This commit was manufactured by cvs2svn to create branch 'binutils-
2_10-branch'.

Sprout from cygnus 2000-02-22 16:18:13 UTC Ian Lance Taylor <ian@airs.com> 'import libiberty from egcs'
Cherrypick from master 2000-04-02 08:24:54 UTC Richard Henderson <rth@redhat.com> '        * config/tc-d30v.c (check_range): Allow signed or unsigned 32-bit':
    ChangeLog
    Makefile.in
    bfd/ChangeLog
    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-ns32k.c
    bfd/aout-target.h
    bfd/aout-tic30.c
    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/cisco-core.c
    bfd/coff-a29k.c
    bfd/coff-alpha.c
    bfd/coff-apollo.c
    bfd/coff-arm.c
    bfd/coff-go32.c
    bfd/coff-h8300.c
    bfd/coff-h8500.c
    bfd/coff-i386.c
    bfd/coff-i860.c
    bfd/coff-i960.c
    bfd/coff-m68k.c
    bfd/coff-m88k.c
    bfd/coff-mcore.c
    bfd/coff-mips.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-tic80.c
    bfd/coff-w65.c
    bfd/coff-we32k.c
    bfd/coff-z8k.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/cpu-arm.c
    bfd/cpu-avr.c
    bfd/cpu-d10v.c
    bfd/cpu-h8500.c
    bfd/cpu-hppa.c
    bfd/cpu-i370.c
    bfd/cpu-m10300.c
    bfd/cpu-m32r.c
    bfd/cpu-mcore.c
    bfd/cpu-ns32k.c
    bfd/cpu-pj.c
    bfd/cpu-sh.c
    bfd/cpu-w65.c
    bfd/doc/Makefile.in
    bfd/dwarf1.c
    bfd/dwarf2.c
    bfd/ecoff.c
    bfd/ecofflink.c
    bfd/elf-bfd.h
    bfd/elf-hppa.h
    bfd/elf-m10200.c
    bfd/elf-m10300.c
    bfd/elf.c
    bfd/elf32-arc.c
    bfd/elf32-arm.h
    bfd/elf32-avr.c
    bfd/elf32-d10v.c
    bfd/elf32-d30v.c
    bfd/elf32-fr30.c
    bfd/elf32-gen.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-m68k.c
    bfd/elf32-m88k.c
    bfd/elf32-mcore.c
    bfd/elf32-mips.c
    bfd/elf32-pj.c
    bfd/elf32-ppc.c
    bfd/elf32-sh.c
    bfd/elf32-sparc.c
    bfd/elf32-v850.c
    bfd/elf64-alpha.c
    bfd/elf64-gen.c
    bfd/elf64-mips.c
    bfd/elf64-sparc.c
    bfd/elfarm-nabi.c
    bfd/elfarm-oabi.c
    bfd/elfcode.h
    bfd/elflink.c
    bfd/elflink.h
    bfd/elfxx-target.h
    bfd/epoc-pe-arm.c
    bfd/epoc-pei-arm.c
    bfd/freebsd.h
    bfd/hash.c
    bfd/hosts/alphalinux.h
    bfd/hp300hpux.c
    bfd/hppabsd-core.c
    bfd/hpux-core.c
    bfd/i386linux.c
    bfd/i386lynx.c
    bfd/i386msdos.c
    bfd/i386os9k.c
    bfd/ieee.c
    bfd/ihex.c
    bfd/irix-core.c
    bfd/libbfd-in.h
    bfd/libbfd.c
    bfd/libbfd.h
    bfd/libcoff-in.h
    bfd/libcoff.h
    bfd/libecoff.h
    bfd/libhppa.h
    bfd/libpei.h
    bfd/linker.c
    bfd/m68klinux.c
    bfd/mipsbsd.c
    bfd/netbsd-core.c
    bfd/netbsd.h
    bfd/nlm-target.h
    bfd/nlm32-ppc.c
    bfd/nlm32-sparc.c
    bfd/nlmcode.h
    bfd/oasys.c
    bfd/osf-core.c
    bfd/pc532-mach.c
    bfd/pe-arm.c
    bfd/pe-i386.c
    bfd/pe-mips.c
    bfd/pe-ppc.c
    bfd/pe-sh.c
    bfd/pei-arm.c
    bfd/pei-i386.c
    bfd/pei-mcore.c
    bfd/pei-mips.c
    bfd/pei-ppc.c
    bfd/pei-sh.c
    bfd/peicode.h
    bfd/peigen.c
    bfd/po/POTFILES.in
    bfd/po/bfd.pot
    bfd/ppcboot.c
    bfd/ptrace-core.c
    bfd/reloc.c
    bfd/reloc16.c
    bfd/riscix.c
    bfd/rs6000-core.c
    bfd/sco5-core.c
    bfd/section.c
    bfd/som.c
    bfd/sparclinux.c
    bfd/srec.c
    bfd/stabs.c
    bfd/sunos.c
    bfd/syms.c
    bfd/targets.c
    bfd/tekhex.c
    bfd/trad-core.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/xcofflink.c
    binutils/ChangeLog
    binutils/Makefile.am
    binutils/Makefile.in
    binutils/NEWS
    binutils/aclocal.m4
    binutils/addr2line.c
    binutils/ar.1
    binutils/ar.c
    binutils/arparse.y
    binutils/arsup.c
    binutils/binutils.texi
    binutils/config.in
    binutils/configure
    binutils/configure.in
    binutils/debug.c
    binutils/deflex.l
    binutils/defparse.y
    binutils/dlltool.c
    binutils/dllwrap.c
    binutils/dyn-string.c
    binutils/dyn-string.h
    binutils/filemode.c
    binutils/ieee.c
    binutils/nm.c
    binutils/objcopy.1
    binutils/objcopy.c
    binutils/objdump.c
    binutils/po/POTFILES.in
    binutils/po/binutils.pot
    binutils/prdbg.c
    binutils/rclex.l
    binutils/rcparse.y
    binutils/rdcoff.c
    binutils/rddbg.c
    binutils/readelf.c
    binutils/rename.c
    binutils/rescoff.c
    binutils/resrc.c
    binutils/resres.c
    binutils/size.c
    binutils/stabs.c
    binutils/strings.1
    binutils/strings.c
    binutils/testsuite/ChangeLog
    binutils/testsuite/binutils-all/hppa/freg.s
    binutils/testsuite/binutils-all/hppa/objdump.exp
    binutils/testsuite/binutils-all/objcopy.exp
    binutils/testsuite/binutils-all/objdump.exp
    binutils/testsuite/binutils-all/readelf.h
    binutils/testsuite/binutils-all/readelf.r
    binutils/testsuite/binutils-all/readelf.s
    binutils/testsuite/binutils-all/readelf.ss
    binutils/testsuite/binutils-all/readelf.wi
    binutils/testsuite/binutils-all/testprog.c
    binutils/windres.c
    binutils/windres.h
    binutils/wrstabs.c
    config.guess
    config.sub
    config/ChangeLog
    config/mh-i370pic
    config/mt-aix43
    config/mt-i370pic
    config/mt-wince
    configure
    configure.in
    gas/ChangeLog
    gas/Makefile.am
    gas/Makefile.in
    gas/NEWS
    gas/aclocal.m4
    gas/app.c
    gas/as.c
    gas/as.h
    gas/atof-generic.c
    gas/cgen.c
    gas/cond.c
    gas/config/atof-ieee.c
    gas/config/atof-vax.c
    gas/config/e-i386aout.c
    gas/config/m68k-parse.h
    gas/config/obj-aout.c
    gas/config/obj-aout.h
    gas/config/obj-bout.c
    gas/config/obj-coff.c
    gas/config/obj-coff.h
    gas/config/obj-ecoff.c
    gas/config/obj-ecoff.h
    gas/config/obj-elf.c
    gas/config/obj-elf.h
    gas/config/obj-evax.h
    gas/config/obj-multi.h
    gas/config/obj-som.c
    gas/config/obj-vms.h
    gas/config/tc-alpha.c
    gas/config/tc-alpha.h
    gas/config/tc-arc.c
    gas/config/tc-arc.h
    gas/config/tc-arm.c
    gas/config/tc-arm.h
    gas/config/tc-avr.c
    gas/config/tc-avr.h
    gas/config/tc-d10v.c
    gas/config/tc-d10v.h
    gas/config/tc-d30v.c
    gas/config/tc-d30v.h
    gas/config/tc-fr30.c
    gas/config/tc-h8300.c
    gas/config/tc-hppa.c
    gas/config/tc-hppa.h
    gas/config/tc-i370.c
    gas/config/tc-i370.h
    gas/config/tc-i386.c
    gas/config/tc-i386.h
    gas/config/tc-i860.c
    gas/config/tc-i960.c
    gas/config/tc-i960.h
    gas/config/tc-m32r.c
    gas/config/tc-m68k.c
    gas/config/tc-m68k.h
    gas/config/tc-m88k.c
    gas/config/tc-m88k.h
    gas/config/tc-mcore.c
    gas/config/tc-mcore.h
    gas/config/tc-mips.c
    gas/config/tc-mips.h
    gas/config/tc-mn10200.c
    gas/config/tc-mn10300.c
    gas/config/tc-ns32k.c
    gas/config/tc-ns32k.h
    gas/config/tc-pj.c
    gas/config/tc-pj.h
    gas/config/tc-ppc.c
    gas/config/tc-ppc.h
    gas/config/tc-sh.c
    gas/config/tc-sh.h
    gas/config/tc-sparc.c
    gas/config/tc-sparc.h
    gas/config/tc-tahoe.c
    gas/config/tc-tic30.c
    gas/config/tc-v850.c
    gas/config/tc-vax.c
    gas/config/tc-w65.c
    gas/config/tc-z8k.c
    gas/config/te-go32.h
    gas/config/te-interix.h
    gas/config/te-wince-pe.h
    gas/configure
    gas/configure.in
    gas/dep-in.sed
    gas/doc/Makefile.am
    gas/doc/Makefile.in
    gas/doc/all.texi
    gas/doc/as.1
    gas/doc/as.texinfo
    gas/doc/c-arm.texi
    gas/doc/c-i370.texi
    gas/doc/c-i386.texi
    gas/doc/c-m32r.texi
    gas/doc/c-mips.texi
    gas/doc/c-pj.texi
    gas/doc/c-sparc.texi
    gas/doc/internals.texi
    gas/dwarf2dbg.c
    gas/dwarf2dbg.h
    gas/ecoff.c
    gas/ecoff.h
    gas/expr.c
    gas/expr.h
    gas/frags.c
    gas/frags.h
    gas/gasp.c
    gas/hash.c
    gas/hash.h
    gas/input-file.c
    gas/input-scrub.c
    gas/itbl-ops.c
    gas/itbl-ops.h
    gas/listing.c
    gas/macro.c
    gas/macro.h
    gas/obj.h
    gas/output-file.c
    gas/po/POTFILES.in
    gas/po/gas.pot
    gas/read.c
    gas/read.h
    gas/sb.h
    gas/stabs.c
    gas/struc-symbol.h
    gas/subsegs.c
    gas/symbols.c
    gas/symbols.h
    gas/testsuite/ChangeLog
    gas/testsuite/gas/all/cond.d
    gas/testsuite/gas/all/gas.exp
    gas/testsuite/gas/all/itbl-test.c
    gas/testsuite/gas/arm/arm7t.d
    gas/testsuite/gas/arm/arm7t.s
    gas/testsuite/gas/arm/float.s
    gas/testsuite/gas/arm/inst.d
    gas/testsuite/gas/arm/inst.s
    gas/testsuite/gas/arm/thumb.s
    gas/testsuite/gas/d10v/d10.exp
    gas/testsuite/gas/d10v/inst.d
    gas/testsuite/gas/d10v/inst.s
    gas/testsuite/gas/elf/elf.exp
    gas/testsuite/gas/elf/section0.d
    gas/testsuite/gas/elf/section0.s
    gas/testsuite/gas/elf/section1.d
    gas/testsuite/gas/elf/section1.s
    gas/testsuite/gas/hppa/basic/add.s
    gas/testsuite/gas/hppa/basic/add2.s
    gas/testsuite/gas/hppa/basic/addi.s
    gas/testsuite/gas/hppa/basic/basic.exp
    gas/testsuite/gas/hppa/basic/branch.s
    gas/testsuite/gas/hppa/basic/branch2.s
    gas/testsuite/gas/hppa/basic/comclr.s
    gas/testsuite/gas/hppa/basic/copr.s
    gas/testsuite/gas/hppa/basic/coprmem.s
    gas/testsuite/gas/hppa/basic/dcor.s
    gas/testsuite/gas/hppa/basic/dcor2.s
    gas/testsuite/gas/hppa/basic/deposit.s
    gas/testsuite/gas/hppa/basic/deposit2.s
    gas/testsuite/gas/hppa/basic/deposit3.s
    gas/testsuite/gas/hppa/basic/ds.s
    gas/testsuite/gas/hppa/basic/extract.s
    gas/testsuite/gas/hppa/basic/extract2.s
    gas/testsuite/gas/hppa/basic/extract3.s
    gas/testsuite/gas/hppa/basic/fmem.s
    gas/testsuite/gas/hppa/basic/fp_comp.s
    gas/testsuite/gas/hppa/basic/fp_comp2.s
    gas/testsuite/gas/hppa/basic/fp_conv.s
    gas/testsuite/gas/hppa/basic/fp_fcmp.s
    gas/testsuite/gas/hppa/basic/fp_misc.s
    gas/testsuite/gas/hppa/basic/imem.s
    gas/testsuite/gas/hppa/basic/immed.s
    gas/testsuite/gas/hppa/basic/logical.s
    gas/testsuite/gas/hppa/basic/media.s
    gas/testsuite/gas/hppa/basic/perf.s
    gas/testsuite/gas/hppa/basic/purge.s
    gas/testsuite/gas/hppa/basic/purge2.s
    gas/testsuite/gas/hppa/basic/sh1add.s
    gas/testsuite/gas/hppa/basic/sh2add.s
    gas/testsuite/gas/hppa/basic/sh3add.s
    gas/testsuite/gas/hppa/basic/shift.s
    gas/testsuite/gas/hppa/basic/shift2.s
    gas/testsuite/gas/hppa/basic/shift3.s
    gas/testsuite/gas/hppa/basic/shladd.s
    gas/testsuite/gas/hppa/basic/shladd2.s
    gas/testsuite/gas/hppa/basic/special.s
    gas/testsuite/gas/hppa/basic/spop.s
    gas/testsuite/gas/hppa/basic/sub.s
    gas/testsuite/gas/hppa/basic/sub2.s
    gas/testsuite/gas/hppa/basic/subi.s
    gas/testsuite/gas/hppa/basic/system.s
    gas/testsuite/gas/hppa/basic/system2.s
    gas/testsuite/gas/hppa/basic/unit.s
    gas/testsuite/gas/hppa/basic/unit2.s
    gas/testsuite/gas/hppa/parse/align1.s
    gas/testsuite/gas/hppa/parse/align2.s
    gas/testsuite/gas/hppa/parse/badfmpyadd.s
    gas/testsuite/gas/hppa/parse/block1.s
    gas/testsuite/gas/hppa/parse/block2.s
    gas/testsuite/gas/hppa/parse/calldatabug.s
    gas/testsuite/gas/hppa/parse/callinfobug.s
    gas/testsuite/gas/hppa/parse/defbug.s
    gas/testsuite/gas/hppa/parse/entrybug.s
    gas/testsuite/gas/hppa/parse/exportbug.s
    gas/testsuite/gas/hppa/parse/exprbug.s
    gas/testsuite/gas/hppa/parse/fixup7bug.s
    gas/testsuite/gas/hppa/parse/global.s
    gas/testsuite/gas/hppa/parse/labelbug.s
    gas/testsuite/gas/hppa/parse/linesepbug.s
    gas/testsuite/gas/hppa/parse/lselbug.s
    gas/testsuite/gas/hppa/parse/parse.exp
    gas/testsuite/gas/hppa/parse/procbug.s
    gas/testsuite/gas/hppa/parse/regpopbug.s
    gas/testsuite/gas/hppa/parse/stdreg.s
    gas/testsuite/gas/hppa/parse/stringer.s
    gas/testsuite/gas/hppa/parse/undefbug.s
    gas/testsuite/gas/hppa/parse/versionbug.s
    gas/testsuite/gas/hppa/parse/xmpyubug.s
    gas/testsuite/gas/hppa/reloc/applybug.s
    gas/testsuite/gas/hppa/reloc/blebug.s
    gas/testsuite/gas/hppa/reloc/blebug2.s
    gas/testsuite/gas/hppa/reloc/blebug3.s
    gas/testsuite/gas/hppa/reloc/exitbug.s
    gas/testsuite/gas/hppa/reloc/fixupbug.s
    gas/testsuite/gas/hppa/reloc/funcrelocbug.s
    gas/testsuite/gas/hppa/reloc/labelopbug.s
    gas/testsuite/gas/hppa/reloc/longcall.s
    gas/testsuite/gas/hppa/reloc/picreloc.s
    gas/testsuite/gas/hppa/reloc/plabelbug.s
    gas/testsuite/gas/hppa/reloc/r_no_reloc.s
    gas/testsuite/gas/hppa/reloc/reduce.s
    gas/testsuite/gas/hppa/reloc/reduce3.s
    gas/testsuite/gas/hppa/reloc/reloc.exp
    gas/testsuite/gas/hppa/reloc/roundmode.s
    gas/testsuite/gas/hppa/reloc/selectorbug.s
    gas/testsuite/gas/hppa/unsorted/brlenbug.s
    gas/testsuite/gas/hppa/unsorted/common.s
    gas/testsuite/gas/hppa/unsorted/fragbug.s
    gas/testsuite/gas/hppa/unsorted/importbug.s
    gas/testsuite/gas/hppa/unsorted/labeldiffs.s
    gas/testsuite/gas/hppa/unsorted/locallabel.s
    gas/testsuite/gas/hppa/unsorted/unsorted.exp
    gas/testsuite/gas/i386/amd.d
    gas/testsuite/gas/i386/amd.s
    gas/testsuite/gas/i386/float.l
    gas/testsuite/gas/i386/float.s
    gas/testsuite/gas/i386/general.l
    gas/testsuite/gas/i386/general.s
    gas/testsuite/gas/i386/i386.exp
    gas/testsuite/gas/i386/intel.d
    gas/testsuite/gas/i386/intel.s
    gas/testsuite/gas/i386/jump.d
    gas/testsuite/gas/i386/jump.s
    gas/testsuite/gas/i386/jump16.d
    gas/testsuite/gas/i386/jump16.s
    gas/testsuite/gas/i386/katmai.d
    gas/testsuite/gas/i386/katmai.s
    gas/testsuite/gas/i386/modrm.l
    gas/testsuite/gas/i386/modrm.s
    gas/testsuite/gas/i386/naked.d
    gas/testsuite/gas/i386/naked.s
    gas/testsuite/gas/i386/opcode.d
    gas/testsuite/gas/i386/prefix.d
    gas/testsuite/gas/i386/prefix.s
    gas/testsuite/gas/i386/reloc.d
    gas/testsuite/gas/i386/reloc.s
    gas/testsuite/gas/i386/white.l
    gas/testsuite/gas/i386/white.s
    gas/testsuite/gas/ieee-fp/x930509a.exp
    gas/testsuite/gas/m32r/error.exp
    gas/testsuite/gas/m32r/fslotx.d
    gas/testsuite/gas/m32r/fslotx.s
    gas/testsuite/gas/m32r/interfere.s
    gas/testsuite/gas/m32r/m32rx.d
    gas/testsuite/gas/m32r/m32rx.exp
    gas/testsuite/gas/m32r/m32rx.s
    gas/testsuite/gas/m32r/relax-2.d
    gas/testsuite/gas/m32r/relax-2.s
    gas/testsuite/gas/m32r/wrongsize.s
    gas/testsuite/gas/macros/irp.d
    gas/testsuite/gas/macros/irp.s
    gas/testsuite/gas/macros/rept.d
    gas/testsuite/gas/macros/rept.s
    gas/testsuite/gas/macros/test2.d
    gas/testsuite/gas/macros/test2.s
    gas/testsuite/gas/macros/test3.d
    gas/testsuite/gas/macros/test3.s
    gas/testsuite/gas/mcore/allinsn.d
    gas/testsuite/gas/mips/e32-rel2.d
    gas/testsuite/gas/mips/elf-rel.d
    gas/testsuite/gas/mips/elf-rel.s
    gas/testsuite/gas/mips/elf-rel2.d
    gas/testsuite/gas/mips/elf-rel2.s
    gas/testsuite/gas/mips/elf_e_flags.c
    gas/testsuite/gas/mips/elf_e_flags.s
    gas/testsuite/gas/mips/elf_e_flags1.d
    gas/testsuite/gas/mips/elf_e_flags2.d
    gas/testsuite/gas/mips/elf_e_flags3.d
    gas/testsuite/gas/mips/elf_e_flags4.d
    gas/testsuite/gas/mips/empic.d
    gas/testsuite/gas/mips/empic.s
    gas/testsuite/gas/mips/la-svr4pic.d
    gas/testsuite/gas/mips/la-xgot.d
    gas/testsuite/gas/mips/la.d
    gas/testsuite/gas/mips/mips.exp
    gas/testsuite/gas/mips/mips16-e.d
    gas/testsuite/gas/mips/mips16-e.s
    gas/testsuite/gas/mips/mips16-f.d
    gas/testsuite/gas/mips/mips16-f.s
    gas/testsuite/gas/mips/sync.d
    gas/testsuite/gas/mn10300/am33.s
    gas/testsuite/gas/mn10300/am33_2.s
    gas/testsuite/gas/mn10300/am33_3.s
    gas/testsuite/gas/mn10300/am33_4.s
    gas/testsuite/gas/mn10300/am33_5.s
    gas/testsuite/gas/mn10300/am33_6.s
    gas/testsuite/gas/mn10300/am33_7.s
    gas/testsuite/gas/mn10300/am33_8.s
    gas/testsuite/gas/mn10300/basic.exp
    gas/testsuite/gas/pj/ops.d
    gas/testsuite/gas/pj/ops.s
    gas/testsuite/gas/pj/pj.exp
    gas/testsuite/gas/sparc/prefetch.d
    gas/testsuite/gas/sparc/rdpr.d
    gas/testsuite/gas/sparc/reloc64.d
    gas/testsuite/gas/sparc/set64.d
    gas/testsuite/gas/sparc/set64.s
    gas/testsuite/gas/sparc/sparc.exp
    gas/testsuite/gas/sparc/synth64.d
    gas/testsuite/gas/sparc/synth64.s
    gas/testsuite/gas/sparc/wrpr.d
    gas/testsuite/gas/vtable/vtable.exp
    gas/testsuite/lib/gas-defs.exp
    gas/write.c
    gprof/ChangeLog
    gprof/Makefile.am
    gprof/Makefile.in
    gprof/alpha.c
    gprof/basic_blocks.c
    gprof/call_graph.c
    gprof/cg_dfn.c
    gprof/configure
    gprof/configure.in
    gprof/corefile.c
    gprof/gmon_io.c
    gprof/gprof.texi
    gprof/hertz.h
    gprof/hist.c
    gprof/i386.c
    gprof/po/POTFILES.in
    gprof/po/gprof.pot
    gprof/sparc.c
    gprof/sym_ids.c
    gprof/symtab.c
    gprof/tahoe.c
    gprof/utils.c
    gprof/vax.c
    include/ChangeLog
    include/ansidecl.h
    include/aout/ChangeLog
    include/aout/aout64.h
    include/bfdlink.h
    include/coff/ChangeLog
    include/coff/arm.h
    include/coff/internal.h
    include/coff/mcore.h
    include/coff/mipspe.h
    include/coff/pe.h
    include/coff/sh.h
    include/dis-asm.h
    include/elf/ChangeLog
    include/elf/arm-oabi.h
    include/elf/arm.h
    include/elf/avr.h
    include/elf/common.h
    include/elf/dwarf.h
    include/elf/dwarf2.h
    include/elf/hppa.h
    include/elf/i370.h
    include/elf/i386.h
    include/elf/i960.h
    include/elf/m32r.h
    include/elf/m68k.h
    include/elf/mcore.h
    include/elf/mips.h
    include/elf/mn10300.h
    include/elf/pj.h
    include/elf/reloc-macros.h
    include/elf/sh.h
    include/elf/sparc.h
    include/hashtab.h
    include/hp-symtab.h
    include/opcode/ChangeLog
    include/opcode/alpha.h
    include/opcode/cgen.h
    include/opcode/d10v.h
    include/opcode/d30v.h
    include/opcode/hppa.h
    include/opcode/i370.h
    include/opcode/i386.h
    include/opcode/m68k.h
    include/opcode/mips.h
    include/opcode/mn10300.h
    include/opcode/pj.h
    include/opcode/ppc.h
    include/partition.h
    include/remote-sim.h
    include/sim-d10v.h
    ld/ChangeLog
    ld/Makefile.am
    ld/Makefile.in
    ld/NEWS
    ld/aclocal.m4
    ld/config.in
    ld/configure
    ld/configure.host
    ld/configure.in
    ld/configure.tgt
    ld/deffile.h
    ld/deffilep.y
    ld/emulparams/arm_epoc_pe.sh
    ld/emulparams/armelf.sh
    ld/emulparams/armelf_linux.sh
    ld/emulparams/armelf_linux26.sh
    ld/emulparams/armelf_oabi.sh
    ld/emulparams/armnbsd.sh
    ld/emulparams/armpe.sh
    ld/emulparams/avr1200.sh
    ld/emulparams/avr23xx.sh
    ld/emulparams/avr4433.sh
    ld/emulparams/avr44x4.sh
    ld/emulparams/avr85xx.sh
    ld/emulparams/avrmega103.sh
    ld/emulparams/avrmega161.sh
    ld/emulparams/avrmega603.sh
    ld/emulparams/d10velf.sh
    ld/emulparams/elf32_i960.sh
    ld/emulparams/elf32bmipn32.sh
    ld/emulparams/elf32i370.sh
    ld/emulparams/elf32mcore.sh
    ld/emulparams/elf32ppc.sh
    ld/emulparams/elf32ppclinux.sh
    ld/emulparams/elf64_sparc.sh
    ld/emulparams/elf64bmip.sh
    ld/emulparams/elf64hppa.sh
    ld/emulparams/i386pe.sh
    ld/emulparams/i386pe_posix.sh
    ld/emulparams/mcorepe.sh
    ld/emulparams/mipspe.sh
    ld/emulparams/pjelf.sh
    ld/emulparams/pjlelf.sh
    ld/emulparams/ppcpe.sh
    ld/emulparams/shpe.sh
    ld/emultempl/aix.em
    ld/emultempl/armcoff.em
    ld/emultempl/armelf.em
    ld/emultempl/armelf_oabi.em
    ld/emultempl/astring.sed
    ld/emultempl/beos.em
    ld/emultempl/elf32.em
    ld/emultempl/generic.em
    ld/emultempl/gld960.em
    ld/emultempl/gld960c.em
    ld/emultempl/hppaelf.em
    ld/emultempl/linux.em
    ld/emultempl/lnk960.em
    ld/emultempl/mipsecoff.em
    ld/emultempl/ostring.sed
    ld/emultempl/pe.em
    ld/emultempl/sunos.em
    ld/emultempl/vanilla.em
    ld/genscripts.sh
    ld/ld.h
    ld/ld.texinfo
    ld/ldcref.c
    ld/ldemul.c
    ld/ldemul.h
    ld/ldexp.c
    ld/ldfile.c
    ld/ldfile.h
    ld/ldgram.y
    ld/ldlang.c
    ld/ldlang.h
    ld/ldmain.c
    ld/ldmisc.c
    ld/lexsup.c
    ld/mri.c
    ld/pe-dll.c
    ld/pe-dll.h
    ld/po/POTFILES.in
    ld/po/ld.pot
    ld/scripttempl/armcoff.sc
    ld/scripttempl/elf.sc
    ld/scripttempl/elf32avr.sc
    ld/scripttempl/elfd10v.sc
    ld/scripttempl/elfi370.sc
    ld/scripttempl/epocpe.sc
    ld/scripttempl/i386go32.sc
    ld/scripttempl/mcorepe.sc
    ld/scripttempl/pe.sc
    ld/scripttempl/pj.sc
    ld/scripttempl/v850.sc
    ld/testsuite/ChangeLog
    ld/testsuite/ld-cdtest/cdtest-foo.cc
    ld/testsuite/ld-cdtest/cdtest-main.cc
    ld/testsuite/ld-checks/asm.s
    ld/testsuite/ld-checks/checks.exp
    ld/testsuite/ld-elfvers/vers.exp
    ld/testsuite/ld-elfvers/vers1.c
    ld/testsuite/ld-elfvers/vers15.c
    ld/testsuite/ld-elfvers/vers17.c
    ld/testsuite/ld-elfvers/vers17.dsym
    ld/testsuite/ld-elfvers/vers17.map
    ld/testsuite/ld-elfvers/vers17.ver
    ld/testsuite/ld-elfvers/vers18.c
    ld/testsuite/ld-elfvers/vers18.dsym
    ld/testsuite/ld-elfvers/vers18.map
    ld/testsuite/ld-elfvers/vers18.sym
    ld/testsuite/ld-elfvers/vers18.ver
    ld/testsuite/ld-elfvers/vers19.c
    ld/testsuite/ld-elfvers/vers19.dsym
    ld/testsuite/ld-elfvers/vers19.ver
    ld/testsuite/ld-elfvers/vers2.c
    ld/testsuite/ld-elfvers/vers3.c
    ld/testsuite/ld-elfvers/vers4.c
    ld/testsuite/ld-elfvers/vers6.c
    ld/testsuite/ld-elfvers/vers7.c
    ld/testsuite/ld-elfvers/vers9.c
    ld/testsuite/ld-scripts/phdrs.exp
    ld/testsuite/ld-scripts/phdrs.t
    ld/testsuite/ld-scripts/script.exp
    ld/testsuite/ld-scripts/weak.exp
    ld/testsuite/ld-selective/selective.exp
    ld/testsuite/ld-shared/main.c
    ld/testsuite/ld-shared/sh1.c
    ld/testsuite/ld-shared/shared.exp
    ld/testsuite/ld-srec/sr3.cc
    ld/testsuite/ld-srec/srec.exp
    ld/testsuite/ld-undefined/undefined.exp
    ld/testsuite/lib/ld-lib.exp
    libiberty/ChangeLog
    libiberty/Makefile.in
    libiberty/argv.c
    libiberty/choose-temp.c
    libiberty/config.in
    libiberty/configure
    libiberty/configure.in
    libiberty/cplus-dem.c
    libiberty/floatformat.c
    libiberty/getruntime.c
    libiberty/hashtab.c
    libiberty/partition.c
    libiberty/pexecute.c
    libiberty/splay-tree.c
    libiberty/vasprintf.c
    libiberty/xmalloc.c
    ltconfig
    ltmain.sh
    mkdep
    opcodes/ChangeLog
    opcodes/Makefile.am
    opcodes/Makefile.in
    opcodes/aclocal.m4
    opcodes/alpha-dis.c
    opcodes/alpha-opc.c
    opcodes/arm-dis.c
    opcodes/arm-opc.h
    opcodes/avr-dis.c
    opcodes/cgen-opc.c
    opcodes/configure
    opcodes/configure.in
    opcodes/d10v-opc.c
    opcodes/d30v-dis.c
    opcodes/d30v-opc.c
    opcodes/dis-buf.c
    opcodes/disassemble.c
    opcodes/fr30-asm.c
    opcodes/fr30-desc.h
    opcodes/fr30-dis.c
    opcodes/fr30-ibld.c
    opcodes/fr30-opc.c
    opcodes/hppa-dis.c
    opcodes/i370-dis.c
    opcodes/i370-opc.c
    opcodes/i386-dis.c
    opcodes/m10300-dis.c
    opcodes/m10300-opc.c
    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/m32r-opc.h
    opcodes/m32r-opinst.c
    opcodes/m68k-dis.c
    opcodes/m68k-opc.c
    opcodes/mcore-dis.c
    opcodes/mcore-opc.h
    opcodes/mips-dis.c
    opcodes/mips-opc.c
    opcodes/pj-dis.c
    opcodes/pj-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
    texinfo/texinfo.tex
Delete:
    bfd/configure.bat
    bfd/makefile.dos
    binutils/configure.bat
    config/mh-aix43
    configure.bat
    gas/config/go32.cfg
    gas/config/te-multi.h
    gas/configure.bat
    gprof/configure.bat
    include/wait.h
    intl/ChangeLog.Cygnus
    ld/configure.bat
    ld/emulparams/go32.sh
    ld/emultempl/stringify.sed
    ld/scripttempl/go32coff.sc
    ld/testsuite/ld-selective/5.cc
    libiberty/configure.bat
    libiberty/makefile.dos
    makeall.bat
    opcodes/configure.bat
diff --git a/ChangeLog b/ChangeLog
index 2604b21..78a8122 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,147 @@
+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.
+	(do-tar-bz2): Replace TOOL with PACKAGE.
+	(gdb.tar.bz2): Remove GDBTK from GDB package.
+	(gdb+dejagnu.tar.bz2, insight.tar.bz2, insight+dejagnu.tar.bz2,
+ 	dejagnu.tar.bz2): New packages.
+
+2000-02-27  Andreas Jaeger  <aj@suse.de>
+
+	* configure.in: Add entry for mips*-*-linux*, move catch all
+	*-*-*linux* entry below this one.
+
+2000-02-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* ltconfig, ltmain.sh: Update to libtool 1.3.4.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* config.sub: Support an OS of "wince".
+
+Thu Feb 24 16:15:56 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config.guess, config.sub: Updated to match config's 2000-02-15
+ 	version.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* config.sub: Add support for Linux/IBM 370.
+	* configure.in: Likewise.
+
+2000-02-22  Nick Clifton  <nickc@cygnus.com>
+
+	* configure.in: Add mips-pe, sh-pe and arm-wince-pe targets.
+
+2000-02-20  Christopher Faylor <cgf@cygnus.com>
+
+	* config.guess: Guess "cygwin" rather than "cygwin32".
+
+2000-02-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* configure (gcc_version): When setting, narrow search to
+	lines containing `version_string'.
+
+2000-01-06  Geoff Keating  <geoffk@cygnus.com>
+
+	* configure.in: Use mt-aix43 to handle *_TARGET defs,
+	not mh-aix43.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* config.sub: Add support for configuring for pj.
+
+1999-08-31  Nick Clifton  <nickc@cygnus.com>
+
+	* config.sub (maybe_os): Add support for configuring for fr30.
+
+1999-08-27  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.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.in (LDFLAGS): Define.
+
+1999-08-08  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* configure.in (i[3456]-*-mingw32*): Don't put gprof in
+	noconfigdirs.
+	(*-*-cygwin*): Likewise.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* mkdep: New file.
+	* Makefile.in (GAS_SUPPORT_DIRS): Add mkdep.
+	(BINUTILS_SUPPORT_DIRS): Add mkdep.
+
+	From Eli Zaretskii <eliz@is.elta.co.il>:
+	* configure (tmpfile): Change cONf$$ to cNf$$ to avoid an overly
+	long file name when using DJGPP on MS-DOS.
+
+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"
+
+1999-07-22  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.in (binutils.tar.bz2): Don't pass makeall.bat and
+	configure.bat in SUPPORT_FILES.
+	(gas+binutils.tar.bz2): Likewise.
+
+	* makeall.bat: Remove; obsolete.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* configure.bat: Remove; obsolete.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure: Add -W -Wall to the default CFLAGS when compiling with
+	gcc.
+
+Thu Jul  8 12:32:23 1999  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* configure.in: Build ld, binutils & gas for hppa*-*-linux-gnu*.
+
+1999-06-30  Mark Mitchell  <mark@codesourcery.com>
+
+	* configure.in: Build ld on IRIX6.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.in: Change distribution targets to use bzip2 instead of
+	gzip.
+	(TEXINFO_SUPPORT): Set to just texinfo/texinfo.tex.
+	(taz): Don't use texinfo/gpl.texinfo or texinfo/lgpl.texinfo.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* config.sub: Add mcore target.
+
+Sun May 30 16:03:16 1999  Cort Dougan  <cort@cs.nmt.edu>
+
+	* config.guess (ppc-*-linux-gnu): Also use ld emul elf32ppclinux.
+
+1999-05-24  Nick Clifton  <nickc@cygnus.com>
+
+	* config.sub: Updated to match latest EGCS version.
+
 1999-04-30  Tom Tromey  <tromey@cygnus.com>
 
 	* ltmain.sh: [mode link] Always use CC given by ltconfig.
@@ -131,7 +275,7 @@
 
 	Patch from: Scott Bambrough <scottb@corelcomputer.com>
 	
-	* config.guess: Modified to recognize uname's armv* syntax. 
+	* config.guess: Modified to recognize uname's armv* syntax.
 
 	* config.sub: Modified to recognize uname's armv* syntax.
 
@@ -653,6 +797,11 @@
         * 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)
+
+	* Makefile.in (install-gdbtk): Call this 'install-gdb' so that
+	the right GUI libraries and files are installed along with GDB.
+
 Tue Apr 28 18:11:24 1998  Ian Lance Taylor  <ian@cygnus.com>
 
 	* configure.in: Change alpha to alpha* in several places.
@@ -754,6 +903,10 @@
 	(noconfigdirs) [various cases]: Likewise.
 	(host_libs): Added intl.
 
+Thu Mar 26 15:00:11 1998  Keith Seitz  <keiths@onions.cygnus.com>
+
+	* configure: Do not disable building gdbtk for cygwin32 hosts.
+
 Wed Mar 25 11:49:12 1998  Jason Molenda  (crash@bugshack.cygnus.com)
 
 	* Makefile.in: Revert yesterday's change.
@@ -1202,6 +1355,11 @@
 	(all-bootstrap): Remove outdated and confusing target.
 	(bootstrap, bootstrap2, bootstrap3): Don't pass BOOT_CFLAGS down.
 
+Thu Sep 18 15:37:42 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure (tooldir): enable_gdbtk=YES for cygwin32, NO for
+ 	windows.  Consistent with gdb/configure.
+
 
 1997-09-15 02:37  Ulrich Drepper  <drepper@cygnus.com>
 
@@ -2295,6 +2453,7 @@
 
 Sat Jun 15 17:13:25 1996  Geoffrey Noer <noer@cygnus.com>
 
+	* configure: enable_gdbtk=no for cygwin32-hosted toolchains
 	* configure.in: remove make from disable-if-Can-Cross list
 		enable gdb if ${host} and ${target} are cygwin32
 
@@ -2687,6 +2846,12 @@
 	* configure.in: Make sure that ${CC} can be used to compile an
 	executable.
 
+Sat Jan  6 07:23:33 1996  Michael Meissner  <meissner@wogglebug.tiac.net>
+
+	* Makefile.in (all-gdb): Depend on $(GDB_TK).
+	* configure (GDB_TK): Set GDB_TK to either "all-tcl all-tk" or
+	nothing depending on whether gdbtk is being built.
+
 Wed Jan  3 17:54:41 1996  Doug Evans  <dje@canuck.cygnus.com>
 
 	* Makefile.in (newlib.tar.gz): Delete building of newlib's info files.
@@ -3284,6 +3449,11 @@
 	* configure.in (i386-go32 host): Fix typo (deja-gnu -> dejagnu).
 	(i386-win32 host): Likewise.  Don't build readline.
 
+Sat Aug  5 09:51:49 1995  Fred Fish  <fnf@rtl.cygnus.com>
+
+	* Makefile.in (GDBTK_SUPPORT_DIRS):  Define and pass as part of
+	SUPPORT_FILES to submakes.
+
 Fri Aug  4 13:04:36 1995  Fred Fish  <fnf@cygnus.com>
 
 	* Makefile.in (GDB_SUPPORT_DIRS): Add utils.
@@ -3462,6 +3632,11 @@
 	* configure.in: Recognize --with-newlib.
 	(sparc-*-sunos4*): Build sim, dejagnu, expect, tcl if cross target.
 
+Mon Apr 10 14:38:20 1995  Jason Molenda (crash@phydeaux.cygnus.com)
+
+	* Makefile.in: move {all,check,install}-gdb from *_MODULES
+	to *_X11_MODULES due to gdbtk needing X include files et al.
+
 Mon Apr 10 11:42:22 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
 	Merge in support for Mac MPW as a host.
diff --git a/Makefile.in b/Makefile.in
index 7f1bb8c..beab8be 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -84,6 +84,7 @@
 CFLAGS = -g
 CXXFLAGS = -g -O2
 
+LDFLAGS = 
 LIBCFLAGS = $(CFLAGS)
 CFLAGS_FOR_TARGET = $(CFLAGS)
 LDFLAGS_FOR_TARGET = 
@@ -109,8 +110,7 @@
 
 LD = ld
 
-# Not plain GZIP, since gzip looks there for extra command-line options.
-GZIPPROG = gzip
+BZIPPROG = bzip2
 
 # These values are substituted by configure.
 DEFAULT_YACC = yacc
@@ -1584,7 +1584,7 @@
 all-target-libgloss: configure-target-libgloss configure-target-newlib
 configure-target-libio: $(ALL_GCC)
 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
-check-target-libio: all-target-libstdc++
+check-target-libio:
 all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
 all-libiberty:
 configure-target-librx: $(ALL_GCC) configure-target-newlib
@@ -1632,6 +1632,7 @@
 all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
 all-target: $(ALL_TARGET_MODULES)
 install-target: $(INSTALL_TARGET_MODULES)
+install-gdb: install-tcl install-tk install-itcl install-tix install-libgui
 ### other supporting targets
 
 MAKEDIRS= \
@@ -1691,8 +1692,7 @@
 
 .PHONY: taz
 
-taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
-  texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
+taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
 	# Take out texinfo from a few places.
 	sed -e '/^all\.normal: /s/\all-texinfo //' \
 	    -e '/^	install-texinfo /d' \
@@ -1737,8 +1737,6 @@
 	#
 	mkdir proto-toplev/texinfo
 	ln -s ../../texinfo/texinfo.tex		proto-toplev/texinfo/
-	ln -s ../../texinfo/gpl.texinfo		proto-toplev/texinfo/
-	ln -s ../../texinfo/lgpl.texinfo	proto-toplev/texinfo/
 	if test -r texinfo/util/tex3patch ; then \
 	  mkdir proto-toplev/texinfo/util && \
 	  ln -s ../../../texinfo/util/tex3patch	proto-toplev/texinfo/util ; \
@@ -1749,55 +1747,84 @@
 	else \
 	  ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
 	fi; \
-	$(MAKE) -f Makefile.in do-tar-gz TOOL=$(TOOL) VER=$$ver
+	if test x"$(PACKAGE)" = x; then \
+	  package="$(TOOL)"; \
+	else \
+	  package="$(PACKAGE)"; \
+	fi; \
+	$(MAKE) -f Makefile.in do-tar-bz2 TOOL=$(TOOL) VER=$$ver PACKAGE=$$package
 
-do-tar-gz:
-	echo "==> Making $(TOOL)-$(VER).tar.gz"
-	-rm -f $(TOOL)-$(VER)
-	ln -s proto-toplev $(TOOL)-$(VER)
-	tar cfh $(TOOL)-$(VER).tar $(TOOL)-$(VER)
-	$(GZIPPROG) -v -9 $(TOOL)-$(VER).tar
+do-tar-bz2:
+	echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
+	-rm -f $(PACKAGE)-$(VER)
+	ln -s proto-toplev $(PACKAGE)-$(VER)
+	tar cfh $(PACKAGE)-$(VER).tar $(PACKAGE)-$(VER)
+	$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
 
-TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
+TEXINFO_SUPPORT= texinfo/texinfo.tex
 DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
 
-.PHONY: gas.tar.gz
-GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms
-gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
+.PHONY: gas.tar.bz2
+GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms mkdep
+gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
 	$(MAKE) -f Makefile.in taz TOOL=gas \
 		SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
 
 # The FSF "binutils" release includes gprof and ld.
-.PHONY: binutils.tar.gz
-BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms
-binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
+.PHONY: binutils.tar.bz2
+BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep
+binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
 	$(MAKE) -f Makefile.in taz TOOL=binutils \
-		SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
+		SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
 
-.PHONY: gas+binutils.tar.gz
+.PHONY: gas+binutils.tar.bz2
 GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
-gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
+gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
 	$(MAKE) -f Makefile.in taz TOOL=gas \
-		SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
+		SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
 
-.PHONY: libg++.tar.gz
+.PHONY: libg++.tar.bz2
 LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
-libg++.tar.gz: $(DIST_SUPPORT) libg++
+libg++.tar.bz2: $(DIST_SUPPORT) libg++
 	$(MAKE) -f Makefile.in taz TOOL=libg++ \
 		SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
 
 GNATS_SUPPORT_DIRS=include libiberty send-pr
-gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
+gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
 	$(MAKE) -f  Makefile.in taz TOOL=gnats \
 		SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
 
-.PHONY: gdb.tar.gz
+.PHONY: gdb.tar.bz2
 GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils intl
-gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
+gdb.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
 	$(MAKE) -f Makefile.in taz TOOL=gdb \
 		SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
 
-.PHONY: newlib.tar.gz
+.PHONY: dejagnu.tar.bz2
+DEJAGNU_SUPPORT_DIRS=  tcl expect libiberty
+dejagnu.tar.bz2: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
+	$(MAKE) -f Makefile.in taz TOOL=dejagnu \
+		SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
+
+.PHONY: gdb+dejagnu.tar.bz2
+GDBD_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl expect dejagnu
+gdb+dejagnu.tar.bz2: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
+	$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=gdb+dejagnu \
+		SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
+
+.PHONY: insight.tar.bz2
+INSIGHT_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl tk itcl tix libgui
+insight.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
+	$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=insight \
+		SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
+
+.PHONY: insight+dejagnu.tar.bz2
+INSIGHTD_SUPPORT_DIRS= $(INSIGHT_SUPPORT_DIRS) expect dejagnu
+insight+dejagnu.tar.bz2: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
+	$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE="insight+dejagnu" \
+		SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
+
+.PHONY: newlib.tar.bz2
 NEWLIB_SUPPORT_DIRS=libgloss
 # taz configures for the sun4 target which won't configure newlib.
 # We need newlib configured so that the .info files are made.
@@ -1810,7 +1837,7 @@
 # the make distclean.  For now punt on the issue of shipping newlib info files
 # with newlib net releases and wait for a day when some native target (sun4?)
 # supports newlib (if only minimally).
-newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
+newlib.tar.bz2: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
 	$(MAKE) -f Makefile.in taz TOOL=newlib \
 		SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
 		DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 66a5b24..82f7eb5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,3239 @@
+2000-03-31  Thomas de Lellis  <tdel@wrs.com>
+
+	* srec.c : Set CHUNK size to 16 bytes to prevent download failures
+	on some targets.
+	* ihex.c : Ditto.
+
+Wed Mar 30 15:28:00 2000  Donald Lindsay  <dlindsay@cygnus.com>
+
+	* elf32-m32r.c (m32r_elf_generic_reloc): new function.  All
+	HOWTO references to bfd_elf_generic_reloc, that have
+	partial_inplace == true, now use the new function.  The function
+	is based on the recent rewrite of m32r_elf_lo16_reloc(), and
+	extends its fixes to the R_M32R_{16,24,32} relocs.
+	The new logic in m32r_elf_lo16_reloc() has been removed, and
+	it instead calls the new routine to obtain that functionality.
+
+2000-03-27  Alan Modra  <alan@linuxcare.com>
+
+	* elf32-avr.c (elf32_avr_gc_mark_hook, elf32_avr_gc_sweep_hook,
+	elf32_avr_check_relocs, avr_final_link_relocate,
+	elf32_avr_relocate_section, bfd_elf_avr_final_write_processing,
+	elf32_avr_object_p): Add prototypes.
+	(elf32_avr_gc_mark_hook): Add default for h->root.type.
+	(bfd_elf_avr_final_write_processing): Make static.
+
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
+
+	* cpu-avr.c: New file.  BFD support routines for AVR architecture.
+	* archures.c (bfd_architecture): Add AVR architecture.
+	(bfd_archures_list): Add reference to AVR architecture info.
+	* elf.c (prep_headers): Handle bfd_arch_avr.
+	* reloc.c: Add various AVR relocation enums.
+	* targets.c (bfd_elf32_avr_vec): Declare and add to target vector
+	list.
+	* Makefile.am: Add support for AVR elf.
+	* configure.in: Likewise.
+	* config.bfd: Likewise.
+	* Makefile.in: Regenerate.
+	* configure: This too.
+	* bfd-in2.h: And this.
+	* libbfd.h: And this.
+
+2000-03-24  H.J. Lu  <hjl@gnu.org>
+
+	* elf64-alpha.c (elf64_alpha_merge_ind_symbols): Add prototype.
+	(elf64_alpha_find_reloc_at_ofs): Likewise.
+
+2000-03-17  Alan Modra  <alan@linuxcare.com.au>
+
+	* reloc.c (bfd_check_overflow): In case complain_overflow_bitfield,
+	flag an overflow if the bitfield is outside -2**n to 2**n-1.  The
+	allowable range used to be -2**(n-1) to 2**n-1.
+	* reloc.c (_bfd_relocate_contents): Same here.  Also replace
+	"boolean overflow" with "bfd_reloc_status_type flag".
+
+2000-03-14  Doug Evans  <dje@casey.transmeta.com>
+ 
+        * elf32-m32r.c (m32r_elf_lo16_reloc): Rewrite.
+ 
+2000-03-14  Kazu Hirata  <kazu@hxi.com>
+
+	* reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
+	of shrinks properly, including the last reloc.
+
+2000-03-13  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-h8300.c (h8300_reloc16_extra_cases): Fix the sanity
+	check for R_MOVL2.
+
+2000-03-11  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* 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.
+
+2000-03-10  Geoff Keating  <geoffk@cygnus.com>
+
+	* elf32-mips.c (_bfd_mips_elf_relocate_section): Do proper
+	sign-extension and big-endian compensation for
+ 	R_MIPS_64 even in ld -r.
+
+2000-03-10  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* elf32-mips.c (mips_elf_next_relocation): Rename from
+	mips_elf_next_lo16_relocation, and generalize to look
+	for any relocation type.
+	(elf_mips_howto_table): Make R_MIPS_PC16 pcrel_offset.
+	(elf_mips_gnu_rel_hi16): Howto for R_MIPS_GNU_REL_HI16.
+	(elf_mips_gnu_rel_lo16): Howto for R_MIPS_GNU_REL_LO16.
+	(elf_mips_gnu_rel16_s2): Howto for R_MIPS_GNU_REL16_S2.
+	(elf_mips_gnu_pcrel64): Howto for R_MIPS_PC64.
+	(elf_mips_gnu_pcrel32): Howto for R_MIPS_PC32.
+	(bfd_elf32_bfd_reloc_type_lookup): Add new relocs.
+	(mips_rtype_to_howto): Likewise.
+	(mips_elf_calculate_relocation): Handle new relocs.
+	(_bfd_mips_elf_relocate_section): REL_HI16/REL_LO16 relocs
+	are paired.  The addend for R_MIPS_GNU_REL16_S2
+	is shifted right two bits.
+
+2000-03-10  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* reloc.c (bfd_perform_relocation): Undo emacs formatting of
+	comment, and ensure it doesn't happen again.
+	(bfd_install_relocation): Same here.
+	(_bfd_relocate_contents): Don't bother assigning unused signmask
+	shift result.  Fix typos in comments.
+	Remove trailing whitespace throughout file.
+
+2000-03-07  Doug Evans  <dje@casey.transmeta.com>
+
+	* reloc.c (reloc_howto_struct): Fix partial_inplace comment.
+	* bfd-in2.h: Rebuild.
+
+2000-03-06  Nick Clifton  <nickc@cygnus.com>
+
+	* peicode.h (struct pe_ILF_vars): Add sym_ptr_table and
+	sym_ptr_ptr fields.
+	(SIZEOF_ILF_SYM_PTR_TABLE): Define.
+	(SIZEOF_ILF_STRINGS): Redefine.
+	(pe_ILF_make_a_symbol-reloc): New function.  Creates a symbol
+	relative reloc, as opposed to a section relative reloc.
+	(pe_ILF_make_a_symbol): Set the class of local symbols to C_STAT
+	not C_LABEL.
+	Add length of symbol's prefix to string pointer.
+	Store a pointer to the symbol in the symbol pointer table.
+	(pe_ILF_build_a_bfd): Do not build .idata$2 or .idata$7.
+	Initialise the symbol pointer table.
+	Store the hint in the Hint/Name table.
+	Make the jump reloc be symbol realtive, not section relative.
+	Create an import symbol for imported code.
+
+2000-03-06  Catherine Moore  <clm@cygnus.com>
+
+	* elf.c (swap_out_syms):  Check for null type_ptr.
+
+2000-03-01  Hans-Peter Nilsson  <hp@axis.com>
+
+	* aout-target.h (MY(write_object_contents)): Remove unused
+	and unusable "#if CHOOSE_RELOC_SIZE".
+	* pc532-mach.c (MY(write_object_contents)): Ditto.
+	* netbsd.h (MY(write_object_contents)): Ditto.
+	* hp300hpux.c (MY(write_object_contents)): Ditto.
+	* freebsd.h (MY(write_object_contents)): Ditto.
+	* aout-tic30.c (tic30_aout_write_object_contents): Ditto.
+
+2000-02-29  H.J. Lu  <hjl@gnu.org>
+
+	* peicode.h (jtab): Make it static.
+
+	* coff-sh.c (sh_align_load_span): Declared if COFF_WITH_PE is
+	defined and COFF_IMAGE_WITH_PE is not defined.
+	(_bfd_sh_align_load_span): Defined as sh_align_load_span if
+	COFF_WITH_PE is defined and COFF_IMAGE_WITH_PE is not defined.
+
+2000-03-01  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-arm.c (bfd_arm_process_before_allocation): Make
+	'symndx' signed to prevent compile time warning.
+
+	* coff-mcore.c: Remove unused prototype for pe_object_p.
+
+	* coff-sh.c: Add "#ifndef COFF_IMAGE_WITH_PE" around static
+	functions that are not used when COFF_IMAGE_WITH_PE is
+	defined.
+	(struct sh_opcode): Change type of 'flags' field to unsigned
+	long so that it can hold the USESAS flag.
+
+	* coffcode.h (styp_to_sec_flags): Initialise 'target_name'.
+
+	* elf-m10300.c (mn10300_elf_relax_section): Initialise
+        'sym_sec'.
+
+	* elf32-i370.c: Add ATTRIBUTE_UNUSED to unused function
+	parameters.
+	Remove unusued variables and code.
+	(elf_backend_add_symbol_hook): Fix prototype.
+
+	* elf32-m68k.c (elf_m68k_gc_sweep_hook): Initialise 'sgot' and
+	'srelgot'.
+
+	* elf32-mcore.c (mcore_elf_relocate_section): Initialise
+	'oldinst'. 
+
+	* elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
+	parameters.
+	Remove unusued variables and code.
+	(elf_backend_add_symbol_hook): Fix prototype.
+
+	* elf32-sh.c (sh_elf_set_mach_from_flags): Use 'flags'.
+
+	* 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.	
+
+2000-03-01  H.J. Lu  <hjl@gnu.org>
+
+	* aoutx.h (aout_link_input_section_std): Pass "true" to
+	the undefined_symbol callback.
+	(aout_link_input_section_ext): Likewise.
+	* bout.c (get_value): Likewise.
+	* coff-a29k.c (coff_a29k_relocate_section): Likewise.
+	* coff-alpha.c (alpha_ecoff_get_relocated_section_conten):
+	Likewise.
+	(alpha_relocate_section): Likewise.
+	* coff-arm.c (coff_arm_relocate_section): Likewise.
+	* coff-i960.c (coff_i960_relocate_section): Likewise.
+	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
+	* coff-mips.c (mips_relocate_section): Likewise.
+	* coff-ppc.c (coff_ppc_relocate_section): Likewise.
+	* coff-sh.c (sh_relocate_section): Likewise.
+	* coff-tic80.c (coff_tic80_relocate_section): Likewise.
+	* cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
+	* elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+	* elf32-i370.c (i370_elf_relocate_section): Likewise.
+	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+	* elf32-sh.c (sh_elf_relocate_section): Likewise.
+	* elf32-v850.c (v850_elf_relocate_section): Likewise.
+	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
+	* elflink.h (elf_link_output_extsym): Likewise.
+	* pe-mips.c (coff_pe_mips_relocate_section): Likewise.
+	* reloc.c (bfd_generic_get_relocated_section_conten): Likewise.
+	* reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise.
+
+	* elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the
+	undefined_symbol callback when building shared library with
+	-Bsymbolic and undefined symbols are allowed. Otherwise, pass
+	"true".
+	* elf32-arm.h (elf32_arm_relocate_section): Likewise.
+	* elf32-i386.c (elf_i386_relocate_section): Likewise.
+	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+	* elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+	(elf32_mips_get_relocated_section_content): Likewise.
+	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+2000-02-28  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.am: Add rules to build pe[i]-{sh|mips}.lo objects.
+	* Makefile.in: Regenerate.
+
+	* configure.in: Add support for mips and sh pe vectors.
+	* configure: regenerate.
+
+	* config.bfd: Add support for arm-wince, mips-pe and sh-pe
+	targets. 
+
+	* targets.c: Add mips and sh pe vectors.
+
+	* libpei.h (coff_final_link_postscript): Only define if not
+	already defined.
+
+	* coffcode.h: Add support for WinCE magic numbers.
+
+	* peigen.c (pe_print_reloc): Update comment and rearrange
+	appending of newline character.
+
+	* peicode.h: Add support for Image Library Format.
+	(pe_ILF_vars): Structure containing data used by ILF code.
+	(pe_ILF_make_a_section): New function.  Create a section based
+	on ILF data.
+	(pe_ILF_make_a_reloc): New function.  Create a reloc based on
+	ILF data.
+	(pe_ILF_make_a_symbol): New function.  Create a symbol based
+	on ILF data.
+	(pe_ILF_save_relocs): New function.  Store the relocs created
+	by pe_ILF_make_a_reloc in a section.
+	(pe_ILF_build_a_bfd): New function.  Create a BFD describing
+	an ILF object.
+	(pe_ILF_object_p): New function.  Return a bfd_target pointer
+	for an ILF object.
+	(pe_bfd_object_p): If an ILF object is detected call
+	pe_ILF_object_p on it.
+
+	* coff-arm.c: Add support for WinCE relocs which are different
+	from normal ARM COFF relocs.
+	* pe-arm.c: Unset TARGET_UNDERSCORE for a WinCE target.
+
+	* coff-sh.c: Add support for sh-pe target.
+	* pe-sh.c: New file.  Support code for sh-pe target.
+	* pei-sh.c: New file.  Support code for sh-pe target.
+
+	* pe-mips.c: New file.  Support code for mips-pe target.
+	* pei-mips.c: New file.  Support code for mips-pe target.
+
+2000-02-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Don't bump
+	architecture if the object causing the bump is dynamic.
+	* elf64-sparc.c (sparc64_elf_merge_private_bfd_data): Likewise,
+	and also don't it for memory ordering.
+	(sparc64_elf_write_relocs): Take src_rela out of the loop.
+
+2000-02-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* dwarf2.c (read_abbrevs): Use _raw_size directly rather than
+	calling bfd_get_section_size_before_reloc.
+	(decode_line_info): Likewise.
+	(_bfd_dwarf2_find_nearest_line): Likewise.
+
+2000-02-27  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* Makefile.am (stamp-lib): Use $(LIBTOOL) --config to get the
+	name of the libtool directory.
+	* Makefile.in: Rebuild.
+
+Fri Feb 25 18:39:26 2000  Rodney Brown (RodneyBrown@pmsc.com)
+
+	* som.c (SOM_HOWTO): Define.
+	(som_hppa_howto_table): Use it.
+
+2000-02-25  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+	* config.bfd: Enable 64 bit support for GNU/Linux/sparc.
+
+	* config.bfd: Enable 64 bit support for Solaris7+/sparc.
+
+2000-02-24  Catherine Moore  <clm@cygnus.com>
+
+	* som.c (som_misc_symbol_info):  Add field
+	secondary_def. 
+	(som_bfd_derive_misc_symbol_info):  Initialize
+	secondary_def.
+	(som_build_and_write_symbol_table): Keep track
+	of secondary_def field.
+	(som_slurp_symbol_table): Set BSF_WEAK symbol flag
+	if secondary_def field is set.
+	(som_bfd_ar_write_symbol_stuff): Initialize
+	secondary_def.
+
+2000-02-23  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* 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.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* cpu-i370.c: New file.
+	* elf32-i370.c:  New file.
+	* archures.c (enum bfd_architecture): Add bfd_arch_i370.
+	(bfd_i370_arch): New.
+	(bfd_archures_list): Add bfd_i370_arch.
+	* elf.c (prep_headers): Add bfd_arch_i370.
+	* Makefile.am: Add support for IBM 370 elf.
+	* config.bfd: Likewise.
+	* configure.in: Likewise.
+	* libbfd.h (bfd_reloc_code_real_names): Likewise.
+	* reloc.c (bfd_reloc_code_type): Likewise.
+	* targets.c: Likewise.
+
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+	* bfd-in2.h: Regenerate.
+
+2000-02-22  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-i386.c (elf_i386_info_to_howto_rel): Give a warning for
+	invalid relocation types, and change them to R_386_NONE.
+
+2000-02-22  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (elf_link_add_object_symbols): If a version symbol is
+	not defined, don't add a second ELF_VER_CHR.
+
+        * elflink.h (elf_bfd_final_link): Call output_extsym for global
+	symbols converted to local symbols even when stripping all
+	symbols.
+        (elf_link_output_extsym): Process global symbols converted to
+	local symbols even if they are being stripped.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* archures.c (bfd_octets_per_byte): Return unsigned int.
+	(bfd_arch_mach_octets_per_byte): Ditto.
+	* libbfd.c (bfd_read, bfd_seek): Quell signed vs. unsigned
+	comparison warning.
+	* section.c (bfd_get_section_size_before_reloc): Quell signed
+	vs. unsigned comparison warning.
+	(bfd_get_section_size_after_reloc): Same here.  Fix parentheses too.
+	* trad-core.c (trad_unix_core_file_p): Correct 2000-01-27
+	change.  What was I thinking?
+	* bfd-in2.h: Regenerate.
+
+	* elflink.h (elf_gc_sweep): Skip non-elf input bfds.
+	(elf_gc_sections): Same here.
+	(elf_gc_common_finalize_got_offsets): And here.
+
+2000-02-21  Ian Lance Taylor  <ian@zembu.com>
+
+	ELF HPPA doesn't work at present; remove it until it does.
+	* config.bfd: Comment out setting targ_defvec to
+	bfd_elf32_hppa_vec.
+	* Makefile.am: Rebuild dependencies.
+	(BFD32_BACKENDS): Remove elf32-hppa.lo.
+	(BFD32_BACKENDS_CFILES): Remove elf32-hppa.c.
+	(SOURCE_HFILES): Remove elf32-hppa.h and hppa_stubs.h.
+	* Makefile.in: Rebuild.
+	* targets.c (bfd_target_vector): Comment out bfd_elf32_hppa_vec.
+
+2000-02-18  Geoff Keating  <geoffk@cygnus.com>
+
+	* coffcode.h (coff_set_arch_mach_hook): Use free(), because there
+	is no bfd_free().  Revert bfd_free part of previous change.
+
+2000-02-18  Geoff Keating  <geoffk@cygnus.com>
+
+	* coffcode.h (coff_set_arch_mach_hook): Don't use variable-size
+	arrays.
+	(coff_compute_section_file_positions): Use bfd_free to pair
+	bfd_malloc.
+	(coff_write_object_contents): Likewise.
+
+	* coff-rs6000.c (xcoff_howto_table_16): New variable.
+	(xcoff_rtype2howto): Handle 16-bit variants of 32-bit relocs.
+
+2000-02-18  Ulrich Drepper  <drepper@cygnus.com>
+
+	* coff-rs6000.c (XCOFFARMAGBIG): New macro.
+	(xcoff_ar_file_hdr_big): New structure.
+	(SIZEOF_AR_FILE_HDR_BIG): New macro.
+	(xcoff_ar_hdr_big): New structure.
+	(SIZEOF_AR_HDR_BIG): New macro.
+	(xcoff_big_format_p): New macro.
+	(xcoff_ardata_big): New macro.
+	(arch_xhdr_big): New macro.
+	(xcoff_slurp_armap): Handle large archives.
+	(xcoff_archive_p): Detect large archives.
+	(xcoff_read_ar_hdr): Handle large archives.
+	(xcoff_openr_next_archived_file): Handle large archives.
+	(xcoff_generic_stat_arch_elt): Handle large archives.
+	(xcoff_write_armap_old): Rename from xcoff_write_armap.
+	(xcoff_write_armap_big): New function.
+	(xcoff_write_armap): New function, dispatch to _old or _big.
+	(xcoff_write_archive_contents_old): Rename from
+	xcoff_write_archive_contents.
+	(xcoff_write_archive_contents_big): New function.
+	(xcoff_write_archive_contents): New function, dispatch to _old or
+	_big.
+
+2000-02-18  Richard Henderson  <rth@cygnus.com>
+
+	* elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect
+	and hide_symbol members.
+	(elf_link_hash_copy_indirect): Remove.
+	(elf_link_hash_hide_symbol): Remove.
+	(struct elf_backend_data): Add elf_backend_copy_indirect_symbol
+	and elf_backend_hide_symbol.
+	(_bfd_elf_link_hash_copy_indirect): Declare.
+	(_bfd_elf_link_hash_hide_symbol): Declare.
+	* elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument.
+	(_bfd_elf_link_hash_hide_symbol): Likewise.
+	(_bfd_elf_link_hash_table_init): Don't init killed members.
+	* elflink.h (elf_link_add_object_symbols): Use the bed function
+	pointers not elf_link_hash_{copy_indirect,hide_symbol}.
+	(elf_link_assign_sym_version): Likewise.
+	* elfxx-target.h (elf_backend_copy_indirect_symbol): Default.
+	(elf_backend_hide_symbol): Likewise.
+	(elfNN_bed): Update for new members.
+
+2000-02-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* rs6000-core.c (CORE_DATA_SIZE_FIELD, CORE_COMM_FIELD, SAVE_FIELD,
+	STACK_END_ADDR): Define for new core file format.
+	(LOADER_OFFSET_FIELD, LOADER_REGION_SIZE, CORE_DUMP): New defines
+	for handling the vagaries of the various core file structures used
+	by AIX over the years.
+	(rs6000coff_core_p, rs6000coff_core_file_matches_executable,
+	Rs6kCorData): Use above defines to adapt code to use AIX 4.3's
+	core_dumpx structure.
+
+Thu Feb 17 00:04:48 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* archures.c (bfd_mach_sh2, bfd_mach_sh_dsp): New macros.
+	(bfd_mach_sh3_dsp): Likewise.
+	(bfd_mach_sh4): Reinstate.
+	(bfd_default_scan): Recognize 7410, 7708, 7729 and 7750.
+	* bfd-in2.h: Regenerate.
+	* coff-sh.c (struct sh_opcode): flags is no longer short.
+	(USESAS, USESAS_REG, USESR8, SETSAS, SETSAS_REG): New macros.
+	(sh_opcode41, sh_opcode42): Integrate as sh_opcode41.
+	(sh_opcode01, sh_opcode02, sh_opcode40): Add sh-dsp opcodes.
+	(sh_opcode41, sh_opcode4, sh_opcode80): Likewise.
+	(sh_opcodes): No longer const.
+	(sh_dsp_opcodef0, sh_dsp_opcodef): New arrays.
+	(sh_insn_uses_reg): Check for USESAS and USESR8.
+	(sh_insn_sets_reg, sh_insns_conflict): Check for SETSAS.
+	(_bfd_sh_align_load_span): Return early for SH4.
+	Modify sh_opcodes lookup table for sh-dsp / sh3-dsp.
+	Take into account that field b of a parallel processing insn
+	could be mistaken for a separate insn.
+	* cpu-sh.c (arch_info_struct): New array elements for
+	sh2, sh-dsp and sh3-dsp.
+	Reinstate element for sh4.
+	(SH2_NEXT, SH_DSP_NEXT, SH3_DSP_NEXT): New macros.
+	(SH4_NEXT): Reinstate.
+	(SH3_NEXT, SH3E_NEXT): Adjust.
+	* elf-bfd.h (_sh_elf_set_mach_from_flags): Declare.
+	* elf32-sh.c (sh_elf_set_private_flags): New function.
+	(sh_elf_copy_private_data, sh_elf_set_mach_from_flags): Likewise.
+	(sh_elf_merge_private_data): New function.
+	(elf_backend_object_p, bfd_elf32_bfd_set_private_bfd_flags): Define.
+	(bfd_elf32_bfd_copy_private_bfd_data): Define.
+	(bfd_elf32_bfd_merge_private_bfd_data): Change to
+	sh_elf_merge_private_data.
+
+2000-02-13  Richard Henderson  <rth@cygnus.com>
+
+	* elf-bfd.h (struct elf_link_hash_table): Add copy_indirect and
+	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 
+	indirect new new symbol to elf.c.
+	(elf_link_assign_sym_version): Break out privatization of
+	non-exported symbol to elf.c.
+	* elf.c (_bfd_elf_link_hash_copy_indirect): New.
+	(_bfd_elf_link_hash_hide_symbol): New.
+	(_bfd_elf_link_hash_table_init): Init copy_indirect and hide_symbol.
+
+2000-02-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* section.c (_bfd_strip_section_from_output): Add info parameter.
+	If it passed as non-NULL, use it to check whether any input BFD
+	has an input section which uses this output section.  Change all
+	callers.
+	* bfd-in2.h: Rebuild.
+
+	* bfd-in.h: Move declarations of bfd_get_elf_phdr_upper_bound and
+	bfd_get_elf_phdrs in from bfd-in2.h, correcting patch of
+	1999-11-29.
+	* bfd-in2.h: Rebuild.
+
+2000-02-10  Timothy Wall  <twall@cygnus.com>
+
+	* coffswap.h (coff_swap_sym_in): Add hook SWAP_SYM_IN_POST to
+	allow final modifications of swapped-in symbol.
+	(coff_swap_sym_out): Ditto with SWAP_SYM_OUT_POST.
+	* coffcode.h (coff_write_relocs): Use macro
+	SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if defined to determine whether
+	symbol index should be set to -1.
+
+Thu Feb 10 20:07:50 GMT 2000  Toshiyasu Morita (toshi.morita@sega.com)
+
+	* coff-sh.c (USES1_REG, USES2_REG, SETS1_REG, SETS2_REG,
+	USESF1_REG, USESF2_REG, SETSF1_REG, SETSF2_REG): New macros.
+	* (sh_insn_sets_reg, sh_insn_sets_freg): New prototypes.
+	* (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 
+	detect conflicts when two instructions both set same integer registers,
+	both set same fp register, and both set special register.
+
+2000-02-09  Timothy Wall  <twall@cygnus.com>
+
+	* coffgen.c (coff_real_object_p): Set arch/mach info prior to
+	swapping in sections, so that the swapping routines have access to
+	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>
+
+        * syms.c (bfd_decode_symclass)
+        Two new class characters were added - 'V' and 'v'.  The
+        meaning of 'W' is now restricted to just weak non-object
+        symbols.  This allows differentiation between, for example,
+        weak functions vs weak objects.  nm for example now dumps:
+        'W' = weak global
+        'w' = weak unresolved
+        'V' = weak global object
+        'v' = weak unresolved object
+
+	(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
+	disassembler.
+
+2000-01-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* coff-i386.c (i3coff_object_p): Remove prototype.
+	Update copyright.
+
+	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Add const
+	to name.  Update copyright.
+
+	* trad-core.c (trad_unix_core_file_p): Cast core_regsec
+	assignment to avoid warning.  Update copyright.
+
+2000-01-24  Robert Lipe  (robertl@sco.com)
+
+        * coffcode.h (coff_write_object_contents): Get buff via bfd_malloc
+	instead of using GNU C extension.
+
+2000-01-21  Nick Clifton  <nickc@cygnus.com>
+
+	* libbfd.c (bfd_read): Do not attempt to get a negativly sized
+	amount from a bfd_in_memory structure.
+	(bfd_seek): Do not allow seeks past the end of a bfd_in_memory
+	structure.
+
+2000-01-14  Nick Clifton  <nickc@cygnus.com>
+
+	* linker.c (default_indirect_link_order): oops - fix incorrectly
+	applied patch from Tim Wall.
+
+2000-01-13  Timothy Wall (twall@tiac.net>
+
+	* coffcode.h: Use bfd_coff_xxx instead of the macro XXX (where xxx
+	= 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
+	interwork thumb to arm stub.
+
+2000-01-13  Timothy Wall (twall@tiac.net>
+
+	* archures.c (bfd_octets_per_byte): New function: Return
+	target byte size.
+	(bfd_arch_mach_octets_per_byte): New function: Return target
+	byte size.
+
+	* section.c: Distinguish between octets and bytes for usage of
+	_cooked_size,  _raw_size, and output_offset.  Clarify
+	description of bfd_set_section_contents.
+
+	* bfd-in2.h: Regenerate.
+
+	* 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.
+
+2000-01-10  Philip Blundell  <pb@futuretv.com>
+
+	* config.bfd (arm*-*-linux-gnu*): Match instead of arm*-*-linux-gnu.
+	(arm*-*-conix*): New target.
+
+2000-01-10  Egor Duda  <deo@logos-m.ru>
+
+	* 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.
+
+2000-01-03  Martin v. Loewis  <loewis@informatik.hu-berlin.de>
+
+	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Process symbol
+	visibility.
+	* elflink.h (elf_link_add_object_symbols): Combine visibilities.
+	* elf.c (bfd_elf_print_symbol): Interpret st_other as visibility.
+
+1999-12-29  Richard Henderson  <rth@cygnus.com>
+
+	* elflink.h (bfd_elf,size_dynamic_sections): Don't export all
+	if no dynamic sections created.
+
+1999-12-27  Nick Clifton  <nickc@cygnus.com>
+
+	* peicode.h (pe_bfd_object_p): Only define for PE format
+	targets. 
+
+1999-12-17  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-i386.c (i3coff_object_p): Delete.
+	(i386coff_vec): Replace reference to i3coff_object_p with a
+	reference to coff_object_p.
+
+	* coff-mcore.c (pe_object_p): Delete.
+
+	* peicode.h (pe_bfd_object_p): New function: Detect the
+	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.
+	(NUM_RELOCS): New macro: The number of known ARM relocs.
+	(RTYPE2HOWTO): Return NULL if the reloc type is out of range.
+	(coff_arm_rtype_to_howto):  Return NULL if the reloc type is out
+	of range.
+	(bfd_arm_process_before_allocation): Produce a warning message if
+	an out of range symbol index is encountered.
+
+1999-12-14  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (is_global_symbol_definition): New Function: Return
+	true iff the symbol is being given a global definition in this
+	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
+	sparc-*-netbsdaout*.
+
+1999-12-13  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_link_is_defined_archive_symbol): Check to see
+	if the symbol is in the common section.
+
+1999-12-10  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_link_is_defined_archive_symbol): New
+	function: Decide if a symbol, in an archive map is there
+	because it is defined in the archive element, or because it is
+	just another common declaration of it.
+	(elf_link_add_archive_symbols): Use
+	elf_link_is_defined_archive_symbol to decide if an archive
+	element contain a reference to a common symbol should be
+	linked in or not.
+
+1999-12-10  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h: Revert previous patch.
+	* targets.c: Revert previous patch.
+	* libbfd-in2.h: Revert previous patch.
+	* libbfd.h: Revert previous patch.
+	* elfxx-target.h: Revert previous patch.
+	* archive.c: Revert previous patch.
+	* aout-target.h: Revert previous patch.
+	* aout-tic30.h: Revert previous patch.
+	* bfd.c: Revert previous patch.
+	* coff-alpha.c: Revert previous patch.
+	* coff-rs6000.c: Revert previous patch.
+	* elf64-mips.c: Revert previous patch.
+	* ieee.c: Revert previous patch.
+	* libecoff.h: Revert previous patch.
+	* oasys.c: Revert previous patch.
+	* som.c: Revert previous patch.
+	* vms.c: Revert previous patch.
+
+1999-12-09  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_link_add_archive_symbols): Add an archive
+        element even if contains a symbol which is currently only
+        considered to be a common.
+
+	* targets.c (struct bfd_target): Add new field
+	_bfd_allow_commons_in_armap.
+	* bfd-in2.h:Regenerate.
+
+	* libbfd-in2.h (_bfd_noarchive_allow_commons_in_armap):
+	Define.
+	 (_bfd_archive_bsd_allow_commons_in_armap): Define.
+	* libbfd.h: Regenerate.
+
+	* elfxx-target.h: If using COFF archive map, override
+	definition of allow_commons_in_armap and replace with
+	bfd_false.
+
+	* archive.c (bfd_compute_and_write_armap): Do not place common
+	symbols into the archive map unless _bfd_allow_commons_in_armap
+	returns true.
+
+	* aout-target.h (MY_allow_commons_in_armap): Define.
+	* aout-tic30.h (MY_allow_commons_in_armap): Define.
+	* bfd.c (bfd_allow_commons_in_armap): Define.
+	* coff-alpha.h (alpha_ecoff_allow_commons_in_armap): Define.
+	* coff-rs6000.h (xcoff_allow_commons_in_armap): Define.
+	* elf64-mips.c (bfd_elf64_allow_commons_in_armap): Define.
+	* ieee.c (ieee_ecoff_allow_commons_in_armap): Define.
+	* libecoff.h (_bfd_ecoff_allow_commons_in_armap): Define.
+	* oasys.c (oasys_allow_commons_in_armap): Define.
+	* som.c (som_allow_commons_in_armap): Define.
+	* vms.c (vms_allow_commons_in_armap): Define.
+
+1999-12-07  Jim Blandy  <jimb@cygnus.com>
+
+	Add support for SSE registers in ELF core files.
+	* elf.c (elfcore_make_note_pseudosection): New function.
+	(elfcore_grok_prfpreg): Use it.
+	(elfcore_grok_prxfpreg): New function.
+	(elfcore_grok_note): Recognize Linux NT_PRXFPREG notes.
+
+1999-12-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Divide R_MIPS_PC16
+	value by 4 before storing it back in the field.  From
+	Koundinya. K <kk@ddeorg.soft.net>.
+
+Tue Nov 30 22:41:14 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* archures.c (bfd_mach_am33): Define.
+	* bfd-in2.h: Rebuilt.
+	* cpu-m10300.c (bfd_am33_arch): Add to the mn103 architecture list
+	* elf-m10300.c (mn10300_elf_relax_section): Handle am33 instructions.
+	(compute_function_info): Handle additional registers saved by
+	movm on the am33.
+	(elf_mn10300_mach): Handle E_MN10300_MACH_AM33.
+	(_bfd_mn10300_elf_final_write_processing): Handle bfd_mach_am33.
+
+1999-11-29  Jim Blandy  <jimb@cygnus.com>
+
+	* elf.c (bfd_get_elf_phdrs, bfd_get_elf_phdr_upper_bound): New
+	functions.
+	* bfd-in2.h (bfd_get_elf_phdrs, bfd_get_elf_phdr_upper_bound): New
+	declarations.
+
+1999-11-27  Michael Meissner  <meissner@cygnus.com>
+
+	* reloc.c (BFD_RELOC_ALPHA_USER_LITERAL): New relocation for
+	internal use within gas for alpha explicit relocations.
+	(BFD_RELOC_ALPHA_USER_LITUSE_BASE): Ditto.
+	(BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF): Ditto.
+	(BFD_RELOC_ALPHA_USER_LITUSE_JSR): Ditto.
+	(BFD_RELOC_ALPHA_USER_GPDISP): Ditto.
+	(BFD_RELOC_ALPHA_USER_GPRELHIGH): Ditto.
+	(BFD_RELOC_ALPHA_USER_GPRELLOW): Ditto.
+
+	* elf64-alpha.c (elf64_alpha_reloc_map): Add mappings for
+	BFD_RELOC_ALPHA_USER_*.
+
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+
+1999-11-26  Fred Fish  <fnf@cygnus.com>
+
+	* elf.c (elfcore_read_notes): Add prototype for static function.
+	(_bfd_elf_make_section_from_phdr): Renamed from bfd_section_from_phdr.
+	(bfd_section_from_phdr): Replacement function that calls
+	_bfd_elf_make_section_from_phdr for generic segment types and
+	backend fucntion pointed to by elf_backend_section_from_phdr for
+	backend specific segment types.
+	(_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.
+
+1999-11-25  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-arm.c (bfd_arm_get_bfd_for_interworking):  Add
+	SEC_CODE and SEC_READONLY flags to glue sections.
+
+	* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Add
+	SEC_CODE and SEC_READONLY flags to glue sections.
+
+1999-11-20  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-mcore.c (coff_mcore_relocate_section): Fix typo in previous
+	delta. 
+
+1999-11-19  Catherine Moore  <clm@cygnus.com>
+
+	* elf32-m68k.c (elf_cpu32_plt0_entry): Fix encoding.
+	(elf_cpu32_plt_entry): Likewise.
+
+1999-11-18  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-mcore.c (coff_mcore_rtype_to_howto): Special case handling
+	for RVA relocs.
+	(coff_mcore_relocate_section): Initialise addend to 0.
+	Special case processing of RVA reloc.
+
+1999-11-17  Richard Henderson  <rth@cygnus.com>
+
+	* elf-bfd.h (struct elf_backend_data): Reorder collect and
+	type_change_ok; add sign_extend_vma.
+	* elf32-mips.c (elf_backend_sign_extend_vma): Define.
+	* elfcode.h (elf_swap_symbol_in): Mind be->sign_extend_vma.
+	(elf_swap_shdr_in, elf_swap_phdr_in): Likewise.
+	* elfxx-target.h (elf_backend_sign_extend_vma): Default.
+	(elfNN_bed): Follow struture changes.
+
+1999-11-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* libbfd.c (bfd_read): Check result of read against desired result
+	using !=, not <.
+	(_bfd_generic_get_section_contents): Set bfd_error if the seek is
+	invalid compared to the section size.
+
+	* ieee.c (ieee_slurp_debug): Get the length of the debug
+	information right if there is no data part.
+
+Tue Nov  2 01:44:41 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* som.c (som_fixup_formats): Improve handling of R_AUX_UNWIND,
+	R_LINETAB, R_LINETAB_ESC, and R_COMMENT.
+
+1999-10-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_bfd_final_link): Make last_local signed.
+
+1999-10-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* stabs.c (_bfd_link_section_stabs): Make sure .stabstr section
+	starts with a zero.
+
+Sat Oct 23 17:36:12 1999  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* archures.c: Add definitions bfd_mach_d10v, bfd_mach_d10v_ts2 and
+ 	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.
+
+Sun Oct 17 17:19:00 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* libhppa.h (bfd_hppa_insn2fmt): Change to return an int.
+
+1999-10-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_merge_symbol): When overriding a weak symbol with
+	a defined symbol in a shared library, clear the DEF_DYNAMIC flag
+	too.
+
+Fri Oct  8 13:03:45 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): R_MIPS_LITERAL
+	relocs also need the GP value.
+	(_bfd_mips_elf_relocate_section): Handle unpaired LO16 relocs
+ 	properly.  Handle sign-extension for R_MIPS_64 correctly.  Correct
+ 	the GP value for R_MIPS_LITERAL relocs too.  Handle
+	R_MIPS_64 relocs properly on big-endian MIPS.
+	(mips_elf_sign_extend): Behave properly with 'long long'.
+	(mips_elf_highest): Correct typo.
+
+Mon Oct  4 17:49:45 1999  Nick Clifton  <nickc@cygnus.com>
+
+	* cpu-m32r.c (arch_info_struct): New static global.
+	(bfd_m32r_arch): Refer to it.
+	* elf32-m32r.c (m32r_elf_object_p): Recognize E_M32RX_ARCH.
+	(m32r_elf_print_private_bfd_data): Ditto.
+	(m32r_elf_final_write_processing): Handle bfd_mach_m32rx.
+	* archures.c (bfd_mach_m32rx): Define it.
+	* bfd-in2.h: Rebuild.
+
+1999-09-28  Fred Fish  <fnf@cygnus.com>
+
+	* targets.c (cisco_core_vec): Replaced with two new vecs ...
+	(cisco_core_big_vec): Add new bigendian vec.
+	(cisco_core_little_vec): Add new little endian vec.
+
+	* cisco-core.c (CRASH_INFO): Fixed offset replaced with ...
+	(crash_info_locs): Add array of possible offsets.
+	(MASK_ADDR): Mask to apply to crash info offset.
+	(crashinfo_external): Add textbase, database, bssbase and
+	turn into a typedef.
+	(cisco_core_file_validate): Renamed from cisco_core_file_p.
+	Many small changes to account for additional hardware versions.
+	Pick a reasonable size for ".reg" section.  Add a ".crash"
+	section to allow access to crashinfo_external struct.
+	(cisco_core_file_p): New version of this function that
+	iterates over crash_info_locs, calling cisco_core_file_validate.
+	(cisco_core_vec): Old big endian only vec replaced with ...
+	(cisco_core_big_vec): Add big endian version.
+	(cisco_core_little_vec): Add little endian version.
+
+	* configure.in (cisco_core_vec): Split to two new vectors ...
+	(cisco_core_big_vec): New target vector.
+	(cisco_core_little_vec): New target vector.
+	* configure: Regenerate.
+	* config.bfd (targ): For m68*-*-aout* targ, change cisco_core_vec
+	to cisco_core_big_vec in targ_selvecs.
+
+1999-09-28  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* elf32-mips.c (mips_elf_relocate_hi16): Unused, delete.
+	(mips_elf_relocate_got_local): Unused, delete.
+	(mips_elf_relocate_global_got): Unused, delete.
+
+1999-09-24  Fred Fish  <fnf@cygnus.com>
+
+	* elf.c (bfd_section_from_phdr): Add typename variable.  Use p_type
+	to initialize it to something meaningful.  Then use it to generate
+	more useful segment names.
+
+Sun Sep 19 12:16:47 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* som.c (NO_PCREL_MODES): Define if the system does not define
+	R_SHORT_PCREL_MODE.
+	(hppa_som_gen_reloc_type): Handle both short and long pcrel branches.
+	(som_write_fixups): Eliminate redundant pcrel mode relocs.  Handle
+	R_LONG_PCREL_MODE and R_SHORT_PCREL_MODE
+	* libhppa.h (dis_assemble_22): New function.
+	(bfd_hppa_insn2fmt): Handle long branch.
+
+	* libhppa.h (bfd_hppa_insn2fmt): Decode and handle formats found
+	in PA2.0.
+
+1999-09-17  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* coff-i386.c (coff_i386_reloc_type_lookup): Support BFD_RELOC_16,
+	BFD_RELOC_16_PCREL, BFD_RELOC_8, BFD_RELOC_8_PCREL relocs.
+	(reloc_howto_type howto_table): Tidy comments and whitespace.
+
+1999-09-17  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Undo
+	previous delta.  Set sec->gc_mark instead.
+
+Thu Sep 16 11:21:13 1999  Catherine Moore  <clm@cygnus.com>
+
+	* elf32-m68k.c (elf_cpu32_plt0_entry): Use a1 instead of a0.
+	(elf_cpu32_plt_entry): Likewise.
+
+Thu Sep 16 10:48:17 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_final_write_processing): Turn on TRAPNIL.
+
+	* elf-hppa.h (elf_hppa_final_link): If unable to find __gp in the
+	symbol table, then just compute a suitable value (but do not
+	create a __gp symbol).
+
+	* elf-hppa.h (elf_hppa_relocate_section): Allow undefined
+	symbols when building shared libraries.
+	(elf_hppa_final_link_relocate): Correct handling of PCREL
+	relocations against undefined symbols.
+
+1999-09-16  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Mark
+	interworking sections as linker created so that they will not
+	be removed by garbage collection.
+
+Wed Sep 15 02:31:57 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_final_link): Revamp __gp handling.
+	(elf_hppa_final_link_relocate): Consistently create an absolute
+	address, then subtract out the value of __gp.
+
+1999-09-14  Michael Meissner  <meissner@cygnus.com>
+
+	* configure.in (Canonicalization of target names): Remove adding
+	${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+	generates $ac_config_sub with a ${CONFIG_SHELL} already.
+	* configure: Regenerate.
+
+1999-09-14  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-m32r.c (ELF_MAXPAGESIZE): Change to 0x1 (at request of
+	Mitsubishi). 
+
+Mon Sep 13 20:01:47 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_record_segment_addrs): New function.
+	(elf_hppa_final_link): Initialize text_segment_base and
+	data_segment_base.
+	(elf_hppa_final_link_relocate): Handle SEGREL relocations.
+
+	* elf-hppa.h (elf_hppa_final_link): Remove unused variables.
+	(elf_hppa_final_link_relocate): Likewise.
+	(elf_hppa_relocate_insn): Likewise.
+	(elf_hppa_relocate_section): Initialize HOWTO.
+
+1999-09-13  Donn Terry  <donn@interix.com>
+
+	* coffcode.h (styp_to_sec_flags): Further refinement of COMDAT
+	handling to support both GNU and MS objects.
+
+	* coffcode.h (coff_write_object_contents): Don't check reloc_count
+	when determining whether to set F_RELFLG.
+
+1999-09-13  Philip Blundell  <pb@nexus.co.uk>
+
+	* elf32-arm.h (elf32_arm_final_link_relocate): Don't range-check
+	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
+	an absolute symbol in REL relocs.
+
+Sun Sep 12 23:47:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle SECREL32.
+	Stub SEGREL32.  Return an error for any relocation not handled.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* cofflink.c (coff_link_add_symbols): Look for special MSVC string
+	constant symbols, and avoid multiple definition errors on them.
+
+1999-09-12  Donn Terry  <donn@interix.com>
+
+	* libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most
+	significant bit is set.
+
+1999-09-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* coff-ppc.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
+
+	* elfcode.h (write_relocs): Handle an absolute symbol in REL
+	relocs as we do for RELA relocs.
+
+1999-09-11  Donn Terry  <donn@interix.com>
+
+	* libpei.h (_bfd_pei_final_link_postscript): Declare.
+	(coff_final_link_postscript): Define.
+	* peigen.c (_bfd_pei_swap_aouthdr_out): Don't set value for data
+	directory entries here.
+	(_bfd_pei_final_link_postscript): New function.
+
+	* peigen.c (_bfd_pei_swap_scnhdr_out): Remove code which sets
+	section flags based on the section name.
+
+	* peicode.h (coff_swap_scnhdr_in): If COFF_IMAGE_WITH_PE, the
+	get the overflow of the s_nlnno field from the s_nreloc field.
+	* peigen.c (_bfd_pei_swap_scnhdr_out): If doing a final link, swap
+	the s_nlnno overflow of the .text section into the s_nreloc
+	field.
+
+	* peigen.c (add_data_entry): Declare.
+	(pei_swap_aouthdr_out): Get image size right.  Set linker version
+	more intuitively.
+	(pei_swap_scnhdr_out): Test for UNINIT section, not .bss.
+	(pe_print_idata): Code cleanup, print more info, get rid of (now)
+	extraneous ImageBase.
+	(pe_print_edata): Likewise.
+	(pe_print_pdata): Likewise.  Print exception entries.
+	(pe_print_reloc): Likewise.  Print MIPS_JMPADDR.
+	(tbl): Make const, add "UNKNOWN".
+	(_bfd_pe_print_private_bfd_data_common): Print timestamp.
+	(_bfd_pe_bfd_copy_private_bfd_data_common): Don't copy deleted
+	section data directory.
+	(_bfd_pe_bfd_copy_private_section_data): Copy pe_flags.
+
+	* libpei.h (_bfd_pe_bfd_get_symbol_info): Declare.
+	* peigen.c (_bfd_pe_bfd_get_symbol_info): New function.
+	* peicode.h (coff_get_symbol_info): Define.
+
+	* config.bfd (i[3456]86-*-interix*): Set targ_cflags to
+	-DSTRICT_PE_FORMAT.
+	* coffcode.h (styp_to_sec_flags): Check STRICT_PE_FORMAT rather
+	than __INTERIX.
+	(coff_classify_symbol): Re-revert 1999-08-08 patch if
+	STRICT_PE_FORMAT.
+
+	* libpei.h: New file, broken out of peicode.h.
+	* peigen.c: New file, broken out of peicode.h.
+	* peicode.h: A bunch of code moved out to libpei.h and peigen.c.
+	* configure.in: Add peigen.lo to list of files required for each
+	PE target.
+	* Makefile.am: Rebuild dependencies.
+	(BFD32_BACKENDS): Add peigen.lo.
+	(BFD32_BACKENDS_CFILES): Add peigen.c.
+	(SOURCE_HFILES): Add libpei.h.
+	* configure, Makefile.in: Rebuild.
+
+	* peicode.h (coff_swap_scnhdr_in): Don't check for a special
+	section name of _BSS; check IMAGE_SCN_CNT_UNINITIALIZED_DATA
+	instead.  Don't clear the s_paddr field for an uninitialized data
+	section.
+
+	* coffcode.h (coff_mkobject_hook): Set timestamp field in
+	coff_data_type to f_timdat.
+	* peicode.h (pe_mkobject_hook): Likewise.
+
+	* peicode.h (coff_swap_filehdr_in): Check the NT executable magic
+	number if COFF_IMAGE_WITH_PE.
+
+	* coffcode.h (coff_mkobject_hook): If COFF_WITH_PE, set HAS_DEBUG
+	to the reverse of IMAGE_FILE_DEBUG_STRIPPED.
+	(coff_write_object_contents): Set IMAGE_FILE_DEBUG_STRIPPED if
+	there is no SEC_DEBUGGING section.
+	* peicode.h (pe_mkobject_hook): Set HAS_DEBUG to the reverse of
+	IMAGE_FILE_DEBUG_STRIPPED.
+
+	* pe-i386.c (COFF_LONG_FILENAMES): Define.
+	(COFF_SECTION_ALIGNMENT_ENTRIES): Define.
+	* pei-i386.c (COFF_LONG_FILENAMES): Define.
+	(COFF_SECTION_ALIGNMENT_ENTRIES): Define.
+
+	* coffswap.h (IMAGE_BASE): Don't define.
+	* pei-arm.c (IMAGE_BASE): Don't define.
+	* pei-i386.c (IMAGE_BASE): Don't define.
+	* pei-mcore.c (IMAGE_BASE): Don't define.
+	* pei-ppc.c (IMAGE_BASE): Don't define.
+
+	* cofflink.c (_bfd_coff_link_input_bfd): When writing out a
+	symbol, switch on the class when determining whether to modify the
+	value.  For PE, don't modify the value of a C_FCN symbol not named
+	.bf.
+
+	* libbfd-in.h (_bfd_abort): Declare.
+	(abort): Define.
+	* bfd.c (_bfd_abort): New function.
+	* libbfd.h: Rebuild.
+
+	* coffcode.h (coff_set_alignment_hook): Delete POWERPC_LE_PE
+	special handling.
+
+	* cofflink.c (_bfd_coff_link_input_bfd): If a symbol is stripped,
+	don't write out the associated line numbers.
+
+	* cofflink.c (_bfd_coff_write_global_sym): Handle section symbol
+	aux entries.
+
+	* cofflink.c (coff_link_add_symbols): Don't warn about symbol type
+	changes when the base type is unknown.
+
+	* coffgen.c (coff_print_symbol): Fix printing of aux record for
+	function symbols.
+
+	* syms.c (BSF_DEBUGGING_RELOC): Define.
+	* coffcode.h (coff_slurp_symbol_table): If PE, set BSF_DEBUGGING
+	for C_FCN/C_EFCN symbols, and set BSF_DEBUGGING_RELOC for such
+	symbols named .bf.
+	* coffgen.c (fixup_symbol_value): Relocate a symbol which has
+	BSF_DEBUGGING_RELOC set.
+	* bfd-in2.h: Rebuild.
+
+1999-09-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* ecoff.c (bfd_debug_section): Update initialization for new
+	comdat_info field.
+	(_bfd_ecoff_styp_to_sec_flags): Add section parameter.
+	* libecoff.h (_bfd_ecoff_styp_to_sec_flags): Update declaration.
+
+1999-09-10  H.J. Lu  <hjl@gnu.org>
+
+	* coff-alpha.c (alpha_ecoff_backend_data): Initialize the new
+	_bfd_filnmlen field.
+	* coff-mips.c (mips_ecoff_backend_data): Likewise.
+
+Fri Sep 10 00:35:14 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Create .opd entries
+	for FPTR relocs involving local symbols.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Get the right
+	value for the stub address in a call through a stub.
+	Install the value for a local symbol directly into the DLT
+	instead of generating a reloc.  Correctly handle FPTR64 relocs.
+
+	* elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): New function.
+	(elf_hppa_remark_useless_dynamic_symbols): Similarly.
+	(elf_hppa_final_link): Call them.
+
+1999-09-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_fix_symbol_flags): Move weakdef handling here...
+	(elf_adjust_dynamic_symbol): ...from here.
+
+Wed Sep  8 17:56:11 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_howto_table); There is no DIR64WR, DIR64DR
+	relocation, remove them.  SECREL64->LTOFF16WF.
+	(elf_hppa_final_link_relocate): Handle LTOFF* relocations.  Handle
+	DIR* relocations.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle PLTOFF* relocs.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DPREL* and
+	GPREL* relocations.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_link_final_relocate): Fix typos.
+	Handle LTOFF_TP* relocs.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle PCREL* relocs.
+	Consistently deal with addends.  Handle DLTIND14F and DLTREL14F.
+	(elf_hppa_relocate_insn): Handle PCREL* relocs.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle LT_OFF_FPTR*,
+	DIR32, DIR64 and FPTR64 relocations.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* 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   
+	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
+	relocation support.  Handle DLTIND relocation requests just like
+	DLTREL relocation requests.  Simplify branch handling.
+
+1999-09-08  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf-hppa.h (elf_hppa_relocate_section): Catch problems with
+	non-allocated section as done in i386 version.
+	(elf_hppa_final_link_relocate): Uncomment R_PARISC_14F in switch
+	statement since this is no know relocation.
+
+Tue Sep  7 17:25:12 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14F
+	relocs.
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14WR and
+	DLTREL14WD relocs.  
+	(elf_hppa_relocate_insn): Similarly.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14R and
+	DLTREL21L relocs.  Pass the output bfd to elf_hppa_relocate_insn.
+	Pass the relocate type rather than the insn format to
+	elf_hppa_relocate_insn.
+	(elf_hppa_relocate_insn): Make switch dependent on relocation type
+	rather than the opcode.  Handle DLTREL21L and DLTREL14R relocs.
+
+1999-09-07  Ian Lance Taylor  <ian@zembu.com>
+
+	* coffcode.h (bfd_coff_backend_data): Add _bfd_filnmlen field.
+	(bfd_coff_filnmlen): Define.
+	(bfd_coff_std_swap_table): Initialize new field.
+	* coffgen.c (coff_fix_symbol_name): Use bfd_coff_filnmlen rather
+	than FILNMLEN.
+	(coff_write_symbols): Likewise.
+	(coff_get_normalized_symtab): Likewise.
+	* coff-sh.c (bfd_coff_small_swap_table): Initialize new field.
+	* libcoff.h: Rebuild.
+
+1999-09-06  Donn Terry  <donn@interix.com>
+
+	* coffcode.h (sort_by_secaddr): New static function if
+	COFF_IMAGE_WITH_PE.
+	(coff_compute_section_file_positions): If COFF_IMAGE_WITH_PE, sort
+	sections by VMA when assigning target_index values.  Always set
+	virt_size.
+
+	* libcoff-in.h (struct pei_section_tdata): Add pe_flags field.
+	* coffcode.h (coff_set_alignment_hook) [COFF_WITH_PE version]: Set
+	pe_flags field.
+	* libcoff.h: Rebuild.
+
+	* coffcode.h (coff_set_custom_section_alignment): Add const to
+	declaration to match definition.
+	(coff_write_object_contents): Don't set F_AR32W(R)? if
+	COFF_WITH_PE.
+
+	* coff-i386.c (in_reloc_p): Add declaration.
+	(i386coff_vec): Simplify initialization of
+	application_section_flags.
+
+	* coffcode.h (sec_to_styp_flags): Write separate COFF_WITH_PE
+	version.  Move COFF_WITH_PE specific code to new version.
+	(stype_to_sec_flags): Likewise.  Add section parameter.
+	* coffgen.c (make_a_section_from_file): Set target_index before
+	calling styp_to_sec_flags.  Pass section to styp_to_sec_flags.
+	* libcoff.h: Rebuild.
+
+	* syms.c (stt): Add some PE/PEI section names.
+	(bfd_decode_symclass): Return 'w', not 'U', for a weak undefined
+	symbol.
+	(bfd_symbol_info): Check for 'w'.
+
+	* section.c (struct bfd_comdat_info): Define.
+	(asection): Add comdat field.
+	(STD_SECTION): Initialize comdat field.
+	(bfd_make_section_anyway): Likewise.
+	* bfd-in2.h: Rebuild.
+
+1999-09-06  Andreas Schwab  <schwab@suse.de>
+
+	* elflink.h (elf_link_add_object_symbols): Copy NON_GOT_REF flag
+	to version symbols.
+
+1999-09-06  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_gc_record_vtentry): Use bfd_zmalloc and
+	bfd_realloc instead of calloc and realloc.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* cpu-pj.c: New file.
+	* elf32-pj.c: New file.
+	* config.bfd (pj*): New cpu.
+	(pj-*-*, pjl-*-*): New targets.
+	* configure.in (bfd_elf32_pj_vec): New target vector.
+	(bfd_elf32_pjl_vec): New target vector.
+ 	* archures.c (bfd_arch_pj): Define.
+	* elf.c (prep_headers): Handle bfd_arch_pj.
+	* reloc.c: Define BFD_RELOC_PJ_* relocations.
+	* targets.c (bfd_elf32_pj_vec, bfd_elf32_pjl_vec): Declare and add
+	to target vector list.
+	* Makefile.am: Rebuild dependencies.
+	(ALL_MACHINES): Add cpu-pj.lo.
+	(ALL_MACHINES_CFILES): Add cpu-pj.c.
+	(BFD32_BACKENDS): Add elf32-pj.lo.
+	(BFD32_BACKENDS_CFILES): Add elf32-pj.c.
+	* configure, Makefile.in, bfd-in2.h, libbfd.h: Rebuild.
+
+1999-09-04  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf-bfd.h (ELF_LINK_NON_GOT_REF): Define.
+	* elflink.h (elf_adjust_dynamic_symbol): Copy REF_REGULAR_NONWEAK
+	and NON_GOT_REF from weak defined symbol to real symbol.
+	* elf32-i386.c (elf_i386_check_relocs): Set NON_GOT_REF.
+	(elf_i386_adjust_dynamic_symbol): If NON_GOT_REF is not set, don't
+	create a COPY reloc.
+	* elf32-sparc.c (elf32_sparc_check_relocs): Set NON_GOT_REF.
+	(elf32_sparc_adjust_dynamic_symbol): If NON_GOT_REF is not set,
+	don't create a COPY reloc.
+
+1999-09-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_bfd_final_link): When counting relocations, don't
+	count those in sections we are not including in the link.
+
+Thu Sep  2 17:41:20 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elflink.h (elf_link_add_object_symbols): Work around bogus SH_LINK
+	field in hpux11 shared libraries.
+
+1999-09-02  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_gc_record_vtentry): Fix memory leak.
+
+Wed Sep  1 13:34:29 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_add_symbol_hook): New function.
+	(elf_hppa_final_link, elf_hppa_relocate_section): Likewise.
+	(elf_hppa_final_link_relocate, elf_hppa_relocate_insn): Likewise.
+
+1999-08-31  Alexandre Petit-Bianco  <apbianco@cygnus.com>
+
+	* elflink.h (record_link_assignment): When possible, keep the
+	original type of the symbol.
+
+Mon Aug 30 15:26:48 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Allow both
+	R_PARISC_DIR32 and R_PARISC_DIR64 regardless of how the
+	tools were configured.
+	* elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type): Declare.
+
+1999-08-26  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_check_relocs): Don't allocate local
+	GOT entries for GOT16 relocations; they're not required.
+
+1999-08-24  Nick Clifton  <nickc@cygnus.com>
+
+	From a patch submitted by Roland McGrath  <roland@baalperazim.frob.com>
+
+	* config.bfd (arm-*-netbsd*): New target.
+	* configure.in (armnetbsd_vec): New target vector.
+	* configure: Regenerate
+	* targets.c (bfd_target_vector): Add &armnetbsd_vec.
+
+	* Makefile.am (BFD32_BACKENDS): Add armnetbsd.lo.
+	(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. 
+
+Tue Aug 24 00:25:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* som.c (som_slurp_symbol_table): Fix typo in comment.
+
+Fri Aug 20 17:01:23 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_fake_sections): Compute section indices
+	here instead of using elf_section_data...
+
+1999-08-19  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-mcore.c (mcore_emit_base_file_entry): New function:  Emit
+	relocations into the base file.
+	(coff_mcore_relocate_section): Call mcore_emit_base_file_entry if
+	we are building a base file.
+
+1999-08-19  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-arm.h (arm_add_to_rel): New function.  Add a value to
+	a REL style reloc.
+	(elf32_arm_relocate_section): Use arm_add_to_rel to increment
+	REL relocs when performing a partial relocation.
+
+1999-08-18  Donn Terry  <donn@interix.com>
+
+	* cofflink.c: Move definitions of N_TMASK, et. al., out of
+	_bfd_coff_link_input_bfd into top level.
+
+	* coff-i386.c (coff_i386_reloc): Handle R_IMAGEBASE.
+	(RTYPE2HOWTO): Return NULL if reloc type is out of range.
+	(coff_i386_rtype_to_howto): Likewise.
+	* coffcode.h (coff_slurp_symbol_table): Change a -2 to N_DEBUG.
+	Completely ignore symbols which are all zero.
+	(dummy_reloc16_estimate): Add return 0.
+	* cofflink.c (_bfd_coff_link_input_bfd): Rename inner scope
+	variable copy to name_copy to avoid shadowing outer scope
+	variable.
+	* libcoff-in.h (coff_data_type): Change raw_syment_count field
+	from unsigned int to unsigned long.  Add timestamp field.
+	* libcoff.h: Rebuild.
+
+1999-08-17  H.J. Lu  <hjl@gnu.org>
+
+	* elf32-hppa.c (bfd_elf32_bfd_is_local_label_name): Fix typo in
+	macro definition.
+
+1999-08-17  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-mips.c (_bfd_mips_elf_add_symbol_hook): Set BSF_DYNAMIC
+	for special section symbols.
+	* elflink.h (elf_merge_symbol): If we have no old BFD, check
+	BSF_DYNAMIC on the section symbol to see whether the old BFD is
+	dynamic.
+
+1999-08-15  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Fix unfortunate
+	coincidence of variable names between old and new code.
+
+1999-08-12  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-arm.h (elf32_arm_to_thumb_stub):  Make 'offset' parameter
+	into a bfd_vma and 'addend' parameter a 'bfd_signed_vma'.
+	(elf32_thumb_to_arm_stub):  Make 'offset' parameter into a bfd_vma
+	and 'addend' parameter a 'bfd_signed_vma'.
+	(elf32_arm_final_link_relocate): Do not involve stubs in
+	R_ARM_THM_PC22 relocs relative to section symbols, they are long
+	jumps, not function calls.
+
+1999-08-11  Robin Farine <advanc@dial.eunet.ch>
+
+	* elf32-arm.h (elf32_arm_final_link_relocate): Check for overflow
+	in R_ARM_PC24 relocs.
+
+Tue Aug 10 12:48:09 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (elf_hppa_fake_sections): New function.
+	* elf32-hppa.c (elf_backend_fake_sections): Define.
+
+	* elf-hppa.h (elf_hppa_final_write_processing): Update for
+	recent changes to the arch_info structure.
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle
+	R_HPPA_SEGBASE and R_HPPA_SEGREL32.
+	* cpu-hppa.c (bfd_hppa20w_arch): New entry in architecture info
+	list.
+
+Tue Aug 10 00:34:29 1999  Mark P. Mitchell  <mark@codesourcery.com>
+	                  Ralf Baechle <ralf@uni-koblenz.de>
+
+	* elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Always
+	output DT_MIPS_GOTSYM.
+	(_bfd_mips_elf_finish_dynamic_sections): Use the same value as
+	DT_MIPS_SYMTABNO if there are no global GOT symbols.
+
+Tue Aug 10 00:21:08 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_create_dynamic_relocation): Change
+	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. 
+	
+	* elflink.h (elf_bfd_final_link): Tweak last change.
+
+1999-08-09  Mark Mitchell  <mark@codesourcery.com>
+
+	* elflink.h (elf_link_size_reloc_section): Use the counts in the
+	elf-section data to allocate just the right amount of relocation
+	space.  Don't allocate the hash space twice.
+	(elf_bfd_final_link): Calculate the amount of space to allocate in
+	each relocation section.
+
+Mon Aug  9 17:37:30 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type, case 32): When in
+	64bit mode, generate a section relative relocation for a 32bit
+	wide relocation.
+	(elf_hppa_is_local_label_name): New function.
+	* elf32-hppa.c (elf_hppa_is_local_label_name): Deleted.  To be
+	shared between 32bit and 64bit port.
+
+1999-08-09  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (elf_mips_howto_table): Fix src_mask for
+	R_MIPS_GOT16 and R_MIPS_CALL16.
+	(mips_elf_got16_entry): Use mips_elf_high to calculate the value
+	to use when looking for a preexisting GOT entry.
+
+1999-08-09  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf64-sparc.c (sparc64_elf_relocate_section): Back out part of
+	the Sep. 4th, 1998 change.  glibc 2.0.x dynamic linker had bug,
+	not binutils.
+	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+
+1999-08-09  Geoff Keating  <geoffk@cygnus.com>
+
+	* elflink.h (elf_link_output_extsym): Don't output a weak
+	reference to an undefined symbol just because it was defined weak
+	in a shared object.
+
+1999-08-09  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* coffgen.c (coff_find_nearest_line): When looking for file, use
+	last best match rather than first.  If address is beyond last line
+	number record, don't return the last line as the correct value.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* section.c (SEC_SMALL_DATA): Rename from SEC_SHORT.
+	* bfd-in2.h: Rebuild.
+
+1999-08-08  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* libcoff-in.h (struct coff_section_alignment_entry): Define.
+	* coffcode.h (coff_set_custom_section_alignment): New static
+	function.
+	(coff_section_alignment_table): New static array.
+	(coff_new_section_hook): Use coff_set_customer_section_alignment.
+	* coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
+	* coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
+	* libcoff.h: Rebuild.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Rename .dep* files to DEP*.  Change DEP variable to
+	MKDEP.
+	* Makefile.in: Rebuild.
+
+1999-08-08  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* section.c (SEC_SHARED): Define.
+	* coffcode.h (sec_to_styp_flags): Handle SEC_SHARED.
+	(styp_to_sec_flags): Likewise.
+	* peicode.h (coff_swap_scnhdr_out): Likewise.
+	* bfd-in2.h: Rebuild.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* coffcode.h (coff_classify_symbol): Comment out part of
+	1999-08-05 change which breaks cygwin DLLs.
+
+	* acinclude.m4 (BFD_BINARY_FOPEN): Change -windows to -windows*.
+	* aclocal.m4, configure: Rebuild.
+
+1999-08-06  Ian Lance Taylor  <ian@zembu.com>
+
+	* section.c (global_syms): Only initialize union field if
+	__STDC__.
+
+1999-08-04  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_got16_entry): Don't multiply GOT index by
+	the size of a GOT entry here.
+	(mips_elf_calculate_relocation): Don't create a local GOT entry
+	for the symbol in a GOT16 relocation; just for it's high-order bit
+	(_bfd_mips_elf_relocate_section): Fix thinko.
+
+1999-08-05  Ian Lance Taylor  <ian@zembu.com>
+
+	Based on patches from Donn Terry <donn@interix.com>:
+	* coffcode.h (enum coff_symbol_classification): Define.
+	(bfd_coff_backend_data): Rename _bfd_coff_sym_is_global to
+	_bfd_coff_classify_symbol.  Change return type.
+	(bfd_coff_classify_symbol): Rename from bfd_coff_sym_is_global.
+	(coff_slurp_symbol_table): Use coff_classify_symbol.
+	(coff_classify_symbol): New static function.
+	(coff_sym_is_global): Never define.
+	(bfd_coff_std_swap_table): Initialize with coff_classify_symbol.
+	* cofflink.c (coff_link_check_ar_symbols): Use
+	bfd_coff_classify_symbol rather than bfd_coff_sym_is_global.
+	(coff_link_add_symbols): Likewise.
+	(_bfd_coff_link_input_bfd): Likewise.
+	* coff-sh.c (bfd_coff_small_swap_table): Initialize with
+	coff_classify_symbol.
+	* libcoff.h: Rebuild.
+
+Wed Aug  4 18:08:07 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* libhppa.h (R_HPPA_LTPSEL, R_HPPA_RTPSEL): New field selectors
+	(e_ltpsel, e_rtpsel): Similarly.
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle 21bit e_ltpsel
+	and 14bit ertpsel.  Handle 64bit psel.
+
+1999-08-04  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_relocate_section): Tweak HI16/LO16
+	handling for REL relocations.  And only left-shift R_MIPS26
+	relocation addends where necessary.
+
+1999-08-03  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_next_lo16_addend): Rename to ...
+	(mips_elf_next_lo16_relocation): Don't compute the addend here.
+	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.
+
+1999-08-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-ppc.c (ppc_elf_relocate_section): Don't use the relocation
+	value of a symbol in a SEC_DEBUGGING section.  Warn when doing a
+	relocation against a symbol in an input section with no output
+	section.  From Daniel Jacobowitz <drow@false.org>.
+
+	* coff-stgo32.c (go32_stubbed_coff_object_p): Remove; not used.
+
+	* acinclude.m4 (BFD_CC_FOR_BUILD): Change to use conftest, and to
+	look for generated file correctly.
+	* aclocal.m4, configure: Rebuild.
+
+1999-08-02  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_relocate_section): Handle R_MIPS_26
+	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
+	some fields.
+	* elf64-sparc.c (sparc64_elf_output_arch_syms): Declare used
+	variables and initialize them.
+
+1999-08-01  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_final_link): Handle the case where
+	there are no global symbols requiring GOT entries.
+	(_bfd_mips_elf_size_dynamic_sections): Likewise.
+	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+	(_bfd_mips_elf_finish_dynamic_sections): Likewise.
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Undefined weak
+	symbols are considered to have the value zero.
+	(_bfd_mips_elf_relocate_section): Don't try to perform a
+	relocation for an undefined symbol.
+	(_bfd_mips_elf_check_relocs): Allocate locate GOT space for local
+	GOT16 relocations.
+
+1999-07-30  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf64-sparc.c (sparc64_elf_build_plt): Cosmetic change - ABI
+	wants ba,a,pt %xcc instead of %icc.
+	Emit correct .PLT0-(.PLTN+4) initial value into the pointer slots
+	of large PLT entries.
+	(sparc64_elf_plt_ptr_offset): Fix calculation.
+	(sparc64_elf_finish_dynamic_symbol): Negative value of R_SPARC_JMP_SLOT
+	addend should be relative to load address, not .plt section start.
+	(sparc64_elf_size_info): Sparc64 uses 32bit .hash entries.
+
+1999-07-30  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf-bfd.h (struct elf_backend_data): Add
+	print_symbol_all and output_arch_syms backend methods.
+	* elfxx-target.h: Likewise.
+	* elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create,
+	sparc64_elf_add_symbol_hook, sparc64_elf_output_arch_syms,
+	sparc64_elf_get_symbol_type, sparc64_elf_symbol_processing): New
+	functions.
+	(sparc64_elf_size_dynamic_sections): Leave space for STT_REGISTER
+	symbols in .dynsym, add their names into .dynstr. Put those symbols
+	into dynlocal.
+	(sparc64_elf_finish_dynamic_sections): Fix up DT_SPARC_REGISTER
+	pointers to STT_REGISTER symbols in dynsym section.
+	(sparc64_elf_print_symbol_all): New function.
+	* elf.c (bfd_elf_print_symbol): Allow special backend symbol
+	printing using the print_symbol_all hook.
+
+1999-07-30  Catherine Moore  <clm@cygnus.com>
+
+	* elf32-arm.h (elf32_arm_check_relocs):  Use r_offset for
+	R_ARM_GNU_VTENTRY.
+
+1999-07-29  Richard Henderson  <rth@cygnus.com>
+
+	* elf32-mips.c (_bfd_mips_elf_final_link): Only re-sort dynsyms if
+	dynamic_sections_created.
+
+1999-07-29  Richard Henderson  <rth@cygnus.com>
+
+	* elf32-mips.c (mips_info_to_howto_rel): Split out switch to ...
+	(mips_rtype_to_howto): ... new function.
+	(_bfd_mips_elf_relocate_section): Use it.
+
+1999-07-28  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_relocate_section): Fix typo.
+
+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'.
+
+1999-07-23  Donn Terry  <donn@interix.com>
+
+	* libcoff-in.h (coff_link_hash_entry): Add coff_link_hash_flags
+	field, and define COFF_LINK_HASH_PE_SECTION_SYMBOL.
+	* cofflink.c (coff_link_add_symbols): If PE, handle section
+	symbols specially.
+	* libcoff.h: Rebuild.
+
+	* config.bfd (i[3456]86-*-interix*): New target.
+
+1999-07-21  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* coffcode.h (styp_to_sec_flags): If COFF_LONG_SECTION_NAMES and
+	COFF_SUPPORT_GNU_LINKONCE, mark sections whose names begin with
+	.gnu.linkonce with SEC_LINKONCE and SEC_LINK_DUPLICATES_DISCARD.
+	* coff-go32.c: (COFF_LONG_SECTION_NAMES): Define.
+	(COFF_SUPPORT_GNU_LINKONCE): Define.
+	* coff-stgo32.c: (COFF_LONG_SECTION_NAMES): Define.
+	(COFF_SUPPORT_GNU_LINKONCE): Define.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* makefile.dos: Remove; obsolete.
+	* configure.bat: Remove; obsolete.
+
+1999-07-21  H.J. Lu  <hjl@gnu.org>
+
+	* config.bfd (i[3456]86-*-vxworks*): Add targ_underscore=yes.
+
+1999-07-21  Philippe De Muyter  <phdm@macqel.be>
+
+	* cofflink.c (_bfd_coff_generic_relocate_section): Issue an error
+	message	and fail if a symbol index is out of range.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Get the GP value
+	when looking at a R_MIPS_GOT16 relocation.
+
+1999-07-20  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-m88k.c: Use CREATE_BIG_COFF_TARGET_VEC.
+
+Mon Jul 19 14:03:44 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_final_link): Restore setting of GP
+ 	removed in previous change.
+	(_bfd_mips_elf_relocate_section): Adjust GP relative relocations
+ 	in relocateable output.
+
+1999-07-19  Ian Lance Taylor  <ian@zembu.com>
+
+	* coff-m88k.c (m88kbcs_vec): Initialize new field of bfd_target
+	structure.
+
+	* elflink.h (elf_merge_symbol): Do merge symbols from the same BFD
+	if they appear to be specially created by the linker.
+
+1999-07-19  Nick Clifton  <nickc@cygnus.com>
+
+	* targets.c (alternative_target): New field in bfd_target
+	structure.
+	(bfd_search_for_target): New function:  Find a target that
+	satisifies a search function.
+	* bfd-in2.h: Regenerate.
+
+	* elfxx-target.h: Initialise the alternative_target field of
+	the bfd_target structures to point to the other target (if
+	defined).
+	* 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. 
+	* coff-a29k.c: Use CREATE_BIG_COFF_TARGET_VEC.
+	* 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-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-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-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. 
+
+1999-07-19  Andreas Schwab  <schwab@suse.de>
+
+	* elflink.h (elf_bfd_final_link): Remove unused variables rel_hash
+	and rel_hdr.
+
+Sat Jul 17 02:28:28 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* 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 
+	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 
+	a relocateable object.
+	(_bfd_mips_elf_relocate_section): Handle relocateable links.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf64-sparc.c (sparc64_elf_info_to_howto): Use ELF64_R_TYPE_ID.
+	(sparc64_elf_get_reloc_upper_bound,
+	sparc64_elf_get_dynamic_reloc_upper_bound,
+	sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table,
+	sparc64_elf_canonicalize_dynamic_reloc, sparc64_elf_write_relocs):
+	New functions.
+	(sparc64_elf_check_relocs, sparc64_elf_relocate_section): Use
+	ELF64_R_TYPE_ID/DATA where appropriate.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf64-sparc.c (sparc64_elf_size_dynamic_sections): Remove
+	DT_SPARC_PLTFMT.
+
+1999-07-16  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-mips.c (mips_elf_local_relocation_p): New static
+	function.
+	(mips_elf_next_lo16_addend): Call bfd_set_error on failure.
+	(mips_elf_calculate_relocation): Use mips_elf_local_relocation_p.
+	Always set *require_jalxp.
+	(mips_elf_stub_section_p): Mark abfd parameter as unused.
+	(_bfd_mips_elf_relocate_section): Only look for LO16 following
+	GOT16 if the GOT16 is against a local symbol.  Don't return false
+	for an undefined symbol.  If there is an overflow, assert that we
+	have a name.
+
+1999-07-16  Andreas Schwab  <schwab@suse.de>
+
+	* elflink.h (elf_link_record_local_dynamic_symbol): Remove unused
+	variables `link' and `elfsec'.
+	(elf_bfd_final_link): Remove unused variable `os'.
+
+Thu Jul 15 17:55:31 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_modify_segment_map): Don't require
+	a PT_PHDR program headers.
+	(_bfd_mips_elf_final_link): Don't assume there are going to be
+	section symbols when we're not building a shared object.
+	(_bfd_mips_elf_check_relocs): Make sure we have a GOT when
+	we need one.
+
+1999-07-15  J.T. Conklin  <jtc@redback.com>
+
+	* config.bfd (i[3456]86-*-vxworks*): New target.
+
+1999-07-15  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_stub_section_p): New function.
+	(mips_elf_calculate_relocation): Handle MIPS16 stub functions.
+	(mips_elf_relocate_section): Adjust calling sequence for
+	mips_elf_calculate_relocation and mips_elf_perform_relocation.
+	(mips_elf_perform_relocation): Turn `jal' into `jalx' where
+	required.
+
+1999-07-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Bump version number to 2.9.5.
+	* configure: Rebuild.
+
+Thu Jul 15 02:56:15 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type, case R_HPPA): Handle
+	64bit format.
+	(_bfd_elf_hppa_gen_reloc_type, case R_GOTOFF): Use base reloc type
+	to derive final type instead of hardwiring a selection.
+
+1999-07-14  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_obtain_contents): Swap 16-bit halves of
+	things relocated by R_MIPS16_GPREL.
+	(mips_elf_perform_relocation): Likewise.
+
+Wed Jul 14 15:23:19 1999  Jim Wilson  <wilson@cygnus.com>
+
+	* elfxx-target.h (elfNN_bed): Add elf_backend_want_dynbss.
+
+1999-07-14  Richard Henderson  <rth@cygnus.com>
+
+	* elf32-mips.c (struct mips_got_info): Add global_gotno.
+	(_bfd_mips_elf_size_dynamic_sections): Set it.
+	(_bfd_mips_elf_final_link): Re-sort; verify the got did not grow.
+	(mips_elf_sort_hash_table): Set max_non_got_dynindex based off
+	new argument max_local.
+
+1999-07-14  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_obtain_contents): Swap the 16-bit
+	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.
+	(mips_elf_obtain_contents): Use bfd_get.
+	(mips_elf_perform_relocation): Handle R_MIPS16_GPREL.
+	(mips_elf_relocate_section): Likewise.
+
+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_perform_relocation.
+	(mips_elf_perform_relocation): Take additional argument.  Handle
+	R_MIPS16_26.  Use bfd_put for convenience.
+
+1999-07-13  Richard Henderson  <rth@cygnus.com>
+
+	* elf.c (assign_file_positions_for_segments): Thinko last change.
+	Always overwrite p_flags.
+
+1999-07-13  Richard Henderson  <rth@cygnus.com>
+
+	* elf-bfd.h (struct elf_backend_data): Add want_dynbss.
+	* elflink.c (_bfd_elf_create_dynamic_sections): Only create
+	.dynbss and .rel[a].bss if want_dynbss.
+	* elfxx-target.h (elf_backend_want_dynbss): Provide default.
+
+1999-07-13  Richard Henderson  <rth@cygnus.com>
+
+	* elf.c (assign_file_positions_for_segments): Don't overwrite p_flags.
+
+1999-07-13  Richard Henderson  <rth@cygnus.com>
+
+	* elf-bfd.h (struct elf_link_local_dynamic_entry): New.
+	(struct elf_link_hash_table): Add dynlocal.
+	(_bfd_elf_link_lookup_local_dynindx): Prototype.
+	(_bfd_elf_link_adjust_dynindx): Delete.
+	(_bfd_elf_link_renumber_dynsyms): Prototype.
+	(_bfd_elf,link_record_local_dynamic_symbol): Prototype.
+	* elfcode.h (elf_link_record_local_dynamic_symbol): New alias.
+	* elflink.c (_bfd_elf_link_adjust_dynindx): Delete.
+	(_bfd_elf_link_lookup_local_dynindx): New function.
+	(elf_link_renumber_hash_table_dynsyms): New function.
+	(_bfd_elf_link_renumber_dynsyms): New function.
+	* elflink.h (elf_link_record_local_dynamic_symbol): New function.
+	(struct elf_assign_sym_version_info): Delete removed_dynamic.
+	(bfd_elf,size_dynamic_sections): Use _bfd_strip_section_from_output
+	instead of elf_link_remove_section_and_adjust_dynindices.
+	Remove removed_dynamic code.  Use _bfd_elf_link_renumber_dynsyms.
+	(elf_link_assign_sym_version): Remove removed_dynamic code.
+	(elf_link_renumber_dynsyms): Delete.
+	(elf_bfd_final_link): Install section and local symbols into .dynsym.
+
+	* elf32-m68k.c (elf_m68k_adjust_dynindx): Delete.
+	(elf_m68k_size_dynamic_sections): Don't set section dynindicies.
+	(elf_m68k_finish_dynamic_sections): Don't write section dynsyms.
+	* elf32-mips.c: Similarly.
+	* elf32-ppc.c: Similarly.
+	* elf32-sparc.c: Similarly.
+	* elf64-alpha.c: Similarly.
+	* elf64-sparc.c: Similarly.
+
+1999-07-13  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Do not complain
+	when _gp_disp is undefined.  Do not check R_MIPS_LO16 for overflow
+	when the relocation is against _gp_disp.
+
+1999-07-12  Mark Mitchell  <mark@codesourcery.com>
+
+	* dwarf2.c (read_attribute): Support DW_FORM_ref8.
+	* elf32-mips.c (mips_elf_link_hash_entry): Change mips_32_relocs
+	to possibly_dynamic_relocs.  Adjust usage throughout code.
+	(elf_mips_howto_table): Handle R_MIPS_64 correctly.
+	(elf_mips_ctor64_howto): Likewise.
+	(mips_elf_calculate_relocation): Handle R_MIPS_64 like R_MIPS_32.
+	Adjust indentation.
+	(mips_elf_relocate_section): Handle R_MIPS_64 in 32-bit mode.
+	(_bfd_mips_elf_check_relocs): Handle R_MIPS_64 like R_MIPS_32.
+	Use MIPS_ELF_GOT_SIZE to calculate the size of GOT entries.
+	* elf64-mips.c (elf_backend_may_use_rel_p): Define.
+
+1999-07-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Rebuild dependencies.
+	* Makefile.in: Rebuild.
+
+	* bfd-in.h: Remove tests of COFF_IMAGE_WITH_PE.
+	* bfd-in2.h: Rebuild.
+
+	* Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+	as appropriate.  Use EMPTY_HOWTO as appropriate.  Fill in
+	structure initializations.  Add casts.
+	* reloc.c (EMPTY_HOWTO): Define.
+	* bfd-in2.h: Rebuild.
+	* coff-h8300.c (h8300_reloc16_extra_cases): Remove useless
+	comparisons against 0.
+	* elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Change
+	previous_ibfd_e_flags to unsigned long.
+	* vms.h (struct vms_private_data_struct): Change section_count to
+	unsigned.
+	* vms-gsd.c (_bfd_vms_slurp_gsd): Change psect_idx to unsigned.
+	(_bfd_vms_write_gsd): Change symnum to unsigned.
+	* vms-hdr.c (_bfd_vms_write_hdr): Change symnum to unsigned.
+	* vms-tir.c (etir_sta): Change psect to unsigned.
+	(alloc_section): Change idx to unsigned.
+	(tir_sta, tir_ctl): Change psect to unsigned.
+	(_bfd_vms_write_tir): Change len and before to bfd_size_type.
+	* vms.c (priv_section_count): Change to unsigned.
+
+1999-07-12  Andreas Schwab  <schwab@suse.de>
+
+	* elf32-m68k.c: Add some ATTRIBUTE_UNUSED.
+	* m68klinux.c: Likewise.
+
+1999-07-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Changes to avoid gcc warnings: Remove unused local
+	variables.  Add default case to enum switches.
+	* coff-arm.c (bfd_arm_allocate_interworking_sections): Only
+	compile if not COFF_IMAGE_WITH_PE.
+	(record_arm_to_thumb_glue, record_thumb_to_arm_glue): Likewise.
+	(bfd_arm_get_bfd_for_interworking): Likewise.
+	(bfd_arm_process_before_allocation): Likewise.
+	* epoc-pei-arm.c: Don't rename bfd_arm functions.
+	* pei-arm.c: Likewise.
+	* elf32-mips.c (mips_elf_link_hash_table_create): Don't declare.
+	(MIPS_ELF_ADD_DYNAMIC_ENTRY): Correct last change.
+	(mips_elf_got16_entry): Put parens around & in body of ==.
+	(mips_elf_calculate_relocation): Correct test for empty string.
+	* vms-gsd.c: Use _bfd_error_handler rather than fprintf to
+	stderr.
+	* vms-misc.c (_bfd_vms_length_hash_symbol): Correct sprintf
+	format.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+	as appropriate.  Fill in structure initializations.  Add variable
+	initializations.  Add casts.
+	* dwarf1.c (parse_line_table): Change eachLine to unsigned long.
+	(dwarf1_unit_find_nearest_line): Change i to unsigned long.
+
+	* elf.c (bfd_elf_hash): Change parameter from unsigned char * to
+	char *.
+	* elf-bfd.h (bfd_elf_hash): Update declaration.
+	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Remove casts
+	when calling bfd_elf_hash.
+
+1999-07-11  Mark Mitchell  <mark@codesourcery.com>
+
+	* libbfd.c (bfd_put_8): Make it of type `void'.
+	* bfd-in2.h: Regenerated.
+	* elf32-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Conditionalize
+	for 32-bit hosts.
+	(_bfd_mips_elf_final_link): Likewise.
+
+	* elflink.h (elf_link_read_relocs_from_section): Be type-correct.
+
+Thu Jul  8 12:32:23 1999  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* config.bfd (hppa*-*-linux-gnu*): New target
+
+1999-07-07  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf-bfd.h (_bfd_mips_elf_section_from_shdr): Constify.
+	(_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_sections): Likewise.
+	(_bfd_mips_elf_gc_mark_hook): Likewise.
+	(_bfd_mips_elf_gc_sweep_hook): Likewise.
+	(_bfd_mips_elf_always_size_sections): Likewise.
+	(_bfd_mips_elf_size_dynamic_sections): Likewise.
+	(_bfd_mips_elf_check_relocs): Likewise.
+	(_bfd_mips_elf_link_hash_table_create): Likewise.
+	(_bfd_mips_elf_print_private_data): Likewise.
+	(_bfd_mips_elf_link_output_symbol_hook): Likewise.
+	(_bfd_mips_elf_final_link): Likewise.
+	(_bfd_mips_elf_additional_program_headers): Likewise.
+	(_bfd_mips_elf_modify_segment_map): Likewise.
+	(_bfd_mips_elf_relocate_section): Likewise.
+	* elf32-mips.c (mips_elf32_object_p): Move contents into
+	_bfd_mips_elf_object_p.
+	(mips_elf_additional_program_headers): Rename to
+	_bfd_mips_elf_additional_program_headers.
+	(mips_elf_modify_segment_map): Rename to
+	_bfd_mips_elf_modify_segment_map.
+	(elf_mips_abi_name): Change prototype.
+	(mips_elf32_section_from_shdr): Merge into
+	_bfd_mips_elf_section_from_shdr.
+	(mips_elf32_section_processing): Merge into
+	_bfd_mips_elf_section_processing.
+	(mips_elf_final_link): Rename to _bfd_mips_elf_final_link.  Invoke
+	the right back-end ELF linker.
+	(mips_elf_relocate_section): Rename to
+	_bfd_mips_elf_relocate_section.  Clean up.  Adjust for 64-bit code.
+	(mips_elf_link_output_symbol_hook): Rename to
+	_bfd_mips_elf_link_output_symbol_hook.
+	(mips_elf_create_dynamic_section): Rename to
+	_bfd_mips_elf_create_dynamic_section.
+	(mips_elf_check_relocs): Rename to _bfd_mips_elf_check_relocs.
+	Adjust for 64-bit code.  Use mips_elf_got_section.
+	(mips_elf_adjust_dynamic_symbol): Rename to
+	_bfd_mips_elf_adjust_dynamic_symbol.  Use
+	mips_elf_allocate_dynamic_relocations.
+	(mips_elf_finish_dynamic_symbol): Rename to
+	_bfd_mips_elf_finish_dynamic_symbol.  Use mips_elf_got_section.
+	Adjust for 64-bit code.
+	(mips_elf_finish_dynamic_sections): Rename to
+	_bfd_mips_elf_finish_dynamic_sections.  Adjust for 64-bit code.
+	(mips_elf_always_size_sections): Rename to
+	_bfd_mips_elf_always_size_sections.
+	(mips_elf_add_symbol_hook): Rename to
+	_bfd_mips_elf_add_symbol_hook.
+	(mips_elf_next_lo16_addend): Constify.
+	(mips_elf_calculate_relocation): Likewise.
+	(mips_elf_obtain_contents): Likewise.
+	(mips_elf_perform_relocation): Likewise.
+	(mips_elf_create_dynamic_relocation): Likewise.
+	(mips_elf_allocate_dynamic_relocations): New function.
+	(MIPS_ELF_REL_DYN_SECTION_NAME): New macro.
+	(MIPS_ELF_REL_SIZE): Likewise.
+	(MIPS_ELF_DYN_SIZE): Likewise.
+	(MIPS_ELF_GOT_SIZE): Likewise.
+	(MIPS_ELF_SYM_SIZE): Likewise.
+	(MIPS_ELF_LOG_FILE_ALIGN): Likewise.
+	(MIPS_ELF_GET_WORD): Likewise.
+	(MIPS_ELF_PUT_WORD): Likewise.
+	(MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise.
+	(STUB_LW): Conditionalize for 64-bit value.
+	(elf_mips_howto_table): Add R_MIPS_HIGHER and R_MIPS_HIGHEST
+	entries.
+	(_bfd_mips_elf_merge_private_bfd_data): Merge e_ident[EI_CLASS].
+	Check it for inconsistency.
+	(_bfd_mips_elf_print_private_bfd_data): Print ABI=64 for 64-bit
+	ABI.
+	(_bfd_mips_elf_fake_sections): Remove duplicate handling of
+	.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.
+	(mips_elf_local_got_index): Likewise.
+	(mips_elf_got_page): Likewise.
+	(mips_elf_got_info): Likewise.
+	(mips_elf_create_dynamic_relocation): Handle 32-bit/64-bit split.
+	(ELF_DYNAMIC_INTERPRETER): Handle 64-bit code.
+	(mips_elf_create_dynamic_sections): Use MIPS_ELF_LOG_FILE_ALIGN,
+	instead of constant `2'.
+	(mips_elf_create_got_section): Tidy.  Use MIPS_ELF_GOT_SIZE.
+	(mips_elf_create_msym_section): Use MIPS_ELF_LOG_FILE_ALIGN.
+	(mips_elf_size_dynamic_sections): Use
+	MIPS_ELF_REL_DYN_SECTION_NAME, MIPS_ELF_GOT_SIZE,
+	MIPS_ELF_ADD_DYNAMIC_ENTRY.  Remove #if 0'd code.
+	Adjust all releveant entries in elf backend table.
+	* elf64-mips.c (mips_elf64_section_from_shdr): Remove.
+	(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.
+	(elf_link_output_extsym): Likewise.
+	* elf.c: (elf_fake_sections): Likewise.
+	* libbfd.c (bfd_get): New macro.
+	(bfd_put): Likewise.
+	* bfd-in2.h: Regenerated.
+
+1999-07-07  Mark Mitchell  <mark@codesourcery.com>
+
+	* 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. 
+	* elflink.h (elf_link_read_relocs_from_section): Adjust to handle
+	multiple internal relocations per external relocation.
+	(link_read_relocs): Likewise.
+	(elf_bfd_final_link): Likewise.
+	(elf_link_input_bfd): Likewise.
+	(elf_gc_mark): Likewise.
+	(elf_gc_smash_unused_vtentry_relocs): Likewise.
+	* elfcode.h (elf_swap_dyn_out): Adjust type to match
+	elf_swap_dyn_in.
+	(size_info): Add entries for new fields.
+	* elf64-mips.c (mips_elf64_swap_reloc_out): Enable.
+	(mips_elf64_be_swap_reloc_in): New function.
+	(mips_elf64_be_swap_reloc_out): Likewise.
+	(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
+	field equals the new rel_count field.
+	(elf_link_input_bfd): When doing a relocateable link, use the new
+	rel_count field rather than the reloc_count field.
+	(elf_reloc_link_order): Likewise.
+	(elf_finish_pointer_linker_section): Likewise.
+
+	Based on patch from H.J. Lu <hjl@gnu.org>:
+	* elflink.h (elf_merge_symbol): Permit a non-weak definition in a
+	shared library to override a weak definition in a regular object.
+
+Tue Jul  6 10:23:39 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* libhppa.h: Revert July 2, 1999 patch.
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): T mode selectors
+	need to generate DLTIND relocations, not DLTREL relocations.
+
+1999-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* coffcode.h (coff_set_arch_mach_hook): Recognise arm 5
+	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>
+
+	* dwarf2.c (parse_comp_unit): Add ABBREV_LENGTH parameter.
+	(_bfd_dwarf2_find_nearest_line): Add ADDR_SIZE parameter.
+	* elf.c (_bfd_elf_find_nearest_line): Pass it.
+	* elf32-arm.h (elf32_arm_find_nearest_line): Likewise.
+	* elf32-mips.c (ABI_64_P): New macro.
+	(IRIX_COMPAT): We are IRIX6-compatible if ABI_64_P.
+	(_bfd_mips_elf_find_nearest_line): Adjust call to
+	_bfd_dwarf2_find_nearest_line.
+	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
+	* libbfd.h: Regenerated.
+
+1999-07-02  Ian Lance Taylor  <ian@zembu.com>
+
+	* config.bfd: Add * at the end of i[3456]86-*-unixware.
+
+Fri Jul  2 12:21:10 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* libhppa.h (HPPA_R_ARG_RELOC): Delete.
+	(HPPA_R_CONSTANT, HPPA_R_ADDEND): Likewise.
+
+1999-07-01  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf-bfd.h (bfd_elf_section_data): Add rel_count and rel_count2
+	fields.
+	(_bfd_elf_init_reloc_shdr): New function.
+	* elf.c (_bfd_elf_new_section_hook): Use bfd_zalloc, rather than
+	bfd_alloc followed by memset.
+	(_bfd_elf_init_reloc_shdr): New function, split out from ...
+	(elf_fake_sections): Here.
+	(assign_section_numbers): Assign section numbers for the second
+	relocation section, if required.
+	* elflink.h (elf_link_output_relocs): New function.
+	(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.
+
+Thu Jul  1 13:58:48 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle R_PCREL_CALL
+	with 22bit format.
+
+1999-06-28  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_got_info): Move declaration before
+	prototypes.  Change global_gotsym to be a pointer to a hash entry,
+	rather than a number index.
+	(mips_elf_link_hash_entry): Move declaration before prototypes.
+	(mips_elf_irix6_finish_dynamic_symbol): New function.
+	(mips_elf_sign_extend): Likewise.
+	(mips_elf_high): Likewise.
+	(mips_elf_higher): Likewise.
+	(mips_elf_highest): Likewise.
+	(mips_elf_global_got_index): Likewise.
+	(mips_elf_local_got_index): Likewise.
+	(mips_elf_got_offset_from_index): Likeiwse.
+	(mips_elf_record_global_got_symbol): Likewise.
+	(mips_elf_got_page): Likewise.
+	(mips_elf_next_lo16_addend): Likewise.
+	(mips_elf_calculate_relocation): Likewise.
+	(mips_elf_obtain_contents): Likewise.
+	(mips_elf_perform_relocation): Likewise.
+	(mips_elf_assign_gp): Likewise.
+	(mips_elf_sort_hash_table_f): Likewise.
+	(mips_elf_sort_hash_table): Likewise.
+	(mips_elf_got_section): Likewise.
+	(mips_elf_got_info): Likewise.
+	(mips_elf_create_local_got_entry): Likewise.
+	(mips_elf_got16_entry): Likewise.
+	(mips_elf_create_dynamic_relocation): Likewise.
+	(elf_mips_howto_table): Add description of R_MIPS_SCN_DISP.
+	(mips_elf_final_gp): Use mips_elf_assign_gp.
+	(_bfd_mips_elf_symbol_processing): Don't move SHN_COMMON symbols
+	into SHN_SCOMMON automatically on IRIX6.
+	(mips_elf_add_symbol_hook): Likewise.
+	(mips_elf_relocate_section): Rewrite, using
+	mips_elf_calculate_relocation and mips_elf_perform_relocation.
+	(mips_elf_create_dynamic_section): Use MIPS_ELF_STUB_SECTION_NAME.
+	Don't deal with .rld_map on IRIX6.
+	(mips_elf_create_got_section): Adjust use of global_gotsym.  Set
+	section flags appropriately for .got.
+	(mips_elf_check_relocs): Handle IRIX6 relocations making use of
+	the got.  Call mips_elf_record_global_got_symbol and allocate
+	local got space appropriately.
+	(mips_elf_size_dynamic_sections): Use bfd_byte *, not unsigned
+	char *.  Rework calculation of GOT size.  Sort dynamic symbol
+	table entries so entries that do not require GOT entries appear at
+	the beginning.  Don't use DT_MIPS_HIPAGENO on IRIX6.  Remove dead
+	code dealing with DT_INIT and DT_FINI.  Remove fiddling with
+	global_gotsym.
+	(mips_elf_finish_dynamic_symbol): Adjust creation of global GOT
+	entries.
+	(mips_elf_finish_dynamic_symbol): Use
+	mips_elf_irix6_finish_dynamic_symbol.
+	(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
+	relocateable link.  From Ralf Baechle <ralf@uni-koblenz.de>.
+
+1999-06-04  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf_backend_got_header_size): Define.
+	(elf_backend_plt_header_size): Likewise.
+
+1999-06-28  Jim Pick  <jim@jimpick.com>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Mind no_undefined
+
+Tue Jun 29 02:25:03 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.c (elf_hppa_howto_table): Use bfd_elf_generic_reloc as
+	relocation function.
+	* elf32-hppa.c (hppa_elf_reloc): Kill unused/unwanted function.
+
+1999-06-27  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (MIPS_ELF_SRDATA_SECTION_NAME): New macro.
+	(MIPS_ELF_OPTIONS_SECTION_NAME): Likewise.
+	(MIPS_ELF_STUB_SECTION_NAME): Likewise.
+	(_bfd_mips_elf_section_from_shdr): Use them.
+	(_bfd_mips_elf_fake_sections): Likewise.  Add .srdata to the list
+	of GP-relative sections.
+	(_bfd_mips_elf_set_section_contents): Use them.
+	(_bfd_mips_elf_section_processing): Share code between .sdata and
+	.lit4/.lit8 sections.  Set appropriate flags for .srdata.
+	(mips_elf_additional_program_headers): Add handling for
+	PT_MIPS_OPTIONS segment on IRIX6.
+	(mips_elf_modify_segment_map): Likeiwse.
+	(mips_elf_final_link): Set EF_MIPS_CPIC when required by the ABI.
+	Include the options sections on IRIX6.  Don't look for GP-relative
+	sections by name; use SHF_MIPS_GPREL instead.
+	(ELF_DYNAMIC_INTERPRETER): Adjust to use /usr/lib32/libc.so.1 for
+	the N32 ABI.
+	(mips_elf_create_dynamic_sections): Don't muck about with section
+	alignments and such on IRIX6.
+	(mips_elf_adjust_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
+	(mips_elf_size_dynamic_sections): Likewise. Adjust to handle the
+	fact that ELF_DYNAMIC_INTERPRETER is no longer a constant.  Use
+	bfd_zalloc rather than bfd_alloc and memset.
+	(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.
+
+1999-06-26  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (mips_elf_swap_msym_in): New function.
+	(mips_elf_swap_msym_out): New function.
+	(mips_elf_create_msym_section): Likewise.
+	(MIPS_ELF_MSYM_SECTION_NAME): New macro.
+	(_bfd_mips_elf_final_write_processing): Set sh_link for .msym.
+	(_bfd_mips_elf_section_from_shdr): Reject an SHT_MIPS_MSYM
+	section not named .msym.
+	(_bfd_mips_elf_fake_sections): Use MIPS_ELF_MSYM_SECTION_NAME, not
+	.msym directly.  Set appropriate attributes for the .msym
+	section.
+	(mips_elf_link_hash_entry): Add min_dyn_reloc_index field.
+	(mips_elf_link_hash_newfunc): Clear it.
+	(mips_elf_create_dynamic_sections): Create the .msym section
+	on IRIX6.
+	(mips_elf_size_dynamic_sections):  Allocate space for the
+	.msym section.  Add a DT_MIPS_MSYM entry.
+	(mips_elf_finish_dynamic_symbol): Write out a .msym entry for
+	the symbol.
+	(mips_elf_finish_dynamic_sections): Assign a value for
+	DT_MIPS_MSYM.  Add .msym entries for the section symbols as well.
+
+	* elf32-mips.c (irix_compat_t): New enumeration.
+	(ABI_N32_P): New macro.
+	(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
+	as writable PE sections.
+
+1999-06-26  David Mosberger  <davidm@hpl.hp.com>
+
+	* dwarf2.c (struct arange): New type.
+	(struct comp_unit): Replace LOW and HIGH by member ARANGE.
+	(arange_add): New function.
+	(decode_line_info): Keep track of address ranges that a compilation
+	unit covers.
+	(comp_unit_contains_address): Return true if address is contained
+	in _any_ of the address ranges associated with a compilation unit.
+	(_bfd_dwarf2_find_nearest_line): Call comp_unit_find_nearest_line
+	on the first comp_unit that contains the address.
+
+1999-06-26  David Mosberger  <davidm@hpl.hp.com>
+
+	* dwarf2.c (struct dwarf2_debug): Add member dwarf_line_buffer.
+	(decode_line_info): Add variable STASH and initialize it to point
+	to the per-bfd dwarf2_debug info.  Remove static variable
+	dwarf_line_buffer and use stash->dwarf_line_buffer in its place.
+
+1999-06-26  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_link_output_extsym): It's OK for a -Bsymbolic
+	shared library to have an undefined symbol.
+
+	From Franz Sirl <Franz.Sirl-kernel@lauterbach.com>:
+	* elf32-ppc.c (ppc_elf_relocate_section): Fix last patch.
+
+Thu Jun 24 20:59:11 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.c (elf_hppa_final_write_processing): New function.
+	* elf32-hppa.c: Remove everything related to symbol extension
+	sections & records.  Use the common elf_hppa_final_write_processing.
+
+1999-06-22  Mark Mitchell  <mark@codesourcery.com>
+
+	* elflink.h (size_dynamic_sections): Use user-specified init/fini
+	functions instead of _init/_fini if requested.
+
+1999-06-23  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf.c (bfd_section_from_shdr): Avoid crashing on a bogus sh_link
+	field.
+
+1999-06-22  Ian Lance Taylor  <ian@zembu.com>
+
+	From Franz Sirl <Franz.Sirl-kernel@lauterbach.com>:
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Set unused dynindx
+	field to 0, not -1.
+	(ppc_elf_finish_dynamic_sections): Check for positive section
+	dynindx field, rather than comparing against -1.
+	(ppc_elf_relocate_section): Only return false if undefined_symbol
+	or reloc_overflow fail, not always upon encountering an error.
+
+1999-06-22  Mark Mitchell  <mark@codesourcery.com>
+
+	* elflink.h (link_read_relocs): Explicitly cast external_relocs to
+	bfd_byte * before performing pointer arithmetic.
+
+Tue Jun 22 13:06:25 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf-hppa.h: New file.  Common stuff for elf32 and elf64 PA
+	support.
+	* elf32-hppa.c: Include elf-hppa.h.
+	(ARCH_SIZE): Define.
+	(elf_hppa_reloc_type_lookup): Delete.  Found in the common code
+	now.
+	(elf32_hppa_info_to_howto): Similarly.
+	(elf_hppa_howto_table): Similarly.
+	(elf_hppa_reloc_type_lookup): Similarly.
+	(hppa_elf_gen_reloc_type): Similarly.
+	* elf32-hppa.h (ELF_HOWTO_TALBE, N_PARISC_RELOCS): Delete.
+
+1999-06-22  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-v850.c (v850_elf_final_link_relocate): Catch overflow
+	handling R_V850_22_PCREL relocation.
+
+1999-06-21  Ian Lance Taylor  <ian@zembu.com>
+
+	* coff-arm.c (arm_emit_base_file_entry): Explicitly declare return
+	type.
+
+Sun Jun 20 14:13:57 1999  Richard Henderson  <rth@cygnus.com>
+
+	* section.c (_bfd_strip_section_from_output): Ignore sections
+	DISCARDed by the link script.
+
+1999-06-19  Ian Lance Taylor  <ian@zembu.com>
+
+	* elflink.h (elf_link_remove_section_and_adjust_dynindices):
+	Remove unused local variable spp.
+
+	* xcofflink.c (bfd_xcoff_size_dynamic_sections): Don't crash if
+	the entry symbol is not set.
+
+Fri Jun 18 04:24:57 1999  Richard Henderson  <rth@cygnus.com>
+
+	* elf64-alpha.c (elf64_alpha_relocate_section): Don't adjust
+	GPDISP or LITUSE in a relocatable link.
+
+Thu Jun 17 21:24:43 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* dwarf1.c (alloc_dwarf1_unit): Allocate using bfd_zalloc.
+	* (alloc_dwarf1_func): Likewise.
+
+Wed Jun 16 03:09:57 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* libhppa.h: Fix various formatting errors.
+	(assemble_3); Rewrite using CATENATE.
+	(assemble_17): Fix various bugs.
+
+1999-06-16  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-mcore.c (R_MCORE_RAW): Fix definition.
+
+1999-06-15  Richard Henderson  <rth@cygnus.com>
+
+	* section.c (SEC_SHORT): Define.
+	* bfd-in2.h: Rebuild.
+
+1999-06-13  Mark Mitchell  <mark@codesourcery.com>
+
+	* 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
+	function.
+	(bfd_elf_size_dynamic_sections): Use it.
+
+1999-06-13  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* elf32-i386.c (elf_howto_table): Change R_386_PC8 from
+	complain_overflow_bitfield to complain_overflow_signed.
+
+1999-06-13  Mark Mitchell  <mark@codesourcery.com>
+
+	* elflink.h (elf_link_read_relocs_from_section): New function,
+	split out from ...
+	(elf_link_read_relocs): Here.  Use it for both relocation
+	sections.
+
+1999-06-12  Mark Mitchell  <mark@codesourcery.com>
+
+	* elfcode.h (elf_slurp_reloc_table_from_section): Don't assume
+	asect->reloc_count is valid.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* elf32-mips.c (mips_elf32_section_processing): Permit a
+	SHT_MIPS_REGINFO section to have a size of 0.
+
+1999-06-12  David O'Brien  <obrien@freebsd.org>
+
+	* config.bfd (alpha*-*-freebsd*): New target.
+	(i[3456]86-*-freebsd*): Now defaults to ELF.
+
+1999-06-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* reloc.c (_bfd_relocate_contents): Permit bitfield relocations to
+	wrap if the relocation covers the high bit of an address.
+
+	* dwarf2.c (decode_line_info): Remove unused variable first_time.
+
+1999-06-10  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* elf64_sparc.c (sparc64_elf_relocate_section): Use R_SPARC_max_std
+	instead of R_SPARC_max.
+	(sparc64_elf_info_to_howto): Likewise.
+	* elf32_sparc.c (elf32_sparc_relocate_section): Likewise.
+	(elf32_sparc_info_to_howto): Likewise; handle vtable relocations.
+
+1999-06-07  Richard Henderson  <rth@cygnus.com>
+
+	* section.c (_bfd_strip_section_from_output): Remove output
+	sections with no initial link_order.
+
+1999-06-07  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-m88k.c (ELF_MAXPAGESIZE): Define.
+
+Mon Jun  7 11:49:43 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* Makefile.am (SOURCE_HFILES): Add missing headers.
+	* Makefile.in: Regenerated.
+
+1999-06-06  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf32-mips.c (_bfd_mips_elf_print_private_data): Recognize
+	the N32 ABI.
+
+1999-06-04  Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+	* elf32-ppc.c (ppc_elf_relocate_section): Don't barf on out of
+	range undefweak symbols.
+	* hash.c: Add missing comma after @xref{}
+	* linker.c: Likewise.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* elfxx-target.h (ELF_MAXPAGESIZE): Produce an error message
+	if not defined.
+	* elf32-gen.c (ELF_MAXPAGESIZE): Define.
+	* elf32-i860.c (ELF_MAXPAGESIZE): Define.
+	* elf32-i960.c (ELF_MAXPAGESIZE): Define.
+	* elf64-gen.c (ELF_MAXPAGESIZE): Define.
+
+1999-06-04  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Rebuild dependencies.
+	(BFD32_BACKENDS): Add dwarf1.lo.
+	(BFD32_BACKENDS_CFILES): Add dwarf1.c.
+	* Makefile.in: Rebuild.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.am: Add epoc-arm-pe target.
+	* Makefile.in: Regenerate.
+	* pe-arm.c: Only redefine interworking function names if they have
+	not already been redefined.
+	* pei-arm.c: Only redefine interworking function names if they have
+	not already been redefined.
+	* epoc-pe-arm.c: Redefine interworking function names to avoid a
+	name space clash.
+	* epoc-pei-arm.c: Redefine interworking function names to avoid a
+	name space clash.
+
+1999-06-03  Nick Clifton  <nickc@cygnus.com>
+
+	* elfxx-target.h (ELF_MAXPAGESIZE): Default to 0x1000 not 1.
+
+Fri Jun  4 10:05:11 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* elf.c (elf_fake_sections): Undo change of 1999-05-10.
+
+Fri Jun  4 03:10:49 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* elf32-sh.c (sh_elf_relax_delete_bytes): Fix setting of
+	start / stop for recalculating of r_addend of R_SH_SWITCH*.
+
+Fri Jun  4 02:53:13 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH32
+	in other text sections.
+
+Fri Jun  4 02:29:34 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* libbfd.c (_bfd_generic_verify_endian_match): New function.
+	* libbfd-in.h (_bfd_generic_verify_endian_match): Declare.
+	* libbfd.h: Regenerate.
+	* coff-sh.c (sh_merge_private_data): Delete.
+	(coff_bfd_merge_private_bfd_data): Change to
+	_bfd_generic_verify_endian_match.
+	(elf32-sh.c): bfd_elf32_bfd_merge_private_bfd_data: Define.
+
+1999-06-03  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf32-arm.h: Fix typo: change ELF_MAXPAGE_SIZE to ELF_MAXPAGESIZE.
+
+1999-06-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* bfd-in.h (bfd_elf32_arm_allocate_interworking_sections): Correct
+	prototype.
+	(bfd_elf32_arm_process_before_allocation): Likewise.
+	* bfd-in2.h: Rebuild.
+
+1999-06-03  David Mosberger  <davidm@hpl.hp.com>
+
+	* dwarf2.c (struct line_info): Add member END_SEQUENCE to keep
+	track of end_sequence markers.
+	(add_line_info): Add END_SEQUENCE arg.
+	(decode_line_info): Don't try to infer lo_pc and hi_pc from the
+	debug-line info---it doesn't work right if a compilation unit
+	consists of multiple discontiguous code-sequences.  It would be
+	worthwhile to optimize for the common case where a compilation
+	unit results in a contiguous set of code sequences, but this is
+	quite tricky to get right for arbitrary DWARF2 files.
+	(lookup_address_in_line_info_table): Don't use the last line entry
+	for a compilation unit for anything with an address higher than
+	this line entry.  Also, check for end_sequence markers to
+	correctly handle discontinuities.
+	(_bfd_dwarf2_find_nearest_line): When checking previously loaded
+	compilation units, check all compilation units with each->high==0
+	just like when reading compilation units.
+
+	* dwarf2.c (decode_line_info): Initialize table->files and
+	table->last_line to NULL to avoid segfaults due to random
+	values in these members.
+	(concat_filename): Check for out-of-range file number before
+	indexing filename table.  Segfaults suck.
+
+	* dwarf2.c (decode_line_info): Don't truncate address to least
+	significant 32 bits (breaks 64 bit targets).
+	(lookup_address_in_function_table): Ditto.
+	(comp_unit_contains_address): Ditto.
+
+1999-06-02  Mark Mitchell  <Mark Mitchell <mark@codesourcery.com>>
+
+	* elf32-mips.c (elf_mips_howto_table): Add R_MIPS_JALR.
+	* elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
+	(mips_elf64_howto_table_rela): Likewise.
+
+	* elfcode.h (elf_slurp_reloc_table_from_section): New function,
+	split out from ...
+	(elf_slurp_reloc_table): Here.  Use it to handle the case where a
+	single section has two associated relocation sections.
+
+1999-06-02  Mark Salter  <msalter@cygnus.com>
+
+	* coffcode.h (coff_set_alignment_hook): Set lma from s_vaddr if
+	COFF_WITH_PE defined.
+
+1999-06-02  Nick Clifton  <nickc@cygnus.com>
+
+	* pe-arm.c: Rename global arm interworking functions to avoid name
+	collision when all targets BFD is built.
+	* pei-arm.c: Ditto.
+
+1999-05-31  Mark Mitchell  <mark@codesourcery.com>
+
+	* elf-bfd.h (elf_backend_data): Remove use_rela_p.  Add
+	may_use_rel_p, may_use_rela_p, default_use_rela_p.
+	(bfd_elf_section_data): Add use_rela_p.
+	* elf.c (bfd_section_from_shdr): Set use_rela_p appropriately.
+	(_bfd_elf_new_section_hook): Likewise.
+	(elf_fake_sections): Use may_use_rela_p, etc., instead of
+	use_rela_p.
+	(_bfd_elf_copy_private_section_data): Copy use_rela_p.
+	* elfcode.h (write_relocs): Determine whether or not use rela
+	relocs based on the relocation section header.
+	* elflink.c (_bfd_elf_create_dynamic_sections): Use default_use_rela_p
+	instead of use_rela_p.
+	* elfxx-target.h (elf_backend_may_use_relp): New macro.
+	(elf_backend_may_use_rela_p): Likewise.
+	(elf_backend_default_use_rela_p): Likewise.
+	(elfNN_bed): Use them.
+
+Wed Jun  2 12:38:49 1999  Miodrag Vallat <miodrag@multimania.com>
+
+	* hosts/alphalinux.h (TRAD_CORE_EXTRA_SIZE_ALLOWED): Expand to 4096.
+
+Tue Jun  1 17:57:58 1999  Mark P. Mitchell  <mitchell@n02.acl.lanl.gov>
+
+	* reloc.c (BFD_RELOC_MIPS_SUB): New relocation.
+	(BFD_RELOC_MIPS_GOT_PAGE): Likewise.
+	(BFD_RELOC_MIPS_GOT_OFST): Likewise.
+	(BFD_RELOC_MIPS_GOT_DISP): Likewise.
+	* bfd-in2.h: Regenerated.
+	* libbfd.h: Likewise.
+	* elf32-mips.c (mips_info_to_howto_rela): New function.
+	(USE_REL): Adjust for new conventions.
+	(MINUS_ONE): New macro.
+	(elf_mips_howto_table): Add R_MIPS_SUB.
+	(mips_r): Add entries for MIPS_SUB, MIPS_GOT_PAGE, MIPS_GOT_OFST,
+	and MIPS_GOT_DISP.
+	(mips_elf_final_write_processing): Set sh_link, not sh_info, for a
+	.MIPS.content section.
+	(_bfd_mips_elf_fake_sections): Treat all sections that begin
+	with .MIPS.content as .MIPS.content sections.  Set
+	SHF_MNIPS_NOSTRIP for such section.
+	(elf_info_to_howto): Define to mips_info_to_howto_rela.
+	* elf64-mips.c (mips_r):  Add entries for MIPS_SUB, MIPS_GOT_PAGE,
+	MIPS_GOT_OFST, and MIPS_GOT_DISP.
+
+Wed Jun  2 11:51:12 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* vms-misc.c (_bfd_vms_hash_newfunc): Fix use of uninitialized
+	variable.
+
+	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Avoid ambigous
+	`else'.
+
+1999-05-30  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Reinstate change of
+	1993-03-25 (!!).  Take into account the bitmasks for the reloc so
+	the addend does not overflow into the rest of the word.
+
+1999-05-29  Nick Clifton  <nickc@cygnus.com>
+
+	* bfd-in.h: Amend prototype for
+	bfd_elf32_arm_process_before_allocation .
+	* bfd-in.h: Regenerate.
+
+	* elfarm-oabi.c (NUM_ELEM): New macro: Compute the number of
+	elements in a fixed sized array.
+	(ARM_ELF_ABI_VERSION): Define.
+	(ARM_ELF_OS_ABI_VERSION): Define.
+	(R_ARM_THM_ABS5): Fix rightshift and size.
+	(R_ARM_THM_PC22): Fix size.
+	(R_ARM_PLT32): Define Howto.
+	(find_howto): New function: Locate a howto based on a reloc
+	number.
+	(elf32_arm_info_to_howto): Use find_howto if necessary.
+	(elf32_arm_reloc_map): Change type of field bfd_reloc_val to
+	bfd_reloc_code_real_type.
+	(elf32_arm_reloc_map[]): Add entries for BFD_RELOC_VTABLE_INHERIT
+	and BFD_RELOC_VTABLE_ENTRY.
+	(elf32_arm_reloc_type_lookup): Use find_howto if necessary.
+
+	* elfarm-nabi.c (NUM_ELEM): New macro: Compute the number of
+	elements in a fixed sized array.
+	(ARM_ELF_ABI_VERSION): Define.
+	(ARM_ELF_OS_ABI_VERSION): Define.
+	(R_ARM_THM_ABS5): Fix rightshift and size.
+	(R_ARM_THM_PC22): Fix size.
+	(elf32_arm_info_to_howto_rel): Rename to elf32_arm_info_to_howto.
+	(elf32_arm_reloc_map): Change type of field bfd_reloc_val to
+	bfd_reloc_code_real_type.
+
+	* elf32-arm.h (struct elf32_arm_link_hash_table): Add new field:
+	no_pipeline_knowledge.
+	(elf32_arm_link_hash_create): Initialise new field to zero.
+	(bfd_elf32_arm_process_before_allocation): Add new paraemter:
+	no_pipeline_knowledge.  Use this parameter to initialise the field
+	in the globals data structure.
+	(elf32_arm_final_link_relocate): Only add in pipeline offset if
+	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.
+	(elf32_arm_post_process_headers): New function:  Initialise the
+	EI_OSABI and EI_ABIVERSION fields of the newly created ELF program
+	header.
+	(elf_backend_post_process_headers): Define.
+
+1999-05-28  Nick Clifton  <nickc@cygnus.com>
+
+	* elf-bfd.h (struct elf_backend_data): Add new field:
+	elf_backend_post_process_headers.
+
+	* elfxx-target.h (elf_backend_post_process_headers): Define to
+	NULL if not already defined.
+	(elfNN_bed): Initialise elf_backend_post_process_headers field.
+
+	* elf.c (prep_headers): Set the EI_OSABI and EI_ABIVERSION fields
+	to zero.
+	(_bfd_elf_compute_section_file_positions): Call
+	elf_backend_post_process_headers if defined.
+
+1999-05-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Check whether getuid and getgid exist.
+	* archive.c: Define getuid and getgid as macros if HAVE_GETUID or
+	HAVE_GETGID are not defined, respectively.
+	(bfd_write_armap): Don't special case on _WIN32 for getuid and
+	getgid.
+	* configure.host: Set ac_cv_func_get{ug}id for *-*-windows*.
+	* configure, config.in: Rebuild.
+
+1999-05-28  Martin Dorey  <mdorey@madge.com>
+
+	* elf32-i960.c: New file.
+	* elf.c (prep_headers): Handle bfd_arch_i960.
+	* targets.c (bfd_target_vector): Add &bfd_elf32_i960_vec.
+	* config.bfd (i960-*-elf*): New target.
+	* configure.in (bfd_elf32_i960_vec): New target vector.
+	* Makefile.am (BFD32_BACKENDS): Add elf32-i960.lo.
+	(BFD32_BACKENDS_CFILES): Add elf32-i960.c.
+	* Makefile.in, aclocal.m4, configure: Rebuild.
+
+1999-05-27  Nick Clifton  <nickc@cygnus.com>
+
+	* elfarm-oabi.c (elf32_arm_howto_table): Add entry for
+	R_ARM_PLT32.
+	(find_howto): New function: Find entries in the
+	elf32_arm_howto_table.
+	(elf32_arm_info_to_howto): Use find_howto if the entry cannot be
+	computed simply.
+	(elf32_arm_reloc_type_lookup): Add lookup for
+	BFD_RELOC_ARM_PLT32.
+
+1999-05-25  Philip Blundell  <pb@nexus.co.uk>
+
+	* bfd/elf32-arm.h (elf32_arm_link_hash_newfunc): New function.
+	(elf32_arm_link_hash_table_create): Use above function as the
+	constructor for hash table entries.
+	(elf32_arm_relocate_section): Avoid crash when there is no output
+	section.
+	(elf32_arm_final_link_relocate): New parameter h.
+	(elf32_arm_relocate_section): Pass symbol hash entry to above
+ 	routine.
+	(elf32_arm_gc_sweep_hook, elf32_arm_check relocs): Correct
+	comments.
+
+1999-05-25  Catherine Moore  <clm@cygnus.com>
+
+	* coff-arm.c (coff_arm_relocate_section): Don't emit
+	base file entries for pc-relative values.
+
+1999-05-25  DJ Delorie  <dj@cygnus.com>
+
+	* peicode.h (coff_swap_sym_in): When we create the actual section
+	to reflect the not-there section C_SECTION symbols refer to,
+	change the symbol class to C_STAT as the section is now really
+	there.
+
+1999-05-24  Philip Blundell  <pb@nexus.co.uk>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Undo change of
+ 	1999-03-25.
+
+Mon May 17 13:35:35 1999  Stan Cox  <scox@cygnus.com>
+
+	* coff-arm.c (_bfd_coff_arm_set_private_flags): Changed
+	F_PIC_INT to F_PIC.
+	* coffcode.h (coff_set_arch_mach_hook): Added F_ARM_2a, and
+	F_ARM_3M labels.  Changed F_PIC_INT to F_PIC.
+
+1999-05-16  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-mcore.c (in_reloc_p): Reinstate.
+
+1999-05-15  Nick Clifton  <nickc@cygnus.com>
+
+	* reloc.c (BFD_RELOC_MCORE_RVA): Define.
+	* bfd-in2.h: Regenerate.
+	* coff-mcore.c (in_reloc_p): Remove defintion.
+	(mcore_coff_howto): Add IMAGE_REL_MCORE_RVA.
+	(mcore_coff_reloc_type_lookup): Map BFD_RELOC_RVA to
+	IMAGE_REL_MCORE_RVA.
+	(coff_mcore_rtype_to_howto): Add special processing for
+	IMAGE_REL_MCORE_RVA.
+	(coff_mcore_relocate_section): Add support for
+	IMAGE_REL_MCORE_RVA.
+	* elf32-mcore (mcore_elf_howto_): Add R_MCORE_RELATIVE.
+	(mcore_elf_reloc_type_lookup): Map BFD_RELOC_RVA to
+	R_MCORE_RELATIVE.
+	(mcore_elf_relocate_section): Delete redundant case labels.
+
+Fri May 14 10:59:55 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Fix operator
+ 	precedence between bit-and and comparison.
+
+Thu May 13 09:45:23 1999  Joel Sherrill (joel@OARcorp.com)
+
+	* config.bfd (i[3456]86*-*-rtems*, m68k*-*-rtems*): Added to
+	list of target formats (targ_selvecs).
+	(i[3456]86*-*-rtemself*, mips*el-*-rtems*): New targets.
+	(powerpcle*-*rtems*, sh-*-rtemself*): New targets.
+
+1999-05-10  DJ Delorie  <dj@cygnus.com>
+
+	* ecoff.c (_bfd_ecoff_write_armap): give the symtab element a
+	reasonable mode until "ar x" is smart enough to skip it (fixes
+	gcc/libgcc.a builds on mips-ecoff targets
+
+	* coffcode.h (styp_to_sec_flags): Explain how COMDATs are supposed
+	to work.  Hack to support MS import libraries, which use different
+	COMDAT types than GNU.
+	(coff_slurp_symbol_table): C_SECTION symbols are local; they refer
+	to implied zero-length sections (see peicode below)
+	* coffgen.c (coff_get_normalized_symtab): Properly read long MS
+	filename symbols, which use one *or more* auxents.
+	* coffswap.h (coff_swap_aux_in): ditto
+	* peicode.h (coff_swap_sym_in): Build the implied zero-length
+	sections
+
+Tue May 11 15:51:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* elf32-v850.c (v850_elf_howto_table): Make partial_inplace false
+	for all relocations.
+
+1999-05-10  Catherine Moore  <clm@cygnus.com>
+
+	* bfd-in.h (bfd_arm_allocate_interworking_sections):  Static
+	if COFF_IMAGE_WITH_PE.
+	(bfd_arm_process_before_allocation): Likewise.
+	(bfd_arm_get_bfd_for_interworking): Likewise.
+	* coff-arm.c: Likewise.
+	* bfd-in2.h: Regenerate.
+	* configure.in (armpe_little_vec): Remove coff-arm.lo.
+	(armpe_big_vec): Likewise.
+	* configure: Rebuild.
+
+1999-05-10  Nick Clifton  <nickc@cygnus.com>
+
+	* elf.c (elf_fake_sections): Check for .rel. as start of rel
+	section, not just .rel.  Same for .rela.
+
+1999-05-07  Nick Clifton  <nickc@cygnus.com>
+
+	* coff-mcore.c (coff_mcore_relocate_section): Replace assert about
+	endianism with an error message.
+
+Thu May  6 17:09:09 1999  Fred Fish  <fnf@be.com>
+
+	* dwarf2.c (read_abbrevs): Change cast of dwarf_abbrev_buffer
+	assignment from "unsigned char *" to "char *".
+	(decode_line_info): Likewise for dwarf_line_buffer assignment.
+
+1999-05-05  Catherine Moore  <clm@cygnus.com>
+
+	* coff-arm.c (coff_arm_relocate_section):  Add one to
+	address of ARM_RVA32 thumb functions.
+
+1999-05-05  Catherine Moore  <clm@cygnus.com>
+
+	* elf32-m68k.c (elf32_m68k_set_private_flags): New.
+	(elf32_m68k_copy_private_bfd_data): New.
+	(elf32_m68k_merge_private_bfd_data): New.
+	(elf32_m68k_print_private_bfd_data): New.
+	(CPU32_FLAG): Define.
+	(PLT_CPU32_ENTRY_SIZE): Define.
+	(elf_cpu32_plt0_entry): Declare.
+	(elf_cpu32_plt_entry): Declare.
+	(elf_m68k_adjust_dynamic_symbol): Generate cpu32 plt entries.
+	(elf_m68k_finish_dynamic_symbol): Likewise.
+	(elf_m68k_finish_dynamic_sections): Likewise.
+	(elf_backend_plt_header_size): Remove definition.
+	(bfd_elf32_bfd_copy_private_bfd_data): Define.
+	(bfd_elf32_bfd_merge_private_bfd_data): Define.
+	(bfd_elf32_bfd_set_private_flags): Define.
+	(bfd_elf32_bfd_print_private_bfd_data): Define.
+
+Mon May  3 09:24:49 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* som.c (som_fixup_formats): Fix comments for R_SHORT_PCREL_MODE
+	and R_LONG_PCREL_MODE.
+
 1999-04-29  Nick Clifton  <nickc@cygnus.com>
 
 	* coff-mcore.c (coff_mcore_relocate_section): Fix typos.
@@ -29,7 +3265,7 @@
 	* libbfd.h: Rebuild.
 
 Sat Apr 17 20:55:15 1999  Catherine Moore  <clm@cygnus.com>
- 
+
 	* coff-arm.c (coff_arm_rtype_to_howto): Remove ARM26D transform.
 	(coff_arm_relocate_section):  Add ARM26D transform.  Only
 	change to ARM26D for relocateable links.
@@ -127,7 +3363,7 @@
 	* configure.in: Add support for MCore targets.
 	* configure: Regenerate.
 	* archures.c: Add support for MCore architecture.
-	* bfd-in2.h: Regenerate. 
+	* bfd-in2.h: Regenerate.
 	* coffcode.h: Add support for mcore-pe targets.
 	* elf.c: Add support for mcore-elf target.
 	* reloc.c: Add support for MCore relocs.
@@ -197,11 +3433,11 @@
 	TARGET_UNDERSCORE and USER_LABEL_PREFIX.
 	* pe-arm.h: Allow previous header files to override definition of
 	TARGET_LITTLE_SYM and TARGET_BIG_SYM.
-	* pei-arm.h: Allow previous header files to override definition of 
+	* pei-arm.h: Allow previous header files to override definition of
 	TARGET_LITTLE_SYM and TARGET_BIG_SYM.
 	* epoc-pe-arm.c: New file.  Support arm-epoc-pe target.
 	* epoc-pei-arm.c: New file.  Support arm-epoc-pei target.
-	
+
 1999-03-30  Nick Clifton  <nickc@cygnus.com>
 
 	* elf.c (elf_map_symbols): Handle the case where section
@@ -217,8 +3453,8 @@
 1999-03-25  Philip Blundell  <pb@nexus.co.uk>
 
 	* config.bfd: Eliminate redundancy in checks for Linux/ARM.
-	
-	* elf32-arm.h (elf32_arm_relocate_section): Take the rightshift into 
+
+	* elf32-arm.h (elf32_arm_relocate_section): Take the rightshift into
 	account when adjusting section symbols during a partial link.
 
 1999-03-24  Nick Clifton  <nickc@cygnus.com>
@@ -312,7 +3548,7 @@
 
 	The following patches are from: Scott Bambrough
 	<scottb@corelcomputer.com>
-	
+
 	* libaout.h (M_ARM6_NETBSD): Set to 143.
 
 	* reloc.c: Add ARM PIC relocs:   BFD_RELOC_ARM_GOT12,
@@ -331,7 +3567,7 @@
 	(elf32_arm_final_link_relocate): Change parameters so that entire
 	reloc is passed.  Add support for PIC relocs.
 	(elf32_arm_relocate_section): Pass entire reloc to
-	elf32_arm_final_link_relocate. 
+	elf32_arm_final_link_relocate.
 	(elf32_arm_check_relocs): Handle new PIC relocs.
 	(elf32_arm_adjust_dynamic_symbol): New function.
 	(elf32_arm_size_dynamic_sections): New function.
@@ -349,7 +3585,7 @@
 	(elf_backend_plt_readonly): Define.
 	(elf_backend_want_got_plt): Define.
 	(elf_backend_want_plt_sym): Define.
-	
+
 Wed Feb 17 12:02:26 1999  Stan Cox  <scox@cygnus.com>
 
 	* elf32-mips.c (_bfd_mips_elf_section_from_shdr): Make reginfo
@@ -357,15 +3593,15 @@
 	(_bfd_mips_elf_fake_sections): Likewise.
 
 Wed Feb 17 12:07:23 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
- 
-        * elfarm-oabi.c (bfd_elf32_arm_allocate_interworking_sections,
-        bfd_elf32_arm_get_bfd_for_interworking,
-        bfd_elf32_arm_process_before_allocation): Define to avoid clash
-        with elfarm-nabi.c.
- 
-        * elf32-arm.h: Don't declare elf32_arm_info_to_howto.
-        (elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub,
-        elf32_arm_find_nearest_line): Make them static.
+
+	* elfarm-oabi.c (bfd_elf32_arm_allocate_interworking_sections,
+	bfd_elf32_arm_get_bfd_for_interworking,
+	bfd_elf32_arm_process_before_allocation): Define to avoid clash
+	with elfarm-nabi.c.
+
+	* elf32-arm.h: Don't declare elf32_arm_info_to_howto.
+	(elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub,
+	elf32_arm_find_nearest_line): Make them static.
 
 Tue Feb 16 22:44:37 1999  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -432,21 +3668,21 @@
 
 Tue Feb  2 18:16:43 1999  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-arm.h (elf32_arm_reloc_map):  Removed.
-        (elf32_arm_reloc_type_lookup):  Removed
-        * elfarm-nabi.c (elf32_arm_reloc_map):  New.
-        (elf32_arm_reloc_type_lookup):  New.
-        * elfarm-oabi.c (elf32_arm_reloc_map):  New.
-        (elf32_arm_reloc_type_lookup):  New.
+	* elf32-arm.h (elf32_arm_reloc_map):  Removed.
+	(elf32_arm_reloc_type_lookup):  Removed
+	* elfarm-nabi.c (elf32_arm_reloc_map):  New.
+	(elf32_arm_reloc_type_lookup):  New.
+	* elfarm-oabi.c (elf32_arm_reloc_map):  New.
+	(elf32_arm_reloc_type_lookup):  New.
 
 Mon Feb  1 19:49:21 1999  Catherine Moore  <clm@cygnus.com>
 
-        * elfarm-nabi.c:  Renamed from elf32-arm-newabi.c.
-        * elfarm-oabi.c:  Renamed from elf32-arm-oldabi.c
-        * Makefile.am:  Use new files.
-        * Makefile.in:  Regenerate.
-        * configure.in:  Use new files.
-        * configure:  Regenerate.       
+	* elfarm-nabi.c:  Renamed from elf32-arm-newabi.c.
+	* elfarm-oabi.c:  Renamed from elf32-arm-oldabi.c
+	* Makefile.am:  Use new files.
+	* Makefile.in:  Regenerate.
+	* configure.in:  Use new files.
+	* configure:  Regenerate.
 
 1999-02-01  Nick Clifton  <nickc@cygnus.com>
 
@@ -456,25 +3692,25 @@
 
 Mon Feb  1 12:21:47 1999  Catherine Moore  <clm@cygnus.com>
 
-        * targets.c (bfd_target_vector):  Add bfd_elf32_littlearm_oabi_vec
-        and bfd_elf32_bigarm_oabi_vec.
+	* targets.c (bfd_target_vector):  Add bfd_elf32_littlearm_oabi_vec
+	and bfd_elf32_bigarm_oabi_vec.
 
 Mon Feb  1 11:46:31 1999  Catherine Moore  <clm@cygnus.com>
 
-        * Makefile.am (elf32-arm-oldabi.lo):  New.
-        (elf32-arm-newabi.lo):  New.
-        * Makefile.in:  Regenerate.
-        * config.bfd (thumb-*-elf):  Remove definition of targ_underscore.
-        (arm-*-elf):  Likewise.
-        (arm-*-oabi):  New.
-        (thumb-*-oabi):  New.
-        * configure:  Regenerate.
-        * configure.in (bfd_elf32_littlearm_oabi_vec):  New.
-        (bfd_elf32_bigarm_oabi_vec):  New.
-        * elf32-arm-newabi.c:  New.
-        * elf32-arm-oldabi.c:  New.
-        * elf32-arm.c:  Removed.
-        * elf32-arm.h:  New.
+	* Makefile.am (elf32-arm-oldabi.lo):  New.
+	(elf32-arm-newabi.lo):  New.
+	* Makefile.in:  Regenerate.
+	* config.bfd (thumb-*-elf):  Remove definition of targ_underscore.
+	(arm-*-elf):  Likewise.
+	(arm-*-oabi):  New.
+	(thumb-*-oabi):  New.
+	* configure:  Regenerate.
+	* configure.in (bfd_elf32_littlearm_oabi_vec):  New.
+	(bfd_elf32_bigarm_oabi_vec):  New.
+	* elf32-arm-newabi.c:  New.
+	* elf32-arm-oldabi.c:  New.
+	* elf32-arm.c:  Removed.
+	* elf32-arm.h:  New.
 
 Mon Feb  1 11:52:12 1999  Frank Ch. Eigler  <fche@cygnus.com>
 
@@ -519,13 +3755,13 @@
 	to F_PIC_INT.
 	* coffcode.h (coff_set_arch_mach_hook): Removed F_ARM_2a and
 	F_ARM_3M labels.  Changed F_PIC to F_PIC_INT.
-	
+
 1999-01-27  Nick Clifton  <nickc@cygnus.com>
 
 	* elf32-fr30.c (fr30_elf_howto_table): Fix name of R_FR30_48
-	relocation. 
+	relocation.
 	(fr30_final_link_relocate): Use computed value as result of
-	relocation. 
+	relocation.
 
 1999-01-26  Frank Ch. Eigler  <fche@cygnus.com>
 
@@ -544,16 +3780,16 @@
 
 Tue Dec 22 15:21:41 1998  Catherine Moore  <clm@cygnus.com>
 
-        * archures.c (bfd_mach_i386_i386_intel_syntax):  Define.
-        * bfd-in2.h:  Likewise.
-        * cpu-i386.c (bfd_i386_arch_intel_syntax):  New.
+	* archures.c (bfd_mach_i386_i386_intel_syntax):  Define.
+	* bfd-in2.h:  Likewise.
+	* cpu-i386.c (bfd_i386_arch_intel_syntax):  New.
 
 1998-12-16  Gavin Romig-Koch  <gavin@cygnus.com>
 
 	* archures.c,bfd-in2.h (bfd_mach_mips4111): New.
 	* cpu-mips.c: Add support for and independent 4111.
 	* elf32-mips.c (elf_mips_mach): E_MIPS_MACH_4111 -> bfd_mach_mips4111.
-	(_bfd_mips_elf_final_write_processing): 
+	(_bfd_mips_elf_final_write_processing):
 	bfd_mach_mips4111 -> E_MIPS_ARCH_3 | E_MIPS_MACH_4111.
 
 1998-12-15  Gavin Romig-Koch  <gavin@cygnus.com>
@@ -563,7 +3799,7 @@
 
 1998-12-12  Gavin Romig-Koch  <gavin@cygnus.com>
 
-	* elf32-mips.c (_bfd_mips_elf_final_write_processing): 
+	* elf32-mips.c (_bfd_mips_elf_final_write_processing):
 	Handle bfd_mach_mips4300.
 
 1998-12-11  Ulrich Drepper  <drepper@cygnus.com>
@@ -911,16 +4147,16 @@
 
 Tue Nov 10 14:31:01 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-d10v.c (reloc_type):  Add R_D10V_GNU_VTINHERIT and
-        R_D10V_GNU_VTENTRY relocs.
-        (elf_d10v_howto_table):  Likewise.
-        (d10v_reloc_map d10v_reloc_map):  Likewise.
-        (elf32_d10v_gc_mark_hook):  New.
-        (elf32_d10v_gc_sweep_hook):  New.
-        (elf32_d10v_check_relocs):  New.
-        (elf32_d10v_relocate_section):  New.
-        (elf_backend_relocate_section):  Define.
-        (elf_backend_can_gc_sections):  Define.
+	* elf32-d10v.c (reloc_type):  Add R_D10V_GNU_VTINHERIT and
+	R_D10V_GNU_VTENTRY relocs.
+	(elf_d10v_howto_table):  Likewise.
+	(d10v_reloc_map d10v_reloc_map):  Likewise.
+	(elf32_d10v_gc_mark_hook):  New.
+	(elf32_d10v_gc_sweep_hook):  New.
+	(elf32_d10v_check_relocs):  New.
+	(elf32_d10v_relocate_section):  New.
+	(elf_backend_relocate_section):  Define.
+	(elf_backend_can_gc_sections):  Define.
 
 Sat Nov  7 18:07:51 1998  Peter Schauer  <peter.schauer@regent.e-technik.tu-muenchen.de>
 
@@ -1002,12 +4238,12 @@
 
 Mon Oct 19 20:03:21 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-sh.c:  Add HOWTO entries for R_SH_GNU_VTINHERIT and
-        R_SH_GNU_VTENTRY.
-        (sh_elf_gc_mark_hook):  New.
-        (sh_elf_gc_sweep_hook):  New.
-        (sh_elf_check_relocs):  New.
-        (elf_backend_can_gc_sections):  Define.
+	* elf32-sh.c:  Add HOWTO entries for R_SH_GNU_VTINHERIT and
+	R_SH_GNU_VTENTRY.
+	(sh_elf_gc_mark_hook):  New.
+	(sh_elf_gc_sweep_hook):  New.
+	(sh_elf_check_relocs):  New.
+	(elf_backend_can_gc_sections):  Define.
 
 Mon Oct 19 16:57:05 1998  Felix Lee  <flee@cygnus.com>
 
@@ -1028,13 +4264,13 @@
 
 Fri Oct 16 14:07:45 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-m32r.c:  Add HOWTO entries for R_M32R_GNU_VTINHERIT
-        and R_M32R_GNU_VTENTRY.
-        (elf_backend_can_gc_sections):  Define.
-        (m32r_elf_check_relocs):  New.
-        (m32r_elf_gc_mark_hook):  New.
-        (m32r_elf_gc_sweep_hook):  New.
-        (m32r_elf_relocate_section):  Handle VT relocs.
+	* elf32-m32r.c:  Add HOWTO entries for R_M32R_GNU_VTINHERIT
+	and R_M32R_GNU_VTENTRY.
+	(elf_backend_can_gc_sections):  Define.
+	(m32r_elf_check_relocs):  New.
+	(m32r_elf_gc_mark_hook):  New.
+	(m32r_elf_gc_sweep_hook):  New.
+	(m32r_elf_relocate_section):  Handle VT relocs.
 
 Mon Oct 12 14:18:40 1998  Nick Clifton  <nickc@cygnus.com>
 
@@ -1051,13 +4287,13 @@
 
 Tue Oct  6 09:20:44 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-sparc.c:  Add HOWTO entries for R_SPARC_GNU_VTINHERIT and
-        R_SPARC_GNU_VTENTRY.
-        (elf32_sparc_check_relocs):  Handle them.
-        (elf32_sparc_reloc_type_lookup):  Likewise.
-        (elf32_sparc_relocate_section):  Likewise.
-        (elf32_sparc_gc_mark_hook):  New.
-        (elf32_sparc_gc_sweep_hook):  New.
+	* elf32-sparc.c:  Add HOWTO entries for R_SPARC_GNU_VTINHERIT and
+	R_SPARC_GNU_VTENTRY.
+	(elf32_sparc_check_relocs):  Handle them.
+	(elf32_sparc_reloc_type_lookup):  Likewise.
+	(elf32_sparc_relocate_section):  Likewise.
+	(elf32_sparc_gc_mark_hook):  New.
+	(elf32_sparc_gc_sweep_hook):  New.
 
 Mon Oct  5 14:55:30 1998  Jeffrey A Law  (law@cygnus.com)
 
@@ -1077,25 +4313,25 @@
 
 Mon Oct  5 10:06:22 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elflink.h (elf_gc_sections):  Do not allow garbage
-        collection if dynamic sections have been created.
+	* elflink.h (elf_gc_sections):  Do not allow garbage
+	collection if dynamic sections have been created.
 
 Mon Oct  5 09:07:37 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-v850.c: Add HOWTO entries for R_V850_GNU_VTINHERIT and
-        R_V850_GNU_VTENTRY.
-        (v850_elf_check_relocs):  Handle VTINHERIT and VTENTRY relocs.
-        (v850_elf_perform_relocation):  Likewise.
-        (v850_elf_final_link_relocate):  Likewise.
-        (v850_elf_relocate_section):  Likewise.
-        (v850_elf_gc_sweep_hook):  New routine.
-        (v850_elf_gc_mark_hook):  New routine.
-        (elf_backend_can_gc_sections):  Define.
+	* elf32-v850.c: Add HOWTO entries for R_V850_GNU_VTINHERIT and
+	R_V850_GNU_VTENTRY.
+	(v850_elf_check_relocs):  Handle VTINHERIT and VTENTRY relocs.
+	(v850_elf_perform_relocation):  Likewise.
+	(v850_elf_final_link_relocate):  Likewise.
+	(v850_elf_relocate_section):  Likewise.
+	(v850_elf_gc_sweep_hook):  New routine.
+	(v850_elf_gc_mark_hook):  New routine.
+	(elf_backend_can_gc_sections):  Define.
 
 Mon Oct  5 09:04:25 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-m68k.c (elf_m68k_gc_sweep_hook):  Don't assume
-        that dynobj exists.
+	* elf32-m68k.c (elf_m68k_gc_sweep_hook):  Don't assume
+	that dynobj exists.
 
 Sun Oct  4 23:29:34 1998  David Edelsohn  <edelsohn@mhpcc.edu>
 
@@ -1123,19 +4359,19 @@
 
 1998-09-27  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
-        * elflink.h (elf_link_add_object_symbols): Undo last change.
+	* elflink.h (elf_link_add_object_symbols): Undo last change.
 
 Wed Sep 23 16:09:31 1998  Richard Henderson  <rth@cygnus.com>
 
-        * elflink.h (elf_link_add_object_symbols): Don't record a dynamic
-        symbol for the indirect alias to a versioned symbol.
+	* elflink.h (elf_link_add_object_symbols): Don't record a dynamic
+	symbol for the indirect alias to a versioned symbol.
 
 Mon Sep 21 12:15:22 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-i386.c (elf32_i386_vtinherit_howto): New.
-        (elf32_i386_vtentry_howto): New.
-        (elf_i386_reloc_type_lookup):  Return elf32_i386_vtentry_howto
-        or elf32_i386_vtinherit_howto  on lookup.
+	* elf32-i386.c (elf32_i386_vtinherit_howto): New.
+	(elf32_i386_vtentry_howto): New.
+	(elf_i386_reloc_type_lookup):  Return elf32_i386_vtentry_howto
+	or elf32_i386_vtinherit_howto  on lookup.
 
 Sun Sep 20 00:48:07 1998  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
@@ -1169,13 +4405,13 @@
 
 Thu Sep 17 16:03:28 1998  Richard Henderson  <rth@cygnus.com>
 
-        * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't
-        transform a defweak into a plt entry.
-        (elf64_alpha_calc_dynrel_sizes): Allow room for secondary
-        plt entry references to receive a RELATIVE reloc.
-        (elf64_alpha_finish_dynamic_symbol): Fill them in.
-        (elf64_alpha_relocate_section): Assert we don't overrun
-        the allocated relocation space.
+	* elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't
+	transform a defweak into a plt entry.
+	(elf64_alpha_calc_dynrel_sizes): Allow room for secondary
+	plt entry references to receive a RELATIVE reloc.
+	(elf64_alpha_finish_dynamic_symbol): Fill them in.
+	(elf64_alpha_relocate_section): Assert we don't overrun
+	the allocated relocation space.
 
 Wed Sep 16 18:03:13 1998  Nick Clifton  <nickc@cygnus.com>
 
@@ -1192,8 +4428,8 @@
 
 Wed Sep 16 11:26:49 CDT 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-arm.c (elf32_arm_gc_mark_hook):  Remove print
-        statement.
+	* elf32-arm.c (elf32_arm_gc_mark_hook):  Remove print
+	statement.
 
 1998-09-15  Geoff Keating  <geoffk@ozemail.com.au>
 
@@ -1221,8 +4457,8 @@
 
 1998-09-10  Geoff Keating  <geoffk@ozemail.com.au>
 
-        * elf32-ppc.c (ppc_elf_relocate_section): If dynobj is NULL,
-        assume there is no PLT or GOT.
+	* elf32-ppc.c (ppc_elf_relocate_section): If dynobj is NULL,
+	assume there is no PLT or GOT.
 
 Wed Sep  9 14:24:12 1998  Nick Clifton  <nickc@cygnus.com>
 
@@ -1259,18 +4495,18 @@
 
 Mon Aug 31 10:23:40 1998  Catherine Moore  <clm@cygnus.com>
 
-        * Makefile.am:  Add elf32-arm.c.
-        * Makefile.in:  Rebuild.
-        * elf-bfd.h:  Add elf_backend_get_symbol_type.
-        * elf.c (swap_out_syms):  If defined, call
-        elf_backend_get_symbol_type.
-        * elf32-arm.c: Define elf_backend_get_symbol_type.
-        (elf32_arm_get_symbol-type):  New routine.
-        (record_thumb_to_arm_glue):  Change to use STT_ARM_TFUNC.
-        (bfd_elf32_arm_process_before_allocation):  Change to
-        check for STT_ARM_TFUNC.
-        (elf32_arm_final_link_relocate):  Likewise.
-        * elfxx-target.h:  Add elf_backend_get_symbol_type.
+	* Makefile.am:  Add elf32-arm.c.
+	* Makefile.in:  Rebuild.
+	* elf-bfd.h:  Add elf_backend_get_symbol_type.
+	* elf.c (swap_out_syms):  If defined, call
+	elf_backend_get_symbol_type.
+	* elf32-arm.c: Define elf_backend_get_symbol_type.
+	(elf32_arm_get_symbol-type):  New routine.
+	(record_thumb_to_arm_glue):  Change to use STT_ARM_TFUNC.
+	(bfd_elf32_arm_process_before_allocation):  Change to
+	check for STT_ARM_TFUNC.
+	(elf32_arm_final_link_relocate):  Likewise.
+	* elfxx-target.h:  Add elf_backend_get_symbol_type.
 
 Fri Aug 28 19:44:07 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -1335,17 +4571,17 @@
 
 Tue Aug 18 11:48:12 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-arm.c: Add prefix bfd_ to elf32_arm_get_bfd_for_interworking,
-        elf32_arm_allocate_interworking_sections and
-        elf32_arm_process_before_allocation.
+	* elf32-arm.c: Add prefix bfd_ to elf32_arm_get_bfd_for_interworking,
+	elf32_arm_allocate_interworking_sections and
+	elf32_arm_process_before_allocation.
 
 Tue Aug 18 11:46:00 1998  Nick Clifton  <nickc@cygnus.com>
 
-        * bfd-in.h: Ammend prototype for
-        elf32_arm_process_before_allocation to remove surplus third
-        argument.
+	* bfd-in.h: Ammend prototype for
+	elf32_arm_process_before_allocation to remove surplus third
+	argument.
 
-        * bfd-in2.h: Regenerate.
+	* bfd-in2.h: Regenerate.
 
 Sat Aug 15 20:55:08 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -1429,8 +4665,8 @@
 
 Sun Aug  9 20:55:44 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf32-arm.c (elf32_arm_final_link_relocate):  Rework
-        R_ARM_THM_RPC22 relocations.
+	* elf32-arm.c (elf32_arm_final_link_relocate):  Rework
+	R_ARM_THM_RPC22 relocations.
 
 Sat Aug  8 15:15:30 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -1467,16 +4703,16 @@
 
 Fri Jul 31 16:38:14 1998  Catherine Moore  <clm@cygnus.com>
 
-        * Makefile.am: Add support for elf32-arm.lo.
-        * Makefile.in: Rebuild.
-        * config.bfd (arm-*-elf):  Define targ_defvec and targ_selvecs.
-        (thumb-*-elf): Define targ_defvec and targ_selvecs.
-        * configure.in:  Handle bfd_elf32_littlearm_vec and bfd_elf32_bigarm_vec.
-        * configure: Regenerate.
-        * elf.c: (prep_headers):  Support arch_type of EM_ARM.
-        * targets.c:  Support new targets bfd_elf32_bigarm_vec and
-        bfd_target bfd_elf32_littlearm_vec.
-        * elf32-arm.c:  New file.
+	* Makefile.am: Add support for elf32-arm.lo.
+	* Makefile.in: Rebuild.
+	* config.bfd (arm-*-elf):  Define targ_defvec and targ_selvecs.
+	(thumb-*-elf): Define targ_defvec and targ_selvecs.
+	* configure.in:  Handle bfd_elf32_littlearm_vec and bfd_elf32_bigarm_vec.
+	* configure: Regenerate.
+	* elf.c: (prep_headers):  Support arch_type of EM_ARM.
+	* targets.c:  Support new targets bfd_elf32_bigarm_vec and
+	bfd_target bfd_elf32_littlearm_vec.
+	* elf32-arm.c:  New file.
 
 Tue Jun 28 19:05:28 1998  Stan Cox  <scox@cygnus.com>
 
@@ -1528,13 +4764,13 @@
 
 
 	* Re-add lost change:
-        * elf-m10300.c (elf32_mn10300_link_hash_entry): Add new field
-        "movm_stack_size".
-        (mn10300_elf_relax_section): Include stack space for register saves
-        in the imm8 field of a "call" instruction.
-        (compute_function_info): Determine how much stack is allocated by
-        the movm instruction.  Fix typo.
-        (elf32_mn10300_link_hash_newfunc): Initialize movm_stack_size.
+	* elf-m10300.c (elf32_mn10300_link_hash_entry): Add new field
+	"movm_stack_size".
+	(mn10300_elf_relax_section): Include stack space for register saves
+	in the imm8 field of a "call" instruction.
+	(compute_function_info): Determine how much stack is allocated by
+	the movm instruction.  Fix typo.
+	(elf32_mn10300_link_hash_newfunc): Initialize movm_stack_size.
 
 Thu Jul 23 11:38:05 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -1596,11 +4832,11 @@
 
 Tue Jul 21 09:47:00 1998  Catherine Moore  <clm@cygnus.com>
 
-        * elf-m10200.c (mn10200_elf_final_link_relocate):
-        Modify range test for case R_MN10200_8.
+	* elf-m10200.c (mn10200_elf_final_link_relocate):
+	Modify range test for case R_MN10200_8.
 
-        * elf-m10300.c (mn10300_elf_final_link_relocate):
-        Modify range test for case R_MN10300_8.
+	* elf-m10300.c (mn10300_elf_final_link_relocate):
+	Modify range test for case R_MN10300_8.
 
 Mon Jul 20 18:50:54 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -1749,7 +4985,7 @@
 	Merge of vax/vms (read-only) support
 	* configure.com: Support Vax target.
 	* makefile.vms: Support Vax target.
-        * vms.h: Renamed from evax.h, merged vax/vms (read-only) support.
+	* vms.h: Renamed from evax.h, merged vax/vms (read-only) support.
 	* vms.c: Renamed from evax-alpha.c, merged vax/vms (read-only)
 	support.
 	* vms-hdr.c: Renamed from evax-emh.c, merged vax/vms (read-only)
@@ -2377,7 +5613,7 @@
 	* dwarf2.c (comp_unit): Move it earlier in the source. Add
 	addr_size.
 	(read_address): Replace 'bdf*' argument with 'comp_unit*' argument.
-        Use addr_size for address size, rather than sizeof(bfd_vma).
+	Use addr_size for address size, rather than sizeof(bfd_vma).
 	(read_attribute): Replace bdf* argument with 'comp_unit*' argument.
 	Fix call to read_address.
 	(decode_line_info): Replace bdf* argument with 'comp_unit*' argument.
@@ -2839,7 +6075,7 @@
 	* elf32-v850.c (v850_elf_merge_private_bfd_data): Do not complain
 	when merging v850 code into v850e/v850ea code.  Do not initialise
 	output flags if the input is the default architecture.
-	
+
 Fri Feb  6 11:50:22 1998  Jeffrey A Law  (law@cygnus.com)
 
 	* elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): For BFD_RELOC_CTOR
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index a155311..f83fcf4 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -4,7 +4,7 @@
 
 INCDIR = $(srcdir)/../include
 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-DEP = mkdep
+MKDEP = mkdep
 
 SUBDIRS = doc po
 
@@ -41,12 +41,14 @@
 	cpu-alpha.lo \
 	cpu-arc.lo \
 	cpu-arm.lo \
+	cpu-avr.lo \
 	cpu-d10v.lo \
 	cpu-d30v.lo \
 	cpu-fr30.lo \
 	cpu-h8300.lo \
 	cpu-h8500.lo \
 	cpu-hppa.lo \
+	cpu-i370.lo \
 	cpu-i386.lo \
 	cpu-i860.lo \
 	cpu-i960.lo \
@@ -58,6 +60,7 @@
 	cpu-mcore.lo \
 	cpu-mips.lo \
 	cpu-ns32k.lo \
+	cpu-pj.lo \
 	cpu-powerpc.lo \
 	cpu-rs6000.lo \
 	cpu-sh.lo \
@@ -75,12 +78,14 @@
 	cpu-alpha.c \
 	cpu-arc.c \
 	cpu-arm.c \
+	cpu-avr.c \
 	cpu-d10v.c \
 	cpu-d30v.c \
 	cpu-fr30.c \
 	cpu-h8300.c \
 	cpu-h8500.c \
 	cpu-hppa.c \
+	cpu-i370.c \
 	cpu-i386.c \
 	cpu-i860.c \
 	cpu-i960.c \
@@ -92,6 +97,7 @@
 	cpu-mcore.c \
 	cpu-mips.c \
 	cpu-ns32k.c \
+	cpu-pj.c \
 	cpu-powerpc.c \
 	cpu-rs6000.c \
 	cpu-sh.c \
@@ -114,6 +120,7 @@
 	aout-tic30.lo \
 	aout0.lo \
 	aout32.lo \
+	armnetbsd.lo \
 	bout.lo \
 	cf-i386lynx.lo \
 	cf-m68klynx.lo \
@@ -144,6 +151,7 @@
 	coff-w65.lo \
 	coff-z8k.lo \
 	cofflink.lo \
+	dwarf1.lo \
 	dwarf2.lo \
 	ecoff.lo \
 	ecofflink.lo \
@@ -151,13 +159,15 @@
 	elf32-arc.lo \
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
+	elf32-avr.lo \
 	elf32-d10v.lo \
 	elf32-d30v.lo \
 	elf32-fr30.lo \
 	elf32-gen.lo \
-	elf32-hppa.lo \
+	elf32-i370.lo \
 	elf32-i386.lo \
 	elf32-i860.lo \
+	elf32-i960.lo \
 	elf32-m32r.lo \
 	elf32-m68k.lo \
 	elf32-m88k.lo \
@@ -165,12 +175,15 @@
 	elf-m10300.lo \
 	elf32-mcore.lo \
 	elf32-mips.lo \
+	elf32-pj.lo \
 	elf32-ppc.lo \
 	elf32-sh.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32.lo \
 	elflink.lo \
+	epoc-pe-arm.lo \
+	epoc-pei-arm.lo \
 	hp300bsd.lo \
 	hp300hpux.lo \
 	som.lo \
@@ -208,6 +221,11 @@
 	pei-mcore.lo \
 	pe-ppc.lo \
 	pei-ppc.lo \
+	pe-sh.lo \
+	pei-sh.lo \
+	pe-mips.lo \
+	pei-mips.lo \
+	peigen.lo \
 	ppcboot.lo \
 	reloc16.lo \
 	riscix.lo \
@@ -232,6 +250,7 @@
 	aout-tic30.c \
 	aout0.c \
 	aout32.c \
+	armnetbsd.c \
 	bout.c \
 	cf-i386lynx.c \
 	cf-m68klynx.c \
@@ -262,6 +281,7 @@
 	coff-w65.c \
 	coff-z8k.c \
 	cofflink.c \
+	dwarf1.c \
 	dwarf2.c \
 	ecoff.c \
 	ecofflink.c \
@@ -269,13 +289,15 @@
 	elf32-arc.c \
 	elfarm-oabi.c \
 	elfarm-nabi.c \
+	elf32-avr.c \
 	elf32-d10v.c \
 	elf32-d30v.c \
 	elf32-fr30.c \
 	elf32-gen.c \
-	elf32-hppa.c \
+	elf32-i370.c \
 	elf32-i386.c \
 	elf32-i860.c \
+	elf32-i960.c \
 	elf32-m32r.c \
 	elf32-m68k.c \
 	elf32-m88k.c \
@@ -283,12 +305,15 @@
 	elf-m10300.c \
 	elf32-mcore.c \
 	elf32-mips.c \
+	elf32-pj.c \
 	elf32-ppc.c \
 	elf32-sh.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32.c \
 	elflink.c \
+	epoc-pe-arm.c \
+	epoc-pei-arm.c \
 	hp300bsd.c \
 	hp300hpux.c \
 	som.c \
@@ -326,6 +351,11 @@
 	pei-mcore.c \
 	pe-ppc.c \
 	pei-ppc.c \
+	pe-sh.c \
+	pei-sh.c \
+	pe-mips.c \
+	pei-mips.c \
+	peigen.c \
 	ppcboot.c \
 	reloc16.c \
 	riscix.c \
@@ -409,11 +439,11 @@
 ## This is a list of all .h files which are in the source tree.
 SOURCE_HFILES = \
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \
-	ecoffswap.h elf32-hppa.h \
-	elfcode.h genlink.h go32stub.h hppa_stubs.h libaout.h \
+	ecoffswap.h elf32-arm.h elfcode.h elfcore.h \
+	elflink.h freebsd.h genlink.h go32stub.h libaout.h \
 	libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \
-	libnlm.h liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h \
-	som.h vms.h
+	libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h \
+	nlmswap.h ns32k.h peicode.h som.h vms.h
 
 HFILES = \
 	elf32-target.h elf64-target.h targmatch.h \
@@ -462,8 +492,9 @@
 libbfd_a_SOURCES =
 
 stamp-lib: libbfd.la
-	if [ -f .libs/libbfd.a ]; then \
-	  cp .libs/libbfd.a libbfd.tmp; \
+	libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
+	if [ -f $$libtooldir/libbfd.a ]; then \
+	  cp $$libtooldir/libbfd.a libbfd.tmp; \
 	  $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
 	else true; fi
 	touch stamp-lib
@@ -512,25 +543,25 @@
 	$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(includedir)/ansidecl.h
 	$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(includedir)/bfdlink.h
 
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) bfd.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) bfd.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
 # The NetBSD mkdep overwrites any existing file contents, and doesn't insert
 # the "DO NOT DELETE" line.
 # Other mkdep versions require a file that already exists, and do insert it.
 # Hence the weirdness....
-.dep1: $(CFILES)
-	rm -f .dep2 .dep2a
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	echo > .dep2a
-	$(DEP) -f .dep2a $(INCLUDES) $(CFLAGS) $?
-	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2
-	rm -f .dep2a
-	$(SHELL) $(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES)
+	rm -f DEP2 DEP2a
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	echo > DEP2a
+	$(MKDEP) -f DEP2a $(INCLUDES) $(CFLAGS) $?
+	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < DEP2a >> DEP2
+	rm -f DEP2a
+	$(SHELL) $(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
@@ -538,19 +569,19 @@
 		-e 's!@INCDIR@!$(INCDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 host-aout.lo: Makefile
@@ -613,7 +644,7 @@
 MOSTLYCLEANFILES = elf32-target.h elf64-target.h ofiles stamp-ofiles \
 	targmatch.h
 
-CLEANFILES = bfd.h dep.sed stmp-bfd-h .dep .dep1 libbfd.a stamp-lib \
+CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEP1 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.
@@ -666,6 +697,7 @@
 cpu-alpha.lo: cpu-alpha.c
 cpu-arc.lo: cpu-arc.c
 cpu-arm.lo: cpu-arm.c
+cpu-avr.lo: cpu-avr.c
 cpu-d10v.lo: cpu-d10v.c
 cpu-d30v.lo: cpu-d30v.c
 cpu-fr30.lo: cpu-fr30.c
@@ -683,6 +715,7 @@
 cpu-mcore.lo: cpu-mcore.c
 cpu-mips.lo: cpu-mips.c
 cpu-ns32k.lo: cpu-ns32k.c ns32k.h
+cpu-pj.lo: cpu-pj.c
 cpu-powerpc.lo: cpu-powerpc.c
 cpu-rs6000.lo: cpu-rs6000.c
 cpu-sh.lo: cpu-sh.c
@@ -715,6 +748,9 @@
 aout32.lo: aout32.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \
   $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
   $(INCDIR)/aout/ar.h
+armnetbsd.lo: armnetbsd.c netbsd.h libaout.h $(INCDIR)/bfdlink.h \
+  aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+  $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
 bout.lo: bout.c $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h
 cf-i386lynx.lo: cf-i386lynx.c coff-i386.c $(INCDIR)/coff/i386.h \
@@ -792,6 +828,9 @@
   $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
 cofflink.lo: cofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
   libcoff.h
+dwarf1.lo: dwarf1.c $(INCDIR)/libiberty.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h
 dwarf2.lo: dwarf2.c $(INCDIR)/libiberty.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -817,6 +856,9 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-arm.h \
   elf32-target.h
+elf32-avr.lo: elf32-avr.c elf-bfd.h $(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-d10v.lo: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
@@ -829,16 +871,18 @@
 elf32-gen.lo: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
-elf32-hppa.lo: elf32-hppa.c $(INCDIR)/bfdlink.h elf-bfd.h \
-  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  elf32-hppa.h libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
-  hppa_stubs.h elf32-target.h
+elf32-i370.lo: elf32-i370.c elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+  elf32-target.h
 elf32-i386.lo: elf32-i386.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i860.lo: elf32-i860.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
+elf32-i960.lo: elf32-i960.c 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-m32r.lo: elf32-m32r.c 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 elf32-target.h
@@ -865,6 +909,9 @@
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
   $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
   elf32-target.h
+elf32-pj.lo: elf32-pj.c $(INCDIR)/bfdlink.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
@@ -883,6 +930,13 @@
   elfcore.h elflink.h
 elflink.lo: elflink.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c coff-arm.c \
+  $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
+  libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
+  libpei.h
 hp300bsd.lo: hp300bsd.c libaout.h $(INCDIR)/bfdlink.h \
   aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -963,28 +1017,42 @@
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
 pe-arm.lo: pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-arm.lo: pei-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pe-i386.lo: pe-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-i386.lo: pei-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-mips.lo: pe-mips.c $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/internal.h \
+  $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+  peicode.h
+pei-mips.lo: pei-mips.c pe-mips.c $(INCDIR)/coff/mipspe.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
   $(INCDIR)/bfdlink.h coffcode.h peicode.h
 pe-mcore.lo: pe-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-mcore.lo: pei-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pe-ppc.lo: pe-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-ppc.lo: pei-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-sh.lo: pe-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  coffcode.h peicode.h
+pei-sh.lo: pei-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  coffcode.h peicode.h
+peigen.lo: peigen.c $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h \
+  $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
 ppcboot.lo: ppcboot.c
 reloc16.lo: reloc16.c $(INCDIR)/bfdlink.h genlink.h \
   $(INCDIR)/coff/internal.h libcoff.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 9258df1..322ecda 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -89,14 +89,13 @@
 INTLDEPS = @INTLDEPS@
 INTLLIBS = @INTLLIBS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
@@ -118,7 +117,7 @@
 
 INCDIR = $(srcdir)/../include
 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-DEP = mkdep
+MKDEP = mkdep
 
 SUBDIRS = doc po
 
@@ -157,12 +156,14 @@
 	cpu-alpha.lo \
 	cpu-arc.lo \
 	cpu-arm.lo \
+	cpu-avr.lo \
 	cpu-d10v.lo \
 	cpu-d30v.lo \
 	cpu-fr30.lo \
 	cpu-h8300.lo \
 	cpu-h8500.lo \
 	cpu-hppa.lo \
+	cpu-i370.lo \
 	cpu-i386.lo \
 	cpu-i860.lo \
 	cpu-i960.lo \
@@ -174,6 +175,7 @@
 	cpu-mcore.lo \
 	cpu-mips.lo \
 	cpu-ns32k.lo \
+	cpu-pj.lo \
 	cpu-powerpc.lo \
 	cpu-rs6000.lo \
 	cpu-sh.lo \
@@ -192,12 +194,14 @@
 	cpu-alpha.c \
 	cpu-arc.c \
 	cpu-arm.c \
+	cpu-avr.c \
 	cpu-d10v.c \
 	cpu-d30v.c \
 	cpu-fr30.c \
 	cpu-h8300.c \
 	cpu-h8500.c \
 	cpu-hppa.c \
+	cpu-i370.c \
 	cpu-i386.c \
 	cpu-i860.c \
 	cpu-i960.c \
@@ -209,6 +213,7 @@
 	cpu-mcore.c \
 	cpu-mips.c \
 	cpu-ns32k.c \
+	cpu-pj.c \
 	cpu-powerpc.c \
 	cpu-rs6000.c \
 	cpu-sh.c \
@@ -232,6 +237,7 @@
 	aout-tic30.lo \
 	aout0.lo \
 	aout32.lo \
+	armnetbsd.lo \
 	bout.lo \
 	cf-i386lynx.lo \
 	cf-m68klynx.lo \
@@ -262,6 +268,7 @@
 	coff-w65.lo \
 	coff-z8k.lo \
 	cofflink.lo \
+	dwarf1.lo \
 	dwarf2.lo \
 	ecoff.lo \
 	ecofflink.lo \
@@ -269,13 +276,15 @@
 	elf32-arc.lo \
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
+	elf32-avr.lo \
 	elf32-d10v.lo \
 	elf32-d30v.lo \
 	elf32-fr30.lo \
 	elf32-gen.lo \
-	elf32-hppa.lo \
+	elf32-i370.lo \
 	elf32-i386.lo \
 	elf32-i860.lo \
+	elf32-i960.lo \
 	elf32-m32r.lo \
 	elf32-m68k.lo \
 	elf32-m88k.lo \
@@ -283,12 +292,15 @@
 	elf-m10300.lo \
 	elf32-mcore.lo \
 	elf32-mips.lo \
+	elf32-pj.lo \
 	elf32-ppc.lo \
 	elf32-sh.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32.lo \
 	elflink.lo \
+	epoc-pe-arm.lo \
+	epoc-pei-arm.lo \
 	hp300bsd.lo \
 	hp300hpux.lo \
 	som.lo \
@@ -326,6 +338,11 @@
 	pei-mcore.lo \
 	pe-ppc.lo \
 	pei-ppc.lo \
+	pe-sh.lo \
+	pei-sh.lo \
+	pe-mips.lo \
+	pei-mips.lo \
+	peigen.lo \
 	ppcboot.lo \
 	reloc16.lo \
 	riscix.lo \
@@ -351,6 +368,7 @@
 	aout-tic30.c \
 	aout0.c \
 	aout32.c \
+	armnetbsd.c \
 	bout.c \
 	cf-i386lynx.c \
 	cf-m68klynx.c \
@@ -381,6 +399,7 @@
 	coff-w65.c \
 	coff-z8k.c \
 	cofflink.c \
+	dwarf1.c \
 	dwarf2.c \
 	ecoff.c \
 	ecofflink.c \
@@ -388,13 +407,15 @@
 	elf32-arc.c \
 	elfarm-oabi.c \
 	elfarm-nabi.c \
+	elf32-avr.c \
 	elf32-d10v.c \
 	elf32-d30v.c \
 	elf32-fr30.c \
 	elf32-gen.c \
-	elf32-hppa.c \
+	elf32-i370.c \
 	elf32-i386.c \
 	elf32-i860.c \
+	elf32-i960.c \
 	elf32-m32r.c \
 	elf32-m68k.c \
 	elf32-m88k.c \
@@ -402,12 +423,15 @@
 	elf-m10300.c \
 	elf32-mcore.c \
 	elf32-mips.c \
+	elf32-pj.c \
 	elf32-ppc.c \
 	elf32-sh.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32.c \
 	elflink.c \
+	epoc-pe-arm.c \
+	epoc-pei-arm.c \
 	hp300bsd.c \
 	hp300hpux.c \
 	som.c \
@@ -445,6 +469,11 @@
 	pei-mcore.c \
 	pe-ppc.c \
 	pei-ppc.c \
+	pe-sh.c \
+	pei-sh.c \
+	pe-mips.c \
+	pei-mips.c \
+	peigen.c \
 	ppcboot.c \
 	reloc16.c \
 	riscix.c \
@@ -533,11 +562,11 @@
 
 SOURCE_HFILES = \
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \
-	ecoffswap.h elf32-hppa.h \
-	elfcode.h genlink.h go32stub.h hppa_stubs.h libaout.h \
+	ecoffswap.h elf32-arm.h elfcode.h elfcore.h \
+	elflink.h freebsd.h genlink.h go32stub.h libaout.h \
 	libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \
-	libnlm.h liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h \
-	som.h vms.h
+	libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h \
+	nlmswap.h ns32k.h peicode.h som.h vms.h
 
 
 HFILES = \
@@ -579,7 +608,7 @@
 	targmatch.h
 
 
-CLEANFILES = bfd.h dep.sed stmp-bfd-h .dep .dep1 libbfd.a stamp-lib \
+CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEP1 libbfd.a stamp-lib \
 	stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
 
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -613,7 +642,7 @@
 
 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)
@@ -868,7 +897,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -1006,8 +1035,9 @@
 ofiles: stamp-ofiles ; @true
 
 stamp-lib: libbfd.la
-	if [ -f .libs/libbfd.a ]; then \
-	  cp .libs/libbfd.a libbfd.tmp; \
+	libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
+	if [ -f $$libtooldir/libbfd.a ]; then \
+	  cp $$libtooldir/libbfd.a libbfd.tmp; \
 	  $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
 	else true; fi
 	touch stamp-lib
@@ -1053,25 +1083,25 @@
 	$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(includedir)/ansidecl.h
 	$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(includedir)/bfdlink.h
 
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) bfd.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) bfd.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
 # The NetBSD mkdep overwrites any existing file contents, and doesn't insert
 # the "DO NOT DELETE" line.
 # Other mkdep versions require a file that already exists, and do insert it.
 # Hence the weirdness....
-.dep1: $(CFILES)
-	rm -f .dep2 .dep2a
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	echo > .dep2a
-	$(DEP) -f .dep2a $(INCLUDES) $(CFLAGS) $?
-	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2
-	rm -f .dep2a
-	$(SHELL) $(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES)
+	rm -f DEP2 DEP2a
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	echo > DEP2a
+	$(MKDEP) -f DEP2a $(INCLUDES) $(CFLAGS) $?
+	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < DEP2a >> DEP2
+	rm -f DEP2a
+	$(SHELL) $(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
@@ -1079,19 +1109,19 @@
 		-e 's!@INCDIR@!$(INCDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 host-aout.lo: Makefile
@@ -1150,7 +1180,6 @@
 config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
 	$(SHELL) ./config.status --recheck
 
-
 elfarm-oabi.lo: elfarm-oabi.c elf32-arm.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
@@ -1196,6 +1225,7 @@
 cpu-alpha.lo: cpu-alpha.c
 cpu-arc.lo: cpu-arc.c
 cpu-arm.lo: cpu-arm.c
+cpu-avr.lo: cpu-avr.c
 cpu-d10v.lo: cpu-d10v.c
 cpu-d30v.lo: cpu-d30v.c
 cpu-fr30.lo: cpu-fr30.c
@@ -1213,6 +1243,7 @@
 cpu-mcore.lo: cpu-mcore.c
 cpu-mips.lo: cpu-mips.c
 cpu-ns32k.lo: cpu-ns32k.c ns32k.h
+cpu-pj.lo: cpu-pj.c
 cpu-powerpc.lo: cpu-powerpc.c
 cpu-rs6000.lo: cpu-rs6000.c
 cpu-sh.lo: cpu-sh.c
@@ -1245,6 +1276,9 @@
 aout32.lo: aout32.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \
   $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
   $(INCDIR)/aout/ar.h
+armnetbsd.lo: armnetbsd.c netbsd.h libaout.h $(INCDIR)/bfdlink.h \
+  aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+  $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
 bout.lo: bout.c $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h
 cf-i386lynx.lo: cf-i386lynx.c coff-i386.c $(INCDIR)/coff/i386.h \
@@ -1322,6 +1356,9 @@
   $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
 cofflink.lo: cofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
   libcoff.h
+dwarf1.lo: dwarf1.c $(INCDIR)/libiberty.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h
 dwarf2.lo: dwarf2.c $(INCDIR)/libiberty.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -1347,6 +1384,9 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-arm.h \
   elf32-target.h
+elf32-avr.lo: elf32-avr.c elf-bfd.h $(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-d10v.lo: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
@@ -1359,16 +1399,18 @@
 elf32-gen.lo: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
-elf32-hppa.lo: elf32-hppa.c $(INCDIR)/bfdlink.h elf-bfd.h \
-  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  elf32-hppa.h libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
-  hppa_stubs.h elf32-target.h
+elf32-i370.lo: elf32-i370.c elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+  elf32-target.h
 elf32-i386.lo: elf32-i386.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i860.lo: elf32-i860.c elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-target.h
+elf32-i960.lo: elf32-i960.c 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-m32r.lo: elf32-m32r.c 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 elf32-target.h
@@ -1395,6 +1437,9 @@
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
   $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
   elf32-target.h
+elf32-pj.lo: elf32-pj.c $(INCDIR)/bfdlink.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
@@ -1413,6 +1458,13 @@
   elfcore.h elflink.h
 elflink.lo: elflink.c $(INCDIR)/bfdlink.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c coff-arm.c \
+  $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
+  libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
+  libpei.h
 hp300bsd.lo: hp300bsd.c libaout.h $(INCDIR)/bfdlink.h \
   aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1493,28 +1545,42 @@
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
 pe-arm.lo: pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-arm.lo: pei-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pe-i386.lo: pe-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-i386.lo: pei-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-mips.lo: pe-mips.c $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/internal.h \
+  $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+  peicode.h
+pei-mips.lo: pei-mips.c pe-mips.c $(INCDIR)/coff/mipspe.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
   $(INCDIR)/bfdlink.h coffcode.h peicode.h
 pe-mcore.lo: pe-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-mcore.lo: pei-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pe-ppc.lo: pe-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
 pei-ppc.lo: pei-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
-  $(INCDIR)/bfdlink.h coffcode.h peicode.h
+  $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-sh.lo: pe-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  coffcode.h peicode.h
+pei-sh.lo: pei-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+  coffcode.h peicode.h
+peigen.lo: peigen.c $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h \
+  $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
 ppcboot.lo: ppcboot.c
 reloc16.lo: reloc16.c $(INCDIR)/bfdlink.h genlink.h \
   $(INCDIR)/coff/internal.h libcoff.h
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index dbe1c30..cac26e8 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -3,7 +3,7 @@
 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
 case "${host}" in
 changequote(,)dnl
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 changequote([,])dnl
   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
 esac])dnl
@@ -24,15 +24,18 @@
   EXEEXT_FOR_BUILD='$(EXEEXT)'
 else
   AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
-    [cat > ac_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-    ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
-    bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
-    rm -f ac_c_test*
-    test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+    [rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     bfd_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
   EXEEXT_FOR_BUILD=""
   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
 fi
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index 4358000..ca9d432 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -15,7 +15,7 @@
 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
 case "${host}" in
 changequote(,)dnl
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 changequote([,])dnl
   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
 esac])dnl
@@ -36,15 +36,18 @@
   EXEEXT_FOR_BUILD='$(EXEEXT)'
 else
   AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
-    [cat > ac_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-    ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
-    bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
-    rm -f ac_c_test*
-    test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+    [rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     bfd_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
   EXEEXT_FOR_BUILD=""
   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
 fi
@@ -208,33 +211,75 @@
 AC_SUBST($1)])
 
 
-# serial 25 AM_PROG_LIBTOOL
-AC_DEFUN(AM_PROG_LIBTOOL,
-[AC_REQUIRE([AM_ENABLE_SHARED])dnl
-AC_REQUIRE([AM_ENABLE_STATIC])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([AM_PROG_LD])dnl
-AC_REQUIRE([AM_PROG_NM])dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-dnl
+# 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=
+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 "$silent" = yes && libtool_flags="$libtool_flags --silent"
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -256,37 +301,41 @@
 
 *-*-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
   ;;
 
-*-*-cygwin*)
-  AM_SYS_LIBTOOL_CYGWIN
+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
-
-# Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
-|| AC_MSG_ERROR([libtool configure failed])
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
 ])
 
-# AM_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AM_ENABLE_SHARED[(DEFAULT)]
+# 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(AM_ENABLE_SHARED,
-[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+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=>>AM_ENABLE_SHARED_DEFAULT],
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
 changequote([, ])dnl
 [p=${PACKAGE-default}
 case "$enableval" in
@@ -304,26 +353,22 @@
   IFS="$ac_save_ifs"
   ;;
 esac],
-enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
 ])
 
-# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AM_DISABLE_SHARED,
-[AM_ENABLE_SHARED(no)])
+# 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)])
 
-# AM_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AM_DISABLE_STATIC,
-[AM_ENABLE_STATIC(no)])
-
-# AM_ENABLE_STATIC - implement the --enable-static flag
-# Usage: AM_ENABLE_STATIC[(DEFAULT)]
+# 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(AM_ENABLE_STATIC,
-[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+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=>>AM_ENABLE_STATIC_DEFAULT],
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
 changequote([, ])dnl
 [p=${PACKAGE-default}
 case "$enableval" in
@@ -341,28 +386,73 @@
   IFS="$ac_save_ifs"
   ;;
 esac],
-enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
+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)])
 
-# AM_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AM_PROG_LD,
+
+# 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])
+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.
+    # Accept absolute paths.
 changequote(,)dnl
-  /* | [A-Za-z]:\\*)
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
 changequote([,])dnl
-    test -z "$LD" && LD="$ac_prog"
-    ;;
+      # 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
@@ -379,10 +469,10 @@
 fi
 AC_CACHE_VAL(ac_cv_path_LD,
 [if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -390,7 +480,7 @@
       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
+	test "$with_gnu_ld" != yes && break
       fi
     fi
   done
@@ -405,11 +495,10 @@
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
-AM_PROG_LD_GNU
+AC_PROG_LD_GNU
 ])
 
-AC_DEFUN(AM_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
@@ -419,29 +508,31 @@
 fi])
 ])
 
-# AM_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AM_PROG_NM,
+# 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}:"
-  for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+  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; then
+    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"
+	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"
+	ac_cv_path_NM="$ac_dir/nm -p"
+	break
       else
-        ac_cv_path_NM="$ac_dir/nm"
+	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
-      break
     fi
   done
   IFS="$ac_save_ifs"
@@ -449,15 +540,85 @@
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
 ])
 
-# AM_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
-AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN,
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-AC_CHECK_TOOL(AS, as, false)
+# 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,
diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c
index a75fa94..fb67b17 100644
--- a/bfd/aix386-core.c
+++ b/bfd/aix386-core.c
@@ -279,5 +279,7 @@
      BFD_JUMP_TABLE_LINK (_bfd_nolink),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0
 };
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 2c11ffe..8216c7e 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -1,5 +1,6 @@
 /* BFD back-end for a.out.adobe binaries.
-   Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.  Based on bout.c.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -372,8 +373,8 @@
 
 static void
 aout_adobe_write_section (abfd, sect)
-     bfd *abfd;
-     sec_ptr sect;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     sec_ptr sect ATTRIBUTE_UNUSED;
 {
   /* FIXME XXX */
 }
@@ -450,8 +451,8 @@
 
 static int 
 aout_adobe_sizeof_headers (ignore_abfd, ignore)
-     bfd *ignore_abfd;
-     boolean ignore;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
+     boolean ignore ATTRIBUTE_UNUSED;
 {
   return sizeof(struct internal_exec);
 }
@@ -523,5 +524,7 @@
      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 beb900b..7365f9d 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -1,5 +1,5 @@
 /* BFD back-end for raw ARM a.out binaries.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   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.
@@ -87,7 +87,7 @@
   HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
 	 MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
 	 false),
-  {-1},
+  EMPTY_HOWTO (-1),
   HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
 	 0x0000ffff, 0x0000ffff, false),
   HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
@@ -230,13 +230,13 @@
 static bfd_reloc_status_type
 MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
 		       output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* This is dead simple at present.  */
   return bfd_reloc_ok;
@@ -251,7 +251,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
   bfd_size_type addr = reloc_entry->address;
@@ -343,7 +343,7 @@
      struct reloc_std_external *bytes;
      arelent *cache_ptr;
      asymbol **symbols;
-     bfd_size_type symcount;
+     bfd_size_type symcount ATTRIBUTE_UNUSED;
 {
   int r_index;
   int r_extern;
@@ -467,6 +467,8 @@
 
 #include "aout-target.h"
 
+extern const bfd_target aout_arm_big_vec;
+
 const bfd_target aout_arm_little_vec =
 {
   "a.out-arm-little",           /* name */
@@ -503,6 +505,8 @@
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
+  & aout_arm_big_vec,
+  
   (PTR) MY_backend_data,
 };
 
@@ -542,5 +546,7 @@
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
+  & aout_arm_little_vec,
+  
   (PTR) MY_backend_data,
 };
diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c
index c1335aa..05ac84e 100644
--- a/bfd/aout-ns32k.c
+++ b/bfd/aout-ns32k.c
@@ -156,7 +156,7 @@
 
 reloc_howto_type *
 MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct reloc_std_external *rel;
      int *r_index;
      int *r_extern;
@@ -266,7 +266,7 @@
      struct reloc_std_external *bytes;
      arelent *cache_ptr;
      asymbol **symbols;
-     bfd_size_type symcount;
+     bfd_size_type symcount ATTRIBUTE_UNUSED;
 {
   int r_index;
   int r_extern;
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 1aee07a..046417b 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -1,5 +1,5 @@
 /* Define a target vector and some small routines for a variant of a.out.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -234,9 +234,9 @@
 static boolean
 MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
      bfd *ibfd;
-     asection *isec;
+     asection *isec ATTRIBUTE_UNUSED;
      bfd *obfd;
-     asection *osec;
+     asection *osec ATTRIBUTE_UNUSED;
 {
   if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
       && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
@@ -258,11 +258,7 @@
   struct external_exec exec_bytes;
   struct internal_exec *execp = exec_hdr (abfd);
 
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE(abfd);
-#else
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
 
   WRITE_HEADERS(abfd, execp);
 
@@ -645,6 +641,9 @@
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
-  (PTR) MY_backend_data,
+  /* Alternative_target */
+  NULL,
+  
+  (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index eae6cb7..686c159 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -1,5 +1,5 @@
 /* BFD back-end for TMS320C30 a.out binaries.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -131,7 +131,7 @@
    it. */
 reloc_howto_type tic30_aout_howto_table[] =
 {
-  {-1},
+  EMPTY_HOWTO (-1),
   HOWTO (1, 2, 1, 16, false, 0, 0, tic30_aout_fix_16,
 	 "16", false, 0x0000FFFF, 0x0000FFFF, false),
   HOWTO (2, 2, 2, 24, false, 0, complain_overflow_bitfield, NULL,
@@ -142,18 +142,18 @@
 	 "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
   HOWTO (5, 2, 1, 16, true, 0, complain_overflow_signed,
 	 tic30_aout_fix_pcrel_16, "PCREL", true, 0x0000FFFF, 0x0000FFFF, true),
-  {-1},
-  {-1},
-  {-1},
-  {-1},
-  {-1}
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1)
 };
 
 extern reloc_howto_type *NAME (aout, reloc_type_lookup) ();
 
 reloc_howto_type *
 tic30_aout_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -218,9 +218,9 @@
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
 
@@ -245,9 +245,9 @@
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
 
@@ -274,11 +274,11 @@
 			 output_bfd, error_message)
      bfd *abfd;
      arelent *reloc_entry;
-     asymbol *symbol;
+     asymbol *symbol ATTRIBUTE_UNUSED;
      PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation = 1;
   bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1);
@@ -590,9 +590,9 @@
 static boolean
 MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
      bfd *ibfd;
-     asection *isec;
+     asection *isec ATTRIBUTE_UNUSED;
      bfd *obfd;
-     asection *osec;
+     asection *osec ATTRIBUTE_UNUSED;
 {
   if (bfd_get_flavour (obfd) == bfd_target_aout_flavour)
     obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
@@ -610,11 +610,8 @@
   struct external_exec exec_bytes;
   struct internal_exec *execp = exec_hdr (abfd);
 
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE (abfd);
-#else
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
+
   {
     bfd_size_type text_size;	/* dummy vars */
     file_ptr text_end;
@@ -779,7 +776,7 @@
 enum machine_type
 tic30_aout_machine_type (arch, machine, unknown)
      enum bfd_architecture arch;
-     unsigned long machine;
+     unsigned long machine ATTRIBUTE_UNUSED;
      boolean *unknown;
 {
   enum machine_type arch_flags;
@@ -1060,6 +1057,8 @@
   BFD_JUMP_TABLE_LINK (MY),
   BFD_JUMP_TABLE_DYNAMIC (MY),
 
-  (PTR) MY_backend_data,
+  NULL,
+  
+  (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 2704eec..fa107a7 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1,5 +1,5 @@
 /* BFD semi-generic back-end for a.out binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -228,28 +228,35 @@
 HOWTO( 8,	       0,  2,    0, false, 0, complain_overflow_bitfield,0,"GOT_REL",	false,         0,0x00000000, false),
 HOWTO( 9,	       0,  1,   16, false, 0, complain_overflow_bitfield,0,"BASE16",	false,0xffffffff,0xffffffff, false),
 HOWTO(10,	       0,  2,   32, false, 0, complain_overflow_bitfield,0,"BASE32",	false,0xffffffff,0xffffffff, false),
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
   HOWTO(16,	       0,  2,	 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false,         0,0x00000000, false),
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 },
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
   HOWTO(32,	       0,  2,	 0, false, 0, complain_overflow_bitfield,0,"RELATIVE",  false,         0,0x00000000, false),
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
-{ -1 },
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
+EMPTY_HOWTO (-1),
   HOWTO(40,	       0,  2,	 0, false, 0, complain_overflow_bitfield,0,"BASEREL",   false,         0,0x00000000, false),
 };
 
@@ -1072,7 +1079,7 @@
 NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
      bfd *abfd;
      bfd_size_type *text_size;
-     file_ptr *text_end;
+     file_ptr *text_end ATTRIBUTE_UNUSED;
 {
   struct internal_exec *execp = exec_hdr (abfd);
 
@@ -2531,16 +2538,16 @@
 /*ARGSUSED*/
  alent *
 NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
-     bfd *ignore_abfd;
-     asymbol *ignore_symbol;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
+     asymbol *ignore_symbol ATTRIBUTE_UNUSED;
 {
-return (alent *)NULL;
+  return (alent *)NULL;
 }
 
 /*ARGSUSED*/
 void
 NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -2568,7 +2575,7 @@
 /*ARGSUSED*/
 void
 NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -2878,7 +2885,7 @@
 int
 NAME(aout,sizeof_headers) (abfd, execable)
      bfd *abfd;
-     boolean execable;
+     boolean execable ATTRIBUTE_UNUSED;
 {
   return adata(abfd).exec_bytes_size;
 }
@@ -4719,6 +4726,8 @@
     default:
       abort ();
     }
+  /*NOTREACHED*/
+  return NULL;
 }
 
 /* Relocate an a.out section using standard a.out relocs.  */
@@ -5020,7 +5029,8 @@
 	      else
 		name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
 	      if (! ((*finfo->info->callbacks->undefined_symbol)
-		     (finfo->info, name, input_bfd, input_section, r_addr)))
+		     (finfo->info, name, input_bfd, input_section,
+		     r_addr, true)))
 		return false;
 	    }
 
@@ -5422,7 +5432,8 @@
 	      else
 		name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
 	      if (! ((*finfo->info->callbacks->undefined_symbol)
-		     (finfo->info, name, input_bfd, input_section, r_addr)))
+		     (finfo->info, name, input_bfd, input_section,
+		     r_addr, true)))
 		return false;
 	    }
 
@@ -5493,7 +5504,7 @@
   int r_index;
   int r_extern;
   reloc_howto_type *howto;
-  file_ptr *reloff_ptr;
+  file_ptr *reloff_ptr = NULL;
   struct reloc_std_external srel;
   struct reloc_ext_external erel;
   PTR rel_ptr;
diff --git a/bfd/archive.c b/bfd/archive.c
index 8ac5aa4..19293af 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1,5 +1,5 @@
 /* BFD back-end for archive files (libraries).
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.  Mostly Gumby Henkel-Wallace's fault.
 
@@ -1178,7 +1178,7 @@
 #else
 static const char *
 normalize (abfd, file)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *file;
 {
   const char *filename = strrchr (file, '/');
@@ -1340,6 +1340,14 @@
 
 /** A couple of functions for creating ar_hdrs */
 
+#ifndef HAVE_GETUID
+#define getuid() 0
+#endif
+
+#ifndef HAVE_GETGID
+#define getgid() 0
+#endif
+
 /* 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
@@ -1901,13 +1909,8 @@
   bfd_ardata (arch)->armap_datepos = (SARMAG
 				      + offsetof (struct ar_hdr, ar_date[0]));
   sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
-#ifndef _WIN32
   sprintf (hdr.ar_uid, "%ld", (long) getuid ());
   sprintf (hdr.ar_gid, "%ld", (long) getgid ());
-#else
-  sprintf (hdr.ar_uid, "%ld", (long) 666);
-  sprintf (hdr.ar_gid, "%ld", (long) 42);
-#endif
   sprintf (hdr.ar_size, "%-10d", (int) mapsize);
   strncpy (hdr.ar_fmag, ARFMAG, 2);
   for (i = 0; i < sizeof (struct ar_hdr); i++)
diff --git a/bfd/archures.c b/bfd/archures.c
index f243862..7462592 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -1,5 +1,6 @@
 /* BFD library support routines for architectures.
-   Copyright (C) 1990, 91-98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
+   Free Software Foundation, Inc.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -134,6 +135,7 @@
 .  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 *}
@@ -147,6 +149,9 @@
 .  bfd_arch_rs6000,    {* IBM RS/6000 *}
 .  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 *}
 .#define bfd_mach_z8001		1
@@ -154,19 +159,25 @@
 .  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
 .#define bfd_mach_sh3        0x30
+.#define bfd_mach_sh3_dsp    0x3d
 .#define bfd_mach_sh3e       0x3e
+.#define bfd_mach_sh4        0x40
 .  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 *}
 .#define bfd_mach_arm_2		1
-.#define bfd_mach_arm_2a		2
+.#define bfd_mach_arm_2a	2
 .#define bfd_mach_arm_3		3
 .#define bfd_mach_arm_3M 	4
-.#define bfd_mach_arm_4 		5
+.#define bfd_mach_arm_4 	5
 .#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 *}
@@ -179,12 +190,20 @@
 .#define bfd_mach_arc_base 0
 .  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 *}
 .#define bfd_mach_mn10300		300
+.#define bfd_mach_am33		330
 .  bfd_arch_fr30,
 .#define bfd_mach_fr30		0x46523330
 .  bfd_arch_mcore,
+.  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
 .  bfd_arch_last
 .  };
 
@@ -232,6 +251,7 @@
 extern const bfd_arch_info_type bfd_h8300_arch;
 extern const bfd_arch_info_type bfd_h8500_arch;
 extern const bfd_arch_info_type bfd_hppa_arch;
+extern const bfd_arch_info_type bfd_i370_arch;
 extern const bfd_arch_info_type bfd_i386_arch;
 extern const bfd_arch_info_type bfd_i860_arch;
 extern const bfd_arch_info_type bfd_i960_arch;
@@ -243,6 +263,7 @@
 extern const bfd_arch_info_type bfd_mn10300_arch;
 extern const bfd_arch_info_type bfd_powerpc_arch;
 extern const bfd_arch_info_type bfd_rs6000_arch;
+extern const bfd_arch_info_type bfd_pj_arch;
 extern const bfd_arch_info_type bfd_sh_arch;
 extern const bfd_arch_info_type bfd_sparc_arch;
 extern const bfd_arch_info_type bfd_tic30_arch;
@@ -255,6 +276,7 @@
 extern const bfd_arch_info_type bfd_v850_arch;
 extern const bfd_arch_info_type bfd_fr30_arch;
 extern const bfd_arch_info_type bfd_mcore_arch;
+extern const bfd_arch_info_type bfd_avr_arch;
 
 static const bfd_arch_info_type * const bfd_archures_list[] =
 {
@@ -270,6 +292,7 @@
   &bfd_h8300_arch,
   &bfd_h8500_arch,
   &bfd_hppa_arch,
+  &bfd_i370_arch,
   &bfd_i386_arch,
   &bfd_i860_arch,
   &bfd_i960_arch,
@@ -292,7 +315,8 @@
   &bfd_w65_arch,
   &bfd_v850_arch,
   &bfd_fr30_arch,
-  & bfd_mcore_arch,
+  &bfd_mcore_arch,
+  &bfd_avr_arch,
 #endif
   0
 };
@@ -796,6 +820,26 @@
       arch = bfd_arch_rs6000;
       break;
 
+    case 7410:
+      arch = bfd_arch_sh;
+      number = bfd_mach_sh_dsp;
+      break;
+
+    case 7708:
+      arch = bfd_arch_sh;
+      number = bfd_mach_sh3;
+      break;
+
+    case 7729:
+      arch = bfd_arch_sh;
+      number = bfd_mach_sh3_dsp;
+      break;
+
+    case 7750:
+      arch = bfd_arch_sh;
+      number = bfd_mach_sh4;
+      break;
+
     default:  
       return false;
     }
@@ -888,9 +932,58 @@
      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!";
 }
+
+/*
+FUNCTION
+	bfd_octets_per_byte
+
+SYNOPSIS
+	unsigned int bfd_octets_per_byte(bfd *abfd);
+
+DESCRIPTION
+	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;
+{
+    return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd), 
+                                          bfd_get_mach (abfd));
+}
+
+/*
+FUNCTION
+	bfd_arch_mach_octets_per_byte
+
+SYNOPSIS
+	unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
+                                                   unsigned long machine);
+
+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;
+{
+    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
new file mode 100644
index 0000000..3e6ee47
--- /dev/null
+++ b/bfd/armnetbsd.c
@@ -0,0 +1,49 @@
+/* BFD back-end for NetBSD/ARM a.out-ish binaries.
+   Copyright (C) 1999 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	BYTES_IN_WORD		4
+#undef TARGET_IS_BIG_ENDIAN_P
+
+#define	TARGET_PAGE_SIZE	4096
+#define	SEGMENT_SIZE		TARGET_PAGE_SIZE
+
+#define	DEFAULT_ARCH		bfd_arch_arm
+#define	DEFAULT_MID 		M_ARM6_NETBSD
+/*#define MACHTYPE_OK(mtype) ((mtype) == M_ARM6_NETBSD)*/
+
+#define MY(OP) 			CAT (armnetbsd_, OP)
+/* This needs to start with a.out so GDB knows it is an a.out variant.  */
+#define TARGETNAME 		"a.out-arm-netbsd"
+
+#if 0
+#define NAME(x,y) CAT3(aoutarm,_32_,y)
+
+#define aoutarm_32_get_section_contents aout_32_get_section_contents
+
+#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
+
+#include "bfd.h"		/* To ensure following declaration is OK */
+
+CONST struct reloc_howto_struct *
+MY_bfd_reloc_type_lookup
+  PARAMS ((bfd * abfd AND
+	  bfd_reloc_code_real_type code));
+#endif
+
+#include "netbsd.h"
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 8bdbf80..1f67c0c 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -1,5 +1,5 @@
 /* Main header file for the bfd library -- portable access to object files.
-   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.
    Contributed by Cygnus Support.
 
@@ -626,6 +626,20 @@
 extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
 extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
 
+/* 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.  */
+extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+
+/* 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
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   Return the number of program header table entries read, or -1 if an
+   error occurs; bfd_get_error will return an appropriate code.  */
+extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+
 /* SunOS shared library support routines for the linker.  */
 
 extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
@@ -714,14 +728,24 @@
 extern boolean bfd_arm_get_bfd_for_interworking
   PARAMS ((bfd *, struct bfd_link_info *));
 
+/* PE ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
 /* ELF ARM Interworking support.  Called from linker.  */
-  extern boolean bfd_elf32_arm_allocate_interworking_sections
-    PARAMS ((struct bfd_link_info *));
- 
-  extern boolean bfd_elf32_arm_process_before_allocation
-    PARAMS ((bfd *, struct bfd_link_info *));
- 
-  extern boolean bfd_elf32_arm_get_bfd_for_interworking
-    PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_elf32_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
 
 /* And more from the source.  */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 8e86304..fa1c5b9 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1,5 +1,5 @@
 /* Main header file for the bfd library -- portable access to object files.
-   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.
    Contributed by Cygnus Support.
 
@@ -626,6 +626,20 @@
 extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
 extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
 
+/* 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.  */
+extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+
+/* 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
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   Return the number of program header table entries read, or -1 if an
+   error occurs; bfd_get_error will return an appropriate code.  */
+extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+
 /* SunOS shared library support routines for the linker.  */
 
 extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
@@ -714,15 +728,25 @@
 extern boolean bfd_arm_get_bfd_for_interworking
   PARAMS ((bfd *, struct bfd_link_info *));
 
+/* PE ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
 /* ELF ARM Interworking support.  Called from linker.  */
-  extern boolean bfd_elf32_arm_allocate_interworking_sections
-    PARAMS ((struct bfd_link_info *));
- 
-  extern boolean bfd_elf32_arm_process_before_allocation
-    PARAMS ((bfd *, struct bfd_link_info *));
- 
-  extern boolean bfd_elf32_arm_get_bfd_for_interworking
-    PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_elf32_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
 
 /* And more from the source.  */
 void 
@@ -759,7 +783,7 @@
  /* Byte swapping macros for user section data.  */
 
 #define bfd_put_8(abfd, val, ptr) \
-                (*((unsigned char *)(ptr)) = (unsigned char)(val))
+                ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
 #define bfd_put_signed_8 \
                bfd_put_8
 #define bfd_get_8(abfd, ptr) \
@@ -794,6 +818,20 @@
 #define bfd_get_signed_64(abfd, ptr) \
                 BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
 
+#define bfd_get(bits, abfd, ptr)                               \
+                ((bits) == 8 ? bfd_get_8 (abfd, ptr)           \
+                : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
+                : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
+                : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
+                : (abort (), (bfd_vma) - 1))
+
+#define bfd_put(bits, abfd, val, ptr)                          \
+                ((bits) == 8 ? bfd_put_8 (abfd, val, ptr)      \
+                : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
+                : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
+                : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
+                : (abort (), (void) 0))
+
 
  /* Byte swapping macros for file header data.  */
 
@@ -833,6 +871,27 @@
 #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. */
+
+struct bfd_comdat_info
+{
+   /* The name of the symbol associated with a comdat section.  */
+  const char *name;
+
+   /* 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
@@ -990,6 +1049,14 @@
         /* 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.  */
+#define SEC_SMALL_DATA 0x2000000
+
+        /* This section contains data which may be shared with other
+          executables or shared objects.  */
+#define SEC_SHARED 0x4000000
+
         /*  End of section flags.  */
 
         /* Some internal packed boolean fields.  */
@@ -1023,22 +1090,25 @@
 
    bfd_vma lma;
 
-         /* The size of the section in bytes, 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 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_size_type _cooked_size;
 
-         /* The original size on disk of the section, in bytes.  Normally this
+         /* 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 _raw_size;
 
          /* If this section is going to be output, then this value is the
-           offset into the output section of the first byte in the input
-           section. E.g., if this was going to start at the 100th byte in
-           the output section, this value would be 100. */
+           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_vma output_offset;
 
@@ -1096,6 +1166,10 @@
 
    unsigned int lineno_count;
 
+         /* Optional information about a COMDAT entry; NULL if not COMDAT */
+
+   struct bfd_comdat_info *comdat;
+
          /* When a section is being output, this value changes as more
            linenumbers are written out */
 
@@ -1155,9 +1229,11 @@
 extern const struct symbol_cache_entry * const bfd_und_symbol;
 extern const struct symbol_cache_entry * const bfd_ind_symbol;
 #define bfd_get_section_size_before_reloc(section) \
-     (section->reloc_done ? (abort(),1): (section)->_raw_size)
+     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
+                            : (section)->_raw_size)
 #define bfd_get_section_size_after_reloc(section) \
-     ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
+     ((section)->reloc_done ? (section)->_cooked_size \
+                            : (abort (), (bfd_size_type) 1))
 asection *
 bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
 
@@ -1204,7 +1280,7 @@
                (ibfd, isection, obfd, osection))
 void 
 _bfd_strip_section_from_output
- PARAMS ((asection *section));
+ PARAMS ((struct bfd_link_info *info, asection *section));
 
 enum bfd_architecture 
 {
@@ -1275,6 +1351,7 @@
   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 */
@@ -1288,6 +1365,9 @@
   bfd_arch_rs6000,     /* IBM RS/6000 */
   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 */
 #define bfd_mach_z8001         1
@@ -1295,19 +1375,25 @@
   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
 #define bfd_mach_sh3        0x30
+#define bfd_mach_sh3_dsp    0x3d
 #define bfd_mach_sh3e       0x3e
+#define bfd_mach_sh4        0x40
   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 */
 #define bfd_mach_arm_2         1
-#define bfd_mach_arm_2a                2
+#define bfd_mach_arm_2a        2
 #define bfd_mach_arm_3         3
 #define bfd_mach_arm_3M        4
-#define bfd_mach_arm_4                 5
+#define bfd_mach_arm_4         5
 #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 */
@@ -1320,12 +1406,20 @@
 #define bfd_mach_arc_base 0
   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 */
 #define bfd_mach_mn10300               300
+#define bfd_mach_am33          330
   bfd_arch_fr30,
 #define bfd_mach_fr30          0x46523330
   bfd_arch_mcore,
+  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
   bfd_arch_last
   };
 
@@ -1391,6 +1485,13 @@
 bfd_printable_arch_mach
  PARAMS ((enum bfd_architecture arch, unsigned long machine));
 
+unsigned int 
+bfd_octets_per_byte PARAMS ((bfd *abfd));
+
+unsigned int 
+bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
+    unsigned long machine));
+
 typedef enum bfd_reloc_status
 {
         /* No errors detected */
@@ -1509,13 +1610,26 @@
         /* The textual name of the relocation type. */
   char *name;
 
-        /* When performing a partial link, some formats must modify the
-          relocations rather than the data - this flag signals this.*/
+        /* 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
+          addend is recorded with the section contents; when performing a
+          partial link (ld -r) the section contents (the data) will be
+          modified.  The value of this field is FALSE if addends are
+          recorded with the relocation (in arelent.addend); when performing
+          a partial link the relocation will be modified.
+          All relocations for all ELF USE_RELA targets should set this field
+          to FALSE (values of TRUE should be looked on with suspicion).
+          However, the converse is not true: not all relocations of all ELF
+          USE_REL targets set this field to TRUE.  Why this is so is peculiar
+          to each particular target.  For relocs that aren't used in partial
+          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
           are to be used in the relocation sum.  E.g., if this was an 8 bit
-          bit of data which we read and relocated, this would be
+          byte of data which we read and relocated, this would be
           0x000000ff. When we have relocs which have an addend, such as
           sun4 extended relocs, the value in the offset part of a
           relocating field is garbage so we never use it. In this case
@@ -1541,6 +1655,9 @@
   {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
 #define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
 
+#define EMPTY_HOWTO(C) \
+  HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false)
+
 #define HOWTO_PREPARE(relocation, symbol)      \
   {                                            \
   if (symbol != (asymbol *)NULL) {             \
@@ -1773,6 +1890,17 @@
   BFD_RELOC_ALPHA_ELF_LITERAL,
   BFD_RELOC_ALPHA_LITUSE,
 
+/* 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. */
+  BFD_RELOC_ALPHA_USER_LITERAL,
+  BFD_RELOC_ALPHA_USER_LITUSE_BASE,
+  BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF,
+  BFD_RELOC_ALPHA_USER_LITUSE_JSR,
+  BFD_RELOC_ALPHA_USER_GPDISP,
+  BFD_RELOC_ALPHA_USER_GPRELHIGH,
+  BFD_RELOC_ALPHA_USER_GPRELLOW,
+
 /* The HINT relocation indicates a value that should be filled into the
 "hint" field of a jmp/jsr/ret instruction, for possible branch-
 prediction logic which may be provided on some processors. */
@@ -1828,6 +1956,10 @@
   BFD_RELOC_MIPS_GOT_LO16,
   BFD_RELOC_MIPS_CALL_HI16,
   BFD_RELOC_MIPS_CALL_LO16,
+  BFD_RELOC_MIPS_SUB,
+  BFD_RELOC_MIPS_GOT_PAGE,
+  BFD_RELOC_MIPS_GOT_OFST,
+  BFD_RELOC_MIPS_GOT_DISP,
 
 
 /* i386/elf relocations */
@@ -1854,6 +1986,14 @@
   BFD_RELOC_NS32K_DISP_16_PCREL,
   BFD_RELOC_NS32K_DISP_32_PCREL,
 
+/* Picojava relocs.  Not all of these appear in object files. */
+  BFD_RELOC_PJ_CODE_HI16,
+  BFD_RELOC_PJ_CODE_LO16,
+  BFD_RELOC_PJ_CODE_DIR16,
+  BFD_RELOC_PJ_CODE_DIR32,
+  BFD_RELOC_PJ_CODE_REL16,
+  BFD_RELOC_PJ_CODE_REL32,
+
 /* Power(rs6000) and PowerPC relocations. */
   BFD_RELOC_PPC_B26,
   BFD_RELOC_PPC_BA26,
@@ -1886,6 +2026,9 @@
   BFD_RELOC_PPC_EMB_BIT_FLD,
   BFD_RELOC_PPC_EMB_RELSDA,
 
+/* IBM 370/390 relocations */
+  BFD_RELOC_I370_D12,
+
 /* The type of reloc used to build a contructor table - at the moment
 probably a 32 bit wide absolute relocation, but the target can choose.
 It generally does map to one of the other relocation types. */
@@ -1898,6 +2041,7 @@
 /* These relocs are only used within the ARM assembler.  They are not
 (at present) written to any object files. */
   BFD_RELOC_ARM_IMMEDIATE,
+  BFD_RELOC_ARM_ADRL_IMMEDIATE,
   BFD_RELOC_ARM_OFFSET_IMM,
   BFD_RELOC_ARM_SHIFT_IMM,
   BFD_RELOC_ARM_SWI,
@@ -1984,39 +2128,39 @@
 This is a 6-bit absolute reloc. */
   BFD_RELOC_D30V_6,
 
-/* This is a 6-bit pc-relative reloc with 
+/* This is a 6-bit pc-relative reloc with
 the right 3 bits assumed to be 0. */
   BFD_RELOC_D30V_9_PCREL,
 
-/* This is a 6-bit pc-relative reloc with 
+/* This is a 6-bit pc-relative reloc with
 the right 3 bits assumed to be 0. Same
 as the previous reloc but on the right side
 of the container. */
   BFD_RELOC_D30V_9_PCREL_R,
 
-/* This is a 12-bit absolute reloc with the 
+/* This is a 12-bit absolute reloc with the
 right 3 bitsassumed to be 0. */
   BFD_RELOC_D30V_15,
 
-/* This is a 12-bit pc-relative reloc with 
+/* This is a 12-bit pc-relative reloc with
 the right 3 bits assumed to be 0. */
   BFD_RELOC_D30V_15_PCREL,
 
-/* This is a 12-bit pc-relative reloc with 
+/* This is a 12-bit pc-relative reloc with
 the right 3 bits assumed to be 0. Same
 as the previous reloc but on the right side
 of the container. */
   BFD_RELOC_D30V_15_PCREL_R,
 
-/* This is an 18-bit absolute reloc with 
+/* This is an 18-bit absolute reloc with
 the right 3 bits assumed to be 0. */
   BFD_RELOC_D30V_21,
 
-/* This is an 18-bit pc-relative reloc with 
+/* This is an 18-bit pc-relative reloc with
 the right 3 bits assumed to be 0. */
   BFD_RELOC_D30V_21_PCREL,
 
-/* This is an 18-bit pc-relative reloc with 
+/* This is an 18-bit pc-relative reloc with
 the right 3 bits assumed to be 0. Same
 as the previous reloc but on the right side
 of the container. */
@@ -2162,8 +2306,77 @@
   BFD_RELOC_MCORE_PCREL_IMM4BY2,
   BFD_RELOC_MCORE_PCREL_32,
   BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
+  BFD_RELOC_MCORE_RVA,
 
-/* These two relocations are used by the linker to determine which of 
+/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
+short offset into 7 bits. */
+  BFD_RELOC_AVR_7_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
+short offset into 12 bits. */
+  BFD_RELOC_AVR_13_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
+program memory address) into 16 bits. */
+  BFD_RELOC_AVR_16_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+data memory address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_LO8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of data memory address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_HI8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of program memory address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_HH8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually data memory address) into 8 bit immediate value of SUBI insn. */
+  BFD_RELOC_AVR_LO8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of data memory address) into 8 bit immediate value of
+SUBI insn. */
+  BFD_RELOC_AVR_HI8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(most high 8 bit of program memory address) into 8 bit immediate value
+of LDI or SUBI insn. */
+  BFD_RELOC_AVR_HH8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+command address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_LO8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of command address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_HI8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of command address) into 8 bit immediate value of LDI insn. */
+  BFD_RELOC_AVR_HH8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually command address) into 8 bit immediate value of SUBI insn. */
+  BFD_RELOC_AVR_LO8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of 16 bit command address) into 8 bit immediate value
+of SUBI insn. */
+  BFD_RELOC_AVR_HI8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 6 bit of 22 bit command address) into 8 bit immediate
+value of SUBI insn. */
+  BFD_RELOC_AVR_HH8_LDI_PM_NEG,
+
+/* This is a 32 bit reloc for the AVR that stores 23 bit value
+into 22 bits. */
+  BFD_RELOC_AVR_CALL,
+
+/* These two relocations are used by the linker to determine which of
 the entries in a C++ virtual function table are actually used.  When
 the --gc-sections option is given, the linker will zero out the entries
 that are not used, so that the code for those functions need not be
@@ -2177,7 +2390,7 @@
 VTABLE_ENTRY is a zero-space relocation that describes the use of a
 virtual function table entry.  The reloc's symbol should refer to the
 table of the class mentioned in the code.  Off of that base, an offset
-describes the entry that is being used.  For Rela hosts, this offset 
+describes the entry that is being used.  For Rela hosts, this offset
 is stored in the reloc's addend.  For Rel hosts, we are forced to put
 this offset in the reloc's section offset. */
   BFD_RELOC_VTABLE_INHERIT,
@@ -2236,7 +2449,7 @@
           <<BSF_GLOBAL>> */
 
         /* The symbol is a debugging record. The value has an arbitary
-          meaning. */
+          meaning, unless BSF_DEBUGGING_RELOC is also set.  */
 #define BSF_DEBUGGING  0x08
 
         /* The symbol denotes a function entry point.  Used in ELF,
@@ -2294,6 +2507,11 @@
           others someday.  */
 #define BSF_OBJECT        0x10000
 
+        /* 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
@@ -2335,6 +2553,9 @@
 int 
 bfd_decode_symclass PARAMS ((asymbol *symbol));
 
+boolean 
+bfd_is_undefined_symclass  PARAMS ((int symclass));
+
 void 
 bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
 
@@ -2974,7 +3195,11 @@
   long  (*_bfd_canonicalize_dynamic_reloc)
     PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
 
+  /* 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));
@@ -2985,6 +3210,9 @@
 const char **
 bfd_target_list PARAMS ((void));
 
+const bfd_target * 
+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 597e8f0..e04172f 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,5 +1,5 @@
 /* Generic BFD library interface and support routines.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -618,7 +618,7 @@
 /*ARGSUSED*/
 void
 bfd_set_reloc (ignore_abfd, asect, location, count)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      sec_ptr asect;
      arelent **location;
      unsigned int count;
@@ -679,6 +679,30 @@
   (*_bfd_error_handler) (_("bfd assertion fail %s:%d"), file, line);
 }
 
+/* A more or less friendly abort message.  In libbfd.h abort is
+   defined to call this function.  */
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+void
+_bfd_abort (file, line, fn)
+     const char *file;
+     int line;
+     const char *fn;
+{
+  if (fn != NULL)
+    (*_bfd_error_handler)
+      (_("BFD internal error, aborting at %s line %d in %s\n"),
+       file, line, fn);
+  else
+    (*_bfd_error_handler)
+      (_("BFD internal error, aborting at %s line %d\n"),
+       file, line);
+  (*_bfd_error_handler) (_("Please report this bug.\n"));
+  xexit (EXIT_FAILURE);
+}
 
 /*
 FUNCTION
diff --git a/bfd/binary.c b/bfd/binary.c
index 6c63fff..c2980b0 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -58,7 +58,7 @@
 
 static boolean
 binary_mkobject (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -112,7 +112,7 @@
 static boolean
 binary_get_section_contents (abfd, section, location, offset, count)
      bfd *abfd;
-     asection *section;
+     asection *section ATTRIBUTE_UNUSED;
      PTR location;
      file_ptr offset;
      bfd_size_type count;
@@ -127,7 +127,7 @@
 
 static long
 binary_get_symtab_upper_bound (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   return (BIN_SYMS + 1) * sizeof (asymbol *);
 }
@@ -222,7 +222,7 @@
 
 static void
 binary_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -318,8 +318,8 @@
 
 static int
 binary_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -382,5 +382,7 @@
   BFD_JUMP_TABLE_LINK (binary),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   NULL
 };
diff --git a/bfd/bout.c b/bfd/bout.c
index 4ef10f5..c230e18 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Intel 960 b.out binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -494,7 +495,7 @@
 
 static reloc_howto_type *
 b_out_bfd_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -1001,8 +1002,8 @@
 
 static int
 b_out_sizeof_headers (ignore_abfd, ignore)
-     bfd *ignore_abfd;
-     boolean ignore;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
+     boolean ignore ATTRIBUTE_UNUSED;
 {
   return sizeof(struct internal_exec);
 }
@@ -1046,7 +1047,8 @@
 	{
 	  if (! ((*link_info->callbacks->undefined_symbol)
 		 (link_info, bfd_asymbol_name (symbol),
-		  input_section->owner, input_section, reloc->address)))
+		  input_section->owner, input_section, reloc->address,
+		  true)))
 	    abort ();
 	  value = 0;
 	}
@@ -1452,6 +1454,8 @@
 #define aout_32_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
 
+extern const bfd_target b_out_vec_little_host;
+
 const bfd_target b_out_vec_big_host =
 {
   "b.out.big",			/* name */
@@ -1489,6 +1493,8 @@
      BFD_JUMP_TABLE_LINK (b_out),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & b_out_vec_little_host,
+  
   (PTR) 0,
 };
 
@@ -1530,5 +1536,7 @@
      BFD_JUMP_TABLE_LINK (b_out),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & b_out_vec_big_host,
+  
   (PTR) 0
 };
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index 11c9bbd..3492e75 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -36,43 +36,60 @@
 # define SIGBUS 10
 #endif
 
-#define CRASH_INFO (0xffc)
-#define CRASH_MAGIC 0xdead1234
+int crash_info_locs[] = {
+  0x0250,	/* mips, ppc, x86, i960 */
+  0x0400,	/* m68k, mips, x86, i960 */
+  0x0FFC,	/* m68k, mips, ppc, x86, i960 */
+  0x3000,	/* ppc */
+  0x4FFC,	/* m68k */
+  -1
+};
+
+#define CRASH_MAGIC	0xdead1234
+#define MASK_ADDR(x)	((x) & 0x0fffffff)	/* Mask crash info address */
 
 typedef enum {
     CRASH_REASON_NOTCRASHED = 0,
     CRASH_REASON_EXCEPTION = 1,
     CRASH_REASON_CORRUPT = 2,
-  } crashreason;
+} crashreason;
 
-struct crashinfo_external
-{
-  char magic[4];			/* Magic number */
+typedef struct {
+  char magic[4];		/* Magic number */
   char version[4];		/* Version number */
   char reason[4];		/* Crash reason */
   char cpu_vector[4];		/* CPU vector for exceptions */
   char registers[4];		/* Pointer to saved registers */
   char rambase[4];		/* Base of RAM (not in V1 crash info) */
-};
+  char textbase[4];		/* Base of .text section (not in V3 crash info) */
+  char database[4];		/* Base of .data section (not in V3 crash info) */
+  char bssbase[4];		/* Base of .bss section (not in V3 crash info) */
+} crashinfo_external;
 
 struct cisco_core_struct
 {
   int sig;
 };
 
+/* Examine the file for a crash info struct at the offset given by
+   CRASH_INFO_LOC. */
+
 static const bfd_target *
-cisco_core_file_p (abfd)
+cisco_core_file_validate (abfd, crash_info_loc)
      bfd *abfd;
+     int crash_info_loc;
 {
   char buf[4];
   unsigned int crashinfo_offset;
-  struct crashinfo_external crashinfo;
+  crashinfo_external crashinfo;
   int nread;
+  unsigned int magic;
+  unsigned int version;
   unsigned int rambase;
   sec_ptr asect;
   struct stat statbuf;
 
-  if (bfd_seek (abfd, CRASH_INFO, SEEK_SET) != 0)
+  if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0)
     return NULL;
 
   nread = bfd_read (buf, 1, 4, abfd);
@@ -82,10 +99,14 @@
 	bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
-  crashinfo_offset = bfd_get_32 (abfd, buf);
+  crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf));
 
   if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)
-    return NULL;
+    {
+      /* Most likely we failed because of a bogus (huge) offset */
+      bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
 
   nread = bfd_read (&crashinfo, 1, sizeof (crashinfo), abfd);
   if (nread != sizeof (crashinfo))
@@ -101,24 +122,27 @@
       return NULL;
     }
 
-  if (bfd_get_32 (abfd, crashinfo.magic) != CRASH_MAGIC)
+  magic = bfd_get_32 (abfd, crashinfo.magic);
+  if (magic != CRASH_MAGIC)
     {
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
-  switch (bfd_get_32 (abfd, crashinfo.version))
+  version = bfd_get_32 (abfd, crashinfo.version);
+  if (version == 0)
     {
-    case 0:
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
-    case 1:
+    }
+  else if (version == 1)
+    {
+      /* V1 core dumps don't specify the dump base, assume 0 */
       rambase = 0;
-      break;
-    default:
-    case 2:
+    }
+  else
+    {
       rambase = bfd_get_32 (abfd, crashinfo.rambase);
-      break;
     }
 
   /* OK, we believe you.  You're a core file.  */
@@ -211,22 +235,43 @@
   abfd->sections = NULL;
   abfd->section_count = 0;
 
+  /* Create a ".reg" section to allow access to the saved
+     registers. */
+
   asect = (asection *) bfd_zmalloc (sizeof (asection));
   if (asect == NULL)
     goto error_return;
   asect->name = ".reg";
   asect->flags = SEC_HAS_CONTENTS;
-  /* This can be bigger than the real size.  Set it to the size of the whole
-     core file.  */
-  asect->_raw_size = statbuf.st_size;
   asect->vma = 0;
   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. */
+  nread = statbuf.st_size - asect->filepos;
+  asect->_raw_size = (nread < 1024) ? nread : 1024;
   asect->next = abfd->sections;
   abfd->sections = asect;
   ++abfd->section_count;
 
-  /* There is only one section containing data from the target system's RAM.
-     We call it .data.  */
+  /* Create a ".crash" section to allow access to the saved
+     crash information. */
+
+  asect = (asection *) bfd_zmalloc (sizeof (asection));
+  if (asect == NULL)
+    goto error_return;
+  asect->name = ".crash";
+  asect->flags = SEC_HAS_CONTENTS;
+  asect->vma = 0;
+  asect->filepos = crashinfo_offset;
+  asect->_raw_size = sizeof (crashinfo);
+  asect->next = abfd->sections;
+  abfd->sections = asect;
+  ++abfd->section_count;
+
+  /* Create a ".data" section that maps the entire file, which is
+     essentially a dump of the target system's RAM. */
+
   asect = (asection *) bfd_zmalloc (sizeof (asection));
   if (asect == NULL)
     goto error_return;
@@ -242,6 +287,9 @@
 
   return abfd->xvec;
 
+  /* Get here if we have already started filling out the BFD
+     and there is an error of some kind. */
+
  error_return:
   {
     sec_ptr nextsect;
@@ -256,6 +304,22 @@
   }
 }
 
+static const bfd_target *
+cisco_core_file_p (abfd)
+     bfd *abfd;
+{
+  int *crash_info_locp;
+  const bfd_target *target = NULL;
+
+  for (crash_info_locp = crash_info_locs;
+       *crash_info_locp != -1  &&  target == NULL;
+       crash_info_locp++)
+    {
+      target = cisco_core_file_validate (abfd, *crash_info_locp);
+    }
+  return (target);
+}
+
 char *
 cisco_core_file_failing_command (abfd)
      bfd *abfd;
@@ -278,9 +342,11 @@
   return true;
 }
 
-const bfd_target cisco_core_vec =
+extern const bfd_target cisco_core_little_vec;
+
+const bfd_target cisco_core_big_vec =
   {
-    "trad-core",
+    "cisco-ios-core-big",
     bfd_target_unknown_flavour,
     BFD_ENDIAN_BIG,		/* target byte order */
     BFD_ENDIAN_BIG,		/* target headers byte order */
@@ -323,5 +389,57 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    & cisco_core_little_vec,
+    
+    (PTR) 0			/* backend_data */
+};
+
+const bfd_target cisco_core_little_vec =
+  {
+    "cisco-ios-core-little",
+    bfd_target_unknown_flavour,
+    BFD_ENDIAN_LITTLE,		/* target byte order */
+    BFD_ENDIAN_LITTLE,		/* target headers byte order */
+    (HAS_RELOC | EXEC_P |	/* object flags */
+     HAS_LINENO | HAS_DEBUG |
+     HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+    0,			                                   /* symbol prefix */
+    ' ',						   /* ar_pad_char */
+    16,							   /* ar_max_namelen */
+    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+    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_check_format */
+     _bfd_dummy_target,		/* unknown format */
+     _bfd_dummy_target,		/* object file */
+     _bfd_dummy_target,		/* archive */
+     cisco_core_file_p	/* a core file */
+    },
+    {				/* bfd_set_format */
+     bfd_false, bfd_false,
+     bfd_false, bfd_false
+    },
+    {				/* bfd_write_contents */
+     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),
+       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),
+
+    &cisco_core_big_vec,
+    
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c
index bbf23ee..0374b20 100644
--- a/bfd/coff-a29k.c
+++ b/bfd/coff-a29k.c
@@ -1,5 +1,6 @@
 /* BFD back-end for AMD 29000 COFF binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 97, 98, 1999
+   Free Software Foundation, Inc.
    Contributed by David Wood at New York University 7/8/91.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -235,9 +236,29 @@
 static reloc_howto_type howto_table[] = 
 {
   {R_ABS,     0, 3, 32, false, 0, complain_overflow_bitfield,a29k_reloc,"ABS",     true, 0xffffffff,0xffffffff, false},
-  {1},  {2},  {3},   {4},  {5},  {6},  {7},  {8},  {9}, {10},
-  {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20},
-  {21}, {22}, {23},
+  EMPTY_HOWTO (1),
+  EMPTY_HOWTO (2),
+  EMPTY_HOWTO (3),
+  EMPTY_HOWTO (4),
+  EMPTY_HOWTO (5),
+  EMPTY_HOWTO (6),
+  EMPTY_HOWTO (7),
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9),
+  EMPTY_HOWTO (10),
+  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),
+  EMPTY_HOWTO (20),
+  EMPTY_HOWTO (21),
+  EMPTY_HOWTO (22),
+  EMPTY_HOWTO (23),
   {R_IREL,    0, 3, 32, true,  0, complain_overflow_signed,a29k_reloc,"IREL",    true, 0xffffffff,0xffffffff, false},
   {R_IABS,    0, 3, 32, false, 0, complain_overflow_bitfield, a29k_reloc,"IABS",    true, 0xffffffff,0xffffffff, false},
   {R_ILOHALF, 0, 3, 16, true,  0, complain_overflow_signed, a29k_reloc,"ILOHALF", true, 0x0000ffff,0x0000ffff, false},
@@ -311,7 +332,7 @@
 static boolean
 coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
 			    contents, relocs, syms, sections)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      bfd *input_bfd;
      asection *input_section;
@@ -395,7 +416,7 @@
 		{
 		  if (! ((*info->callbacks->undefined_symbol)
 			 (info, h->root.root.string, input_bfd, input_section,
-			  rel->r_vaddr - input_section->vma)))
+			  rel->r_vaddr - input_section->vma, true)))
 		    return false;
 		}
 	    }
@@ -562,10 +583,10 @@
 /*ARGSUSED*/
 static boolean
 coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
-     bfd *obfd;
-     struct bfd_link_info *info;
-     bfd *ibfd;
-     asection *sec;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     bfd *ibfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
      struct internal_reloc *irel;
      boolean *adjustedp;
 {
@@ -580,61 +601,4 @@
 
 #include "coffcode.h"
 
-const bfd_target a29kcoff_big_vec =
-{
-  "coff-a29k-big",		/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC /* section flags */
-   | SEC_LOAD | SEC_RELOC  
-   | SEC_READONLY ),
-  '_',				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-  /* 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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32,   bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- {
-	    
-   _bfd_dummy_target,
-   coff_object_p,
-   bfd_generic_archive_p,
-   _bfd_dummy_target
-  },
- {
-   bfd_false,
-   coff_mkobject,
-   _bfd_generic_mkarchive,
-   bfd_false
-  },
- {
-   bfd_false,
-   coff_write_object_contents,
-   _bfd_write_archive_contents,
-   bfd_false
-  },
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
+CREATE_BIG_COFF_TARGET_VEC (a29kcoff_big_vec, "coff-a29k-big", 0, SEC_READONLY, '_', NULL)
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index d841663..6bbc279 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -1,5 +1,5 @@
 /* BFD back-end for ALPHA Extended-Coff files.
-   Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
    Ian Lance Taylor <ian@cygnus.com>.
 
@@ -1133,7 +1133,7 @@
 	    case bfd_reloc_undefined:
 	      if (! ((*link_info->callbacks->undefined_symbol)
 		     (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
-		      input_bfd, input_section, rel->address)))
+		      input_bfd, input_section, rel->address, true)))
 		goto error_return;
 	      break;
 	    case bfd_reloc_dangerous: 
@@ -1719,7 +1719,7 @@
 			 relocated.  */
 		      if (! ((*info->callbacks->undefined_symbol)
 			     (info, h->root.root.string, input_bfd,
-			      input_section, (bfd_vma) 0)))
+			      input_section, (bfd_vma) 0, true)))
 			return false;
 		      addend = 0;
 		    }
@@ -1921,7 +1921,7 @@
 		      if (! ((*info->callbacks->undefined_symbol)
 			     (info, h->root.root.string, input_bfd,
 			      input_section,
-			      r_vaddr - input_section->vma)))
+			      r_vaddr - input_section->vma, true)))
 			return false;
 		      relocation = 0;
 		    }
@@ -2266,13 +2266,14 @@
     (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
     alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
     alpha_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, 4,
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
     alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
     alpha_ecoff_swap_scnhdr_in, NULL,
     alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_alpha,
@@ -2398,5 +2399,7 @@
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      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 253ec89..6075d52 100644
--- a/bfd/coff-apollo.c
+++ b/bfd/coff-apollo.c
@@ -105,57 +105,16 @@
 
 #include "coffcode.h"
 
-const bfd_target 
-#ifdef TARGET_SYM
-  TARGET_SYM =
-#else
-  apollocoff_vec =
+#ifndef TARGET_SYM
+#define TARGET_SYM apollocoff_vec
 #endif
-{
-#ifdef TARGET_NAME
-  TARGET_NAME,
-#else
-  "apollo-m68k",			/* name */
+
+#ifndef TARGET_NAME
+#define TARGET_NAME "apollo-m68k"
 #endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
 
-  (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 */
 #ifdef NAMES_HAVE_UNDERSCORE
-  '_',
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, '_', NULL)
 #else
-  0,				/* leading underscore */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, 0, NULL)
 #endif
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p, /* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index d478ce5..2b89b84 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -1,5 +1,5 @@
 /* BFD back-end for ARM COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -47,6 +47,10 @@
 #define SET_INTERWORK_FLAG( abfd, flg )	(coff_data (abfd)->flags = \
 					(coff_data (abfd)->flags & ~ F_INTERWORK) \
 					 | (flg | F_INTERWORK_SET))
+
+#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 */
@@ -89,10 +93,12 @@
   PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
 static struct coff_link_hash_entry * find_arm_glue
   PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
+#ifndef COFF_IMAGE_WITH_PE
 static void record_arm_to_thumb_glue
   PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
 static void record_thumb_to_arm_glue
   PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
+#endif
 static boolean coff_arm_merge_private_bfd_data
   PARAMS ((bfd *, bfd *));
 static boolean coff_arm_print_private_bfd_data
@@ -126,11 +132,11 @@
 		 error_message)
      bfd *abfd;
      arelent *reloc_entry;
-     asymbol *symbol;
+     asymbol *symbol ATTRIBUTE_UNUSED;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   symvalue diff;
   if (output_bfd == (bfd *) NULL)
@@ -193,8 +199,7 @@
 #endif
 
 /* These most certainly belong somewhere else. Just had to get rid of
-   the manifest constants in the code. */
-
+   the manifest constants in the code.  */
 #define ARM_8        0
 #define ARM_16       1
 #define ARM_32       2
@@ -211,9 +216,127 @@
 #define ARM_THUMB12 13
 #define ARM_THUMB23 14
 
+#ifdef ARM_WINCE
+#undef  ARM_32
+#undef  ARM_RVA32
+#undef  ARM_26
+#undef  ARM_THUMB12
+#undef  ARM_26D
+
+#define ARM_32       1
+#define ARM_RVA32    2
+#define ARM_26	     3
+#define ARM_THUMB12  4
+#define ARM_26D      5
+#define ARM_SECTION  14
+#define ARM_SECREL   15
+#endif
+
 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, 
+	0,
+	2, 
+	32,
+	false,
+	0,
+	complain_overflow_bitfield,
+	coff_arm_reloc,
+	"ARM_32",
+        true,
+	0xffffffff,
+	0xffffffff,
+	PCRELOFFSET),
+  HOWTO (ARM_RVA32, 
+	0,
+	2, 
+	32,
+	false,
+	0,
+	complain_overflow_bitfield,
+	coff_arm_reloc,
+	"ARM_RVA32",
+        true,
+	0xffffffff,
+	0xffffffff,
+	PCRELOFFSET),
+  HOWTO (ARM_26,
+	2,
+	2,
+	24,
+	true,
+	0,
+	complain_overflow_signed,
+	aoutarm_fix_pcrel_26 ,
+	"ARM_26",
+	false,
+	0x00ffffff,
+	0x00ffffff, 
+	PCRELOFFSET),
+  HOWTO (ARM_THUMB12,
+	1,
+	1,
+	11,
+	true,
+	0,
+	complain_overflow_signed,
+	coff_thumb_pcrel_12 ,
+	"ARM_THUMB12",
+	false,
+	0x000007ff,
+	0x000007ff, 
+	PCRELOFFSET),
+  HOWTO (ARM_26D,  
+	2, 
+	2,
+	24,
+	false,
+	0,
+	complain_overflow_dont,
+	aoutarm_fix_pcrel_26_done, 
+	"ARM_26D",
+	true,
+	0x00ffffff,
+	0x0,
+	false),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  EMPTY_HOWTO (-1),
+  HOWTO (ARM_SECTION,  
+	0, 
+	1, 
+	16, 
+	false,
+	0,
+	complain_overflow_bitfield,
+	coff_arm_reloc,
+	"ARM_16", 
+	true,
+	0x0000ffff,
+	0x0000ffff, 
+	PCRELOFFSET),
+  HOWTO (ARM_SECREL, 
+	0,
+	2, 
+	32,
+	false,
+	0,
+	complain_overflow_bitfield,
+	coff_arm_reloc,
+	"ARM_32",
+        true,
+	0xffffffff,
+	0xffffffff,
+	PCRELOFFSET),
+#else /* not ARM_WINCE */
   HOWTO(ARM_8,			/* type */
 	0,			/* rightshift */
 	0,			/* size */
@@ -319,7 +442,7 @@
 	0x0,
 	false),
   /* 8 is unused */
-  {-1},
+  EMPTY_HOWTO (-1),
   HOWTO( ARM_NEG16,
 	0,
 	-1,
@@ -397,61 +520,66 @@
 	false,
 	0x07ff07ff,
 	0x07ff07ff, 
-	PCRELOFFSET),
+	PCRELOFFSET)
+#endif /* not ARM_WINCE */
 };
 
+#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
+
 #ifdef COFF_WITH_PE
 /* Return true if this relocation should
    appear in the output .reloc section. */
 
 static boolean
 in_reloc_p (abfd, howto)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      reloc_howto_type * howto;
 {
   return !howto->pc_relative && howto->type != ARM_RVA32;
 }     
 #endif
 
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
-	    (cache_ptr)->howto = aoutarm_std_reloc_howto + (dst)->r_type;
+#define RTYPE2HOWTO(cache_ptr, dst)		\
+  (cache_ptr)->howto =				\
+    (dst)->r_type < NUM_RELOCS			\
+    ? aoutarm_std_reloc_howto + (dst)->r_type	\
+    : NULL
 
 #define coff_rtype_to_howto coff_arm_rtype_to_howto
 
 static reloc_howto_type *
 coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
-     struct coff_link_hash_entry *h;
-     struct internal_syment *sym;
+     struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
+     struct internal_syment *sym ATTRIBUTE_UNUSED;
      bfd_vma *addendp;
 {
-  reloc_howto_type *howto;
+  reloc_howto_type * howto;
 
+  if (rel->r_type >= NUM_RELOCS)
+    return NULL;
+  
   howto = aoutarm_std_reloc_howto + rel->r_type;
 
   if (rel->r_type == ARM_RVA32)
-    {
-      *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
-    }
+    *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
 
   return howto;
-
 }
 /* Used by the assembler. */
 
 static bfd_reloc_status_type
 aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
 			  output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* This is dead simple at present.  */
   return bfd_reloc_ok;
@@ -468,7 +596,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
   bfd_size_type addr = reloc_entry->address;
@@ -528,7 +656,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
      thumb_pcrel_branchtype btype;
 {
   bfd_vma relocation = 0;
@@ -696,7 +824,8 @@
       bfd * abfd;
       bfd_reloc_code_real_type code;
 {
-#define ASTD(i,j)       case i: return &aoutarm_std_reloc_howto[j]
+#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)
       {
@@ -708,6 +837,12 @@
 
   switch (code)
     {
+#ifdef ARM_WINCE
+      ASTD (BFD_RELOC_32,                   ARM_32);
+      ASTD (BFD_RELOC_RVA,                  ARM_RVA32);
+      ASTD (BFD_RELOC_ARM_PCREL_BRANCH,     ARM_26);
+      ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
+#else
       ASTD (BFD_RELOC_8,                    ARM_8);
       ASTD (BFD_RELOC_16,                   ARM_16);
       ASTD (BFD_RELOC_32,                   ARM_32);
@@ -719,6 +854,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      
     default: return (CONST struct reloc_howto_struct *) 0;
     }
 }
@@ -783,7 +919,7 @@
   return & ret->root.root;
 }
 
-static
+static void
 arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
       struct bfd_link_info *info;
       bfd *output_bfd;
@@ -934,8 +1070,6 @@
 static const insn32 a2t2_bx_r12_insn    = 0xe12fff1c;
 static const insn32 a2t3_func_addr_insn = 0x00000001;
 
-#define A2T3_OFFSET 8
-
 /*
    Thumb->ARM:				Thumb->(non-interworking aware) ARM
 
@@ -959,8 +1093,6 @@
 static const insn16 t2a2_noop_insn  = 0x46c0;
 static const insn32 t2a3_b_insn     = 0xea000000;
 
-#define T2A3_OFFSET 8
-
 static const insn16 t2a1_push_insn  = 0xb540;
 static const insn16 t2a2_ldr_insn   = 0x4e03;
 static const insn16 t2a3_mov_insn   = 0x46fe;
@@ -1099,6 +1231,13 @@
           howto = &fake_arm26_reloc;
         }
 
+#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. */
+      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,
@@ -1211,7 +1350,8 @@
 				      s->contents + my_offset + 8);
 
                           if (info->base_file)
-                            arm_emit_base_file_entry (info, output_bfd, s, A2T3_OFFSET);
+                            arm_emit_base_file_entry (info, output_bfd, s, 
+                                                            my_offset + 8);
 
 			}
 
@@ -1236,11 +1376,11 @@
 		      
 		      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)
                 {
@@ -1319,6 +1459,9 @@
 			      /* 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);
+
+                              if (info->base_file)
+                                arm_emit_base_file_entry (info, output_bfd, s, my_offset + 16);
 			    }
 			  else
 			    {
@@ -1341,8 +1484,6 @@
 					  t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
 					  s->contents + my_offset + 4);
 
-                              if (info->base_file)
-                                arm_emit_base_file_entry (info, output_bfd, s, T2A3_OFFSET);
 			    }
 			}
 
@@ -1365,12 +1506,10 @@
 				  contents + rel->r_vaddr
 				  - input_section->vma);
 		      
-                      if (info->base_file)
-                        arm_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
-
 		      done = 1;
                     }
                 }
+#endif
             }
 	  
           /* If the relocation type and destination symbol does not
@@ -1396,7 +1535,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
@@ -1411,6 +1550,7 @@
 #if 1 /* THUMBEXTENSION */
       if (done)
 	rstat = bfd_reloc_ok;
+#ifndef ARM_WINCE
       /* Only perform this fix during the final link, not a relocatable link.  nickc@cygnus.com  */
       else if (! info->relocateable
 	       && howto->type == ARM_THUMB23)
@@ -1525,6 +1665,7 @@
 	      rstat = overflow ? bfd_reloc_overflow : bfd_reloc_ok;
             }
         }
+#endif
       else
 #endif /* THUMBEXTENSION */
         rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
@@ -1537,7 +1678,7 @@
 	 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  */
       if (! info->relocateable
-	  && rel->r_type == ARM_32)
+	  && (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
 	{
 	  /* Determine if we need to set the bottom bit of a relocated address
 	     because the address is the address of a Thumb code symbol.  */
@@ -1610,7 +1751,8 @@
   return true;
 }
 
-#ifndef COFF_WITH_PE
+#ifndef COFF_IMAGE_WITH_PE
+
 boolean
 bfd_arm_allocate_interworking_sections (info) 
      struct bfd_link_info * info;
@@ -1797,6 +1939,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/
    {armcoff/pe}.em  */
+
 boolean
 bfd_arm_get_bfd_for_interworking (abfd, info)
      bfd * 		    abfd;
@@ -1822,7 +1965,7 @@
   
   if (sec == NULL) 
     {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
       
       sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
       
@@ -1836,7 +1979,7 @@
 
   if (sec == NULL) 
     {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
       
       sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
       
@@ -1911,6 +2054,14 @@
 	  if (symndx == -1)
 	    continue;
 
+	  /* If the index is outside of the range of our table, something has gone wrong.  */
+	  if (symndx >= obj_conv_table_size (abfd))
+	    {
+	      _bfd_error_handler (_("%s: illegal symbol index in reloc: %d"),
+				  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
@@ -1929,6 +2080,7 @@
 		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
 		 for ARM_THUMB9 and ARM_THUMB12 as well.  We need to look
@@ -1949,6 +2101,7 @@
 		  ;
 		}
 	      break;
+#endif
 	      
 	    default:
 	      break;
@@ -1959,7 +2112,7 @@
   return true;
 }
 
-#endif /* ! COFF_WITH_PE */
+#endif /* ! defined (COFF_IMAGE_WITH_PE) */
 
 #define coff_bfd_reloc_type_lookup 		coff_arm_reloc_type_lookup
 #define coff_relocate_section 			coff_arm_relocate_section
@@ -1979,8 +2132,8 @@
 
 static boolean
 coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
-     bfd *obfd;
-     struct bfd_link_info *info;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      bfd *ibfd;
      asection *sec;
      struct internal_reloc *irel;
@@ -2183,7 +2336,7 @@
   if (APCS_SET (abfd)
       && (   (APCS_26_FLAG    (abfd) != flag)
 	  || (APCS_FLOAT_FLAG (abfd) != (flags & F_APCS_FLOAT))
-	  || (PIC_FLAG        (abfd) != (flags & F_PIC_INT ? F_PIC : 0))
+	  || (PIC_FLAG        (abfd) != (flags & F_PIC))
 	  ))
     return false;
 
@@ -2289,21 +2442,16 @@
 #define USER_LABEL_PREFIX "_"
 #endif
 
+/* Like _bfd_coff_is_local_label_name, but
+   a) test against USER_LABEL_PREFIX, to avoid stripping labels known to be
+      non-local.
+   b) Allow other prefixes than ".", e.g. an empty prefix would cause all
+      labels of the form Lxxx to be stripped.  */
 static boolean
 coff_arm_is_local_label_name (abfd, name)
-     bfd *        abfd;
+     bfd *        abfd ATTRIBUTE_UNUSED;
      const char * name;
 {
-#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 (LOCAL_LABEL_PREFIX[0] != 0)
-    {
-      if (strncmp (name, LOCAL_LABEL_PREFIX, strlen (LOCAL_LABEL_PREFIX)) == 0)
-	return true;
-    }
-#endif
 #ifdef USER_LABEL_PREFIX
   if (USER_LABEL_PREFIX[0] != 0)
     {
@@ -2311,18 +2459,24 @@
 	return false;
     }
 #endif
+
+#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. */
   
-  /* devo/gcc/config/dbxcoff.h defines ASM_OUTPUT_SOURCE_LINE to generate
-     local line numbers as .LM<number>, so treat these as local.  */
-  
-  switch (name[0])
+  if (LOCAL_LABEL_PREFIX[0] != 0)
     {
-    case 'L': return true;
-    case '.': return (name[1] == 'L' && name[2] == 'M') ? true : false;
-    default:  return false;     /* Cannot make our minds up - default to
-				   false so that it will not be stripped
-				   by accident.  */ 
+      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
@@ -2344,7 +2498,7 @@
 
 static boolean
 coff_arm_final_link_postscript (abfd, pfinfo)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      struct coff_final_link_info * pfinfo;
 {
   struct coff_arm_link_hash_table * globals;
@@ -2364,194 +2518,35 @@
   return true;
 }
 
-#if 0
-#define coff_SWAP_sym_in  arm_bfd_coff_swap_sym_in
-
-static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-
-/* Sepcial version of symbol swapper, used to grab a bfd
-   onto which the glue sections can be attached.  */
-static void
-arm_bfd_coff_swap_sym_in (abfd, ext1, in1)
-     bfd * abfd;
-     PTR   ext1;
-     PTR   in1;
-{
-  flagword flags;
-  register asection * s;
-
-  /* Do the normal swap in.  */
-  coff_swap_sym_in (abfd, ext1, in1);
-
-  if (bfd_of_glue_owner != NULL) /* we already have a toc, so go home */
-    return;
-
-  /* Save the bfd for later allocation.  */
-  bfd_of_glue_owner = abfd;
-
-  s = bfd_get_section_by_name (bfd_of_glue_owner , 
-			       ARM2THUMB_GLUE_SECTION_NAME);
-
-  if (s == NULL) 
-    {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
-      
-      s = bfd_make_section (bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
-
-      if (s == NULL
-	  || !bfd_set_section_flags (bfd_of_glue_owner, s, flags)
-	  || !bfd_set_section_alignment (bfd_of_glue_owner, s, 2))
-	{
-	  /* FIXME: set appropriate bfd error */
-	  abort();
-	}
-    }
-
-  s = bfd_get_section_by_name (bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-
-  if (s == NULL) 
-    {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
-      
-      s = bfd_make_section (bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-      
-      if (s == NULL
-	  || !bfd_set_section_flags (bfd_of_glue_owner, s, flags)
-	  || !bfd_set_section_alignment (bfd_of_glue_owner, s, 2))
-	{
-	  /* FIXME: set appropriate bfd error krk@cygnus.com */
-	  abort();
-	}
-    }
-  
-  return;
-}
-#endif
-
 #include "coffcode.h"
 
-const bfd_target
-#ifdef TARGET_LITTLE_SYM
-TARGET_LITTLE_SYM =
-#else
-armcoff_little_vec =
+#ifndef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM armcoff_little_vec
 #endif
-{
-#ifdef TARGET_LITTLE_NAME
-  TARGET_LITTLE_NAME,
-#else
-  "coff-arm-little",
+#ifndef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "coff-arm-little"
 #endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |		/* 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
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+#ifndef TARGET_BIG_SYM
+#define TARGET_BIG_SYM armcoff_big_vec
+#endif
+#ifndef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "coff-arm-big"
 #endif
 
-#ifdef TARGET_UNDERSCORE
-  TARGET_UNDERSCORE,		/* leading underscore */
-#else
-  0,				/* leading underscore */
-#endif
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-  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 */
-
-/* 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 */
-       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),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  (PTR) & bfd_coff_std_swap_table,
-};
-
-const bfd_target
-#ifdef TARGET_BIG_SYM
-TARGET_BIG_SYM =
-#else
-armcoff_big_vec =
-#endif
-{
-#ifdef TARGET_BIG_NAME
-  TARGET_BIG_NAME,
-#else
-  "coff-arm-big",
-#endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |		/* 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
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+#ifndef TARGET_UNDERSCORE
+#define TARGET_UNDERSCORE 0
 #endif
 
-#ifdef TARGET_UNDERSCORE
-  TARGET_UNDERSCORE,		/* leading underscore */
+#ifdef COFF_WITH_PE
+#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
 #else
-  0,				/* leading underscore */
+#define EXTRA_S_FLAGS 0
 #endif
-  '/',				/* ar_pad_char */
-  15,				/* 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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+/* Forward declaration for use initialising alternative_target field.  */
+extern const bfd_target TARGET_BIG_SYM ;
 
-/* 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 */
-       bfd_false},
-    {bfd_false, coff_write_object_contents, /* bfd_write_contents */
-       _bfd_write_archive_contents, bfd_false},
+/* Target vectors.  */
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM)
+CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM)
 
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  (PTR) & bfd_coff_std_swap_table,
-};
diff --git a/bfd/coff-go32.c b/bfd/coff-go32.c
index be4adb2..a6b28e1 100644
--- a/bfd/coff-go32.c
+++ b/bfd/coff-go32.c
@@ -1,5 +1,5 @@
-/* BFD back-end for Intel 386 COFF files (go32 variant).
-   Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+/* BFD back-end for Intel 386 COFF files (DJGPP variant).
+   Copyright 1990, 91, 92, 93, 94, 1999, 2000 Free Software Foundation, Inc.
    Written by DJ Delorie.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -21,5 +21,19 @@
 #define TARGET_SYM		go32coff_vec
 #define TARGET_NAME		"coff-go32"
 #define TARGET_UNDERSCORE	'_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.d"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.t"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.r"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }
 
 #include "coff-i386.c"
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 74a4ec3..3d54f20 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Hitachi H8/300 COFF binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -203,13 +204,13 @@
 static bfd_reloc_status_type
 special (abfd, reloc_entry, symbol, data, input_section, output_bfd,
 		 error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd == (bfd *) NULL)
     return bfd_reloc_continue;
@@ -795,7 +796,7 @@
       value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Sanity check.  */
-      if (value < 0x8000 || value > 0xff8000)
+      if (value <= 0x7fff || value >= 0xff8000)
 	{
 	  /* Insert the 16bit value into the proper location.  */
 	  bfd_put_16 (abfd, value, data + dst_address);
@@ -1060,13 +1061,13 @@
 	symbol = *(reloc->sym_ptr_ptr);
 	value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 	if (symbol == bfd_abs_section_ptr->symbol
-	    || (value >= 0 && value <= 0xff))
+	    || value <= 0xff)
 	  {
 	    /* This should be handled in a manner very similar to
 	       R_RELBYTES.   If the value is in range, then just slam
 	       the value into the right location.  Else trigger a
 	       reloc overflow callback.  */
-	    if (value >= 0 && value <= 0xff)
+	    if (value <= 0xff)
 	      {
 		bfd_put_8 (abfd, value, data + dst_address);
 		dst_address += 1;
@@ -1345,44 +1346,4 @@
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
 
-
-const bfd_target h8300coff_vec =
-{
-  "coff-h8300",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */
-  '_',				/* leading char */
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p,	/* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+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 91109ea..22eeaa5 100644
--- a/bfd/coff-h8500.c
+++ b/bfd/coff-h8500.c
@@ -311,44 +311,4 @@
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-const bfd_target h8500coff_vec =
-{
-  "coff-h8500",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (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 */
-  '_',				/* leading symbol underscore */
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p,	/* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (h8500coff_vec, "coff-h8500", 0, 0, '_', NULL)
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index 7898cc1..84d4d14 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 386 COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -37,13 +37,14 @@
 
 #include "libcoff.h"
 
-static bfd_reloc_status_type coff_i386_reloc 
+static bfd_reloc_status_type coff_i386_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static reloc_howto_type *coff_i386_rtype_to_howto
   PARAMS ((bfd *, asection *, struct internal_reloc *,
 	   struct coff_link_hash_entry *, struct internal_syment *,
-
 	   bfd_vma *));
+static reloc_howto_type *coff_i386_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
 
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
 /* The page size is a guess based on ELF.  */
@@ -66,9 +67,9 @@
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   symvalue diff;
 
@@ -106,8 +107,8 @@
 
 #ifdef COFF_WITH_PE
   /* FIXME: How should this case be handled?  */
-  if (reloc_entry->howto->type == R_IMAGEBASE && diff != 0)
-    abort ();
+  if (reloc_entry->howto->type == R_IMAGEBASE)
+    diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
 #endif
 
 #define DOIT(x) \
@@ -154,140 +155,150 @@
 }
 
 #ifdef COFF_WITH_PE
-/* Return true if this relocation should
-   appear in the output .reloc section. */
 
-static boolean in_reloc_p(abfd, howto)
-     bfd * abfd;
+/* 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;
      reloc_howto_type *howto;
 {
   return ! howto->pc_relative && howto->type != R_IMAGEBASE;
-}     
-#endif
+}
+
+#endif /* COFF_WITH_PE */
 
 #ifndef PCRELOFFSET
 #define PCRELOFFSET false
 #endif
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
-  {0},
-  {1},
-  {2},
-  {3},
-  {4},
-  {5},
-  HOWTO (R_DIR32,               /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  EMPTY_HOWTO (0),
+  EMPTY_HOWTO (1),
+  EMPTY_HOWTO (2),
+  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 */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i386_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 */                               
+	 coff_i386_reloc,	/* special_function */
+	 "dir32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+  /* PE IMAGE_REL_I386_DIR32NB relocation (7).	*/
+  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_i386_reloc,       /* special_function */                     
-	 "rva32",	           /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
-	 false),                /* pcrel_offset */
-  {010},
-  {011},
-  {012},
-  {013},
-  {014},
-  {015},
-  {016},
-  HOWTO (R_RELBYTE,		/* type */                                 
-	 0,			/* rightshift */                           
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 8,			/* bitsize */                   
-	 false,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+	 coff_i386_reloc,	/* special_function */
+	 "rva32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  EMPTY_HOWTO (010),
+  EMPTY_HOWTO (011),
+  EMPTY_HOWTO (012),
+  EMPTY_HOWTO (013),
+  EMPTY_HOWTO (014),
+  EMPTY_HOWTO (015),
+  EMPTY_HOWTO (016),
+  /* Byte relocation (017).  */
+  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_i386_reloc,	/* special_function */                     
-	 "8",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x000000ff,		/* src_mask */                             
-	 0x000000ff,		/* dst_mask */                             
+	 coff_i386_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 */                               
+  /* 16-bit word relocation (020).  */
+  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_i386_reloc,	/* special_function */                     
-	 "16",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x0000ffff,		/* src_mask */                             
-	 0x0000ffff,		/* dst_mask */                             
+	 coff_i386_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 */                               
+  /* 32-bit longword relocation (021).	*/
+  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_i386_reloc,	/* special_function */                     
-	 "32",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0xffffffff,		/* src_mask */                             
-	 0xffffffff,		/* dst_mask */                             
+	 coff_i386_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 */                               
+  /* Byte PC relative relocation (022).	 */
+  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_i386_reloc,	/* special_function */                     
-	 "DISP8",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x000000ff,		/* src_mask */                             
-	 0x000000ff,		/* dst_mask */                             
+	 coff_i386_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 */                               
+  /* 16-bit word PC relative relocation (023).	*/
+  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_i386_reloc,	/* special_function */                     
-	 "DISP16",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x0000ffff,		/* src_mask */                             
-	 0x0000ffff,		/* dst_mask */                             
+	 coff_i386_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 */                               
+  /* 32-bit longword PC relative relocation (024).  */
+  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_i386_reloc,	/* special_function */                     
-	 "DISP32",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0xffffffff,		/* src_mask */                             
-	 0xffffffff,		/* dst_mask */                             
+	 coff_i386_reloc,	/* special_function */
+	 "DISP32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
 	 PCRELOFFSET)		/* pcrel_offset */
 };
 
@@ -297,8 +308,11 @@
 #define BADMAG(x) I386BADMAG(x)
 #define I386 1			/* Customize coffcode.h */
 
-#define RTYPE2HOWTO(cache_ptr, dst) \
-	    (cache_ptr)->howto = howto_table + (dst)->r_type;
+#define RTYPE2HOWTO(cache_ptr, dst)					\
+  ((cache_ptr)->howto =							\
+   ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0])	\
+    ? howto_table + (dst)->r_type					\
+    : NULL))
 
 /* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
    library.  On some other COFF targets STYP_BSS is normally
@@ -385,19 +399,25 @@
 
 static reloc_howto_type *
 coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
      struct coff_link_hash_entry *h;
      struct internal_syment *sym;
      bfd_vma *addendp;
 {
-
   reloc_howto_type *howto;
 
+  if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0]))
+    {
+      bfd_set_error (bfd_error_bad_value);
+      return NULL;
+    }
+
   howto = howto_table + rel->r_type;
 
 #ifdef COFF_WITH_PE
+  /* Cancel out code in _bfd_coff_generic_relocate_section.  */
   *addendp = 0;
 #endif
 
@@ -411,7 +431,7 @@
 	 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);
 
 #ifndef COFF_WITH_PE
@@ -430,7 +450,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;
 #endif
 
@@ -458,23 +478,29 @@
   return howto;
 }
 
-
 #define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
 
-
 static reloc_howto_type *
 coff_i386_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
     {
     case BFD_RELOC_RVA:
-      return howto_table +R_IMAGEBASE;
+      return howto_table + R_IMAGEBASE;
     case BFD_RELOC_32:
       return howto_table + R_DIR32;
     case BFD_RELOC_32_PCREL:
       return howto_table + R_PCRLONG;
+    case BFD_RELOC_16:
+      return howto_table + R_RELWORD;
+    case BFD_RELOC_16_PCREL:
+      return howto_table + R_PCRWORD;
+    case BFD_RELOC_8:
+      return howto_table + R_RELBYTE;
+    case BFD_RELOC_8_PCREL:
+      return howto_table + R_PCRBYTE;
     default:
       BFD_FAIL ();
       return 0;
@@ -508,69 +534,6 @@
 
 #include "coffcode.h"
 
-static const bfd_target *
-i3coff_object_p (abfd)
-     bfd *abfd;
-{
-#ifdef COFF_IMAGE_WITH_PE
-  /* We need to hack badly to handle a PE image correctly.  In PE
-     images created by the GNU linker, the offset to the COFF header
-     is always the size.  However, this is not the case in images
-     generated by other PE linkers.  The PE format stores a four byte
-     offset to the PE signature just before the COFF header at
-     location 0x3c of the file.  We pick up that offset, verify that
-     the PE signature is there, and then set ourselves up to read in
-     the COFF header.  */
-  {
-    bfd_byte ext_offset[4];
-    file_ptr offset;
-    bfd_byte ext_signature[4];
-    unsigned long signature;
-
-    if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
-	|| bfd_read (ext_offset, 1, 4, abfd) != 4)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-    offset = bfd_h_get_32 (abfd, ext_offset);
-    if (bfd_seek (abfd, offset, SEEK_SET) != 0
-	|| bfd_read (ext_signature, 1, 4, abfd) != 4)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-    signature = bfd_h_get_32 (abfd, ext_signature);
-
-    if (signature != 0x4550)
-      {
-	bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-
-    /* Here is the hack.  coff_object_p wants to read filhsz bytes to
-       pick up the COFF header.  We adjust so that that will work.  20
-       is the size of the i386 COFF filehdr.  */
-
-    if (bfd_seek (abfd,
-		  (bfd_tell (abfd)
-		   - bfd_coff_filhsz (abfd)
-		   + 20),
-		  SEEK_SET)
-	!= 0)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-  }
-#endif
-
-  return coff_object_p (abfd);
-}
-
 const bfd_target
 #ifdef TARGET_SYM
   TARGET_SYM =
@@ -591,14 +554,11 @@
    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 */
-   | SEC_CODE | SEC_DATA),
-#else
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_CODE | SEC_DATA
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+#ifdef COFF_WITH_PE
+   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES
 #endif
+   | SEC_CODE | SEC_DATA),
 
 #ifdef TARGET_UNDERSCORE
   TARGET_UNDERSCORE,		/* leading underscore */
@@ -616,8 +576,8 @@
      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. */
-    {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
-       bfd_generic_archive_p, i3coff_object_p},
+    {_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 */
        bfd_false},
     {bfd_false, coff_write_object_contents, /* bfd_write_contents */
@@ -633,5 +593,7 @@
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  NULL,
+
+  COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c
index 929fa42..ab3bb5f 100644
--- a/bfd/coff-i860.c
+++ b/bfd/coff-i860.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 860 COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
    Created mostly by substituting "860" for "386" in coff-i386.c
    Harry Dolan <dolan@ssd.intel.com>, October 1995
 
@@ -57,9 +57,9 @@
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   symvalue diff;
 
@@ -141,12 +141,12 @@
 
 static reloc_howto_type howto_table[] = 
 {
-  {0},
-  {1},
-  {2},
-  {3},
-  {4},
-  {5},
+  EMPTY_HOWTO (0),
+  EMPTY_HOWTO (1),
+  EMPTY_HOWTO (2),
+  EMPTY_HOWTO (3),
+  EMPTY_HOWTO (4),
+  EMPTY_HOWTO (5),
   HOWTO (R_DIR32,               /* type */                                 
 	 0,	                /* rightshift */                           
 	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
@@ -174,13 +174,13 @@
 	 0xffffffff,            /* src_mask */                             
 	 0xffffffff,            /* dst_mask */                             
 	 false),                /* pcrel_offset */
-  {010},
-  {011},
-  {012},
-  {013},
-  {014},
-  {015},
-  {016},
+  EMPTY_HOWTO (010),
+  EMPTY_HOWTO (011),
+  EMPTY_HOWTO (012),
+  EMPTY_HOWTO (013),
+  EMPTY_HOWTO (014),
+  EMPTY_HOWTO (015),
+  EMPTY_HOWTO (016),
   HOWTO (R_RELBYTE,		/* type */                                 
 	 0,			/* rightshift */                           
 	 0,			/* size (0 = byte, 1 = short, 2 = long) */ 
@@ -313,7 +313,7 @@
 
 static reloc_howto_type *
 coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
      struct coff_link_hash_entry *h;
@@ -418,5 +418,7 @@
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  NULL,
+  
+  COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c
index 25455d9..4c37fab 100644
--- a/bfd/coff-i960.c
+++ b/bfd/coff-i960.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Intel 960 COFF files.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -60,7 +61,7 @@
 
 static boolean
 coff_i960_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return (name[0] == 'L'
@@ -106,7 +107,7 @@
      asymbol *symbol_in;
      PTR data;
      asection *input_section;
-     bfd *ignore_bfd;
+     bfd *ignore_bfd ATTRIBUTE_UNUSED;
      char **error_message;
 {
   /* This item has already been relocated correctly, but we may be
@@ -193,10 +194,10 @@
      bfd *abfd;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   asection *osec;
 
@@ -277,7 +278,7 @@
 
 static reloc_howto_type *
 coff_i960_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -368,7 +369,7 @@
 static boolean
 coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
 			    contents, relocs, syms, sections)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      bfd *input_bfd;
      asection *input_section;
@@ -457,7 +458,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
@@ -580,10 +581,10 @@
 /*ARGSUSED*/
 static boolean
 coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
-     bfd *obfd;
-     struct bfd_link_info *info;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      bfd *ibfd;
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
      struct internal_reloc *irel;
      boolean *adjustedp;
 {
@@ -615,49 +616,9 @@
 
 #include "coffcode.h"
 
-const bfd_target icoff_little_vec =
-{
-  "coff-Intel-little",		/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little */
+extern const bfd_target icoff_big_vec;
 
-  (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 */
-  '_',				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-  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},
- {bfd_false, coff_mkobject,	/* bfd_set_format */
-   _bfd_generic_mkarchive, 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),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
+CREATE_LITTLE_COFF_TARGET_VEC (icoff_little_vec, "coff-Intel-little", 0, 0, '_', & icoff_big_vec)
 
 const bfd_target icoff_big_vec =
 {
@@ -699,5 +660,7 @@
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  & icoff_little_vec,
+  
+  COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c
index 5a06b17..d7138c0 100644
--- a/bfd/coff-m68k.c
+++ b/bfd/coff-m68k.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Motorola 68000 COFF binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -174,7 +175,7 @@
 #endif
 reloc_howto_type *
 m68k_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -215,11 +216,11 @@
 /*ARGSUSED*/
 static reloc_howto_type *
 m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
-     struct coff_link_hash_entry *h;
-     struct internal_syment *sym;
+     struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
+     struct internal_syment *sym ATTRIBUTE_UNUSED;
      bfd_vma *addendp;
 {
   arelent relent;
@@ -257,9 +258,9 @@
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   symvalue diff;
 
@@ -376,7 +377,7 @@
 /*ARGSUSED*/
 static reloc_howto_type *
 m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
      struct coff_link_hash_entry *h;
@@ -433,48 +434,8 @@
 #define TARGET_NAME "coff-m68k"
 #endif
 
-const bfd_target TARGET_SYM =
-{
-  TARGET_NAME,
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
 #ifdef NAMES_HAVE_UNDERSCORE
-  '_',
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
 #else
-  0,				/* leading underscore */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, 0, NULL)
 #endif
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p, /* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
-};
diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c
index 8da0b05..f78377a 100644
--- a/bfd/coff-m88k.c
+++ b/bfd/coff-m88k.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files.
-   Copyright 1990, 91, 92, 93, 94, 95, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -44,7 +45,7 @@
 
 static boolean
 m88k_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return name[0] == '@';
@@ -59,7 +60,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   reloc_howto_type *howto = reloc_entry->howto;
 
@@ -287,44 +288,4 @@
 
 #undef coff_write_armap
 
-const bfd_target m88kbcs_vec =
-{
-  "coff-m88kbcs",		/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (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 */
-  '_',				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p, /* bfd_check_format */
-       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 */
-       _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (m88kbcs_vec, "coff-m88kbcs", 0, 0, '_', NULL)
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index d787096..19cbea1 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -1,6 +1,5 @@
-/* BFD back-end for Motorolla MCore COFF/PE
-   Copyright 1999
-   Free Software Foundation, Inc.
+/* BFD back-end for Motorola MCore COFF/PE
+   Copyright (C) 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -45,8 +44,6 @@
   PARAMS ((bfd *));
 static bfd_reloc_status_type        mcore_coff_unsupported_reloc 
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean                      in_reloc_p
-  PARAMS ((bfd *, reloc_howto_type *));
 static boolean                      coff_mcore_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
 	   struct internal_reloc *, struct internal_syment *, asection **));
@@ -55,10 +52,6 @@
 static reloc_howto_type *           coff_mcore_rtype_to_howto
   PARAMS ((bfd *, asection *, struct internal_reloc *,
 	   struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
-static const bfd_target *           pe_object_p
-  PARAMS ((bfd *));
-
-
 
 /* The NT loader points the toc register to &toc + 32768, in order to
    use the complete range of a 16-bit displacement. We have to adjust
@@ -67,7 +60,7 @@
 #define TOC_SECTION_NAME ".private.toc"
 
 /* The main body of code is in coffcode.h.  */
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
 
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
    from smaller values.  Start with zero, widen, *then* decrement.  */
@@ -84,7 +77,7 @@
 	 false,	                 /* pc_relative */                          
 	 0,	                 /* bitpos */                               
 	 complain_overflow_dont, /* dont complain_on_overflow */
-	 0,		         /* special_function */                     
+	 NULL,		         /* special_function */                     
 	 "ABSOLUTE",             /* name */
 	 false,	                 /* partial_inplace */                      
 	 0x00,	 	         /* src_mask */                             
@@ -98,7 +91,7 @@
 	 false,	                /* pc_relative */                          
 	 0,	                /* bitpos */                               
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 NULL,		        /* special_function */                     
 	 "ADDR32",              /* name */
 	 true,	                /* partial_inplace */                      
 	 0xffffffff,            /* src_mask */                             
@@ -114,7 +107,7 @@
 	 true,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 mcore_coff_unsupported_reloc,	/* special_function */
+	 mcore_coff_unsupported_reloc, /* special_function */
 	 "IMM8BY4",             /* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
@@ -146,7 +139,7 @@
 	 true,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 mcore_coff_unsupported_reloc,/* special_function */
+	 mcore_coff_unsupported_reloc, /* special_function */
 	 "IMM4BY2",              /* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
@@ -187,6 +180,20 @@
 	 false,			/* partial_inplace */
 	 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) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 NULL,                  /* special_function */
+	 "MCORE_RVA",           /* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
 	 true)			/* pcrel_offset */
 };
 
@@ -237,17 +244,36 @@
   return & ret->root.root;
 }
 
+/* Add an entry to the base file.  */
+static void
+mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
+      struct bfd_link_info * info;
+      bfd *                  output_bfd;
+      asection *             input_section;
+      bfd_vma                reloc_offset;
+{
+  bfd_vma addr = reloc_offset
+                 - 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;
+  
+  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)
      bfd * abfd;
      arelent * reloc_entry;
-     asymbol * symbol;
-     PTR data;
-     asection * input_section;
-     bfd * output_bfd;
-     char ** error_message;
+     asymbol * symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection * input_section ATTRIBUTE_UNUSED;
+     bfd * output_bfd ATTRIBUTE_UNUSED;
+     char ** error_message ATTRIBUTE_UNUSED;
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
   
@@ -266,7 +292,7 @@
 
 static reloc_howto_type *
 mcore_coff_reloc_type_lookup (abfd, code)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -277,6 +303,7 @@
       HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM4BY2,      IMAGE_REL_MCORE_PCREL_IMM4BY2);
       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: 
       return NULL;
     }
@@ -290,10 +317,10 @@
 
 static reloc_howto_type *
 coff_mcore_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      asection * sec;
      struct internal_reloc * rel;
-     struct coff_link_hash_entry * h;
+     struct coff_link_hash_entry * h ATTRIBUTE_UNUSED;
      struct internal_syment * sym;
      bfd_vma * addendp;
 {
@@ -304,8 +331,11 @@
     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;
   
-  if (howto->pc_relative)
+  else if (howto->pc_relative)
     {
       * addendp = sec->vma - 2; /* XXX guess - is this right ? */
       
@@ -323,16 +353,18 @@
   
   return howto;
 }
-
-/* Return true if this relocation should
-   appear in the output .reloc section. */
-static boolean in_reloc_p (abfd, howto)
-     bfd * abfd;
+
+/* Return true if this relocation should appear in the output .reloc section.
+   This function is referenced in pe_mkobject in peicode.h.  */
+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_MCORE_RVA;
 }     
 
+
 /* The reloc processing routine for the optimized COFF linker.  */
 static boolean
 coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
@@ -357,8 +389,19 @@
   if (info->relocateable)
     return true;
   
-  BFD_ASSERT (input_bfd->xvec->byteorder
-	      == output_bfd->xvec->byteorder);
+  /* Check if we have the same endianess */
+  if (   input_bfd->xvec->byteorder != output_bfd->xvec->byteorder
+      && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
+    {
+      (*_bfd_error_handler)
+	(_("%s: compiled for a %s endian system and target is %s endian.\n"),
+	 bfd_get_filename (input_bfd),
+         bfd_big_endian (input_bfd) ? "big" : "little",
+         bfd_big_endian (output_bfd) ? "big" : "little");
+
+      bfd_set_error (bfd_error_wrong_format);
+      return false;
+    }
 
   hihalf = false;
   hihalf_val = 0;
@@ -368,8 +411,6 @@
   
   for (; rel < relend; rel++)
     {
-      asection *                     toc_section = NULL;
-      bfd_vma                        relocation;
       long                           symndx;
       struct internal_syment *       sym;
       bfd_vma                        val;
@@ -395,6 +436,8 @@
 	  sym = syms + symndx;
 	}
 
+      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 +488,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	  
@@ -481,10 +524,25 @@
 	case IMAGE_REL_MCORE_PCREL_32:
 	case IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2:
 	case IMAGE_REL_MCORE_ADDR32:
+	  /* 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,
+	     input_section, contents, rel->r_vaddr - input_section->vma,
+	     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:
@@ -520,184 +578,9 @@
 
 #include "coffcode.h"
 
-static const bfd_target *
-pe_object_p (abfd)
-     bfd * abfd;
-{
-#ifdef COFF_IMAGE_WITH_PE
-  /* We need to hack badly to handle a PE image correctly.  In PE
-     images created by the GNU linker, the offset to the COFF header
-     is always the size.  However, this is not the case in images
-     generated by other PE linkers.  The PE format stores a four byte
-     offset to the PE signature just before the COFF header at
-     location 0x3c of the file.  We pick up that offset, verify that
-     the PE signature is there, and then set ourselves up to read in
-     the COFF header.  */
-  {
-    bfd_byte ext_offset[4];
-    file_ptr offset;
-    bfd_byte ext_signature[4];
-    unsigned long signature;
+/* Forward declaration to initialise alterbative_target field.  */
+extern const bfd_target TARGET_LITTLE_SYM;
 
-    if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
-	|| bfd_read (ext_offset, 1, 4, abfd) != 4)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-    
-    offset = bfd_h_get_32 (abfd, ext_offset);
-    
-    if (bfd_seek (abfd, offset, SEEK_SET) != 0
-	|| bfd_read (ext_signature, 1, 4, abfd) != 4)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	
-	return NULL;
-      }
-    
-    signature = bfd_h_get_32 (abfd, ext_signature);
-
-    if (signature != 0x4550)
-      {
-	bfd_set_error (bfd_error_wrong_format);
-	return NULL;
-      }
-
-    /* Here is the hack.  coff_object_p wants to read filhsz bytes to
-       pick up the COFF header.  We adjust so that that will work.  20
-       is the size of the mips COFF filehdr.  */
-    if (bfd_seek (abfd, (bfd_tell (abfd) - bfd_coff_filhsz (abfd) + 20),
-		  SEEK_SET) != 0)
-      {
-	if (bfd_get_error () != bfd_error_system_call)
-	  bfd_set_error (bfd_error_wrong_format);
-	
-	return NULL;
-      }
-  }
-#endif
-
-  return coff_object_p (abfd);
-}
-
 /* The transfer vectors that lead the outside world to all of the above. */
-
-const bfd_target
-TARGET_BIG_SYM =
-{
-  TARGET_BIG_NAME,
-  bfd_target_coff_flavour,	
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-
-  0,				/* leading char */
-  '/',				/* ar_pad_char */
-  15,				/* 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_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,
-    pe_object_p, 		/* bfd_check_format */
-    bfd_generic_archive_p, 	/* _bfd_dummy_target */
-    pe_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),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
-const bfd_target
-TARGET_LITTLE_SYM =
-{
-  TARGET_LITTLE_NAME,
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-  
-  0,				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-  
-  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 */
-
-/* Note that we allow an object file to be treated as a core file as well. */
-  {
-    _bfd_dummy_target,
-    pe_object_p, 		/* bfd_check_format */
-    bfd_generic_archive_p,
-    pe_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),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
+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)
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 051eb86..bb4b15e 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1,5 +1,5 @@
 /* BFD back-end for MIPS Extended-Coff files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -273,10 +273,10 @@
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  { 8 },
-  { 9 },
-  { 10 },
-  { 11 },
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9),
+  EMPTY_HOWTO (10),
+  EMPTY_HOWTO (11),
 
   /* This reloc is a Cygnus extension used when generating position
      independent code for embedded systems.  It represents a 16 bit PC
@@ -334,13 +334,13 @@
 	 0xffff,		/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  { 15 },
-  { 16 },
-  { 17 },
-  { 18 },
-  { 19 },
-  { 20 },
-  { 21 },
+  EMPTY_HOWTO (15),
+  EMPTY_HOWTO (16),
+  EMPTY_HOWTO (17),
+  EMPTY_HOWTO (18),
+  EMPTY_HOWTO (19),
+  EMPTY_HOWTO (20),
+  EMPTY_HOWTO (21),
 
   /* This reloc is a Cygnus extension used when generating position
      independent code for embedded systems.  It represents an entry in
@@ -569,7 +569,7 @@
 
 static void
 mips_adjust_reloc_out (abfd, rel, intern)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const arelent *rel;
      struct internal_reloc *intern;
 {
@@ -604,13 +604,13 @@
 		    input_section,
 		    output_bfd,
 		    error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0
@@ -651,13 +651,13 @@
 		  input_section,
 		  output_bfd,
 		  error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_reloc_status_type ret;
   bfd_vma relocation;
@@ -933,13 +933,13 @@
 		  input_section,
 		  output_bfd,
 		  error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_reloc_status_type ret;
   bfd_vma relocation;
@@ -1109,13 +1109,13 @@
 		   input_section,
 		   output_bfd,
 		   error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   return bfd_reloc_ok;
 }
@@ -1124,7 +1124,7 @@
 
 static reloc_howto_type *
 mips_bfd_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   int mips_type;
@@ -1781,7 +1781,7 @@
 		  if (! ((*info->callbacks->undefined_symbol)
 			 (info, h->root.root.string, input_bfd,
 			  input_section,
-			  int_rel.r_vaddr - input_section->vma)))
+			  int_rel.r_vaddr - input_section->vma, true)))
 		    return false;
 		  relocation = 0;
 		}
@@ -2329,9 +2329,9 @@
 
 static boolean
 mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      bfd *input_bfd;
-     asection *input_section;
+     asection *input_section ATTRIBUTE_UNUSED;
      struct ecoff_link_hash_entry *h;
      bfd_byte *location;
      bfd_vma address;
@@ -2505,13 +2505,14 @@
     (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
     mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
     mips_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true, false, 4,
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
     mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
     mips_ecoff_swap_scnhdr_in, NULL,
     mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_mips,
@@ -2600,6 +2601,8 @@
 /* GC of sections is not done.  */
 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
 
+extern const bfd_target ecoff_big_vec;
+
 const bfd_target ecoff_little_vec =
 {
   "ecoff-littlemips",		/* name */
@@ -2639,6 +2642,8 @@
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & ecoff_big_vec,
+  
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2680,6 +2685,8 @@
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & ecoff_little_vec,
+  
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2722,5 +2729,7 @@
      BFD_JUMP_TABLE_LINK (_bfd_ecoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) &mips_ecoff_backend_data
 };
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index cf45044..c5e695d 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -1,5 +1,5 @@
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -906,10 +906,10 @@
 static boolean
 ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
      bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
      int sym;
-     enum toc_type toc_kind;
+     enum toc_type toc_kind ATTRIBUTE_UNUSED;
 {
   struct ppc_coff_link_hash_entry *h;
   const char *name;
@@ -1007,7 +1007,7 @@
    appear in the output .reloc section. */
 
 static boolean in_reloc_p(abfd, howto)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      reloc_howto_type *howto;
 {
   return 
@@ -1197,7 +1197,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
@@ -1700,7 +1700,7 @@
 
 boolean
 ppc_allocate_toc_section (info) 
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   asection *s;
   bfd_byte *foo;
@@ -1806,13 +1806,13 @@
 		 input_section,
 		 output_bfd,
 		 error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("REFHI");
   DUMP_RELOC("REFHI",reloc_entry);
@@ -1860,13 +1860,13 @@
 		input_section,
 		output_bfd,
 		error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("PAIR");
   DUMP_RELOC("PAIR",reloc_entry);
@@ -1886,13 +1886,13 @@
 		 input_section,
 		 output_bfd,
 		 error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("TOCREL16");
   DUMP_RELOC("TOCREL16",reloc_entry);
@@ -1945,13 +1945,13 @@
 		  input_section,
 		  output_bfd,
 		  error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("SECREL");
   DUMP_RELOC("SECREL",reloc_entry);
@@ -1970,13 +1970,13 @@
 		   input_section,
 		   output_bfd,
 		   error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("SECTION");
   DUMP_RELOC("SECTION",reloc_entry);
@@ -1995,13 +1995,13 @@
 		  input_section,
 		  output_bfd,
 		  error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   UN_IMPL("IMGLUE");
   DUMP_RELOC("IMGLUE",reloc_entry);
@@ -2093,11 +2093,11 @@
 
 static reloc_howto_type *
 coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
-     struct coff_link_hash_entry *h;
-     struct internal_syment *sym;
+     struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
+     struct internal_syment *sym ATTRIBUTE_UNUSED;
      bfd_vma *addendp;
 {
   reloc_howto_type *howto;
@@ -2175,7 +2175,7 @@
 
 static reloc_howto_type *
 ppc_coff_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -2214,6 +2214,7 @@
 #define coff_bfd_final_link          ppc_bfd_coff_final_link 
 
 #ifndef COFF_IMAGE_WITH_PE
+/* FIXME: This no longer works.  */
 #define coff_swap_sym_in_hook        ppc_coff_swap_sym_in_hook
 #endif
 
@@ -2221,8 +2222,25 @@
 
 #define COFF_PAGE_SIZE                       0x1000
 
+/* FIXME: This controls some code that used to be in peicode.h and is
+   now in peigen.c.  It will not control the code in peigen.c.  If
+   anybody wants to get this working, you will need to fix that.  */
 #define POWERPC_LE_PE
 
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".idata$2"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".idata$3"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".idata$4"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".idata$5"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".idata$6"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".reloc"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }
+
 #include "coffcode.h"
 
 
@@ -2245,7 +2263,7 @@
 static void
 ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
      bfd            *abfd;
-     PTR ext1;
+     PTR ext1 ATTRIBUTE_UNUSED;
      PTR in1;
 {
   struct internal_syment      *in = (struct internal_syment *)in1;
@@ -2316,7 +2334,6 @@
    where the POWERPC_LE_PE macro modifies the code. It is left in as a 
    precise form of comment. krk@cygnus.com
 */
-#define POWERPC_LE_PE
 
 
 /* Do the final link step.  */
@@ -2824,11 +2841,15 @@
 #endif
 
 
+/* Forward declaration for use by alternative_target field.  */
+#ifdef TARGET_BIG_SYM
+extern const bfd_target TARGET_BIG_SYM;
+#endif
+
 /* The transfer vectors that lead the outside world to all of the above. */
 
 #ifdef TARGET_LITTLE_SYM
-const bfd_target
-TARGET_LITTLE_SYM =
+const bfd_target TARGET_LITTLE_SYM =
 {
   TARGET_LITTLE_NAME,		/* name or coff-arm-little */
   bfd_target_coff_flavour,
@@ -2874,14 +2895,20 @@
   BFD_JUMP_TABLE_WRITE (coff),
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  /* Alternative_target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
   
-  COFF_SWAP_TABLE,
+  COFF_SWAP_TABLE
 };
 #endif
 
 #ifdef TARGET_BIG_SYM
-const bfd_target
-TARGET_BIG_SYM =
+const bfd_target TARGET_BIG_SYM =
 {
   TARGET_BIG_NAME,
   bfd_target_coff_flavour,	
@@ -2928,7 +2955,15 @@
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+
+  /* Alternative_target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+  
+  COFF_SWAP_TABLE
 };
 
 #endif
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 6b4cd44..6f8563f 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -1,5 +1,6 @@
 /* BFD back-end for IBM RS/6000 "XCOFF" files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    FIXME: Can someone provide a transliteration of this name into ASCII?
    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
@@ -139,8 +140,8 @@
 
 static boolean
 xcoff_is_local_label_name (abfd, name)
-     bfd *abfd;
-     const char *name;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
 {
   return false;
 }
@@ -258,7 +259,7 @@
 	 0xffff,        	/* dst_mask */                             
 	 false),                /* pcrel_offset */
   
-  { 7 },
+  EMPTY_HOWTO (7),
   
   /* Non modifiable absolute branch.  */
   HOWTO (8,	                /* type */                                 
@@ -275,7 +276,7 @@
 	 0x3fffffc,        	/* dst_mask */                             
 	 false),                /* pcrel_offset */
   
-  { 9 },
+  EMPTY_HOWTO (9),
 
   /* Non modifiable relative branch.  */
   HOWTO (0xa,	                /* type */                                 
@@ -292,7 +293,7 @@
 	 0x3fffffc,        	/* dst_mask */                             
 	 false),                /* pcrel_offset */
   
-  { 0xb },
+  EMPTY_HOWTO (0xb),
 
   /* Indirect load.  */
   HOWTO (0xc,	                /* type */                                 
@@ -324,7 +325,7 @@
 	 0xffff,        	/* dst_mask */                             
 	 false),                /* pcrel_offset */
   
-  { 0xe },
+  EMPTY_HOWTO (0xe),
   
   /* Non-relocating reference.  */
   HOWTO (0xf,	                /* type */                                 
@@ -341,8 +342,8 @@
 	 0,     	   	/* dst_mask */                             
 	 false),                /* pcrel_offset */
   
-  { 0x10 },
-  { 0x11 },
+  EMPTY_HOWTO (0x10),
+  EMPTY_HOWTO (0x11),
   
   /* TOC relative indirect load.  */
   HOWTO (0x12,	                /* type */                                 
@@ -495,6 +496,55 @@
 	 false)                 /* pcrel_offset */
 };
 
+/* These are the first two like the above but for 16-bit relocs.  */
+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 */                               
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 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 */                               
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 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 */                               
+	 complain_overflow_signed, /* complain_on_overflow */
+	 0,		        /* special_function */                     
+	 "R_REL_16",            /* name */                                 
+	 true,	                /* partial_inplace */                      
+	 0xffffffff,            /* src_mask */                             
+	 0xffffffff,            /* dst_mask */                             
+	 false),                /* pcrel_offset */
+};
+  
 static void
 xcoff_rtype2howto (relent, internal)
      arelent *relent;
@@ -502,6 +552,11 @@
 {
   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])))
+    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
@@ -518,7 +573,7 @@
 
 static reloc_howto_type *
 xcoff_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -590,12 +645,25 @@
    binary number which is the number of entries.  This is followed by
    a that many four byte binary numbers; each is the file offset of an
    entry in the archive.  These numbers are followed by a series of
-   null terminated strings, which are symbol names.  */
+   null terminated strings, which are symbol names.
 
-/* XCOFF archives use this as a magic string.  */
+   AIX 4.3 introduced a new archive format which can handle larger
+   files and also 32- and 64-bit objects in the same archive.  The
+   things said above remain true except that there is now more than
+   one global symbol table.  The one is used to index 32-bit objects,
+   the other for 64-bit objects.
 
-#define XCOFFARMAG "<aiaff>\012"
-#define SXCOFFARMAG 8
+   The new archives (recognizable by the new ARMAG string) has larger
+   field lengths so that we cannot really share any code.  Also we have
+   to take care that we are not generating the new form of archives
+   on AIX 4.2 or earlier systems.  */
+
+/* XCOFF archives use this as a magic string.  Note that both strings
+   have the same length.  */
+
+#define XCOFFARMAG    "<aiaff>\012"
+#define XCOFFARMAGBIG "<bigaf>\012"
+#define SXCOFFARMAG   8
 
 /* This terminates an XCOFF archive member name.  */
 
@@ -628,6 +696,38 @@
 
 #define SIZEOF_AR_FILE_HDR (5 * 12 + SXCOFFARMAG)
 
+/* This is the equivalent data structure for the big archive format.  */
+
+struct xcoff_ar_file_hdr_big
+{
+  /* Magic string.  */
+  char magic[SXCOFFARMAG];
+
+  /* Offset of the member table (decimal ASCII string).  */
+  char memoff[20];
+
+  /* Offset of the global symbol table for 32-bit objects (decimal ASCII
+     string).  */
+  char symoff[20];
+
+  /* Offset of the global symbol table for 64-bit objects (decimal ASCII
+     string).  */
+  char symoff64[20];
+
+  /* Offset of the first member in the archive (decimal ASCII string).  */
+  char firstmemoff[20];
+
+  /* Offset of the last member in the archive (decimal ASCII string).  */
+  char lastmemoff[20];
+
+  /* Offset of the first member on the free list (decimal ASCII
+     string).  */
+  char freeoff[20];
+};
+
+#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG)
+
+
 /* Each XCOFF archive member starts with this (printable) structure.  */
 
 struct xcoff_ar_hdr
@@ -666,16 +766,65 @@
 
 #define SIZEOF_AR_HDR (7 * 12 + 4)
 
+/* The equivalent for the big archive format.  */
+
+struct xcoff_ar_hdr_big
+{
+  /* File size not including the header (decimal ASCII string).  */
+  char size[20];
+
+  /* File offset of next archive member (decimal ASCII string).  */
+  char nextoff[20];
+
+  /* File offset of previous archive member (decimal ASCII string).  */
+  char prevoff[20];
+
+  /* File mtime (decimal ASCII string).  */
+  char date[12];
+
+  /* File UID (decimal ASCII string).  */
+  char uid[12];
+
+  /* File GID (decimal ASCII string).  */
+  char gid[12];
+
+  /* File mode (octal ASCII string).  */
+  char mode[12];
+
+  /* Length of file name (decimal ASCII string).  */
+  char namlen[4];
+
+  /* This structure is followed by the file name.  The length of the
+     name is given in the namlen field.  If the length of the name is
+     odd, the name is followed by a null byte.  The name and optional
+     null byte are followed by XCOFFARFMAG, which is not included in
+     namlen.  The contents of the archive member follow; the number of
+     bytes is given in the size field.  */
+};
+
+#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.  */
+#define xcoff_big_format_p(abfd) \
+  (xcoff_ardata (abfd)->magic[1] == 'b')
+
 /* We store a copy of the xcoff_ar_file_hdr in the tdata field of the
-   artdata structure.  */
+   artdata structure.  Similar for the big archive.  */
 #define xcoff_ardata(abfd) \
   ((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata)
+#define xcoff_ardata_big(abfd) \
+  ((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata)
 
 /* We store a copy of the xcoff_ar_hdr in the arelt_data field of an
-   archive element.  */
+   archive element.  Similar for the big archive.  */
 #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
 #define arch_xhdr(bfd) \
   ((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header)
+#define arch_xhdr_big(bfd) \
+  ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
 
 /* XCOFF archives do not have anything which corresponds to an
    extended name table.  */
@@ -701,7 +850,6 @@
      bfd *abfd;
 {
   file_ptr off;
-  struct xcoff_ar_hdr hdr;
   size_t namlen;
   bfd_size_type sz;
   bfd_byte *contents, *cend;
@@ -715,27 +863,64 @@
       return true;
     }
 
-  off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10);
-  if (off == 0)
+  if (! xcoff_big_format_p (abfd))
     {
-      bfd_has_map (abfd) = false;
-      return true;
+      /* This is for the old format.  */
+      struct xcoff_ar_hdr hdr;
+
+      off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10);
+      if (off == 0)
+	{
+	  bfd_has_map (abfd) = false;
+	  return true;
+	}
+
+      if (bfd_seek (abfd, off, SEEK_SET) != 0)
+	return false;
+
+      /* The symbol table starts with a normal archive header.  */
+      if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
+	return false;
+
+      /* Skip the name (normally empty).  */
+      namlen = strtol (hdr.namlen, (char **) NULL, 10);
+      if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0)
+	return false;
+
+      sz = strtol (hdr.size, (char **) NULL, 10);
+    }
+  else
+    {
+      /* This is for the new format.  */
+      struct xcoff_ar_hdr_big hdr;
+
+      off = strtol (xcoff_ardata_big (abfd)->symoff, (char **) NULL, 10);
+      if (off == 0)
+	{
+	  bfd_has_map (abfd) = false;
+	  return true;
+	}
+
+      if (bfd_seek (abfd, off, SEEK_SET) != 0)
+	return false;
+
+      /* The symbol table starts with a normal archive header.  */
+      if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd)
+	  != SIZEOF_AR_HDR_BIG)
+	return false;
+
+      /* Skip the name (normally empty).  */
+      namlen = strtol (hdr.namlen, (char **) NULL, 10);
+      if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0)
+	return false;
+
+      /* XXX This actually has to be a call to strtoll (at least on 32-bit
+	 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);
     }
 
-  if (bfd_seek (abfd, off, SEEK_SET) != 0)
-    return false;
-
-  /* The symbol table starts with a normal archive header.  */
-  if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
-    return false;
-
-  /* Skip the name (normally empty).  */
-  namlen = strtol (hdr.namlen, (char **) NULL, 10);
-  if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0)
-    return false;
-
   /* Read in the entire symbol table.  */
-  sz = strtol (hdr.size, (char **) NULL, 10);
   contents = (bfd_byte *) bfd_alloc (abfd, sz);
   if (contents == NULL)
     return false;
@@ -788,17 +973,17 @@
 xcoff_archive_p (abfd)
      bfd *abfd;
 {
-  struct xcoff_ar_file_hdr hdr;
+  char magic[SXCOFFARMAG];
 
-  if (bfd_read ((PTR) &hdr, SIZEOF_AR_FILE_HDR, 1, abfd)
-      != SIZEOF_AR_FILE_HDR)
+  if (bfd_read ((PTR) magic, SXCOFFARMAG, 1, abfd) != SXCOFFARMAG)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
-  if (strncmp (hdr.magic, XCOFFARMAG, SXCOFFARMAG) != 0)
+  if (strncmp (magic, XCOFFARMAG, SXCOFFARMAG) != 0
+      && strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0)
     {
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
@@ -813,18 +998,67 @@
   if (bfd_ardata (abfd) == (struct artdata *) NULL)
     return NULL;
 
-  bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
-						  (char **) NULL, 10);
   bfd_ardata (abfd)->cache = NULL;
   bfd_ardata (abfd)->archive_head = NULL;
   bfd_ardata (abfd)->symdefs = NULL;
   bfd_ardata (abfd)->extended_names = NULL;
 
-  bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR);
-  if (bfd_ardata (abfd)->tdata == NULL)
-    return NULL;
+  /* Now handle the two formats.  */
+  if (magic[1] != 'b')
+    {
+      /* This is the old format.  */
+      struct xcoff_ar_file_hdr hdr;
 
-  memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
+      /* Copy over the magic string.  */
+      memcpy (hdr.magic, magic, SXCOFFARMAG);
+
+      /* Now read the rest of the file header.  */
+      if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR - SXCOFFARMAG, 1,
+		    abfd) != SIZEOF_AR_FILE_HDR - SXCOFFARMAG)
+	{
+	  if (bfd_get_error () != bfd_error_system_call)
+	    bfd_set_error (bfd_error_wrong_format);
+	  return NULL;
+	}
+
+      bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
+						      (char **) NULL, 10);
+
+      bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR);
+      if (bfd_ardata (abfd)->tdata == NULL)
+	return NULL;
+
+      memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
+    }
+  else
+    {
+      /* This is the new format.  */
+      struct xcoff_ar_file_hdr_big hdr;
+
+      /* Copy over the magic string.  */
+      memcpy (hdr.magic, magic, SXCOFFARMAG);
+
+      /* Now read the rest of the file header.  */
+      if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, 1,
+		    abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG)
+	{
+	  if (bfd_get_error () != bfd_error_system_call)
+	    bfd_set_error (bfd_error_wrong_format);
+	  return NULL;
+	}
+
+      /* XXX This actually has to be a call to strtoll (at least on 32-bit
+	 machines) since the field width is 20 and there numbers with more
+	 than 32 bits can be represented.  */
+      bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
+						      (char **) NULL, 10);
+
+      bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR_BIG);
+      if (bfd_ardata (abfd)->tdata == NULL)
+	return NULL;
+
+      memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
+    }
 
   if (! xcoff_slurp_armap (abfd))
     {
@@ -842,29 +1076,80 @@
 xcoff_read_ar_hdr (abfd)
      bfd *abfd;
 {
-  struct xcoff_ar_hdr hdr;
   size_t namlen;
-  struct xcoff_ar_hdr *hdrp;
   struct areltdata *ret;
 
-  if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
-    return NULL;
-
-  namlen = strtol (hdr.namlen, (char **) NULL, 10);
-  hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, SIZEOF_AR_HDR + namlen + 1);
-  if (hdrp == NULL)
-    return NULL;
-  memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
-  if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen)
-    return NULL;
-  ((char *) hdrp)[SIZEOF_AR_HDR + namlen] = '\0';
-
   ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata));
   if (ret == NULL)
     return NULL;
-  ret->arch_header = (char *) hdrp;
-  ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
-  ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
+
+  if (! xcoff_big_format_p (abfd))
+    {
+      struct xcoff_ar_hdr hdr;
+      struct xcoff_ar_hdr *hdrp;
+
+      if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
+	{
+	  free (ret);
+	  return NULL;
+	}
+
+      namlen = strtol (hdr.namlen, (char **) NULL, 10);
+      hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd,
+						SIZEOF_AR_HDR + namlen + 1);
+      if (hdrp == NULL)
+	{
+	  free (ret);
+	  return NULL;
+	}
+      memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
+      if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen)
+	{
+	  free (ret);
+	  return NULL;
+	}
+      ((char *) hdrp)[SIZEOF_AR_HDR + namlen] = '\0';
+
+      ret->arch_header = (char *) hdrp;
+      ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
+      ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
+    }
+  else
+    {
+      struct xcoff_ar_hdr_big hdr;
+      struct xcoff_ar_hdr_big *hdrp;
+
+      if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd)
+	  != SIZEOF_AR_HDR_BIG)
+	{
+	  free (ret);
+	  return NULL;
+	}
+
+      namlen = strtol (hdr.namlen, (char **) NULL, 10);
+      hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd,
+						    SIZEOF_AR_HDR_BIG
+						    + namlen + 1);
+      if (hdrp == NULL)
+	{
+	  free (ret);
+	  return NULL;
+	}
+      memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
+      if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, 1, namlen, abfd) != namlen)
+	{
+	  free (ret);
+	  return NULL;
+	}
+      ((char *) hdrp)[SIZEOF_AR_HDR_BIG + namlen] = '\0';
+
+      ret->arch_header = (char *) hdrp;
+      /* XXX This actually has to be a call to strtoll (at least on 32-bit
+	 machines) since the field width is 20 and there numbers with more
+	 than 32 bits can be represented.  */
+      ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
+      ret->filename = (char *) hdrp + SIZEOF_AR_HDR_BIG;
+    }
 
   /* Skip over the XCOFFARFMAG at the end of the file name.  */
   if (bfd_seek (abfd, (namlen & 1) + SXCOFFARFMAG, SEEK_CUR) != 0)
@@ -888,19 +1173,47 @@
       return NULL;
     }
 
-  if (last_file == NULL)
-    filestart = bfd_ardata (archive)->first_file_filepos;
-  else
-    filestart = strtol (arch_xhdr (last_file)->nextoff, (char **) NULL, 10);
-
-  if (filestart == 0
-      || filestart == strtol (xcoff_ardata (archive)->memoff,
-			      (char **) NULL, 10)
-      || filestart == strtol (xcoff_ardata (archive)->symoff,
-			      (char **) NULL, 10))
+  if (! xcoff_big_format_p (archive))
     {
-      bfd_set_error (bfd_error_no_more_archived_files);
-      return NULL;
+      if (last_file == NULL)
+	filestart = bfd_ardata (archive)->first_file_filepos;
+      else
+	filestart = strtol (arch_xhdr (last_file)->nextoff, (char **) NULL,
+			    10);
+
+      if (filestart == 0
+	  || filestart == strtol (xcoff_ardata (archive)->memoff,
+				  (char **) NULL, 10)
+	  || filestart == strtol (xcoff_ardata (archive)->symoff,
+				  (char **) NULL, 10))
+	{
+	  bfd_set_error (bfd_error_no_more_archived_files);
+	  return NULL;
+	}
+    }
+  else
+    {
+      if (last_file == NULL)
+	filestart = bfd_ardata (archive)->first_file_filepos;
+      else
+	/* XXX These actually have to be a calls to strtoll (at least
+	   on 32-bit machines) since the fields's width is 20 and
+	   there numbers with more than 32 bits can be represented.  */
+	filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL,
+			    10);
+
+      /* XXX These actually have to be calls to strtoll (at least on 32-bit
+	 machines) since the fields's width is 20 and there numbers with more
+	 than 32 bits can be represented.  */
+      if (filestart == 0
+	  || filestart == strtol (xcoff_ardata_big (archive)->memoff,
+				  (char **) NULL, 10)
+	  || filestart == strtol (xcoff_ardata_big (archive)->symoff,
+				  (char **) NULL, 10))
+	{
+	  bfd_set_error (bfd_error_no_more_archived_files);
+	  return NULL;
+	}
     }
 
   return _bfd_get_elt_at_filepos (archive, filestart);
@@ -913,21 +1226,32 @@
      bfd *abfd;
      struct stat *s;
 {
-  struct xcoff_ar_hdr *hdrp;
-
   if (abfd->arelt_data == NULL)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return -1;
     }
 
-  hdrp = arch_xhdr (abfd);
+  if (! xcoff_big_format_p (abfd))
+    {
+      struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
 
-  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
-  s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
-  s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
-  s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
-  s->st_size = arch_eltdata (abfd)->parsed_size;
+      s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+      s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
+      s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
+      s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
+      s->st_size = arch_eltdata (abfd)->parsed_size;
+    }
+  else
+    {
+      struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd);
+
+      s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+      s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
+      s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
+      s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
+      s->st_size = arch_eltdata (abfd)->parsed_size;
+    }
 
   return 0;
 }
@@ -954,9 +1278,9 @@
 
 /*ARGSUSED*/
 static boolean
-xcoff_write_armap (abfd, elength, map, orl_count, stridx)
+xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
      bfd *abfd;
-     unsigned int elength;
+     unsigned int elength ATTRIBUTE_UNUSED;
      struct orl *map;
      unsigned int orl_count;
      int stridx;
@@ -986,7 +1310,7 @@
   if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR
       || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
     return false;
-  
+
   bfd_h_put_32 (abfd, orl_count, buf);
   if (bfd_write (buf, 1, 4, abfd) != 4)
     return false;
@@ -1038,11 +1362,115 @@
   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;
+{
+  struct xcoff_ar_hdr_big hdr;
+  char *p;
+  unsigned char buf[4];
+  bfd *sub;
+  file_ptr fileoff;
+  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.date, "%d", 0);
+  sprintf (hdr.uid, "%d", 0);
+  sprintf (hdr.gid, "%d", 0);
+  sprintf (hdr.mode, "%d", 0);
+  sprintf (hdr.namlen, "%d", 0);
+
+  /* We need spaces, not null bytes, in the header.  */
+  for (p = (char *) &hdr; p < (char *) &hdr + SIZEOF_AR_HDR_BIG; p++)
+    if (*p == '\0')
+      *p = ' ';
+
+  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);
+  if (bfd_write (buf, 1, 4, abfd) != 4)
+    return false;
+
+  sub = abfd->archive_head;
+  fileoff = SIZEOF_AR_FILE_HDR_BIG;
+  i = 0;
+  while (sub != NULL && i < orl_count)
+    {
+      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;
+	}
+      namlen = strlen (normalize_filename (sub));
+      namlen = (namlen + 1) &~ 1;
+      fileoff += (SIZEOF_AR_HDR_BIG
+		  + namlen
+		  + SXCOFFARFMAG
+		  + arelt_size (sub));
+      fileoff = (fileoff + 1) &~ 1;
+      sub = sub->next;
+    }
+
+  for (i = 0; i < orl_count; i++)
+    {
+      const char *name;
+      size_t namlen;
+
+      name = *map[i].name;
+      namlen = strlen (name);
+      if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1)
+	return false;
+    }
+
+  if ((stridx & 1) != 0)
+    {
+      char b;
+
+      b = '\0';
+      if (bfd_write (&b, 1, 1, abfd) != 1)
+	return false;
+    }
+
+  return true;
+}
+
+/*ARGSUSED*/
+static boolean
+xcoff_write_armap (abfd, elength, map, orl_count, stridx)
+     bfd *abfd;
+     unsigned int elength ATTRIBUTE_UNUSED;
+     struct orl *map;
+     unsigned int orl_count;
+     int stridx;
+{
+  if (! xcoff_big_format_p (abfd))
+    return xcoff_write_armap_old (abfd, elength, map, orl_count, stridx);
+  else
+    return xcoff_write_armap_big (abfd, elength, map, orl_count, stridx);
+}
+
 /* Write out an XCOFF archive.  We always write an entire archive,
    rather than fussing with the freelist and so forth.  */
 
 static boolean
-xcoff_write_archive_contents (abfd)
+xcoff_write_archive_contents_old (abfd)
      bfd *abfd;
 {
   struct xcoff_ar_file_hdr fhdr;
@@ -1285,6 +1713,285 @@
 
   return true;
 }
+
+static boolean
+xcoff_write_archive_contents_big (abfd)
+     bfd *abfd;
+{
+  struct xcoff_ar_file_hdr_big fhdr;
+  size_t count;
+  size_t total_namlen;
+  file_ptr *offsets;
+  boolean makemap;
+  boolean hasobjects;
+  file_ptr prevoff, nextoff;
+  bfd *sub;
+  unsigned int i;
+  struct xcoff_ar_hdr_big ahdr;
+  bfd_size_type size;
+  char *p;
+  char decbuf[13];
+
+  memset (&fhdr, 0, sizeof fhdr);
+  strncpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
+  sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR_BIG);
+  sprintf (fhdr.freeoff, "%d", 0);
+
+  count = 0;
+  total_namlen = 0;
+  for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+    {
+      ++count;
+      total_namlen += strlen (normalize_filename (sub)) + 1;
+    }
+  offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
+  if (offsets == NULL)
+    return false;
+
+  if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
+    return false;
+
+  makemap = bfd_has_map (abfd);
+  hasobjects = false;
+  prevoff = 0;
+  nextoff = SIZEOF_AR_FILE_HDR_BIG;
+  for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
+    {
+      const char *name;
+      size_t namlen;
+      struct xcoff_ar_hdr_big *ahdrp;
+      bfd_size_type remaining;
+
+      if (makemap && ! hasobjects)
+	{
+	  if (bfd_check_format (sub, bfd_object))
+	    hasobjects = true;
+	}
+
+      name = normalize_filename (sub);
+      namlen = strlen (name);
+
+      if (sub->arelt_data != NULL)
+	ahdrp = arch_xhdr_big (sub);
+      else
+	ahdrp = NULL;
+
+      if (ahdrp == NULL)
+	{
+	  struct stat s;
+
+	  memset (&ahdr, 0, sizeof ahdr);
+	  ahdrp = &ahdr;
+	  /* XXX This should actually be a call to stat64 (at least on
+	     32-bit machines).  */
+	  if (stat (bfd_get_filename (sub), &s) != 0)
+	    {
+	      bfd_set_error (bfd_error_system_call);
+	      return false;
+	    }
+
+	  /* 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 (ahdrp->size, "%ld", (long) s.st_size);
+	  sprintf (ahdrp->date, "%ld", (long) s.st_mtime);
+	  sprintf (ahdrp->uid, "%ld", (long) s.st_uid);
+	  sprintf (ahdrp->gid, "%ld", (long) s.st_gid);
+	  sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode);
+
+	  if (sub->arelt_data == NULL)
+	    {
+	      sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata));
+	      if (sub->arelt_data == NULL)
+		return false;
+	    }
+
+	  arch_eltdata (sub)->parsed_size = s.st_size;
+	}
+
+      /* XXX These calls 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 (ahdrp->prevoff, "%ld", (long) prevoff);
+      sprintf (ahdrp->namlen, "%ld", (long) namlen);
+
+      /* If the length of the name is odd, we write out the null byte
+         after the name as well.  */
+      namlen = (namlen + 1) &~ 1;
+
+      remaining = arelt_size (sub);
+      size = (SIZEOF_AR_HDR_BIG
+	      + namlen
+	      + SXCOFFARFMAG
+	      + remaining);
+
+      BFD_ASSERT (nextoff == bfd_tell (abfd));
+
+      offsets[i] = nextoff;
+
+      prevoff = nextoff;
+      nextoff += size + (size & 1);
+
+      sprintf (ahdrp->nextoff, "%ld", (long) nextoff);
+
+      /* We need spaces, not null bytes, in the header.  */
+      for (p = (char *) ahdrp; p < (char *) ahdrp + SIZEOF_AR_HDR_BIG; p++)
+	if (*p == '\0')
+	  *p = ' ';
+
+      if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR_BIG, abfd)
+	  != SIZEOF_AR_HDR_BIG
+	  || bfd_write ((PTR) name, 1, namlen, abfd) != namlen
+	  || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
+	      != SXCOFFARFMAG))
+	return false;
+
+      if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0)
+	return false;
+      while (remaining != 0)
+	{
+	  bfd_size_type amt;
+	  bfd_byte buffer[DEFAULT_BUFFERSIZE];
+
+	  amt = sizeof buffer;
+	  if (amt > remaining)
+	    amt = remaining;
+	  if (bfd_read (buffer, 1, amt, sub) != amt
+	      || bfd_write (buffer, 1, amt, abfd) != amt)
+	    return false;
+	  remaining -= amt;
+	}
+
+      if ((size & 1) != 0)
+	{
+	  bfd_byte b;
+
+	  b = '\0';
+	  if (bfd_write (&b, 1, 1, abfd) != 1)
+	    return false;
+	}
+    }
+
+  /* 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.lastmemoff, "%ld", (long) prevoff);
+
+  /* Write out the member table.  */
+
+  BFD_ASSERT (nextoff == bfd_tell (abfd));
+  /* 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.memoff, "%ld", (long) nextoff);
+
+  memset (&ahdr, 0, sizeof ahdr);
+  /* XXX The next two calls 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 (ahdr.size, "%ld", (long) (12 + count * 12 + total_namlen));
+  sprintf (ahdr.prevoff, "%ld", (long) prevoff);
+  sprintf (ahdr.date, "%d", 0);
+  sprintf (ahdr.uid, "%d", 0);
+  sprintf (ahdr.gid, "%d", 0);
+  sprintf (ahdr.mode, "%d", 0);
+  sprintf (ahdr.namlen, "%d", 0);
+
+  size = (SIZEOF_AR_HDR_BIG
+	  + 12
+	  + count * 12
+	  + total_namlen
+	  + SXCOFFARFMAG);
+
+  prevoff = nextoff;
+  nextoff += size + (size & 1);
+
+  if (makemap && hasobjects)
+    /* 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 (ahdr.nextoff, "%ld", (long) nextoff);
+  else
+    sprintf (ahdr.nextoff, "%d", 0);
+
+  /* We need spaces, not null bytes, in the header.  */
+  for (p = (char *) &ahdr; p < (char *) &ahdr + SIZEOF_AR_HDR_BIG; p++)
+    if (*p == '\0')
+      *p = ' ';
+
+  if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
+      || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
+	  != SXCOFFARFMAG))
+    return false;
+
+  sprintf (decbuf, "%-12ld", (long) count);
+  if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
+    return false;
+  for (i = 0; i < count; i++)
+    {
+      sprintf (decbuf, "%-12ld", (long) offsets[i]);
+      if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
+	return false;
+    }
+  for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+    {
+      const char *name;
+      size_t namlen;
+
+      name = normalize_filename (sub);
+      namlen = strlen (name);
+      if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1)
+	return false;
+    }
+  if ((size & 1) != 0)
+    {
+      bfd_byte b;
+
+      b = '\0';
+      if (bfd_write ((PTR) &b, 1, 1, abfd) != 1)
+	return false;
+    }
+
+  /* Write out the armap, if appropriate.  */
+
+  if (! makemap || ! hasobjects)
+    sprintf (fhdr.symoff, "%d", 0);
+  else
+    {
+      BFD_ASSERT (nextoff == bfd_tell (abfd));
+      /* 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;
+    }
+
+  /* Write out the archive file header.  */
+
+  /* We need spaces, not null bytes, in the header.  */
+  for (p = (char *) &fhdr; p < (char *) &fhdr + SIZEOF_AR_FILE_HDR_BIG; p++)
+    if (*p == '\0')
+      *p = ' ';
+
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+      || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR_BIG, 1, abfd) !=
+	  SIZEOF_AR_FILE_HDR_BIG))
+    return false;
+
+  return true;
+}
+
+static boolean
+xcoff_write_archive_contents (abfd)
+     bfd *abfd;
+{
+  if (! xcoff_big_format_p (abfd))
+    return xcoff_write_archive_contents_old (abfd);
+  else
+    return xcoff_write_archive_contents_big (abfd);
+}
 
 /* We can't use the usual coff_sizeof_headers routine, because AIX
    always uses an a.out header.  */
@@ -1293,7 +2000,7 @@
 static int
 _bfd_xcoff_sizeof_headers (abfd, reloc)
      bfd *abfd;
-     boolean reloc;
+     boolean reloc ATTRIBUTE_UNUSED;
 {
   int size;
 
@@ -1377,7 +2084,7 @@
 #else
   "aixcoff-rs6000",		/* name */
 #endif
-  bfd_target_coff_flavour,	
+  bfd_target_coff_flavour,
   BFD_ENDIAN_BIG,		/* data byte order is big */
   BFD_ENDIAN_BIG,		/* header byte order is big */
 
@@ -1414,5 +2121,7 @@
      BFD_JUMP_TABLE_LINK (_bfd_xcoff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
 
-  COFF_SWAP_TABLE,
+  NULL,
+  
+  COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index e3d6eec..821fecd 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Hitachi Super-H COFF binaries.
-   Copyright 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    Written by Steve Chamberlain, <sac@cygnus.com>.
    Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>.
@@ -26,18 +26,33 @@
 #include "bfdlink.h"
 #include "coff/sh.h"
 #include "coff/internal.h"
+
+#ifdef COFF_WITH_PE
+#include "coff/pe.h"
+
+#ifndef COFF_IMAGE_WITH_PE
+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 *));
+
+#define _bfd_sh_align_load_span sh_align_load_span
+#endif
+#endif
+
 #include "libcoff.h"
 
 /* Internal functions.  */
 static bfd_reloc_status_type sh_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static long get_symbol_value PARAMS ((asymbol *));
-static boolean sh_merge_private_data PARAMS ((bfd *, bfd *));
 static boolean sh_relax_section
   PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
 static boolean sh_relax_delete_bytes
   PARAMS ((bfd *, asection *, bfd_vma, int));
+#ifndef COFF_IMAGE_WITH_PE
 static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int));
+#endif
 static boolean sh_align_loads
   PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *));
 static boolean sh_swap_insns
@@ -49,26 +64,64 @@
   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
 	   bfd_byte *, boolean, asymbol **));
 
+#ifdef COFF_WITH_PE
+/* Can't build import tables with 2**4 alignment.  */
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER	2
+#else
 /* Default section alignment to 2**4.  */
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (4)
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER	4
+#endif
+
+#ifdef COFF_IMAGE_WITH_PE
+/* Align PE executables.  */
+#define COFF_PAGE_SIZE 0x1000
+#endif
 
 /* Generate long file names.  */
 #define COFF_LONG_FILENAMES
 
+#ifdef COFF_WITH_PE
+/* Return true if this relocation should
+   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 && howto->type != R_SH_IMAGEBASE;
+}     
+#endif
+
 /* The supported relocations.  There are a lot of relocations defined
    in coff/internal.h which we do not expect to ever see.  */
 static reloc_howto_type sh_coff_howtos[] =
 {
-  { 0 },
-  { 1 },
-  { 2 },
-  { 3 }, /* R_SH_PCREL8 */
-  { 4 }, /* R_SH_PCREL16 */
-  { 5 }, /* R_SH_HIGH8 */
-  { 6 }, /* R_SH_IMM24 */
-  { 7 }, /* R_SH_LOW16 */
-  { 8 },
-  { 9 }, /* R_SH_PCDISP8BY4 */
+  EMPTY_HOWTO (0),
+  EMPTY_HOWTO (1),
+#ifdef COFF_WITH_PE
+  /* Windows CE */
+  HOWTO (R_SH_IMM32CE,		/* 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 */
+	 "r_imm32ce",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+#else
+  EMPTY_HOWTO (2),
+#endif
+  EMPTY_HOWTO (3), /* R_SH_PCREL8 */
+  EMPTY_HOWTO (4), /* R_SH_PCREL16 */
+  EMPTY_HOWTO (5), /* R_SH_HIGH8 */
+  EMPTY_HOWTO (6), /* R_SH_IMM24 */
+  EMPTY_HOWTO (7), /* R_SH_LOW16 */
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9), /* R_SH_PCDISP8BY4 */
 
   HOWTO (R_SH_PCDISP8BY2,	/* type */
 	 1,			/* rightshift */
@@ -84,7 +137,7 @@
 	 0xff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  { 11 }, /* R_SH_PCDISP8 */
+  EMPTY_HOWTO (11), /* R_SH_PCDISP8 */
 
   HOWTO (R_SH_PCDISP,		/* type */
 	 1,			/* rightshift */
@@ -100,7 +153,7 @@
 	 0xfff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  { 13 },
+  EMPTY_HOWTO (13),
 
   HOWTO (R_SH_IMM32,		/* type */
 	 0,			/* rightshift */
@@ -116,13 +169,29 @@
 	 0xffffffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  { 15 },
-  { 16 }, /* R_SH_IMM8 */
-  { 17 }, /* R_SH_IMM8BY2 */
-  { 18 }, /* R_SH_IMM8BY4 */
-  { 19 }, /* R_SH_IMM4 */
-  { 20 }, /* R_SH_IMM4BY2 */
-  { 21 }, /* R_SH_IMM4BY4 */
+  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 */                               
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 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 */
+#endif
+  EMPTY_HOWTO (17), /* R_SH_IMM8BY2 */
+  EMPTY_HOWTO (18), /* R_SH_IMM8BY4 */
+  EMPTY_HOWTO (19), /* R_SH_IMM4 */
+  EMPTY_HOWTO (20), /* R_SH_IMM4BY2 */
+  EMPTY_HOWTO (21), /* R_SH_IMM4BY4 */
 
   HOWTO (R_SH_PCRELIMM8BY2,	/* type */
 	 1,			/* rightshift */
@@ -304,6 +373,7 @@
 /* FIXME: This should not be set here.  */
 #define __A_MAGIC_SET__
 
+#ifndef COFF_WITH_PE
 /* Swap the r_offset field in and out.  */
 #define SWAP_IN_RELOC_OFFSET  bfd_h_get_32
 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
@@ -316,6 +386,7 @@
       dst->r_stuff[1] = 'C';			\
     }						\
   while (0)
+#endif
 
 /* Get the value of a symbol, when performing a relocation.  */
 
@@ -335,6 +406,96 @@
   return relocation;
 }
 
+#ifdef COFF_WITH_PE
+/* Convert an rtype to howto for the COFF backend linker.
+   Copied from coff-i386.  */
+#define coff_rtype_to_howto coff_sh_rtype_to_howto
+
+static reloc_howto_type *
+coff_sh_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     asection * sec;
+     struct internal_reloc * rel;
+     struct coff_link_hash_entry * h;
+     struct internal_syment * sym;
+     bfd_vma * addendp;
+{
+  reloc_howto_type * howto;
+
+  howto = sh_coff_howtos + rel->r_type;
+
+  *addendp = 0;
+
+  if (howto->pc_relative)
+    *addendp += sec->vma;
+
+  if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+    {
+      /* This is a common symbol.  The section contents include the
+	 size (sym->n_value) as an addend.  The relocate_section
+	 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);
+    }
+
+  if (howto->pc_relative)
+    {
+      *addendp -= 4;
+
+      /* 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
+         to 0 at the start of this function.  We need to adjust here,
+         to avoid the adjustment the generic code will make.  FIXME:
+         This is getting a bit hackish.  */
+      if (sym != NULL && sym->n_scnum != 0)
+	*addendp -= sym->n_value;
+    }
+
+  if (rel->r_type == R_SH_IMAGEBASE)
+    *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
+
+  return howto;
+}
+
+/* This structure is used to map BFD reloc codes to SH PE relocs.  */
+struct shcoff_reloc_map
+{
+  unsigned char bfd_reloc_val;
+  unsigned char shcoff_reloc_val;
+};
+
+/* An array mapping BFD reloc codes to SH PE relocs.  */
+static const struct shcoff_reloc_map sh_reloc_map[] =
+{
+  { BFD_RELOC_32, R_SH_IMM32CE },
+  { BFD_RELOC_RVA, R_SH_IMAGEBASE },
+  { BFD_RELOC_CTOR, R_SH_IMM32CE },
+};
+
+/* Given a BFD reloc code, return the howto structure for the
+   corresponding SH PE reloc.  */
+#define coff_bfd_reloc_type_lookup	sh_coff_reloc_type_lookup
+
+static reloc_howto_type *
+sh_coff_reloc_type_lookup (abfd, code)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct shcoff_reloc_map); i++)
+    {
+      if (sh_reloc_map[i].bfd_reloc_val == code)
+	return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
+    }
+
+  fprintf (stderr, "SH Error: unknown reloc type %d\n", code);
+  return NULL;
+}
+#endif /* COFF_WITH_PE */
+
 /* This macro is used in coffcode.h to get the howto corresponding to
    an internal reloc.  */
 
@@ -382,7 +543,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   unsigned long insn;
   bfd_vma sym_value;
@@ -402,6 +563,10 @@
   /* Almost all relocs have to do with relaxing.  If any work must be
      done for them, it has been done in sh_relax_section.  */
   if (r_type != R_SH_IMM32
+#ifdef COFF_WITH_PE
+      && r_type != R_SH_IMM32CE
+      && r_type != R_SH_IMAGEBASE
+#endif
       && (r_type != R_SH_PCDISP
 	  || (symbol_in->flags & BSF_LOCAL) != 0))
     return bfd_reloc_ok;
@@ -415,10 +580,21 @@
   switch (r_type)
     {
     case R_SH_IMM32:
+#ifdef COFF_WITH_PE
+    case R_SH_IMM32CE:
+#endif
       insn = bfd_get_32 (abfd, hit_data);
       insn += sym_value + reloc_entry->addend;
       bfd_put_32 (abfd, insn, hit_data);
       break;
+#ifdef COFF_WITH_PE
+    case R_SH_IMAGEBASE:
+      insn = bfd_get_32 (abfd, hit_data);
+      insn += (sym_value + reloc_entry->addend
+	       - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase);
+      bfd_put_32 (abfd, insn, hit_data);
+      break;
+#endif
     case R_SH_PCDISP:
       insn = bfd_get_16 (abfd, hit_data);
       sym_value += reloc_entry->addend;
@@ -442,31 +618,7 @@
   return bfd_reloc_ok;
 }
 
-/* This routine checks for linking big and little endian objects
-   together.  */
-
-static boolean
-sh_merge_private_data (ibfd, obfd)
-     bfd *ibfd;
-     bfd *obfd;
-{
-  if (ibfd->xvec->byteorder != obfd->xvec->byteorder
-      && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
-    {
-      (*_bfd_error_handler)
-	("%s: compiled for a %s endian system and target is %s endian",
-	 bfd_get_filename (ibfd),
-	 bfd_big_endian (ibfd) ? "big" : "little",
-	 bfd_big_endian (obfd) ? "big" : "little");
-
-      bfd_set_error (bfd_error_wrong_format);
-      return false;
-    }
-
-  return true;
-}
-
-#define coff_bfd_merge_private_bfd_data sh_merge_private_data
+#define coff_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
 
 /* We can do relaxing.  */
 #define coff_bfd_relax_section sh_relax_section
@@ -643,7 +795,14 @@
       paddr += sec->vma;
       for (irelfn = internal_relocs; irelfn < irelend; irelfn++)
 	if (irelfn->r_vaddr == paddr
+#ifdef COFF_WITH_PE
+	    && (irelfn->r_type == R_SH_IMM32
+		|| irelfn->r_type == R_SH_IMM32CE
+		|| irelfn->r_type == R_SH_IMAGEBASE))
+
+#else
 	    && irelfn->r_type == R_SH_IMM32)
+#endif
 	  break;
       if (irelfn >= irelend)
 	{
@@ -1021,6 +1180,10 @@
 	  break;
 
 	case R_SH_IMM32:
+#ifdef COFF_WITH_PE
+	case R_SH_IMM32CE:
+	case R_SH_IMAGEBASE:
+#endif
 	  /* If this reloc is against a symbol defined in this
              section, and the symbol will not be adjusted below, we
              must check the addend to see it will put the value in
@@ -1237,7 +1400,13 @@
 	{
 	  struct internal_syment sym;
 
+#ifdef COFF_WITH_PE
+	  if (irelscan->r_type != R_SH_IMM32
+	      && irelscan->r_type != R_SH_IMAGEBASE
+	      && irelscan->r_type != R_SH_IMM32CE)
+#else
 	  if (irelscan->r_type != R_SH_IMM32)
+#endif
 	    continue;
 
 	  bfd_coff_swap_sym_in (abfd,
@@ -1389,7 +1558,7 @@
      mask value in the sh_major_opcode structure.  */
   unsigned short opcode;
   /* Flags for this instruction.  */
-  unsigned short flags;
+  unsigned long flags;
 };
 
 /* Flag which appear in the sh_opcode structure.  */
@@ -1409,10 +1578,12 @@
 /* This instruction uses the value in the register in the field at
    mask 0x0f00 of the instruction.  */
 #define USES1 (0x10)
+#define USES1_REG(x) ((x & 0x0f00) >> 8)
 
 /* This instruction uses the value in the register in the field at
    mask 0x00f0 of the instruction.  */
 #define USES2 (0x20)
+#define USES2_REG(x) ((x & 0x00f0) >> 4)
 
 /* This instruction uses the value in register 0.  */
 #define USESR0 (0x40)
@@ -1420,10 +1591,12 @@
 /* This instruction sets the value in the register in the field at
    mask 0x0f00 of the instruction.  */
 #define SETS1 (0x80)
+#define SETS1_REG(x) ((x & 0x0f00) >> 8)
 
 /* This instruction sets the value in the register in the field at
    mask 0x00f0 of the instruction.  */
 #define SETS2 (0x100)
+#define SETS2_REG(x) ((x & 0x00f0) >> 4)
 
 /* This instruction sets register 0.  */
 #define SETSR0 (0x200)
@@ -1437,10 +1610,12 @@
 /* This instruction uses the floating point register in the field at
    mask 0x0f00 of the instruction.  */
 #define USESF1 (0x1000)
+#define USESF1_REG(x) ((x & 0x0f00) >> 8)
 
 /* This instruction uses the floating point register in the field at
    mask 0x00f0 of the instruction.  */
 #define USESF2 (0x2000)
+#define USESF2_REG(x) ((x & 0x00f0) >> 4)
 
 /* This instruction uses floating point register 0.  */
 #define USESF0 (0x4000)
@@ -1448,18 +1623,34 @@
 /* This instruction sets the floating point register in the field at
    mask 0x0f00 of the instruction.  */
 #define SETSF1 (0x8000)
+#define SETSF1_REG(x) ((x & 0x0f00) >> 8)
 
+#define USESAS (0x10000)
+#define USESAS_REG(x) (((((x) >> 8) - 2) & 3) + 2)
+#define USESR8 (0x20000)
+#define SETSAS (0x40000)
+#define SETSAS_REG(x) USESAS_REG (x)
+
+#ifndef COFF_IMAGE_WITH_PE
 static boolean sh_insn_uses_reg
   PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
+static boolean sh_insn_sets_reg
+  PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
+static boolean sh_insn_uses_or_sets_reg
+  PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
 static boolean sh_insn_uses_freg
   PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
+static boolean sh_insn_sets_freg
+  PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
+static boolean sh_insn_uses_or_sets_freg
+  PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
 static boolean sh_insns_conflict
   PARAMS ((unsigned int, const struct sh_opcode *, unsigned int,
 	   const struct sh_opcode *));
 static boolean sh_load_use
   PARAMS ((unsigned int, const struct sh_opcode *, unsigned int,
 	   const struct sh_opcode *));
-
+#endif
 /* The opcode maps.  */
 
 #define MAP(a) a, sizeof a / sizeof a[0]
@@ -1481,21 +1672,33 @@
 
 static const struct sh_opcode sh_opcode01[] =
 {
-  { 0x0002, SETS1 | USESSP },			/* stc sr,rn */
   { 0x0003, BRANCH | DELAY | USES1 | SETSSP },	/* bsrf rn */
   { 0x000a, SETS1 | USESSP },			/* sts mach,rn */
-  { 0x0012, SETS1 | USESSP },			/* stc gbr,rn */
   { 0x001a, SETS1 | USESSP },			/* sts macl,rn */
-  { 0x0022, SETS1 | USESSP },			/* stc vbr,rn */
   { 0x0023, BRANCH | DELAY | USES1 },		/* braf rn */
   { 0x0029, SETS1 | USESSP },			/* movt rn */
   { 0x002a, SETS1 | USESSP },			/* sts pr,rn */
+  { 0x005a, SETS1 | USESSP },			/* sts fpul,rn */
+  { 0x006a, SETS1 | USESSP },			/* sts fpscr,rn / sts dsr,rn */
+  { 0x0083, LOAD | USES1 },			/* pref @rn */
+  { 0x007a, SETS1 | USESSP },			/* sts a0,rn */
+  { 0x008a, SETS1 | USESSP },			/* sts x0,rn */
+  { 0x009a, SETS1 | USESSP },			/* sts x1,rn */
+  { 0x00aa, SETS1 | USESSP },			/* sts y0,rn */
+  { 0x00ba, SETS1 | USESSP }			/* sts y1,rn */
+};
+
+/* These sixteen instructions can be handled with one table entry below.  */
+#if 0
+  { 0x0002, SETS1 | USESSP },			/* stc sr,rn */
+  { 0x0012, SETS1 | USESSP },			/* stc gbr,rn */
+  { 0x0022, SETS1 | USESSP },			/* stc vbr,rn */
   { 0x0032, SETS1 | USESSP },			/* stc ssr,rn */
   { 0x0042, SETS1 | USESSP },			/* stc spc,rn */
-  { 0x005a, SETS1 | USESSP },			/* sts fpul,rn */
-  { 0x006a, SETS1 | USESSP },			/* sts fpscr,rn */
+  { 0x0052, SETS1 | USESSP },			/* stc mod,rn */
+  { 0x0062, SETS1 | USESSP },			/* stc rs,rn */
+  { 0x0072, SETS1 | USESSP },			/* stc re,rn */
   { 0x0082, SETS1 | USESSP },			/* stc r0_bank,rn */
-  { 0x0083, LOAD | USES1 },			/* pref @rn */
   { 0x0092, SETS1 | USESSP },			/* stc r1_bank,rn */
   { 0x00a2, SETS1 | USESSP },			/* stc r2_bank,rn */
   { 0x00b2, SETS1 | USESSP },			/* stc r3_bank,rn */
@@ -1503,10 +1706,11 @@
   { 0x00d2, SETS1 | USESSP },			/* stc r5_bank,rn */
   { 0x00e2, SETS1 | USESSP },			/* stc r6_bank,rn */
   { 0x00f2, SETS1 | USESSP }			/* stc r7_bank,rn */
-};
+#endif
 
 static const struct sh_opcode sh_opcode02[] =
 {
+  { 0x0002, SETS1 | USESSP },			/* stc <special_reg>,rn */
   { 0x0004, STORE | USES1 | USES2 | USESR0 },	/* mov.b rm,@(r0,rn) */
   { 0x0005, STORE | USES1 | USES2 | USESR0 },	/* mov.w rm,@(r0,rn) */
   { 0x0006, STORE | USES1 | USES2 | USESR0 },	/* mov.l rm,@(r0,rn) */
@@ -1586,74 +1790,108 @@
   { 0x4000, SETS1 | SETSSP | USES1 },		/* shll rn */
   { 0x4001, SETS1 | SETSSP | USES1 },		/* shlr rn */
   { 0x4002, STORE | SETS1 | USES1 | USESSP },	/* sts.l mach,@-rn */
-  { 0x4003, STORE | SETS1 | USES1 | USESSP },	/* stc.l sr,@-rn */
   { 0x4004, SETS1 | SETSSP | USES1 },		/* rotl rn */
   { 0x4005, SETS1 | SETSSP | USES1 },		/* rotr rn */
   { 0x4006, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,mach */
-  { 0x4007, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,sr */
   { 0x4008, SETS1 | USES1 },			/* shll2 rn */
   { 0x4009, SETS1 | USES1 },			/* shlr2 rn */
   { 0x400a, SETSSP | USES1 },			/* lds rm,mach */
   { 0x400b, BRANCH | DELAY | USES1 },		/* jsr @rn */
-  { 0x400e, SETSSP | USES1 },			/* ldc rm,sr */
   { 0x4010, SETS1 | SETSSP | USES1 },		/* dt rn */
   { 0x4011, SETSSP | USES1 },			/* cmp/pz rn */
   { 0x4012, STORE | SETS1 | USES1 | USESSP },	/* sts.l macl,@-rn */
-  { 0x4013, STORE | SETS1 | USES1 | USESSP },	/* stc.l gbr,@-rn */
+  { 0x4014, SETSSP | USES1 },			/* setrc rm */
   { 0x4015, SETSSP | USES1 },			/* cmp/pl rn */
   { 0x4016, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,macl */
-  { 0x4017, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,gbr */
   { 0x4018, SETS1 | USES1 },			/* shll8 rn */
   { 0x4019, SETS1 | USES1 },			/* shlr8 rn */
   { 0x401a, SETSSP | USES1 },			/* lds rm,macl */
   { 0x401b, LOAD | SETSSP | USES1 },		/* tas.b @rn */
-  { 0x401e, SETSSP | USES1 },			/* ldc rm,gbr */
   { 0x4020, SETS1 | SETSSP | USES1 },		/* shal rn */
   { 0x4021, SETS1 | SETSSP | USES1 },		/* shar rn */
   { 0x4022, STORE | SETS1 | USES1 | USESSP },	/* sts.l pr,@-rn */
-  { 0x4023, STORE | SETS1 | USES1 | USESSP },	/* stc.l vbr,@-rn */
   { 0x4024, SETS1 | SETSSP | USES1 | USESSP },	/* rotcl rn */
   { 0x4025, SETS1 | SETSSP | USES1 | USESSP },	/* rotcr rn */
   { 0x4026, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,pr */
-  { 0x4027, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,vbr */
   { 0x4028, SETS1 | USES1 },			/* shll16 rn */
   { 0x4029, SETS1 | USES1 },			/* shlr16 rn */
   { 0x402a, SETSSP | USES1 },			/* lds rm,pr */
   { 0x402b, BRANCH | DELAY | USES1 },		/* jmp @rn */
-  { 0x402e, SETSSP | USES1 },			/* ldc rm,vbr */
-  { 0x4033, STORE | SETS1 | USES1 | USESSP },	/* stc.l ssr,@-rn */
-  { 0x4037, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,ssr */
-  { 0x403e, SETSSP | USES1 },			/* ldc rm,ssr */
-  { 0x4043, STORE | SETS1 | USES1 | USESSP },	/* stc.l spc,@-rn */
-  { 0x4047, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,spc */
-  { 0x404e, SETSSP | USES1 },			/* ldc rm,spc */
   { 0x4052, STORE | SETS1 | USES1 | USESSP },	/* sts.l fpul,@-rn */
   { 0x4056, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,fpul */
   { 0x405a, SETSSP | USES1 },			/* lds.l rm,fpul */
-  { 0x4062, STORE | SETS1 | USES1 | USESSP },	/* sts.l fpscr,@-rn */
-  { 0x4066, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,fpscr */
-  { 0x406a, SETSSP | USES1 }			/* lds rm,fpscr */
+  { 0x4062, STORE | SETS1 | USES1 | USESSP },	/* sts.l fpscr / dsr,@-rn */
+  { 0x4066, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,fpscr / dsr */
+  { 0x406a, SETSSP | USES1 },			/* lds rm,fpscr / lds rm,dsr */
+  { 0x4072, STORE | SETS1 | USES1 | USESSP },	/* sts.l a0,@-rn */
+  { 0x4076, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,a0 */
+  { 0x407a, SETSSP | USES1 },			/* lds.l rm,a0 */
+  { 0x4082, STORE | SETS1 | USES1 | USESSP },	/* sts.l x0,@-rn */
+  { 0x4086, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,x0 */
+  { 0x408a, SETSSP | USES1 },			/* lds.l rm,x0 */
+  { 0x4092, STORE | SETS1 | USES1 | USESSP },	/* sts.l x1,@-rn */
+  { 0x4096, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,x1 */
+  { 0x409a, SETSSP | USES1 },			/* lds.l rm,x1 */
+  { 0x40a2, STORE | SETS1 | USES1 | USESSP },	/* sts.l y0,@-rn */
+  { 0x40a6, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,y0 */
+  { 0x40aa, SETSSP | USES1 },			/* lds.l rm,y0 */
+  { 0x40b2, STORE | SETS1 | USES1 | USESSP },	/* sts.l y1,@-rn */
+  { 0x40b6, LOAD | SETS1 | SETSSP | USES1 },	/* lds.l @rm+,y1 */
+  { 0x40ba, SETSSP | USES1 }			/* lds.l rm,y1 */
+#if 0 /* These groups sixteen insns can be
+         handled with one table entry each below.  */
+  { 0x4003, STORE | SETS1 | USES1 | USESSP },	/* stc.l sr,@-rn */
+  { 0x4013, STORE | SETS1 | USES1 | USESSP },	/* stc.l gbr,@-rn */
+  { 0x4023, STORE | SETS1 | USES1 | USESSP },	/* stc.l vbr,@-rn */
+  { 0x4033, STORE | SETS1 | USES1 | USESSP },	/* stc.l ssr,@-rn */
+  { 0x4043, STORE | SETS1 | USES1 | USESSP },	/* stc.l spc,@-rn */
+  { 0x4053, STORE | SETS1 | USES1 | USESSP },	/* stc.l mod,@-rn */
+  { 0x4063, STORE | SETS1 | USES1 | USESSP },	/* stc.l rs,@-rn */
+  { 0x4073, STORE | SETS1 | USES1 | USESSP },	/* stc.l re,@-rn */
+  { 0x4083, STORE | SETS1 | USES1 | USESSP },	/* stc.l r0_bank,@-rn */
+  ..
+  { 0x40f3, STORE | SETS1 | USES1 | USESSP },	/* stc.l r7_bank,@-rn */
+
+  { 0x4007, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,sr */
+  { 0x4017, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,gbr */
+  { 0x4027, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,vbr */
+  { 0x4037, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,ssr */
+  { 0x4047, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,spc */
+  { 0x4057, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,mod */
+  { 0x4067, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,rs */
+  { 0x4077, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,re */
+  { 0x4087, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,r0_bank */
+  ..
+  { 0x40f7, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,r7_bank */
+
+  { 0x400e, SETSSP | USES1 },			/* ldc rm,sr */
+  { 0x401e, SETSSP | USES1 },			/* ldc rm,gbr */
+  { 0x402e, SETSSP | USES1 },			/* ldc rm,vbr */
+  { 0x403e, SETSSP | USES1 },			/* ldc rm,ssr */
+  { 0x404e, SETSSP | USES1 },			/* ldc rm,spc */
+  { 0x405e, SETSSP | USES1 },			/* ldc rm,mod */
+  { 0x406e, SETSSP | USES1 },			/* ldc rm,rs */
+  { 0x407e, SETSSP | USES1 }			/* ldc rm,re */
+  { 0x408e, SETSSP | USES1 }			/* ldc rm,r0_bank */
+  ..
+  { 0x40fe, SETSSP | USES1 }			/* ldc rm,r7_bank */
+#endif
 };
 
 static const struct sh_opcode sh_opcode41[] =
 {
-  { 0x4083, STORE | SETS1 | USES1 | USESSP },	/* stc.l rx_bank,@-rn */
-  { 0x4087, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,rx_bank */
-  { 0x408e, SETSSP | USES1 }			/* ldc rm,rx_bank */
-};
-
-static const struct sh_opcode sh_opcode42[] =
-{
-  { 0x400c, SETS1 | USES1 | USES2 },			/* shad rm,rn */
-  { 0x400d, SETS1 | USES1 | USES2 },			/* shld rm,rn */
+  { 0x4003, STORE | SETS1 | USES1 | USESSP },	/* stc.l <special_reg>,@-rn */
+  { 0x4007, LOAD | SETS1 | SETSSP | USES1 },	/* ldc.l @rm+,<special_reg> */
+  { 0x400c, SETS1 | USES1 | USES2 },		/* shad rm,rn */
+  { 0x400d, SETS1 | USES1 | USES2 },		/* shld rm,rn */
+  { 0x400e, SETSSP | USES1 },			/* ldc rm,<special_reg> */
   { 0x400f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.w @rm+,@rn+ */
 };
 
 static const struct sh_minor_opcode sh_opcode4[] =
 {
   { MAP (sh_opcode40), 0xf0ff },
-  { MAP (sh_opcode41), 0xf08f },
-  { MAP (sh_opcode42), 0xf00f }
+  { MAP (sh_opcode41), 0xf00f }
 };
 
 static const struct sh_opcode sh_opcode50[] =
@@ -1705,12 +1943,15 @@
 {
   { 0x8000, STORE | USES2 | USESR0 },	/* mov.b r0,@(disp,rn) */
   { 0x8100, STORE | USES2 | USESR0 },	/* mov.w r0,@(disp,rn) */
+  { 0x8200, SETSSP },			/* setrc #imm */
   { 0x8400, LOAD | SETSR0 | USES2 },	/* mov.b @(disp,rm),r0 */
   { 0x8500, LOAD | SETSR0 | USES2 },	/* mov.w @(disp,rn),r0 */
   { 0x8800, SETSSP | USESR0 },		/* cmp/eq #imm,r0 */
   { 0x8900, BRANCH | USESSP },		/* bt label */
   { 0x8b00, BRANCH | USESSP },		/* bf label */
+  { 0x8c00, SETSSP },			/* ldrs @(disp,pc) */
   { 0x8d00, BRANCH | DELAY | USESSP },	/* bt/s label */
+  { 0x8e00, SETSSP },			/* ldre @(disp,pc) */
   { 0x8f00, BRANCH | DELAY | USESSP }	/* bf/s label */
 };
 
@@ -1832,7 +2073,7 @@
   { MAP (sh_opcodef1), 0xf0ff }
 };
 
-static const struct sh_major_opcode sh_opcodes[] =
+static struct sh_major_opcode sh_opcodes[] =
 {
   { MAP (sh_opcode0) },
   { MAP (sh_opcode1) },
@@ -1852,6 +2093,27 @@
   { MAP (sh_opcodef) }
 };
 
+/* The double data transfer / parallel processing insns are not
+   described here.  This will cause sh_align_load_span to leave them alone.  */
+
+static const struct sh_opcode sh_dsp_opcodef0[] =
+{
+  { 0xf400, USESAS | SETSAS | LOAD | SETSSP },	/* movs.x @-as,ds */
+  { 0xf401, USESAS | SETSAS | STORE | USESSP },	/* movs.x ds,@-as */
+  { 0xf404, USESAS | LOAD | SETSSP },		/* movs.x @as,ds */
+  { 0xf405, USESAS | STORE | USESSP },		/* movs.x ds,@as */
+  { 0xf408, USESAS | SETSAS | LOAD | SETSSP },	/* movs.x @as+,ds */
+  { 0xf409, USESAS | SETSAS | STORE | USESSP },	/* movs.x ds,@as+ */
+  { 0xf40c, USESAS | SETSAS | LOAD | SETSSP | USESR8 },	/* movs.x @as+r8,ds */
+  { 0xf40d, USESAS | SETSAS | STORE | USESSP | USESR8 }	/* movs.x ds,@as+r8 */
+};
+
+static const struct sh_minor_opcode sh_dsp_opcodef[] =
+{
+  { MAP (sh_dsp_opcodef0), 0xfc0d }
+};
+
+#ifndef COFF_IMAGE_WITH_PE
 /* Given an instruction, return a pointer to the corresponding
    sh_opcode structure.  Return NULL if the instruction is not
    recognized.  */
@@ -1885,6 +2147,20 @@
   return NULL;  
 }
 
+/* See whether an instruction uses or sets a general purpose register */
+
+static boolean
+sh_insn_uses_or_sets_reg (insn, op, reg)
+     unsigned int insn;
+     const struct sh_opcode *op;
+     unsigned int reg;
+{
+  if (sh_insn_uses_reg (insn, op, reg))
+    return true;
+
+  return sh_insn_sets_reg (insn, op, reg);
+}
+
 /* See whether an instruction uses a general purpose register.  */
 
 static boolean
@@ -1898,18 +2174,63 @@
   f = op->flags;
 
   if ((f & USES1) != 0
-      && ((insn & 0x0f00) >> 8) == reg)
+      && USES1_REG (insn) == reg)
     return true;
   if ((f & USES2) != 0
-      && ((insn & 0x00f0) >> 4) == reg)
+      && USES2_REG (insn) == reg)
     return true;
   if ((f & USESR0) != 0
       && reg == 0)
     return true;
+  if ((f & USESAS) && reg == USESAS_REG (insn))
+    return true;
+  if ((f & USESR8) && reg == 8)
+    return true;
 
   return false;
 }
 
+/* See whether an instruction sets a general purpose register.  */
+
+static boolean
+sh_insn_sets_reg (insn, op, reg)
+     unsigned int insn;
+     const struct sh_opcode *op;
+     unsigned int reg;
+{
+  unsigned int f;
+
+  f = op->flags;
+
+  if ((f & SETS1) != 0
+      && SETS1_REG (insn) == reg)
+    return true;
+  if ((f & SETS2) != 0
+      && SETS2_REG (insn) == reg)
+    return true;
+  if ((f & SETSR0) != 0
+      && reg == 0)
+    return true;
+  if ((f & SETSAS) && reg == SETSAS_REG (insn))
+    return true;
+
+  return false;
+}
+
+/* See whether an instruction uses or sets a floating point register */
+
+static boolean
+sh_insn_uses_or_sets_freg (insn, op, reg)
+     unsigned int insn;
+     const struct sh_opcode *op;
+     unsigned int reg;
+{
+  if (sh_insn_uses_freg (insn, op, reg))
+    return true;
+
+  return sh_insn_sets_freg (insn, op, reg);
+}
+
 /* See whether an instruction uses a floating point register.  */
 
 static boolean
@@ -1932,10 +2253,10 @@
      bit of the register number.  */
      
   if ((f & USESF1) != 0
-      && ((insn & 0x0e00) >> 8) == (freg & 0xe))
+      && (USESF1_REG (insn) & 0xe) == (freg & 0xe))
     return true;
   if ((f & USESF2) != 0
-      && ((insn & 0x00e0) >> 4) == (freg & 0xe))
+      && (USESF2_REG (insn) & 0xe) == (freg & 0xe))
     return true;
   if ((f & USESF0) != 0
       && freg == 0)
@@ -1944,6 +2265,34 @@
   return false;
 }
 
+/* See whether an instruction sets a floating point register.  */
+
+static boolean
+sh_insn_sets_freg (insn, op, freg)
+     unsigned int insn;
+     const struct sh_opcode *op;
+     unsigned int freg;
+{
+  unsigned int f;
+
+  f = op->flags;
+
+  /* We can't tell if this is a double-precision insn, so just play safe
+     and assume that it might be.  So not only have we test FREG against
+     itself, but also even FREG against FREG+1 - if the using insn uses
+     just the low part of a double precision value - but also an odd
+     FREG against FREG-1 -  if the setting insn sets just the low part
+     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;
+
+  return false;
+}
+
 /* See whether instructions I1 and I2 conflict, assuming I1 comes
    before I2.  OP1 and OP2 are the corresponding sh_opcode structures.
    This should return true if there is a conflict, or false if the
@@ -1971,35 +2320,41 @@
       || (f2 & (BRANCH | DELAY)) != 0)
     return true;
 
-  if ((f1 & SETSSP) != 0 && (f2 & USESSP) != 0)
-    return true;
-  if ((f2 & SETSSP) != 0 && (f1 & USESSP) != 0)
+  if (((f1 | f2) & SETSSP)
+      && (f1 & (SETSSP | USESSP))
+      && (f2 & (SETSSP | USESSP)))
     return true;
 
   if ((f1 & SETS1) != 0
-      && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8))
+      && sh_insn_uses_or_sets_reg (i2, op2, SETS1_REG (i1)))
     return true;
   if ((f1 & SETS2) != 0
-      && sh_insn_uses_reg (i2, op2, (i1 & 0x00f0) >> 4))
+      && sh_insn_uses_or_sets_reg (i2, op2, SETS2_REG (i1)))
     return true;
   if ((f1 & SETSR0) != 0
-      && sh_insn_uses_reg (i2, op2, 0))
+      && sh_insn_uses_or_sets_reg (i2, op2, 0))
+    return true;
+  if ((f1 & SETSAS)
+      && sh_insn_uses_or_sets_reg (i2, op2, SETSAS_REG (i1)))
     return true;
   if ((f1 & SETSF1) != 0
-      && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8))
+      && sh_insn_uses_or_sets_freg (i2, op2, SETSF1_REG (i1)))
     return true;
 
   if ((f2 & SETS1) != 0
-      && sh_insn_uses_reg (i1, op1, (i2 & 0x0f00) >> 8))
+      && sh_insn_uses_or_sets_reg (i1, op1, SETS1_REG (i2)))
     return true;
   if ((f2 & SETS2) != 0
-      && sh_insn_uses_reg (i1, op1, (i2 & 0x00f0) >> 4))
+      && sh_insn_uses_or_sets_reg (i1, op1, SETS2_REG (i2)))
     return true;
   if ((f2 & SETSR0) != 0
-      && sh_insn_uses_reg (i1, op1, 0))
+      && sh_insn_uses_or_sets_reg (i1, op1, 0))
+    return true;
+  if ((f2 & SETSAS)
+      && sh_insn_uses_or_sets_reg (i1, op1, SETSAS_REG (i2)))
     return true;
   if ((f2 & SETSF1) != 0
-      && sh_insn_uses_freg (i1, op1, (i2 & 0x0f00) >> 8))
+      && sh_insn_uses_or_sets_freg (i1, op1, SETSF1_REG (i2)))
     return true;
 
   /* The instructions do not conflict.  */
@@ -2052,6 +2407,9 @@
    STOP are the range of memory to examine.  If a swap is made,
    *PSWAPPED is set to true.  */
 
+#ifdef COFF_WITH_PE
+static
+#endif
 boolean
 _bfd_sh_align_load_span (abfd, sec, contents, swap, relocs,
 			 plabel, label_end, start, stop, pswapped)
@@ -2066,8 +2424,24 @@
      bfd_vma stop;
      boolean *pswapped;
 {
+  int dsp = (abfd->arch_info->mach == bfd_mach_sh_dsp
+	     || abfd->arch_info->mach == bfd_mach_sh3_dsp);
   bfd_vma i;
 
+  /* The SH4 has a Harvard architecture, hence aligning loads is not
+     desirable.  In fact, it is counter-productive, since it interferes
+     with the schedules generated by the compiler.  */
+  if (abfd->arch_info->mach == bfd_mach_sh4)
+    return true;
+
+  /* If we are linking sh[3]-dsp code, swap the FPU instructions for DSP
+     instructions.  */
+  if (dsp)
+    {
+      sh_opcodes[0xf].minor_opcodes = sh_dsp_opcodef;
+      sh_opcodes[0xf].count = sizeof sh_dsp_opcodef / sizeof sh_dsp_opcodef;
+    }
+
   /* Instructions should be aligned on 2 byte boundaries.  */
   if ((start & 1) == 1)
     ++start;
@@ -2097,7 +2471,28 @@
       if (i > start)
 	{
 	  prev_insn = bfd_get_16 (abfd, contents + i - 2);
-	  prev_op = sh_insn_info (prev_insn);
+	  /* If INSN is the field b of a parallel processing insn, it is not
+	     a load / store after all.  Note that the test here might mistake
+	     the field_b of a pcopy insn for the starting code of a parallel
+	     processing insn; this might miss a swapping opportunity, but at
+	     least we're on the safe side.  */
+	  if (dsp && (prev_insn & 0xfc00) == 0xf800)
+	    continue;
+
+	  /* Check if prev_insn is actually the field b of a parallel
+	     processing insn.  Again, this can give a spurious match
+	     after a pcopy.  */
+	  if (dsp && i - 2 > start)
+	    {
+	      unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4);
+	
+	      if ((pprev_insn & 0xfc00) == 0xf800)
+		prev_op = NULL;
+	      else
+		prev_op = sh_insn_info (prev_insn);
+	    }
+	  else
+	    prev_op = sh_insn_info (prev_insn);
 
 	  /* If the load/store instruction is in a delay slot, we
 	     can't swap.  */
@@ -2224,6 +2619,7 @@
 
   return true;
 }
+#endif /* not COFF_IMAGE_WITH_PE */
 
 /* Look for loads and stores which we can align to four byte
    boundaries.  See the longer comment above sh_relax_section for why
@@ -2437,7 +2833,7 @@
 static boolean
 sh_relocate_section (output_bfd, info, input_bfd, input_section, contents,
 		     relocs, syms, sections)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      bfd *input_bfd;
      asection *input_section;
@@ -2464,6 +2860,10 @@
       /* Almost all relocs have to do with relaxing.  If any work must
          be done for them, it has been done in sh_relax_section.  */
       if (rel->r_type != R_SH_IMM32
+#ifdef COFF_WITH_PE
+	  && rel->r_type != R_SH_IMM32CE
+	  && rel->r_type != R_SH_IMAGEBASE
+#endif
 	  && rel->r_type != R_SH_PCDISP)
 	continue;
 
@@ -2508,6 +2908,11 @@
 	  return false;
 	}
 
+#ifdef COFF_WITH_PE
+      if (rel->r_type == R_SH_IMAGEBASE)
+	addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
+#endif
+      
       val = 0;
 
       if (h == NULL)
@@ -2548,7 +2953,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
@@ -2704,90 +3109,29 @@
 
 /* The target vectors.  */
 
-const bfd_target shcoff_vec =
-{
-  "coff-sh",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
+#ifndef TARGET_SHL_SYM
+CREATE_BIG_COFF_TARGET_VEC (shcoff_vec, "coff-sh", BFD_IS_RELAXABLE, 0, '_', NULL)
+#endif
 
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE),
+#ifdef TARGET_SHL_SYM
+#define TARGET_SYM TARGET_SHL_SYM
+#else
+#define TARGET_SYM shlcoff_vec
+#endif
+     
+#ifndef TARGET_SHL_NAME
+#define TARGET_SHL_NAME "coff-shl"
+#endif
 
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
-  '_',				/* leading symbol underscore */
-  '/',				/* ar_pad_char */
-  15,				/* 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_getb64, bfd_getb_signed_64, bfd_putb64,
-  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-  bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+#ifdef COFF_WITH_PE
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
+			       SEC_CODE | SEC_DATA, '_', NULL);
+#else
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
+			       0, '_', NULL)
+#endif
 
-  {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-     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 */
-     _bfd_write_archive_contents, bfd_false},
-
-  BFD_JUMP_TABLE_GENERIC (coff),
-  BFD_JUMP_TABLE_COPY (coff),
-  BFD_JUMP_TABLE_CORE (_bfd_nocore),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
-const bfd_target shlcoff_vec =
-{
-  "coff-shl",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little endian too*/
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
-  '_',				/* leading symbol underscore */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-  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},   
-  {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),
-  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-  BFD_JUMP_TABLE_SYMBOLS (coff),
-  BFD_JUMP_TABLE_RELOCS (coff),
-  BFD_JUMP_TABLE_WRITE (coff),
-  BFD_JUMP_TABLE_LINK (coff),
-  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
-
+#ifndef TARGET_SHL_SYM
 /* Some people want versions of the SH COFF target which do not align
    to 16 byte boundaries.  We implement that by adding a couple of new
    target vectors.  These are just like the ones above, but they
@@ -2842,7 +3186,7 @@
   coff_swap_lineno_out, coff_swap_reloc_out,
   coff_swap_filehdr_out, coff_swap_aouthdr_out,
   coff_swap_scnhdr_out,
-  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ,
+  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
 #ifdef COFF_LONG_FILENAMES
   true,
 #else
@@ -2859,7 +3203,7 @@
   coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
   coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
-  coff_sym_is_global, coff_compute_section_file_positions,
+  coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
   coff_adjust_symndx, coff_link_add_one_symbol,
   coff_link_output_has_begun, coff_final_link_postscript
@@ -2874,6 +3218,8 @@
 #define coff_small_get_section_contents_in_window \
   coff_get_section_contents_in_window
 
+extern const bfd_target shlcoff_small_vec;
+
 const bfd_target shcoff_small_vec =
 {
   "coff-sh-small",		/* name */
@@ -2913,6 +3259,8 @@
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  & shlcoff_small_vec,
+  
   (PTR) &bfd_coff_small_swap_table
 };
 
@@ -2955,5 +3303,8 @@
   BFD_JUMP_TABLE_LINK (coff),
   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 bc2cf15..5e919da 100644
--- a/bfd/coff-sparc.c
+++ b/bfd/coff-sparc.c
@@ -1,5 +1,6 @@
 /* BFD back-end for Sparc COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -77,13 +78,13 @@
 static bfd_reloc_status_type
 bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
 			output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0)
@@ -158,7 +159,7 @@
 
 static reloc_howto_type *
 coff_sparc_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -202,55 +203,12 @@
 
 #include "coffcode.h"
 
-const bfd_target
-#ifdef TARGET_SYM
-  TARGET_SYM =
-#else
-  sparccoff_vec =
+#ifndef TARGET_SYM
+#define TARGET_SYM sparccoff_vec
 #endif
-{
-#ifdef TARGET_NAME
-  TARGET_NAME,
-#else
-  "coff-sparc",			/* name */
+
+#ifndef TARGET_NAME
+#define TARGET_NAME "coff-sparc"
 #endif
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,	/* data byte order is big */
-  BFD_ENDIAN_BIG,	/* header byte order is big */
 
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  '_',				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* 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_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
-/* 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 */
-       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),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index 21724fe..26dba40 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 386 COFF files (go32 variant with a stub).
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Robert Hoehne.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -39,6 +39,14 @@
 #define TARGET_NAME		"coff-go32-exe"
 #define TARGET_UNDERSCORE	'_'
 #define COFF_GO32_EXE
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }
 
 #include "bfd.h"
 
@@ -103,58 +111,6 @@
    host system */
 #define _H(index) (bfd_h_get_16(abfd, (bfd_byte *)(header+index*2)))
 
-/* This function checks if the bfd is a stubbed coff image */
-static const bfd_target *
-go32_stubbed_coff_object_p (abfd)
-     bfd *abfd;
-{
-  unsigned char header[10];
-  char magic[8];
-  unsigned long coff_start, exe_start;
-
-  if (bfd_read (&header, 1, sizeof (header), abfd) != sizeof (header))
-    {
-      if (bfd_get_error () != bfd_error_system_call)
-	bfd_set_error (bfd_error_wrong_format);
-      return 0;
-    }
-  if (_H (0) != 0x5a4d)		/* it is not an exe file. maybe a coff-image */
-    {
-      if (bfd_get_error () != bfd_error_system_call)
-	bfd_set_error (bfd_error_wrong_format);
-      return 0;
-    }
-  coff_start = (long) _H (2) * 512L;
-  if (_H (1))
-    coff_start += (long) _H (1) - 512L;
-
-  /* We can handle only a stub with a length of STUBSIZE */
-  if (coff_start != STUBSIZE)
-    {
-      bfd_set_error (bfd_error_wrong_format);
-      return 0;
-    }
-  exe_start = _H (4) * 16;
-  if (bfd_seek (abfd, exe_start, SEEK_SET) != 0)
-    return 0;
-  if (bfd_read (&magic, 1, 8, abfd) != 8)
-    {
-      if (bfd_get_error () != bfd_error_system_call)
-	bfd_set_error (bfd_error_wrong_format);
-      return 0;
-    }
-  if (memcmp (magic, "go32stub", 8) != 0)
-    {
-      bfd_set_error (bfd_error_wrong_format);
-      return 0;
-    }
-  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
-    return 0;
-
-  /* Call the normal COFF detection routine */
-  return coff_object_p (abfd);
-}
-
 /* These bytes are a 2048-byte DOS executable, which loads the COFF
    image into memory and then runs it. It is called 'stub' */
 
@@ -223,9 +179,9 @@
 
 static void
 adjust_filehdr_out_post  (abfd, in, out)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR in;
-     PTR out;
+     PTR out ATTRIBUTE_UNUSED;
 {
   struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
   /* undo the above change */
@@ -234,8 +190,8 @@
 
 static void
 adjust_scnhdr_in_post  (abfd, ext, in)
-     bfd *abfd;
-     PTR ext;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     PTR ext ATTRIBUTE_UNUSED;
      PTR in;
 {
   struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -247,9 +203,9 @@
 
 static void
 adjust_scnhdr_out_pre  (abfd, in, out)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR in;
-     PTR out;
+     PTR out ATTRIBUTE_UNUSED;
 {
   struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
 
@@ -260,9 +216,9 @@
 
 static void
 adjust_scnhdr_out_post (abfd, in, out)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR in;
-     PTR out;
+     PTR out ATTRIBUTE_UNUSED;
 {
   struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
 
@@ -273,12 +229,12 @@
 
 static void
 adjust_aux_in_post  (abfd, ext1, type, class, indx, numaux, in1)
-     bfd *abfd;
-     PTR ext1;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     PTR ext1 ATTRIBUTE_UNUSED;
      int type;
      int class;
-     int indx;
-     int numaux;
+     int indx ATTRIBUTE_UNUSED;
+     int numaux ATTRIBUTE_UNUSED;
      PTR in1;
 {
   union internal_auxent *in = (union internal_auxent *) in1;
@@ -291,13 +247,13 @@
 
 static void
 adjust_aux_out_pre  (abfd, inp, type, class, indx, numaux, extp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR inp;
      int type;
      int class;
-     int indx;
-     int numaux;
-     PTR extp;
+     int indx ATTRIBUTE_UNUSED;
+     int numaux ATTRIBUTE_UNUSED;
+     PTR extp ATTRIBUTE_UNUSED;
 {
   union internal_auxent *in = (union internal_auxent *) inp;
 
@@ -309,13 +265,13 @@
 
 static void
 adjust_aux_out_post (abfd, inp, type, class, indx, numaux, extp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR inp;
      int type;
      int class;
-     int indx;
-     int numaux;
-     PTR extp;
+     int indx ATTRIBUTE_UNUSED;
+     int numaux ATTRIBUTE_UNUSED;
+     PTR extp ATTRIBUTE_UNUSED;
 {
   union internal_auxent *in = (union internal_auxent *) inp;
 
diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c
index 3ff8c59..a971f76 100644
--- a/bfd/coff-tic30.c
+++ b/bfd/coff-tic30.c
@@ -1,5 +1,5 @@
 /* BFD back-end for TMS320C30 coff binaries.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -41,7 +41,7 @@
 	 "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
   HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL,
 	 "PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
-  {-1}
+  EMPTY_HOWTO (-1)
 };
 
 #ifndef coff_bfd_reloc_type_lookup
@@ -52,7 +52,7 @@
    and coff implementations. */
 reloc_howto_type *
 tic30_coff_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -202,5 +202,7 @@
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index 043c8a0..a8ade33 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
-   Copyright 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    Written by Fred Fish (fnf@cygnus.com)
 
@@ -359,13 +359,13 @@
 static bfd_reloc_status_type
 ppbase_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
 	      error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol_in ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   abort ();
@@ -376,13 +376,13 @@
 static bfd_reloc_status_type
 glob15_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
 	      error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol_in ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   abort ();
@@ -393,13 +393,13 @@
 static bfd_reloc_status_type
 glob16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
 	      error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol_in ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   abort ();
@@ -410,13 +410,13 @@
 static bfd_reloc_status_type
 local16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
 	      error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol_in ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   abort ();
@@ -452,11 +452,11 @@
 
 static reloc_howto_type *
 coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      struct internal_reloc *rel;
-     struct coff_link_hash_entry *h;
-     struct internal_syment *sym;
+     struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
+     struct internal_syment *sym ATTRIBUTE_UNUSED;
      bfd_vma *addendp;
 {
   arelent genrel;
@@ -576,7 +576,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
@@ -715,45 +715,4 @@
 #undef C_LASTENT		/* Clashes with TIc80's C_STATLAB */
 #include "coffcode.h"
 
-const bfd_target 
-  tic80coff_vec =
-{
-  "coff-tic80",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little (arch supports both) */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-  '_',				/* leading underscore */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-  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},
- {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),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE
- };
+CREATE_LITTLE_COFF_TARGET_VEC (tic80coff_vec, "coff-tic80", D_PAGED, 0, '_', NULL)
diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c
index 28d68c3..0379bfb 100644
--- a/bfd/coff-w65.c
+++ b/bfd/coff-w65.c
@@ -401,45 +401,4 @@
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-
-
-bfd_target w65_vec =
-{
-  "coff-w65",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_LITTLE,		/* data byte order is little */
-  BFD_ENDIAN_LITTLE,		/* header byte order is little */
-
-  (HAS_RELOC | EXEC_P |		/* object flags */
-   HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */
-  '_',				/* leading char */
-  '/',				/* ar_pad_char */
-  15,				/* ar_max_namelen */
-  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-  bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
-  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},
-  {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),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_LITTLE_COFF_TARGET_VEC (w65_vec, "coff-w95", BFD_IS_RELAXABLE, 0, '_', NULL)
diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c
index 826bbe3..c559ad7 100644
--- a/bfd/coff-we32k.c
+++ b/bfd/coff-we32k.c
@@ -1,5 +1,5 @@
 /* BFD back-end for we32k COFF files.
-   Copyright (C) 1992, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
    Contributed by Brendan Kehoe (brendan@cs.widener.edu).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -29,21 +29,21 @@
 
 static reloc_howto_type howto_table[] = 
 {
-    {0},
-    {1},
-    {2},
-    {3},
-    {4},
-    {5},
+    EMPTY_HOWTO (0),
+    EMPTY_HOWTO (1),
+    EMPTY_HOWTO (2),
+    EMPTY_HOWTO (3),
+    EMPTY_HOWTO (4),
+    EMPTY_HOWTO (5),
   HOWTO(R_DIR32,	       0,  2, 	32, false, 0,complain_overflow_bitfield, 0, "dir32",	true, 0xffffffff,0xffffffff, false),
-    {7},
-    {010},
-    {011},
-    {012},
-    {013},
-    {014},
-    {015},
-    {016},
+    EMPTY_HOWTO (7),
+    EMPTY_HOWTO (010),
+    EMPTY_HOWTO (011),
+    EMPTY_HOWTO (012),
+    EMPTY_HOWTO (013),
+    EMPTY_HOWTO (014),
+    EMPTY_HOWTO (015),
+    EMPTY_HOWTO (016),
   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),
   HOWTO(R_RELLONG,	       0,  2, 	32, false, 0, complain_overflow_bitfield, 0, "32",	true, 0xffffffff,0xffffffff, false),
@@ -65,45 +65,4 @@
 
 #define coff_write_armap bsd_write_armap
 
-const bfd_target we32kcoff_vec =
-{
-  "coff-we32k",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (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 */
-  15,				/* 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_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, coff_object_p, /* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (we32kcoff_vec, "coff-we32k", 0, 0, 0, NULL)
diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c
index 04049e89..21f29a8 100644
--- a/bfd/coff-z8k.c
+++ b/bfd/coff-z8k.c
@@ -237,44 +237,4 @@
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-const bfd_target z8kcoff_vec =
-{
-  "coff-z8k",			/* name */
-  bfd_target_coff_flavour,
-  BFD_ENDIAN_BIG,		/* data byte order is big */
-  BFD_ENDIAN_BIG,		/* header byte order is big */
-
-  (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 */
-  '_',				/* leading symbol underscore */
-  '/',				/* ar_pad_char */
-  15,				/* 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_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, coff_object_p,	/* bfd_check_format */
-   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 */
-   _bfd_write_archive_contents, bfd_false},
-
-     BFD_JUMP_TABLE_GENERIC (coff),
-     BFD_JUMP_TABLE_COPY (coff),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-     BFD_JUMP_TABLE_SYMBOLS (coff),
-     BFD_JUMP_TABLE_RELOCS (coff),
-     BFD_JUMP_TABLE_WRITE (coff),
-     BFD_JUMP_TABLE_LINK (coff),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-  COFF_SWAP_TABLE,
-};
+CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL)
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 383719c..8193a21 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1,5 +1,5 @@
 /* Support for the generic parts of most COFF variants, for BFD.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -131,7 +131,7 @@
 	moment. To port BFD, that person will have to add more @code{#defines}.
 	Three of the bit twiddling routines are exported to
 	@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
-	and @code{coff_swap_linno_in}. @code{GDB} reads the symbol
+	and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
 	table on its own, but uses BFD to fix things up.  More of the
 	bit twiddlers are exported for @code{gas};
 	@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
@@ -313,8 +313,12 @@
 #define STRING_SIZE_SIZE (4)
 
 static long sec_to_styp_flags PARAMS ((const char *, flagword));
-static flagword styp_to_sec_flags PARAMS ((bfd *, PTR, const char *));
+static flagword styp_to_sec_flags
+  PARAMS ((bfd *, PTR, const char *, asection *));
 static boolean coff_bad_format_hook PARAMS ((bfd *, PTR));
+static void coff_set_custom_section_alignment
+  PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
+	   const unsigned int));
 static boolean coff_new_section_hook PARAMS ((bfd *, asection *));
 static boolean coff_set_arch_mach_hook PARAMS ((bfd *, PTR));
 static boolean coff_write_relocs PARAMS ((bfd *, int));
@@ -329,6 +333,8 @@
 static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t));
 static boolean coff_slurp_line_table PARAMS ((bfd *, asection *));
 static boolean coff_slurp_symbol_table PARAMS ((bfd *));
+static enum coff_symbol_classification coff_classify_symbol
+  PARAMS ((bfd *, struct internal_syment *));
 static boolean coff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
 static long coff_canonicalize_reloc
   PARAMS ((bfd *, asection *, arelent **, asymbol **));
@@ -338,12 +344,13 @@
 
 /* void warning(); */
 
-/*
- * Return a word with STYP_* (scnhdr.s_flags) flags set to represent the
- * incoming SEC_* flags.  The inverse of this function is styp_to_sec_flags().
- * NOTE: If you add to/change this routine, you should mirror the changes
- * 	in styp_to_sec_flags().
- */
+/* Return a word with STYP_* (scnhdr.s_flags) flags set to represent
+   the incoming SEC_* flags.  The inverse of this function is
+   styp_to_sec_flags().  NOTE: If you add to/change this routine, you
+   should probably mirror the changes in styp_to_sec_flags().  */
+
+#ifndef COFF_WITH_PE
+
 static long
 sec_to_styp_flags (sec_name, sec_flags)
      CONST char *sec_name;
@@ -393,12 +400,6 @@
     {
       styp_flags = STYP_INFO;
     }
-#ifdef COFF_WITH_PE
-  else if (!strcmp (sec_name, ".edata"))
-    {
-      styp_flags = STYP_DATA;
-    }
-#endif
 #ifdef RS6000COFF_C
   else if (!strcmp (sec_name, _PAD))
     {
@@ -440,25 +441,93 @@
     styp_flags |= STYP_NOLOAD;
 #endif
 
-#ifdef COFF_WITH_PE
-  if (sec_flags & SEC_LINK_ONCE)
-    styp_flags |= IMAGE_SCN_LNK_COMDAT;
-#endif
-
-  return (styp_flags);
+  return styp_flags;
 }
-/*
- * Return a word with SEC_* flags set to represent the incoming
- * STYP_* flags (from scnhdr.s_flags).   The inverse of this
- * function is sec_to_styp_flags().
- * NOTE: If you add to/change this routine, you should mirror the changes
- *      in sec_to_styp_flags().
- */
+
+#else /* COFF_WITH_PE */
+
+/* The PE version; see above for the general comments.  The non-PE
+   case seems to be more guessing, and breaks PE format; specifically,
+   .rdata is readonly, but it sure ain't text.  Really, all this
+   should be set up properly in gas (or whatever assembler is in use),
+   and honor whatever objcopy/strip, etc. sent us as input.  */
+
+static long
+sec_to_styp_flags (sec_name, sec_flags)
+     const char *sec_name ATTRIBUTE_UNUSED;
+     flagword sec_flags;
+{
+  long styp_flags = 0;
+
+  /* caution: there are at least three groups of symbols that have
+     very similar bits and meanings: IMAGE_SCN*, SEC_*, and STYP_*.
+     SEC_* are the BFD internal flags, used for generic BFD
+     information.  STYP_* are the COFF section flags which appear in
+     COFF files.  IMAGE_SCN_* are the PE section flags which appear in
+     PE files.  The STYP_* flags and the IMAGE_SCN_* flags overlap,
+     but there are more IMAGE_SCN_* flags.  */
+
+  /* skip LOAD */
+  /* READONLY later */
+  /* skip RELOC */
+  if ((sec_flags & SEC_CODE) != 0)
+    styp_flags |= IMAGE_SCN_CNT_CODE;
+  if ((sec_flags & SEC_DATA) != 0)
+    styp_flags |= IMAGE_SCN_CNT_INITIALIZED_DATA;
+  if ((sec_flags & SEC_ALLOC) != 0 && (sec_flags & SEC_LOAD) == 0)
+    styp_flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA;  /* ==STYP_BSS */
+  /* skip ROM */
+  /* skip CONSTRUCTOR */
+  /* skip CONTENTS */
+#ifdef STYP_NOLOAD
+  if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
+    styp_flags |= STYP_NOLOAD;
+#endif
+  if ((sec_flags & SEC_IS_COMMON) != 0)
+    styp_flags |= IMAGE_SCN_LNK_COMDAT;
+  if ((sec_flags & SEC_DEBUGGING) != 0)
+    styp_flags |= IMAGE_SCN_MEM_DISCARDABLE;
+  if ((sec_flags & SEC_EXCLUDE) != 0)
+    styp_flags |= IMAGE_SCN_LNK_REMOVE;
+  if ((sec_flags & SEC_NEVER_LOAD) != 0)
+    styp_flags |= IMAGE_SCN_LNK_REMOVE;
+  /* skip IN_MEMORY */
+  /* skip SORT */
+  if (sec_flags & SEC_LINK_ONCE) 
+    styp_flags |= IMAGE_SCN_LNK_COMDAT; 
+  /* skip LINK_DUPLICATES */
+  /* skip LINKER_CREATED */
+
+  /* For now, the read/write bits are mapped onto SEC_READONLY, even
+     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. */
+  if ((sec_flags & SEC_READONLY) == 0)
+    styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write */
+  if (sec_flags & SEC_CODE)
+    styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE */
+  if (sec_flags & SEC_SHARED)
+    styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful */
+
+  return styp_flags; 
+}
+
+#endif /* COFF_WITH_PE */
+
+/* Return a word with SEC_* flags set to represent the incoming STYP_*
+   flags (from scnhdr.s_flags).  The inverse of this function is
+   sec_to_styp_flags().  NOTE: If you add to/change this routine, you
+   should probably mirror the changes in sec_to_styp_flags().  */
+
+#ifndef COFF_WITH_PE
+
 static flagword
-styp_to_sec_flags (abfd, hdr, name)
-     bfd *abfd;
+styp_to_sec_flags (abfd, hdr, name, section)
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR hdr;
      const char *name;
+     asection *section ATTRIBUTE_UNUSED;
 {
   struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
   long styp_flags = internal_s->s_flags;
@@ -573,10 +642,99 @@
     }
 #endif /* STYP_SDATA */
 
-#ifdef COFF_WITH_PE
+#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
+  /* 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
+     g++.  g++ will emit each template expansion in its own section.
+     The symbols will be defined as weak, so that multiple definitions
+     are permitted.  The GNU linker extension is to actually discard
+     all but one of the sections.  */
+  if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+    sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
+#endif
+
+  return sec_flags;
+}
+
+#else /* COFF_WITH_PE */
+
+/* The PE version; see above for the general comments.
+
+   Since to set the SEC_LINK_ONCE and associated flags, we have to
+   look at the symbol table anyway, we return the symbol table index
+   of the symbol being used as the COMDAT symbol.  This is admittedly
+   ugly, but there's really nowhere else that we have access to the
+   required information.  FIXME: Is the COMDAT symbol index used for
+   any purpose other than objdump?  */
+
+static flagword
+styp_to_sec_flags (abfd, hdr, name, section)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     PTR hdr;
+     const char *name;
+     asection *section;
+{
+  struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
+  long styp_flags = internal_s->s_flags;
+  flagword sec_flags = 0;
+
+  if (styp_flags & STYP_DSECT)
+    abort ();  /* Don't know what to do */
+#ifdef SEC_NEVER_LOAD
+  if (styp_flags & STYP_NOLOAD)
+    sec_flags |= SEC_NEVER_LOAD;
+#endif
+  if (styp_flags & STYP_GROUP)
+    abort ();  /* Don't know what to do */
+  /* skip IMAGE_SCN_TYPE_NO_PAD */
+  if (styp_flags & STYP_COPY)
+    abort ();  /* Don't know what to do */
+  if (styp_flags & IMAGE_SCN_CNT_CODE)
+    sec_flags |= SEC_CODE | SEC_ALLOC | SEC_LOAD;
+  if (styp_flags & IMAGE_SCN_CNT_INITIALIZED_DATA)
+    sec_flags |= SEC_DATA | SEC_ALLOC | SEC_LOAD;
+  if (styp_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
+    sec_flags |= SEC_ALLOC;
+  if (styp_flags & IMAGE_SCN_LNK_OTHER)
+    abort ();  /* Don't know what to do */
+  if (styp_flags & IMAGE_SCN_LNK_INFO)
+    {
+      /* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
+	 defined.  coff_compute_section_file_positions uses
+	 COFF_PAGE_SIZE to ensure that the low order bits of the
+	 section VMA and the file offset match.  If we don't know
+	 COFF_PAGE_SIZE, we can't ensure the correct correspondence,
+	 and demand page loading of the file will fail.  */
+#ifdef COFF_PAGE_SIZE
+      sec_flags |= SEC_DEBUGGING;
+#endif
+    }
+  if (styp_flags & STYP_OVER)
+    abort ();  /* Don't know what to do */
   if (styp_flags & IMAGE_SCN_LNK_REMOVE)
     sec_flags |= SEC_EXCLUDE;
 
+  if (styp_flags & IMAGE_SCN_MEM_SHARED)
+    sec_flags |= SEC_SHARED;
+  /* COMDAT: see below */
+  if (styp_flags & IMAGE_SCN_MEM_DISCARDABLE)
+    sec_flags |= SEC_DEBUGGING;
+  if (styp_flags & IMAGE_SCN_MEM_NOT_CACHED)
+    abort ();/* Don't know what to do */
+  if (styp_flags & IMAGE_SCN_MEM_NOT_PAGED)
+    abort (); /* Don't know what to do */
+
+  /* We infer from the distinct read/write/execute bits the settings
+     of some of the bfd flags; the actual values, should we need them,
+     are also in pei_section_data (abfd, section)->pe_flags.  */
+
+  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. */
+  if ((styp_flags & IMAGE_SCN_MEM_WRITE) == 0)
+    sec_flags |= SEC_READONLY;
+
+  /* COMDAT gets very special treatment.  */
   if (styp_flags & IMAGE_SCN_LNK_COMDAT)
     {
       sec_flags |= SEC_LINK_ONCE;
@@ -588,16 +746,30 @@
          can't call slurp_symtab, because the linker doesn't want the
          swapped symbols.  */
 
+      /* COMDAT sections are special.  The first symbol is the section
+	 symbol, which tells what kind of COMDAT section it is.  The
+	 second symbol is the "comdat symbol" - the one with the
+	 unique name.  GNU uses the section symbol for the unique
+	 name; MS uses ".text" for every comdat section.  Sigh.  - DJ */
+
+      /* This is not mirrored in sec_to_styp_flags(), but there
+	 doesn't seem to be a need to, either, and it would at best be
+	 rather messy.  */
+
       if (_bfd_coff_get_external_symbols (abfd))
 	{
-	  bfd_byte *esym, *esymend;
+	  bfd_byte *esymstart, *esym, *esymend;
+	  int seen_state = 0;
+	  char *target_name = NULL;
 
-	  esym = (bfd_byte *) obj_coff_external_syms (abfd);
-	  esymend = esym + obj_raw_syment_count (abfd) * SYMESZ;
+	  esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
+	  esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
 
 	  while (esym < esymend)
 	    {
 	      struct internal_syment isym;
+	      char buf[SYMNMLEN + 1];
+	      const char *symname;
 
 	      bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
 
@@ -608,65 +780,223 @@
 		  abort ();
 		}
 
-	      if (isym.n_sclass == C_STAT
-		  && isym.n_type == T_NULL
-		  && isym.n_numaux == 1)
+	      if (isym.n_scnum == section->target_index)
 		{
-		  char buf[SYMNMLEN + 1];
-		  const char *symname;
+		  /* According to the MSVC documentation, the first
+		     TWO entries with the section # are both of
+		     interest to us.  The first one is the "section
+		     symbol" (section name).  The second is the comdat
+		     symbol name.  Here, we've found the first
+		     qualifying entry; we distinguish it from the
+		     second with a state flag.
 
+		     In the case of gas-generated (at least until that
+		     is fixed) .o files, it isn't necessarily the
+		     second one.  It may be some other later symbol.
+
+		     Since gas also doesn't follow MS conventions and
+		     emits the section similar to .text$<name>, where
+		     <something> is the name we're looking for, we
+		     distinguish the two as follows:
+
+		     If the section name is simply a section name (no
+		     $) we presume it's MS-generated, and look at
+		     precisely the second symbol for the comdat name.
+		     If the section name has a $, we assume it's
+		     gas-generated, and look for <something> (whatever
+		     follows the $) as the comdat symbol.  */
+
+		  /* All 3 branches use this */
 		  symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
+
 		  if (symname == NULL)
 		    abort ();
 
-		  if (strcmp (name, symname) == 0)
+		  switch (seen_state)
 		    {
-		      union internal_auxent aux;
+		    case 0:
+		      {
+			/* The first time we've seen the symbol.  */
+			union internal_auxent aux;
 
-		      /* This is the section symbol.  */
+			seen_state = 1;
 
-		      bfd_coff_swap_aux_in (abfd, (PTR) (esym + SYMESZ),
-					    isym.n_type, isym.n_sclass,
-					    0, isym.n_numaux, (PTR) &aux);
+			/* If it isn't the stuff we're expecting, die;
+			   The MS documentation is vague, but it
+			   appears that the second entry serves BOTH
+			   as the comdat symbol and the defining
+			   symbol record (either C_STAT or C_EXT,
+			   possibly with an aux entry with debug
+			   information if it's a function.)  It
+			   appears the only way to find the second one
+			   is to count.  (On Intel, they appear to be
+			   adjacent, but on Alpha, they have been
+			   found separated.)
 
-		      switch (aux.x_scn.x_comdat)
-			{
-			case IMAGE_COMDAT_SELECT_NODUPLICATES:
-			  sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
-			  break;
+			   Here, we think we've found the first one,
+			   but there's some checking we can do to be
+			   sure.  */
 
-			default:
-			case IMAGE_COMDAT_SELECT_ANY:
-			  sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
-			  break;
+			if (! (isym.n_sclass == C_STAT
+			       && isym.n_type == T_NULL
+			       && isym.n_value == 0))
+			  abort ();
 
-			case IMAGE_COMDAT_SELECT_SAME_SIZE:
-			  sec_flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
-			  break;
+			/* FIXME LATER: MSVC generates section names
+			   like .text for comdats.  Gas generates
+			   names like .text$foo__Fv (in the case of a
+			   function).  See comment above for more.  */
 
-			case IMAGE_COMDAT_SELECT_EXACT_MATCH:
-			  sec_flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
-			  break;
+			if (strcmp (name, symname) != 0)
+			  abort ();
+  
+			/* This is the section symbol.  */
 
-			case IMAGE_COMDAT_SELECT_ASSOCIATIVE:
-			  /* FIXME: This is not currently implemented.  */
-			  sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
-			  break;
-			}
+			bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
+					      isym.n_type, isym.n_sclass,
+					      0, isym.n_numaux, (PTR) &aux);
 
+			target_name = strchr (name, '$');
+			if (target_name != NULL)
+			  {
+			    /* Gas mode.  */
+			    seen_state = 2;
+			    /* Skip the `$'.  */
+			    target_name += 1;
+			  }
+
+			/* FIXME: Microsoft uses NODUPLICATES and
+			   ASSOCIATIVE, but gnu uses ANY and
+			   SAME_SIZE.  Unfortunately, gnu doesn't do
+			   the comdat symbols right.  So, until we can
+			   fix it to do the right thing, we are
+			   temporarily disabling comdats for the MS
+			   types (they're used in DLLs and C++, but we
+			   don't support *their* C++ libraries anyway
+			   - DJ.  */
+
+			/* Cygwin does not follow the MS style, and
+			   uses ANY and SAME_SIZE where NODUPLICATES
+			   and ASSOCIATIVE should be used.  For
+			   Interix, we just do the right thing up
+			   front.  */
+
+			switch (aux.x_scn.x_comdat)
+			  {
+			  case IMAGE_COMDAT_SELECT_NODUPLICATES:
+#ifdef STRICT_PE_FORMAT 
+			    sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
+#else
+			    sec_flags &= ~SEC_LINK_ONCE;
+#endif
+			    break;
+
+			  case IMAGE_COMDAT_SELECT_ANY:
+			    sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
+			    break;
+
+			  case IMAGE_COMDAT_SELECT_SAME_SIZE:
+			    sec_flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
+			    break;
+
+			  case IMAGE_COMDAT_SELECT_EXACT_MATCH:
+			    /* Not yet fully implemented ??? */
+			    sec_flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
+			    break;
+
+			  /* debug$S gets this case; other
+                             implications ??? */
+
+			  /* There may be no symbol... we'll search
+			     the whole table... Is this the right
+			     place to play this game? Or should we do
+			     it when reading it in.  */
+			  case IMAGE_COMDAT_SELECT_ASSOCIATIVE:
+#ifdef STRICT_PE_FORMAT
+			    /* FIXME: This is not currently implemented.  */
+			    sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
+#else
+			    sec_flags &= ~SEC_LINK_ONCE;
+#endif
+			    break;
+
+			  default:  /* 0 means "no symbol" */
+			    /* debug$F gets this case; other
+                               implications ??? */
+			    sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
+			    break;
+			  }
+	 	      }
 		      break;
+
+		    case 2:
+		      /* Gas mode: the first matching on partial name.  */
+
+#ifndef TARGET_UNDERSCORE
+#define TARGET_UNDERSCORE 0
+#endif
+		      /* Is this the name we're looking for? */
+		      if (strcmp (target_name, 
+				  symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
+			{
+			    /* Not the name we're looking for */
+	                    esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
+			    continue;
+			}
+		      /* Fall through.  */
+		    case 1: 
+		      /* MSVC mode: the lexically second symbol (or
+			 drop through from the above).  */
+		      {
+		        char *newname;
+
+			/* This must the the second symbol with the
+			   section #.  It is the actual symbol name.
+			   Intel puts the two adjacent, but Alpha (at
+			   least) spreads them out.  */
+
+		        section->comdat = 
+			  bfd_alloc (abfd, sizeof (struct bfd_comdat_info));
+		        if (section->comdat == NULL)
+		          abort ();
+		        section->comdat->symbol =
+			  (esym - esymstart) / bfd_coff_symesz (abfd);
+
+		        newname = bfd_alloc (abfd, strlen (symname) + 1);
+		        if (newname == NULL)
+		          abort ();
+
+		        strcpy (newname, symname);
+		        section->comdat->name = newname;
+
+		      }
+
+		      goto breakloop;
 		    }
 		}
 
-	      esym += (isym.n_numaux + 1) * SYMESZ;
+	      esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
 	    }
+	  breakloop:
 	}
     }
+
+#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
+  /* 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
+     g++.  g++ will emit each template expansion in its own section.
+     The symbols will be defined as weak, so that multiple definitions
+     are permitted.  The GNU linker extension is to actually discard
+     all but one of the sections.  */
+  if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+    sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
 #endif
 
-  return (sec_flags);
+  return sec_flags;
 }
 
+#endif /* COFF_WITH_PE */
+
 #define	get_index(symbol)	((symbol)->udata.i)
 
 /*
@@ -675,6 +1005,22 @@
 
 CODE_FRAGMENT
 
+.{* COFF symbol classifications.  *}
+.
+.enum coff_symbol_classification
+.{
+.  {* Global symbol.  *}
+.  COFF_SYMBOL_GLOBAL,
+.  {* Common symbol.  *}
+.  COFF_SYMBOL_COMMON,
+.  {* Undefined symbol.  *}
+.  COFF_SYMBOL_UNDEFINED,
+.  {* Local symbol.  *}
+.  COFF_SYMBOL_LOCAL,
+.  {* PE section symbol.  *}
+.  COFF_SYMBOL_PE_SECTION
+.};
+.
 Special entry points for gdb to swap in coff symbol table parts:
 .typedef struct
 .{
@@ -750,6 +1096,7 @@
 . unsigned int _bfd_auxesz;
 . unsigned int _bfd_relsz;
 . unsigned int _bfd_linesz;
+. unsigned int _bfd_filnmlen;
 . boolean _bfd_coff_long_filenames;
 . boolean _bfd_coff_long_section_names;
 . unsigned int _bfd_coff_default_section_alignment_power;
@@ -782,7 +1129,8 @@
 . flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
 .       bfd     *abfd,
 .       PTR     internal_scnhdr,
-.       const char *name));
+.       const char *name,
+.       asection *section));
 . void (*_bfd_set_alignment_hook) PARAMS ((
 .       bfd     *abfd,
 .       asection *sec,
@@ -819,7 +1167,7 @@
 .       arelent *r,
 .       unsigned int shrink,
 .       struct bfd_link_info *link_info));
-. boolean (*_bfd_coff_sym_is_global) PARAMS ((
+. enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
 .       bfd *abfd,
 .       struct internal_syment *));
 . boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
@@ -910,6 +1258,7 @@
 .#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
 .#define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
 .#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
+.#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
 .#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
 .#define bfd_coff_long_section_names(abfd) \
 .        (coff_backend_info (abfd)->_bfd_coff_long_section_names)
@@ -935,8 +1284,9 @@
 .#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
 .        ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
 .
-.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
-.        ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
+.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
+.        ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
+.         (abfd, scnhdr, name, section))
 .
 .#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
 .        ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
@@ -959,8 +1309,8 @@
 .        ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
 .         (abfd, section, reloc, shrink, link_info))
 .
-.#define bfd_coff_sym_is_global(abfd, sym)\
-.        ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
+.#define bfd_coff_classify_symbol(abfd, sym)\
+.        ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
 .         (abfd, sym))
 .
 .#define bfd_coff_compute_section_file_positions(abfd)\
@@ -994,7 +1344,7 @@
 
 static boolean
 coff_bad_format_hook (abfd, filehdr)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      PTR filehdr;
 {
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1012,22 +1362,80 @@
      */
 
 #if defined(M88) || defined(I960)
-  if (internal_f->f_opthdr != 0 && AOUTSZ != internal_f->f_opthdr)
+  if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr)
     return false;
 #endif
 
   return true;
 }
 
-/*
-   initialize a section structure with information peculiar to this
-   particular implementation of coff
-*/
+/* Check whether this section uses an alignment other than the
+   default.  */
+
+static void
+coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section;
+     const struct coff_section_alignment_entry *alignment_table;
+     const unsigned int table_size;
+{
+  const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
+  unsigned int i;
+
+  for (i = 0; i < table_size; ++i)
+    {
+      const char *secname = bfd_get_section_name (abfd, section);
+      if (alignment_table[i].comparison_length == (unsigned int) -1
+	  ? strcmp (alignment_table[i].name, secname) == 0
+	  : strncmp (alignment_table[i].name, secname,
+		     alignment_table[i].comparison_length) == 0)
+	break;
+    }
+  if (i >= table_size)
+    return;
+
+  if (alignment_table[i].default_alignment_min != COFF_ALIGNMENT_FIELD_EMPTY
+      && default_alignment < alignment_table[i].default_alignment_min)
+    return;
+
+  if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
+      && default_alignment > alignment_table[i].default_alignment_max)
+    return;
+
+  section->alignment_power = alignment_table[i].alignment_power;
+}
+
+/* Custom section alignment records.  */
+
+static const struct coff_section_alignment_entry
+coff_section_alignment_table[] =
+{
+#ifdef COFF_SECTION_ALIGNMENT_ENTRIES
+  COFF_SECTION_ALIGNMENT_ENTRIES,
+#endif
+  /* There must not be any gaps between .stabstr sections.  */
+  { COFF_SECTION_NAME_PARTIAL_MATCH (".stabstr"),
+    1, COFF_ALIGNMENT_FIELD_EMPTY, 0 },
+  /* The .stab section must be aligned to 2**2 at most, to avoid gaps.  */
+  { COFF_SECTION_NAME_PARTIAL_MATCH (".stab"),
+    3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
+  /* Similarly for the .ctors and .dtors sections.  */
+  { COFF_SECTION_NAME_EXACT_MATCH (".ctors"),
+    3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
+  { COFF_SECTION_NAME_EXACT_MATCH (".dtors"),
+    3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
+};
+
+static const unsigned int coff_section_alignment_table_size =
+  sizeof coff_section_alignment_table / sizeof coff_section_alignment_table[0];
+
+/* Initialize a section structure with information peculiar to this
+   particular implementation of COFF.  */
 
 static boolean
 coff_new_section_hook (abfd, section)
-     bfd * abfd;
-     asection * section;
+     bfd *abfd;
+     asection *section;
 {
   combined_entry_type *native;
 
@@ -1063,22 +1471,9 @@
 
   coffsymbol (section->symbol)->native = native;
 
-  /* The .stab section must be aligned to 2**2 at most, because
-     otherwise there may be gaps in the section which gdb will not
-     know how to interpret.  Examining the section name is a hack, but
-     that is also how gdb locates the section.
-     We need to handle the .ctors and .dtors sections similarly, to
-     avoid introducing null words in the tables.  */
-  if (COFF_DEFAULT_SECTION_ALIGNMENT_POWER > 2
-      && (strncmp (section->name, ".stab", 5) == 0
-	  || strcmp (section->name, ".ctors") == 0
-	  || strcmp (section->name, ".dtors") == 0))
-    section->alignment_power = 2;
-
-  /* Similarly, the .stabstr section must be aligned to 2**0 at most.  */
-  if (COFF_DEFAULT_SECTION_ALIGNMENT_POWER > 0
-      && strncmp (section->name, ".stabstr", 8) == 0)
-    section->alignment_power = 0;
+  coff_set_custom_section_alignment (abfd, section,
+				     coff_section_alignment_table,
+				     coff_section_alignment_table_size);
 
   return true;
 }
@@ -1091,7 +1486,7 @@
 
 static void
 coff_set_alignment_hook (abfd, section, scnhdr)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      asection * section;
      PTR scnhdr;
 {
@@ -1131,7 +1526,7 @@
 
 static void
 coff_set_alignment_hook (abfd, section, scnhdr)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      asection * section;
      PTR scnhdr;
 {
@@ -1145,66 +1540,34 @@
   ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES,  1)
   ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES,  0)
 
-#ifdef POWERPC_LE_PE
-  if (strcmp (section->name, ".idata$2") == 0)
-    {
-      section->alignment_power = 0;
-    }
-  else if (strcmp (section->name, ".idata$3") == 0)
-    {
-      section->alignment_power = 0;
-    }
-  else if (strcmp (section->name, ".idata$4") == 0)
-    {
-      section->alignment_power = 2;
-    }
-  else if (strcmp (section->name, ".idata$5") == 0)
-    {
-      section->alignment_power = 2;
-    }
-  else if (strcmp (section->name, ".idata$6") == 0)
-    {
-      section->alignment_power = 1;
-    }
-  else if (strcmp (section->name, ".reloc") == 0)
-    {
-      section->alignment_power = 1;
-    }
-  else if (strncmp (section->name, ".stab", 5) == 0)
-    {
-      section->alignment_power = 2;
-    }
-#endif
-
-#ifdef COFF_IMAGE_WITH_PE
   /* In a PE image file, the s_paddr field holds the virtual size of a
-     section, while the s_size field holds the raw size.  */
-  if (hdr->s_paddr != 0)
+     section, while the s_size field holds the raw size.  We also keep
+     the original section flag value, since not every bit can be
+     mapped onto a generic BFD section bit.  */
+  if (coff_section_data (abfd, section) == NULL)
     {
-      if (coff_section_data (abfd, section) == NULL)
+      section->used_by_bfd =
+	(PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+      if (section->used_by_bfd == NULL)
 	{
-	  section->used_by_bfd =
-	    (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
-	  if (section->used_by_bfd == NULL)
-	    {
-	      /* FIXME: Return error.  */
-	      abort ();
-	    }
+	  /* FIXME: Return error.  */
+	  abort ();
 	}
-      if (pei_section_data (abfd, section) == NULL)
-	{
-	  coff_section_data (abfd, section)->tdata =
-	    (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
-	  if (coff_section_data (abfd, section)->tdata == NULL)
-	    {
-	      /* FIXME: Return error.  */
-	      abort ();
-	    }
-	}
-      pei_section_data (abfd, section)->virt_size = hdr->s_paddr;
     }
-#endif
+  if (pei_section_data (abfd, section) == NULL)
+    {
+      coff_section_data (abfd, section)->tdata =
+	(PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
+      if (coff_section_data (abfd, section)->tdata == NULL)
+	{
+	  /* FIXME: Return error.  */
+	  abort ();
+	}
+    }
+  pei_section_data (abfd, section)->virt_size = hdr->s_paddr;
+  pei_section_data (abfd, section)->pe_flags = hdr->s_flags;
 
+  section->lma = hdr->s_vaddr;
 }
 #undef ALIGN_SET
 #undef ELIFALIGN_SET
@@ -1290,7 +1653,7 @@
 coff_mkobject_hook (abfd, filehdr, aouthdr)
      bfd * abfd;
      PTR filehdr;
-     PTR aouthdr;
+     PTR aouthdr ATTRIBUTE_UNUSED;
 {
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
   coff_data_type *coff;
@@ -1309,9 +1672,11 @@
   coff->local_n_btshft = N_BTSHFT;
   coff->local_n_tmask = N_TMASK;
   coff->local_n_tshift = N_TSHIFT;
-  coff->local_symesz = SYMESZ;
-  coff->local_auxesz = AUXESZ;
-  coff->local_linesz = LINESZ;
+  coff->local_symesz = bfd_coff_symesz (abfd);
+  coff->local_auxesz = bfd_coff_auxesz (abfd);
+  coff->local_linesz = bfd_coff_linesz (abfd);
+
+  coff->timestamp = internal_f->f_timdat;
 
   obj_raw_syment_count (abfd) =
     obj_conv_table_size (abfd) =
@@ -1320,7 +1685,7 @@
 #ifdef RS6000COFF_C
   if ((internal_f->f_flags & F_SHROBJ) != 0)
     abfd->flags |= DYNAMIC;
-  if (aouthdr != NULL && internal_f->f_opthdr >= AOUTSZ)
+  if (aouthdr != NULL && internal_f->f_opthdr >= bfd_coff_aoutsz (abfd))
     {
       struct internal_aouthdr *internal_a =
 	(struct internal_aouthdr *) aouthdr;
@@ -1346,6 +1711,13 @@
     coff->flags = 0;
 #endif
   
+#ifdef COFF_WITH_PE
+  /* FIXME: I'm not sure this is ever executed, since peicode.h
+     defines coff_mkobject_hook.  */
+  if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
+    abfd->flags |= HAS_DEBUG;
+#endif
+
   return (PTR) coff;
 }
 #endif
@@ -1393,14 +1765,19 @@
 #endif
 #ifdef ARMMAGIC
     case ARMMAGIC:
+    case ARMPEMAGIC:
+    case THUMBPEMAGIC:
       arch = bfd_arch_arm;
       switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
 	{
-	case F_ARM_2:  machine = bfd_mach_arm_2;  break;
-	case F_ARM_3:  machine = bfd_mach_arm_3;  break;
-	default:
-	case F_ARM_4:  machine = bfd_mach_arm_4;  break;
-	case F_ARM_4T: machine = bfd_mach_arm_4T; break;
+        case F_ARM_2:  machine = bfd_mach_arm_2;  break;
+        case F_ARM_2a: machine = bfd_mach_arm_2a; break;
+        case F_ARM_3:  machine = bfd_mach_arm_3;  break;
+        default:
+        case F_ARM_3M: machine = bfd_mach_arm_3M; break;
+        case F_ARM_4:  machine = bfd_mach_arm_4;  break;
+        case F_ARM_4T: machine = bfd_mach_arm_4T; break;
+        case F_ARM_5:  machine = bfd_mach_arm_5;  break;
 	}
       break;
 #endif
@@ -1505,17 +1882,23 @@
 	      cputype = 0;
 	    else
 	      {
-		bfd_byte buf[SYMESZ];
+		bfd_byte *buf;
 		struct internal_syment sym;
 
+		buf = (bfd_byte *) bfd_malloc (bfd_coff_symesz (abfd));
 		if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
-		    || bfd_read (buf, 1, SYMESZ, abfd) != SYMESZ)
-		  return false;
+		    || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd) 
+			!= bfd_coff_symesz (abfd)))
+		  {
+		    free (buf);
+		    return false;
+		  }
 		coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym);
 		if (sym.n_sclass == C_FILE)
 		  cputype = sym.n_type & 0xff;
 		else
 		  cputype = 0;
+		free (buf);
 	      }
 	  }
 
@@ -1594,11 +1977,21 @@
 #ifdef SH_ARCH_MAGIC_BIG
     case SH_ARCH_MAGIC_BIG:
     case SH_ARCH_MAGIC_LITTLE:
+#ifdef COFF_WITH_PE
+    case SH_ARCH_MAGIC_WINCE:
+#endif
       arch = bfd_arch_sh;
       machine = 0;
       break;
 #endif
 
+#ifdef MIPS_ARCH_MAGIC_WINCE
+    case MIPS_ARCH_MAGIC_WINCE:
+      arch = bfd_arch_mips;
+      machine = 0;
+      break;
+#endif
+
 #ifdef H8500MAGIC
     case H8500MAGIC:
       arch = bfd_arch_h8500;
@@ -1649,7 +2042,7 @@
 
 static boolean
 symname_in_debug_hook (abfd, sym)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      struct internal_syment *sym;
 {
   return SYMNAME_IN_DEBUG (sym) ? true : false;
@@ -1673,7 +2066,7 @@
 /*ARGSUSED*/
 static boolean
 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      combined_entry_type *table_base;
      combined_entry_type *symbol;
      unsigned int indaux;
@@ -1713,11 +2106,11 @@
 /*ARGSUSED*/
 static boolean
 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
-     bfd *abfd;
-     combined_entry_type *table_base;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     combined_entry_type *table_base ATTRIBUTE_UNUSED;
      combined_entry_type *symbol;
      unsigned int indaux;
-     combined_entry_type *aux;
+     combined_entry_type *aux ATTRIBUTE_UNUSED;
 {
   /* Return true if we don't want to pointerize this aux entry, which
      is the case for the lastfirst aux entry for a C_LEAFPROC symbol.  */
@@ -1742,12 +2135,12 @@
 
 static boolean
 coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
-     bfd *abfd;
-     FILE *file;
-     combined_entry_type *table_base;
-     combined_entry_type *symbol;
-     combined_entry_type *aux;
-     unsigned int indaux;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     FILE *file ATTRIBUTE_UNUSED;
+     combined_entry_type *table_base ATTRIBUTE_UNUSED;
+     combined_entry_type *symbol ATTRIBUTE_UNUSED;
+     combined_entry_type *aux ATTRIBUTE_UNUSED;
+     unsigned int indaux ATTRIBUTE_UNUSED;
 {
 #ifdef RS6000COFF_C
   if ((symbol->u.syment.n_sclass == C_EXT
@@ -1893,7 +2286,11 @@
 #endif
 	    if (q->sym_ptr_ptr)
 	      {
+#ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
+                if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
+#else
 		if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr)
+#endif
 		  /* This is a relocation relative to the absolute symbol.  */
 		  n.r_symndx = -1;
 		else
@@ -1918,7 +2315,8 @@
 	  n.r_type = q->howto->type;
 #endif
 	  coff_swap_reloc_out (abfd, &n, &dst);
-	  if (bfd_write ((PTR) & dst, 1, RELSZ, abfd) != RELSZ)
+	  if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
+	      != bfd_coff_relsz (abfd))
 	    return false;
 	}
 
@@ -1937,8 +2335,8 @@
 static boolean
 coff_set_flags (abfd, magicp, flagsp)
      bfd * abfd;
-     unsigned int *magicp;
-     unsigned short *flagsp;
+     unsigned int *magicp ATTRIBUTE_UNUSED;
+     unsigned short *flagsp ATTRIBUTE_UNUSED;
 {
   switch (bfd_get_arch (abfd))
     {
@@ -2016,7 +2414,11 @@
 #endif
 #ifdef ARMMAGIC
     case bfd_arch_arm:
+#ifdef ARM_WINCE
+      * magicp = ARMPEMAGIC;
+#else
       * magicp = ARMMAGIC;
+#endif
       * flagsp = 0;
       if (APCS_SET (abfd))
 	{
@@ -2027,7 +2429,7 @@
 	    * flagsp |= F_APCS_FLOAT;
 	  
 	  if (PIC_FLAG (abfd))
-	    * flagsp |= F_PIC_INT;
+	    * flagsp |= F_PIC;
 	}
       if (INTERWORK_SET (abfd) && INTERWORK_FLAG (abfd))
 	* flagsp |= F_INTERWORK;
@@ -2039,6 +2441,8 @@
 	case bfd_mach_arm_3M: * flagsp |= F_ARM_3M; break;
 	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 */
 	}
       return true;
 #endif
@@ -2109,10 +2513,21 @@
 
 #ifdef SH_ARCH_MAGIC_BIG
     case bfd_arch_sh:
+#ifdef COFF_IMAGE_WITH_PE
+      *magicp = SH_ARCH_MAGIC_WINCE;
+#else
       if (bfd_big_endian (abfd))
 	*magicp = SH_ARCH_MAGIC_BIG;
       else
 	*magicp = SH_ARCH_MAGIC_LITTLE;
+#endif
+      return true;
+      break;
+#endif
+
+#ifdef MIPS_ARCH_MAGIC_WINCE
+    case bfd_arch_mips:
+      *magicp = MIPS_ARCH_MAGIC_WINCE;
       return true;
       break;
 #endif
@@ -2196,6 +2611,30 @@
   return true;			/* We're easy ... */
 }
 
+#ifdef COFF_IMAGE_WITH_PE
+
+/* This is used to sort sections by VMA, as required by PE image
+   files.  */
+
+static int sort_by_secaddr PARAMS ((const PTR, const PTR));
+
+static int
+sort_by_secaddr (arg1, arg2)
+     const PTR arg1;
+     const PTR arg2;
+{
+  const asection *a = *(const asection **) arg1;
+  const asection *b = *(const asection **) arg2;
+
+  if (a->vma < b->vma)
+    return -1;
+  else if (a->vma > b->vma)
+    return 1;
+  else
+    return 0;
+}
+
+#endif /* COFF_IMAGE_WITH_PE */
 
 /* Calculate the file position for each section. */
 
@@ -2212,9 +2651,8 @@
 {
   asection *current;
   asection *previous = (asection *) NULL;
-  file_ptr sofar = FILHSZ;
+  file_ptr sofar = bfd_coff_filhsz (abfd);
   boolean align_adjust;
-  unsigned int count;
 #ifdef ALIGN_SECTIONS_IN_FILE
   file_ptr old_sofar;
 #endif
@@ -2280,48 +2718,132 @@
     }
 
   if (abfd->flags & EXEC_P)
-    sofar += AOUTSZ;
+    sofar += bfd_coff_aoutsz (abfd);
 #ifdef RS6000COFF_C
   else if (xcoff_data (abfd)->full_aouthdr)
-    sofar += AOUTSZ;
+    sofar += bfd_coff_aoutsz (abfd);
   else
     sofar += SMALL_AOUTSZ;
 #endif
 
-  sofar += abfd->section_count * SCNHSZ;
+  sofar += abfd->section_count * bfd_coff_scnhsz (abfd);
 
 #ifdef RS6000COFF_C
   /* XCOFF handles overflows in the reloc and line number count fields
      by allocating a new section header to hold the correct counts.  */
   for (current = abfd->sections; current != NULL; current = current->next)
     if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
-      sofar += SCNHSZ;
+      sofar += bfd_coff_scnhsz (abfd);
 #endif
 
+#ifdef COFF_IMAGE_WITH_PE
+  {
+    /* PE requires the sections to be in memory order when listed in
+       the section headers.  It also does not like empty loadable
+       sections.  The sections apparently do not have to be in the
+       right order in the image file itself, but we do need to get the
+       target_index values right.  */
+
+    int count;
+    asection **section_list;
+    int i;
+    int target_index;
+
+    count = 0;
+    for (current = abfd->sections; current != NULL; current = current->next)
+      ++count;
+
+    /* We allocate an extra cell to simplify the final loop.  */
+    section_list = bfd_malloc (sizeof (struct asection *) * (count + 1));
+    if (section_list == NULL)
+      return false;
+
+    i = 0;
+    for (current = abfd->sections; current != NULL; current = current->next)
+      {
+	section_list[i] = current;
+	++i;
+      }
+    section_list[i] = NULL;
+
+    qsort (section_list, count, sizeof (asection *), sort_by_secaddr);
+
+    /* Rethread the linked list into sorted order; at the same time,
+       assign target_index values.  */
+    target_index = 1;
+    abfd->sections = section_list[0];
+    for (i = 0; i < count; i++)
+      {
+	current = section_list[i];
+	current->next = section_list[i + 1];
+
+	/* Later, if the section has zero size, we'll be throwing it
+	   away, so we don't want to number it now.  Note that having
+	   a zero size and having real contents are different
+	   concepts: .bss has no contents, but (usually) non-zero
+	   size.  */
+	if (current->_raw_size == 0)
+	  {
+	    /* Discard.  However, it still might have (valid) symbols
+	       in it, so arbitrarily set it to section 1 (indexing is
+	       1-based here; usually .text).  __end__ and other
+	       contents of .endsection really have this happen.
+	       FIXME: This seems somewhat dubious.  */
+	    current->target_index = 1;
+	  }
+	else
+	  current->target_index = target_index++;
+      }
+
+    free (section_list);
+  }
+#else /* ! COFF_IMAGE_WITH_PE */
+  {
+    /* Set the target_index field.  */
+    int target_index;
+
+    target_index = 1;
+    for (current = abfd->sections; current != NULL; current = current->next)
+      current->target_index = target_index++;
+  }
+#endif /* ! COFF_IMAGE_WITH_PE */
+
   align_adjust = false;
-  for (current = abfd->sections, count = 1;
+  for (current = abfd->sections;
        current != (asection *) NULL;
-       current = current->next, ++count)
+       current = current->next)
     {
 #ifdef COFF_IMAGE_WITH_PE
-      /* The NT loader does not want empty section headers, so we omit
-         them.  We don't actually remove the section from the BFD,
-         although we probably should.  This matches code in
-         coff_write_object_contents.  */
-      if (current->_raw_size == 0)
+      /* With PE we have to pad each section to be a multiple of its
+	 page size too, and remember both sizes.  */
+      if (coff_section_data (abfd, current) == NULL)
 	{
-	  current->target_index = -1;
-	  --count;
-	  continue;
+	  current->used_by_bfd =
+	    (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+	  if (current->used_by_bfd == NULL)
+	    return false;
 	}
+      if (pei_section_data (abfd, current) == NULL)
+	{
+	  coff_section_data (abfd, current)->tdata =
+	    (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
+	  if (coff_section_data (abfd, current)->tdata == NULL)
+	    return false;
+	}
+      if (pei_section_data (abfd, current)->virt_size == 0)
+	pei_section_data (abfd, current)->virt_size = current->_raw_size;
 #endif
 
-      current->target_index = count;
-
-      /* Only deal with sections which have contents */
+      /* Only deal with sections which have contents.  */
       if (!(current->flags & SEC_HAS_CONTENTS))
 	continue;
 
+#ifdef COFF_IMAGE_WITH_PE
+      /* Make sure we skip empty sections in a PE image.  */
+      if (current->_raw_size == 0)
+	continue;
+#endif
+
       /* 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
@@ -2352,26 +2874,7 @@
       current->filepos = sofar;
 
 #ifdef COFF_IMAGE_WITH_PE
-      /* With PE we have to pad each section to be a multiple of its
-	 page size too, and remember both sizes.  */
-
-      if (coff_section_data (abfd, current) == NULL)
-	{
-	  current->used_by_bfd =
-	    (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
-	  if (current->used_by_bfd == NULL)
-	    return false;
-	}
-      if (pei_section_data (abfd, current) == NULL)
-	{
-	  coff_section_data (abfd, current)->tdata =
-	    (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
-	  if (coff_section_data (abfd, current)->tdata == NULL)
-	    return false;
-	}
-      if (pei_section_data (abfd, current)->virt_size == 0)
-	pei_section_data (abfd, current)->virt_size = current->_raw_size;
-
+      /* Set the padded size.  */
       current->_raw_size = (current->_raw_size + page_size -1) & -page_size;
 #endif
 
@@ -2528,6 +3031,7 @@
   asection *current;
   boolean hasrelocs = false;
   boolean haslinno = false;
+  boolean hasdebug = false;
   file_ptr scn_base;
   file_ptr reloc_base;
   file_ptr lineno_base;
@@ -2549,7 +3053,7 @@
   /* Make a pass through the symbol table to count line number entries and
      put them into the correct asections */
 
-  lnno_size = coff_count_linenumbers (abfd) * LINESZ;
+  lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
 
   if (abfd->output_has_begun == false)
     {
@@ -2563,7 +3067,7 @@
 
   for (current = abfd->sections; current != NULL; current =
        current->next)
-    reloc_size += current->reloc_count * RELSZ;
+    reloc_size += current->reloc_count * bfd_coff_relsz (abfd);
 
   lineno_base = reloc_base + reloc_size;
   sym_base = lineno_base + lnno_size;
@@ -2576,7 +3080,7 @@
 	{
 	  current->line_filepos = lineno_base;
 	  current->moving_line_filepos = lineno_base;
-	  lineno_base += current->lineno_count * LINESZ;
+	  lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
 	}
       else
 	{
@@ -2585,7 +3089,7 @@
       if (current->reloc_count)
 	{
 	  current->rel_filepos = reloc_base;
-	  reloc_base += current->reloc_count * RELSZ;
+	  reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
 	}
       else
 	{
@@ -2597,13 +3101,13 @@
   internal_f.f_nscns = 0;
 
   if ((abfd->flags & EXEC_P) != 0)
-    scn_base = FILHSZ + AOUTSZ;
+    scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
   else
     {
-      scn_base = FILHSZ;
+      scn_base = bfd_coff_filhsz (abfd);
 #ifdef RS6000COFF_C
       if (xcoff_data (abfd)->full_aouthdr)
-	scn_base += AOUTSZ;
+	scn_base += bfd_coff_aoutsz (abfd);
       else
 	scn_base += SMALL_AOUTSZ;
 #endif
@@ -2618,25 +3122,24 @@
        current = current->next)
     {
       struct internal_scnhdr section;
-
-#ifdef COFF_WITH_PE
-      /* If we've got a .reloc section, remember. */
+      boolean is_reloc_section = false;
 
 #ifdef COFF_IMAGE_WITH_PE
       if (strcmp (current->name, ".reloc") == 0)
 	{
+	  is_reloc_section = true;
+	  hasrelocs = true;
 	  pe_data (abfd)->has_reloc_section = 1;
 	}
 #endif
 
-#endif
       internal_f.f_nscns++;
 
       strncpy (section.s_name, current->name, SCNNMLEN);
 
 #ifdef COFF_LONG_SECTION_NAMES
       /* Handle long section names as in PE.  This must be compatible
-         with the code in coff_write_symbols.  */
+         with the code in coff_write_symbols and _bfd_coff_final_link.  */
       {
 	size_t len;
 
@@ -2691,10 +3194,16 @@
       section.s_lnnoptr = current->line_filepos;
       section.s_nreloc = current->reloc_count;
       section.s_nlnno = current->lineno_count;
+#ifndef COFF_IMAGE_WITH_PE
+      /* In PEI, relocs come in the .reloc section.  */
       if (current->reloc_count != 0)
 	hasrelocs = true;
+#endif
       if (current->lineno_count != 0)
 	haslinno = true;
+      if ((current->flags & SEC_DEBUGGING) != 0
+	  && ! is_reloc_section)
+	hasdebug = true;
 
 #ifdef RS6000COFF_C
       /* Indicate the use of an XCOFF overflow section header.  */
@@ -2731,10 +3240,11 @@
 #endif
 
 #ifdef COFF_IMAGE_WITH_PE
-      /* suppress output of the sections if they are null.  ld includes
-	 the bss and data sections even if there is no size assigned
-	 to them.  NT loader doesn't like it if these section headers are
-	 included if the sections themselves are not needed */
+      /* Suppress output of the sections if they are null.  ld
+	 includes the bss and data sections even if there is no size
+	 assigned to them.  NT loader doesn't like it if these section
+	 headers are included if the sections themselves are not
+	 needed.  See also coff_compute_section_file_positions.  */
       if (section.s_size == 0)
 	internal_f.f_nscns--;
       else
@@ -2742,7 +3252,8 @@
 	{
 	  SCNHDR buff;
 	  if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
-	      || bfd_write ((PTR) (&buff), 1, SCNHSZ, abfd) != SCNHSZ)
+	      || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd)
+	           != bfd_coff_scnhsz (abfd))
 	    return false;
 	}
 
@@ -2863,7 +3374,8 @@
 	  scnhdr.s_nlnno = current->target_index;
 	  scnhdr.s_flags = STYP_OVRFLO;
 	  if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
-	      || bfd_write ((PTR) &buff, 1, SCNHSZ, abfd) != SCNHSZ)
+	      || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd)
+	           != bfd_coff_scnhsz (abfd))
 	    return false;
 	}
     }
@@ -2884,13 +3396,13 @@
   internal_f.f_flags = 0;
 
   if (abfd->flags & EXEC_P)
-    internal_f.f_opthdr = AOUTSZ;
+    internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
   else
     {
       internal_f.f_opthdr = 0;
 #ifdef RS6000COFF_C
       if (xcoff_data (abfd)->full_aouthdr)
-	internal_f.f_opthdr = AOUTSZ;
+	internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
       else
 	internal_f.f_opthdr = SMALL_AOUTSZ;
 #endif
@@ -2902,12 +3414,17 @@
     internal_f.f_flags |= F_LNNO;
   if (abfd->flags & EXEC_P)
     internal_f.f_flags |= F_EXEC;
+#ifdef COFF_IMAGE_WITH_PE
+  if (! hasdebug)
+    internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED;
+#endif
 
-  /* FIXME: this is wrong for PPC_PE! */
+#ifndef COFF_WITH_PE
   if (bfd_little_endian (abfd))
     internal_f.f_flags |= F_AR32WR;
   else
     internal_f.f_flags |= F_AR32W;
+#endif
 
 #ifdef TIC80_TARGET_ID
   internal_f.f_target_id = TIC80_TARGET_ID;
@@ -3028,6 +3545,16 @@
     RS6K_AOUTHDR_OMAGIC;
 #endif
 
+#if defined(SH) && defined(COFF_WITH_PE)
+#define __A_MAGIC_SET__
+    internal_a.magic = SH_PE_MAGIC;
+#endif
+
+#if defined(MIPS) && defined(COFF_WITH_PE)
+#define __A_MAGIC_SET__
+    internal_a.magic = MIPS_PE_MAGIC;
+#endif
+
 #ifndef __A_MAGIC_SET__
 #include "Your aouthdr magic number is not being set!"
 #else
@@ -3200,19 +3727,41 @@
   /* now write them */
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
     return false;
+  
   {
-    char buff[FILHSZ];
+    char * buff;
+    bfd_size_type amount;
+    
+    buff = bfd_malloc (bfd_coff_filhsz (abfd));
+    if (buff == NULL) 
+      return false;
+    
     coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
-    if (bfd_write ((PTR) buff, 1, FILHSZ, abfd) != FILHSZ)
+    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)) */
-      char buff[AOUTSZ];
+      char * buff;
+      bfd_size_type amount;
+
+      buff = bfd_malloc (bfd_coff_aoutsz (abfd));
+      if (buff == NULL) 
+	return false;
+      
       coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
-      if (bfd_write ((PTR) buff, 1, AOUTSZ, abfd) != AOUTSZ)
+      amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd);
+      
+      free (buff);
+      
+      if (amount != bfd_coff_aoutsz (abfd))
 	return false;
     }
 #ifdef RS6000COFF_C
@@ -3224,7 +3773,7 @@
       /* XCOFF seems to always write at least a small a.out header.  */
       coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) &buff);
       if (xcoff_data (abfd)->full_aouthdr)
-	size = AOUTSZ;
+	size = bfd_coff_aoutsz (abfd);
       else
 	size = SMALL_AOUTSZ;
       if (bfd_write ((PTR) &buff, 1, size, abfd) != size)
@@ -3359,6 +3908,9 @@
 	base of the line number information for the table is stored in
 	the symbol associated with the function.
 
+	Note: The PE format uses line number 0 for a flag indicating a
+	new source file.
+
 	The information is copied from the external to the internal
 	table, and each symbol which marks a function is marked by
 	pointing its...
@@ -3380,7 +3932,7 @@
   native_lineno = (LINENO *) buy_and_read (abfd,
 					   asect->line_filepos,
 					   SEEK_SET,
-					   (size_t) (LINESZ *
+					   (size_t) (bfd_coff_linesz (abfd) *
 						     asect->lineno_count));
   lineno_cache =
     (alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent)));
@@ -3448,6 +4000,10 @@
   return true;
 }
 
+/* Slurp in the symbol table, converting it to generic form.  Note
+   that if coff_relocate_section is defined, the linker will read
+   symbols via coff_link_add_symbols, rather than via this routine.  */
+
 static boolean
 coff_slurp_symbol_table (abfd)
      bfd * abfd;
@@ -3527,31 +4083,15 @@
 	    case C_SYSTEM:	/* System Wide variable */
 #endif
 #ifdef COFF_WITH_PE
-            /* PE uses storage class 0x68 to denote a section symbol */
+            /* In PE, 0x68 (104) denotes a section symbol */
             case C_SECTION:
-	    /* PE uses storage class 0x69 for a weak external symbol.  */
+	    /* In PE, 0x69 (105) denotes a weak external symbol.  */
 	    case C_NT_WEAK:
 #endif
-	      if ((src->u.syment.n_scnum) == 0)
+	      switch (coff_classify_symbol (abfd, &src->u.syment))
 		{
-		  if ((src->u.syment.n_value) == 0)
-		    {
-		      dst->symbol.section = bfd_und_section_ptr;
-		      dst->symbol.value = 0;
-		    }
-		  else
-		    {
-		      dst->symbol.section = bfd_com_section_ptr;
-		      dst->symbol.value = (src->u.syment.n_value);
-		    }
-		}
-	      else
-		{
-		  /* Base the value as an index from the base of the
-		     section */
-
+		case COFF_SYMBOL_GLOBAL:
 		  dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
-
 #if defined COFF_WITH_PE
 		  /* PE sets the symbol to a value relative to the
                      start of the section.  */
@@ -3560,19 +4100,45 @@
 		  dst->symbol.value = (src->u.syment.n_value
 				       - dst->symbol.section->vma);
 #endif
-
 		  if (ISFCN ((src->u.syment.n_type)))
 		    {
 		      /* A function ext does not go at the end of a
 			 file.  */
 		      dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
 		    }
+		  break;
+
+		case COFF_SYMBOL_COMMON:
+		  dst->symbol.section = bfd_com_section_ptr;
+		  dst->symbol.value = src->u.syment.n_value;
+		  break;
+
+		case COFF_SYMBOL_UNDEFINED:
+		  dst->symbol.section = bfd_und_section_ptr;
+		  dst->symbol.value = 0;
+		  break; 
+
+		case COFF_SYMBOL_PE_SECTION:
+		  dst->symbol.flags |= BSF_EXPORT | BSF_SECTION_SYM;
+		  dst->symbol.value = 0;
+		  break;
+
+		case COFF_SYMBOL_LOCAL:
+		  dst->symbol.flags = BSF_LOCAL;
+#if defined COFF_WITH_PE
+		  /* PE sets the symbol to a value relative to the
+                     start of the section.  */
+		  dst->symbol.value = src->u.syment.n_value;
+#else
+		  dst->symbol.value = (src->u.syment.n_value
+				       - dst->symbol.section->vma);
+#endif
+		  if (ISFCN ((src->u.syment.n_type)))
+		    dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
+		  break;
 		}
 
 #ifdef RS6000COFF_C
-	      /* A C_HIDEXT symbol is not global.  */
-	      if (src->u.syment.n_sclass == C_HIDEXT)
-		dst->symbol.flags = BSF_LOCAL;
 	      /* A symbol with a csect entry should not go at the end.  */
 	      if (src->u.syment.n_numaux > 0)
 		dst->symbol.flags |= BSF_NOT_AT_END;
@@ -3581,6 +4147,11 @@
 #ifdef COFF_WITH_PE
 	      if (src->u.syment.n_sclass == C_NT_WEAK)
 		dst->symbol.flags = BSF_WEAK;
+	      if (src->u.syment.n_sclass == C_SECTION
+		  && src->u.syment.n_scnum > 0)
+		{
+		  dst->symbol.flags = BSF_LOCAL;
+		}
 #endif
 
 	      if (src->u.syment.n_sclass == C_WEAKEXT)
@@ -3598,7 +4169,7 @@
             case C_THUMBSTATFUNC:/* Thumb static function        */
 #endif
 	    case C_LABEL:	/* label			 */
-	      if (src->u.syment.n_scnum == -2)
+	      if (src->u.syment.n_scnum == N_DEBUG)
 		dst->symbol.flags = BSF_DEBUGGING;
 	      else
 		dst->symbol.flags = BSF_LOCAL;
@@ -3680,7 +4251,7 @@
 		for (sec = abfd->sections; sec != NULL; sec = sec->next)
 		  if (sec->line_filepos <= (file_ptr) src->u.syment.n_value
 		      && ((file_ptr) (sec->line_filepos
-				      + sec->lineno_count * LINESZ)
+				      + sec->lineno_count * bfd_coff_linesz (abfd))
 			  > (file_ptr) src->u.syment.n_value))
 		    break;
 		if (sec == NULL)
@@ -3690,7 +4261,7 @@
 		    dst->symbol.section = sec;
 		    dst->symbol.value = ((src->u.syment.n_value
 					  - sec->line_filepos)
-					 / LINESZ);
+					 / bfd_coff_linesz (abfd));
 		    src->fix_line = 1;
 		  }
 	      }
@@ -3710,22 +4281,37 @@
 #endif
 
 	    case C_BLOCK:	/* ".bb" or ".eb"		 */
-	    case C_FCN:		/* ".bf" or ".ef"		 */
+	    case C_FCN:		/* ".bf" or ".ef" (or PE ".lf")	 */
 	    case C_EFCN:	/* physical end of function	 */
-	      dst->symbol.flags = BSF_LOCAL;
 #if defined COFF_WITH_PE
 	      /* PE sets the symbol to a value relative to the start
 		 of the section.  */
 	      dst->symbol.value = src->u.syment.n_value;
+	      if (strcmp (dst->symbol.name, ".bf") != 0)
+		{
+		  /* PE uses funny values for .ef and .lf; don't
+                     relocate them.  */
+		  dst->symbol.flags = BSF_DEBUGGING;
+		}
+	      else
+		dst->symbol.flags = BSF_DEBUGGING | BSF_DEBUGGING_RELOC;
 #else
 	      /* Base the value as an index from the base of the
 		 section.  */
+	      dst->symbol.flags = BSF_LOCAL;
 	      dst->symbol.value = (src->u.syment.n_value
 				   - dst->symbol.section->vma);
 #endif
 	      break;
 
 	    case C_NULL:
+	      /* PE DLLs sometimes have zeroed out symbols for some
+                 reason.  Just ignore them without a warning.  */
+	      if (src->u.syment.n_type == 0
+		  && src->u.syment.n_value == 0
+		  && src->u.syment.n_scnum == 0)
+		break;
+	      /* Fall through.  */
 	    case C_EXTDEF:	/* external definition		 */
 	    case C_ULABEL:	/* undefined label		 */
 	    case C_USTATIC:	/* undefined static		 */
@@ -3783,47 +4369,107 @@
   return true;
 }				/* coff_slurp_symbol_table() */
 
-/* Check whether a symbol is globally visible.  This is used by the
-   COFF backend linker code in cofflink.c, since a couple of targets
-   have globally visible symbols which are not class C_EXT.  This
-   function need not handle the case of n_class == C_EXT.  */
+/* Classify a COFF symbol.  A couple of targets have globally visible
+   symbols which are not class C_EXT, and this handles those.  It also
+   recognizes some special PE cases.  */
 
-#undef OTHER_GLOBAL_CLASS
-
-#ifdef I960
-#define OTHER_GLOBAL_CLASS C_LEAFEXT
-#endif
-
-#ifdef COFFARM
-#define OTHER_GLOBAL_CLASS C_THUMBEXT || syment->n_sclass == C_THUMBEXTFUNC
-#else
-#ifdef COFF_WITH_PE
-#define OTHER_GLOBAL_CLASS C_SECTION
-#endif
-#endif
-
-#ifdef OTHER_GLOBAL_CLASS
-
-static boolean coff_sym_is_global PARAMS ((bfd *, struct internal_syment *));
-
-static boolean
-coff_sym_is_global (abfd, syment)
-     bfd * abfd;
-     struct internal_syment * syment;
+static enum coff_symbol_classification
+coff_classify_symbol (abfd, syment)
+     bfd *abfd;
+     struct internal_syment *syment;
 {
-  return (syment->n_sclass == OTHER_GLOBAL_CLASS);
+  /* FIXME: This partially duplicates the switch in
+     coff_slurp_symbol_table.  */
+  switch (syment->n_sclass)
+    {
+    case C_EXT:
+    case C_WEAKEXT:
+#ifdef I960
+    case C_LEAFEXT:
+#endif
+#ifdef ARM
+    case C_THUMBEXT:
+    case C_THUMBEXTFUNC:
+#endif
+#ifdef C_SYSTEM
+    case C_SYSTEM:
+#endif
+#ifdef COFF_WITH_PE
+    case C_NT_WEAK:
+#endif
+      if (syment->n_scnum == 0)
+	{
+	  if (syment->n_value == 0)
+	    return COFF_SYMBOL_UNDEFINED;
+	  else
+	    return COFF_SYMBOL_COMMON;
+	}
+      return COFF_SYMBOL_GLOBAL;
+
+    default:
+      break;
+    }
+
+#ifdef COFF_WITH_PE
+  if (syment->n_sclass == C_STAT)
+    {
+      if (syment->n_scnum == 0)
+	{
+	  /* The Microsoft compiler sometimes generates these if a
+             small static function is inlined every time it is used.
+             The function is discarded, but the symbol table entry
+             remains.  */
+	  return COFF_SYMBOL_LOCAL;
+	}
+
+#ifdef STRICT_PE_FORMAT
+      /* This is correct for Microsoft generated objects, but it
+         breaks gas generated objects.  */
+
+      if (syment->n_value == 0)
+	{
+	  asection *sec;
+	  char buf[SYMNMLEN + 1];
+
+	  sec = coff_section_from_bfd_index (abfd, syment->n_scnum);
+	  if (sec != NULL
+	      && (strcmp (bfd_get_section_name (abfd, sec),
+			  _bfd_coff_internal_syment_name (abfd, syment, buf))
+		  == 0))
+	    return COFF_SYMBOL_PE_SECTION;
+	}
+#endif
+
+      return COFF_SYMBOL_LOCAL;
+    }
+
+  if (syment->n_sclass == C_SECTION)
+    {
+      /* In some cases in a DLL generated by the Microsoft linker, the
+         n_value field will contain garbage.  FIXME: This should
+         probably be handled by the swapping function instead.  */
+      syment->n_value = 0;
+      if (syment->n_scnum == 0)
+	return COFF_SYMBOL_UNDEFINED;
+      return COFF_SYMBOL_PE_SECTION;
+    }
+#endif /* COFF_WITH_PE */
+
+  /* If it is not a global symbol, we presume it is a local symbol.  */
+
+  if (syment->n_scnum == 0)
+    {
+      char buf[SYMNMLEN + 1];
+
+      (*_bfd_error_handler)
+	(_("warning: %s: local symbol `%s' has no section"),
+	 bfd_get_filename (abfd),
+	 _bfd_coff_internal_syment_name (abfd, syment, buf));
+    }
+
+  return COFF_SYMBOL_LOCAL;
 }
 
-#undef OTHER_GLOBAL_CLASS
-
-#else /* ! defined (OTHER_GLOBAL_CLASS) */
-
-/* sym_is_global should not be defined if it has nothing to do.  */
-
-#define coff_sym_is_global 0
-
-#endif /* ! defined (OTHER_GLOBAL_CLASS) */
-
 /*
 SUBSUBSECTION
 	Reading relocations
@@ -3897,7 +4543,7 @@
     (RELOC *) buy_and_read (abfd,
 			    asect->rel_filepos,
 			    SEEK_SET,
-			    (size_t) (RELSZ *
+			    (size_t) (bfd_coff_relsz (abfd) *
 				      asect->reloc_count));
   reloc_cache = (arelent *)
     bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent)));
@@ -3995,12 +4641,12 @@
 /*ARGSUSED*/
 static reloc_howto_type *
 coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
-     bfd *abfd;
-     asection *sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
      struct internal_reloc *rel;
-     struct coff_link_hash_entry *h;
-     struct internal_syment *sym;
-     bfd_vma *addendp;
+     struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
+     struct internal_syment *sym ATTRIBUTE_UNUSED;
+     bfd_vma *addendp ATTRIBUTE_UNUSED;
 {
   arelent genrel;
 
@@ -4074,13 +4720,14 @@
 
 static int
 dummy_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 *abfd ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     arelent *reloc ATTRIBUTE_UNUSED;
+     unsigned int shrink ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
 {
   abort ();
+  return 0;
 }
 
 #endif
@@ -4098,13 +4745,13 @@
 static void
 dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
 			   dst_ptr)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
-     struct bfd_link_order *link_order;
-     arelent *reloc;
-     bfd_byte *data;
-     unsigned int *src_ptr;
-     unsigned int *dst_ptr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+     struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
+     arelent *reloc ATTRIBUTE_UNUSED;
+     bfd_byte *data ATTRIBUTE_UNUSED;
+     unsigned int *src_ptr ATTRIBUTE_UNUSED;
+     unsigned int *dst_ptr ATTRIBUTE_UNUSED;
 {
   abort ();
 }
@@ -4155,7 +4802,7 @@
 static boolean
 coff_link_output_has_begun (abfd, info)
      bfd * abfd;
-     struct coff_final_link_info * info;
+     struct coff_final_link_info * info ATTRIBUTE_UNUSED;
 {
   return abfd->output_has_begun;
 }
@@ -4168,8 +4815,8 @@
 
 static boolean
 coff_final_link_postscript (abfd, pfinfo)
-     bfd * abfd;
-     struct coff_final_link_info * pfinfo;
+     bfd * abfd ATTRIBUTE_UNUSED;
+     struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -4218,16 +4865,14 @@
 #define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
 #endif
 
-
-
-static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
+static const bfd_coff_backend_data bfd_coff_std_swap_table =
 {
   coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
   coff_SWAP_aux_out, coff_SWAP_sym_out,
   coff_SWAP_lineno_out, coff_SWAP_reloc_out,
   coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
   coff_SWAP_scnhdr_out,
-  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ,
+  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
 #ifdef COFF_LONG_FILENAMES
   true,
 #else
@@ -4244,7 +4889,7 @@
   coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
   coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
-  coff_sym_is_global, coff_compute_section_file_positions,
+  coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
   coff_adjust_symndx, coff_link_add_one_symbol,
   coff_link_output_has_begun, coff_final_link_postscript
@@ -4316,3 +4961,101 @@
 #ifndef coff_bfd_gc_sections
 #define coff_bfd_gc_sections		    bfd_generic_gc_sections
 #endif
+
+#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE)	\
+const bfd_target VAR =							\
+{									\
+  NAME ,								\
+  bfd_target_coff_flavour,						\
+  BFD_ENDIAN_BIG,		/* data byte order is big */		\
+  BFD_ENDIAN_BIG,		/* header byte order is big */		\
+  /* object flags */							\
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |			\
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),			\
+  /* section flags */							\
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+  UNDER,			/* leading symbol underscore */		\
+  '/',				/* ar_pad_char */			\
+  15,				/* ar_max_namelen */			\
+  									\
+  /* Data conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+  									\
+  /* Header conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+									\
+	/* bfd_check_format */						\
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p,		\
+    _bfd_dummy_target },						\
+	/* bfd_set_format */						\
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },	\
+	/* bfd_write_contents */					\
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents,	\
+    bfd_false },							\
+									\
+  BFD_JUMP_TABLE_GENERIC (coff),					\
+  BFD_JUMP_TABLE_COPY (coff),						\
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),					\
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),				\
+  BFD_JUMP_TABLE_SYMBOLS (coff),					\
+  BFD_JUMP_TABLE_RELOCS (coff),						\
+  BFD_JUMP_TABLE_WRITE (coff),						\
+  BFD_JUMP_TABLE_LINK (coff),						\
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),				\
+  									\
+  ALTERNATIVE,								\
+  									\
+  COFF_SWAP_TABLE							\
+};
+
+#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE)	\
+const bfd_target VAR =							\
+{									\
+  NAME ,								\
+  bfd_target_coff_flavour,						\
+  BFD_ENDIAN_LITTLE,		/* data byte order is little */		\
+  BFD_ENDIAN_LITTLE,		/* header byte order is little */	\
+	/* object flags */						\
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |			\
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),			\
+	/* section flags */						\
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+  UNDER,			/* leading symbol underscore */		\
+  '/',				/* ar_pad_char */			\
+  15,				/* ar_max_namelen */			\
+									\
+  /* Data conversion functions.  */					\
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,				\
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,				\
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16,				\
+  /* Header conversion functions.  */					\
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,				\
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,				\
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16,				\
+	/* bfd_check_format */						\
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p,		\
+    _bfd_dummy_target },						\
+       /* bfd_set_format */						\
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },	\
+	/* bfd_write_contents */					\
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents,	\
+    bfd_false },							\
+									\
+  BFD_JUMP_TABLE_GENERIC (coff),					\
+  BFD_JUMP_TABLE_COPY (coff),						\
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),					\
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),				\
+  BFD_JUMP_TABLE_SYMBOLS (coff),					\
+  BFD_JUMP_TABLE_RELOCS (coff),						\
+  BFD_JUMP_TABLE_WRITE (coff),						\
+  BFD_JUMP_TABLE_LINK (coff),						\
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),				\
+									\
+  ALTERNATIVE,								\
+  									\
+  COFF_SWAP_TABLE							\
+};
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index df41383..f2410d9 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1,5 +1,5 @@
 /* Support for the generic parts of COFF, for BFD.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -140,9 +140,9 @@
   return_section->lineno_count = hdr->s_nlnno;
   return_section->userdata = NULL;
   return_section->next = (asection *) NULL;
-  return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name);
-
   return_section->target_index = target_index;
+  return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name,
+							   return_section);
 
   /* At least on i386-coff, the line number count for a shared library
      section must be ignored.  */
@@ -211,6 +211,11 @@
   if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
     goto fail;
 
+  /* Set the arch/mach *before* swapping in sections; section header swapping
+     may depend on arch/mach info. */
+  if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
+    goto fail;
+
   /* Now copy data as required; construct all asections etc */
   if (nscns != 0)
     {
@@ -228,9 +233,6 @@
 
   /*  make_abs_section (abfd); */
 
-  if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
-    goto fail;
-
   return abfd->xvec;
 
  fail:
@@ -559,7 +561,7 @@
 /*ARGSUSED*/
 coff_symbol_type *
 coff_symbol_from (ignore_abfd, symbol)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
 {
   if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour)
@@ -585,7 +587,8 @@
       syment->n_scnum = N_UNDEF;
       syment->n_value = coff_symbol_ptr->symbol.value;
     }
-  else if (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING)
+  else if ((coff_symbol_ptr->symbol.flags & BSF_DEBUGGING) != 0
+	   && (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING_RELOC) == 0)
     {
       syment->n_value = coff_symbol_ptr->symbol.value;
     }
@@ -594,6 +597,7 @@
       syment->n_scnum = N_UNDEF;
       syment->n_value = 0;
     }
+  /* FIXME: Do we need to handle the absolute section here?  */
   else
     {
       if (coff_symbol_ptr->symbol.section)
@@ -810,14 +814,18 @@
   if (native->u.syment.n_sclass == C_FILE
       && native->u.syment.n_numaux > 0)
     {
+      unsigned int filnmlen;
+
       strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
       auxent = &(native + 1)->u.auxent;
 
+      filnmlen = bfd_coff_filnmlen (abfd);
+
       if (bfd_coff_long_filenames (abfd))
 	{
-	  if (name_length <= FILNMLEN)
+	  if (name_length <= filnmlen)
 	    {
-	      strncpy (auxent->x_file.x_fname, name, FILNMLEN);
+	      strncpy (auxent->x_file.x_fname, name, filnmlen);
 	    }
 	  else
 	    {
@@ -828,11 +836,9 @@
 	}
       else
 	{
-	  strncpy (auxent->x_file.x_fname, name, FILNMLEN);
-	  if (name_length > FILNMLEN)
-	    {
-	      name[FILNMLEN] = '\0';
-	    }
+	  strncpy (auxent->x_file.x_fname, name, filnmlen);
+	  if (name_length > filnmlen)
+	    name[filnmlen] = '\0';
 	}
     }
   else
@@ -1246,7 +1252,7 @@
 	    }
 	  else if (c_symbol->native->u.syment.n_sclass == C_FILE
 		   && c_symbol->native->u.syment.n_numaux > 0)
-	    maxlen = FILNMLEN;
+	    maxlen = bfd_coff_filnmlen (abfd);
 	  else
 	    maxlen = SYMNMLEN;
 
@@ -1351,7 +1357,7 @@
 /*ARGSUSED */
 alent *
 coff_get_lineno (ignore_abfd, symbol)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
 {
   return coffsymbol (symbol)->lineno;
@@ -1746,10 +1752,26 @@
 	    }
 	  else
 	    {
-	      /* ordinary short filename, put into memory anyway */
-	      internal_ptr->u.syment._n._n_n._n_offset = (long)
-		copy_name (abfd, (internal_ptr + 1)->u.auxent.x_file.x_fname,
-			   FILNMLEN);
+	      /* Ordinary short filename, put into memory anyway.  The
+                 Microsoft PE tools sometimes store a filename in
+                 multiple AUX entries.  */
+	      if (internal_ptr->u.syment.n_numaux > 1
+		  && coff_data (abfd)->pe)
+		{
+		  internal_ptr->u.syment._n._n_n._n_offset =
+		    ((long)
+		     copy_name (abfd,
+				(internal_ptr + 1)->u.auxent.x_file.x_fname,
+				internal_ptr->u.syment.n_numaux * symesz));
+		}
+	      else
+		{
+		  internal_ptr->u.syment._n._n_n._n_offset =
+		    ((long)
+		     copy_name (abfd,
+				(internal_ptr + 1)->u.auxent.x_file.x_fname,
+				bfd_coff_filnmlen (abfd)));
+		}
 	    }
 	}
       else
@@ -1847,8 +1869,8 @@
 asymbol *
 coff_bfd_make_debug_symbol (abfd, ptr, sz)
      bfd *abfd;
-     PTR ptr;
-     unsigned long sz;
+     PTR ptr ATTRIBUTE_UNUSED;
+     unsigned long sz ATTRIBUTE_UNUSED;
 {
   coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
   if (new == NULL)
@@ -2046,8 +2068,23 @@
 				 auxp->u.auxent.x_scn.x_comdat);
 		      break;
 		    }
+		    /* else fall through */
+		case C_EXT:
+		  if (ISFCN (combined->u.syment.n_type))
+		    {
+		      fprintf (file,
+			       _("AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"),
+			       tagndx,
+			       auxp->u.auxent.x_sym.x_misc.x_fsize,
+			       auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr,
+			       (auxp->fix_end
+				? ((long)
+				   (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
+				    - root))
+				: auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l));
+		      break;
+		    }
 		  /* else fall through */
-
 		default:
 		  fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
 			   auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
@@ -2095,16 +2132,15 @@
 
 boolean
 _bfd_coff_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return name[0] == '.' && name[1] == 'L';
 }
 
-/* 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.  */
-
+/* 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,
@@ -2190,9 +2226,11 @@
 		}
 	    }
 
+	  /* We use <= MAXDIFF here so that if we get a zero length
+             file, we actually use the next file entry.  */
 	  if (p2 < pend
 	      && offset + sec_vma >= (bfd_vma) p2->u.syment.n_value
-	      && offset + sec_vma - (bfd_vma) p2->u.syment.n_value < maxdiff)
+	      && offset + sec_vma - (bfd_vma) p2->u.syment.n_value <= maxdiff)
 	    {
 	      *filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
 	      maxdiff = offset + sec_vma - p2->u.syment.n_value;
@@ -2229,6 +2267,8 @@
 
   if (section->lineno != NULL)
     {
+      bfd_vma last_value = 0;
+
       l = &section->lineno[i];
 
       for (; i < section->lineno_count; i++)
@@ -2240,6 +2280,7 @@
 	      if (coff->symbol.value > offset)
 		break;
 	      *functionname_ptr = coff->symbol.name;
+	      last_value = coff->symbol.value;
 	      if (coff->native)
 		{
 		  combined_entry_type *s = coff->native;
@@ -2268,6 +2309,20 @@
 	    }
 	  l++;
 	}
+
+      /* If we fell off the end of the loop, then assume that this
+	 symbol has no line number info.  Otherwise, symbols with no
+	 line number info get reported with the line number of the
+	 last line of the last symbol which does have line number
+	 info.  We use 0x100 as a slop to account for cases where the
+	 last line has executable code.  */
+      if (i >= section->lineno_count
+	  && last_value != 0
+	  && offset - last_value > 0x100)
+	{
+	  *functionname_ptr = NULL;
+	  *line_ptr = 0;
+	}
     }
 
   /* Cache the results for the next call.  */
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index cf56869..609f665 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -1,5 +1,5 @@
 /* COFF specific linker code.
-   Copyright 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -40,6 +40,16 @@
   PARAMS ((bfd *, struct bfd_link_info *, bfd *));
 static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
 
+/* 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
+   variables with the appropriate names, and with values from the
+   coff_data (abfd) structure.  */
+
+#define N_TMASK n_tmask
+#define N_BTSHFT n_btshft
+#define N_BTMASK n_btmask
+
 /* Create an entry in a COFF linker hash table.  */
 
 struct bfd_hash_entry *
@@ -225,32 +235,25 @@
      struct bfd_link_info *info;
      boolean *pneeded;
 {
-  boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
   bfd_size_type symesz;
   bfd_byte *esym;
   bfd_byte *esym_end;
 
   *pneeded = false;
 
-  sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global;
-
   symesz = bfd_coff_symesz (abfd);
   esym = (bfd_byte *) obj_coff_external_syms (abfd);
   esym_end = esym + obj_raw_syment_count (abfd) * symesz;
   while (esym < esym_end)
     {
       struct internal_syment sym;
+      enum coff_symbol_classification classification;
 
       bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
 
-      if ((sym.n_sclass == C_EXT
-	   || sym.n_sclass == C_WEAKEXT
-	   || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK)
-#ifdef C_SYSTEM
-	   || sym.n_sclass == C_SYSTEM
-#endif
-	   || (sym_is_global && (*sym_is_global) (abfd, &sym)))
-	  && (sym.n_scnum != 0 || sym.n_value != 0))
+      classification = bfd_coff_classify_symbol (abfd, &sym);
+      if (classification == COFF_SYMBOL_GLOBAL
+	  || classification == COFF_SYMBOL_COMMON)
 	{
 	  const char *name;
 	  char buf[SYMNMLEN + 1];
@@ -292,7 +295,9 @@
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
+  unsigned int n_tmask = coff_data (abfd)->local_n_tmask;
+  unsigned int n_btshft = coff_data (abfd)->local_n_btshft;
+  unsigned int n_btmask = coff_data (abfd)->local_n_btmask;
   boolean keep_syms;
   boolean default_copy;
   bfd_size_type symcount;
@@ -306,8 +311,6 @@
   keep_syms = obj_coff_keep_syms (abfd);
   obj_coff_keep_syms (abfd) = true;
 
-  sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global;
-
   if (info->keep_memory)
     default_copy = false;
   else
@@ -334,23 +337,20 @@
   while (esym < esym_end)
     {
       struct internal_syment sym;
+      enum coff_symbol_classification classification;
       boolean copy;
 
       bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
 
-      if (sym.n_sclass == C_EXT
-	   || sym.n_sclass == C_WEAKEXT
-	   || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK)
-#ifdef C_SYSTEM
-	  || sym.n_sclass == C_SYSTEM
-#endif
-	  || (sym_is_global && (*sym_is_global) (abfd, &sym)))
+      classification = bfd_coff_classify_symbol (abfd, &sym);
+      if (classification != COFF_SYMBOL_LOCAL)
 	{
 	  const char *name;
 	  char buf[SYMNMLEN + 1];
 	  flagword flags;
 	  asection *section;
 	  bfd_vma value;
+	  boolean addit;
 
 	  /* This symbol is externally visible.  */
 
@@ -367,37 +367,119 @@
 
 	  value = sym.n_value;
 
-	  if (sym.n_scnum == 0)
+	  switch (classification)
 	    {
-	      if (value == 0)
-		{
-		  flags = 0;
-		  section = bfd_und_section_ptr;
-		}
-	      else
-		{
-		  flags = BSF_GLOBAL;
-		  section = bfd_com_section_ptr;
-		}
-	    }
-	  else
-	    {
+	    default:
+	      abort ();
+
+	    case COFF_SYMBOL_GLOBAL:
 	      flags = BSF_EXPORT | BSF_GLOBAL;
 	      section = coff_section_from_bfd_index (abfd, sym.n_scnum);
 	      if (! obj_pe (abfd))
 		value -= section->vma;
+	      break;
+
+	    case COFF_SYMBOL_UNDEFINED:
+	      flags = 0;
+	      section = bfd_und_section_ptr;
+	      break;
+
+	    case COFF_SYMBOL_COMMON:
+	      flags = BSF_GLOBAL;
+	      section = bfd_com_section_ptr;
+	      break;
+
+	    case COFF_SYMBOL_PE_SECTION:
+	      flags = BSF_SECTION_SYM | BSF_GLOBAL;
+	      section = coff_section_from_bfd_index (abfd, sym.n_scnum);
+	      break;
 	    }
 
 	  if (sym.n_sclass == C_WEAKEXT
 	      || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
 	    flags = BSF_WEAK;
 
-	  if (! (bfd_coff_link_add_one_symbol
-		 (info, abfd, name, flags, section, value,
-		  (const char *) NULL, copy, false,
-		  (struct bfd_link_hash_entry **) sym_hash)))
-	    goto error_return;
+	  addit = true;
 
+	  /* In the PE format, section symbols actually refer to the
+             start of the output section.  We handle them specially
+             here.  */
+	  if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
+	    {
+	      *sym_hash = coff_link_hash_lookup (coff_hash_table (info),
+						 name, false, copy, false);
+	      if (*sym_hash != NULL)
+		{
+		  if (((*sym_hash)->coff_link_hash_flags
+		       & COFF_LINK_HASH_PE_SECTION_SYMBOL) == 0
+		      && (*sym_hash)->root.type != bfd_link_hash_undefined
+		      && (*sym_hash)->root.type != bfd_link_hash_undefweak)
+		    (*_bfd_error_handler)
+		      ("Warning: symbol `%s' is both section and non-section",
+		       name);
+
+		  addit = false;
+		}
+	    }
+
+	  /* The Microsoft Visual C compiler does string pooling by
+	     hashing the constants to an internal symbol name, and
+	     relying on the the linker comdat support to discard
+	     duplicate names.  However, if one string is a literal and
+	     one is a data initializer, one will end up in the .data
+	     section and one will end up in the .rdata section.  The
+	     Microsoft linker will combine them into the .data
+	     section, which seems to be wrong since it might cause the
+	     literal to change.
+
+	     As long as there are no external references to the
+	     symbols, which there shouldn't be, we can treat the .data
+	     and .rdata instances as separate symbols.  The comdat
+	     code in the linker will do the appropriate merging.  Here
+	     we avoid getting a multiple definition error for one of
+	     these special symbols.
+
+	     FIXME: I don't think this will work in the case where
+	     there are two object files which use the constants as a
+	     literal and two object files which use it as a data
+	     initializer.  One or the other of the second object files
+	     is going to wind up with an inappropriate reference.  */
+	  if (obj_pe (abfd)
+	      && (classification == COFF_SYMBOL_GLOBAL
+		  || classification == COFF_SYMBOL_PE_SECTION)
+	      && section->comdat != NULL
+	      && strncmp (name, "??_", 3) == 0
+	      && strcmp (name, section->comdat->name) == 0)
+	    {
+	      if (*sym_hash == NULL)
+		*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
+						   name, false, copy, false);
+	      if (*sym_hash != NULL
+		  && (*sym_hash)->root.type == bfd_link_hash_defined
+		  && (*sym_hash)->root.u.def.section->comdat != NULL
+		  && strcmp ((*sym_hash)->root.u.def.section->comdat->name,
+			     section->comdat->name) == 0)
+		addit = false;
+	    }
+
+	  if (addit)
+	    {
+	      if (! (bfd_coff_link_add_one_symbol
+		     (info, abfd, name, flags, section, value,
+		      (const char *) NULL, copy, false,
+		      (struct bfd_link_hash_entry **) sym_hash)))
+		goto error_return;
+	    }
+
+	  if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
+	    (*sym_hash)->coff_link_hash_flags |=
+	      COFF_LINK_HASH_PE_SECTION_SYMBOL;
+
+	  /* Limit the alignment of a common symbol to the possible
+             alignment of a section.  There is no point to permitting
+             a higher alignment for a common symbol: we can not
+             guarantee it, and it may cause us to allocate extra space
+             in the common section.  */
 	  if (section == bfd_com_section_ptr
 	      && (*sym_hash)->root.type == bfd_link_hash_common
 	      && ((*sym_hash)->root.u.c.p->alignment_power
@@ -407,25 +489,44 @@
 
 	  if (info->hash->creator->flavour == bfd_get_flavour (abfd))
 	    {
-	      if (((*sym_hash)->class == C_NULL
-		   && (*sym_hash)->type == T_NULL)
-		  || sym.n_scnum != 0
-		  || (sym.n_value != 0
-		      && (*sym_hash)->root.type != bfd_link_hash_defined
-		      && (*sym_hash)->root.type != bfd_link_hash_defweak))
-		{
-		  (*sym_hash)->class = sym.n_sclass;
-		  if (sym.n_type != T_NULL)
-		    {
-		      if ((*sym_hash)->type != T_NULL
-			  && (*sym_hash)->type != sym.n_type)
-			(*_bfd_error_handler)
-			  (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
-			   name, (*sym_hash)->type, sym.n_type,
-			   bfd_get_filename (abfd));
-		      (*sym_hash)->type = sym.n_type;
-		    }
-		  (*sym_hash)->auxbfd = abfd;
+	      /* If we don't have any symbol information currently in
+                 the hash table, or if we are looking at a symbol
+                 definition, then update the symbol class and type in
+                 the hash table.  */
+  	      if (((*sym_hash)->class == C_NULL
+  		   && (*sym_hash)->type == T_NULL)
+  		  || sym.n_scnum != 0
+  		  || (sym.n_value != 0
+  		      && (*sym_hash)->root.type != bfd_link_hash_defined
+  		      && (*sym_hash)->root.type != bfd_link_hash_defweak))
+  		{
+  		  (*sym_hash)->class = sym.n_sclass;
+  		  if (sym.n_type != T_NULL)
+  		    {
+  		      /* We want to warn if the type changed, but not
+  			 if it changed from an unspecified type.
+  			 Testing the whole type byte may work, but the
+  			 change from (e.g.) a function of unspecified
+  			 type to function of known type also wants to
+  			 skip the warning.  */
+  		      if ((*sym_hash)->type != T_NULL
+  			  && (*sym_hash)->type != sym.n_type
+  		          && !(DTYPE ((*sym_hash)->type) == DTYPE (sym.n_type)
+  		               && (BTYPE ((*sym_hash)->type) == T_NULL
+  		                   || BTYPE (sym.n_type) == T_NULL)))
+  			(*_bfd_error_handler)
+  			  (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
+  			   name, (*sym_hash)->type, sym.n_type,
+  			   bfd_get_filename (abfd));
+
+  		      /* We don't want to change from a meaningful
+  			 base type to a null one, but if we know
+  			 nothing, take what little we might now know.  */
+  		      if (BTYPE (sym.n_type) != T_NULL
+  			  || (*sym_hash)->type == T_NULL)
+			(*sym_hash)->type = sym.n_type;
+  		    }
+  		  (*sym_hash)->auxbfd = abfd;
 		  if (sym.n_numaux != 0)
 		    {
 		      union internal_auxent *alloc;
@@ -450,6 +551,26 @@
 		    }
 		}
 	    }
+
+	  if (classification == COFF_SYMBOL_PE_SECTION
+	      && (*sym_hash)->numaux != 0)
+	    {
+	      /* Some PE sections (such as .bss) have a zero size in
+                 the section header, but a non-zero size in the AUX
+                 record.  Correct that here.
+
+		 FIXME: This is not at all the right place to do this.
+		 For example, it won't help objdump.  This needs to be
+		 done when we swap in the section header.  */
+
+	      BFD_ASSERT ((*sym_hash)->numaux == 1);
+	      if (section->_raw_size == 0)
+		section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen;
+
+	      /* FIXME: We could test whether the section sizes
+                 matches the size in the aux entry, but apparently
+                 that sometimes fails unexpectedly.  */
+	    }
 	}
 
       esym += (sym.n_numaux + 1) * symesz;
@@ -1069,7 +1190,7 @@
 static int
 process_embedded_commands (output_bfd, info,  abfd)
      bfd *output_bfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      bfd *abfd;
 {
   asection *sec = bfd_get_section_by_name (abfd, ".drectve");
@@ -1212,15 +1333,17 @@
      struct coff_final_link_info *finfo;
      bfd *input_bfd;
 {
-  boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
+  unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask;
+  unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft;
+#if 0
+  unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask;
+#endif
   boolean (*adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *,
 				    asection *, struct internal_reloc *,
 				    boolean *));
   bfd *output_bfd;
   const char *strings;
   bfd_size_type syment_base;
-  unsigned int n_tmask;
-  unsigned int n_btshft;
   boolean copy, hash;
   bfd_size_type isymesz;
   bfd_size_type osymesz;
@@ -1238,7 +1361,6 @@
   /* Move all the symbols to the output file.  */
 
   output_bfd = finfo->output_bfd;
-  sym_is_global = coff_backend_info (input_bfd)->_bfd_coff_sym_is_global;
   strings = NULL;
   syment_base = obj_raw_syment_count (output_bfd);
   isymesz = bfd_coff_symesz (input_bfd);
@@ -1246,13 +1368,6 @@
   linesz = bfd_coff_linesz (input_bfd);
   BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd));
 
-  n_tmask = coff_data (input_bfd)->local_n_tmask;
-  n_btshft = coff_data (input_bfd)->local_n_btshft;
-
-  /* Define macros so that ISFCN, et. al., macros work correctly.  */
-#define N_TMASK n_tmask
-#define N_BTSHFT n_btshft
-
   copy = false;
   if (! finfo->info->keep_memory)
     copy = true;
@@ -1293,6 +1408,7 @@
   while (esym < esym_end)
     {
       struct internal_syment isym;
+      enum coff_symbol_classification classification;
       boolean skip;
       boolean global;
       boolean dont_skip_symbol;
@@ -1306,14 +1422,22 @@
 	 the symbol.  */
       isym = *isymp;
 
-      if (isym.n_scnum != 0)
-	*secpp = coff_section_from_bfd_index (input_bfd, isym.n_scnum);
-      else
+      classification = bfd_coff_classify_symbol (input_bfd, &isym);
+      switch (classification)
 	{
-	  if (isym.n_value == 0)
-	    *secpp = bfd_und_section_ptr;
-	  else
-	    *secpp = bfd_com_section_ptr;
+	default:
+	  abort ();
+	case COFF_SYMBOL_GLOBAL:
+	case COFF_SYMBOL_PE_SECTION:
+	case COFF_SYMBOL_LOCAL:
+	  *secpp = coff_section_from_bfd_index (input_bfd, isym.n_scnum);
+	  break;
+	case COFF_SYMBOL_COMMON:
+	  *secpp = bfd_com_section_ptr;
+	  break;
+	case COFF_SYMBOL_UNDEFINED:
+	  *secpp = bfd_und_section_ptr;
+	  break;
 	}
 
       /* Extract the flag indicating if this symbol is used by a
@@ -1337,28 +1461,34 @@
 
       if (! skip)
 	{
-	  if (isym.n_sclass == C_EXT
-	      || isym.n_sclass == C_WEAKEXT
-	      || (obj_pe (input_bfd) && isym.n_sclass == C_NT_WEAK)
-#ifdef C_SYSTEM
-	      || isym.n_sclass == C_SYSTEM
-#endif
-	      || (sym_is_global && (*sym_is_global) (input_bfd, &isym)))
+	  switch (classification)
 	    {
+	    default:
+	      abort ();
+	    case COFF_SYMBOL_GLOBAL:
+	    case COFF_SYMBOL_COMMON:
+	    case COFF_SYMBOL_PE_SECTION:
 	      /* This is a global symbol.  Global symbols come at the
 		 end of the symbol table, so skip them for now.
 		 Locally defined function symbols, however, are an
 		 exception, and are not moved to the end.  */
 	      global = true;
-	      if (! ISFCN (isym.n_type) || isym.n_scnum == 0)
+	      if (! ISFCN (isym.n_type))
 		skip = true;
-	    }
-	  else
-	    {
+	      break;
+
+	    case COFF_SYMBOL_UNDEFINED:
+	      /* Undefined symbols are left for the end.  */
+	      global = true;
+	      skip = true;
+	      break;
+
+	    case COFF_SYMBOL_LOCAL:
 	      /* This is a local symbol.  Skip it if we are discarding
                  local symbols.  */
 	      if (finfo->info->discard == discard_all && ! dont_skip_symbol)
 		skip = true;
+	      break;
 	    }
 	}
 
@@ -1466,7 +1596,7 @@
 	    {
 	      const char *elename;
 	      char elebuf[SYMNMLEN + 1];
-	      char *copy;
+	      char *name_copy;
 
 	      bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp);
 
@@ -1481,12 +1611,13 @@
 	      if (elename == NULL)
 		return false;
 
-	      copy = (char *) bfd_alloc (input_bfd, strlen (elename) + 1);
-	      if (copy == NULL)
+	      name_copy = (char *) bfd_alloc (input_bfd,
+					      strlen (elename) + 1);
+	      if (name_copy == NULL)
 		return false;
-	      strcpy (copy, elename);
+	      strcpy (name_copy, elename);
 
-	      (*epp)->name = copy;
+	      (*epp)->name = name_copy;
 	      (*epp)->type = islp->n_type;
 	      (*epp)->tagndx = 0;
 	      if (islp->n_numaux >= 1
@@ -1598,31 +1729,76 @@
 	      isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
 	    }
 
-	  if (isym.n_scnum > 0)
+	  switch (isym.n_sclass)
 	    {
-	      isym.n_scnum = (*secpp)->output_section->target_index;
-	      isym.n_value += (*secpp)->output_offset;
-	      if (! obj_pe (input_bfd))
-		isym.n_value -= (*secpp)->vma;
-	      if (! obj_pe (finfo->output_bfd))
-		isym.n_value += (*secpp)->output_section->vma;
-	    }
+	    case C_AUTO:
+	    case C_MOS:
+	    case C_EOS:
+	    case C_MOE:
+	    case C_MOU:
+	    case C_UNTAG:
+	    case C_STRTAG:
+	    case C_ENTAG:
+	    case C_TPDEF:
+	    case C_ARG:
+	    case C_USTATIC:
+	    case C_REG:
+	    case C_REGPARM:
+	    case C_FIELD:
+	      /* The symbol value should not be modified.  */
+	      break;
 
-	  /* The value of a C_FILE symbol is the symbol index of the
-	     next C_FILE symbol.  The value of the last C_FILE symbol
-	     is the symbol index to the first external symbol
-	     (actually, coff_renumber_symbols does not get this
-	     right--it just sets the value of the last C_FILE symbol
-	     to zero--and nobody has ever complained about it).  We
-	     try to get this right, below, just before we write the
-	     symbols out, but in the general case we may have to write
-	     the symbol out twice.  */
-	  if (isym.n_sclass == C_FILE)
-	    {
+	    case C_FCN:
+	      if (obj_pe (input_bfd)
+		  && strcmp (isym.n_name, ".bf") != 0
+		  && isym.n_scnum > 0)
+		{
+		  /* For PE, .lf and .ef get their value left alone,
+		     while .bf gets relocated.  However, they all have
+		     "real" section numbers, and need to be moved into
+		     the new section.  */
+		  isym.n_scnum = (*secpp)->output_section->target_index;
+		  break;
+		}
+	      /* Fall through.  */
+	    default:
+	    case C_LABEL:  /* Not completely sure about these 2 */
+	    case C_EXTDEF:
+	    case C_BLOCK:
+	    case C_EFCN:
+	    case C_NULL:
+	    case C_EXT:
+	    case C_STAT:
+	    case C_SECTION:
+	    case C_NT_WEAK:
+	      /* Compute new symbol location.  */
+	    if (isym.n_scnum > 0)
+	      {
+		isym.n_scnum = (*secpp)->output_section->target_index;
+		isym.n_value += (*secpp)->output_offset;
+		if (! obj_pe (input_bfd))
+		  isym.n_value -= (*secpp)->vma;
+		if (! obj_pe (finfo->output_bfd))
+		  isym.n_value += (*secpp)->output_section->vma;
+	      }
+	    break;
+
+	    case C_FILE:
+	      /* The value of a C_FILE symbol is the symbol index of
+		 the next C_FILE symbol.  The value of the last C_FILE
+		 symbol is the symbol index to the first external
+		 symbol (actually, coff_renumber_symbols does not get
+		 this right--it just sets the value of the last C_FILE
+		 symbol to zero--and nobody has ever complained about
+		 it).  We try to get this right, below, just before we
+		 write the symbols out, but in the general case we may
+		 have to write the symbol out twice.  */
+
 	      if (finfo->last_file_index != -1
 		  && finfo->last_file.n_value != (long) output_index)
 		{
-		  /* We must correct the value of the last C_FILE entry.  */
+		  /* We must correct the value of the last C_FILE
+                     entry.  */
 		  finfo->last_file.n_value = output_index;
 		  if ((bfd_size_type) finfo->last_file_index >= syment_base)
 		    {
@@ -1654,6 +1830,7 @@
 
 	      finfo->last_file_index = output_index;
 	      finfo->last_file = isym;
+	      break;
 	    }
 
 	  /* If doing task linking, convert normal global function symbols to
@@ -1934,6 +2111,8 @@
 	  bfd_vma offset;
 	  bfd_byte *eline;
 	  bfd_byte *elineend;
+	  bfd_byte *oeline;
+	  boolean skipping;
 
 	  /* FIXME: If SEC_HAS_CONTENTS is not for the section, then
 	     build_link_order in ldwrite.c will not have created a
@@ -1955,7 +2134,9 @@
 
 	  offset = o->output_section->vma + o->output_offset - o->vma;
 	  eline = finfo->linenos;
+	  oeline = finfo->linenos;
 	  elineend = eline + linesz * o->lineno_count;
+	  skipping = false;
 	  for (; eline < elineend; eline += linesz)
 	    {
 	      struct internal_lineno iline;
@@ -1975,11 +2156,13 @@
 		  if (indx < 0)
 		    {
 		      /* These line numbers are attached to a symbol
-			 which we are stripping.  We should really
-			 just discard the line numbers, but that would
-			 be a pain because we have already counted
-			 them.  */
-		      indx = 0;
+			 which we are stripping.  We must discard the
+			 line numbers because reading them back with
+			 no associated symbol (or associating them all
+			 with symbol #0) will fail.  We can't regain
+			 the space in the output file, but at least
+			 they're dense.  */
+		      skipping = true;
 		    }
 		  else
 		    {
@@ -2018,23 +2201,32 @@
 						 is.n_type, is.n_sclass, 0,
 						 is.n_numaux, auxptr);
 			}
+
+			skipping = false;
 		    }
 
 		  iline.l_addr.l_symndx = indx;
 		}
 
-	      bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline, (PTR) eline);
+	      if (!skipping)
+	        {
+		  bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline,
+					    (PTR) oeline);
+		  oeline += linesz;
+		}
 	    }
 
 	  if (bfd_seek (output_bfd,
 			(o->output_section->line_filepos
 			 + o->output_section->lineno_count * linesz),
 			SEEK_SET) != 0
-	      || bfd_write (finfo->linenos, linesz, o->lineno_count,
-			    output_bfd) != linesz * o->lineno_count)
+	      || (bfd_write (finfo->linenos, 1, oeline - finfo->linenos,
+			     output_bfd)
+		  != (bfd_size_type) (oeline - finfo->linenos)))
 	    return false;
 
-	  o->output_section->lineno_count += o->lineno_count;
+	  o->output_section->lineno_count +=
+	    (oeline - finfo->linenos) / linesz;
 	}
     }
 
@@ -2233,7 +2425,10 @@
       if (secdata == NULL || secdata->stab_info == NULL)
 	{
 	  if (! bfd_set_section_contents (output_bfd, o->output_section,
-					  contents, o->output_offset,
+					  contents, 
+                                          (file_ptr) 
+                                          (o->output_offset * 
+                                           bfd_octets_per_byte (output_bfd)),
 					  (o->_cooked_size != 0
 					   ? o->_cooked_size
 					   : o->_raw_size)))
@@ -2386,11 +2581,64 @@
 
   ++obj_raw_syment_count (output_bfd);
 
-  /* Write out any associated aux entries.  There normally will be
-     none.  If there are any, I have no idea how to modify them.  */
+  /* Write out any associated aux entries.  Most of the aux entries
+     will have been modified in _bfd_coff_link_input_bfd.  We have to
+     handle section aux entries here, now that we have the final
+     relocation and line number counts.  */
   for (i = 0; i < isym.n_numaux; i++)
     {
-      bfd_coff_swap_aux_out (output_bfd, (PTR) (h->aux + i), isym.n_type,
+      union internal_auxent *auxp;
+
+      auxp = h->aux + i;
+
+      /* Look for a section aux entry here using the same tests that
+         coff_swap_aux_out uses.  */
+      if (i == 0
+	  && (isym.n_sclass == C_STAT
+	      || isym.n_sclass == C_HIDDEN)
+	  && isym.n_type == T_NULL
+	  && (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak))
+	{
+	  asection *sec;
+
+	  sec = h->root.u.def.section->output_section;
+	  if (sec != NULL)
+	    {
+	      auxp->x_scn.x_scnlen = (sec->_cooked_size != 0
+				      ? sec->_cooked_size
+				      : sec->_raw_size);
+
+	      /* For PE, an overflow on the final link reportedly does
+                 not matter.  FIXME: Why not?  */
+
+	      if (sec->reloc_count > 0xffff
+		  && (! obj_pe (output_bfd)
+		      || finfo->info->relocateable))
+		(*_bfd_error_handler)
+		  (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
+		   bfd_get_filename (output_bfd),
+		   bfd_get_section_name (output_bfd, sec),
+		   sec->reloc_count);
+
+	      if (sec->lineno_count > 0xffff
+		  && (! obj_pe (output_bfd)
+		      || finfo->info->relocateable))
+		(*_bfd_error_handler)
+		  (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
+		   bfd_get_filename (output_bfd),
+		   bfd_get_section_name (output_bfd, sec),
+		   sec->lineno_count);
+
+	      auxp->x_scn.x_nreloc = sec->reloc_count;
+	      auxp->x_scn.x_nlinno = sec->lineno_count;
+	      auxp->x_scn.x_checksum = 0;
+	      auxp->x_scn.x_associated = 0;
+	      auxp->x_scn.x_comdat = 0;
+	    }
+	}
+
+      bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type,
 			     isym.n_sclass, i, isym.n_numaux,
 			     (PTR) finfo->outsyms);
       if (bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz)
@@ -2492,7 +2740,9 @@
 	  break;
 	}
       ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
-				     (file_ptr) link_order->offset, size);
+				     (file_ptr) 
+                                     (link_order->offset *
+                                      bfd_octets_per_byte (output_bfd)), size);
       free (buf);
       if (! ok)
 	return false;
@@ -2603,6 +2853,14 @@
 	  h = NULL;
 	  sym = NULL;
 	}
+      else if (symndx < 0
+	       || (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
+	{
+	  (*_bfd_error_handler)
+	    ("%s: illegal symbol index %ld in relocs",
+	     bfd_get_filename (input_bfd), symndx);
+	  return false;
+	}
       else
 	{    
 	  h = obj_coff_sym_hashes (input_bfd)[symndx];
@@ -2675,7 +2933,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
 	}
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index ae30a5d..d7d090f 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -1,5 +1,6 @@
 /* Generic COFF swapping routines, for BFD.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -26,10 +27,6 @@
    Any file which uses this must first include "coff/internal.h" and
    "coff/CPU.h".  The functions will then be correct for that CPU.  */
 
-#ifndef IMAGE_BASE
-#define IMAGE_BASE 0
-#endif
-
 #define PUTWORD bfd_h_put_32
 #define PUTHALF bfd_h_put_16
 #define	PUTBYTE bfd_h_put_8
@@ -264,7 +261,7 @@
   SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
 #endif
 
-  return RELSZ;
+  return bfd_coff_relsz (abfd);
 }
 
 #endif /* NO_COFF_RELOCS */
@@ -324,7 +321,7 @@
 #ifdef COFF_ADJUST_FILEHDR_OUT_POST
   COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
 #endif
-  return FILHSZ;
+  return bfd_coff_filhsz (abfd);
 }
 
 
@@ -360,6 +357,9 @@
   }
   in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
   in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
+#ifdef COFF_ADJUST_SYM_IN_POST
+  COFF_ADJUST_SYM_IN_POST (abfd, ext1, in1);
+#endif
 }
 
 static unsigned int
@@ -393,6 +393,9 @@
       }
   bfd_h_put_8(abfd,  in->n_sclass , ext->e_sclass);
   bfd_h_put_8(abfd,  in->n_numaux , ext->e_numaux);
+#ifdef COFF_ADJUST_SYM_OUT_POST
+  COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp);
+#endif
   return SYMESZ;
 }
 
@@ -422,7 +425,16 @@
 #if FILNMLEN != E_FILNMLEN
 	    -> Error, we need to cope with truncating or extending FILNMLEN!;
 #else
-	    memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	    if (numaux > 1)
+	      {
+		if (indx == 0)
+		  memcpy (in->x_file.x_fname, ext->x_file.x_fname,
+			  numaux * sizeof (AUXENT));
+	      }
+	    else
+	      {
+		memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	      }
 #endif
 	  }
       goto end;
@@ -518,8 +530,8 @@
      PTR 	inp;
      int   type;
      int   class;
-     int   indx;
-     int   numaux;
+     int   indx ATTRIBUTE_UNUSED;
+     int   numaux ATTRIBUTE_UNUSED;
      PTR	extp;
 {
   union internal_auxent *in = (union internal_auxent *)inp;
@@ -839,7 +851,7 @@
 {
   struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
   SCNHDR *scnhdr_ext = (SCNHDR *)out;
-  unsigned int ret = SCNHSZ;
+  unsigned int ret = bfd_coff_scnhsz (abfd);
 
 #ifdef COFF_ADJUST_SCNHDR_OUT_PRE
   COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 449ae91..d8f91d2 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -35,9 +35,11 @@
 c30*)	targ_archs=bfd_tic30_arch ;;
 hppa*)	targ_archs=bfd_hppa_arch ;;
 i[3456]86) targ_archs=bfd_i386_arch ;;
+i370)   targ_archs=bfd_i370_arch ;;
 m68*)	targ_archs=bfd_m68k_arch ;;
 m88*)	targ_archs=bfd_m88k_arch ;;
 mips*)	targ_archs=bfd_mips_arch ;;
+pj*)	targ_archs="bfd_pj_arch bfd_i386_arch";;
 powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
 rs6000)	targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
 sparc*) targ_archs=bfd_sparc_arch ;;
@@ -55,7 +57,7 @@
 case "${targ}" in
 # START OF targmatch.h
 #ifdef BFD64
-  alpha*-*-netbsd*)
+  alpha*-*-netbsd* | alpha*-*-freebsd*)
     targ_defvec=bfd_elf64_alpha_vec
     targ_selvecs=ecoffalpha_little_vec
     ;;
@@ -84,6 +86,10 @@
     targ_selvecs=bfd_elf32_bigarc_vec
     ;;
 
+  arm-*-netbsd*)
+    targ_defvec=armnetbsd_vec
+    targ_underscore=yes
+    ;;
   arm-*-riscix*)
     targ_defvec=riscix_vec
     ;;
@@ -92,6 +98,12 @@
     targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
     targ_underscore=no
     ;;
+  arm-wince-pe | arm-*-wince)
+    targ_defvec=armpe_little_vec
+    targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
+    targ_underscore=no
+    targ_cflags=-DARM_WINCE
+    ;;
   arm-*-pe*)
     targ_defvec=armpe_little_vec
     targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
@@ -110,7 +122,7 @@
     targ_selvecs=armcoff_big_vec
     targ_underscore=yes
     ;;
-  arm-*-elf | arm*-*-linux-gnu)
+  arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
     ;;
@@ -163,6 +175,10 @@
     targ_underscore=yes
     ;;
 
+  avr-*-*)
+    targ_defvec=bfd_elf32_avr_vec
+    ;;
+
   c30-*-*aout* | tic30-*-*aout*)
     targ_defvec=tic30_aout_vec
     ;;
@@ -193,42 +209,60 @@
     targ_underscore=yes
     ;;
 
-  hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
+#if 0 /* HPPA ELF does not work currently.  */
+  hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
     targ_defvec=bfd_elf32_hppa_vec
     ;;
+#endif
 #if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
+#if 0 /* HPPA ELF does not work currently.  */
   hppa*-*-bsd*)
     targ_defvec=som_vec
     targ_selvecs=bfd_elf32_hppa_vec
     ;;
+#endif
   hppa*-*-hpux* | hppa*-*-hiux* | hppa*-*-mpeix*)
     targ_defvec=som_vec
     ;;
+#if 0 /* HPPA ELF does not work currently.  */
   hppa*-*-osf*)
     targ_defvec=som_vec
     targ_selvecs=bfd_elf32_hppa_vec
     ;;
+#endif
 #endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
 
+  i370-*-*) 
+    targ_defvec=bfd_elf32_i370_vec
+    targ_selvecs="bfd_elf32_i370_vec"
+    ;;
   i[3456]86-*-sco3.2v5*coff)
     targ_defvec=i386coff_vec
     targ_selvecs=bfd_elf32_i386_vec
     ;;
-  i[3456]86-*-sysv4* | i[3456]86-*-unixware | i[3456]86-*-solaris2* | \
-  i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | i[3456]86-*-freebsdelf* | \
+  i[3456]86-*-sysv4* | i[3456]86-*-unixware* | i[3456]86-*-solaris2* | \
+  i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | \
   i[3456]86-*-dgux* | i[3456]86-*-sysv5*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=i386coff_vec
     ;;
+  i[3456]86-*-rtemself*)
+    targ_defvec=bfd_elf32_i386_vec
+    targ_selvecs="i386coff_vec i386aout_vec"
+    ;;
   i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
     targ_defvec=go32coff_vec
     targ_selvecs="go32stubbedcoff_vec i386aout_vec"
     ;;
   i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \
-  i[3456]86-*-aix* | i[3456]86*-*-rtems*)
+  i[3456]86-*-aix*)
     targ_defvec=i386coff_vec
     ;;
-  i[3456]86-sequent-bsd*)
+  i[3456]86*-*-rtems*)
+    targ_defvec=i386coff_vec
+    targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
+    ;;
+ i[3456]86-sequent-bsd*)
     targ_defvec=i386dynix_vec
     targ_underscore=yes
     ;;
@@ -236,11 +270,16 @@
     targ_defvec=i386bsd_vec
     targ_underscore=yes
     ;;
-  i[3456]86-*-freebsd*)
+  i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | \
+  i[3456]86-*-freebsd[12])
     targ_defvec=i386freebsd_vec
     targ_selvecs=i386bsd_vec
     targ_underscore=yes
     ;;
+  i[3456]86-*-freebsd*)
+    targ_defvec=bfd_elf32_i386_vec
+    targ_selvecs=i386coff_vec
+    ;;
   i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
     targ_defvec=i386netbsd_vec
     targ_selvecs=i386bsd_vec
@@ -290,9 +329,15 @@
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs="i386pe_vec i386pei_vec"
     ;;
+  i[3456]86-*-interix*)
+    targ_defvec=i386pei_vec
+    targ_selvecs="i386pe_vec"
+    # FIXME: This should eventually be checked at runtime.
+    targ_cflags=-DSTRICT_PE_FORMAT
+    ;;
   i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe)
     targ_defvec=i386pe_vec
-    targ_selvecs="i386pe_vec i386pei_vec"
+    targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
     ;;
   i[3456]86-none-*)
     targ_defvec=i386coff_vec
@@ -300,6 +345,10 @@
   i[3456]86-*-aout* | i[3456]86*-*-vsta*)
     targ_defvec=i386aout_vec
     ;;
+  i[3456]86-*-vxworks*)
+    targ_defvec=i386aout_vec
+    targ_underscore=yes
+    ;;
 
   i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
     targ_defvec=i860coff_vec
@@ -323,6 +372,10 @@
     targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
     targ_underscore=yes
     ;;
+  i960-*-elf*)
+    targ_defvec=bfd_elf32_i960_vec
+    targ_selvecs="icoff_little_vec icoff_big_vec"
+    ;;
 
   m32r-*-*)
     targ_defvec=bfd_elf32_m32r_vec
@@ -344,17 +397,21 @@
     ;;
   m68*-*-aout*)
     targ_defvec=aout0_big_vec
-    # We include cisco_core_vec here, rather than making a separate cisco
+    # We include cisco_core_big_vec here, rather than making a separate cisco
     # configuration, so that cisco-core.c gets routinely tested at
     # least for compilation.
-    targ_selvecs="cisco_core_vec ieee_vec"
+    targ_selvecs="cisco_core_big_vec ieee_vec"
     targ_underscore=yes
     ;;
   m68*-*-elf* | m68*-*-sysv4*)
     targ_defvec=bfd_elf32_m68k_vec
     targ_selvecs="m68kcoff_vec ieee_vec"
     ;;
-  m68*-*-coff* | m68*-*-sysv* | m68*-*-rtems*)
+  m68*-*-rtems*)
+    targ_defvec=m68kcoff_vec
+    targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
+    ;;
+  m68*-*-coff* | m68*-*-sysv*)
     targ_defvec=m68kcoff_vec
     targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
     ;;
@@ -483,6 +540,11 @@
     targ_defvec=aout_mips_little_vec
     targ_cflags=-DSTAT_FOR_EXEC
     ;;
+  mips*-*-pe*)
+    targ_defvec=mipslpe_vec
+    targ_selvecs="mipslpei_vec mipslpei_vec ecoff_little_vec ecoff_big_vec"
+    targ_underscore=yes
+    ;;
   mips*-*-sysv4*)
     targ_defvec=bfd_elf32_bigmips_vec
     targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
@@ -491,7 +553,7 @@
     targ_defvec=ecoff_big_vec
     targ_selvecs=ecoff_little_vec
     ;;
-  mips*el-*-elf* | mips*el-*-vxworks*)
+  mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks*)
     targ_defvec=bfd_elf32_littlemips_vec
     targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
     ;;
@@ -529,6 +591,16 @@
     targ_underscore=yes
     ;;
 
+  pj-*-*)
+    targ_defvec=bfd_elf32_pj_vec
+    targ_selvecs="bfd_elf32_pj_vec bfd_elf32_pjl_vec"
+    ;;
+
+  pjl-*-*)
+    targ_defvec=bfd_elf32_pjl_vec
+    targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
+    ;;
+
   powerpc-*-aix* | powerpc-*-beos*)
     targ_defvec=rs6000coff_vec
     ;;
@@ -546,7 +618,8 @@
     targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
     ;;
   powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
-  powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks*)
+  powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+  powerpcle-*-rtems*)
     targ_defvec=bfd_elf32_powerpcle_vec
     targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
     ;;
@@ -560,11 +633,16 @@
     targ_defvec=rs6000coff_vec
     ;;
 
-  sh-*-elf*)
+  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"
     targ_underscore=yes
     ;;
+  sh-*-pe)
+    targ_defvec=shlpe_vec
+    targ_selvecs="shlpe_vec shlpei_vec"
+    targ_underscore=yes
+    ;;
   sh-*-* | sh-*-rtems*)
     targ_defvec=shcoff_vec
     targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
@@ -590,20 +668,35 @@
     ;;
   sparc-*-linux-gnu*)
     targ_defvec=bfd_elf32_sparc_vec
-    targ_selvecs="sparclinux_vec sunos_big_vec"
+    targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
     ;;
   sparc-*-lynxos*)
     targ_defvec=sparclynx_coff_vec
     targ_selvecs=sparclynx_aout_vec
     ;;
-  sparc-*-netbsd* | sparc-*-openbsd*)
+  sparc-*-netbsdelf*)
+    targ_defvec=bfd_elf32_sparc_vec
+    targ_selvecs=sparcnetbsd_vec
+    ;;
+  sparc-*-netbsdaout* | sparc-*-netbsd*)
+    targ_defvec=sparcnetbsd_vec
+    targ_selvecs=bfd_elf32_sparc_vec
+    targ_underscore=yes
+    ;;
+  sparc-*-openbsd*)
     targ_defvec=sparcnetbsd_vec
     targ_underscore=yes
     ;;
-  sparc-*-elf* | sparc-*-solaris2*)
+  sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
     targ_defvec=bfd_elf32_sparc_vec
     targ_selvecs=sunos_big_vec
     ;;
+#ifdef BFD64
+  sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
+    targ_defvec=bfd_elf32_sparc_vec
+    targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec"
+    ;;
+#endif
   sparc-*-sysv4*)
     targ_defvec=bfd_elf32_sparc_vec
     ;;
diff --git a/bfd/config.in b/bfd/config.in
index 51fa45b..7383656 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -67,9 +67,15 @@
 /* Define if you have the getcwd function.  */
 #undef HAVE_GETCWD
 
+/* Define if you have the getgid function.  */
+#undef HAVE_GETGID
+
 /* Define if you have the getpagesize function.  */
 #undef HAVE_GETPAGESIZE
 
+/* Define if you have the getuid function.  */
+#undef HAVE_GETUID
+
 /* Define if you have the madvise function.  */
 #undef HAVE_MADVISE
 
@@ -226,6 +232,9 @@
 /* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
 #undef HAVE_LWPSTATUS_T_PR_REG
 
+/* Define if <sys/procfs.h> has win32_pstatus_t. */
+#undef HAVE_WIN32_PSTATUS_T
+
 /* Name of host specific header file to include in trad-core.c. */
 #undef TRAD_HEADER
 
diff --git a/bfd/configure b/bfd/configure
index f6ca66f..fecd4a9 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
+# Generated automatically using autoconf version 2.13.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -16,8 +16,12 @@
 ac_help="$ac_help
   --enable-static[=PKGS]  build static libraries [default=yes]"
 ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
 ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+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"
@@ -354,7 +358,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
+    echo "configure generated by autoconf version 2.13.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -514,7 +518,7 @@
 
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -558,9 +562,130 @@
 if test -z "$ac_aux_dir"; then
   { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:572: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_host_alias=$host
+  case "$ac_cv_host_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      if ac_cv_host_alias=`$ac_config_guess`; then :
+      else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+      fi ;;
+    *) ac_cv_host_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+  ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:613: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_target_alias=$target
+  case "$ac_cv_target_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_target_alias=$host_alias ;;
+
+    *) ac_cv_target_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+  ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:653: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_build_alias=$build
+  case "$ac_cv_build_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_build_alias=$host_alias ;;
+
+    *) ac_cv_build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+  ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
 
 
 # Do some error checking and defaulting for the host and target type.
@@ -583,69 +708,6 @@
 *) { 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:594: 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:615: 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:633: 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, &&
@@ -654,8 +716,8 @@
 # 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:658: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:720: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -684,8 +746,8 @@
   # 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:688: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:750: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -731,12 +793,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:739: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:801: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -766,8 +828,8 @@
   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:771: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:833: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -778,12 +840,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 782 "configure"
+#line 844 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:849: \"$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
@@ -808,14 +870,14 @@
 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:813: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:875: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:818: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:880: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -823,7 +885,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:827: \"$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:889: \"$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
@@ -842,8 +904,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:846: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:908: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -874,7 +936,7 @@
 fi
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:878: checking for POSIXized ISC" >&5
+echo "configure:940: 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
@@ -907,9 +969,9 @@
 # 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:911: checking for a BSD compatible install" >&5
+echo "configure:973: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -927,6 +989,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -955,12 +1021,12 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:964: checking whether build environment is sane" >&5
+echo "configure:1030: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1008,18 +1074,18 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1021: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1087: 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
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
@@ -1046,7 +1112,7 @@
 
 PACKAGE=bfd
 
-VERSION=2.9.4
+VERSION=2.9.5
 
 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; }
@@ -1063,7 +1129,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1067: checking for working aclocal" >&5
+echo "configure:1133: 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.
@@ -1076,7 +1142,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1080: checking for working autoconf" >&5
+echo "configure:1146: 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.
@@ -1089,7 +1155,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1093: checking for working automake" >&5
+echo "configure:1159: 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.
@@ -1102,7 +1168,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1106: checking for working autoheader" >&5
+echo "configure:1172: 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.
@@ -1115,7 +1181,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1119: checking for working makeinfo" >&5
+echo "configure:1185: 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.
@@ -1138,8 +1204,8 @@
 # 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:1142: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+echo "configure:1208: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AR"; then
@@ -1170,8 +1236,8 @@
 # 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:1174: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1240: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1202,8 +1268,8 @@
   # 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:1206: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1272: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1282,11 +1348,34 @@
   enable_static=yes
 fi
 
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  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
+else
+  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
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1289: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1378: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1320,18 +1409,23 @@
   with_gnu_ld=no
 fi
 
-
 ac_prog=ld
 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:1329: checking for ld used by GCC" >&5
+echo "configure:1417: 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]:\\*)
-    test -z "$LD" && LD="$ac_prog"
-    ;;
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
   "")
     # If it fails, then pretend we aren't using GCC.
     ac_prog=ld
@@ -1343,19 +1437,19 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1347: checking for GNU ld" >&5
+echo "configure:1441: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1350: checking for non-GNU ld" >&5
+echo "configure:1444: checking for non-GNU ld" >&5
 fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -1363,7 +1457,7 @@
       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
+	test "$with_gnu_ld" != yes && break
       fi
     fi
   done
@@ -1380,10 +1474,9 @@
   echo "$ac_t""no" 1>&6
 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:1386: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+echo "configure:1479: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
@@ -1398,29 +1491,31 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1402: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+echo "configure:1495: checking for BSD-compatible nm" >&5
+if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   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}:"
-  for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+  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; then
+    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"
+	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"
+	ac_cv_path_NM="$ac_dir/nm -p"
+	break
       else
-        ac_cv_path_NM="$ac_dir/nm"
+	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
-      break
     fi
   done
   IFS="$ac_save_ifs"
@@ -1431,10 +1526,9 @@
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1437: checking whether ln -s works" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+echo "configure:1531: checking whether ln -s works" >&5
+if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftestdata
@@ -1453,24 +1547,37 @@
   echo "$ac_t""no" 1>&6
 fi
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
 
 # Check for any special flags to pass to ltconfig.
-libtool_flags=
+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 "$silent" = yes && libtool_flags="$libtool_flags --silent"
+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"
 
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1473 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1474: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1580 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1488,157 +1595,118 @@
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1602: checking whether the C compiler needs -belf" >&5
+if eval "test \"\${lt_cv_cc_needs_belf+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() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1614: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  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
   ;;
 
-*-*-cygwin*)
-  # 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:1499: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1531: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  DLLTOOL="false"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1566: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1598: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  AS="false"
-fi
-fi
-
-
-  ;;
 
 esac
 
+
+# Save cache, so that ltconfig can load it
+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
+
+
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+      test -f "$cache_file" && . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+
+# 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'
+
 # Redirect the config.log output again, so that the ltconfig log is not
 # clobbered by the next message.
 exec 5>>./config.log
@@ -1704,17 +1772,17 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1718: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1786: 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"
@@ -1737,12 +1805,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1741: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+echo "configure:1809: checking for Cygwin environment" >&5
+if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1746 "configure"
+#line 1814 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1753,7 +1821,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:1757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -1763,26 +1831,25 @@
   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:1774: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+echo "configure:1841: checking for mingw32 environment" >&5
+if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1779 "configure"
+#line 1846 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:1786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -1792,29 +1859,57 @@
   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 EMX OS/2 environment""... $ac_c" 1>&6
+echo "configure:1869: checking for EMX OS/2 environment" >&5
+if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1874 "configure"
+#include "confdefs.h"
+
+int main() {
+return __EMX__;
+; return 0; }
+EOF
+if { (eval echo configure:1881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_emxos2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_emxos2=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_emxos2" 1>&6
+EMXOS2=
+test "$ac_cv_emxos2" = yes && EMXOS2=yes
+
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1805: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+echo "configure:1900: checking for executable suffix" >&5
+if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = 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:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.C | *.o | *.obj | *.xcoff) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -1840,8 +1935,8 @@
 # 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:1844: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1939: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1870,8 +1965,8 @@
   # 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:1874: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1969: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1917,12 +2012,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:1925: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:2020: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1952,8 +2047,8 @@
   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:1957: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:2052: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1964,12 +2059,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1968 "configure"
+#line 2063 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2068: \"$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
@@ -1994,14 +2089,14 @@
 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:1999: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:2094: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:2004: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:2099: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -2009,7 +2104,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2013: \"$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:2108: \"$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
@@ -2028,8 +2123,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2032: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:2127: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -2062,13 +2157,13 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2066: checking how to run the C preprocessor" >&5
+echo "configure:2161: 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
+if eval "test \"\${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
@@ -2077,13 +2172,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2081 "configure"
+#line 2176 "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:2087: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2182: \"$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
   :
@@ -2094,13 +2189,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2098 "configure"
+#line 2193 "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:2104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2199: \"$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
   :
@@ -2111,13 +2206,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2115 "configure"
+#line 2210 "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:2121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2216: \"$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
   :
@@ -2142,12 +2237,12 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2146: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+echo "configure:2241: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2151 "configure"
+#line 2246 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2155,7 +2250,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2254: \"$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*
@@ -2172,7 +2267,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 2176 "configure"
+#line 2271 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2190,7 +2285,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 2194 "configure"
+#line 2289 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2211,7 +2306,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2215 "configure"
+#line 2310 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2222,7 +2317,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2246,12 +2341,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2250: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+echo "configure:2345: checking for working const" >&5
+if eval "test \"\${ac_cv_c_const+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2255 "configure"
+#line 2350 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2300,7 +2395,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2321,21 +2416,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2325: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+echo "configure:2420: checking for inline" >&5
+if eval "test \"\${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 2332 "configure"
+#line 2427 "configure"
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2361,12 +2456,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2365: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+echo "configure:2460: checking for off_t" >&5
+if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2370 "configure"
+#line 2465 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2377,29 +2472,31 @@
 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
+  eval "ac_cv_type_off_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_off_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'off_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define off_t long
 EOF
 
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2398: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+echo "configure:2495: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2403 "configure"
+#line 2500 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2410,17 +2507,19 @@
 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
+  eval "ac_cv_type_size_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_size_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define size_t unsigned
 EOF
 
@@ -2429,19 +2528,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:2433: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+echo "configure:2532: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2438 "configure"
+#line 2537 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2544: \"$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
@@ -2462,12 +2561,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2466: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+echo "configure:2565: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2471 "configure"
+#line 2570 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2495,7 +2594,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2598: \"$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
@@ -2527,12 +2626,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2531: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+echo "configure:2630: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2536 "configure"
+#line 2635 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2557,12 +2656,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:2561: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2660: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2566 "configure"
+#line 2665 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2571,6 +2670,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2580,12 +2680,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:2589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2689: \"$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
@@ -2612,15 +2712,15 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2616: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo "configure:2716: checking stack direction for C alloca" >&5
+if eval "test \"\${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 2624 "configure"
+#line 2724 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2639,7 +2739,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2743: \"$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
@@ -2664,17 +2764,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2668: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:2768: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2673 "configure"
+#line 2773 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2778: \"$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*
@@ -2703,12 +2803,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2707: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2807: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2712 "configure"
+#line 2812 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2717,6 +2817,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2726,12 +2827,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:2735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2836: \"$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
@@ -2756,15 +2857,15 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2760: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+echo "configure:2861: checking for working mmap" >&5
+if eval "test \"\${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 2768 "configure"
+#line 2869 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2904,7 +3005,7 @@
 }
 
 EOF
-if { (eval echo configure:2908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3009: \"$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
@@ -2932,17 +3033,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2936: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3037: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2941 "configure"
+#line 3042 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3047: \"$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*
@@ -2972,12 +3073,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2976: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3077: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2981 "configure"
+#line 3082 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2986,6 +3087,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2995,12 +3097,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3106: \"$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
@@ -3029,12 +3131,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3033: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3135: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3038 "configure"
+#line 3140 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3043,6 +3145,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3052,12 +3155,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3164: \"$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
@@ -3091,19 +3194,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3095: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+echo "configure:3198: checking for LC_MESSAGES" >&5
+if eval "test \"\${am_cv_val_LC_MESSAGES+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3100 "configure"
+#line 3203 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3210: \"$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
@@ -3124,7 +3227,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3128: checking whether NLS is requested" >&5
+echo "configure:3231: 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"
@@ -3144,7 +3247,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3148: checking whether included gettext is requested" >&5
+echo "configure:3251: 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"
@@ -3163,17 +3266,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3167: checking for libintl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3270: checking for libintl.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3172 "configure"
+#line 3275 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3280: \"$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*
@@ -3190,19 +3293,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:3194: checking for gettext in libc" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+echo "configure:3297: checking for gettext in libc" >&5
+if eval "test \"\${gt_cv_func_gettext_libc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3199 "configure"
+#line 3302 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3309: \"$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
@@ -3218,15 +3321,15 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3222: 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 "configure:3325: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 3230 "configure"
+#line 3333 "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
@@ -3237,7 +3340,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3344: \"$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
@@ -3253,19 +3356,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:3257: checking for gettext in libintl" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+echo "configure:3360: checking for gettext in libintl" >&5
+if eval "test \"\${gt_cv_func_gettext_libintl+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3262 "configure"
+#line 3365 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3372: \"$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
@@ -3293,8 +3396,8 @@
 	      # 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:3297: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3400: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3327,12 +3430,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3331: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3434: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3336 "configure"
+#line 3439 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3341,6 +3444,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3350,12 +3454,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3463: \"$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
@@ -3382,8 +3486,8 @@
 		# 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:3386: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3490: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3418,8 +3522,8 @@
 		# 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:3422: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3526: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3450,7 +3554,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3454 "configure"
+#line 3558 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3458,7 +3562,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3490,8 +3594,8 @@
         # 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:3494: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3598: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3524,8 +3628,8 @@
         # 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:3528: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3632: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3560,8 +3664,8 @@
         # 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:3564: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3668: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3650,7 +3754,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3654: checking for catalogs to be installed" >&5
+echo "configure:3758: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3678,17 +3782,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:3682: checking for linux/version.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3786: checking for linux/version.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3687 "configure"
+#line 3791 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3796: \"$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*
@@ -3766,9 +3870,9 @@
 # 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:3770: checking for a BSD compatible install" >&5
+echo "configure:3874: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -3786,6 +3890,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -3814,7 +3922,7 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
@@ -3849,19 +3957,22 @@
   EXEEXT_FOR_BUILD='$(EXEEXT)'
 else
   echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:3853: checking for build system executable suffix" >&5
-if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
+echo "configure:3961: checking for build system executable suffix" >&5
+if eval "test \"\${bfd_cv_build_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > ac_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-    ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
-    bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
-    rm -f ac_c_test*
-    test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
+  rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     bfd_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
 fi
 
 echo "$ac_t""$bfd_cv_build_exeext" 1>&6
@@ -3874,17 +3985,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3878: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3989: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3883 "configure"
+#line 3994 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3999: \"$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*
@@ -3914,17 +4025,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3918: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4029: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3923 "configure"
+#line 4034 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4039: \"$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*
@@ -3951,12 +4062,12 @@
 done
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3955: 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 "configure:4066: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"\${ac_cv_header_time+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3960 "configure"
+#line 4071 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3965,7 +4076,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3990,12 +4101,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:3994: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+echo "configure:4105: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3999 "configure"
+#line 4110 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4003,7 +4114,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4007: \"$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*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4028,15 +4139,15 @@
 # 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:4032: 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 "configure:4143: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4040 "configure"
+#line 4151 "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
@@ -4047,7 +4158,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4162: \"$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
@@ -4069,15 +4180,15 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4073: 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 "configure:4184: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4081 "configure"
+#line 4192 "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
@@ -4088,7 +4199,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4203: \"$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
@@ -4110,15 +4221,15 @@
 
 fi
 
-for ac_func in fcntl getpagesize setitimer sysconf fdopen
+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:4117: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:4228: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4122 "configure"
+#line 4233 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4127,6 +4238,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4136,12 +4248,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4257: \"$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
@@ -4168,7 +4280,7 @@
 
 
 case "${host}" in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
   cat >> confdefs.h <<\EOF
 #define USE_BINARY_FOPEN 1
 EOF
@@ -4176,12 +4288,12 @@
 esac
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4180: checking whether strstr must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
+echo "configure:4292: checking whether strstr must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_strstr+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4185 "configure"
+#line 4297 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4202,7 +4314,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:4206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -4223,12 +4335,12 @@
 fi
 
 echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4227: checking whether malloc must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
+echo "configure:4339: checking whether malloc must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_malloc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4232 "configure"
+#line 4344 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4249,7 +4361,7 @@
 char *(*pfn) = (char *(*)) malloc
 ; return 0; }
 EOF
-if { (eval echo configure:4253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_malloc=no
 else
@@ -4270,12 +4382,12 @@
 fi
 
 echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4274: checking whether realloc must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
+echo "configure:4386: checking whether realloc must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_realloc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4279 "configure"
+#line 4391 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4296,7 +4408,7 @@
 char *(*pfn) = (char *(*)) realloc
 ; return 0; }
 EOF
-if { (eval echo configure:4300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_realloc=no
 else
@@ -4317,12 +4429,12 @@
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4321: checking whether free must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
+echo "configure:4433: checking whether free must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_free+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4326 "configure"
+#line 4438 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4343,7 +4455,7 @@
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:4347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4459: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -4364,12 +4476,12 @@
 fi
 
 echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4368: checking whether getenv must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
+echo "configure:4480: checking whether getenv must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_getenv+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4373 "configure"
+#line 4485 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4390,7 +4502,7 @@
 char *(*pfn) = (char *(*)) getenv
 ; return 0; }
 EOF
-if { (eval echo configure:4394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_getenv=no
 else
@@ -4429,8 +4541,13 @@
   hppa*-*-mpeix*)	COREFILE=hpux-core.lo ;;
   hppa*-*-bsd*)		COREFILE="hpux-core.lo hppabsd-core.lo"
 			COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
+  i370-*-*)		
+	COREFILE=trad-core.lo
+	TRAD_HEADER='"hosts/i370linux.h"'
+	;;
+
   i[3456]86-sequent-bsd*)
-	COREFILE=trad-core.lo;
+	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/symmetry.h"'
 	;;
   i[3456]86-sequent-sysv4*) ;;
@@ -4591,17 +4708,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4595: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4712: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4600 "configure"
+#line 4717 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4722: \"$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*
@@ -4629,19 +4746,19 @@
 
   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:4633: 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 "configure:4750: checking for prstatus_t in sys/procfs.h" >&5
+ if eval "test \"\${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 4638 "configure"
+#line 4755 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 prstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prstatus_t=yes
 else
@@ -4663,19 +4780,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
 
     echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4667: 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 "configure:4784: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+ if eval "test \"\${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 4672 "configure"
+#line 4789 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 prstatus_t avar; void* aref = (void*) &avar.pr_who
 ; return 0; }
 EOF
-if { (eval echo configure:4679: \"$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_have_sys_procfs_type_member_prstatus_t_pr_who=yes
 else
@@ -4697,19 +4814,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
 
     echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4701: 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 "configure:4818: checking for pstatus_t in sys/procfs.h" >&5
+ if eval "test \"\${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 4706 "configure"
+#line 4823 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pstatus_t=yes
 else
@@ -4731,19 +4848,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
 
     echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4735: 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 "configure:4852: checking for prpsinfo_t in sys/procfs.h" >&5
+ if eval "test \"\${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 4740 "configure"
+#line 4857 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 prpsinfo_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
 else
@@ -4765,19 +4882,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
 
     echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4769: 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 "configure:4886: checking for psinfo_t in sys/procfs.h" >&5
+ if eval "test \"\${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 4774 "configure"
+#line 4891 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 psinfo_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_psinfo_t=yes
 else
@@ -4799,19 +4916,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
 
     echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4803: 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 "configure:4920: checking for lwpstatus_t in sys/procfs.h" >&5
+ if eval "test \"\${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 4808 "configure"
+#line 4925 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
 else
@@ -4833,19 +4950,19 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
 
     echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4837: 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 "configure:4954: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+ if eval "test \"\${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 4842 "configure"
+#line 4959 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar; void* aref = (void*) &avar.pr_context
 ; return 0; }
 EOF
-if { (eval echo configure:4849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4966: \"$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
@@ -4867,19 +4984,19 @@
  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:4871: 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 "configure:4988: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+ if eval "test \"\${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 4876 "configure"
+#line 4993 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
 ; return 0; }
 EOF
-if { (eval echo configure:4883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5000: \"$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
@@ -4900,6 +5017,40 @@
  fi
  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:5022: checking for win32_pstatus_t in sys/procfs.h" >&5
+ if eval "test \"\${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 5027 "configure"
+#include "confdefs.h"
+#include <sys/procfs.h>
+int main() {
+win32_pstatus_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_win32_pstatus_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_win32_pstatus_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_WIN32_PSTATUS_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_win32_pstatus_t" 1>&6
+
   fi
 fi
 
@@ -4929,7 +5080,7 @@
 if test -n "$enable_targets" ; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result" ; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -4964,7 +5115,7 @@
 # 64-bit support needs to be compiled in.  Currently, it will be included if
 # the default or any other explicitly requested target requires it; it
 # will not be included on a 32-bit host if no 64-bit target is requested, and
-# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is
+# no "--with-64-bit-bfd" option is given, even if "--enable-targets=all" is
 # used.
 
 # uniq the default and selected vectors in all the configured targets.
@@ -5002,14 +5153,15 @@
     a_out_adobe_vec)		tb="$tb aout-adobe.lo aout32.lo" ;;
     armcoff_little_vec)		tb="$tb coff-arm.lo cofflink.lo " ;;
     armcoff_big_vec)		tb="$tb coff-arm.lo cofflink.lo " ;;
-    armpe_little_vec)		tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
-    armpe_big_vec)		tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
-    armpei_little_vec)		tb="$tb pei-arm.lo cofflink.lo " ;;
-    armpei_big_vec)		tb="$tb pei-arm.lo cofflink.lo " ;;
-    arm_epoc_pe_little_vec)	tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
-    arm_epoc_pe_big_vec)	tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
-    arm_epoc_pei_little_vec)	tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
-    arm_epoc_pei_big_vec)	tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
+    armnetbsd_vec)		tb="$tb armnetbsd.lo aout32.lo" ;;
+    armpe_little_vec)		tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+    armpe_big_vec)		tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+    armpei_little_vec)		tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+    armpei_big_vec)		tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pe_little_vec)	tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pe_big_vec)	tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pei_little_vec)	tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pei_big_vec)	tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
     aout0_big_vec)		tb="$tb aout0.lo aout32.lo" ;;
     aout_arm_big_vec)		tb="$tb aout-arm.lo aout32.lo" ;;
     aout_arm_little_vec)	tb="$tb aout-arm.lo aout32.lo" ;;
@@ -5020,6 +5172,7 @@
     b_out_vec_little_host)	tb="$tb bout.lo aout32.lo" ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"
 				target64=true ;;
+    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" ;;
     bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
@@ -5034,8 +5187,10 @@
     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_elf32_i860_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"
@@ -5047,6 +5202,8 @@
     bfd_elf32_mcore_little_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
     bfd_elf32_mn10200_vec)	tb="$tb elf-m10200.lo elf32.lo $elf" ;;
     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+    bfd_elf32_pj_vec)           tb="$tb elf32-pj.lo elf32.lo $elf";;
+    bfd_elf32_pjl_vec)          tb="$tb elf32-pj.lo elf32.lo $elf";;
     bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
     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" ;;
@@ -5059,7 +5216,8 @@
 				target64=true ;;
     bfd_elf64_sparc_vec)	tb="$tb elf64-sparc.lo elf64.lo $elf"
 				target64=true ;;
-    cisco_core_vec)		tb="$tb cisco-core.lo" ;;
+    cisco_core_big_vec)		tb="$tb cisco-core.lo" ;;
+    cisco_core_little_vec)	tb="$tb cisco-core.lo" ;;
     demo_64_vec)		tb="$tb demo64.lo aout64.lo"
 				target64=true ;;
     ecoff_big_vec)		tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@@ -5080,8 +5238,8 @@
     i386dynix_vec)		tb="$tb i386dynix.lo aout32.lo" ;;
     i386freebsd_vec)		tb="$tb i386freebsd.lo aout32.lo" ;;
     i386msdos_vec)		tb="$tb i386msdos.lo" ;;
-    i386pe_vec)			tb="$tb pe-i386.lo cofflink.lo " ;;
-    i386pei_vec)		tb="$tb pei-i386.lo cofflink.lo" ;;
+    i386pe_vec)			tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
+    i386pei_vec)		tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
     i386linux_vec)		tb="$tb i386linux.lo aout32.lo" ;;
     i386lynx_aout_vec)		tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
     i386lynx_coff_vec)		tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
@@ -5102,10 +5260,12 @@
     m68kaux_coff_vec)		tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-    mcore_pe_big_vec)		tb="$tb pe-mcore.lo cofflink.lo" ;;
-    mcore_pe_little_vec)	tb="$tb pe-mcore.lo cofflink.lo" ;;
-    mcore_pei_big_vec)		tb="$tb pei-mcore.lo cofflink.lo" ;;
-    mcore_pei_little_vec)	tb="$tb pei-mcore.lo cofflink.lo" ;;
+    mipslpe_vec)		tb="$tb pe-mips.lo cofflink.lo" ;;
+    mipslpei_vec)		tb="$tb pei-mips.lo cofflink.lo" ;;
+    mcore_pe_big_vec)		tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pe_little_vec)	tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pei_big_vec)		tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pei_little_vec)	tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
     newsos3_vec)		tb="$tb newsos3.lo aout32.lo" ;;
     nlm32_i386_vec)		tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
     nlm32_sparc_vec)		tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
@@ -5117,15 +5277,17 @@
     pc532machaout_vec)		tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
     pmac_xcoff_vec)		tb="$tb coff-pmac.lo xcofflink.lo" ;;
     rs6000coff_vec)		tb="$tb coff-rs6000.lo xcofflink.lo" ;;
-    bfd_powerpc_pe_vec)         tb="$tb pe-ppc.lo cofflink.lo" ;;  
-    bfd_powerpcle_pe_vec)       tb="$tb pe-ppc.lo cofflink.lo" ;;  
-    bfd_powerpc_pei_vec)        tb="$tb pei-ppc.lo cofflink.lo" ;;
-    bfd_powerpcle_pei_vec)      tb="$tb pei-ppc.lo cofflink.lo" ;;
+    bfd_powerpc_pe_vec)         tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;  
+    bfd_powerpcle_pe_vec)       tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;  
+    bfd_powerpc_pei_vec)        tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+    bfd_powerpcle_pei_vec)      tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
     ppcboot_vec)		tb="$tb ppcboot.lo" ;;
     shcoff_vec)			tb="$tb coff-sh.lo cofflink.lo" ;;
     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" ;;
     som_vec)			tb="$tb som.lo" ;;
     sparcle_aout_vec)		tb="$tb aout-sparcle.lo aout32.lo" ;;
     sparclinux_vec)		tb="$tb sparclinux.lo aout32.lo" ;;
@@ -5228,17 +5390,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5239: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:5394: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5244 "configure"
+#line 5399 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5404: \"$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*
@@ -5267,12 +5429,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5278: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:5433: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5283 "configure"
+#line 5438 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5281,6 +5443,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -5290,12 +5453,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5462: \"$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
@@ -5320,15 +5483,15 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:5331: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+echo "configure:5487: checking for working mmap" >&5
+if eval "test \"\${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 5339 "configure"
+#line 5495 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -5468,7 +5631,7 @@
 }
 
 EOF
-if { (eval echo configure:5479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5635: \"$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
@@ -5493,12 +5656,12 @@
 for ac_func in madvise mprotect
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5504: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:5660: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5509 "configure"
+#line 5665 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5507,6 +5670,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -5516,12 +5680,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5689: \"$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
@@ -5643,7 +5807,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.13"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -5715,12 +5879,8 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
 s%@LN_S@%$LN_S%g
 s%@LIBTOOL@%$LIBTOOL%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@AS@%$AS%g
 s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
 s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
 s%@MAINT@%$MAINT%g
@@ -5983,5 +6143,5 @@
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
 
diff --git a/bfd/configure.bat b/bfd/configure.bat
deleted file mode 100644
index 78fe79e..0000000
--- a/bfd/configure.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off

-if "%1" == "h8/300" goto h8300

-

-echo Configuring bfd for go32

-update hosts\go32.h sysdep.h

-update Makefile.dos Makefile

-echo s/@WORDSIZE@/32/g>config.sed

-sed -e s/^/s\/@VERSION@\// -e s/$/\/g/g version >>config.sed

-sed -f config.sed < bfd-in2.h > bfd.h2

-update bfd.h2 bfd.h

-goto exit

-

-:h8300

-echo Configuring bfd for H8/300

-update hosts\h-go32.h sysdep.h

-update Makefile.dos Makefile

-

-:exit

diff --git a/bfd/configure.host b/bfd/configure.host
index ef7048b..e24cd60 100644
--- a/bfd/configure.host
+++ b/bfd/configure.host
@@ -63,6 +63,8 @@
 			ac_cv_func_getpagesize=no
 			ac_cv_func_madvise=no
 			ac_cv_func_mprotect=no
+			ac_cv_func_getuid=no
+			ac_cv_func_getgid=no
 			ac_cv_header_sys_file_h=no
 			ac_cv_header_sys_time_h=no
 			ac_cv_header_unistd_h=no
diff --git a/bfd/configure.in b/bfd/configure.in
index 3a3e36f..df2b613 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.4)
+AM_INIT_AUTOMAKE(bfd, 2.9.5)
 
 dnl These must be called before AM_PROG_LIBTOOL, because it may want
 dnl to call AC_CHECK_PROG.
@@ -98,7 +98,7 @@
 AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
 AC_HEADER_TIME
 AC_HEADER_DIRENT
-AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen)
+AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
 
 BFD_BINARY_FOPEN
 
@@ -126,10 +126,15 @@
   hppa*-*-mpeix*)	COREFILE=hpux-core.lo ;;
   hppa*-*-bsd*)		COREFILE="hpux-core.lo hppabsd-core.lo"
 			COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
+  i370-*-*)		
+	COREFILE=trad-core.lo
+	TRAD_HEADER='"hosts/i370linux.h"'
+	;;
+
 changequote(,)dnl
   i[3456]86-sequent-bsd*)
 changequote([,])dnl
-	COREFILE=trad-core.lo;
+	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/symmetry.h"'
 	;;
 changequote(,)dnl
@@ -314,6 +319,7 @@
     BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_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)
   fi
 fi
 AC_SUBST(COREFILE)
@@ -341,7 +347,7 @@
 if test -n "$enable_targets" ; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result" ; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -376,7 +382,7 @@
 # 64-bit support needs to be compiled in.  Currently, it will be included if
 # the default or any other explicitly requested target requires it; it
 # will not be included on a 32-bit host if no 64-bit target is requested, and
-# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is
+# no "--with-64-bit-bfd" option is given, even if "--enable-targets=all" is
 # used.
 
 # uniq the default and selected vectors in all the configured targets.
@@ -414,14 +420,15 @@
     a_out_adobe_vec)		tb="$tb aout-adobe.lo aout32.lo" ;;
     armcoff_little_vec)		tb="$tb coff-arm.lo cofflink.lo " ;;
     armcoff_big_vec)		tb="$tb coff-arm.lo cofflink.lo " ;;
-    armpe_little_vec)		tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
-    armpe_big_vec)		tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
-    armpei_little_vec)		tb="$tb pei-arm.lo cofflink.lo " ;;
-    armpei_big_vec)		tb="$tb pei-arm.lo cofflink.lo " ;;
-    arm_epoc_pe_little_vec)	tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
-    arm_epoc_pe_big_vec)	tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
-    arm_epoc_pei_little_vec)	tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
-    arm_epoc_pei_big_vec)	tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
+    armnetbsd_vec)		tb="$tb armnetbsd.lo aout32.lo" ;;
+    armpe_little_vec)		tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+    armpe_big_vec)		tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+    armpei_little_vec)		tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+    armpei_big_vec)		tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pe_little_vec)	tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pe_big_vec)	tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pei_little_vec)	tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+    arm_epoc_pei_big_vec)	tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
     aout0_big_vec)		tb="$tb aout0.lo aout32.lo" ;;
     aout_arm_big_vec)		tb="$tb aout-arm.lo aout32.lo" ;;
     aout_arm_little_vec)	tb="$tb aout-arm.lo aout32.lo" ;;
@@ -432,6 +439,7 @@
     b_out_vec_little_host)	tb="$tb bout.lo aout32.lo" ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"
 				target64=true ;;
+    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" ;;
     bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
@@ -446,8 +454,10 @@
     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_elf32_i860_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"
@@ -459,6 +469,8 @@
     bfd_elf32_mcore_little_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
     bfd_elf32_mn10200_vec)	tb="$tb elf-m10200.lo elf32.lo $elf" ;;
     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+    bfd_elf32_pj_vec)           tb="$tb elf32-pj.lo elf32.lo $elf";;
+    bfd_elf32_pjl_vec)          tb="$tb elf32-pj.lo elf32.lo $elf";;
     bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
     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" ;;
@@ -471,7 +483,8 @@
 				target64=true ;;
     bfd_elf64_sparc_vec)	tb="$tb elf64-sparc.lo elf64.lo $elf"
 				target64=true ;;
-    cisco_core_vec)		tb="$tb cisco-core.lo" ;;
+    cisco_core_big_vec)		tb="$tb cisco-core.lo" ;;
+    cisco_core_little_vec)	tb="$tb cisco-core.lo" ;;
     demo_64_vec)		tb="$tb demo64.lo aout64.lo"
 				target64=true ;;
     ecoff_big_vec)		tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@@ -492,8 +505,8 @@
     i386dynix_vec)		tb="$tb i386dynix.lo aout32.lo" ;;
     i386freebsd_vec)		tb="$tb i386freebsd.lo aout32.lo" ;;
     i386msdos_vec)		tb="$tb i386msdos.lo" ;;
-    i386pe_vec)			tb="$tb pe-i386.lo cofflink.lo " ;;
-    i386pei_vec)		tb="$tb pei-i386.lo cofflink.lo" ;;
+    i386pe_vec)			tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
+    i386pei_vec)		tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
     i386linux_vec)		tb="$tb i386linux.lo aout32.lo" ;;
     i386lynx_aout_vec)		tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
     i386lynx_coff_vec)		tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
@@ -514,10 +527,12 @@
     m68kaux_coff_vec)		tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-    mcore_pe_big_vec)		tb="$tb pe-mcore.lo cofflink.lo" ;;
-    mcore_pe_little_vec)	tb="$tb pe-mcore.lo cofflink.lo" ;;
-    mcore_pei_big_vec)		tb="$tb pei-mcore.lo cofflink.lo" ;;
-    mcore_pei_little_vec)	tb="$tb pei-mcore.lo cofflink.lo" ;;
+    mipslpe_vec)		tb="$tb pe-mips.lo cofflink.lo" ;;
+    mipslpei_vec)		tb="$tb pei-mips.lo cofflink.lo" ;;
+    mcore_pe_big_vec)		tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pe_little_vec)	tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pei_big_vec)		tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
+    mcore_pei_little_vec)	tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
     newsos3_vec)		tb="$tb newsos3.lo aout32.lo" ;;
     nlm32_i386_vec)		tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
     nlm32_sparc_vec)		tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
@@ -529,15 +544,17 @@
     pc532machaout_vec)		tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
     pmac_xcoff_vec)		tb="$tb coff-pmac.lo xcofflink.lo" ;;
     rs6000coff_vec)		tb="$tb coff-rs6000.lo xcofflink.lo" ;;
-    bfd_powerpc_pe_vec)         tb="$tb pe-ppc.lo cofflink.lo" ;;  
-    bfd_powerpcle_pe_vec)       tb="$tb pe-ppc.lo cofflink.lo" ;;  
-    bfd_powerpc_pei_vec)        tb="$tb pei-ppc.lo cofflink.lo" ;;
-    bfd_powerpcle_pei_vec)      tb="$tb pei-ppc.lo cofflink.lo" ;;
+    bfd_powerpc_pe_vec)         tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;  
+    bfd_powerpcle_pe_vec)       tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;  
+    bfd_powerpc_pei_vec)        tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+    bfd_powerpcle_pei_vec)      tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
     ppcboot_vec)		tb="$tb ppcboot.lo" ;;
     shcoff_vec)			tb="$tb coff-sh.lo cofflink.lo" ;;
     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" ;;
     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/cpu-arm.c b/bfd/cpu-arm.c
index d999c0f..bda9c44 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -1,5 +1,5 @@
 /* BFD support for the ARM processor
-   Copyright 1994, 95, 1997 Free Software Foundation, Inc.
+   Copyright 1994, 95, 97, 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.
@@ -82,10 +82,17 @@
   { bfd_mach_arm_3,  "arm7di"   },
   { bfd_mach_arm_3M, "arm7dm"   },
   { bfd_mach_arm_3M, "arm7dmi"  },
+  { bfd_mach_arm_4T, "arm7tdmi" },
   { bfd_mach_arm_4,  "arm8"     },
   { bfd_mach_arm_4,  "arm810"   },
+  { bfd_mach_arm_4,  "arm9"     },
+  { bfd_mach_arm_4,  "arm920"   },
+  { bfd_mach_arm_4T, "arm920t"  },
+  { bfd_mach_arm_4T, "arm9tdmi" },
   { bfd_mach_arm_4,  "sa1"      },
-  { bfd_mach_arm_4T, "arm7tdmi" }
+  { bfd_mach_arm_4,  "strongarm"},
+  { bfd_mach_arm_4,  "strongarm110" },
+  { bfd_mach_arm_4,  "strongarm1100" },
 };
 
 static boolean 
@@ -127,7 +134,9 @@
   N( bfd_mach_arm_3,  "armv3",  false, & arch_info_struct[3] ),
   N( bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4] ),
   N( bfd_mach_arm_4,  "armv4",  false, & arch_info_struct[5] ),
-  N( bfd_mach_arm_4T, "armv4t", false, NULL )
+  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 )
 };
 
 const bfd_arch_info_type bfd_arm_arch =
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
new file mode 100644
index 0000000..637b13f
--- /dev/null
+++ b/bfd/cpu-avr.c
@@ -0,0 +1,89 @@
+/* BFD library support routines for the AVR architecture.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Denis Chertykov <denisc@overta.ru>
+
+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"
+
+
+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 */		\
+  addr_bits,			/* bits in an address */	\
+  8,				/* 8 bits in a byte */		\
+  bfd_arch_avr,							\
+  machine,			/* machine */			\
+  "avr",			/* arch_name  */		\
+  print,			/* printable name */		\
+  1,				/* section align power */	\
+  default,			/* the default machine */	\
+  compatible,							\
+  bfd_default_scan,						\
+  next								\
+}
+
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  /* AT90S1200 */
+  N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
+
+  /* AT90S2xxx, AT90S4xxx, AT90S81xx, 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)
+};
+
+const bfd_arch_info_type bfd_avr_arch =
+  N (16, bfd_mach_avr2, "avr", true, & arch_info_struct[0]);
+
+/* This routine is provided two arch_infos and works out which AVR
+   machine which would be compatible with both and returns a pointer
+   to its info structure.  */
+
+static const bfd_arch_info_type *
+compatible (a,b)
+     const bfd_arch_info_type * a;
+     const bfd_arch_info_type * b;
+{
+  /* If a & b are for different architectures we can do nothing.  */
+  if (a->arch != b->arch)
+    return NULL;
+
+  /* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4).  */
+  if ((a->mach == 3 && b->mach == 4)
+      || (a->mach == 4 && b->mach == 3))
+    return NULL;
+
+  /* So far all newer AVR architecture cores are supersets of previous
+     cores.  */
+  if (a->mach <= b->mach)
+    return b;
+
+  /* Never reached!  */
+  return NULL;
+}
diff --git a/bfd/cpu-d10v.c b/bfd/cpu-d10v.c
index a1ff088..e16c3b7 100644
--- a/bfd/cpu-d10v.c
+++ b/bfd/cpu-d10v.c
@@ -1,5 +1,5 @@
 /* BFD support for the D10V processor
-   Copyright 1996 Free Software Foundation, Inc.
+   Copyright 1996, 1999 Free Software Foundation, Inc.
    Contributed by Martin Hunt (hunt@cygnus.com).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -22,19 +22,50 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-const bfd_arch_info_type bfd_d10v_arch = 
+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,
-    0,		
-    "d10v",				
-    "d10v",				
-    4, /* section alignment power */	
-    true,				
-    bfd_default_compatible, 		
-    bfd_default_scan,			
-    0,				
+  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 = 
+{
+  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,				
+};
+
+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-h8500.c b/bfd/cpu-h8500.c
index e4abfd1..eae42e3 100644
--- a/bfd/cpu-h8500.c
+++ b/bfd/cpu-h8500.c
@@ -1,5 +1,5 @@
 /* BFD library support routines for the H8/500 architecture.
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1999 Free Software Foundation, Inc.
    Hacked by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -156,7 +156,7 @@
 
 static boolean 
 scan_mach (info, string)
-     const struct bfd_arch_info *info;
+     const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
      const char *string;
 {
   if (strcmp(string,"h8/500") == 0) return true;
diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c
index 5d26a92..5c17743 100644
--- a/bfd/cpu-hppa.c
+++ b/bfd/cpu-hppa.c
@@ -54,6 +54,23 @@
   &bfd_hppa10_arch,
 };
 
+/* PA2.0 in wide mode */
+static const bfd_arch_info_type bfd_hppa20w_arch =
+{
+  64,				/* 32 bits in a word */
+  64,				/* 32 bits in an address */
+  8,				/* 8 bits in a byte */
+  bfd_arch_hppa,
+  25,				/* ??? How best to describe wide mode here?  */
+  "hppa",
+  "hppa2.0w",
+  3,
+  false,			/* Unless we use 1.1 specific features */
+  bfd_default_compatible, 
+  bfd_default_scan ,
+  &bfd_hppa20_arch,
+};
+
 const bfd_arch_info_type bfd_hppa_arch =
 {
   32,				/* 32 bits in a word */
@@ -67,5 +84,5 @@
   false,			/* 1.1 specific features used */
   bfd_default_compatible, 
   bfd_default_scan ,
-  &bfd_hppa20_arch,
+  &bfd_hppa20w_arch,
 };
diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c
new file mode 100644
index 0000000..2331eef
--- /dev/null
+++ b/bfd/cpu-i370.c
@@ -0,0 +1,94 @@
+/* BFD i370 CPU definition
+   Copyright (C) 1994, 95, 96, 98, 99, 2000 Free Software Foundation, Inc.
+   Contributed by Ian Lance Taylor, Cygnus Support.
+   Hacked by Linas Vepstas <linas@linas.org> in 1998, 1999
+
+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"
+
+/* The common i360/370 architecture comes in many forms  */
+
+static const bfd_arch_info_type *i370_compatible
+  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
+
+static const bfd_arch_info_type *
+i370_compatible (a, b)
+     const bfd_arch_info_type *a;
+     const bfd_arch_info_type *b;
+{
+  BFD_ASSERT (a->arch == bfd_arch_i370);
+  switch (b->arch)
+    {
+    default:
+      return NULL;
+    case bfd_arch_i370:
+      return bfd_default_compatible (a, b);
+    }
+  /*NOTREACHED*/
+}
+
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  /* hack alert: old old machines are really 16 and 24 bit arch ... */
+  {
+    32, /* 32 bits in a word */
+    32, /* 32 bits in an address */
+    8,  /* 8 bits in a byte */
+    bfd_arch_i370,
+    360, /* for the 360 */
+    "i370",
+    "i370:360",
+    3,
+    false, /* not the default */
+    i370_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_i370,
+    370, /* for the 370 */
+    "i370",
+    "i370:370",
+    3,
+    false, /* not the default */
+    i370_compatible,
+    bfd_default_scan,
+    0
+  },
+};
+
+const bfd_arch_info_type bfd_i370_arch =
+  {
+    32, /* 32 bits in a word */
+    32, /* 32 bits in an address */
+    8,  /* 8 bits in a byte */
+    bfd_arch_i370,
+    0,  /* for the 360/370 common architecture */
+    "i370",
+    "i370:common",
+    3,
+    true, /* the default */
+    i370_compatible,
+    bfd_default_scan,
+    &arch_info_struct[0]
+  };
diff --git a/bfd/cpu-m10300.c b/bfd/cpu-m10300.c
index 5aa0bfe..c14428e 100644
--- a/bfd/cpu-m10300.c
+++ b/bfd/cpu-m10300.c
@@ -1,5 +1,5 @@
 /* BFD support for the Matsushita 10300 processor
-   Copyright 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -21,12 +21,26 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-#define NEXT NULL
+const bfd_arch_info_type bfd_am33_arch =
+  {
+    32, /* 32 bits in a word */
+    32, /* 32 bits in an address */
+    8,  /* 8 bits in a byte */
+    bfd_arch_mn10300,
+    330,
+    "am33",
+    "am33",
+    2,
+    false,
+    bfd_default_compatible,
+    bfd_default_scan,
+    0,
+  };
 
 const bfd_arch_info_type bfd_mn10300_arch =
   {
-    32, /* 16 bits in a word */
-    32, /* 16 bits in an address */
+    32, /* 32 bits in a word */
+    32, /* 32 bits in an address */
     8,  /* 8 bits in a byte */
     bfd_arch_mn10300,
     300,
@@ -35,7 +49,6 @@
     2,
     true, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
-    NEXT,
+    bfd_default_scan,
+    &bfd_am33_arch,
   };
-
diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c
index bd3cc31..895ad41 100644
--- a/bfd/cpu-m32r.c
+++ b/bfd/cpu-m32r.c
@@ -27,6 +27,13 @@
 
 #define NEXT NULL
 
+static const bfd_arch_info_type arch_info_struct[] = 
+{
+  N (bfd_mach_m32rx, "m32rx", false, NULL)
+};
+
+#undef NEXT
+#define NEXT &arch_info_struct[0]
 
 const bfd_arch_info_type bfd_m32r_arch =
   N (bfd_mach_m32r, "m32r", true, NEXT);
diff --git a/bfd/cpu-mcore.c b/bfd/cpu-mcore.c
index 7dbfe1b..760bcde 100644
--- a/bfd/cpu-mcore.c
+++ b/bfd/cpu-mcore.c
@@ -1,4 +1,4 @@
-/* BFD library support routines for Motorolla's MCore architecture
+/* BFD library support routines for Motorola's MCore architecture
    Copyright (C) 1993, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c
index 1b0a18d..f74e25b 100644
--- a/bfd/cpu-ns32k.c
+++ b/bfd/cpu-ns32k.c
@@ -1,5 +1,5 @@
 /* BFD support for the ns32k architecture.
-   Copyright (C) 1990, 91, 94, 95, 96, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
    Almost totally rewritten by Ian Dall from initial work
    by Andrew Cagney.
 
@@ -173,7 +173,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
      long (*get_data)();
      int (*put_data)();
 {
@@ -596,7 +596,7 @@
 _bfd_do_ns32k_reloc_contents ( howto, input_bfd, relocation, location,
 			      get_data, put_data)
      reloc_howto_type *howto;
-     bfd *input_bfd;
+     bfd *input_bfd ATTRIBUTE_UNUSED;
      bfd_vma relocation;
      bfd_byte *location;
      long (*get_data)();
diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c
new file mode 100644
index 0000000..44ddd33
--- /dev/null
+++ b/bfd/cpu-pj.c
@@ -0,0 +1,85 @@
+/* BFD library support routines for the Pico Java architecture.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   Hacked by Steve Chamberlain of Transmeta. sac@pobox.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"
+
+
+static boolean 
+scan_mach (info, string)
+     const struct bfd_arch_info *info;
+     const char *string;
+{
+  if (strcasecmp (info->printable_name, string) == 0)
+    return true;
+  return false;
+}
+
+
+#if 0
+/* This routine is provided two arch_infos and returns whether
+   they'd be compatible */
+
+static const bfd_arch_info_type *
+compatible (a,b)
+     const bfd_arch_info_type *a;
+     const bfd_arch_info_type *b;
+{
+  if (a->arch != b->arch || a->mach != b->mach)
+   return NULL;
+  return a;
+}
+#endif
+
+
+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_pj,
+    0,
+    "pj",			/* arch_name  */
+    "pj",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    0,
+  },
+};
+
+const bfd_arch_info_type bfd_pj_arch =
+{
+  32,				/* 32 bits in a word */
+  32,				/* 32 bits in an address */
+  8,				/* 8 bits in a byte */
+  bfd_arch_pj,
+  0,
+  "pj",				/* arch_name  */
+  "pj",				/* printable name */
+  1,
+  true,				/* the default machine */
+  bfd_default_compatible,
+  scan_mach,
+  &arch_info_struct [0]
+};
diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c
index 44adf92..cb54e7d 100644
--- a/bfd/cpu-sh.c
+++ b/bfd/cpu-sh.c
@@ -1,5 +1,5 @@
 /* BFD library support routines for the Hitachi-SH architecture.
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 97, 1998, 2000 Free Software Foundation, Inc.
    Hacked by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -50,8 +50,12 @@
 #endif
 
 #define SH_NEXT &arch_info_struct[0]
-#define SH3_NEXT &arch_info_struct[1]
-#define SH3E_NEXT NULL
+#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
 
 static const bfd_arch_info_type arch_info_struct[] = 
 {
@@ -60,6 +64,34 @@
     32,				/* 32 bits in an address */
     8,				/* 8 bits in a byte */
     bfd_arch_sh,
+    bfd_mach_sh2,
+    "sh",			/* arch_name  */
+    "sh2",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    SH2_NEXT
+  },
+  {
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_sh,
+    bfd_mach_sh_dsp,
+    "sh",			/* arch_name  */
+    "sh-dsp",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    SH_DSP_NEXT
+  },
+  {
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_sh,
     bfd_mach_sh3,
     "sh",			/* arch_name  */
     "sh3",			/* printable name */
@@ -74,6 +106,20 @@
     32,				/* 32 bits in an address */
     8,				/* 8 bits in a byte */
     bfd_arch_sh,
+    bfd_mach_sh3_dsp,
+    "sh",			/* arch_name  */
+    "sh3-dsp",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    SH3_DSP_NEXT
+  },
+  {
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_sh,
     bfd_mach_sh3e,
     "sh",			/* arch_name  */
     "sh3e",			/* printable name */
@@ -83,6 +129,20 @@
     scan_mach,
     SH3E_NEXT
   },
+  {
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_sh,
+    bfd_mach_sh4,
+    "sh",			/* arch_name  */
+    "sh4",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    SH4_NEXT
+  },
 };
 
 const bfd_arch_info_type bfd_sh_arch =
diff --git a/bfd/cpu-w65.c b/bfd/cpu-w65.c
index c0bbf04..13f68b3 100644
--- a/bfd/cpu-w65.c
+++ b/bfd/cpu-w65.c
@@ -1,5 +1,5 @@
 /* BFD library support routines for the WDC 65816 architecture.
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1999 Free Software Foundation, Inc.
    Hacked by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -27,7 +27,7 @@
 
 static boolean 
 scan_mach (info, string)
-     const struct bfd_arch_info *info;
+     const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
      const char *string;
 {
   if (strcmp(string,"w65") == 0) return true;
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 6295c10..343cab1 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -89,14 +89,13 @@
 INTLDEPS = @INTLDEPS@
 INTLLIBS = @INTLLIBS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
@@ -104,7 +103,6 @@
 TDEFINES = @TDEFINES@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 WIN32LDFLAGS = @WIN32LDFLAGS@
 WIN32LIBADD = @WIN32LIBADD@
@@ -189,7 +187,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
 .SUFFIXES:
@@ -324,7 +322,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c
index cbcc26b..da184cc 100644
--- a/bfd/dwarf1.c
+++ b/bfd/dwarf1.c
@@ -1,5 +1,5 @@
 /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
-   Copyright 1998 Free Software Foundation, Inc.
+   Copyright 1998, 1999 Free Software Foundation, Inc.
 
 Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).  
 
@@ -140,8 +140,8 @@
   struct dwarf1_debug* stash;
 {
   struct dwarf1_unit* x = 
-    (struct dwarf1_unit*) bfd_alloc (stash->abfd, 
-				       sizeof (struct dwarf1_unit));
+    (struct dwarf1_unit*) bfd_zalloc (stash->abfd, 
+				      sizeof (struct dwarf1_unit));
   x->prev = stash->lastUnit;
   stash->lastUnit = x;
 
@@ -157,8 +157,8 @@
      struct dwarf1_unit* aUnit;
 {
   struct dwarf1_func* x = 
-    (struct dwarf1_func*) bfd_alloc (stash->abfd, 
-				  sizeof (struct dwarf1_func));
+    (struct dwarf1_func*) bfd_zalloc (stash->abfd, 
+				      sizeof (struct dwarf1_func));
   x->prev = aUnit->func_list;
   aUnit->func_list = x;
   
@@ -186,6 +186,8 @@
   /* First comes the length. */
   aDieInfo->length = bfd_get_32 (abfd, xptr);
   xptr += 4;
+  if (aDieInfo->length == 0)
+    return false;
   if (aDieInfo->length < 6)
     {
       /* Just padding bytes. */
@@ -291,7 +293,7 @@
   xptr = stash->line_section + aUnit->stmt_list_offset;
   if (xptr < stash->line_section_end)
     {
-      int eachLine;
+      unsigned long eachLine;
 
       char* tblend;
       unsigned long base;
@@ -398,7 +400,7 @@
     {
       if (aUnit->has_stmt_list)
 	{
-	  int i;
+	  unsigned long i;
 	  struct dwarf1_func* eachFunc;
 
 	  if (! aUnit->linenumber_table)
@@ -454,7 +456,7 @@
                               filename_ptr, functionname_ptr, linenumber_ptr)
      bfd *abfd;
      asection *section;
-     asymbol **symbols;
+     asymbol **symbols ATTRIBUTE_UNUSED;
      bfd_vma offset;
      const char **filename_ptr;
      const char **functionname_ptr;
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 385bf82..5710d1a 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1,5 +1,5 @@
 /* DWARF 2 support.
-   Copyright 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
    Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
    (gavin@cygnus.com).
@@ -99,8 +99,16 @@
 
   /* Length of the loaded .debug_abbrev section. */
   unsigned long dwarf_abbrev_size;
+
+  /* Buffer for decode_line_info.  */
+  char *dwarf_line_buffer;
 };
 
+struct arange {
+  struct arange *next;
+  bfd_vma low;
+  bfd_vma high;
+};
 
 
 /* A minimal decoding of DWARF2 compilation units.  We only decode
@@ -116,8 +124,7 @@
 
   /* The lowest and higest addresses contained in this compilation
      unit as specified in the compilation unit header. */
-  bfd_vma low;
-  bfd_vma high;
+  struct arange arange;
 
   /* The DW_AT_name attribute (for error messages). */
   char* name;
@@ -163,7 +170,7 @@
 
 static unsigned int
 read_1_byte (abfd, buf)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
 {
   return bfd_get_8 (abfd, (bfd_byte *) buf);
@@ -171,7 +178,7 @@
 
 static int
 read_1_signed_byte (abfd, buf)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
 {
   return bfd_get_signed_8 (abfd, (bfd_byte *) buf);
@@ -231,9 +238,9 @@
 
 static char *
 read_n_bytes (abfd, buf, size)
-     bfd * abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
-     unsigned int size;
+     unsigned int size ATTRIBUTE_UNUSED;
 {
   /* 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
@@ -243,7 +250,7 @@
 
 static char *
 read_string (abfd, buf, bytes_read_ptr)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
      unsigned int *bytes_read_ptr;
 {
@@ -261,7 +268,7 @@
 
 static unsigned int
 read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
      unsigned int *bytes_read_ptr;
 {
@@ -291,8 +298,8 @@
 
 static int
 read_signed_leb128 (abfd, buf, bytes_read_ptr)
-     bfd * abfd;
-     char * buf;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     char *buf;
      unsigned int * bytes_read_ptr;
 {
   int           result;
@@ -329,15 +336,17 @@
      struct comp_unit* unit;
      char *buf;
 {
-  bfd_vma retval = 0;
-
-  if (unit->addr_size == 4)
+  switch (unit->addr_size)
     {
-      retval = bfd_get_32 (unit->abfd, (bfd_byte *) buf);
-    } else {
-      retval = bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+    case 8:
+      return bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+    case 4:
+      return bfd_get_32 (unit->abfd, (bfd_byte *) buf);
+    case 2:
+      return bfd_get_16 (unit->abfd, (bfd_byte *) buf);
+    default:
+      abort ();
     }
-  return retval;
 }
 
 
@@ -422,8 +431,8 @@
 	  return 0;
 	}
       
-      stash->dwarf_abbrev_size = bfd_get_section_size_before_reloc (msec);
-      stash->dwarf_abbrev_buffer = (unsigned char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
+      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;
       
@@ -604,6 +613,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;
@@ -631,6 +644,7 @@
   char* filename;
   unsigned int line;
   unsigned int column;
+  int end_sequence;		/* end of (sequential) code sequence */
 };
 
 struct fileinfo {
@@ -653,12 +667,13 @@
 };
 
 static void 
-add_line_info (table, address, filename, line, column)
+add_line_info (table, address, filename, line, column, end_sequence)
      struct line_info_table* table;
      bfd_vma address;
      char* filename;
      unsigned int line;
      unsigned int column;
+     int end_sequence;
 {
   struct line_info* info = (struct line_info*)
     bfd_alloc (table->abfd, sizeof (struct line_info));
@@ -670,6 +685,7 @@
   info->filename = filename;
   info->line = line;
   info->column = column;
+  info->end_sequence = end_sequence;
 }
 
 static char* 
@@ -677,7 +693,16 @@
      struct line_info_table* table;
      unsigned int file;
 {
-  char* filename = table->files[file - 1].name;
+  char* filename;
+
+  if (file - 1 >= table->num_files)
+    {
+      (*_bfd_error_handler) (_("Dwarf Error: mangled line number "
+			       "section (bad file number)."));
+      return "<unknown>";
+    }
+
+  filename = table->files[file - 1].name;
   if (*filename == '/')
     return filename;
 
@@ -690,6 +715,50 @@
     }
 }
 
+static void
+arange_add (unit, low_pc, high_pc)
+     struct comp_unit *unit;
+     bfd_vma low_pc;
+     bfd_vma high_pc;
+{
+  struct arange *arange;
+
+  /* first see if we can cheaply extend an existing range: */
+  arange = &unit->arange;
+  do
+    {
+      if (low_pc == arange->high)
+	{
+	  arange->high = high_pc;
+	  return;
+	}
+      if (high_pc == arange->low)
+	{
+	  arange->low = low_pc;
+	  return;
+	}
+      arange = arange->next;
+    }
+  while (arange);
+
+  if (unit->arange.high == 0)
+    {
+      /* 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: */
+  arange = bfd_zalloc (unit->abfd, sizeof (*arange));
+  arange->low = low_pc;
+  arange->high = high_pc;
+
+  arange->next = unit->arange.next;
+  unit->arange.next = arange;
+}
+
 /* Decode the line number information for UNIT. */
 
 static struct line_info_table*
@@ -698,7 +767,7 @@
 {
   bfd *abfd = unit->abfd;
 
-  static char* dwarf_line_buffer = 0;
+  struct dwarf2_debug *stash;
 
   struct line_info_table* table;
 
@@ -709,7 +778,9 @@
   char *cur_file, *cur_dir;
   unsigned char op_code, extended_op, adj_opcode;
 
-  if (! dwarf_line_buffer)
+  stash = elf_tdata (abfd)->dwarf2_find_line_info;
+
+  if (! stash->dwarf_line_buffer)
     {
       asection *msec;
       unsigned long size;
@@ -722,13 +793,13 @@
 	  return 0;
 	}
       
-      size = bfd_get_section_size_before_reloc (msec);
-      dwarf_line_buffer = (unsigned char*) bfd_alloc (abfd, size);
-      if (! dwarf_line_buffer)
+      size = msec->_raw_size;
+      stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, size);
+      if (! stash->dwarf_line_buffer)
 	return 0;
 
       if (! bfd_get_section_contents (abfd, msec, 
-				      dwarf_line_buffer, 0,
+				      stash->dwarf_line_buffer, 0,
 				      size))
 	return 0;
 
@@ -747,7 +818,10 @@
   table->num_dirs = 0;
   table->dirs = NULL;
 
-  line_ptr = dwarf_line_buffer + unit->line_offset;
+  table->files = NULL;
+  table->last_line = NULL;
+
+  line_ptr = stash->dwarf_line_buffer + unit->line_offset;
 
   /* read in the prologue */
   lh.total_length = read_4_bytes (abfd, line_ptr);
@@ -830,7 +904,8 @@
       unsigned int column = 0;
       int is_stmt = lh.default_is_stmt;
       int basic_block = 0;
-      int end_sequence = 0;
+      int end_sequence = 0, need_low_pc = 1;
+      bfd_vma low_pc = 0;
 
       /* Decode the table. */
       while (! end_sequence)
@@ -847,7 +922,14 @@
 		{
 		case DW_LNE_end_sequence:
 		  end_sequence = 1;
-		  add_line_info (table, address, filename, line, column);
+		  add_line_info (table, address, filename, line, column,
+				 end_sequence);
+		  if (need_low_pc)
+		    {
+		      need_low_pc = 0;
+		      low_pc = address;
+		    }
+		  arange_add (unit, low_pc, address);
 		  break;
 		case DW_LNE_set_address:
 		  address = read_address (unit, line_ptr);
@@ -884,8 +966,13 @@
 		}
 	      break;
 	    case DW_LNS_copy:
-	      add_line_info (table, address, filename, line, column);
+	      add_line_info (table, address, filename, line, column, 0);
 	      basic_block = 0;
+	      if (need_low_pc)
+		{
+		  need_low_pc = 0;
+		  low_pc = address;
+		}
 	      break;
 	    case DW_LNS_advance_pc:
 	      address += lh.minimum_instruction_length
@@ -918,7 +1005,8 @@
 	      basic_block = 1;
 	      break;
 	    case DW_LNS_const_add_pc:
-	      address += (255 - lh.opcode_base) / lh.line_range;
+	      address += lh.minimum_instruction_length
+		      * ((255 - lh.opcode_base) / lh.line_range);
 	      break;
 	    case DW_LNS_fixed_advance_pc:
 	      address += read_2_bytes (abfd, line_ptr);
@@ -930,8 +1018,13 @@
 		* lh.minimum_instruction_length;
 	      line += lh.line_base + (adj_opcode % lh.line_range);
 	      /* append row to matrix using current values */
-	      add_line_info (table, address, filename, line, column);
+	      add_line_info (table, address, filename, line, column, 0);
 	      basic_block = 1;
+	      if (need_low_pc)
+		{
+		  need_low_pc = 0;
+		  low_pc = address;
+		}
 	    }
 	}
     }
@@ -954,21 +1047,25 @@
      const char **filename_ptr;
      unsigned int *linenumber_ptr;
 {
+  struct line_info* next_line = table->last_line;
   struct line_info* each_line;
-  struct line_info* next_line;
   
-  for (next_line = 0, each_line = table->last_line;
-       each_line;
-       next_line = each_line, each_line = each_line->prev_line)
+  if (!next_line)
+    return false;
+
+  each_line = next_line->prev_line;
+
+  while (each_line && next_line)
     {
-      if (addr >= each_line->address
-	  && (next_line == 0
-	      || addr < next_line->address)) 
+      if (!each_line->end_sequence
+	  && addr >= each_line->address && addr < next_line->address)
 	{
 	  *filename_ptr = each_line->filename;
 	  *linenumber_ptr = each_line->line;
 	  return true;
 	}
+      next_line = each_line;
+      each_line = each_line->prev_line;
     }
   
   return false;
@@ -1125,24 +1222,27 @@
 
 
 
-/* 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 unit header.
-   END_PTR points one past the end of this comp unit.
+/* 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
+   unit header.  END_PTR points one past the end of this comp unit.
+   If ABBREV_LENGTH is 0, then the length of the abbreviation offset
+   is assumed to be four bytes.  Otherwise, it it is the size given.
 
    This routine does not read the whole compilation unit; only enough
    to get to the line number information for the compilation unit.  */
 
 static struct comp_unit *
-parse_comp_unit (abfd, info_ptr, end_ptr)
+parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
      bfd* abfd;
      char* info_ptr;
      char* end_ptr;
+     unsigned int abbrev_length;
 {
   struct comp_unit* unit;
 
   unsigned short version;
-  unsigned int abbrev_offset;
+  unsigned int abbrev_offset = 0;
   unsigned char addr_size;
   struct abbrev_info** abbrevs;
 
@@ -1152,8 +1252,14 @@
 
   version = read_2_bytes (abfd, info_ptr);
   info_ptr += 2;
-  abbrev_offset = read_4_bytes (abfd, info_ptr);
-  info_ptr += 4;
+  BFD_ASSERT (abbrev_length == 0
+	      || abbrev_length == 4
+	      || abbrev_length == 8);
+  if (abbrev_length == 0 || abbrev_length == 4)
+    abbrev_offset = read_4_bytes (abfd, info_ptr);
+  else if (abbrev_length == 8)
+    abbrev_offset = read_8_bytes (abfd, info_ptr);
+  info_ptr += abbrev_length;
   addr_size = read_1_byte (abfd, info_ptr);
   info_ptr += 1;
 
@@ -1173,9 +1279,9 @@
       return 0;
     }
 
-  if (addr_size != 4 && addr_size != 8)
+  if (addr_size != 2 && addr_size != 4 && addr_size != 8)
     {
-      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '4' and '8'.", addr_size );
+      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2', '4' and '8'.", addr_size );
       bfd_set_error (bfd_error_bad_value);
       return 0;
     }
@@ -1228,11 +1334,11 @@
 	  break;
 
 	case DW_AT_low_pc:
-	  unit->low = DW_ADDR (&attr);
+	  unit->arange.low = DW_ADDR (&attr);
 	  break;
 
 	case DW_AT_high_pc:
-	  unit->high = DW_ADDR (&attr);
+	  unit->arange.high = DW_ADDR (&attr);
 	  break;
 
 	case DW_AT_comp_dir:
@@ -1271,8 +1377,20 @@
      struct comp_unit* unit;
      bfd_vma addr;
 {
-  return ! unit->error
-    && (addr >= unit->low && addr <= unit->high);
+  struct arange *arange;
+
+  if (unit->error)
+    return 0;
+
+  arange = &unit->arange;
+  do
+    {
+      if (addr >= arange->low && addr < arange->high)
+	return 1;
+      arange = arange->next;
+    }
+  while (arange);
+  return 0;
 }
 
 
@@ -1332,19 +1450,25 @@
   return line_p || func_p;
 }
 
-/* The DWARF2 version of find_nearest line.
-   Return true if the line is found without error. */
+/* 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.
+   You may use zero to indicate that the default value should be
+   used.  */
 
 boolean
 _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
-			  filename_ptr, functionname_ptr, linenumber_ptr)
+			       filename_ptr, functionname_ptr,
+			       linenumber_ptr,
+			       addr_size)
      bfd *abfd;
      asection *section;
-     asymbol **symbols;
+     asymbol **symbols ATTRIBUTE_UNUSED;
      bfd_vma offset;
      const char **filename_ptr;
      const char **functionname_ptr;
      unsigned int *linenumber_ptr;
+     unsigned int addr_size;
 {
   /* Read each compilation unit from the section .debug_info, and check
      to see if it contains the address we are searching for.  If yes,
@@ -1367,6 +1491,13 @@
   *functionname_ptr = NULL;
   *linenumber_ptr = 0;
 
+  /* The DWARF2 spec says that the initial length field, and the
+     offset of the abbreviation table, should both be 4-byte values.
+     However, some compilers do things differently.  */
+  if (addr_size == 0)
+    addr_size = 4;
+  BFD_ASSERT (addr_size == 4 || addr_size == 8);
+    
   if (! stash)
     {
       asection *msec;
@@ -1387,7 +1518,7 @@
 	  return false;
 	}
 
-      size = bfd_get_section_size_before_reloc (msec);
+      size = msec->_raw_size;
       if (size == 0)
 	return false;
       
@@ -1404,14 +1535,20 @@
 
       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.
+      /* 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... */
+	 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 
@@ -1423,27 +1560,28 @@
   /* 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);
-    }
+    if (comp_unit_contains_address (each, addr))
+      return comp_unit_find_nearest_line (each, addr, filename_ptr, 
+					  functionname_ptr, linenumber_ptr);
 
   /* Read each remaining comp. units checking each as they are read. */
   while (stash->info_ptr < stash->info_ptr_end)
     {
       struct comp_unit* each;
-      unsigned int length;
+      bfd_vma length;
+      boolean found;
 
-      length = read_4_bytes (abfd, stash->info_ptr);
-      stash->info_ptr += 4;
+      if (addr_size == 4)
+	length = read_4_bytes (abfd, stash->info_ptr);
+      else
+	length = read_8_bytes (abfd, stash->info_ptr);
+      stash->info_ptr += addr_size;
 
       if (length > 0)
         {
 	  each = parse_comp_unit (abfd, stash->info_ptr, 
-				  stash->info_ptr + length);
+				  stash->info_ptr + length,
+				  addr_size);
 	  stash->info_ptr += length;
 
 	  if (each)
@@ -1451,11 +1589,28 @@
 	      each->next_unit = stash->all_comp_units;
 	      stash->all_comp_units = each;
 
-	      if (comp_unit_contains_address (each, addr))
-		return comp_unit_find_nearest_line (each, addr,
-						    filename_ptr, 
-						    functionname_ptr, 
-						    linenumber_ptr);
+	      /* DW_AT_low_pc and DW_AT_high_pc are optional for
+		 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. */
+	      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);
+		}
+	      else
+		{
+		  found = comp_unit_find_nearest_line (each, addr,
+						       filename_ptr,
+						       functionname_ptr,
+						       linenumber_ptr);
+		  if (found)
+		    return true;
+		}
 	    }
 	}
     }
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index d5c6f85..4b136ee 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, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -72,7 +72,23 @@
 
 /* This stuff is somewhat copied from coffcode.h.  */
 
-static asection bfd_debug_section = { "*DEBUG*" };
+static asection bfd_debug_section =
+{
+  /* name,   index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */
+  "*DEBUG*", 0,     0,    0,     0,       0,          0,           0,
+  /* vma, lma, _cooked_size, _raw_size, output_offset, output_section, */
+  0,      0,   0,            0,         0,             NULL,
+  /* 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 *) NULL,
+  /* symbol_ptr_ptr,                   link_order_head, ..._tail */
+  (struct symbol_cache_entry **) NULL, NULL,            NULL
+};
 
 /* Create an ECOFF object.  */
 
@@ -138,7 +154,7 @@
 
 boolean
 _bfd_ecoff_new_section_hook (abfd, section)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *section;
 {
   section->alignment_power = 4;
@@ -349,10 +365,11 @@
 
 /*ARGSUSED*/
 flagword
-_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name)
-     bfd *abfd;
+_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR hdr;
-     const char *name;
+     const char *name ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
 {
   struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
   long styp_flags = internal_s->s_flags;
@@ -496,7 +513,7 @@
 boolean
 _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
      bfd *abfd;
-     asection *ignore;
+     asection *ignore ATTRIBUTE_UNUSED;
      struct ecoff_debug_info *debug;
 {
   const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
@@ -1433,7 +1450,7 @@
 /*ARGSUSED*/
 void
 _bfd_ecoff_get_symbol_info (abfd, symbol, ret)
-     bfd *abfd;			/* Ignored.  */
+     bfd *abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -1445,7 +1462,7 @@
 /*ARGSUSED*/
 boolean
 _bfd_ecoff_bfd_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return name[0] == '$';
@@ -1801,7 +1818,7 @@
 			      filename_ptr, functionname_ptr, retline_ptr)
      bfd *abfd;
      asection *section;
-     asymbol **ignore_symbols;
+     asymbol **ignore_symbols ATTRIBUTE_UNUSED;
      bfd_vma offset;
      CONST char **filename_ptr;
      CONST char **functionname_ptr;
@@ -1971,7 +1988,7 @@
 int
 _bfd_ecoff_sizeof_headers (abfd, reloc)
      bfd *abfd;
-     boolean reloc;
+     boolean reloc ATTRIBUTE_UNUSED;
 {
   asection *current;
   int c;
@@ -3181,7 +3198,14 @@
      armap.  */
   hdr.ar_uid[0] = '0';
   hdr.ar_gid[0] = '0';
+#if 0
   hdr.ar_mode[0] = '0';
+#else
+  /* 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';
+#endif
 
   sprintf (hdr.ar_size, "%-10d", (int) mapsize);
 
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index a120a2b..25fc966 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1,5 +1,5 @@
 /* Routines to link ECOFF debugging information.
-   Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 1999 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.
@@ -491,9 +491,9 @@
 /*ARGSUSED*/
 PTR
 bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct ecoff_debug_info *output_debug;
-     const struct ecoff_debug_swap *output_swap;
+     const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
   struct accumulate *ainfo;
@@ -551,9 +551,9 @@
 void
 bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
      PTR handle;
-     bfd *output_bfd;
-     struct ecoff_debug_info *output_debug;
-     const struct ecoff_debug_swap *output_swap;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     struct ecoff_debug_info *output_debug ATTRIBUTE_UNUSED;
+     const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
   struct accumulate *ainfo = (struct accumulate *) handle;
@@ -1412,7 +1412,7 @@
 /*ARGSUSED*/
 static void
 ecoff_align_debug (abfd, debug, swap)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct ecoff_debug_info *debug;
      const struct ecoff_debug_swap *swap;
 {
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 82ffe2a..0dcecdf 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1,5 +1,6 @@
 /* BFD back-end data structures for ELF files.
-   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software
+   Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -85,6 +86,16 @@
 
   /* Symbol index as a dynamic symbol.  Initialized to -1, and remains
      -1 if this is not a dynamic symbol.  */
+  /* ??? Note that this is consistently used as a synonym for tests
+     against whether we can perform various simplifying transformations
+     to the code.  (E.g. changing a pc-relative jump to a PLT entry
+     into a pc-relative jump to the target function.)  That test, which
+     is often relatively complex, and someplaces wrong or incomplete,
+     should really be replaced by a predicate in elflink.c.
+
+     End result: this field -1 does not indicate that the symbol is
+     not in the dynamic symbol table, but rather that the symbol is
+     not visible outside this DSO.  */
   long dynindx;
 
   /* String table index in .dynstr if this is a dynamic symbol.  */
@@ -146,7 +157,7 @@
   /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */
   char type;
 
-  /* Symbol st_other value.  */
+  /* Symbol st_other value, symbol visibility.  */
   unsigned char other;
 
   /* Hash value of the name computed using the ELF hash function.  */
@@ -178,6 +189,28 @@
 #define ELF_LINK_FORCED_LOCAL 02000
   /* Symbol was marked during garbage collection.  */
 #define ELF_LINK_HASH_MARK 04000
+  /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is
+     not currently set by all the backends.  */
+#define ELF_LINK_NON_GOT_REF 010000
+};
+
+/* Records local symbols to be emitted in the dynamic symbol table.  */
+
+struct elf_link_local_dynamic_entry
+{
+  struct elf_link_local_dynamic_entry *next;
+
+  /* The input bfd this symbol came from.  */
+  bfd *input_bfd;
+
+  /* The index of the local symbol being copied.  */
+  long input_indx;
+
+  /* The index in the outgoing dynamic symbol table.  */
+  long dynindx;
+  
+  /* A copy of the input symbol.  */
+  Elf_Internal_Sym isym;
 };
 
 /* ELF linker hash table.  */
@@ -208,6 +241,8 @@
   struct elf_link_hash_entry *hgot;
   /* A pointer to information used to link stabs in sections.  */
   PTR stab_info;
+  /* A linked list of local symbols to be added to .dynsym.  */
+  struct elf_link_local_dynamic_entry *dynlocal;
 };
 
 /* Look up an entry in an ELF linker hash table.  */
@@ -235,6 +270,13 @@
   unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
   unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
 
+  /* The size of entries in the .hash section.  */
+  unsigned char sizeof_hash_entry;
+
+  /* The number of internal relocations to allocate per external
+     relocation entry.  */
+  unsigned char int_rels_per_ext_rel;
+
   unsigned char arch_size, file_align;
   unsigned char elfclass, ev_current;
   int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
@@ -245,6 +287,32 @@
     PARAMS ((bfd *, asection *, asymbol **, boolean));
   long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
   void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+  void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
+
+  /* This function, if defined, is called to swap in a REL
+     relocation.  If an external relocation corresponds to more than
+     one internal relocation, then all relocations are swapped in at
+     once.  */
+  void (*swap_reloc_in)
+    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+
+  /* This function, if defined, is called to swap out a REL
+     relocation.  */
+  void (*swap_reloc_out)
+    PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+
+  /* This function, if defined, is called to swap in a RELA
+     relocation.  If an external relocation corresponds to more than
+     one internal relocation, then all relocations are swapped in at
+     once.  */
+  void (*swap_reloca_in)
+    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+
+  /* This function, if defined, is called to swap out a RELA
+     relocation.  */
+  void (*swap_reloca_out)
+    PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+
 };
 
 #define elf_symbol_from(ABFD,S) \
@@ -255,11 +323,6 @@
 
 struct elf_backend_data
 {
-  /* Whether the backend uses REL or RELA relocations.  FIXME: some
-     ELF backends use both.  When we need to support one, this whole
-     approach will need to be changed.  */
-  int use_rela_p;
-
   /* The architecture for this backend.  */
   enum bfd_architecture arch;
 
@@ -269,18 +332,6 @@
   /* The maximum page size for this backend.  */
   bfd_vma maxpagesize;
 
-  /* This is true if the linker should act like collect and gather
-     global constructors and destructors by name.  This is true for
-     MIPS ELF because the Irix 5 tools can not handle the .init
-     section.  */
-  boolean collect;
-
-  /* This is true if the linker should ignore changes to the type of a
-     symbol.  This is true for MIPS ELF because some Irix 5 objects
-     record undefined functions as STT_OBJECT although the definitions
-     are STT_FUNC.  */
-  boolean type_change_ok;
-
   /* A function to translate an ELF RELA relocation to a BFD arelent
      structure.  */
   void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
@@ -337,6 +388,12 @@
 						    Elf32_Internal_Shdr *,
 						    char *));
 
+  /* A function to handle unusual program segment types when creating BFD
+     sections from ELF program segments. */
+  boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
+						    Elf32_Internal_Phdr *,
+						    int));
+
   /* A function to set up the ELF section header for a BFD section in
      preparation for writing it out.  This is where the flags and type
      fields are set for unusual sections.  */
@@ -515,6 +572,37 @@
     PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
 	     const Elf_Internal_Rela *relocs));
 
+  /* This function, if defined, is called after the ELF headers have
+     been created.  This allows for things like the OS and ABI versions
+     to be changed.  */
+  void (*elf_backend_post_process_headers)
+    PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* This function, if defined, prints a symbol to file and returns the
+     name of the symbol to be printed.  It should return NULL to fall
+     back to default symbol printing.  */
+  const char *(*elf_backend_print_symbol_all)
+    PARAMS ((bfd *, PTR, asymbol *));
+
+  /* This function, if defined, is called after all local symbols and
+     global symbols converted to locals are emited into the symtab
+     section.  It allows the backend to emit special global symbols
+     not handled in the hash table.  */
+  boolean (*elf_backend_output_arch_syms)
+    PARAMS ((bfd *, struct bfd_link_info *, PTR,
+	    boolean (*) PARAMS ((PTR, const char *,
+             Elf_Internal_Sym *, asection *))));
+
+  /* Copy any information related to dynamic linking from a pre-existing
+     symbol IND to a newly created symbol DIR.  */
+  void (*elf_backend_copy_indirect_symbol)
+    PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+
+  /* 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 *));
+
   /* The swapping table to use when dealing with ECOFF information.
      Used for the MIPS ELF .mdebug section.  */
   const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
@@ -534,12 +622,46 @@
   bfd_vma got_header_size;
   bfd_vma plt_header_size;
 
+  /* This is true if the linker should act like collect and gather
+     global constructors and destructors by name.  This is true for
+     MIPS ELF because the Irix 5 tools can not handle the .init
+     section.  */
+  unsigned collect : 1;
+
+  /* This is true if the linker should ignore changes to the type of a
+     symbol.  This is true for MIPS ELF because some Irix 5 objects
+     record undefined functions as STT_OBJECT although the definitions
+     are STT_FUNC.  */
+  unsigned type_change_ok : 1;
+
+  /* Whether the backend may use REL relocations.  (Some backends use
+     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.)  */
+  unsigned may_use_rela_p : 1;
+
+  /* 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.  */   
+  unsigned default_use_rela_p : 1;
+
+  /* True if addresses "naturally" sign extend.  This is used when
+     swapping in from Elf32 when BFD64.  */
+  unsigned sign_extend_vma : 1;
+
   unsigned want_got_plt : 1;
   unsigned plt_readonly : 1;
   unsigned want_plt_sym : 1;
   unsigned plt_not_loaded : 1;
   unsigned plt_alignment : 4;
   unsigned can_gc_sections : 1;
+  unsigned want_dynbss : 1;
 };
 
 /* Information stored for each BFD section in an ELF file.  This
@@ -555,12 +677,19 @@
   /* If there is a second reloc section associated with this section,
      as can happen on Irix 6, this field points to the header.  */
   Elf_Internal_Shdr *rel_hdr2;
+  /* The number of relocations currently assigned to REL_HDR.  */
+  unsigned int rel_count;
+  /* The number of relocations currently assigned to REL_HDR2.  */
+  unsigned int rel_count2;
   /* The ELF section number of this section.  Only used for an output
      file.  */
   int this_idx;
-  /* The ELF section number of the reloc section associated with this
-     section, if any.  Only used for an output file.  */
+  /* The ELF section number of the reloc section indicated by
+     REL_HDR if any.  Only used for an output file.  */
   int rel_idx;
+  /* The ELF section number of the reloc section indicated by
+     REL_HDR2 if any.  Only used for an output file.  */
+  int rel_idx2;
   /* Used by the backend linker to store the symbol hash table entries
      associated with relocs against global symbols.  */
   struct elf_link_hash_entry **rel_hashes;
@@ -570,12 +699,15 @@
   Elf_Internal_Rela *relocs;
   /* Used by the backend linker when generating a shared library to
      record the dynamic symbol index for a section symbol
-     corresponding to this section.  */
+     corresponding to this section.  A value of 0 means that there is
+     no dynamic symbol for this section.  */
   long dynindx;
   /* A pointer used for .stab linking optimizations.  */
   PTR stab_info;
   /* A pointer available for the processor specific ELF backend.  */
   PTR tdata;
+  /* Nonzero if this section uses RELA relocations, rather than REL.  */
+  unsigned int use_rela_p:1;
 };
 
 #define elf_section_data(sec)  ((struct bfd_elf_section_data*)sec->used_by_bfd)
@@ -815,7 +947,7 @@
 #define bfd_elf32_print_symbol	bfd_elf_print_symbol
 #define bfd_elf64_print_symbol	bfd_elf_print_symbol
 
-extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
+extern unsigned long bfd_elf_hash PARAMS ((const char *));
 
 extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
 							    arelent *,
@@ -829,10 +961,16 @@
 extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
 extern boolean _bfd_elf_make_section_from_shdr
   PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
+extern boolean _bfd_elf_make_section_from_phdr
+  PARAMS ((bfd *abfd, Elf_Internal_Phdr *hdr, int index, const char *typename));
 extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
   PARAMS ((bfd *));
+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 *));
 extern boolean _bfd_elf_link_hash_table_init
   PARAMS ((struct elf_link_hash_table *, bfd *,
 	   struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
@@ -875,6 +1013,8 @@
 #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 
+  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
 
 /* If the target doesn't have reloc handling written yet:  */
 extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
@@ -892,6 +1032,9 @@
 boolean
 _bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
 					     struct elf_link_hash_entry *));
+long
+_bfd_elf_link_lookup_local_dynindx PARAMS ((struct bfd_link_info *,
+					    bfd *, long));
 boolean
 _bfd_elf_compute_section_file_positions PARAMS ((bfd *,
 						 struct bfd_link_info *));
@@ -906,6 +1049,8 @@
 						  struct bfd_link_info *));
 boolean _bfd_elf_create_got_section PARAMS ((bfd *,
 					     struct bfd_link_info *));
+unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
+						      struct bfd_link_info *));
 
 elf_linker_section_t *_bfd_elf_create_linker_section
   PARAMS ((bfd *abfd,
@@ -991,7 +1136,7 @@
 extern void bfd_elf32_swap_dyn_in
   PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
 extern void bfd_elf32_swap_dyn_out
-  PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
+  PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
 extern long bfd_elf32_slurp_symbol_table
   PARAMS ((bfd *, asymbol **, boolean));
 extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
@@ -1034,7 +1179,7 @@
 extern void bfd_elf64_swap_dyn_in
   PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
 extern void bfd_elf64_swap_dyn_out
-  PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
+  PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
 extern long bfd_elf64_slurp_symbol_table
   PARAMS ((bfd *, asymbol **, boolean));
 extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
@@ -1047,8 +1192,15 @@
 extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
   PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
 
-#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
-#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
+#define bfd_elf32_link_record_dynamic_symbol \
+  _bfd_elf_link_record_dynamic_symbol
+#define bfd_elf64_link_record_dynamic_symbol \
+  _bfd_elf_link_record_dynamic_symbol
+
+boolean _bfd_elf32_link_record_local_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, bfd *, long));
+boolean _bfd_elf64_link_record_local_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, bfd *, long));
 
 extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
@@ -1081,7 +1233,7 @@
 
 extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
 extern boolean _bfd_mips_elf_section_from_shdr
-  PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
+  PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
 extern boolean _bfd_mips_elf_fake_sections
   PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
 extern boolean _bfd_mips_elf_section_from_bfd_section
@@ -1110,5 +1262,48 @@
 	   const char **, unsigned int *));
 extern boolean _bfd_mips_elf_set_section_contents
   PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
+extern boolean _bfd_mips_elf_create_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_mips_elf_add_symbol_hook
+  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+	   const char **, flagword *, asection **, bfd_vma *));
+extern boolean _bfd_mips_elf_adjust_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+extern boolean _bfd_mips_elf_finish_dynamic_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+	   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 
+  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 *, 
+	   const Elf_Internal_Rela *));
+extern boolean _bfd_mips_elf_always_size_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_mips_elf_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_mips_elf_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   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 
+  PARAMS ((bfd *, PTR));
+extern boolean _bfd_mips_elf_link_output_symbol_hook
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
+	   asection *));
+extern boolean _bfd_mips_elf_final_link
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern int _bfd_mips_elf_additional_program_headers PARAMS ((bfd *));
+extern boolean _bfd_mips_elf_modify_segment_map PARAMS ((bfd *));
+extern boolean _bfd_mips_elf_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+
+/* SH ELF specific routine.  */
+
+extern boolean _sh_elf_set_mach_from_flags PARAMS ((bfd *));
 
 #endif /* _LIBELF_H_ */
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
new file mode 100644
index 0000000..b55e1c4
--- /dev/null
+++ b/bfd/elf-hppa.h
@@ -0,0 +1,1884 @@
+/* Common code for PA ELF implementations.
+   Copyright (C) 1999 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 ELF_HOWTO_TABLE_SIZE       R_PARISC_UNIMPLEMENTED + 1
+
+/* This file is included by multiple PA ELF BFD backends with different
+   sizes.
+
+   Most of the routines are written to be size independent, but sometimes
+   external constraints require 32 or 64 bit specific code.  We remap
+   the definitions/functions as necessary here.  */
+#if ARCH_SIZE == 64
+#define ELF_R_TYPE(X)   ELF64_R_TYPE(X)
+#define ELF_R_SYM(X)   ELF64_R_SYM(X)
+#define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
+#define elf_hppa_relocate_section elf64_hppa_relocate_section
+#define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
+#define elf_hppa_final_link elf64_hppa_final_link
+#endif
+#if ARCH_SIZE == 32
+#define ELF_R_TYPE(X)   ELF32_R_TYPE(X)
+#define ELF_R_SYM(X)   ELF32_R_SYM(X)
+#define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
+#define elf_hppa_relocate_section elf32_hppa_relocate_section
+#define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
+#define elf_hppa_final_link elf32_hppa_final_link
+#endif
+
+static boolean
+elf_hppa_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
+           bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+
+static bfd_reloc_status_type elf_hppa_final_link_relocate
+  PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
+           bfd_byte *, bfd_vma, struct bfd_link_info *,
+           asection *, struct elf_link_hash_entry *,
+	   struct elf64_hppa_dyn_hash_entry *));
+
+static unsigned long elf_hppa_relocate_insn
+  PARAMS ((unsigned long, long, unsigned long));
+
+static boolean elf_hppa_add_symbol_hook
+  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+	   const char **, flagword *, asection **, bfd_vma *));
+
+static boolean elf_hppa_final_link
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+static boolean elf_hppa_unmark_useless_dynamic_symbols
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static boolean elf_hppa_remark_useless_dynamic_symbols
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static void elf_hppa_record_segment_addrs
+  PARAMS ((bfd *, asection *, PTR));
+
+/* ELF/PA relocation howto entries.  */
+
+static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
+{
+  {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
+
+  /* The values in DIR32 are to placate the check in
+     _bfd_stab_section_find_nearest_line.  */
+  {R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false},
+  {R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR21L"},
+  {R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR17R"},
+  {R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR17F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14R"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL32"},
+
+  {R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL21L"},
+  {R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17R"},
+  {R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17F"},
+  {R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17C"},
+  {R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14R"},
+  {R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL21L"},
+  {R_PARISC_DPREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14WR"},
+
+  {R_PARISC_DPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14DR"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14R"},
+  {R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14R"},
+  {R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14R"},
+  {R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14F"},
+
+  {R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SETBASE"},
+  {R_PARISC_SECREL32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SECREL32"},
+  {R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL21L"},
+  {R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL17R"},
+  {R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL17F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14R"},
+  {R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14F"},
+  {R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGBASE"},
+  {R_PARISC_SEGREL32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGREL32"},
+
+  {R_PARISC_PLTOFF21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_PLTOFF14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R"},
+  {R_PARISC_PLTOFF14F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_FPTR32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32"},
+  {R_PARISC_LTOFF_FPTR21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_FPTR14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_FPTR64"},
+  {R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL32"},
+  {R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL14R"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_PCREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL64"},
+  {R_PARISC_PCREL22C, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL22C"},
+  {R_PARISC_PCREL22F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL22F"},
+  {R_PARISC_PCREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14WR"},
+  {R_PARISC_PCREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14DR"},
+  {R_PARISC_PCREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16F"},
+  {R_PARISC_PCREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16WF"},
+  {R_PARISC_PCREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16DF"},
+
+  {R_PARISC_DIR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR64"},
+  {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
+  {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
+  {R_PARISC_DIR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14WR"},
+  {R_PARISC_DIR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14DR"},
+  {R_PARISC_DIR16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16F"},
+  {R_PARISC_DIR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16WF"},
+  {R_PARISC_DIR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16DF"},
+  {R_PARISC_GPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL64"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DLTREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR"},
+  {R_PARISC_DLTREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR"},
+  {R_PARISC_GPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16F"},
+  {R_PARISC_GPREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16WF"},
+  {R_PARISC_GPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16DF"},
+  {R_PARISC_LTOFF64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF64"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_DLTIND14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR"},
+
+  {R_PARISC_DLTIND14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR"},
+  {R_PARISC_LTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16F"},
+  {R_PARISC_LTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF"},
+  {R_PARISC_LTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_BASEREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BSEREL14WR"},
+  {R_PARISC_BASEREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_SEGREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGREL64"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_PLTOFF14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR"},
+  {R_PARISC_PLTOFF14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR"},
+  {R_PARISC_PLTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F"},
+  {R_PARISC_PLTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF"},
+  {R_PARISC_PLTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF"},
+
+  {R_PARISC_LTOFF_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_FPTR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR"},
+  {R_PARISC_LTOFF_FPTR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR"},
+  {R_PARISC_LTOFF_FPTR16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F"},
+  {R_PARISC_LTOFF_FPTR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF"},
+  {R_PARISC_LTOFF_FPTR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_COPY"},
+  {R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_IPLT"},
+
+  {R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_EPLT"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_TPREL32, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL32"},
+  {R_PARISC_TPREL21L, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_TPREL14R, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL14R"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_TP21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_TP14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_TP14F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_TPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL64"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_TPREL14WR, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL14WR"},
+
+  {R_PARISC_TPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL14DR"},
+  {R_PARISC_TPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL16F"},
+  {R_PARISC_TPREL16WF, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL16WF"},
+  {R_PARISC_TPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL16DF"},
+  {R_PARISC_LTOFF_TP64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
+  {R_PARISC_LTOFF_TP14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR"},
+  {R_PARISC_LTOFF_TP14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR"},
+  {R_PARISC_LTOFF_TP16F, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_LTOFF_TP16F"},
+
+  {R_PARISC_LTOFF_TP16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF"},
+  {R_PARISC_LTOFF_TP16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF"},
+};
+
+#define OFFSET_14R_FROM_21L 4
+#define OFFSET_14F_FROM_21L 5
+
+/* Return one (or more) BFD relocations which implement the base
+   relocation with modifications based on format and field.  */
+
+elf_hppa_reloc_type **
+_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
+     bfd *abfd;
+     elf_hppa_reloc_type base_type;
+     int format;
+     int field;
+     int ignore;
+     asymbol *sym;
+{
+  elf_hppa_reloc_type *finaltype;
+  elf_hppa_reloc_type **final_types;
+
+  /* Allocate slots for the BFD relocation.  */
+  final_types = ((elf_hppa_reloc_type **)
+		 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2));
+  if (final_types == NULL)
+    return NULL;
+
+  /* Allocate space for the relocation itself.  */
+  finaltype = ((elf_hppa_reloc_type *)
+	       bfd_alloc (abfd, sizeof (elf_hppa_reloc_type)));
+  if (finaltype == NULL)
+    return NULL;
+
+  /* Some reasonable defaults.  */
+  final_types[0] = finaltype;
+  final_types[1] = NULL;
+
+#define final_type finaltype[0]
+
+  final_type = base_type;
+
+  /* Just a tangle of nested switch statements to deal with the braindamage
+     that a different field selector means a completely different relocation
+     for PA ELF.  */
+  switch (base_type)
+    {
+    /* We have been using generic relocation types.  However, that may not
+       really make sense.  Anyway, we need to support both R_PARISC_DIR64
+       and R_PARISC_DIR32 here.  */
+    case R_PARISC_DIR32:
+    case R_PARISC_DIR64:
+    case R_HPPA_ABS_CALL:
+      switch (format)
+	{
+	case 14:
+	  switch (field)
+	    {
+	    case e_rsel:
+	    case e_rrsel:
+	      final_type = R_PARISC_DIR14R;
+	      break;
+	    case e_rtsel:
+	      final_type = R_PARISC_DLTIND14R;
+	      break;
+	    case e_rtpsel:
+	      final_type = R_PARISC_LTOFF_FPTR14DR;
+	      break;
+	    case e_tsel:
+	      final_type = R_PARISC_DLTIND14F;
+	      break;
+	    case e_rpsel:
+	      final_type = R_PARISC_PLABEL14R;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 17:
+	  switch (field)
+	    {
+	    case e_fsel:
+	      final_type = R_PARISC_DIR17F;
+	      break;
+	    case e_rsel:
+	    case e_rrsel:
+	      final_type = R_PARISC_DIR17R;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 21:
+	  switch (field)
+	    {
+	    case e_lsel:
+	    case e_lrsel:
+	      final_type = R_PARISC_DIR21L;
+	      break;
+	    case e_ltsel:
+	      final_type = R_PARISC_DLTIND21L;
+	      break;
+	    case e_ltpsel:
+	      final_type = R_PARISC_LTOFF_FPTR21L;
+	      break;
+	    case e_lpsel:
+	      final_type = R_PARISC_PLABEL21L;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 32:
+	  switch (field)
+	    {
+	    case e_fsel:
+	      final_type = R_PARISC_DIR32;
+	      /* When in 64bit mode, a 32bit relocation is supposed to
+		 be a section relative relocation.  Dwarf2 (for example)
+		 uses 32bit section relative relocations.  */
+	      if (bfd_get_arch_info (abfd)->bits_per_address != 32)
+	        final_type = R_PARISC_SECREL32;
+	      break;
+	    case e_psel:
+	      final_type = R_PARISC_PLABEL32;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 64:
+	  switch (field)
+	    {
+	    case e_fsel:
+	      final_type = R_PARISC_DIR64;
+	      break;
+	    case e_psel:
+	      final_type = R_PARISC_FPTR64;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	default:
+	  return NULL;
+	}
+      break;
+
+
+    case R_HPPA_GOTOFF:
+      switch (format)
+	{
+	case 14:
+	  switch (field)
+	    {
+	    case e_rsel:
+	    case e_rrsel:
+	      final_type = base_type + OFFSET_14R_FROM_21L;
+	      break;
+	    case e_fsel:
+	      final_type = base_type + OFFSET_14F_FROM_21L;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 21:
+	  switch (field)
+	    {
+	    case e_lrsel:
+	    case e_lsel:
+	      final_type = base_type;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	default:
+	  return NULL;
+	}
+      break;
+
+
+    case R_HPPA_PCREL_CALL:
+      switch (format)
+	{
+	case 14:
+	  switch (field)
+	    {
+	    case e_rsel:
+	    case e_rrsel:
+	      final_type = R_PARISC_PCREL14R;
+	      break;
+	    case e_fsel:
+	      final_type = R_PARISC_PCREL14F;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 17:
+	  switch (field)
+	    {
+	    case e_rsel:
+	    case e_rrsel:
+	      final_type = R_PARISC_PCREL17R;
+	      break;
+	    case e_fsel:
+	      final_type = R_PARISC_PCREL17F;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
+	case 22:
+	  switch (field)
+	    {
+	    case e_fsel:
+	      final_type = R_PARISC_PCREL22F;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  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_SEGREL32:
+    case R_PARISC_SEGBASE:
+      /* The defaults are fine for these cases.  */
+      break;
+
+    default:
+      return NULL;
+    }
+
+  return final_types;
+}
+
+/* Translate from an elf into field into a howto relocation pointer.  */
+
+static void
+elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
+     bfd *abfd;
+     arelent *bfd_reloc;
+     Elf_Internal_Rela *elf_reloc;
+{
+  BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
+	      < (unsigned int) R_PARISC_UNIMPLEMENTED);
+  bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
+}
+
+/* Translate from an elf into field into a howto relocation pointer.  */
+
+static void
+elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
+     bfd *abfd;
+     arelent *bfd_reloc;
+     Elf_Internal_Rel *elf_reloc;
+{
+  BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
+	      < (unsigned int) R_PARISC_UNIMPLEMENTED);
+  bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
+}
+
+/* Return the address of the howto table entry to perform the CODE
+   relocation for an ARCH machine.  */
+
+static reloc_howto_type *
+elf_hppa_reloc_type_lookup (abfd, code)
+     bfd *abfd;
+     bfd_reloc_code_real_type code;
+{
+  if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
+    {
+      BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
+      return &elf_hppa_howto_table[(int) code];
+    }
+  return NULL;
+}
+
+static void
+elf_hppa_final_write_processing (abfd, linker)
+     bfd *abfd;
+     boolean linker;
+{
+  int mach = bfd_get_mach (abfd);
+
+  elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
+				     | EF_PARISC_EXT | EF_PARISC_LSB
+				     | EF_PARISC_WIDE | EF_PARISC_NO_KABP
+				     | EF_PARISC_LAZYSWAP);
+
+  if (mach == 10)
+    elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
+  else if (mach == 11)
+    elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
+  else if (mach == 20)
+    elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
+  else if (mach == 25)
+    elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
+				      | EFA_PARISC_2_0
+				      /* The GNU tools have trapped without
+					 option since 1993, so need to take
+					 a step backwards with the ELF
+					 based toolchains.  */
+				      | EF_PARISC_TRAPNIL);
+}
+
+/* Return true if SYM represents a local label symbol.  */
+
+static boolean
+elf_hppa_is_local_label_name (abfd, name)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     const char *name;
+{
+  return (name[0] == 'L' && name[1] == '$');
+}
+
+/* Set the correct type for an ELF section.  We do this by the
+   section name, which is a hack, but ought to work.  */
+
+static boolean
+elf_hppa_fake_sections (abfd, hdr, sec)
+     bfd *abfd;
+     Elf64_Internal_Shdr *hdr;
+     asection *sec;
+{
+  register const char *name;
+
+  name = bfd_get_section_name (abfd, sec);
+
+  if (strcmp (name, ".PARISC.unwind") == 0)
+    {
+      int indx;
+      asection *sec;
+      hdr->sh_type = SHT_LOPROC + 1;
+      /* ?!? How are unwinds supposed to work for symbols in arbitrary
+	 sections?  Or what if we have multiple .text sections in a single
+	 .o file?  HP really messed up on this one.
+
+	 Ugh.  We can not use elf_section_data (sec)->this_idx at this
+	 point because it is not initialized yet.
+
+	 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++)
+	{
+	  if (sec->name && strcmp (sec->name, ".text") == 0)
+	    {
+	      hdr->sh_info = indx;
+	      break;
+	    }
+	}
+
+      /* I have no idea if this is really necessary or what it means.  */
+      hdr->sh_entsize = 4;
+    }
+  return true;
+}
+
+/* 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.  */
+
+static boolean
+elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     const Elf_Internal_Sym *sym;
+     const char **namep ATTRIBUTE_UNUSED;
+     flagword *flagsp ATTRIBUTE_UNUSED;
+     asection **secp;
+     bfd_vma *valp;
+{
+  int index = sym->st_shndx;
+
+  switch (index)
+    {
+    case SHN_PARISC_ANSI_COMMON:
+      *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
+      (*secp)->flags |= SEC_IS_COMMON;
+      *valp = sym->st_size;
+      break;
+
+    case SHN_PARISC_HUGE_COMMON:
+      *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
+      (*secp)->flags |= SEC_IS_COMMON;
+      *valp = sym->st_size;
+      break;
+    }
+
+  return true;
+}
+
+static boolean
+elf_hppa_unmark_useless_dynamic_symbols (h, data)
+     struct elf_link_hash_entry *h;
+     PTR data;
+{
+  struct bfd_link_info *info = (struct bfd_link_info *)data;
+
+  /* If we are not creating a shared library, and this symbol is
+     referenced by a shared library but is not defined anywhere, then
+     the generic code will warn that it is undefined.
+
+     This behavior is undesirable on HPs since the standard shared
+     libraries contain reerences to undefined symbols.
+
+     So we twiddle the flags associated with such symbols so that they
+     will not trigger the warning.  ?!? FIXME.  This is horribly fraglie.
+
+     Ultimately we should have better controls over the generic ELF BFD
+     linker code.  */
+  if (! info->relocateable
+      && ! (info->shared
+	    && !info->no_undefined)
+      && h->root.type == bfd_link_hash_undefined
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+    {
+      h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
+      h->elf_link_hash_flags |= 0x8000;
+    }
+
+  return true;
+}
+
+
+static boolean
+elf_hppa_remark_useless_dynamic_symbols (h, data)
+     struct elf_link_hash_entry *h;
+     PTR data;
+{
+  struct bfd_link_info *info = (struct bfd_link_info *)data;
+
+  /* If we are not creating a shared library, and this symbol is
+     referenced by a shared library but is not defined anywhere, then
+     the generic code will warn that it is undefined.
+
+     This behavior is undesirable on HPs since the standard shared
+     libraries contain reerences to undefined symbols.
+
+     So we twiddle the flags associated with such symbols so that they
+     will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
+
+     Ultimately we should have better controls over the generic ELF BFD
+     linker code.  */
+  if (! info->relocateable
+      && ! (info->shared
+	    && !info->no_undefined)
+      && h->root.type == bfd_link_hash_undefined
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
+      && (h->elf_link_hash_flags & 0x8000) != 0)
+    {
+      h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+      h->elf_link_hash_flags &= ~0x8000;
+    }
+
+  return true;
+}
+
+/* Record the lowest address for the data and text segments.  */
+static void
+elf_hppa_record_segment_addrs (abfd, section, data)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section;
+     PTR data;
+{
+  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)
+       == (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)
+    hppa_info->data_segment_base = value;
+}
+
+/* Called after we have seen all the input files/sections, but before
+   final symbol resolution and section placement has been determined.
+
+   We use this hook to (possibly) provide a value for __gp, then we
+   fall back to the generic ELF final link routine.  */
+
+static boolean
+elf_hppa_final_link (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  boolean retval;
+
+  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
+	 in the hash table.  If that fails, just compute the value __gp
+	 should have had.  */
+      gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
+				 false, false);
+
+      if (gp)
+	{
+
+	  /* 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_val = (gp->root.u.def.section->output_section->vma
+		    + gp->root.u.def.section->output_offset
+		    + gp->root.u.def.value);
+	}
+      else
+	{
+	  asection *sec;
+  
+
+	  /* First look for a .plt section.  If found, then __gp is the
+	     address of the .plt + gp_offset.
+
+	     If no .plt is found, then look for .dlt, .opd and .data (in
+	     that order) and set __gp to the base address of whichever section
+	    is found first.  */
+
+	  sec = hppa_info->plt_sec;
+	  if (sec)
+	    gp_val = (sec->output_offset
+		      + sec->output_section->vma
+		      + hppa_info->gp_offset);
+	  else
+	    {
+	      sec = hppa_info->dlt_sec;
+	      if (!sec)
+		sec = hppa_info->opd_sec;
+	      if (!sec)
+		sec = bfd_get_section_by_name (abfd, ".data");
+	      if (!sec)
+		return false;
+
+	      gp_val = sec->output_offset + sec->output_section->vma;
+	    }
+	}
+
+      /* Install whatever value we found/computed for __gp.  */
+      _bfd_set_gp_value (abfd, gp_val);
+    }
+
+  /* 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
+     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;
+
+  /* HP's shared libraries have references to symbols that are not
+     defined anywhere.  The generic ELF BFD linker code will complaim
+     about such symbols.
+
+     So we detect the losing case and arrange for the flags on the symbol
+     to indicate that it was never referenced.  This keeps the generic
+     ELF BFD link code happy and appears to not create any secondary
+     problems.  Ultimately we need a way to control the behavior of the
+     generic ELF BFD link code better.  */
+  elf_link_hash_traverse (elf_hash_table (info),
+			  elf_hppa_unmark_useless_dynamic_symbols,
+			  info);
+
+  /* Invoke the regular ELF backend linker to do all the work.  */
+  retval = bfd_elf_bfd_final_link (abfd, info);
+
+  elf_link_hash_traverse (elf_hash_table (info),
+			  elf_hppa_remark_useless_dynamic_symbols,
+			  info);
+
+  return retval;
+}
+
+/* Relocate an HPPA ELF section.  */
+
+static boolean
+elf_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;
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
+
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
+  rel = relocs;
+  relend = relocs + input_section->reloc_count;
+  for (; rel < relend; rel++)
+    {
+      int r_type;
+      reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
+      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;
+      char *dyn_name;
+      char *dynh_buf = NULL;
+      size_t dynh_buflen = 0;
+      struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
+
+      r_type = ELF_R_TYPE (rel->r_info);
+      if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+
+      r_symndx = ELF_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.  */
+	  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);
+
+	  /* If this symbol has an entry in the PA64 dynamic hash
+	     table, then get it.  */
+	  dyn_name = get_dyn_name (input_bfd, h, rel,
+				   &dynh_buf, &dynh_buflen);
+	  dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+					      dyn_name, false, false);
+
+	}
+      else
+	{
+	  /* This is not a local symbol.  */
+	  long indx;
+
+	  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;
+
+	      /* If this symbol has an entry in the PA64 dynamic hash
+		 table, then get it.  */
+	      dyn_name = get_dyn_name (input_bfd, h, rel,
+				       &dynh_buf, &dynh_buflen);
+	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+						  dyn_name, false, false);
+
+	      /* If we have a relocation against a symbol defined in a
+		 shared library and we have not created an entry in the
+		 PA64 dynamic symbol hash table for it, then we lose.  */
+	      if (sym_sec->output_section == NULL && dyn_h == 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 if (sym_sec->output_section)
+		relocation = (h->root.u.def.value
+			      + sym_sec->output_offset
+			      + sym_sec->output_section->vma);
+	      /* Value will be provided via one of the offsets in the
+		 dyn_h hash table entry.  */
+	      else
+		relocation = 0;
+	    }
+	  /* Allow undefined symbols in shared libraries.  */
+          else if (info->shared && !info->no_undefined)
+	    {
+	      if (info->symbolic)
+		(*info->callbacks->undefined_symbol)
+		  (info, h->root.root.string, input_bfd,
+		   input_section, rel->r_offset, false);
+
+	      /* If this symbol has an entry in the PA64 dynamic hash
+		 table, then get it.  */
+	      dyn_name = get_dyn_name (input_bfd, h, rel,
+				       &dynh_buf, &dynh_buflen);
+	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+						  dyn_name, false, false);
+
+	      if (dyn_h == 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;
+		}
+	      relocation = 0;
+	    }
+	  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 = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
+					input_section, contents,
+					relocation, info, sym_sec,
+					h, dyn_h);
+
+      if (r != bfd_reloc_ok)
+	{
+	  switch (r)
+	    {
+	    default:
+	      abort ();
+	    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;
+	    }
+	}
+    }
+  return true;
+}
+
+
+/* Compute the value for a relocation (REL) during a final link stage,
+   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. 
+
+   The work of actually applying the relocation is left to a helper
+   routine in an attempt to reduce the complexity and size of this
+   function.  */
+
+static bfd_reloc_status_type
+elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
+			      input_section, contents, value,
+			      info, sym_sec, h, dyn_h)
+     Elf_Internal_Rela *rel;
+     bfd *input_bfd;
+     bfd *output_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     bfd_vma value;
+     struct bfd_link_info *info;
+     asection *sym_sec;
+     struct elf_link_hash_entry *h;
+     struct elf64_hppa_dyn_hash_entry *dyn_h;
+{
+  unsigned long insn;
+  bfd_vma offset = rel->r_offset;
+  bfd_vma addend = rel->r_addend;
+  reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
+  unsigned long r_type = howto->type;
+  unsigned long r_field = e_fsel;
+  bfd_byte *hit_data = contents + offset;
+  struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
+
+  insn = bfd_get_32 (input_bfd, hit_data);
+
+  switch (r_type)
+    {
+    case R_PARISC_NONE:
+      break;
+
+    /* Random PC relative relocs.  */
+    case R_PARISC_PCREL21L:
+    case R_PARISC_PCREL14R:
+    case R_PARISC_PCREL14F:
+    case R_PARISC_PCREL14WR:
+    case R_PARISC_PCREL14DR:
+    case R_PARISC_PCREL16F:
+    case R_PARISC_PCREL16WF:
+    case R_PARISC_PCREL16DF:
+      {
+	if (r_type == R_PARISC_PCREL21L)
+	  r_field = e_lsel;
+	else if (r_type == R_PARISC_PCREL14F
+		 || r_type == R_PARISC_PCREL16F
+		 || r_type == R_PARISC_PCREL16WF
+		 || r_type == R_PARISC_PCREL16DF)
+	  r_field = e_fsel;
+	else
+	  r_field = e_rsel;
+
+	/* If this is a call to a function defined in another dynamic
+	   library, then redirect the call to the local stub for this
+	   function.  */
+	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);
+
+	/* Adjust for any field selectors.  */
+	value = hppa_field_adjust (value, -8 + addend, r_field);
+
+	/* Apply the relocation to the given instruction.  */
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    /* Basic function call support.  I'm not entirely sure if PCREL14F is
+       actually needed or even handled correctly.
+
+       Note for a call to a function defined in another dynamic library
+       we want to redirect the call to a stub.  */
+    case R_PARISC_PCREL22F:
+    case R_PARISC_PCREL17F:
+    case R_PARISC_PCREL22C:
+    case R_PARISC_PCREL17C:
+    case R_PARISC_PCREL17R:
+      {
+	if (r_type == R_PARISC_PCREL17R)
+	  r_field = e_rsel;
+	else
+	  r_field = e_fsel;
+
+	/* If this is a call to a function defined in another dynamic
+	   library, then redirect the call to the local stub for this
+	   function.  */
+	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);
+
+	/* Adjust for any field selectors.  */
+	value = hppa_field_adjust (value, -8 + addend, e_fsel);
+
+	/* All branches are implicitly shifted by 2 places.  */
+	value >>= 2;
+
+	/* Apply the relocation to the given instruction.  */
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    /* Indirect references to data through the DLT.  */
+    case R_PARISC_DLTIND14R:
+    case R_PARISC_DLTIND14F:
+    case R_PARISC_DLTIND14DR:
+    case R_PARISC_DLTIND14WR:
+    case R_PARISC_DLTIND21L:
+    case R_PARISC_LTOFF_FPTR14R:
+    case R_PARISC_LTOFF_FPTR14DR:
+    case R_PARISC_LTOFF_FPTR14WR:
+    case R_PARISC_LTOFF_FPTR21L:
+    case R_PARISC_LTOFF_FPTR16F:
+    case R_PARISC_LTOFF_FPTR16WF:
+    case R_PARISC_LTOFF_FPTR16DF:
+    case R_PARISC_LTOFF_TP21L:
+    case R_PARISC_LTOFF_TP14R:
+    case R_PARISC_LTOFF_TP14F:
+    case R_PARISC_LTOFF_TP14WR:
+    case R_PARISC_LTOFF_TP14DR:
+    case R_PARISC_LTOFF_TP16F:
+    case R_PARISC_LTOFF_TP16WF:
+    case R_PARISC_LTOFF_TP16DF:
+    case R_PARISC_LTOFF16F:
+    case R_PARISC_LTOFF16WF:
+    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
+	   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. 
+
+	   Similarly we may still need to set up an entry in .opd for
+	   a local function which had its address taken.  */
+	if (dyn_h->h == NULL)
+	  {
+	    bfd_put_64 (hppa_info->dlt_sec->owner,
+			value,
+			hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
+
+	    /* Now handle .opd creation if needed.  */
+	    if (r_type == R_PARISC_LTOFF_FPTR14R
+		|| r_type == R_PARISC_LTOFF_FPTR14DR
+		|| r_type == R_PARISC_LTOFF_FPTR14WR
+		|| r_type == R_PARISC_LTOFF_FPTR21L
+		|| r_type == R_PARISC_LTOFF_FPTR16F
+		|| r_type == R_PARISC_LTOFF_FPTR16WF
+		|| r_type == R_PARISC_LTOFF_FPTR16DF)
+	      {
+		/* The first two words of an .opd entry are zero.  */
+		memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
+			0, 16);
+
+		/* The next word is the address of the function.  */
+		bfd_put_64 (hppa_info->opd_sec->owner, value,
+			    (hppa_info->opd_sec->contents
+			     + dyn_h->opd_offset + 16));
+
+		/* The last word is our local __gp value.  */
+		value = _bfd_get_gp_value
+			  (hppa_info->opd_sec->output_section->owner);
+		bfd_put_64 (hppa_info->opd_sec->owner, value,
+			    (hppa_info->opd_sec->contents
+			     + dyn_h->opd_offset + 24));
+	      }
+	  }
+
+	/* We want the value of the DLT offset for this symbol, not
+	   the symbol's actual address.  Note that __gp may not point
+	   to the start of the DLT, so we have to compute the absolute
+	   address, then subtract out the value of __gp.  */
+	value = (dyn_h->dlt_offset
+		 + hppa_info->dlt_sec->output_offset
+		 + hppa_info->dlt_sec->output_section->vma);
+	value -= _bfd_get_gp_value (output_bfd);
+
+
+	/* All DLTIND relocations are basically the same at this point,
+	   except that we need different field selectors for the 21bit
+	   version vs the 14bit versions.  */
+	if (r_type == R_PARISC_DLTIND21L
+	    || r_type == R_PARISC_LTOFF_FPTR21L
+	    || r_type == R_PARISC_LTOFF_TP21L)
+	  value = hppa_field_adjust (value, addend, e_lrsel);
+	else if (r_type == R_PARISC_DLTIND14F
+		 || r_type == R_PARISC_LTOFF_FPTR16F
+		 || r_type == R_PARISC_LTOFF_FPTR16WF
+		 || r_type == R_PARISC_LTOFF_FPTR16DF
+		 || r_type == R_PARISC_LTOFF16F
+		 || r_type == R_PARISC_LTOFF16DF
+		 || r_type == R_PARISC_LTOFF16WF
+		 || r_type == R_PARISC_LTOFF_TP16F
+		 || r_type == R_PARISC_LTOFF_TP16WF
+		 || r_type == R_PARISC_LTOFF_TP16DF)
+	  value = hppa_field_adjust (value, addend, e_fsel);
+	else
+	  value = hppa_field_adjust (value, addend, e_rrsel);
+
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    case R_PARISC_DLTREL14R:
+    case R_PARISC_DLTREL14F:
+    case R_PARISC_DLTREL14DR:
+    case R_PARISC_DLTREL14WR:
+    case R_PARISC_DLTREL21L:
+    case R_PARISC_DPREL21L:
+    case R_PARISC_DPREL14WR:
+    case R_PARISC_DPREL14DR:
+    case R_PARISC_DPREL14R:
+    case R_PARISC_DPREL14F:
+    case R_PARISC_GPREL16F:
+    case R_PARISC_GPREL16WF:
+    case R_PARISC_GPREL16DF:
+      {
+	/* Subtract out the global pointer value to make value a DLT
+	   relative address.  */
+	value -= _bfd_get_gp_value (output_bfd);
+
+	/* All DLTREL relocations are basically the same at this point,
+	   except that we need different field selectors for the 21bit
+	   version vs the 14bit versions.  */
+	if (r_type == R_PARISC_DLTREL21L
+	    || r_type == R_PARISC_DPREL21L)
+	  value = hppa_field_adjust (value, addend, e_lrsel);
+	else if (r_type == R_PARISC_DLTREL14F
+		 || r_type == R_PARISC_DPREL14F
+		 || r_type == R_PARISC_GPREL16F
+		 || r_type == R_PARISC_GPREL16WF
+		 || r_type == R_PARISC_GPREL16DF)
+	  value = hppa_field_adjust (value, addend, e_fsel);
+	else
+	  value = hppa_field_adjust (value, addend, e_rrsel);
+
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    case R_PARISC_DIR21L:
+    case R_PARISC_DIR17R:
+    case R_PARISC_DIR17F:
+    case R_PARISC_DIR14R:
+    case R_PARISC_DIR14WR:
+    case R_PARISC_DIR14DR:
+    case R_PARISC_DIR16F:
+    case R_PARISC_DIR16WF:
+    case R_PARISC_DIR16DF:
+      {
+	/* All DIR relocations are basically the same at this point,
+	   except that we need different field selectors for the 21bit
+	   version vs the 14bit versions.  */
+	if (r_type == R_PARISC_DIR21L)
+	  value = hppa_field_adjust (value, addend, e_lrsel);
+	else if (r_type == R_PARISC_DIR17F
+		 || r_type == R_PARISC_DIR16F
+		 || r_type == R_PARISC_DIR16WF
+		 || r_type == R_PARISC_DIR16DF)
+	  value = hppa_field_adjust (value, addend, e_fsel);
+	else
+	  value = hppa_field_adjust (value, addend, e_rrsel);
+
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    case R_PARISC_PLTOFF21L:
+    case R_PARISC_PLTOFF14R:
+    case R_PARISC_PLTOFF14F:
+    case R_PARISC_PLTOFF14WR:
+    case R_PARISC_PLTOFF14DR:
+    case R_PARISC_PLTOFF16F:
+    case R_PARISC_PLTOFF16WF:
+    case R_PARISC_PLTOFF16DF:
+      {
+	/* We want the value of the PLT offset for this symbol, not
+	   the symbol's actual address.  Note that __gp may not point
+	   to the start of the DLT, so we have to compute the absolute
+	   address, then subtract out the value of __gp.  */
+	value = (dyn_h->plt_offset
+		 + hppa_info->plt_sec->output_offset
+		 + hppa_info->plt_sec->output_section->vma);
+	value -= _bfd_get_gp_value (output_bfd);
+
+	/* All PLTOFF relocations are basically the same at this point,
+	   except that we need different field selectors for the 21bit
+	   version vs the 14bit versions.  */
+	if (r_type == R_PARISC_PLTOFF21L)
+	  value = hppa_field_adjust (value, addend, e_lrsel);
+	else if (r_type == R_PARISC_PLTOFF14F
+		 || r_type == R_PARISC_PLTOFF16F
+		 || r_type == R_PARISC_PLTOFF16WF
+		 || r_type == R_PARISC_PLTOFF16DF)
+	  value = hppa_field_adjust (value, addend, e_fsel);
+	else
+	  value = hppa_field_adjust (value, addend, e_rrsel);
+
+	insn = elf_hppa_relocate_insn (insn, value, r_type);
+	break;
+      }
+
+    case R_PARISC_LTOFF_FPTR32:
+      {
+	/* We may still need to create the FPTR itself if it was for
+	   a local symbol.  */
+	if (dyn_h->h == NULL)
+	  {
+	    /* The first two words of an .opd entry are zero.  */
+	    memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
+
+	    /* The next word is the address of the function.  */
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			(hppa_info->opd_sec->contents
+			 + dyn_h->opd_offset + 16));
+
+	    /* The last word is our local __gp value.  */
+	    value = _bfd_get_gp_value
+		      (hppa_info->opd_sec->output_section->owner);
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
+	  }
+
+	/* We want the value of the DLT offset for this symbol, not
+	   the symbol's actual address.  Note that __gp may not point
+	   to the start of the DLT, so we have to compute the absolute
+	   address, then subtract out the value of __gp.  */
+	value = (dyn_h->dlt_offset
+		 + hppa_info->dlt_sec->output_offset
+		 + hppa_info->dlt_sec->output_section->vma);
+	value -= _bfd_get_gp_value (output_bfd);
+	bfd_put_32 (input_bfd, value, hit_data);
+	return bfd_reloc_ok;
+      }
+
+    case R_PARISC_LTOFF_FPTR64:
+    case R_PARISC_LTOFF_TP64:
+      {
+	/* We may still need to create the FPTR itself if it was for
+	   a local symbol.  */
+	if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
+	  {
+	    /* The first two words of an .opd entry are zero.  */
+	    memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
+
+	    /* The next word is the address of the function.  */
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			(hppa_info->opd_sec->contents
+			 + dyn_h->opd_offset + 16));
+
+	    /* The last word is our local __gp value.  */
+	    value = _bfd_get_gp_value
+		      (hppa_info->opd_sec->output_section->owner);
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
+	  }
+
+	/* We want the value of the DLT offset for this symbol, not
+	   the symbol's actual address.  Note that __gp may not point
+	   to the start of the DLT, so we have to compute the absolute
+	   address, then subtract out the value of __gp.  */
+	value = (dyn_h->dlt_offset
+		 + hppa_info->dlt_sec->output_offset
+		 + hppa_info->dlt_sec->output_section->vma);
+	value -= _bfd_get_gp_value (output_bfd);
+	bfd_put_64 (input_bfd, value, hit_data);
+	return bfd_reloc_ok;
+      }
+
+    case R_PARISC_DIR32:
+      bfd_put_32 (input_bfd, value + addend, hit_data);
+      return bfd_reloc_ok;
+
+    case R_PARISC_DIR64:
+      bfd_put_64 (input_bfd, value + addend, hit_data);
+      return bfd_reloc_ok;
+
+    case R_PARISC_GPREL64:
+      /* 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;
+
+    case R_PARISC_LTOFF64:
+	/* We want the value of the DLT offset for this symbol, not
+	   the symbol's actual address.  Note that __gp may not point
+	   to the start of the DLT, so we have to compute the absolute
+	   address, then subtract out the value of __gp.  */
+      value = (dyn_h->dlt_offset
+	       + hppa_info->dlt_sec->output_offset
+	       + hppa_info->dlt_sec->output_section->vma);
+      value -= _bfd_get_gp_value (output_bfd);
+
+      bfd_put_64 (input_bfd, value + addend, hit_data);
+      return bfd_reloc_ok;
+
+    case R_PARISC_PCREL32:
+      {
+	/* If this is a call to a function defined in another dynamic
+	   library, then redirect the call to the local stub for this
+	   function.  */
+	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);
+	return bfd_reloc_ok;
+      }
+
+    case R_PARISC_PCREL64:
+      {
+	/* If this is a call to a function defined in another dynamic
+	   library, then redirect the call to the local stub for this
+	   function.  */
+	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);
+	return bfd_reloc_ok;
+      }
+
+
+    case R_PARISC_FPTR64:
+      {
+	/* We may still need to create the FPTR itself if it was for
+	   a local symbol.  */
+	if (dyn_h->h == NULL)
+	  {
+	    /* The first two words of an .opd entry are zero.  */
+	    memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
+
+	    /* The next word is the address of the function.  */
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			(hppa_info->opd_sec->contents
+			 + dyn_h->opd_offset + 16));
+
+	    /* The last word is our local __gp value.  */
+	    value = _bfd_get_gp_value
+		      (hppa_info->opd_sec->output_section->owner);
+	    bfd_put_64 (hppa_info->opd_sec->owner, value,
+			hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
+	  }
+
+	/* We want the value of the OPD offset for this symbol, not
+           the symbol's actual address.  */
+	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),
+		  hit_data);
+      return bfd_reloc_ok;
+
+    case R_PARISC_SEGREL32:
+    case R_PARISC_SEGREL64:
+      {
+	/* If this is the first SEGREL relocation, then initialize
+	   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));
+
+	/* VALUE holds the absolute address.  We want to include the
+	   addend, then turn it into a segment relative address.
+
+	   The segment is derived from SYM_SEC.  We assume that there are
+	   only two segments of note in the resulting executable/shlib.
+	   A readonly segment (.text) and a readwrite segment (.data).  */
+	value += addend;
+
+	if (sym_sec->flags & SEC_CODE)
+	  value -= hppa_info->text_segment_base;
+	else
+	  value -= hppa_info->data_segment_base;
+
+	if (r_type == R_PARISC_SEGREL32)
+	  bfd_put_32 (input_bfd, value, hit_data);
+	else
+	  bfd_put_64 (input_bfd, value, hit_data);
+        return bfd_reloc_ok;
+      }
+      
+
+    /* Something we don't know how to handle.  */
+    default:
+      return bfd_reloc_notsupported;
+    }
+
+  /* Update the instruction word.  */
+  bfd_put_32 (input_bfd, insn, hit_data);
+  return (bfd_reloc_ok);
+}
+
+/* Relocate the given INSN.  VALUE should be the actual value we want
+   to insert into the instruction, ie by this point we should not be
+   concerned with computing an offset relative to the DLT, PC, etc.
+   Instead this routine is meant to handle the bit manipulations needed
+   to insert the relocation into the given instruction.  */
+
+static unsigned long
+elf_hppa_relocate_insn (insn, sym_value, r_type)
+     unsigned long insn;
+     long sym_value;
+     unsigned long r_type;
+{
+  switch (r_type)
+    {
+    /* This is any 22bit branch.  In PA2.0 syntax it corresponds to
+       the "B" instruction.  */
+    case R_PARISC_PCREL22F:
+    case R_PARISC_PCREL22C:
+      {
+	unsigned int w3, w2, w1, w;
+
+	/* These are 22 bit branches.  Mask off bits we do not care
+	   about.  */
+	sym_value &= 0x3fffff;
+
+	/* Now extract the W1, W2, W3 and W fields from the value.  */
+	dis_assemble_22 (sym_value, &w3, &w1, &w2, &w);
+
+	/* Mask out bits for the value in the instruction.  */
+	insn &= 0xfc00e002;
+
+	/* Insert the bits for the W1, W2 and W fields into the
+	   instruction.  */
+	insn |= (w3 << 21) | (w2 << 2) | (w1 << 16) | w;
+	return insn;
+       }
+
+    /* This is any 17bit 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:
+      {
+	unsigned int w2, w1, w;
+
+	/* These are 17 bit branches.  Mask off bits we do not care
+	   about.  */
+	sym_value &= 0x1ffff;
+
+	/* Now extract the W1, W2 and W fields from the value.  */
+	dis_assemble_17 (sym_value, &w1, &w2, &w);
+
+	/* Mask out bits for the value in the instruction.  */
+	insn &= 0xffe0e002;
+
+	/* Insert the bits for the W1, W2 and W fields into the
+	   instruction.  */
+	insn |= (w2 << 2) | (w1 << 16) | w;
+	return insn;
+      }
+
+    /* ADDIL or LDIL instructions.  */
+    case R_PARISC_DLTREL21L:
+    case R_PARISC_DLTIND21L:
+    case R_PARISC_LTOFF_FPTR21L:
+    case R_PARISC_PCREL21L:
+    case R_PARISC_LTOFF_TP21L:
+    case R_PARISC_DPREL21L:
+    case R_PARISC_PLTOFF21L:
+    case R_PARISC_DIR21L:
+      {
+        int w;
+
+	/* Mask off bits in INSN we do not want.  */
+	insn &= 0xffe00000;
+
+	/* Turn the 21bit value into the proper format.  */
+	dis_assemble_21 (sym_value, &w);
+
+	/* And insert the proper bits into INSN.  */
+        return insn | w;
+      }
+
+    /* LDO and integer loads/stores with 14bit displacements.  */
+    case R_PARISC_DLTREL14R:
+    case R_PARISC_DLTREL14F:
+    case R_PARISC_DLTIND14R:
+    case R_PARISC_DLTIND14F:
+    case R_PARISC_LTOFF_FPTR14R:
+    case R_PARISC_LTOFF_FPTR16F:
+    case R_PARISC_PCREL14R:
+    case R_PARISC_PCREL14F:
+    case R_PARISC_PCREL16F:
+    case R_PARISC_LTOFF_TP14R:
+    case R_PARISC_LTOFF_TP14F:
+    case R_PARISC_LTOFF_TP16F:
+    case R_PARISC_DPREL14R:
+    case R_PARISC_DPREL14F:
+    case R_PARISC_GPREL16F:
+    case R_PARISC_PLTOFF14R:
+    case R_PARISC_PLTOFF14F:
+    case R_PARISC_PLTOFF16F:
+    case R_PARISC_DIR14R:
+    case R_PARISC_DIR16F:
+    case R_PARISC_LTOFF16F:
+      {
+        int w;
+
+	/* Mask off bits in INSN we do not want.  */
+	insn &= 0xffffc000;
+
+	/* Turn the 14bit value into the proper format.  */
+	low_sign_unext (sym_value, 14, &w);
+
+	/* And insert the proper bits into INSN.  */
+        return insn | w;
+      }
+
+    /* Doubleword loads and stores with a 14bit displacement.  */
+    case R_PARISC_DLTREL14DR:
+    case R_PARISC_DLTIND14DR:
+    case R_PARISC_LTOFF_FPTR14DR:
+    case R_PARISC_LTOFF_FPTR16DF:
+    case R_PARISC_PCREL14DR:
+    case R_PARISC_PCREL16DF:
+    case R_PARISC_LTOFF_TP14DR:
+    case R_PARISC_LTOFF_TP16DF:
+    case R_PARISC_DPREL14DR:
+    case R_PARISC_GPREL16DF:
+    case R_PARISC_PLTOFF14DR:
+    case R_PARISC_PLTOFF16DF:
+    case R_PARISC_DIR14DR:
+    case R_PARISC_DIR16DF:
+    case R_PARISC_LTOFF16DF:
+      {
+	/* Mask off bits in INSN we do not want.  */
+	insn &= 0xffffc00e;
+
+	/* The sign bit at 14 moves into bit zero in the destination.  */
+        insn |= ((sym_value & 0x2000) >> 13);
+
+	/* Turn off the bits in sym_value we do not care about.  */
+	sym_value &= 0x1ff8;
+
+	/* Now shift it one bit position left so that it lines up with the
+	   destination field in INSN.  */
+	sym_value <<= 1;
+
+	return insn | sym_value;
+      }
+
+    /* Floating point single word load/store instructions.  */
+    case R_PARISC_DLTREL14WR:
+    case R_PARISC_DLTIND14WR:
+    case R_PARISC_LTOFF_FPTR14WR:
+    case R_PARISC_LTOFF_FPTR16WF:
+    case R_PARISC_PCREL14WR:
+    case R_PARISC_PCREL16WF:
+    case R_PARISC_LTOFF_TP14WR:
+    case R_PARISC_LTOFF_TP16WF:
+    case R_PARISC_DPREL14WR:
+    case R_PARISC_GPREL16WF:
+    case R_PARISC_PLTOFF14WR:
+    case R_PARISC_PLTOFF16WF:
+    case R_PARISC_DIR16WF:
+    case R_PARISC_DIR14WR:
+    case R_PARISC_LTOFF16WF:
+      {
+	/* Mask off bits in INSN we do not want.  */
+	insn &= 0xffffc006;
+
+	/* The sign bit at 14 moves into bit zero in the destination.  */
+        insn |= ((sym_value & 0x2000) >> 13);
+
+	/* Turn off the bits in sym_value we do not care about.  */
+	sym_value &= 0x1ffc;
+
+	/* Now shift it one bit position left so that it lines up with the
+	   destination field in INSN.  */
+	sym_value <<= 1;
+
+	return insn | sym_value;
+      }
+
+    default:
+      return insn;
+    }
+}
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 53d193d..1939635 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -1,5 +1,5 @@
 /* Matsushita 10200 specific support for 32-bit ELF
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -185,7 +185,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;
@@ -205,7 +205,7 @@
 
 static void
 mn10200_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
@@ -223,15 +223,15 @@
 				 addend, info, sym_sec, is_local)
      reloc_howto_type *howto;
      bfd *input_bfd;
-     bfd *output_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;
-     int is_local;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sym_sec ATTRIBUTE_UNUSED;
+     int is_local ATTRIBUTE_UNUSED;
 {
   unsigned long r_type = howto->type;
   bfd_byte *hit_data = contents + offset;
@@ -408,7 +408,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset, true)))
 		return false;
 	      relocation = 0;
 	    }
@@ -447,7 +447,7 @@
 	    case bfd_reloc_undefined:
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, name, input_bfd, input_section,
-		      rel->r_offset)))
+		      rel->r_offset, true)))
 		return false;
 	      break;
 
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 9ba09a8..498f538 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 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -290,7 +290,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;
@@ -310,7 +310,7 @@
 
 static void
 mn10300_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
@@ -385,7 +385,7 @@
 static asection *
 mn10300_elf_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;
@@ -407,6 +407,9 @@
 
 	    case bfd_link_hash_common:
 	      return h->root.u.c.p->section;
+
+	    default:
+	      break;
 	    }
 	}
     }
@@ -431,15 +434,15 @@
 				 addend, info, sym_sec, is_local)
      reloc_howto_type *howto;
      bfd *input_bfd;
-     bfd *output_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;
-     int is_local;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sym_sec ATTRIBUTE_UNUSED;
+     int is_local ATTRIBUTE_UNUSED;
 {
   unsigned long r_type = howto->type;
   bfd_byte *hit_data = contents + offset;
@@ -620,7 +623,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset, true)))
 		return false;
 	      relocation = 0;
 	    }
@@ -659,7 +662,7 @@
 	    case bfd_reloc_undefined:
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, name, input_bfd, input_section,
-		      rel->r_offset)))
+		      rel->r_offset, true)))
 		return false;
 	      break;
 
@@ -696,7 +699,7 @@
 static boolean
 elf32_mn10300_finish_hash_table_entry (gen_entry, in_args)
      struct bfd_hash_entry *gen_entry;
-     PTR in_args;
+     PTR in_args ATTRIBUTE_UNUSED;
 {
   struct elf32_mn10300_link_hash_entry *entry;
   unsigned int byte_count = 0;
@@ -846,10 +849,9 @@
 	    {
 	      struct elf32_mn10300_link_hash_entry *hash;
 	      Elf_Internal_Sym *sym;
-	      asection *sym_sec;
+	      asection *sym_sec = NULL;
 	      const char *sym_name;
 	      char *new_name;
-	      Elf_Internal_Shdr *hdr;
 
 	      /* Get cached copy of section contents if it exists.  */
 	      if (elf_section_data (section)->this_hdr.contents != NULL)
@@ -928,7 +930,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);
@@ -1191,9 +1193,8 @@
 		{
 		  Elf_Internal_Sym isym;
 		  struct elf32_mn10300_link_hash_entry *sym_hash;
-		  asection *sym_sec;
+		  asection *sym_sec = NULL;
 		  const char *sym_name;
-		  Elf_Internal_Shdr *hdr;
 		  char *new_name;
 
 		  bfd_elf32_swap_symbol_in (input_bfd, esym, &isym);
@@ -1210,7 +1211,9 @@
 		    sym_sec = bfd_abs_section_ptr;
 		  else if (isym.st_shndx == SHN_COMMON)
 		    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);
@@ -1460,8 +1463,7 @@
       if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
 	{
 	  Elf_Internal_Sym isym;
-	  asection *sym_sec;
-	  Elf_Internal_Shdr *hdr;
+	  asection *sym_sec = NULL;
 	  const char *sym_name;
 	  char *new_name;
 
@@ -1478,7 +1480,9 @@
 	    sym_sec = bfd_abs_section_ptr;
 	  else if (isym.st_shndx == SHN_COMMON)
 	    sym_sec = bfd_com_section_ptr;
-
+	  else
+	    abort ();
+	  
 	  symval = (isym.st_value
 		    + sym_sec->output_section->vma
 		    + sym_sec->output_offset);
@@ -1903,6 +1907,79 @@
 	  *again = true;
 	}
 
+      /* Try to turn a 24 immediate, displacement or absolute address
+	 into a 8 immediate, displacement or absolute address.  */
+      if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_24)
+	{
+	  bfd_vma value = symval;
+	  value += irel->r_addend;
+
+	  /* See if the value will fit in 8 bits.  */
+	  if ((long)value < 0x7f && (long)value > -0x80)
+	    {
+	      unsigned char code;
+
+	      /* AM33 insns which have 24 operands are 6 bytes long and
+		 will have 0xfd as the first byte.  */
+
+	      /* Get the first opcode.  */
+	      code = bfd_get_8 (abfd, contents + irel->r_offset - 3);
+
+	      if (code == 0xfd)
+		{
+	          /* Get the second opcode.  */
+	          code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+
+		  /* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit
+		     equivalent instructions exists.  */
+	          if (code != 0x6b && code != 0x7b
+		      && code != 0x8b && code != 0x9b
+		      && ((code & 0x0f) == 0x09 || (code & 0x0f) == 0x08
+			  || (code & 0x0f) == 0x0a || (code & 0x0f) == 0x0b
+			  || (code & 0x0f) == 0x0e))
+		    {
+		      /* Not safe if the high bit is on as relaxing may
+		         move the value out of high mem and thus not fit
+		         in a signed 8bit value.  This is currently over
+		         conservative.  */
+		      if ((value & 0x80) == 0)
+			{
+			  /* Note that we've changed the relocation contents,
+			     etc.  */
+			  elf_section_data (sec)->relocs = internal_relocs;
+			  free_relocs = NULL;
+
+			  elf_section_data (sec)->this_hdr.contents = contents;
+			  free_contents = NULL;
+
+			  symtab_hdr->contents = (bfd_byte *) extsyms;
+			  free_extsyms = NULL;
+
+			  /* Fix the opcode.  */
+			  bfd_put_8 (abfd, 0xfb, contents + irel->r_offset - 3);
+			  bfd_put_8 (abfd, code, contents + irel->r_offset - 2);
+
+			  /* Fix the relocation's type.  */
+			  irel->r_info
+			    = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						         R_MN10300_8);
+
+			  /* Delete two bytes of data.  */
+			  if (!mn10300_elf_relax_delete_bytes (abfd, sec,
+							       irel->r_offset + 1, 2))
+			    goto error_return;
+
+			  /* That will change things, so, we should relax
+			     again.  Note that this is not required, and it
+			      may be slow.  */
+			  *again = true;
+			  break;
+			}
+		    }
+
+		}
+	    }
+	}
 
       /* Try to turn a 32bit immediate, displacement or absolute address
 	 into a 16bit immediate, displacement or absolute address.  */
@@ -1911,6 +1988,74 @@
 	  bfd_vma value = symval;
 	  value += irel->r_addend;
 
+	  /* See if the value will fit in 24 bits.
+	     We allow any 16bit match here.  We prune those we can't
+	     handle below.  */
+	  if ((long)value < 0x7fffff && (long)value > -0x800000)
+	    {
+	      unsigned char code;
+
+	      /* AM33 insns which have 32bit operands are 7 bytes long and
+		 will have 0xfe as the first byte.  */
+
+	      /* Get the first opcode.  */
+	      code = bfd_get_8 (abfd, contents + irel->r_offset - 3);
+
+	      if (code == 0xfe)
+		{
+	          /* Get the second opcode.  */
+	          code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+
+		  /* All the am33 32 -> 24 relaxing possibilities.  */
+		  /* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit
+		     equivalent instructions exists.  */
+	          if (code != 0x6b && code != 0x7b
+		      && code != 0x8b && code != 0x9b
+		      && ((code & 0x0f) == 0x09 || (code & 0x0f) == 0x08
+			  || (code & 0x0f) == 0x0a || (code & 0x0f) == 0x0b
+			  || (code & 0x0f) == 0x0e))
+		    {
+		      /* Not safe if the high bit is on as relaxing may
+		         move the value out of high mem and thus not fit
+		         in a signed 16bit value.  This is currently over
+		         conservative.  */
+		      if ((value & 0x8000) == 0)
+			{
+			  /* Note that we've changed the relocation contents,
+			     etc.  */
+			  elf_section_data (sec)->relocs = internal_relocs;
+			  free_relocs = NULL;
+
+			  elf_section_data (sec)->this_hdr.contents = contents;
+			  free_contents = NULL;
+
+			  symtab_hdr->contents = (bfd_byte *) extsyms;
+			  free_extsyms = NULL;
+
+			  /* Fix the opcode.  */
+			  bfd_put_8 (abfd, 0xfd, contents + irel->r_offset - 3);
+			  bfd_put_8 (abfd, code, contents + irel->r_offset - 2);
+
+			  /* Fix the relocation's type.  */
+			  irel->r_info
+			    = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						         R_MN10300_24);
+
+			  /* Delete one byte of data.  */
+			  if (!mn10300_elf_relax_delete_bytes (abfd, sec,
+							       irel->r_offset + 3, 1))
+			    goto error_return;
+
+			  /* That will change things, so, we should relax
+			     again.  Note that this is not required, and it
+			      may be slow.  */
+			  *again = true;
+			  break;
+			}
+		    }
+
+		}
+	    }
 
 	  /* See if the value will fit in 16 bits.
 	     We allow any 16bit match here.  We prune those we can't
@@ -2333,6 +2478,20 @@
       if (hash->movm_args & 0x08)
 	hash->movm_stack_size += 8 * 4;
 
+      if (bfd_get_mach (abfd) == bfd_mach_am33)
+	{
+	  /* "exother" space.  e0, e1, mdrq, mcrh, mcrl, mcvf */
+	  if (hash->movm_args & 0x1)
+	    hash->movm_stack_size += 6 * 4;
+
+	  /* exreg1 space.  e4, e5, e6, e7 */
+	  if (hash->movm_args & 0x2)
+	    hash->movm_stack_size += 4 * 4;
+
+	  /* exreg0 space.  e2, e3  */
+	  if (hash->movm_args & 0x4)
+	    hash->movm_stack_size += 2 * 4;
+	}
     }
 
   /* Now look for the two stack adjustment variants.  */
@@ -2724,6 +2883,8 @@
       default:
         return bfd_mach_mn10300;
 
+      case E_MN10300_MACH_AM33:
+        return bfd_mach_am33;
     }
 }
 
@@ -2735,13 +2896,9 @@
 void
 _bfd_mn10300_elf_final_write_processing (abfd, linker)
      bfd *abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   unsigned long val;
-  unsigned int i;
-  Elf_Internal_Shdr **hdrpp;
-  const char *name;
-  asection *sec;
 
   switch (bfd_get_mach (abfd))
     {
@@ -2750,6 +2907,9 @@
 	val = E_MN10300_MACH_MN10300;
 	break;
 
+      case bfd_mach_am33:
+	val = E_MN10300_MACH_AM33;
+	break;
     }
 
   elf_elfheader (abfd)->e_flags &= ~ (EF_MN10300_MACH);
diff --git a/bfd/elf.c b/bfd/elf.c
index ab010d4..8830ff0 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1,5 +1,5 @@
 /* ELF executable support for BFD.
-   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.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -53,6 +53,7 @@
 static INLINE int sym_is_global PARAMS ((bfd *, asymbol *));
 static boolean elf_map_symbols PARAMS ((bfd *));
 static bfd_size_type get_program_header_size PARAMS ((bfd *));
+static boolean elfcore_read_notes PARAMS ((bfd *, bfd_vma, bfd_vma));
 
 /* Swap version information in and out.  The version information is
    currently size independent.  If that ever changes, this code will
@@ -200,10 +201,12 @@
 
 /* Standard ELF hash function.  Do not change this function; you will
    cause invalid hash tables to be generated.  */
+
 unsigned long
-bfd_elf_hash (name)
-     CONST unsigned char *name;
+bfd_elf_hash (namearg)
+     const char *namearg;
 {
+  const unsigned char *name = (const unsigned char *) namearg;
   unsigned long h = 0;
   unsigned long g;
   int ch;
@@ -503,13 +506,13 @@
 		       input_section,
 		       output_bfd,
 		       error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0
@@ -756,8 +759,22 @@
     case bfd_print_symbol_all:
       {
 	CONST char *section_name;
+	CONST char *name = NULL;
+	struct elf_backend_data *bed;
+	unsigned char st_other;
+	
 	section_name = symbol->section ? symbol->section->name : "(*none*)";
-	bfd_print_symbol_vandf ((PTR) file, symbol);
+
+	bed = get_elf_backend_data (abfd);
+	if (bed->elf_backend_print_symbol_all)
+	    name = (*bed->elf_backend_print_symbol_all) (abfd, filep, symbol);
+
+	if (name == NULL)
+	  {
+	    name = symbol->name;  
+	    bfd_print_symbol_vandf ((PTR) file, symbol);
+	  }
+
 	fprintf (file, " %s\t", section_name);
 	/* Print the "other" value for a symbol.  For common symbols,
 	   we've already printed the size; now print the alignment.
@@ -820,12 +837,21 @@
 	  }
 
 	/* If the st_other field is not zero, print it.  */
-	if (((elf_symbol_type *) symbol)->internal_elf_sym.st_other != 0)
-	  fprintf (file, " 0x%02x",
-		   ((unsigned int)
-		    ((elf_symbol_type *) symbol)->internal_elf_sym.st_other));
+	st_other = ((elf_symbol_type *) symbol)->internal_elf_sym.st_other;
+	
+	switch (st_other)
+	  {
+	  case 0: break;
+	  case STV_INTERNAL:  fprintf (file, " .internal");  break;
+	  case STV_HIDDEN:    fprintf (file, " .hidden");    break;
+	  case STV_PROTECTED: fprintf (file, " .protected"); break;
+	  default:
+	    /* Some other non-defined flags are also present, so print
+	       everything hex.  */
+	    fprintf (file, " 0x%02x", (unsigned int) st_other);
+	  }
 
-	fprintf (file, " %s", symbol->name);
+	fprintf (file, " %s", name);
       }
       break;
     }
@@ -880,6 +906,58 @@
   return (struct bfd_hash_entry *) ret;
 }
 
+/* Copy data from an indirect symbol to its direct symbol, hiding the
+   old indirect symbol.  */
+
+void
+_bfd_elf_link_hash_copy_indirect (dir, ind)
+     struct elf_link_hash_entry *dir, *ind;
+{
+  /* Copy down any references that we may have already seen to the
+     symbol which just became indirect.  */
+
+  dir->elf_link_hash_flags |=
+    (ind->elf_link_hash_flags
+     & (ELF_LINK_HASH_REF_DYNAMIC
+	| ELF_LINK_HASH_REF_REGULAR
+	| ELF_LINK_HASH_REF_REGULAR_NONWEAK
+	| ELF_LINK_NON_GOT_REF));
+
+  /* Copy over the global and procedure linkage table offset entries.
+     These may have been already set up by a check_relocs routine.  */
+  if (dir->got.offset == (bfd_vma) -1)
+    {
+      dir->got.offset = ind->got.offset;
+      ind->got.offset = (bfd_vma) -1;
+    }
+  BFD_ASSERT (ind->got.offset == (bfd_vma) -1);
+
+  if (dir->plt.offset == (bfd_vma) -1)
+    {
+      dir->plt.offset = ind->plt.offset;
+      ind->plt.offset = (bfd_vma) -1;
+    }
+  BFD_ASSERT (ind->plt.offset == (bfd_vma) -1);
+
+  if (dir->dynindx == -1)
+    {
+      dir->dynindx = ind->dynindx;
+      dir->dynstr_index = ind->dynstr_index;
+      ind->dynindx = -1;
+      ind->dynstr_index = 0;
+    }
+  BFD_ASSERT (ind->dynindx == -1);
+}
+
+void
+_bfd_elf_link_hash_hide_symbol(h)
+     struct elf_link_hash_entry *h;
+{
+  h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+  h->dynindx = -1;
+  h->plt.offset = (bfd_vma) -1;
+}
+
 /* Initialize an ELF linker hash table.  */
 
 boolean
@@ -944,7 +1022,7 @@
 
 struct bfd_link_needed_list *
 bfd_elf_get_needed_list (abfd, info)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
   if (info->hash->creator->flavour != bfd_target_elf_flavour)
@@ -1201,6 +1279,15 @@
 	asection *target_sect;
 	Elf_Internal_Shdr *hdr2;
 
+	/* Check for a bogus link to avoid crashing.  */
+	if (hdr->sh_link >= ehdr->e_shnum)
+	  {
+	    ((*_bfd_error_handler)
+	     (_("%s: invalid link %lu for reloc section %s (index %u)"),
+	      bfd_get_filename (abfd), hdr->sh_link, name, shindex));
+	    return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
+	  }
+
 	/* For some incomprehensible reason Oracle distributes
 	   libraries for Solaris in which some of the objects have
 	   bogus sh_link fields.  It would be nice if we could just
@@ -1265,6 +1352,10 @@
 	target_sect->flags |= SEC_RELOC;
 	target_sect->relocation = NULL;
 	target_sect->rel_filepos = hdr->sh_offset;
+	/* In the section to which the relocations apply, mark whether
+	   its relocations are of the REL or RELA variety.  */
+	elf_section_data (target_sect)->use_rela_p 
+	  = (hdr->sh_type == SHT_RELA);
 	abfd->flags |= HAS_RELOC;
 	return true;
       }
@@ -1324,11 +1415,15 @@
 {
   struct bfd_elf_section_data *sdata;
 
-  sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata));
+  sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, sizeof (*sdata));
   if (!sdata)
     return false;
   sec->used_by_bfd = (PTR) sdata;
-  memset (sdata, 0, sizeof (*sdata));
+
+  /* Indicate whether or not this section should use RELA relocations.  */
+  sdata->use_rela_p 
+    = get_elf_backend_data (abfd)->default_use_rela_p;
+
   return true;
 }
 
@@ -1355,10 +1450,11 @@
  */
 
 boolean
-bfd_section_from_phdr (abfd, hdr, index)
+_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
      bfd *abfd;
      Elf_Internal_Phdr *hdr;
      int index;
+     const char *typename;
 {
   asection *newsect;
   char *name;
@@ -1368,7 +1464,7 @@
   split = ((hdr->p_memsz > 0)
 	    && (hdr->p_filesz > 0)
 	    && (hdr->p_memsz > hdr->p_filesz));
-  sprintf (namebuf, split ? "segment%da" : "segment%d", index);
+  sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
   name = bfd_alloc (abfd, strlen (namebuf) + 1);
   if (!name)
     return false;
@@ -1399,7 +1495,7 @@
 
   if (split)
     {
-      sprintf (namebuf, "segment%db", index);
+      sprintf (namebuf, "%s%db", typename, index);
       name = bfd_alloc (abfd, strlen (namebuf) + 1);
       if (!name)
 	return false;
@@ -1423,6 +1519,89 @@
   return true;
 }
 
+boolean
+bfd_section_from_phdr (abfd, hdr, index)
+     bfd *abfd;
+     Elf_Internal_Phdr *hdr;
+     int index;
+{
+  struct elf_backend_data *bed;
+
+  switch (hdr->p_type)
+    {
+    case PT_NULL:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "null");
+
+    case PT_LOAD:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "load");
+
+    case PT_DYNAMIC:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "dynamic");
+
+    case PT_INTERP:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "interp");
+
+    case PT_NOTE:
+      if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note"))
+	return false;
+      if (! elfcore_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
+	return false;
+      return true;
+
+    case PT_SHLIB:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "shlib");
+
+    case PT_PHDR:
+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr");
+
+    default:
+      /* Check for any processor-specific program segment types.
+         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);
+      else
+	return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "segment");
+    }
+}
+
+/* Initialize REL_HDR, the section-header for new section, containing
+   relocations against ASECT.  If USE_RELA_P is true, we use RELA
+   relocations; otherwise, we use REL relocations.  */
+
+boolean
+_bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p)
+     bfd *abfd;
+     Elf_Internal_Shdr *rel_hdr;
+     asection *asect;
+     boolean use_rela_p;
+{
+  char *name;
+  struct elf_backend_data *bed;
+
+  bed = get_elf_backend_data (abfd);
+  name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name));
+  if (name == NULL)
+    return false;
+  sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
+  rel_hdr->sh_name =
+    (unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name,
+				       true, false);
+  if (rel_hdr->sh_name == (unsigned int) -1)
+    return false;
+  rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL;
+  rel_hdr->sh_entsize = (use_rela_p
+			 ? bed->s->sizeof_rela
+			 : bed->s->sizeof_rel);
+  rel_hdr->sh_addralign = bed->s->file_align;
+  rel_hdr->sh_flags = 0;
+  rel_hdr->sh_addr = 0;
+  rel_hdr->sh_size = 0;
+  rel_hdr->sh_offset = 0;
+
+  return true;
+}
+
 /* Set up an ELF internal section header for a section.  */
 
 /*ARGSUSED*/
@@ -1478,7 +1657,7 @@
   else if (strcmp (asect->name, ".hash") == 0)
     {
       this_hdr->sh_type = SHT_HASH;
-      this_hdr->sh_entsize = bed->s->arch_size / 8;
+      this_hdr->sh_entsize = bed->s->sizeof_hash_entry;
     }
   else if (strcmp (asect->name, ".dynsym") == 0)
     {
@@ -1491,13 +1670,13 @@
       this_hdr->sh_entsize = bed->s->sizeof_dyn;
     }
   else if (strncmp (asect->name, ".rela", 5) == 0
-	   && get_elf_backend_data (abfd)->use_rela_p)
+	   && get_elf_backend_data (abfd)->may_use_rela_p)
     {
       this_hdr->sh_type = SHT_RELA;
       this_hdr->sh_entsize = bed->s->sizeof_rela;
     }
   else if (strncmp (asect->name, ".rel", 4) == 0
-	   && ! get_elf_backend_data (abfd)->use_rela_p)
+	   && get_elf_backend_data (abfd)->may_use_rel_p)
     {
       this_hdr->sh_type = SHT_REL;
       this_hdr->sh_entsize = bed->s->sizeof_rel;
@@ -1558,47 +1737,19 @@
     this_hdr->sh_flags |= SHF_EXECINSTR;
 
   /* Check for processor-specific section types.  */
-  {
-    struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
-    if (bed->elf_backend_fake_sections)
-      (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect);
-  }
+  if (bed->elf_backend_fake_sections)
+    (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect);
 
   /* If the section has relocs, set up a section header for the
-     SHT_REL[A] section.  */
-  if ((asect->flags & SEC_RELOC) != 0)
-    {
-      Elf_Internal_Shdr *rela_hdr;
-      int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
-      char *name;
-
-      rela_hdr = &elf_section_data (asect)->rel_hdr;
-      name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name));
-      if (name == NULL)
-	{
-	  *failedptr = true;
-	  return;
-	}
-      sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
-      rela_hdr->sh_name =
-	(unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name,
-					   true, false);
-      if (rela_hdr->sh_name == (unsigned int) -1)
-	{
-	  *failedptr = true;
-	  return;
-	}
-      rela_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL;
-      rela_hdr->sh_entsize = (use_rela_p
-			      ? bed->s->sizeof_rela
-			      : bed->s->sizeof_rel);
-      rela_hdr->sh_addralign = bed->s->file_align;
-      rela_hdr->sh_flags = 0;
-      rela_hdr->sh_addr = 0;
-      rela_hdr->sh_size = 0;
-      rela_hdr->sh_offset = 0;
-    }
+     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.  */ 
+  if ((asect->flags & SEC_RELOC) != 0
+      && !_bfd_elf_init_reloc_shdr (abfd, 
+				    &elf_section_data (asect)->rel_hdr,
+				    asect, 
+				    elf_section_data (asect)->use_rela_p))
+    *failedptr = true;
 }
 
 /* Assign all ELF section numbers.  The dummy first section is handled here
@@ -1626,6 +1777,11 @@
 	d->rel_idx = 0;
       else
 	d->rel_idx = section_number++;
+
+      if (d->rel_hdr2)
+	d->rel_idx2 = section_number++;
+      else
+	d->rel_idx2 = 0;
     }
 
   t->shstrtab_section = section_number++;
@@ -1674,6 +1830,8 @@
       i_shdrp[d->this_idx] = &d->this_hdr;
       if (d->rel_idx != 0)
 	i_shdrp[d->rel_idx] = &d->rel_hdr;
+      if (d->rel_idx2 != 0)
+	i_shdrp[d->rel_idx2] = d->rel_hdr2;
 
       /* Fill in the sh_link and sh_info fields while we're at it.  */
 
@@ -1685,6 +1843,11 @@
 	  d->rel_hdr.sh_link = t->symtab_section;
 	  d->rel_hdr.sh_info = d->this_idx;
 	}
+      if (d->rel_idx2 != 0)
+	{
+	  d->rel_hdr2->sh_link = t->symtab_section;
+	  d->rel_hdr2->sh_info = d->this_idx;
+	}
 
       switch (d->this_hdr.sh_type)
 	{
@@ -2011,6 +2174,10 @@
   if (! prep_headers (abfd))
     return false;
 
+  /* Post process the headers if necessary.  */
+  if (bed->elf_backend_post_process_headers)
+    (*bed->elf_backend_post_process_headers) (abfd, link_info);
+
   failed = false;
   bfd_map_over_sections (abfd, elf_fake_sections, &failed);
   if (failed)
@@ -2514,11 +2681,7 @@
 	       elf_sort_sections);
 
       p->p_type = m->p_type;
-
-      if (m->p_flags_valid)
-	p->p_flags = m->p_flags;
-      else
-	p->p_flags = 0;
+      p->p_flags = m->p_flags;
 
       if (p->p_type == PT_LOAD
 	  && m->count > 0
@@ -3042,6 +3205,9 @@
     bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB;
   i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current;
 
+  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_SYSV;
+  i_ehdrp->e_ident[EI_ABIVERSION] = 0;
+
   for (count = EI_PAD; count < EI_NIDENT; count++)
     i_ehdrp->e_ident[count] = 0;
 
@@ -3065,6 +3231,9 @@
       else
 	i_ehdrp->e_machine = EM_SPARC;
       break;
+    case bfd_arch_i370:
+      i_ehdrp->e_machine = EM_S370;
+      break;
     case bfd_arch_i386:
       i_ehdrp->e_machine = EM_386;
       break;
@@ -3077,6 +3246,9 @@
     case bfd_arch_i860:
       i_ehdrp->e_machine = EM_860;
       break;
+    case bfd_arch_i960:
+      i_ehdrp->e_machine = EM_960;
+      break;
     case bfd_arch_mips:	/* MIPS Rxxxx */
       i_ehdrp->e_machine = EM_MIPS;	/* only MIPS R3000 */
       break;
@@ -3104,6 +3276,9 @@
     case bfd_arch_mcore:
       i_ehdrp->e_machine = EM_MCORE;
       break;
+    case bfd_arch_avr:
+      i_ehdrp->e_machine = EM_AVR;
+      break;
     case bfd_arch_v850:
       switch (bfd_get_mach (abfd))
 	{
@@ -3126,6 +3301,9 @@
     case bfd_arch_mn10300:
       i_ehdrp->e_machine = EM_CYGNUS_MN10300;
       break;
+    case bfd_arch_pj:
+      i_ehdrp->e_machine = EM_PJ;
+      break;
       /* also note that EM_M32, AT&T WE32100 is unknown to bfd */
     default:
       i_ehdrp->e_machine = EM_NONE;
@@ -3827,6 +4005,9 @@
       || ihdr->sh_type == SHT_GNU_verdef)
     ohdr->sh_info = ihdr->sh_info;
 
+  elf_section_data (osec)->use_rela_p
+    = elf_section_data (isec)->use_rela_p;
+
   return true;
 }
 
@@ -4046,7 +4227,8 @@
 	  type = STT_NOTYPE;
 
         /* Processor-specific types */
-        if (bed->elf_backend_get_symbol_type)
+        if (type_ptr != NULL
+	    && bed->elf_backend_get_symbol_type)
           type = (*bed->elf_backend_get_symbol_type) (&type_ptr->internal_elf_sym, type);
 
 	if (flags & BSF_SECTION_SYM)
@@ -4140,7 +4322,7 @@
 
 long
 _bfd_elf_get_reloc_upper_bound (abfd, asect)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr asect;
 {
   return (asect->reloc_count + 1) * sizeof (arelent *);
@@ -4471,7 +4653,7 @@
 
 void
 _bfd_elf_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -4484,7 +4666,7 @@
 
 boolean
 _bfd_elf_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   /* Normal local symbols start with ``.L''.  */
@@ -4510,8 +4692,8 @@
 
 alent *
 _bfd_elf_get_lineno (ignore_abfd, symbol)
-     bfd *ignore_abfd;
-     asymbol *symbol;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
 {
   abort ();
   return NULL;
@@ -4565,7 +4747,7 @@
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr))
+				     line_ptr, 0))
     return true;
 
   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
@@ -4661,9 +4843,9 @@
 
 void
 _bfd_elf_no_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
-     arelent *cache_ptr;
-     Elf_Internal_Rela *dst;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr ATTRIBUTE_UNUSED;
+     Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
 {
   abort ();
 }
@@ -4797,13 +4979,13 @@
 
 bfd_reloc_status_type
 _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg)
-     bfd *abfd;
-     arelent *re;
-     struct symbol_cache_entry *symbol;
-     PTR data;
-     asection *is;
-     bfd *obfd;
-     char **errmsg;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *re ATTRIBUTE_UNUSED;
+     struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *is ATTRIBUTE_UNUSED;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     char **errmsg ATTRIBUTE_UNUSED;
 {
   return bfd_reloc_ok;
 }
@@ -4924,28 +5106,33 @@
 #endif /* defined (HAVE_PRSTATUS_T) */
 
 
-/* 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. */
+/* 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
+     such a section already exists.
+   - For the multi-threaded case, a section named "NAME/PID", where
+     PID is elfcore_make_pid (abfd).
+   Both pseudosections have identical contents: the contents of NOTE.  */
 
 static boolean
-elfcore_grok_prfpreg (abfd, note)
+elfcore_make_note_pseudosection (abfd, name, note)
      bfd* abfd;
+     char *name;
      Elf_Internal_Note* note;
 {
   char buf[100];
-  char* name;
+  char *threaded_name;
   asection* sect;
 
-  /* Make a ".reg2/999" section. */
+  /* Build the section name.  */
 
-  sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd));
-  name = bfd_alloc (abfd, strlen (buf) + 1);
-  if (name == NULL)
+  sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
+  threaded_name = bfd_alloc (abfd, strlen (buf) + 1);
+  if (threaded_name == NULL)
     return false;
-  strcpy (name, buf);
+  strcpy (threaded_name, buf);
 
-  sect = bfd_make_section (abfd, name);
+  sect = bfd_make_section (abfd, threaded_name);
   if (sect == NULL)
     return false;
   sect->_raw_size = note->descsz;
@@ -4953,12 +5140,37 @@
   sect->flags = SEC_HAS_CONTENTS;
   sect->alignment_power = 2;
 
-  if (! elfcore_maybe_make_sect (abfd, ".reg2", sect))
+  if (! elfcore_maybe_make_sect (abfd, name, sect))
     return false;
 
   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. */
+static boolean
+elfcore_grok_prfpreg (abfd, 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;
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
+}
+
+
 #if defined (HAVE_PRPSINFO_T)
 # define elfcore_psinfo_t prpsinfo_t
 #endif
@@ -5139,7 +5351,83 @@
 }
 #endif /* defined (HAVE_LWPSTATUS_T) */
 
+#if defined (HAVE_WIN32_PSTATUS_T)
+static boolean
+elfcore_grok_win32pstatus (abfd, note)
+     bfd * abfd;
+     Elf_Internal_Note * note;
+{
+  char buf[30];
+  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) 
+    {
+    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 ;
+
+    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;
+      
+      strcpy (name, buf);
+
+      sect = bfd_make_section (abfd, name);
+      if (sect == NULL)
+        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);
+      sect->flags = SEC_HAS_CONTENTS;
+      sect->alignment_power = 2;
+
+      if (pstatus.data.thread_info.is_active_thread)
+	if (! elfcore_maybe_make_sect (abfd, ".reg", sect))
+	  return false;
+      break;
+
+    case NOTE_INFO_MODULE:
+      /* Make a ".module/xxxxxxxx" section.  */
+      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;
+      sect->alignment_power = 2;
+      break;
+
+    default:
+      return true;
+    }
+
+  return true;
+}
+#endif /* HAVE_WIN32_PSTATUS_T */
 
 static boolean
 elfcore_grok_note (abfd, note)
@@ -5169,6 +5457,18 @@
     case NT_FPREGSET:		/* FIXME: rename to NT_PRFPREG */
       return elfcore_grok_prfpreg (abfd, note);
 
+#if defined (HAVE_WIN32_PSTATUS_T)
+    case NT_WIN32PSTATUS:	
+      return elfcore_grok_win32pstatus (abfd, note);
+#endif
+
+  case NT_PRXFPREG:		/* Linux SSE extension */
+      if (note->namesz == 5
+	  && ! strcmp (note->namedata, "LINUX"))
+	return elfcore_grok_prxfpreg (abfd, note);
+      else
+	return true;
+
 #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
     case NT_PRPSINFO:
     case NT_PSINFO:
@@ -5231,6 +5531,8 @@
 }
 
 
+/* 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)
@@ -5241,10 +5543,54 @@
   if (! bfd_section_from_phdr (abfd, phdr, sec_num))
     return false;
 
-  if (phdr->p_type == PT_NOTE
-      && ! elfcore_read_notes (abfd, phdr->p_offset, phdr->p_filesz))
-    return false;
-
   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;
+{
+  if (abfd->xvec->flavour != bfd_target_elf_flavour)
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return -1;
+    }
+
+  return (elf_elfheader (abfd)->e_phnum
+	  * 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
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   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;
+     void *phdrs;
+{
+  int num_phdrs;
+
+  if (abfd->xvec->flavour != bfd_target_elf_flavour)
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return -1;
+    }
+
+  num_phdrs = elf_elfheader (abfd)->e_phnum;
+  memcpy (phdrs, elf_tdata (abfd)->phdr, 
+	  num_phdrs * sizeof (Elf_Internal_Phdr));
+
+  return num_phdrs;
+}
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index a490a24..318dc70 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1,5 +1,5 @@
 /* ARC-specific support for 32-bit ELF
-   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -118,7 +118,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;
@@ -138,7 +138,7 @@
 
 static void
 arc_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
@@ -178,7 +178,7 @@
 static void
 arc_elf_final_write_processing (abfd, linker)
      bfd *abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   int mach;
   unsigned long val;
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index d4e97d6..eaaf976 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -29,12 +29,14 @@
   PARAMS ((bfd *, bfd *));
 static boolean elf32_arm_print_private_bfd_data
   PARAMS ((bfd *, PTR));
-static int elf32_arm_get_symbol_type 
+static int elf32_arm_get_symbol_type
   PARAMS (( Elf_Internal_Sym *, int));
 static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
   PARAMS ((bfd *));
 static bfd_reloc_status_type elf32_arm_final_link_relocate
-  PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *, const char *, unsigned char));
+  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));
@@ -46,6 +48,14 @@
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 static void record_thumb_to_arm_glue
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static void elf32_arm_post_process_headers
+  PARAMS ((bfd *, struct bfd_link_info *));
+static int elf32_arm_to_thumb_stub
+  PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
+	   bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
+static int elf32_thumb_to_arm_stub
+  PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
+	   bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
 
 /* The linker script knows the section names for placement.
    The entry_names are used to do simple name mangling on the stubs.
@@ -71,7 +81,7 @@
 
 /* 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 calles the dynamic
+   called before the relocation has been set up calls the dynamic
    linker first */
 
 static const bfd_byte elf32_arm_plt0_entry [PLT_ENTRY_SIZE] =
@@ -79,7 +89,7 @@
   0x04, 0xe0, 0x2d, 0xe5,	/* str   lr, [sp, #-4]!     */
   0x10, 0xe0, 0x9f, 0xe5,	/* ldr   lr, [pc, #16]      */
   0x0e, 0xe0, 0x8f, 0xe0,	/* adr   lr, pc, lr         */
-  0x08, 0xf0, 0xbe, 0xe5	/* ldr   pc, [lr, #-4]      */
+  0x08, 0xf0, 0xbe, 0xe5	/* ldr   pc, [lr, #8]!      */
 };
 
 /* Subsequent entries in a procedure linkage table look like
@@ -113,7 +123,7 @@
   bfd_size_type count;
 };
 
-/* arm ELF linker hash entry.  */
+/* Arm ELF linker hash entry.  */
 
 struct elf32_arm_link_hash_entry
 {
@@ -154,9 +164,43 @@
 
     /* 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;
   };
 
 
+/* Create an entry in an ARM ELF linker hash table.  */
+
+static struct bfd_hash_entry *
+elf32_arm_link_hash_newfunc (entry, table, string)
+     struct bfd_hash_entry * entry;
+     struct bfd_hash_table * table;
+     const char * string;
+{
+  struct elf32_arm_link_hash_entry * ret =
+    (struct elf32_arm_link_hash_entry *) entry;
+
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (ret == (struct elf32_arm_link_hash_entry *) NULL)
+    ret = ((struct elf32_arm_link_hash_entry *)
+	   bfd_hash_allocate (table,
+			      sizeof (struct elf32_arm_link_hash_entry)));
+  if (ret == (struct elf32_arm_link_hash_entry *) NULL)
+    return (struct bfd_hash_entry *) ret;
+
+  /* Call the allocation method of the superclass.  */
+  ret = ((struct elf32_arm_link_hash_entry *)
+	 _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+				     table, string));
+  if (ret != (struct elf32_arm_link_hash_entry *) NULL)
+    ret->pcrel_relocs_copied = NULL;
+
+  return (struct bfd_hash_entry *) ret;
+}
+
 /* Create an ARM elf linker hash table */
 
 static struct bfd_link_hash_table *
@@ -171,7 +215,7 @@
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
-				      _bfd_elf_link_hash_newfunc))
+				      elf32_arm_link_hash_newfunc))
     {
       bfd_release (abfd, ret);
       return NULL;
@@ -180,6 +224,7 @@
   ret->thumb_glue_size = 0;
   ret->arm_glue_size = 0;
   ret->bfd_of_glue_owner = NULL;
+  ret->no_pipeline_knowledge = 0;
 
   return &ret->root.root;
 }
@@ -282,7 +327,7 @@
    ldmia r13! {r6, lr}
    bx    lr
    __func_addr:
-   .word        func 
+   .word        func
  */
 
 #define THUMB2ARM_GLUE_SIZE 8
@@ -500,7 +545,10 @@
 
   if (sec == NULL)
     {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+      /* Note: we do not include the flag SEC_LINKER_CREATED, as this
+	 will prevent elf_link_input_bfd() from processing the contents
+	 of this section.  */
+      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
 
       sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
 
@@ -508,13 +556,17 @@
 	  || !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;
     }
 
   sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);
 
   if (sec == NULL)
     {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
 
       sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
 
@@ -522,6 +574,8 @@
 	  || !bfd_set_section_flags (abfd, sec, flags)
 	  || !bfd_set_section_alignment (abfd, sec, 2))
 	return false;
+      
+      sec->gc_mark = 1;
     }
 
   /* Save the bfd for later use.  */
@@ -531,9 +585,10 @@
 }
 
 boolean
-bfd_elf32_arm_process_before_allocation (abfd, link_info)
+bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
      bfd *abfd;
      struct bfd_link_info *link_info;
+     int no_pipeline_knowledge;
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *free_relocs = NULL;
@@ -559,6 +614,8 @@
   BFD_ASSERT (globals != NULL);
   BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
 
+  globals->no_pipeline_knowledge = no_pipeline_knowledge;
+
   /* Rummage around all the relocs and map the glue vectors.  */
   sec = abfd->sections;
 
@@ -583,7 +640,6 @@
 	{
 	  long r_type;
 	  unsigned long r_index;
-	  unsigned char code;
 
 	  struct elf_link_hash_entry *h;
 
@@ -591,7 +647,7 @@
 	  r_index = ELF32_R_SYM (irel->r_info);
 
 	  /* These are the only relocation types we care about */
-	  if (r_type != R_ARM_PC24
+	  if (   r_type != R_ARM_PC24
 	      && r_type != R_ARM_THM_PC22)
 	    continue;
 
@@ -658,7 +714,7 @@
 	    {
 	    case R_ARM_PC24:
 	      /* 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
+	         the target of the call.  If it is a thumb target, we
 	         insert glue.  */
 
 	      if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
@@ -666,9 +722,9 @@
 	      break;
 
 	    case R_ARM_THM_PC22:
-	      /* 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. */ 
+	      /* 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);
@@ -681,6 +737,7 @@
     }
 
   return true;
+  
 error_return:
   if (free_relocs != NULL)
     free (free_relocs);
@@ -688,22 +745,22 @@
     free (free_contents);
   if (free_extsyms != NULL)
     free (free_extsyms);
+  
   return false;
-
 }
 
 /* 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,
@@ -711,7 +768,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)
@@ -754,23 +811,23 @@
 static int
 elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
 			 hit_data, sym_sec, offset, addend, val)
-     struct bfd_link_info *info;
-     char *name;
-     bfd *input_bfd;
-     bfd *output_bfd;
-     asection *input_section;
-     bfd_byte *hit_data;
-     asection *sym_sec;
-     int offset;
-     int addend;
-     bfd_vma val;
+     struct bfd_link_info * info;
+     const char *           name;
+     bfd *                  input_bfd;
+     bfd *                  output_bfd;
+     asection *             input_section;
+     bfd_byte *             hit_data;
+     asection *             sym_sec;
+     bfd_vma                offset;
+     bfd_signed_vma         addend;
+     bfd_vma                val;
 {
-  asection *s = 0;
+  asection * s = 0;
   long int my_offset;
   unsigned long int tmp;
   long int ret_offset;
-  struct elf_link_hash_entry *myh;
-  struct elf32_arm_link_hash_table *globals;
+  struct elf_link_hash_entry * myh;
+  struct elf32_arm_link_hash_table * globals;
 
   myh = find_thumb_glue (info, name, input_bfd);
   if (myh == NULL)
@@ -838,7 +895,7 @@
     + my_offset
     - (input_section->output_offset
        + offset + addend)
-    - 4;
+    - 8;
 
   tmp = bfd_get_32 (input_bfd, hit_data
 		    - input_section->vma);
@@ -854,24 +911,23 @@
 static int
 elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
 			 hit_data, sym_sec, offset, addend, val)
-
-     struct bfd_link_info *info;
-     char *name;
-     bfd *input_bfd;
-     bfd *output_bfd;
-     asection *input_section;
-     bfd_byte *hit_data;
-     asection *sym_sec;
-     int offset;
-     int addend;
-     bfd_vma val;
+     struct bfd_link_info * info;
+     const char *           name;
+     bfd *                  input_bfd;
+     bfd *                  output_bfd;
+     asection *             input_section;
+     bfd_byte *             hit_data;
+     asection *             sym_sec;
+     bfd_vma                offset;
+     bfd_signed_vma         addend;
+     bfd_vma                val;
 {
   unsigned long int tmp;
   long int my_offset;
-  asection *s;
+  asection * s;
   long int ret_offset;
-  struct elf_link_hash_entry *myh;
-  struct elf32_arm_link_hash_table *globals;
+  struct elf_link_hash_entry * myh;
+  struct elf32_arm_link_hash_table * globals;
 
   myh = find_arm_glue (info, name, input_bfd);
   if (myh == NULL)
@@ -929,13 +985,12 @@
        + input_section->output_section->vma
        + offset + addend)
     - 8;
-
+  
   tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
 
   bfd_put_32 (output_bfd, tmp, hit_data
 	      - input_section->vma);
 
-
   return true;
 }
 
@@ -943,7 +998,7 @@
 static bfd_reloc_status_type
 elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
 			       input_section, contents, rel, value,
-			       info, sym_sec, sym_name, sym_flags)
+			       info, sym_sec, sym_name, sym_flags, h)
      reloc_howto_type *     howto;
      bfd *                  input_bfd;
      bfd *                  output_bfd;
@@ -955,6 +1010,7 @@
      asection *             sym_sec;
      const char *           sym_name;
      unsigned char          sym_flags;
+     struct elf_link_hash_entry * h;
 {
   unsigned long                 r_type = howto->type;
   unsigned long                 r_symndx;
@@ -966,9 +1022,12 @@
   asection *                    sgot = NULL;
   asection *                    splt = NULL;
   asection *                    sreloc = NULL;
-  struct elf_link_hash_entry *  h = NULL;
   bfd_vma                       addend;
-    
+  bfd_signed_vma                signed_addend;
+  struct elf32_arm_link_hash_table * globals;
+
+  globals = elf32_arm_hash_table (info);
+
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj)
     {
@@ -981,11 +1040,20 @@
   r_symndx = ELF32_R_SYM (rel->r_info);
 
 #ifdef USE_REL
-  addend = (bfd_get_32 (input_bfd, hit_data) & howto->src_mask);
+  addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask;
+
+  if (addend & ((howto->src_mask + 1) >> 1))
+    {
+      signed_addend = -1;
+      signed_addend &= ~ howto->src_mask;
+      signed_addend |= addend;
+    }
+  else
+    signed_addend = addend;
 #else
-  addend = rel->r_addend;
+  addend = signed_addend = rel->r_addend;
 #endif
-  
+
   switch (r_type)
     {
     case R_ARM_NONE:
@@ -996,7 +1064,7 @@
     case R_ARM_REL32:
       /* When generating a shared object, these relocations are copied
 	 into the output file to be resolved at run time. */
-      
+
       if (info->shared
 	  && (r_type != R_ARM_PC24
  	      || (h != NULL
@@ -1007,35 +1075,35 @@
 	{
 	  Elf_Internal_Rel outrel;
 	  boolean skip, relocate;
-	  
+
 	  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 bfd_reloc_notsupported;
-	      
+
 	      BFD_ASSERT (strncmp (name, ".rel", 4) == 0
 			  && strcmp (bfd_get_section_name (input_bfd,
 							   input_section),
 				     name + 4) == 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,
@@ -1045,10 +1113,10 @@
 		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);
@@ -1083,20 +1151,21 @@
 		  outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32);
 		}
 	    }
-	  
+
 	  bfd_elf32_swap_reloc_out (output_bfd, &outrel,
 				    (((Elf32_External_Rel *)
 				      sreloc->contents)
 				     + sreloc->reloc_count));
 	  ++sreloc->reloc_count;
 	  
-	  /* If this reloc is against an external symbol, we do not want to 
+	  /* 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)
 	    return bfd_reloc_ok;
+
 	  
-	  return _bfd_final_link_relocate (howto, input_bfd, input_section, 
+	  return _bfd_final_link_relocate (howto, input_bfd, input_section,
 					   contents, rel->r_offset, value,
 					   (bfd_vma) 0);
 	}
@@ -1104,38 +1173,103 @@
 	{
 	case R_ARM_PC24:
 	  /* Arm B/BL instruction */
-	  
+
 	  /* Check for arm calling thumb function.  */
 	  if (sym_flags == STT_ARM_TFUNC)
 	    {
 	      elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd,
-				       input_section, hit_data, sym_sec, rel->r_offset, addend, value);
+				       input_section, hit_data, sym_sec, rel->r_offset,
+				       signed_addend, value);
 	      return bfd_reloc_ok;
 	    }
-	  
-	  value = value + addend;
-	  value -= (input_section->output_section->vma
-		    + input_section->output_offset + 8);
-	  value -= rel->r_offset;
-	  value = value >> howto->rightshift;
-	  
-	  value &= 0xffffff;
-	  value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000);
+
+	  if (   strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0
+	      || strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0)
+	    {
+	      /* 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;
+	      value += addend;
+
+	      if (! globals->no_pipeline_knowledge)
+		value -= 8;
+	    }
+	  else
+	    {
+	      /* The ARM ELF ABI says that this reloc is computed as: S - P + A
+		 where:
+		  S is the address of the symbol in the relocation.
+		  P is address of the instruction being relocated.
+		  A is the addend (extracted from the instruction) in bytes.
+
+		 S is held in 'value'.
+		 P is the base address of the section containing the instruction
+		   plus the offset of the reloc into that section, ie:
+		     (input_section->output_section->vma +
+		      input_section->output_offset +
+		      rel->r_offset).
+		 A is the addend, converted into bytes, ie:
+		     (signed_addend * 4)
+
+		 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;
+	      value += (signed_addend << howto->size);
+
+	      /* Previous versions of this code also used to add in the pipeline
+		 offset here.  This is wrong because the linker is not supposed
+		 to know about such things, and one day it might change.  In order
+		 to support old binaries that need the old behaviour however, so
+		 we attempt to detect which ABI was used to create the reloc.  */
+	      if (! globals->no_pipeline_knowledge)
+		{
+		  Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */
+
+		  i_ehdrp = elf_elfheader (input_bfd);
+
+		  if (i_ehdrp->e_ident[EI_OSABI] == 0)
+		    value -= 8;
+		}
+	    }
+
+	  /* 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.  */	     
+	  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))
+		  || 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));
 	  break;
-	  
+
 	case R_ARM_ABS32:
 	  value += addend;
 	  if (sym_flags == STT_ARM_TFUNC)
 	    value |= 1;
 	  break;
-	  
+
 	case R_ARM_REL32:
 	  value -= (input_section->output_section->vma
 		    + input_section->output_offset);
 	  value += addend;
 	  break;
 	}
-      
+
       bfd_put_32 (input_bfd, value, hit_data);
       return bfd_reloc_ok;
 
@@ -1190,45 +1324,62 @@
     case R_ARM_THM_PC22:
       /* Thumb BL (branch long instruction). */
       {
-	bfd_vma relocation;
-	boolean overflow = false;
-	bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data);
-	bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
-	bfd_vma src_mask = 0x007FFFFE;
+	bfd_vma        relocation;
+	boolean        overflow = false;
+	bfd_vma        upper_insn = bfd_get_16 (input_bfd, hit_data);
+	bfd_vma        lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
 	bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
-	bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
-	bfd_vma check;
+	bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
+	bfd_vma        check;
 	bfd_signed_vma signed_check;
-	bfd_vma add;
-	bfd_signed_vma signed_add;
 
 #ifdef USE_REL
 	/* Need to refetch the addend and squish the two 11 bit pieces
 	   together.  */
 	{
-	  bfd_vma upper = bfd_get_16 (input_bfd, hit_data) & 0x7ff;
-	  bfd_vma lower = bfd_get_16 (input_bfd, hit_data + 2) & 0x7ff;
+	  bfd_vma upper = upper_insn & 0x7ff;
+	  bfd_vma lower = lower_insn & 0x7ff;
 	  upper = (upper ^ 0x400) - 0x400; /* sign extend */
 	  addend = (upper << 12) | (lower << 1);
+	  signed_addend = addend;
 	}
 #endif
 
-        /* If it's not a call to thumb, assume call to arm */
-	if (sym_flags != STT_ARM_TFUNC)
+        /* If it is not a call to thumb, assume call to arm.
+	   If it is a call relative to a section name, then it is not a
+	   function call at all, but rather a long jump.  */
+	if (sym_flags != STT_ARM_TFUNC && sym_flags != STT_SECTION)
 	  {
 	    if (elf32_thumb_to_arm_stub
 		(info, sym_name, input_bfd, output_bfd, input_section,
-		 hit_data, sym_sec, rel->r_offset, addend, value))
+		 hit_data, sym_sec, rel->r_offset, signed_addend, value))
 	      return bfd_reloc_ok;
 	    else
 	      return bfd_reloc_dangerous;
 	  }
 
-	/* +4: pc is offset by 4 */
-	relocation = value + addend + 4;
+	relocation = value + signed_addend;
+
 	relocation -= (input_section->output_section->vma
-		       + input_section->output_offset);
-	relocation -= rel->r_offset;
+		       + input_section->output_offset
+		       + rel->r_offset);
+	
+	if (! globals->no_pipeline_knowledge)
+	  {
+	    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
+	       offset here.  This is wrong because the linker is not supposed
+	       to know about such things, and one day it might change.  In order
+	       to support old binaries that need the old behaviour however, so
+	       we attempt to detect which ABI was used to create the reloc.  */
+	    if (   strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0
+		|| strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0
+		|| i_ehdrp->e_ident[EI_OSABI] == 0)
+	      relocation += 4;
+	  }
 
 	check = relocation >> howto->rightshift;
 
@@ -1239,17 +1390,8 @@
 	else
 	  signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
 
-	add = ((upper_insn & 0x7ff) << 12) | ((lower_insn & 0x7ff) << 1);
-	/* sign extend */
-	signed_add = (add ^ 0x400000) - 0x400000;
-
-	/* Add the value from the object file.  */
-	signed_check += signed_add;
-	relocation += signed_add;
-
 	/* Assumes two's complement.  */
-	if (signed_check > reloc_signed_max
-	    || signed_check < reloc_signed_min)
+	if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
 	  overflow = true;
 
 	/* Put RELOCATION back into the insn.  */
@@ -1287,15 +1429,15 @@
       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. */
-      
+
       value -= sgot->output_section->vma;
-      return _bfd_final_link_relocate (howto, input_bfd, input_section, 
+      return _bfd_final_link_relocate (howto, input_bfd, input_section,
       				       contents, rel->r_offset, value,
       				       (bfd_vma) 0);
 
@@ -1303,28 +1445,28 @@
       /* Use global offset table as symbol value. */
 
       BFD_ASSERT (sgot != NULL);
-      
+
       if (sgot == NULL)
         return bfd_reloc_notsupported;
 
       value = sgot->output_section->vma;
-      return _bfd_final_link_relocate (howto, input_bfd, input_section, 
+      return _bfd_final_link_relocate (howto, input_bfd, input_section,
       				       contents, rel->r_offset, value,
       				       (bfd_vma) 0);
-      
+
     case R_ARM_GOT32:
       /* Relocation is to the entry for this symbol in the
          global offset table. */
       if (sgot == NULL)
 	return bfd_reloc_notsupported;
-      
+
       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)
 	       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
@@ -1334,11 +1476,11 @@
 		 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 .rel.got relocation
-		 entry to initialize the value.  This is done in the 
+		 entry to initialize the value.  This is done in the
 		 finish_dynamic_symbol routine. */
-	      
+
 	      if ((off & 1) != 0)
 		off &= ~1;
 	      else
@@ -1347,18 +1489,18 @@
 		  h->got.offset |= 1;
 		}
 	    }
-	  
+
 	  value = 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. */
@@ -1367,17 +1509,17 @@
 	  else
 	    {
 	      bfd_put_32 (output_bfd, value, sgot->contents + off);
-	      
+
 	      if (info->shared)
 		{
 		  asection * srelgot;
 		  Elf_Internal_Rel outrel;
-		  
+
 		  srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
 		  BFD_ASSERT (srelgot != NULL);
-		  
+
 		  outrel.r_offset = (sgot->output_section->vma
-				     + sgot->output_offset 
+				     + sgot->output_offset
 				     + off);
 		  outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
 		  bfd_elf32_swap_reloc_out (output_bfd, &outrel,
@@ -1386,17 +1528,17 @@
 					     + srelgot->reloc_count));
 		  ++srelgot->reloc_count;
 		}
-	      
+
 	      local_got_offsets[r_symndx] |= 1;
 	    }
-	  
+
 	  value = sgot->output_offset + off;
 	}
       
-      return _bfd_final_link_relocate (howto, input_bfd, input_section, 
+      return _bfd_final_link_relocate (howto, input_bfd, input_section,
       				       contents, rel->r_offset, value,
       				       (bfd_vma) 0);
-      
+
     case R_ARM_PLT32:
       /* Relocation is to the entry for this symbol in the
          procedure linkage table.  */
@@ -1426,7 +1568,7 @@
       return _bfd_final_link_relocate (howto, input_bfd, input_section,
         			       contents, rel->r_offset, value,
         			       (bfd_vma) 0);
-      
+
     case R_ARM_SBREL32:
       return bfd_reloc_notsupported;
 
@@ -1456,6 +1598,55 @@
     }
 }
 
+#ifdef USE_REL
+/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS.  */
+static void
+arm_add_to_rel (abfd, address, howto, increment)
+     bfd *              abfd;
+     bfd_byte *         address;
+     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))
+    {
+      bfd_signed_vma mask;
+      
+      mask = -1;
+      mask &= ~ howto->src_mask;
+      addend |= mask;
+    }
+
+  /* Add in the increment, (which is a byte value).  */
+  switch (howto->type)
+    {
+    case R_ARM_THM_PC22:
+    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 */
 
 /* Relocate an ARM ELF section.  */
 static boolean
@@ -1483,25 +1674,25 @@
   relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
     {
-      int r_type;
-      reloc_howto_type * howto;
-      unsigned long r_symndx;
-      Elf_Internal_Sym * sym;
-      asection * sec;
+      int                          r_type;
+      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;
+      bfd_vma                      relocation;
+      bfd_reloc_status_type        r;
+      arelent                      bfd_reloc;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
-      r_type = ELF32_R_TYPE (rel->r_info);
+      r_type   = ELF32_R_TYPE (rel->r_info);
 
-      if (r_type == R_ARM_GNU_VTENTRY
-          || r_type == R_ARM_GNU_VTINHERIT )
+      if (   r_type == R_ARM_GNU_VTENTRY
+          || r_type == R_ARM_GNU_VTINHERIT)
         continue;
 
-      /* ScottB: range check r_type here. */
-      
-      howto = elf32_arm_howto_table + r_type;
+      elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel);
+      howto = bfd_reloc.howto;
 
       if (info->relocateable)
 	{
@@ -1516,12 +1707,8 @@
 		{
 		  sec = local_sections[r_symndx];
 #ifdef USE_REL
-		  {
-		    bfd_vma val;
-		    val = bfd_get_32 (input_bfd, contents + rel->r_offset);
-		    val += (sec->output_offset + sym->st_value) >> howto->rightshift;
-		    bfd_put_32 (input_bfd, val, contents + rel->r_offset);
-		  }
+		  arm_add_to_rel (input_bfd, contents + rel->r_offset,
+				  howto, sec->output_offset + sym->st_value);
 #else
 		  rel->r_addend += (sec->output_offset + sym->st_value)
 		    >> howto->rightshift;
@@ -1553,14 +1740,12 @@
 	  if (h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
+	      int relocation_needed = 1;
+
 	      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 
+	         We check specially because in some obscure cases
 	         sec->output_section will be NULL. */
 	      switch (r_type)
 		{
@@ -1569,17 +1754,17 @@
 	          if (info->shared
 	              && (
 	              	  (!info->symbolic && h->dynindx != -1)
-	                  || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR == 0)
+	                  || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
 			  )
 	              && ((input_section->flags & SEC_ALLOC) != 0)
 		      )
-	            relocation = 0;
+	            relocation_needed = 0;
 		  break;
-		  
+
 	        case R_ARM_GOTPC:
-	          relocation = 0;
+	          relocation_needed = 0;
 		  break;
-		  
+
 	        case R_ARM_GOT32:
 	          if (elf_hash_table(info)->dynamic_sections_created
 	              && (!info->shared
@@ -1587,14 +1772,14 @@
 	                  || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
 			  )
 		      )
-	            relocation = 0;
+	            relocation_needed = 0;
 		  break;
-		  
+
 	        case R_ARM_PLT32:
 	          if (h->plt.offset != (bfd_vma)-1)
-	            relocation = 0;
+	            relocation_needed = 0;
 		  break;
-		  
+
 	        default:
 		  if (sec->output_section == NULL)
 		    {
@@ -1602,17 +1787,27 @@
 			(_("%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;
+		      relocation_needed = 0;
 		    }
 		}
+
+	      if (relocation_needed)
+		relocation = h->root.u.def.value
+		  + sec->output_section->vma
+		  + sec->output_offset;
+	      else
+		relocation = 0;
 	    }
 	  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)
 		    (info, h->root.root.string, input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset,
+		     (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
@@ -1627,12 +1822,12 @@
 	  if (name == NULL || *name == '\0')
 	    name = bfd_section_name (input_bfd, sec);
 	}
-      
+
       r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
 					 input_section, contents, rel,
 					 relocation, info, sec, name,
 					 (h ? ELF_ST_TYPE (h->type) :
-					  ELF_ST_TYPE (sym->st_info)));
+					  ELF_ST_TYPE (sym->st_info)), h);
 
       if (r != bfd_reloc_ok)
 	{
@@ -1650,7 +1845,7 @@
 	    case bfd_reloc_undefined:
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, name, input_bfd, input_section,
-		     rel->r_offset)))
+		     rel->r_offset, true)))
 		return false;
 	      break;
 
@@ -1910,16 +2105,28 @@
      Elf_Internal_Sym * elf_sym;
      int type;
 {
-  if (ELF_ST_TYPE (elf_sym->st_info) == STT_ARM_TFUNC)
-    return ELF_ST_TYPE (elf_sym->st_info);
-  else
-    return type;
+  switch (ELF_ST_TYPE (elf_sym->st_info))
+    {
+    case STT_ARM_TFUNC:
+      return ELF_ST_TYPE (elf_sym->st_info);
+      break;
+    case STT_ARM_16BIT:
+      /* If the symbol is not an object, return the STT_ARM_16BIT flag.
+	 This allows us to distinguish between data used by Thumb instructions
+	 and non-data (which is probably code) inside Thumb regions of an
+	 executable.  */
+      if (type != STT_OBJECT)
+	return ELF_ST_TYPE (elf_sym->st_info);
+      break;
+    }
+
+  return type;
 }
-    
+
 static asection *
 elf32_arm_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;
@@ -1941,6 +2148,9 @@
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -1957,21 +2167,21 @@
   return NULL;
 }
 
+/* Update the got entry reference counts for the section being removed.  */
+
 static boolean
 elf32_arm_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 armelf */
+  /* We don't support garbage collection of GOT and PLT relocs yet.  */
   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.  */
- 
+/* Look through the relocs for a section during the first phase.  */
+
 static boolean
 elf32_arm_check_relocs (abfd, info, sec, relocs)
      bfd *                      abfd;
@@ -1987,33 +2197,33 @@
   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);
   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)
 	{
@@ -2047,7 +2257,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)
 		  {
@@ -2070,7 +2280,7 @@
 	        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.  */
@@ -2097,7 +2307,7 @@
 		    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;
@@ -2212,7 +2422,7 @@
 		      {
 		        p = ((struct elf32_arm_pcrel_relocs_copied *)
 			     bfd_alloc (dynobj, sizeof * p));
-			
+
 		        if (p == NULL)
 			  return false;
 		        p->next = eh->pcrel_relocs_copied;
@@ -2232,20 +2442,20 @@
           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:
-          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset))
             return false;
           break;
         }
     }
- 
+
   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. */
@@ -2268,8 +2478,8 @@
   asymbol **   p;
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
-				     filename_ptr, functionname_ptr, 
-				     line_ptr))
+				     filename_ptr, functionname_ptr,
+				     line_ptr, 0))
     return true;
 
   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
@@ -2277,7 +2487,7 @@
 					     functionname_ptr, line_ptr,
 					     &elf_tdata (abfd)->line_info))
     return false;
-  
+
   if (found)
     return true;
 
@@ -2324,7 +2534,7 @@
   *filename_ptr = filename;
   *functionname_ptr = bfd_asymbol_name (func);
   *line_ptr = 0;
-  
+
   return true;
 }
 
@@ -2614,6 +2824,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)
@@ -2702,7 +2913,7 @@
 static boolean
 elf32_arm_discard_copies (h, ignore)
      struct elf32_arm_link_hash_entry * h;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf32_arm_pcrel_relocs_copied * s;
 
@@ -2767,7 +2978,7 @@
       bfd_put_32 (output_bfd,
 		      (sgot->output_section->vma
 		       + sgot->output_offset
-		       + got_offset 
+		       + got_offset
 		       - splt->output_section->vma
 		       - splt->output_offset
 		       - h->plt.offset - 12),
@@ -2804,7 +3015,7 @@
 
       /* 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);
@@ -2978,9 +3189,23 @@
   return true;
 }
 
+static void
+elf32_arm_post_process_headers (abfd, link_info)
+     bfd * abfd;
+     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+{
+  Elf_Internal_Ehdr * i_ehdrp;	/* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+
+  i_ehdrp->e_ident[EI_OSABI]      = ARM_ELF_OS_ABI_VERSION;
+  i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
+}
+
+
 #define ELF_ARCH			bfd_arch_arm
 #define ELF_MACHINE_CODE		EM_ARM
-#define ELF_MAXPAGE_SIZE		0x8000
+#define ELF_MAXPAGESIZE			0x8000
 
 
 #define bfd_elf32_bfd_copy_private_bfd_data 	elf32_arm_copy_private_bfd_data
@@ -3001,10 +3226,14 @@
 #define elf_backend_finish_dynamic_symbol	elf32_arm_finish_dynamic_symbol
 #define elf_backend_finish_dynamic_sections	elf32_arm_finish_dynamic_sections
 #define elf_backend_size_dynamic_sections	elf32_arm_size_dynamic_sections
+#define elf_backend_post_process_headers	elf32_arm_post_process_headers
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_plt_readonly    1
 #define elf_backend_want_got_plt    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-avr.c b/bfd/elf32-avr.c
new file mode 100644
index 0000000..c64ab28
--- /dev/null
+++ b/bfd/elf32-avr.c
@@ -0,0 +1,963 @@
+/* AVR-specific support for 32-bit ELF
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Denis Chertykov <denisc@overta.ru>
+
+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/avr.h"
+
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+static void avr_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static asection *elf32_avr_gc_mark_hook
+  PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf32_avr_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+static boolean elf32_avr_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+static bfd_reloc_status_type avr_final_link_relocate
+  PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, bfd_vma));
+static boolean elf32_avr_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+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
+
+static reloc_howto_type elf_avr_howto_table[] =
+{
+  HOWTO (R_AVR_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_AVR_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_AVR_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_AVR_32",		/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 7 bit PC relative relocation.  */
+  HOWTO (R_AVR_7_PCREL,		/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 7,			/* bitsize */
+	 true,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_AVR_7_PCREL",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* A 13 bit PC relative relocation.  */
+  HOWTO (R_AVR_13_PCREL,	/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 13,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_AVR_13_PCREL",	/* name */
+	 false,			/* partial_inplace */
+	 0xfff,			/* src_mask */
+	 0xfff,			/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* A 16 bit absolute relocation.  */
+  HOWTO (R_AVR_16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* 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_AVR_16",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit absolute relocation for command address.  */
+  HOWTO (R_AVR_16_PM,		/* type */
+	 1,			/* 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_AVR_16_PM",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A low 8 bit absolute relocation of 16 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_LO8_LDI,		/* type */
+	 0,			/* rightshift */
+	 1,			/* 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_AVR_LO8_LDI",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 8 bit absolute relocation of 16 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_HI8_LDI,		/* type */
+	 8,			/* rightshift */
+	 1,			/* 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_AVR_HI8_LDI",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 6 bit absolute relocation of 22 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_HH8_LDI,		/* type */
+	 16,			/* rightshift */
+	 1,			/* 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_AVR_HH8_LDI",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A negative low 8 bit absolute relocation of 16 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_LO8_LDI_NEG,	/* type */
+	 0,			/* rightshift */
+	 1,			/* 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_AVR_LO8_LDI_NEG",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A hegative high 8 bit absolute relocation of 16 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_HI8_LDI_NEG,	/* type */
+	 8,			/* rightshift */
+	 1,			/* 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_AVR_HI8_LDI_NEG",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A hegative high 6 bit absolute relocation of 22 bit address.
+     For LDI command.  */
+  HOWTO (R_AVR_HH8_LDI_NEG,	/* type */
+	 16,			/* rightshift */
+	 1,			/* 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_AVR_HH8_LDI_NEG",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A low 8 bit absolute relocation of 24 bit program memory address.
+     For LDI command.  */
+  HOWTO (R_AVR_LO8_LDI_PM,	/* type */
+	 1,			/* rightshift */
+	 1,			/* 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_AVR_LO8_LDI_PM",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 8 bit absolute relocation of 16 bit program memory address.
+     For LDI command.  */
+  HOWTO (R_AVR_HI8_LDI_PM,	/* type */
+	 9,			/* rightshift */
+	 1,			/* 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_AVR_HI8_LDI_PM",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 8 bit absolute relocation of 24 bit program memory address.
+     For LDI command.  */
+  HOWTO (R_AVR_HH8_LDI_PM,	/* type */
+	 17,			/* rightshift */
+	 1,			/* 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_AVR_HH8_LDI_PM",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A low 8 bit absolute relocation of a negative 24 bit
+     program memory address.  For LDI command.  */
+  HOWTO (R_AVR_LO8_LDI_PM_NEG,	/* type */
+	 1,			/* rightshift */
+	 1,			/* 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_AVR_LO8_LDI_PM_NEG", /* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 8 bit absolute relocation of a negative 16 bit
+     program memory address.  For LDI command.  */
+  HOWTO (R_AVR_HI8_LDI_PM_NEG,	/* type */
+	 9,			/* rightshift */
+	 1,			/* 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_AVR_HI8_LDI_PM_NEG", /* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* A high 8 bit absolute relocation of a negative 24 bit
+     program memory address.  For LDI command.  */
+  HOWTO (R_AVR_HH8_LDI_PM_NEG,	/* type */
+	 17,			/* rightshift */
+	 1,			/* 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_AVR_HH8_LDI_PM_NEG", /* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+  /* Relocation for CALL command in ATmega.  */
+  HOWTO (R_AVR_CALL,		/* type */
+	 1,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 23,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_AVR_CALL",		/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false)			/* pcrel_offset */
+};
+
+/* Map BFD reloc types to AVR ELF reloc types.  */
+
+struct avr_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned int elf_reloc_val;
+};
+
+ static const struct avr_reloc_map avr_reloc_map[] =
+{
+  { BFD_RELOC_NONE,                 R_AVR_NONE },
+  { BFD_RELOC_32,                   R_AVR_32 },
+  { BFD_RELOC_AVR_7_PCREL,          R_AVR_7_PCREL },
+  { BFD_RELOC_AVR_13_PCREL,         R_AVR_13_PCREL },
+  { BFD_RELOC_16,                   R_AVR_16 },
+  { BFD_RELOC_AVR_16_PM,            R_AVR_16_PM },
+  { BFD_RELOC_AVR_LO8_LDI,          R_AVR_LO8_LDI},
+  { BFD_RELOC_AVR_HI8_LDI,          R_AVR_HI8_LDI },
+  { BFD_RELOC_AVR_HH8_LDI,          R_AVR_HH8_LDI },
+  { BFD_RELOC_AVR_LO8_LDI_NEG,      R_AVR_LO8_LDI_NEG },
+  { BFD_RELOC_AVR_HI8_LDI_NEG,      R_AVR_HI8_LDI_NEG },
+  { BFD_RELOC_AVR_HH8_LDI_NEG,      R_AVR_HH8_LDI_NEG },
+  { BFD_RELOC_AVR_LO8_LDI_PM,       R_AVR_LO8_LDI_PM },
+  { BFD_RELOC_AVR_HI8_LDI_PM,       R_AVR_HI8_LDI_PM },
+  { BFD_RELOC_AVR_HH8_LDI_PM,       R_AVR_HH8_LDI_PM },
+  { BFD_RELOC_AVR_LO8_LDI_PM_NEG,   R_AVR_LO8_LDI_PM_NEG },
+  { BFD_RELOC_AVR_HI8_LDI_PM_NEG,   R_AVR_HI8_LDI_PM_NEG },
+  { BFD_RELOC_AVR_HH8_LDI_PM_NEG,   R_AVR_HH8_LDI_PM_NEG },
+  { BFD_RELOC_AVR_CALL,             R_AVR_CALL }
+};
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_type_lookup (abfd, code)
+     bfd *abfd;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (avr_reloc_map) / sizeof (struct avr_reloc_map);
+       i++)
+    {
+      if (avr_reloc_map[i].bfd_reloc_val == code)
+	return &elf_avr_howto_table[avr_reloc_map[i].elf_reloc_val];
+    }
+
+  return NULL;
+}
+
+/* Set the howto pointer for an AVR ELF reloc.  */
+
+static void
+avr_info_to_howto_rela (abfd, cache_ptr, dst)
+     bfd *abfd;
+     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_AVR_max);
+  cache_ptr->howto = &elf_avr_howto_table[r_type];
+}
+
+static asection *
+elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     Elf_Internal_Rela *rel;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
+{
+  if (h != NULL)
+    {
+      switch (ELF32_R_TYPE (rel->r_info))
+	{
+	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;
+}
+
+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;
+{
+  /* We don't use got and plt entries for avr.  */
+  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
+elf32_avr_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];
+    }
+
+  return true;
+}
+
+/* Perform a single relocation.  By default we use the standard BFD
+   routines, but a few relocs, we have to do them ourselves.  */
+
+static bfd_reloc_status_type
+avr_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_reloc_ok;
+  bfd_vma               x;
+  bfd_signed_vma	srel;
+
+  switch (howto->type)
+    {
+    case R_AVR_7_PCREL:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation;
+      srel += rel->r_addend;
+      srel -= rel->r_offset;
+      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 << 7) - 1) || (srel < - (1 << 7)))
+	return bfd_reloc_overflow;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xfc07) | (((srel >> 1) << 3) & 0x3f8);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_13_PCREL:
+      contents   += rel->r_offset;
+      srel = (bfd_signed_vma) relocation;
+      srel += rel->r_addend;
+      srel -= rel->r_offset;
+      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;
+
+      /* AVR addresses commands as words.  */
+      srel >>= 1;
+
+      /* Check for overflow.  */
+      if (srel < -2048 || srel > 2047)
+	{
+	  /* Apply WRAPAROUND if possible.  */
+	  if (bfd_get_mach (input_bfd) == bfd_mach_avr2)
+	    {
+	      if (srel > 2047)
+		srel -= 4096;
+	      else
+		srel += 4096;
+	    }
+	  else
+	    return bfd_reloc_overflow;
+	}
+
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf000) | (srel & 0xfff);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_LO8_LDI:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HI8_LDI:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = (srel >> 8) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HH8_LDI:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = (srel >> 16) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_LO8_LDI_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HI8_LDI_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      srel = (srel >> 8) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HH8_LDI_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      srel = (srel >> 16) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_LO8_LDI_PM:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HI8_LDI_PM:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      srel = (srel >> 8) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HH8_LDI_PM:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      srel = (srel >> 16) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_LO8_LDI_PM_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HI8_LDI_PM_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      srel = (srel >> 8) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_HH8_LDI_PM_NEG:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      srel = -srel;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      srel = (srel >> 16) & 0xff;
+      x = bfd_get_16 (input_bfd, contents);
+      x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00);
+      bfd_put_16 (input_bfd, x, contents);
+      break;
+
+    case R_AVR_CALL:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation + rel->r_addend;
+      if (srel & 1)
+	return bfd_reloc_outofrange;
+      srel = srel >> 1;
+      x = bfd_get_16 (input_bfd, contents);
+      x |= ((srel & 0x10000) | ((srel << 3) & 0x1f00000)) >> 16;
+      bfd_put_16 (input_bfd, x, contents);
+      bfd_put_16 (input_bfd, srel & 0xffff, contents+2);
+      break;
+
+    default:
+      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				    contents, rel->r_offset,
+				    relocation, rel->r_addend);
+    }
+
+  return r;
+}
+
+/* Relocate an AVR ELF section.  */
+static boolean
+elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
+			    contents, relocs, local_syms, local_sections)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     Elf_Internal_Rela *relocs;
+     Elf_Internal_Sym *local_syms;
+     asection **local_sections;
+{
+  Elf_Internal_Shdr *           symtab_hdr;
+  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);
+      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  = elf_avr_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;
+	}
+      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;
+	    }
+	}
+
+      r = avr_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;
+}
+
+/* The final processing done just before writing out a AVR ELF object
+   file.  This gets the AVR architecture right based on the machine
+   number.  */
+
+static void
+bfd_elf_avr_final_write_processing (abfd, linker)
+     bfd *abfd;
+     boolean linker ATTRIBUTE_UNUSED;
+{
+  unsigned long val;
+
+  switch (bfd_get_mach (abfd))
+    {
+    default:
+    case bfd_mach_avr2:
+      val = E_AVR_MACH_AVR2;
+      break;
+
+    case bfd_mach_avr1:
+      val = E_AVR_MACH_AVR1;
+      break;
+
+    case bfd_mach_avr3:
+      val = E_AVR_MACH_AVR3;
+      break;
+
+    case bfd_mach_avr4:
+      val = E_AVR_MACH_AVR4;
+      break;
+
+    }
+
+  elf_elfheader (abfd)->e_machine = EM_AVR;
+  elf_elfheader (abfd)->e_flags &= ~ EF_AVR_MACH;
+  elf_elfheader (abfd)->e_flags |= val;
+}
+
+/* Set the right machine number.  */
+
+static boolean
+elf32_avr_object_p (abfd)
+     bfd *abfd;
+{
+  int e_set = bfd_mach_avr2;
+  if (elf_elfheader (abfd)->e_machine == EM_AVR)
+    {
+      int e_mach = elf_elfheader (abfd)->e_flags & EF_AVR_MACH;
+      switch (e_mach)
+	{
+	default:
+	case E_AVR_MACH_AVR2:
+	  e_set = bfd_mach_avr2;
+	  break;
+
+	case E_AVR_MACH_AVR1:
+	  e_set = bfd_mach_avr1;
+	  break;
+
+	case E_AVR_MACH_AVR3:
+	  e_set = bfd_mach_avr3;
+	  break;
+
+	case E_AVR_MACH_AVR4:
+	  e_set = bfd_mach_avr4;
+	  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
+
+#define TARGET_LITTLE_SYM       bfd_elf32_avr_vec
+#define TARGET_LITTLE_NAME	"elf32-avr"
+
+#define elf_info_to_howto	             avr_info_to_howto_rela
+#define elf_info_to_howto_rel	             NULL
+#define elf_backend_relocate_section         elf32_avr_relocate_section
+#define elf_backend_gc_mark_hook             elf32_avr_gc_mark_hook
+#define elf_backend_gc_sweep_hook            elf32_avr_gc_sweep_hook
+#define elf_backend_check_relocs             elf32_avr_check_relocs
+#define elf_backend_can_gc_sections          1
+#define elf_backend_final_write_processing \
+					bfd_elf_avr_final_write_processing
+#define elf_backend_object_p		elf32_avr_object_p
+
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index be80bae..dd2e892 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 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
    Contributed by Martin Hunt (hunt@cygnus.com).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -211,7 +211,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;
@@ -231,7 +231,7 @@
 
 static void
 d10v_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
@@ -245,7 +245,7 @@
 static asection *
 elf32_d10v_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;
@@ -267,6 +267,9 @@
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -285,10 +288,10 @@
 
 static boolean
 elf32_d10v_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 d10v */
   return true;
@@ -356,7 +359,7 @@
 static boolean
 elf32_d10v_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;
@@ -446,7 +449,7 @@
 	    {
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, h->root.root.string, input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset, true)))
 		return false;
 	      relocation = 0;
 	    }
@@ -482,7 +485,7 @@
 	    case bfd_reloc_undefined:
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, name, input_bfd, input_section,
-		     rel->r_offset)))
+		     rel->r_offset, true)))
 		return false;
 	      break;
 
diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c
index 0b0e9e9..263b5c0 100644
--- a/bfd/elf32-d30v.c
+++ b/bfd/elf32-d30v.c
@@ -1,5 +1,5 @@
 /* D30V-specific support for 32-bit ELF
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
    Contributed by Martin Hunt (hunt@cygnus.com).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -540,7 +540,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;
@@ -560,7 +560,7 @@
 
 static void
 d30v_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
@@ -575,7 +575,7 @@
 
 static void
 d30v_info_to_howto_rela (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index 7c8725f..6b295d3 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -1,5 +1,5 @@
 /* FR30-specific support for 32-bit ELF.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -250,7 +250,7 @@
      PTR        data;
      asection * input_section;
      bfd *      output_bfd;
-     char **    error_message;
+     char **    error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma       relocation;
   unsigned long x;
@@ -297,7 +297,7 @@
      PTR        data;
      asection * input_section;
      bfd *      output_bfd;
-     char **    error_message;
+     char **    error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma       relocation;
 
@@ -353,7 +353,7 @@
 
 static reloc_howto_type *
 fr30_reloc_type_lookup (abfd, code)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -370,7 +370,7 @@
 
 static void
 fr30_info_to_howto_rela (abfd, cache_ptr, dst)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      arelent * cache_ptr;
      Elf32_Internal_Rela * dst;
 {
@@ -499,7 +499,7 @@
 static boolean
 fr30_elf_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;
@@ -617,7 +617,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset, true)))
 		return false;
 #if 0
 	      fprintf (stderr, "unknown: name: %s\n", name);
@@ -643,7 +643,8 @@
 	      
 	    case bfd_reloc_undefined:
 	      r = info->callbacks->undefined_symbol
-		(info, name, input_bfd, input_section, rel->r_offset);
+		(info, name, input_bfd, input_section, rel->r_offset,
+		 true);
 	      break;
 	      
 	    case bfd_reloc_outofrange:
@@ -681,7 +682,7 @@
 static asection *
 fr30_elf_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;
@@ -703,6 +704,9 @@
 
 	    case bfd_link_hash_common:
 	      return h->root.u.c.p->section;
+
+	    default:
+	      break;
 	    }
 	}
     }
@@ -724,10 +728,10 @@
 
 static boolean
 fr30_elf_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;
 {
   return true;
 }
diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c
index a4d3cac..47da53b 100644
--- a/bfd/elf32-gen.c
+++ b/bfd/elf32-gen.c
@@ -1,5 +1,5 @@
 /* Generic support for 32-bit ELF
-   Copyright 1993, 1995, 1998 Free Software Foundation, Inc.
+   Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -42,18 +42,18 @@
 
 static void
 elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *bfd_reloc;
-     Elf32_Internal_Rela *elf_reloc;
+     Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
 {
   bfd_reloc->howto = &dummy;
 }
 
 static void
 elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *bfd_reloc;
-     Elf32_Internal_Rel *elf_reloc;
+     Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
 {
   bfd_reloc->howto = &dummy;
 }
@@ -64,6 +64,7 @@
 #define TARGET_BIG_NAME			"elf32-big"
 #define ELF_ARCH			bfd_arch_unknown
 #define ELF_MACHINE_CODE		EM_NONE
+#define ELF_MAXPAGESIZE			0x1
 #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
 #define elf_info_to_howto		elf_generic_info_to_howto
 #define elf_info_to_howto_rel		elf_generic_info_to_howto_rel
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 6bd7f67..683a308 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -1,5 +1,5 @@
 /* BFD back-end for HP PA-RISC ELF files.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    Written by
@@ -26,53 +26,14 @@
 
 #include "bfd.h"
 #include "sysdep.h"
-#include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
+#include "elf/hppa.h"
+#include "libhppa.h"
+#include "elf32-hppa.h"
+#define ARCH_SIZE		32
+#include "elf-hppa.h"
 
-/* The internal type of a symbol table extension entry.  */
-typedef unsigned long symext_entryS;
-
-/* The external type of a symbol table extension entry.  */
-#define ELF32_PARISC_SX_SIZE (4)
-#define ELF32_PARISC_SX_GET(bfd, addr) bfd_h_get_32 ((bfd), (addr))
-#define ELF32_PARISC_SX_PUT(bfd, val, addr) \
-  bfd_h_put_32 ((bfd), (val), (addr))
-
-/* HPPA symbol table extension entry types */
-enum elf32_hppa_symextn_types
-{
-  PARISC_SXT_NULL,
-  PARISC_SXT_SYMNDX,
-  PARISC_SXT_ARG_RELOC,
-};
-
-/* These macros compose and decompose the value of a symextn entry:
-
-   entry_type = ELF32_PARISC_SX_TYPE(word);
-   entry_value = ELF32_PARISC_SX_VAL(word);
-   word = ELF32_PARISC_SX_WORD(type,val);  */
-
-#define ELF32_PARISC_SX_TYPE(p)		((p) >> 24)
-#define ELF32_PARISC_SX_VAL(p)		((p) & 0xFFFFFF)
-#define ELF32_PARISC_SX_WORD(type,val)	(((type) << 24) + (val & 0xFFFFFF))
-
-/* The following was added facilitate implementation of the .hppa_symextn
-   section.  This section is built after the symbol table is built in the
-   elf_write_object_contents routine (called from bfd_close).  It is built
-   so late because it requires information that is not known until
-   the symbol and string table sections have been allocated, and
-   the symbol table has been built. */
-
-#define SYMEXTN_SECTION_NAME ".PARISC.symext"
-
-struct symext_chain
-  {
-    symext_entryS entry;
-    struct symext_chain *next;
-  };
-
-typedef struct symext_chain symext_chainS;
 
 /* We use three different hash tables to hold information for
    linking PA ELF objects.
@@ -83,11 +44,7 @@
 
    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.
-
-   The last hash table keeps track of argument location information needed
-   to build hash tables.  Each function with nonzero argument location
-   bits will have an entry in this table.  */
+   necessary to build the linker stubs during a link.  */
 
 /* Hash table for linker stubs.  */
 
@@ -123,23 +80,6 @@
 
 };
 
-/* Hash table for argument location information.  */
-
-struct elf32_hppa_args_hash_entry
-{
-  /* Base hash table entry structure.  */
-  struct bfd_hash_entry root;
-
-  /* The argument location bits for this entry.  */
-  int arg_bits;
-};
-
-struct elf32_hppa_args_hash_table
-{
-  /* The hash table itself.  */
-  struct bfd_hash_table root;
-};
-
 struct elf32_hppa_link_hash_entry
 {
   struct elf_link_hash_entry root;
@@ -153,9 +93,6 @@
   /* The stub hash table.  */
   struct elf32_hppa_stub_hash_table *stub_hash_table;
 
-  /* The argument relocation bits hash table.  */
-  struct elf32_hppa_args_hash_table *args_hash_table;
-
   /* A count of the number of output symbols.  */
   unsigned int output_symbol_count;
 
@@ -164,32 +101,6 @@
   int global_sym_defined;
 };
 
-/* FIXME.  */
-#define ARGUMENTS	0
-#define RETURN_VALUE	1
-
-/* The various argument relocations that may be performed.  */
-typedef enum
-{
-  /* No relocation.  */
-  NO,
-  /* Relocate 32 bits from GR to FP register.  */
-  GF,
-  /* Relocate 64 bits from a GR pair to FP pair.  */
-  GD,
-  /* Relocate 32 bits from FP to GR.  */
-  FG,
-  /* Relocate 64 bits from FP pair to GR pair.  */
-  DG,
-} arg_reloc_type;
-
-/* What is being relocated (eg which argument or the return value).  */
-typedef enum
-{
-  ARG0, ARG1, ARG2, ARG3, RET,
-} arg_reloc_location;
-
-
 /* ELF32/HPPA relocation support
 
 	This file contains ELF32/HPPA relocation support as specified
@@ -199,43 +110,10 @@
 #include "elf32-hppa.h"
 #include "hppa_stubs.h"
 
-static bfd_reloc_status_type hppa_elf_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
 static unsigned long hppa_elf_relocate_insn
   PARAMS ((bfd *, asection *, unsigned long, unsigned long, long,
 	   long, unsigned long, unsigned long, unsigned long));
 
-static bfd_reloc_status_type hppa_elf_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd*, char **));
-
-static reloc_howto_type * elf_hppa_reloc_type_lookup
-  PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-static boolean elf32_hppa_set_section_contents
-  PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-
-static void elf32_hppa_info_to_howto
-  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
-
-static boolean elf32_hppa_backend_symbol_table_processing
-  PARAMS ((bfd *, elf_symbol_type *, unsigned int));
-
-static void elf32_hppa_backend_begin_write_processing
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-static void elf32_hppa_backend_final_write_processing
-  PARAMS ((bfd *, boolean));
-
-static void add_entry_to_symext_chain
-  PARAMS ((bfd *, unsigned int, unsigned int, symext_chainS **,
-	   symext_chainS **));
-
-static void
-elf_hppa_tc_make_sections PARAMS ((bfd *, symext_chainS *));
-
-static boolean hppa_elf_is_local_label_name PARAMS ((bfd *, const char *));
-
 static boolean elf32_hppa_add_symbol_hook
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
 	   const char **, flagword *, asection **, bfd_vma *));
@@ -252,10 +130,6 @@
 elf32_hppa_stub_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 
-static struct bfd_hash_entry *
-elf32_hppa_args_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
 static boolean
 elf32_hppa_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
@@ -271,238 +145,11 @@
 static boolean
 elf32_hppa_build_one_stub PARAMS ((struct bfd_hash_entry *, PTR));
 
-static boolean
-elf32_hppa_read_symext_info
-  PARAMS ((bfd *, Elf_Internal_Shdr *, struct elf32_hppa_args_hash_table *,
-	   Elf_Internal_Sym *));
-
 static unsigned int elf32_hppa_size_of_stub
-  PARAMS ((unsigned int, unsigned int, bfd_vma, bfd_vma, const char *));
-
-static boolean elf32_hppa_arg_reloc_needed
-  PARAMS ((unsigned int, unsigned int, arg_reloc_type []));
+  PARAMS ((bfd_vma, bfd_vma, const char *));
 
 static void elf32_hppa_name_of_stub
-  PARAMS ((unsigned int, unsigned int, bfd_vma, bfd_vma, char *));
-
-static boolean elf32_hppa_size_symext PARAMS ((struct bfd_hash_entry *, PTR));
-
-static boolean elf32_hppa_link_output_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const char *,
-	   Elf_Internal_Sym *, asection *));
-
-/* ELF/PA relocation howto entries.  */
-
-static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
-{
-  {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_NONE"},
-  /* The values in DIR32 are to placate the check in
-     _bfd_stab_section_find_nearest_line.  */
-  {R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false},
-  {R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR21L"},
-  {R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR17R"},
-  {R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR17F"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DIR14R"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL21L"},
-  {R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL17R"},
-  {R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL17F"},
-  {R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL17C"},
-  {R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL14R"},
-  {R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PCREL14F"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DPREL21L"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DPREL14R"},
-  {R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DPREL14F"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTREL21L"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTREL14R"},
-  {R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTREL14F"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTIND21L"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTIND14R"},
-  {R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_DLTIND14F"},
-
-  {R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_SETBASE"},
-  {R_PARISC_BASEREL32, 0, 0, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL32"},
-  {R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL21L"},
-  {R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL17R"},
-  {R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL17F"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL14R"},
-  {R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_BASEREL14F"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_TEXTREL32, 0, 0, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_TEXTREL32"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_DATAREL32, 0, 0, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLABEL32"},
-  {R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLABEL21L"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLABEL14R"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_PLTIND21L, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLTIND21L"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_UNIMPLEMENTED"},
-  {R_PARISC_PLTIND14R, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLTIND14R"},
-  {R_PARISC_PLTIND14F, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_PLTIND14F"},
-
-
-  {R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_COPY"},
-  {R_PARISC_GLOB_DAT, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_GLOB_DAT"},
-  {R_PARISC_JMP_SLOT, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_JMP_SLOT"},
-  {R_PARISC_RELATIVE, 0, 0, 0, false, 0, complain_overflow_bitfield, hppa_elf_reloc, "R_PARISC_RELATIVE"},
-
-  {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
-};
-
-/* Where (what register type) is an argument comming from?  */
-typedef enum
-{
-  AR_NO,
-  AR_GR,
-  AR_FR,
-  AR_FU,
-  AR_FPDBL1,
-  AR_FPDBL2,
-} arg_location;
-
-/* Horizontal represents the callee's argument location information,
-   vertical represents caller's argument location information.  Value at a
-   particular X,Y location represents what (if any) argument relocation
-   needs to be performed to make caller and callee agree.  */
-
-static CONST arg_reloc_type arg_mismatches[6][6] =
-{
-  {NO, NO, NO, NO, NO, NO},
-  {NO, NO, GF, NO, GD, NO},
-  {NO, FG, NO, NO, NO, NO},
-  {NO, NO, NO, NO, NO, NO},
-  {NO, DG, NO, NO, NO, NO},
-  {NO, DG, NO, NO, NO, NO},
-};
-
-/* Likewise, but reversed for the return value.  */
-static CONST arg_reloc_type ret_mismatches[6][6] =
-{
-  {NO, NO, NO, NO, NO, NO},
-  {NO, NO, FG, NO, DG, NO},
-  {NO, GF, NO, NO, NO, NO},
-  {NO, NO, NO, NO, NO, NO},
-  {NO, GD, NO, NO, NO, NO},
-  {NO, GD, NO, NO, NO, NO},
-};
-
-/* Misc static crud for symbol extension records.  */
-static symext_chainS *symext_rootP;
-static symext_chainS *symext_lastP;
-static bfd_size_type symext_chain_size;
-
-/* FIXME: We should be able to try this static variable!  */
-static bfd_byte *symextn_contents;
-
+  PARAMS ((bfd_vma, bfd_vma, char *));
 
 /* For linker stub hash tables.  */
 #define elf32_hppa_stub_hash_lookup(table, string, create, copy) \
@@ -515,24 +162,6 @@
     (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \
     (info)))
 
-/* For linker args hash tables.  */
-#define elf32_hppa_args_hash_lookup(table, string, create, copy) \
-  ((struct elf32_hppa_args_hash_entry *) \
-   bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-#define elf32_hppa_args_hash_traverse(table, func, info) \
-  (bfd_hash_traverse \
-   (&(table)->root, \
-    (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \
-    (info)))
-
-#define elf32_hppa_args_hash_table_init(table, newfunc) \
-  (bfd_hash_table_init \
-   (&(table)->root, \
-    (struct bfd_hash_entry *(*) PARAMS ((struct bfd_hash_entry *, \
-					 struct bfd_hash_table *, \
-					 const char *))) (newfunc)))
-
 /* For HPPA linker hash table.  */
 
 #define elf32_hppa_link_hash_lookup(table, string, create, copy, follow)\
@@ -552,10 +181,6 @@
   ((struct elf32_hppa_link_hash_table *) ((p)->hash))
 
 
-/* Extract specific argument location bits for WHICH from
-   the full argument location in AR.  */
-#define EXTRACT_ARBITS(ar, which) ((ar) >> (8 - ((which) * 2))) & 3
-
 /* Assorted hash table functions.  */
 
 /* Initialize an entry in the stub hash table.  */
@@ -610,38 +235,6 @@
   return (bfd_hash_table_init (&table->root, newfunc));
 }
 
-/* Initialize an entry in the argument location hash table.  */
-
-static struct bfd_hash_entry *
-elf32_hppa_args_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
-{
-  struct elf32_hppa_args_hash_entry *ret;
-
-  ret = (struct elf32_hppa_args_hash_entry *) entry;
-
-  /* Allocate the structure if it has not already been allocated by a
-     subclass.  */
-  if (ret == NULL)
-    ret = ((struct elf32_hppa_args_hash_entry *)
-	   bfd_hash_allocate (table,
-			      sizeof (struct elf32_hppa_args_hash_entry)));
-  if (ret == NULL)
-    return NULL;
-
-  /* Call the allocation method of the superclass.  */
-  ret = ((struct elf32_hppa_args_hash_entry *)
-	 bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
-  /* Initialize the local fields.  */
-  if (ret)
-    ret->arg_bits = 0;
-
-  return (struct bfd_hash_entry *) ret;
-}
-
 /* Create the derived linker hash table.  The PA ELF port uses the derived
    hash table to keep information specific to the PA ELF linker (without
    using static variables).  */
@@ -663,7 +256,6 @@
       return NULL;
     }
   ret->stub_hash_table = NULL;
-  ret->args_hash_table = NULL;
   ret->output_symbol_count = 0;
   ret->global_value = 0;
   ret->global_sym_defined = 0;
@@ -851,7 +443,7 @@
 	    {
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, h->root.root.string, input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset, true)))
 		return false;
 	      break;
 	    }
@@ -870,13 +462,6 @@
 	    sym_name = bfd_section_name (input_bfd, sym_sec);
 	}
 
-      /* If args_hash_table is NULL, then we have encountered some
-	 kind of link error (ex. undefined symbols).  Do not try to
-	 apply any relocations, continue the loop so we can notify
-	 the user of several errors in a single attempted link.  */
-      if (elf32_hppa_hash_table (info)->args_hash_table == NULL)
-	continue;
-
       r = elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd,
 					      input_section, contents,
 					      rel->r_offset, relocation,
@@ -894,7 +479,7 @@
 	    case bfd_reloc_notsupported:
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, "$global$", input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset, true)))
 		return false;
 	      return false;
 	    case bfd_reloc_dangerous:
@@ -937,286 +522,6 @@
   return true;
 }
 
-/* Return one (or more) BFD relocations which implement the base
-   relocation with modifications based on format and field.  */
-
-elf32_hppa_reloc_type **
-hppa_elf_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
-     bfd *abfd;
-     elf32_hppa_reloc_type base_type;
-     int format;
-     int field;
-     int ignore;
-     asymbol *sym;
-{
-  elf32_hppa_reloc_type *finaltype;
-  elf32_hppa_reloc_type **final_types;
-
-  /* Allocate slots for the BFD relocation.  */
-  final_types = ((elf32_hppa_reloc_type **)
-		 bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type *) * 2));
-  if (final_types == NULL)
-    return NULL;
-
-  /* Allocate space for the relocation itself.  */
-  finaltype = ((elf32_hppa_reloc_type *)
-	       bfd_alloc (abfd, sizeof (elf32_hppa_reloc_type)));
-  if (finaltype == NULL)
-    return NULL;
-
-  /* Some reasonable defaults.  */
-  final_types[0] = finaltype;
-  final_types[1] = NULL;
-
-#define final_type finaltype[0]
-
-  final_type = base_type;
-
-  /* Just a tangle of nested switch statements to deal with the braindamage
-     that a different field selector means a completely different relocation
-     for PA ELF.  */
-  switch (base_type)
-    {
-    case R_HPPA:
-    case R_HPPA_ABS_CALL:
-      switch (format)
-	{
-	case 14:
-	  switch (field)
-	    {
-	    case e_rsel:
-	    case e_rrsel:
-	      final_type = R_PARISC_DIR14R;
-	      break;
-	    case e_rtsel:
-	      final_type = R_PARISC_DLTREL14R;
-	      break;
-	    case e_tsel:
-	      final_type = R_PARISC_DLTREL14F;
-	      break;
-	    case e_rpsel:
-	      final_type = R_PARISC_PLABEL14R;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	case 17:
-	  switch (field)
-	    {
-	    case e_fsel:
-	      final_type = R_PARISC_DIR17F;
-	      break;
-	    case e_rsel:
-	    case e_rrsel:
-	      final_type = R_PARISC_DIR17R;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	case 21:
-	  switch (field)
-	    {
-	    case e_lsel:
-	    case e_lrsel:
-	      final_type = R_PARISC_DIR21L;
-	      break;
-	    case e_ltsel:
-	      final_type = R_PARISC_DLTREL21L;
-	      break;
-	    case e_lpsel:
-	      final_type = R_PARISC_PLABEL21L;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	case 32:
-	  switch (field)
-	    {
-	    case e_fsel:
-	      final_type = R_PARISC_DIR32;
-	      break;
-	    case e_psel:
-	      final_type = R_PARISC_PLABEL32;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	default:
-	  return NULL;
-	}
-      break;
-
-
-    case R_HPPA_GOTOFF:
-      switch (format)
-	{
-	case 14:
-	  switch (field)
-	    {
-	    case e_rsel:
-	    case e_rrsel:
-	      final_type = R_PARISC_DPREL14R;
-	      break;
-	    case e_fsel:
-	      final_type = R_PARISC_DPREL14F;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	case 21:
-	  switch (field)
-	    {
-	    case e_lrsel:
-	    case e_lsel:
-	      final_type = R_PARISC_DPREL21L;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	default:
-	  return NULL;
-	}
-      break;
-
-
-    case R_HPPA_PCREL_CALL:
-      switch (format)
-	{
-	case 14:
-	  switch (field)
-	    {
-	    case e_rsel:
-	    case e_rrsel:
-	      final_type = R_PARISC_PCREL14R;
-	      break;
-	    case e_fsel:
-	      final_type = R_PARISC_PCREL14F;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
-	case 17:
-	  switch (field)
-	    {
-	    case e_rsel:
-	    case e_rrsel:
-	      final_type = R_PARISC_PCREL17R;
-	      break;
-	    case e_fsel:
-	      final_type = R_PARISC_PCREL17F;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  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;
-
-    default:
-      return NULL;
-    }
-
-  return final_types;
-}
-
-#undef final_type
-
-/* Set the contents of a particular section at a particular location.  */
-
-static boolean
-elf32_hppa_set_section_contents (abfd, section, location, offset, count)
-     bfd *abfd;
-     sec_ptr section;
-     PTR location;
-     file_ptr offset;
-     bfd_size_type count;
-{
-  /* Ignore write requests for the symbol extension section until we've
-     had the chance to rebuild it ourselves.  */
-  if (!strcmp (section->name, ".PARISC.symextn") && !symext_chain_size)
-    return true;
-  else
-    return _bfd_elf_set_section_contents (abfd, section, location,
-					  offset, count);
-}
-
-/* Translate from an elf into field into a howto relocation pointer.  */
-
-static void
-elf32_hppa_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
-     arelent *cache_ptr;
-     Elf32_Internal_Rela *dst;
-{
-  BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_PARISC_UNIMPLEMENTED);
-  cache_ptr->howto = &elf_hppa_howto_table[ELF32_R_TYPE (dst->r_info)];
-}
-
-
-/* Actually perform a relocation.  NOTE this is (mostly) superceeded
-   by elf32_hppa_bfd_final_link_relocate which is called by the new
-   fast linker.  */
-
-static bfd_reloc_status_type
-hppa_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
-		error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
-{
-  /* It is no longer valid to call hppa_elf_reloc when creating
-     a final executable.  */
-  if (output_bfd)
-    {
-      reloc_entry->address += input_section->output_offset;
-
-      /* Work around lossage in generic elf code to write relocations.
-	 (maps different section symbols into the same symbol index).  */
-      if ((symbol_in->flags & BSF_SECTION_SYM)
-	  && symbol_in->section)
-	reloc_entry->addend += symbol_in->section->output_offset;
-      return bfd_reloc_ok;
-    }
-  else
-    {
-      *error_message = (char *) _("Unsupported call to hppa_elf_reloc");
-      return bfd_reloc_notsupported;
-    }
-}
-
 /* Actually perform a relocation as part of a final link.  This can get
    rather hairy when linker stubs are needed.  */
 
@@ -1226,7 +531,7 @@
 				    addend, info, sym_sec, sym_name, is_local)
      reloc_howto_type *howto;
      bfd *input_bfd;
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd_byte *contents;
      bfd_vma offset;
@@ -1329,10 +634,7 @@
     case R_PARISC_PCREL17F:
       {
 	bfd_vma location;
-	unsigned int len, caller_args, callee_args;
-	arg_reloc_type arg_reloc_types[5];
-	struct elf32_hppa_args_hash_table *args_hash_table;
-	struct elf32_hppa_args_hash_entry *args_hash;
+	unsigned int len;
 	char *new_name, *stub_name;
 
 	/* Get the field selector right.  We'll need it in a minute.  */
@@ -1349,8 +651,6 @@
 		    input_section->output_offset +
 		    input_section->output_section->vma);
 
-	/* Now look for the argument relocation bits associated with the
-	   target.  */
 	len = strlen (sym_name) + 1;
 	if (is_local)
 	  len += 9;
@@ -1363,32 +663,9 @@
 	if (is_local)
 	  sprintf (new_name + len - 10, "_%08x", (int)sym_sec);
 
-	args_hash_table = elf32_hppa_hash_table (info)->args_hash_table;
-
-	args_hash = elf32_hppa_args_hash_lookup (args_hash_table,
-						 new_name, false, false);
-	if (args_hash == NULL)
-	  callee_args = 0;
-	else
-	  callee_args = args_hash->arg_bits;
-
-	/* If this is a CALL relocation, then get the caller's bits
-	   from the addend.  Else use the magic 0x155 value for PLABELS.
-
-	   Also we don't care about the destination (value) for PLABELS.  */
-	if (r_type == R_PARISC_PCREL17F)
-	  caller_args = HPPA_R_ARG_RELOC (addend);
-	else
-	  {
-	    caller_args = 0x155;
-	    location = value;
-	  }
-
 	/* Any kind of linker stub needed?  */
 	if (((int)(value - location) > 0x3ffff)
-	    || ((int)(value - location) < (int)0xfffc0000)
-	    || elf32_hppa_arg_reloc_needed (caller_args, callee_args,
-					    arg_reloc_types))
+	    || ((int)(value - location) < (int)0xfffc0000))
 	  {
 	    struct elf32_hppa_stub_hash_table *stub_hash_table;
 	    struct elf32_hppa_stub_hash_entry *stub_hash;
@@ -1401,8 +678,7 @@
 	    stub_name = bfd_malloc (len);
 	    if (!stub_name)
 	      return bfd_reloc_notsupported;
-	    elf32_hppa_name_of_stub (caller_args, callee_args,
-				     location, value, stub_name);
+	    elf32_hppa_name_of_stub (location, value, stub_name);
 	    strcat (stub_name, new_name);
 	    free (new_name);
 
@@ -1420,7 +696,6 @@
 
 	    if (stub_hash != NULL)
 	      {
-
 		if (r_type == R_PARISC_PCREL17F)
 		  {
 		    unsigned long delay_insn;
@@ -1492,28 +767,9 @@
 			return bfd_reloc_dangerous;
 		      }
 		  }
-		else
-		  {
-		    /* PLABEL stuff is easy.  */
-
-		    value = (stub_hash->offset
-			     + stub_section->output_offset
-			     + stub_section->output_section->vma);
-		    /* We don't need the RP adjustment for PLABELs.  */
-		    value += 4;
-		    if (r_type == R_PARISC_PLABEL32)
-		      r_format = 32;
-		    else if (r_type == R_PARISC_PLABEL21L)
-		      r_format = 21;
-		    else if (r_type == R_PARISC_PLABEL14R)
-		      r_format = 14;
-
-		    r_pcrel = 0;
-		    addend = 0;
-		  }
-		}
-	      else
-		return bfd_reloc_notsupported;
+	        else
+		  return bfd_reloc_notsupported;
+	      }
 	  }
 	goto do_basic_type_1;
       }
@@ -1534,526 +790,16 @@
   return (bfd_reloc_ok);
 }
 
-/* Return the address of the howto table entry to perform the CODE
-   relocation for an ARCH machine.  */
-
-static reloc_howto_type *
-elf_hppa_reloc_type_lookup (abfd, code)
-     bfd *abfd;
-     bfd_reloc_code_real_type code;
-{
-  if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
-    {
-      BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
-      return &elf_hppa_howto_table[(int) code];
-    }
-  return NULL;
-}
-
-/* Return true if SYM represents a local label symbol.  */
-
-static boolean
-hppa_elf_is_local_label_name (abfd, name)
-     bfd *abfd;
-     const char *name;
-{
-  return (name[0] == 'L' && name[1] == '$');
-}
-
-/* Do any backend specific processing when beginning to write an object
-   file.  For PA ELF we need to determine the size of the symbol extension
-   section *before* any other output processing happens.  */
-
-static void
-elf32_hppa_backend_begin_write_processing (abfd, info)
-     bfd *abfd;
-     struct bfd_link_info *info;
-{
-  unsigned int i;
-  asection *symextn_sec;
-
-  /* Size up the symbol extension section.  */
-  if ((abfd->outsymbols == NULL
-       && info == NULL)
-      || symext_chain_size != 0)
-    return;
-
-  if (info == NULL)
-    {
-      /* We were not called from the BFD ELF linker code, so we need
-	 to examine the output BFD's outsymbols.
-
-	 Note we can not build the symbol extensions now as the symbol
-	 map hasn't been set up.  */
-      for (i = 0; i < abfd->symcount; i++)
-	{
-	  elf_symbol_type *symbol = (elf_symbol_type *)abfd->outsymbols[i];
-
-	  /* Only functions ever need an entry in the symbol extension
-	     section.  */
-	  if (!(symbol->symbol.flags & BSF_FUNCTION))
-	    continue;
-
-	  /* And only if they specify the locations of their arguments.  */
-	  if (symbol->tc_data.hppa_arg_reloc == 0)
-	    continue;
-
-	  /* Yup.  This function symbol needs an entry.  */
-	  symext_chain_size += 2 * ELF32_PARISC_SX_SIZE;
-	}
-    }
-  else if (info->relocateable == true)
-    {
-      struct elf32_hppa_args_hash_table *table;
-      table = elf32_hppa_hash_table (info)->args_hash_table;
-
-      /* Determine the size of the symbol extension section.  */
-      elf32_hppa_args_hash_traverse (table,
-				     elf32_hppa_size_symext,
-				     &symext_chain_size);
-    }
-
-  /* Now create the section and set its size.  We'll fill in the
-     contents later.  */
-  symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME);
-  if (symextn_sec == NULL)
-    symextn_sec = bfd_make_section (abfd, SYMEXTN_SECTION_NAME);
-
-  bfd_set_section_flags (abfd, symextn_sec,
-			 SEC_LOAD | SEC_HAS_CONTENTS | SEC_DATA);
-  symextn_sec->output_section = symextn_sec;
-  symextn_sec->output_offset = 0;
-  bfd_set_section_alignment (abfd, symextn_sec, 2);
-  bfd_set_section_size (abfd, symextn_sec, symext_chain_size);
-}
-
-/* Called for each entry in the args location hash table.  For each
-   entry we bump the size pointer by 2 records (16 bytes).  */
-
-static boolean
-elf32_hppa_size_symext (gen_entry, in_args)
-     struct bfd_hash_entry *gen_entry;
-     PTR in_args;
-{
-  bfd_size_type *sizep = (bfd_size_type *)in_args;
-
-  *sizep += 2 * ELF32_PARISC_SX_SIZE;
-  return true;
-}
-
-/* Backend routine called by the linker for each output symbol.
-
-   For PA ELF we use this opportunity to add an appropriate entry
-   to the symbol extension chain for function symbols.  */
-
-static boolean
-elf32_hppa_link_output_symbol_hook (abfd, info, name, sym, section)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     const char *name;
-     Elf_Internal_Sym *sym;
-     asection *section;
-{
-  char *new_name;
-  unsigned int len, index;
-  struct elf32_hppa_args_hash_table *args_hash_table;
-  struct elf32_hppa_args_hash_entry *args_hash;
-
-  /* If the args hash table is NULL, then we've encountered an error
-     of some sorts (for example, an undefined symbol).  In that case
-     we've got nothing else to do.
-
-     NOTE: elf_link_output_symbol will abort if we return false here!  */
-  if (elf32_hppa_hash_table (info)->args_hash_table == NULL)
-    return true;
-
-  index = elf32_hppa_hash_table (info)->output_symbol_count++;
-
-  /* We need to look up this symbol in the args hash table to see if
-     it has argument relocation bits.  */
-  if (ELF_ST_TYPE (sym->st_info) != STT_FUNC)
-    return true;
-
-  /* We know it's a function symbol of some kind.  */
-  len = strlen (name) + 1;
-  if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
-    len += 9;
-
-  new_name = bfd_malloc (len);
-  if (new_name == NULL)
-    return false;
-
-  strcpy (new_name, name);
-  if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
-    sprintf (new_name + len - 10, "_%08x", (int)section);
-
-  /* Now that we have the unique name, we can look it up in the
-     args hash table.  */
-  args_hash_table = elf32_hppa_hash_table (info)->args_hash_table;
-  args_hash = elf32_hppa_args_hash_lookup (args_hash_table, new_name,
-					   false, false);
-  free (new_name);
-  if (args_hash == NULL)
-    return true;
-
-  /* We know this symbol has arg reloc bits.  */
-  add_entry_to_symext_chain (abfd, args_hash->arg_bits,
-			     index, &symext_rootP, &symext_lastP);
-  return true;
-}
-
-/* Perform any processing needed late in the object file writing process.
-   For PA ELF we build and set the contents of the symbol extension
-   section.  */
-
-static void
-elf32_hppa_backend_final_write_processing (abfd, linker)
-     bfd *abfd;
-     boolean linker;
-{
-  asection *symextn_sec;
-  unsigned int i;
-
-  /* Now build the symbol extension section.  */
-  if (symext_chain_size == 0)
-    return;
-
-  if (! linker)
-    {
-      /* We were not called from the backend linker, so we still need
-	 to build the symbol extension chain.
-
-         Look at each symbol, adding the appropriate information to the
-	 symbol extension section list as necessary.  */
-      for (i = 0; i < abfd->symcount; i++)
-	{
-	  elf_symbol_type *symbol = (elf_symbol_type *) abfd->outsymbols[i];
-
-	  /* Only functions ever need an entry in the symbol extension
-	     section.  */
-	  if (!(symbol->symbol.flags & BSF_FUNCTION))
-	    continue;
-
-	  /* And only if they specify the locations of their arguments.  */
-	  if (symbol->tc_data.hppa_arg_reloc == 0)
-	    continue;
-
-	  /* Add this symbol's information to the chain.  */
-	  add_entry_to_symext_chain (abfd, symbol->tc_data.hppa_arg_reloc,
-				     symbol->symbol.udata.i, &symext_rootP,
-				     &symext_lastP);
-	}
-    }
-
-  /* Now fill in the contents of the symbol extension section.  */
-  elf_hppa_tc_make_sections (abfd, symext_rootP);
-
-  /* And attach that as the section's contents.  */
-  symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME);
-  if (symextn_sec == (asection *) 0)
-    abort();
-
-  symextn_sec->contents = (void *)symextn_contents;
-
-  bfd_set_section_contents (abfd, symextn_sec, symextn_sec->contents,
-			    symextn_sec->output_offset, symextn_sec->_raw_size);
-}
-
-/* Update the symbol extention chain to include the symbol pointed to
-   by SYMBOLP if SYMBOLP is a function symbol.  Used internally and by GAS.  */
-
-static void
-add_entry_to_symext_chain (abfd, arg_reloc, sym_idx, symext_root, symext_last)
-     bfd *abfd;
-     unsigned int arg_reloc;
-     unsigned int sym_idx;
-     symext_chainS **symext_root;
-     symext_chainS **symext_last;
-{
-  symext_chainS *symextP;
-
-  /* Allocate memory and initialize this entry.  */
-  symextP = (symext_chainS *) bfd_alloc (abfd, sizeof (symext_chainS) * 2);
-  if (!symextP)
-    abort();			/* FIXME */
-
-  symextP[0].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_SYMNDX, sym_idx);
-  symextP[0].next = &symextP[1];
-
-  symextP[1].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_ARG_RELOC, arg_reloc);
-  symextP[1].next = NULL;
-
-  /* Now update the chain itself so it can be walked later to build
-     the symbol extension section.  */
-  if (*symext_root == NULL)
-    {
-      *symext_root = &symextP[0];
-      *symext_last = &symextP[1];
-    }
-  else
-    {
-      (*symext_last)->next = &symextP[0];
-      *symext_last = &symextP[1];
-    }
-}
-
-/* Build the symbol extension section.  */
-
-static void
-elf_hppa_tc_make_sections (abfd, symext_root)
-     bfd *abfd;
-     symext_chainS *symext_root;
-{
-  symext_chainS *symextP;
-  unsigned int i;
-  asection *symextn_sec;
-
-  symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME);
-
-  /* Grab some memory for the contents of the symbol extension section
-     itself.  */
-  symextn_contents = (bfd_byte *) bfd_zalloc (abfd,
-					      symextn_sec->_raw_size);
-  if (!symextn_contents)
-    abort();			/* FIXME */
-
-  /* Fill in the contents of the symbol extension chain.  */
-  for (i = 0, symextP = symext_root; symextP; symextP = symextP->next, ++i)
-    ELF32_PARISC_SX_PUT (abfd, (bfd_vma) symextP->entry,
-			 symextn_contents + i * ELF32_PARISC_SX_SIZE);
-
-  return;
-}
-
-/* Do some PA ELF specific work after reading in the symbol table.
-   In particular attach the argument relocation from the
-   symbol extension section to the appropriate symbols.  */
-
-static boolean
-elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt)
-     bfd *abfd;
-     elf_symbol_type *esyms;
-     unsigned int symcnt;
-{
-  Elf32_Internal_Shdr *symextn_hdr =
-    bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME);
-  unsigned int i, current_sym_idx = 0;
-
-  /* If no symbol extension existed, then all symbol extension information
-     is assumed to be zero.  */
-  if (symextn_hdr == NULL)
-    {
-      for (i = 0; i < symcnt; i++)
-	esyms[i].tc_data.hppa_arg_reloc = 0;
-      return (true);
-    }
-
-  /* FIXME:  Why not use bfd_get_section_contents here?  Also should give
-     memory back when we're done.  */
-  /* Allocate a buffer of the appropriate size for the symextn section.  */
-  symextn_hdr->contents = bfd_zalloc(abfd,symextn_hdr->sh_size);
-  if (!symextn_hdr->contents)
-    return false;
-
-  /* Read in the symextn section.  */
-  if (bfd_seek (abfd, symextn_hdr->sh_offset, SEEK_SET) == -1)
-    return false;
-  if (bfd_read ((PTR) symextn_hdr->contents, 1, symextn_hdr->sh_size, abfd)
-      != symextn_hdr->sh_size)
-    return false;
-
-  /* Parse entries in the symbol extension section, updating the symtab
-     entries as we go */
-  for (i = 0; i < symextn_hdr->sh_size / ELF32_PARISC_SX_SIZE; i++)
-    {
-      symext_entryS se =
-	ELF32_PARISC_SX_GET (abfd,
-			     ((unsigned char *)symextn_hdr->contents
-			      + i * ELF32_PARISC_SX_SIZE));
-      unsigned int se_value = ELF32_PARISC_SX_VAL (se);
-      unsigned int se_type = ELF32_PARISC_SX_TYPE (se);
-
-      switch (se_type)
-	{
-	case PARISC_SXT_NULL:
-	  break;
-
-	case PARISC_SXT_SYMNDX:
-	  if (se_value >= symcnt)
-	    {
-	      bfd_set_error (bfd_error_bad_value);
-	      return (false);
-	    }
-	  current_sym_idx = se_value - 1;
-	  break;
-
-	case PARISC_SXT_ARG_RELOC:
-	  esyms[current_sym_idx].tc_data.hppa_arg_reloc = se_value;
-	  break;
-
-	default:
-	  bfd_set_error (bfd_error_bad_value);
-	  return (false);
-	}
-    }
-  return (true);
-}
-
-/* Read and attach the symbol extension information for the symbols
-   in INPUT_BFD to the argument location hash table.  Handle locals
-   if DO_LOCALS is true; likewise for globals when DO_GLOBALS is true.  */
-
-static boolean
-elf32_hppa_read_symext_info (input_bfd, symtab_hdr, args_hash_table, local_syms)
-     bfd *input_bfd;
-     Elf_Internal_Shdr *symtab_hdr;
-     struct elf32_hppa_args_hash_table *args_hash_table;
-     Elf_Internal_Sym *local_syms;
-{
-  asection *symextn_sec;
-  bfd_byte *contents;
-  unsigned int i, n_entries, current_index = 0;
-
-  /* Get the symbol extension section for this BFD.  If no section exists
-     then there's nothing to do.  Likewise if the section exists, but
-     has no contents.  */
-  symextn_sec = bfd_get_section_by_name (input_bfd, SYMEXTN_SECTION_NAME);
-  if (symextn_sec == NULL)
-    return true;
-
-  /* Done separately so we can turn off SEC_HAS_CONTENTS (see below).  */
-  if (symextn_sec->_raw_size == 0)
-    {
-      symextn_sec->flags &= ~SEC_HAS_CONTENTS;
-      return true;
-    }
-
-  contents = (bfd_byte *) bfd_malloc ((size_t) symextn_sec->_raw_size);
-  if (contents == NULL)
-    return false;
-
-  /* How gross.  We turn off SEC_HAS_CONTENTS for the input symbol extension
-     sections to keep the generic ELF/BFD code from trying to do anything
-     with them.  We have to undo that hack temporarily so that we can read
-     in the contents with the generic code.  */
-  symextn_sec->flags |= SEC_HAS_CONTENTS;
-  if (bfd_get_section_contents (input_bfd, symextn_sec, contents,
-				0, symextn_sec->_raw_size) == false)
-    {
-      symextn_sec->flags &= ~SEC_HAS_CONTENTS;
-      free (contents);
-      return false;
-    }
-
-  /* Gross.  Turn off SEC_HAS_CONTENTS for the input symbol extension
-     sections (see above).  */
-  symextn_sec->flags &= ~SEC_HAS_CONTENTS;
-
-  n_entries = symextn_sec->_raw_size / ELF32_PARISC_SX_SIZE;
-  for (i = 0; i < n_entries; i++)
-    {
-      symext_entryS entry =
-	ELF32_PARISC_SX_GET (input_bfd, contents + i * ELF32_PARISC_SX_SIZE);
-      unsigned int value = ELF32_PARISC_SX_VAL (entry);
-      unsigned int type = ELF32_PARISC_SX_TYPE (entry);
-      struct elf32_hppa_args_hash_entry *args_hash;
-
-      switch (type)
-	{
-	case PARISC_SXT_NULL:
-	  break;
-
-	case PARISC_SXT_SYMNDX:
-	  if (value >= symtab_hdr->sh_size / sizeof (Elf32_External_Sym))
-	    {
-	      bfd_set_error (bfd_error_bad_value);
-	      free (contents);
-	      return false;
-	    }
-	  current_index = value;
-	  break;
-
-	case PARISC_SXT_ARG_RELOC:
-	  if (current_index < symtab_hdr->sh_info)
-	    {
-	      Elf_Internal_Shdr *hdr;
-	      char *new_name;
-	      const char *sym_name;
-	      asection *sym_sec;
-	      unsigned int len;
-
-	      hdr = elf_elfsections (input_bfd)[local_syms[current_index].st_shndx];
-	      sym_sec = hdr->bfd_section;
-	      sym_name = bfd_elf_string_from_elf_section (input_bfd,
-						      symtab_hdr->sh_link,
-	 			        local_syms[current_index].st_name);
-	      len = strlen (sym_name) + 10;
-	      new_name = bfd_malloc (len);
-	      if (new_name == NULL)
-		{
-		  free (contents);
-		  return false;
-		}
-	      strcpy (new_name, sym_name);
-	      sprintf (new_name + len - 10, "_%08x", (int)sym_sec);
-
-	      /* This is a global symbol with argument location info.
-		 We need to enter it into the hash table.  */
-	      args_hash = elf32_hppa_args_hash_lookup (args_hash_table,
-						       new_name, true,
-						       true);
-	      free (new_name);
-	      if (args_hash == NULL)
-		{
-		  free (contents);
-		  return false;
-		}
-	      args_hash->arg_bits = value;
-	      break;
-	    }
-	  else if (current_index >= symtab_hdr->sh_info)
-	    {
-	      struct elf_link_hash_entry *h;
-
-	      current_index -= symtab_hdr->sh_info;
-	      h = elf_sym_hashes(input_bfd)[current_index];
-	      /* This is a global symbol with argument location
-		 information.  We need to enter it into the hash table.  */
-	      args_hash = elf32_hppa_args_hash_lookup (args_hash_table,
-						       h->root.root.string,
-						       true, true);
-	      if (args_hash == NULL)
-		{
-		  bfd_set_error (bfd_error_bad_value);
-		  free (contents);
-		  return false;
-		}
-	      args_hash->arg_bits = value;
-	      break;
-	    }
-	  else
-	    break;
-
-	default:
-	  bfd_set_error (bfd_error_bad_value);
-	  free (contents);
-	  return false;
-	}
-    }
-  free (contents);
-  return true;
-}
-
 /* Undo the generic ELF code's subtraction of section->vma from the
    value of each external symbol.  */
 
 static boolean
 elf32_hppa_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;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     const Elf_Internal_Sym *sym ATTRIBUTE_UNUSED;
+     const char **namep ATTRIBUTE_UNUSED;
+     flagword *flagsp ATTRIBUTE_UNUSED;
      asection **secp;
      bfd_vma *valp;
 {
@@ -2066,117 +812,12 @@
    for a call from LOCATION to DESTINATION.  Copy the name into STUB_NAME.  */
 
 static void
-elf32_hppa_name_of_stub (caller, callee, location, destination, stub_name)
-     unsigned int caller, callee;
-     bfd_vma location, destination;
+elf32_hppa_name_of_stub (location, destination, stub_name)
+     bfd_vma location ATTRIBUTE_UNUSED;
+     bfd_vma destination ATTRIBUTE_UNUSED;
      char *stub_name;
 {
-  arg_reloc_type arg_reloc_types[5];
-
-  if (elf32_hppa_arg_reloc_needed (caller, callee, arg_reloc_types))
-    {
-      arg_reloc_location i;
-      /* Fill in the basic template.  */
-      strcpy (stub_name, "__XX_XX_XX_XX_XX_stub_");
-
-      /* Now fix the specifics.  */
-      for (i = ARG0; i <= RET; i++)
-	switch (arg_reloc_types[i])
-	  {
-	    case NO:
-	      stub_name[3 * i + 2] = 'N';
-	      stub_name[3 * i + 3] = 'O';
-	      break;
-	    case GF:
-	      stub_name[3 * i + 2] = 'G';
-	      stub_name[3 * i + 3] = 'F';
-	      break;
-	    case FG:
-	      stub_name[3 * i + 2] = 'F';
-	      stub_name[3 * i + 3] = 'G';
-	      break;
-	    case GD:
-	      stub_name[3 * i + 2] = 'G';
-	      stub_name[3 * i + 3] = 'D';
-	      break;
-	    case DG:
-	      stub_name[3 * i + 2] = 'D';
-	      stub_name[3 * i + 3] = 'G';
-	      break;
-	  }
-    }
-  else
-    strcpy (stub_name, "_____long_branch_stub_");
-}
-
-/* Determine if an argument relocation stub is needed to perform a
-   call assuming the argument relocation bits for caller and callee
-   are in CALLER and CALLEE.  Place the type of relocations (if any)
-   into stub_types_p.  */
-
-static boolean
-elf32_hppa_arg_reloc_needed (caller, callee, stub_types)
-     unsigned int caller, callee;
-     arg_reloc_type stub_types[5];
-{
-  /* Special case for no relocations.  */
-  if (caller == 0 || callee == 0)
-    return 0;
-  else
-    {
-      arg_location caller_loc[5];
-      arg_location callee_loc[5];
-
-      /* Extract the location information for the argument and return
-	 value on both the caller and callee sides.  */
-      caller_loc[ARG0] = EXTRACT_ARBITS (caller, ARG0);
-      callee_loc[ARG0] = EXTRACT_ARBITS (callee, ARG0);
-      caller_loc[ARG1] = EXTRACT_ARBITS (caller, ARG1);
-      callee_loc[ARG1] = EXTRACT_ARBITS (callee, ARG1);
-      caller_loc[ARG2] = EXTRACT_ARBITS (caller, ARG2);
-      callee_loc[ARG2] = EXTRACT_ARBITS (callee, ARG2);
-      caller_loc[ARG3] = EXTRACT_ARBITS (caller, ARG3);
-      callee_loc[ARG3] = EXTRACT_ARBITS (callee, ARG3);
-      caller_loc[RET] = EXTRACT_ARBITS (caller, RET);
-      callee_loc[RET] = EXTRACT_ARBITS (callee, RET);
-
-      /* Check some special combinations.  This is necessary to
-	 deal with double precision FP arguments.  */
-      if (caller_loc[ARG0] == AR_FU || caller_loc[ARG1] == AR_FU)
-	{
-	  caller_loc[ARG0] = AR_FPDBL1;
-	  caller_loc[ARG1] = AR_NO;
-	}
-      if (caller_loc[ARG2] == AR_FU || caller_loc[ARG3] == AR_FU)
-	{
-	  caller_loc[ARG2] = AR_FPDBL2;
-	  caller_loc[ARG3] = AR_NO;
-	}
-      if (callee_loc[ARG0] == AR_FU || callee_loc[ARG1] == AR_FU)
-	{
-	  callee_loc[ARG0] = AR_FPDBL1;
-	  callee_loc[ARG1] = AR_NO;
-	}
-      if (callee_loc[ARG2] == AR_FU || callee_loc[ARG3] == AR_FU)
-	{
-	  callee_loc[ARG2] = AR_FPDBL2;
-	  callee_loc[ARG3] = AR_NO;
-	}
-
-      /* Now look up any relocation needed for each argument and the
-	 return value.  */
-      stub_types[ARG0] = arg_mismatches[caller_loc[ARG0]][callee_loc[ARG0]];
-      stub_types[ARG1] = arg_mismatches[caller_loc[ARG1]][callee_loc[ARG1]];
-      stub_types[ARG2] = arg_mismatches[caller_loc[ARG2]][callee_loc[ARG2]];
-      stub_types[ARG3] = arg_mismatches[caller_loc[ARG3]][callee_loc[ARG3]];
-      stub_types[RET] = ret_mismatches[caller_loc[RET]][callee_loc[RET]];
-
-      return (stub_types[ARG0] != NO
-	      || stub_types[ARG1] != NO
-	      || stub_types[ARG2] != NO
-	      || stub_types[ARG3] != NO
-	      || stub_types[RET] != NO);
-    }
+  strcpy (stub_name, "_____long_branch_stub_");
 }
 
 /* Compute the size of the stub needed to call from LOCATION to DESTINATION
@@ -2184,62 +825,16 @@
    CALLEE.  Return zero if no stub is needed to perform such a call.  */
 
 static unsigned int
-elf32_hppa_size_of_stub (callee, caller, location, destination, sym_name)
-     unsigned int callee, caller;
+elf32_hppa_size_of_stub (location, destination, sym_name)
      bfd_vma location, destination;
      const char *sym_name;
 {
-  arg_reloc_type arg_reloc_types[5];
-
-  /* Determine if a long branch or argument relocation stub is needed.
-     If an argument relocation stub is needed, the relocation will be
-     stored into arg_reloc_types.  */
+  /* Determine if a long branch stub is needed.  */
   if (!(((int)(location - destination) > 0x3ffff)
-	|| ((int)(location - destination) < (int)0xfffc0000)
-	|| elf32_hppa_arg_reloc_needed (caller, callee, arg_reloc_types)))
+	|| ((int)(location - destination) < (int)0xfffc0000)))
     return 0;
 
-  /* Some kind of stub is needed.  Determine how big it needs to be.
-     First check for argument relocation stubs as they also handle
-     long calls.  Then check for long calls to millicode and finally
-     the normal long calls.  */
-  if (arg_reloc_types[ARG0] != NO
-      || arg_reloc_types[ARG1] != NO
-      || arg_reloc_types[ARG2] != NO
-      || arg_reloc_types[ARG3] != NO
-      || arg_reloc_types[RET] != NO)
-    {
-      /* Some kind of argument relocation stub is needed.  */
-      unsigned int len = 16;
-      arg_reloc_location i;
-
-      /* Each GR or FG relocation takes 2 insns, each GD or DG
-	 relocation takes 3 insns.  Plus 4 more insns for the
-         RP adjustment, ldil & (be | ble) and copy.  */
-      for (i = ARG0; i <= RET; i++)
-	switch (arg_reloc_types[i])
-	  {
-	    case GF:
-	    case FG:
-	      len += 8;
-	      break;
-
-	    case GD:
-	    case DG:
-	      len += 12;
-	      break;
-
-	    default:
-	      break;
-	  }
-
-      /* Extra instructions are needed if we're relocating a return value.  */
-      if (arg_reloc_types[RET] != NO)
-	len += 12;
-
-      return len;
-    }
-  else if (!strncmp ("$$", sym_name, 2)
+  if (!strncmp ("$$", sym_name, 2)
       && strcmp ("$$dyncall", sym_name))
     return 12;
   else
@@ -2280,131 +875,7 @@
 	       + entry->target_section->output_offset
 	       + entry->target_section->output_section->vma);
 
-  if (strncmp ("_____long_branch_stub_", entry->root.string, 22))
-    {
-      /* This must be an argument or return value relocation stub.  */
-      unsigned long insn;
-      arg_reloc_location i;
-      bfd_byte *begin_loc = loc;
-
-      /* 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);
-      loc += 4;
-
-      /* If we are relocating a return value, then we're going to have
-	 to return into the stub.  So we have to save off the user's
-	 return pointer into the stack at RP'.  */
-      if (strncmp (entry->root.string + 14, "NO", 2))
-	{
-	  bfd_put_32 (stub_bfd, STW_R31_M8R30, loc);
-	  loc += 4;
-	}
-
-      /* Iterate over the argument relocations, emitting instructions
-	 to move them around as necessary.  */
-      for (i = ARG0; i <= ARG3; i++)
-	{
-	  if (!strncmp (entry->root.string + 3 * i + 2, "GF", 2))
-	    {
-	      bfd_put_32 (stub_bfd, STW_ARG_M16R30 | ((26 - i) << 16), loc);
-	      bfd_put_32 (stub_bfd, FLDW_M16R30_FARG | (4 + i), loc + 4);
-	      loc += 8;
-	    }
-	  else if (!strncmp (entry->root.string + 3 * i + 2, "FG", 2))
-	    {
-	      bfd_put_32 (stub_bfd, FSTW_FARG_M16R30 | (4 + i), loc);
-	      bfd_put_32 (stub_bfd, LDW_M16R30_ARG | ((26 - i) << 16), loc + 4);
-	      loc += 8;
-	    }
-	  else if (!strncmp (entry->root.string + 3 * i + 2, "GD", 2))
-	    {
-	      bfd_put_32 (stub_bfd, STW_ARG_M12R30 | ((26 - i) << 16), loc);
-	      bfd_put_32 (stub_bfd, STW_ARG_M16R30 | ((25 - i) << 16), loc + 4);
-	      bfd_put_32 (stub_bfd, FLDD_M16R30_FARG | (5 + i), loc + 8);
-	      loc += 12;
-	    }
-	  else if (!strncmp (entry->root.string + 3 * i + 2, "DG", 2))
-	    {
-	      bfd_put_32 (stub_bfd, FSTD_FARG_M16R30 | (5 + i), loc);
-	      bfd_put_32 (stub_bfd, LDW_M12R30_ARG | ((26 - i) << 16), loc + 4);
-	      bfd_put_32 (stub_bfd, LDW_M16R30_ARG | ((25 - i) << 16), loc + 8);
-	      loc += 12;
-	    }
-	}
-
-      /* Load the high bits of the target address into %r1.  */
-      insn = hppa_rebuild_insn (stub_bfd, LDIL_R1,
-				hppa_field_adjust (sym_value, 0, e_lrsel), 21);
-      bfd_put_32 (stub_bfd, insn, loc);
-      loc += 4;
-
-      /* If we are relocating a return value, then we're going to have
-	 to return into the stub, then perform the return value relocation.  */
-      if (strncmp (entry->root.string + 14, "NO", 2))
-	{
-	  /* To return to the stub we "ble" to the target and copy the return
-	     pointer from %r31 into %r2.  */
-	  insn = hppa_rebuild_insn (stub_bfd,
-				    BLE_SR4_R1,
-				    hppa_field_adjust (sym_value, 0,
-						       e_rrsel) >> 2,
-				    17);
-	  bfd_put_32 (stub_bfd, insn, loc);
-	  bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 4);
-
-	  /* Reload the return pointer for our caller from the stack.  */
-	  bfd_put_32 (stub_bfd, LDW_M8R30_R31, loc + 8);
-	  loc += 12;
-
-	  /* Perform the return value relocation.  */
-	  if (!strncmp (entry->root.string + 14, "GF", 2))
-	    {
-	      bfd_put_32 (stub_bfd, STW_ARG_M16R30 | (28 << 16), loc);
-	      bfd_put_32 (stub_bfd, FLDW_M16R30_FARG | 4, loc + 4);
-	      loc += 8;
-	    }
-	  else if (!strncmp (entry->root.string + 14, "FG", 2))
-	    {
-	      bfd_put_32 (stub_bfd, FSTW_FARG_M16R30 | 4, loc);
-	      bfd_put_32 (stub_bfd, LDW_M16R30_ARG | (28 << 16), loc + 4);
-	      loc += 8;
-	    }
-	  else if (!strncmp (entry->root.string + 2, "GD", 2))
-	    {
-	      bfd_put_32 (stub_bfd, STW_ARG_M12R30 | (28 << 16), loc);
-	      bfd_put_32 (stub_bfd, STW_ARG_M16R30 | (29 << 16), loc + 4);
-	      bfd_put_32 (stub_bfd, FLDD_M16R30_FARG | 4, loc + 8);
-	      loc += 12;
-	    }
-	  else if (!strncmp (entry->root.string + 2, "DG", 2))
-	    {
-	      bfd_put_32 (stub_bfd, FSTD_FARG_M16R30 | 4, loc);
-	      bfd_put_32 (stub_bfd, LDW_M12R30_ARG | (28 << 16), loc + 4);
-	      bfd_put_32 (stub_bfd, LDW_M16R30_ARG | (29 << 16), loc + 8);
-	      loc += 12;
-	    }
-	  /* Branch back to the user's code now.  */
-	  bfd_put_32 (stub_bfd, BV_N_0_R31, loc);
-	  loc += 4;
-	}
-      else
-	{
-	  /* No return value relocation, so we can simply "be" to the
-	     target and copy out return pointer into %r2.  */
-	  insn = hppa_rebuild_insn (stub_bfd, BE_SR4_R1,
-				    hppa_field_adjust (sym_value, 0,
-						       e_rrsel) >> 2, 17);
-	  bfd_put_32 (stub_bfd, insn, loc);
-	  bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 4);
-	  loc += 8;
-	}
-
-      /* Update the location and offsets.  */
-      stub_hash_table->location += (loc - begin_loc);
-      stub_hash_table->offset += (loc - begin_loc);
-    }
-  else
+  if (1)
     {
       /* Create one of two variant long branch stubs.  One for $$dyncall and
 	 normal calls, the other for calls to millicode.  */
@@ -2498,17 +969,15 @@
 boolean
 elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info)
      bfd *stub_bfd;
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *link_info;
 {
   bfd *input_bfd;
   asection *section, *stub_sec = 0;
   Elf_Internal_Shdr *symtab_hdr;
-  Elf_Internal_Sym *local_syms, *isym, **all_local_syms;
-  Elf32_External_Sym *ext_syms, *esym;
+  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;
-  struct elf32_hppa_args_hash_table *args_hash_table = 0;
 
   /* Create and initialize the stub hash table.  */
   stub_hash_table = ((struct elf32_hppa_stub_hash_table *)
@@ -2520,19 +989,8 @@
 					elf32_hppa_stub_hash_newfunc))
     goto error_return;
 
-  /* Likewise for the argument location hash table.  */
-  args_hash_table = ((struct elf32_hppa_args_hash_table *)
-		     bfd_malloc (sizeof (struct elf32_hppa_args_hash_table)));
-  if (!args_hash_table)
-    goto error_return;
-
-  if (!elf32_hppa_args_hash_table_init (args_hash_table,
-					elf32_hppa_args_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;
-  elf32_hppa_hash_table(link_info)->args_hash_table = args_hash_table;
 
   /* Count the number of input BFDs.  */
   for (input_bfd = link_info->input_bfds;
@@ -2540,88 +998,6 @@
        input_bfd = input_bfd->link_next)
      bfd_count++;
 
-  /* 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_malloc (sizeof (Elf_Internal_Sym *)
-					* bfd_count);
-  if (all_local_syms == NULL)
-    goto error_return;
-  memset (all_local_syms, 0, sizeof (Elf_Internal_Sym *) * bfd_count);
-
-  /* Walk over all the input BFDs adding entries to the args hash table
-     for all the external functions.  */
-  for (input_bfd = link_info->input_bfds, index = 0;
-       input_bfd != NULL;
-       input_bfd = input_bfd->link_next, index++)
-    {
-      /* We'll need the symbol table in a second.  */
-      symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-      if (symtab_hdr->sh_info == 0)
-	continue;
-
-      /* 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)
-	{
-	  for (i = 0; i < bfd_count; i++)
-	    if (all_local_syms[i])
-	      free (all_local_syms[i]);
-	  free (all_local_syms);
-	  goto error_return;
-	}
-      all_local_syms[index] = local_syms;
-
-      ext_syms
-	= (Elf32_External_Sym *) bfd_malloc (symtab_hdr->sh_info
-					     * sizeof (Elf32_External_Sym));
-      if (ext_syms == NULL)
-	{
-	  for (i = 0; i < bfd_count; i++)
-	    if (all_local_syms[i])
-	      free (all_local_syms[i]);
-	  free (all_local_syms);
-	  goto error_return;
-	}
-
-      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)))
-	{
-	  for (i = 0; i < bfd_count; i++)
-	    if (all_local_syms[i])
-	      free (all_local_syms[i]);
-	  free (all_local_syms);
-	  free (ext_syms);
-	  goto error_return;
-	}
-
-      /* Swap the local symbols in.  */
-      isym = local_syms;
-      esym = ext_syms;
-      for (i = 0; i < symtab_hdr->sh_info; i++, esym++, isym++)
-	 bfd_elf32_swap_symbol_in (input_bfd, esym, isym);
-
-      /* Now we can free the external symbols.  */
-      free (ext_syms);
-
-      if (elf32_hppa_read_symext_info (input_bfd, symtab_hdr, args_hash_table,
-				       local_syms) == false)
-	{
-	  for (i = 0; i < bfd_count; i++)
-	    if (all_local_syms[i])
-	      free (all_local_syms[i]);
-	  free (all_local_syms);
-	  goto error_return;
-	}
-    }
-
   /* Magic as we know the stub bfd only has one section.  */
   stub_sec = stub_bfd->sections;
 
@@ -2721,11 +1097,10 @@
 	  irelaend = irela + section->reloc_count;
 	  for (; irela < irelaend; irela++)
 	    {
-	      long r_type, callee_args, caller_args, size_of_stub;
+	      long r_type, size_of_stub;
 	      unsigned long r_index;
 	      struct elf_link_hash_entry *hash;
 	      struct elf32_hppa_stub_hash_entry *stub_hash;
-	      struct elf32_hppa_args_hash_entry *args_hash;
 	      Elf_Internal_Sym *sym;
 	      asection *sym_sec;
 	      const char *sym_name;
@@ -2821,24 +1196,6 @@
 		    }
 		}
 
-	      args_hash = elf32_hppa_args_hash_lookup (args_hash_table,
-						       sym_name, false, false);
-
-	      /* Get both caller and callee argument information.  */
-	      if (args_hash == NULL)
-		callee_args = 0;
-	      else
-		callee_args = args_hash->arg_bits;
-
-	      /* For calls get the caller's bits from the addend of
-		 the call relocation.  For PLABELS the caller's bits
-		 are assumed to have all args & return values in general
-		 registers (0x155).  */
-	      if (r_type == R_PARISC_PCREL17F)
-		caller_args = HPPA_R_ARG_RELOC (irela->r_addend);
-	      else
-		caller_args = 0x155;
-
 	      /* Now determine where the call point is.  */
 	      location = (section->output_offset
 			  + section->output_section->vma
@@ -2851,9 +1208,7 @@
 
 	      /* Determine what (if any) linker stub is needed and its
 		 size (in bytes).  */
-	      size_of_stub = elf32_hppa_size_of_stub (callee_args,
-						      caller_args,
-						      location,
+	      size_of_stub = elf32_hppa_size_of_stub (location,
 						      destination,
 						      sym_name);
 	      if (size_of_stub != 0)
@@ -2880,8 +1235,7 @@
 		      free (all_local_syms);
 		      goto error_return;
 		    }
-		  elf32_hppa_name_of_stub (caller_args, callee_args,
-					   location, destination, stub_name);
+		  elf32_hppa_name_of_stub (location, destination, stub_name);
 		  strcat (stub_name + 22, sym_name);
 
 		  /* Because sym_name was malloced above for local symbols.  */
@@ -2945,11 +1299,6 @@
       elf32_hppa_hash_table(link_info)->stub_hash_table = NULL;
       free (stub_hash_table);
     }
-  if (args_hash_table)
-    {
-      elf32_hppa_hash_table(link_info)->args_hash_table = NULL;
-      free (args_hash_table);
-    }
   /* 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.  */
@@ -2959,25 +1308,17 @@
 
 /* Misc BFD support code.  */
 #define bfd_elf32_bfd_reloc_type_lookup		elf_hppa_reloc_type_lookup
-#define bfd_elf32_bfd_is_local_label_name	hppa_elf_is_local_label_name
-
-/* Symbol extension stuff.  */
-#define bfd_elf32_set_section_contents		elf32_hppa_set_section_contents
-#define elf_info_to_howto			elf32_hppa_info_to_howto
-#define elf_backend_symbol_table_processing \
-  elf32_hppa_backend_symbol_table_processing
-#define elf_backend_begin_write_processing \
-  elf32_hppa_backend_begin_write_processing
-#define elf_backend_final_write_processing \
-  elf32_hppa_backend_final_write_processing
+#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
 
 /* 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 elf_backend_link_output_symbol_hook \
-  elf32_hppa_link_output_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 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 b233920..915fc13 100644
--- a/bfd/elf32-hppa.h
+++ b/bfd/elf32-hppa.h
@@ -35,32 +35,29 @@
 #include "libhppa.h"
 #include "elf/hppa.h"
 
-#define ELF_HOWTO_TABLE_SIZE	R_PARISC_UNIMPLEMENTED + 1
-#define N_PARISC_RELOCS		R_PARISC_UNIMPLEMENTED + 1
-
-/* Define 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 relocation 
-   as appropriate.  This allows GAS to share much more code
-   between the two target object formats.  */
-
-#define R_HPPA_NONE			R_PARISC_NONE
-#define	R_HPPA				R_PARISC_DIR32
-#define	R_HPPA_GOTOFF			R_PARISC_DPREL21L
-#define	R_HPPA_PCREL_CALL		R_PARISC_PCREL21L
-#define R_HPPA_ABS_CALL			R_PARISC_DIR17F
-#define R_HPPA_COMPLEX			R_PARISC_UNIMPLEMENTED
-
-elf32_hppa_reloc_type ** hppa_elf_gen_reloc_type
-  PARAMS ((bfd *, elf32_hppa_reloc_type, int, int, int, asymbol *));
-
 boolean elf32_hppa_size_stubs
   PARAMS ((bfd *, bfd *, struct bfd_link_info *));
 
 boolean elf32_hppa_build_stubs
   PARAMS ((bfd *, 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 *));
+
+/* Define 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 relocation
+   as appropriate.  This allows GAS to share much more code
+   between the two target object formats.  */
+
+#define R_HPPA_NONE			R_PARISC_NONE
+#define R_HPPA				R_PARISC_DIR32
+#define R_HPPA_GOTOFF			R_PARISC_DPREL21L
+#define R_HPPA_PCREL_CALL		R_PARISC_PCREL21L
+#define R_HPPA_ABS_CALL			R_PARISC_DIR17F
+#define R_HPPA_COMPLEX			R_PARISC_UNIMPLEMENTED
+
 #endif /* _ELF32_HPPA_H */
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
new file mode 100644
index 0000000..c8bf943
--- /dev/null
+++ b/bfd/elf32-i370.c
@@ -0,0 +1,1742 @@
+/* i370-specific support for 32-bit ELF
+   Copyright 1994, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Cygnus Support.
+   Hacked by Linas Vepstas for i370 linas@linas.org
+
+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.  */
+
+
+
+/* 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
+   else is a wild card.  In particular, don't expect shared libs or
+   dynamic loading to work ...  its never been tested ...
+*/
+
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/i370.h"
+
+#define USE_RELA		/* we want RELA relocations, not REL */
+
+/* i370 relocations */
+/* Note that there is really just one relocation that we currently
+ * support (and only one that we seem to need, at the moment), and
+ * that is the 31-bit address relocation.  Note that the 370/390
+ * only supports a 31-bit (2GB) address space.
+ */
+enum i370_reloc_type
+{
+  R_I370_NONE		=   0,
+  R_I370_ADDR31		=   1,
+  R_I370_ADDR32		=   2,
+  R_I370_ADDR16		=   3,
+  R_I370_REL31		=   4,
+  R_I370_REL32		=   5,
+  R_I370_ADDR12		=   6,
+  R_I370_REL12		=   7,
+  R_I370_ADDR8		=   8,
+  R_I370_REL8		=   9,
+  R_I370_COPY		=  10,
+  R_I370_RELATIVE	=  11,
+
+  R_I370_max
+};
+
+
+static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ];
+
+static reloc_howto_type i370_elf_howto_raw[] =
+{
+  /* This reloc does nothing.  */
+  HOWTO (R_I370_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_I370_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A standard 31 bit relocation.  */
+  HOWTO (R_I370_ADDR31,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 31,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_I370_ADDR31",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x7fffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A standard 32 bit relocation.  */
+  HOWTO (R_I370_ADDR32,		/* 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_I370_ADDR32",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A standard 16 bit relocation.  */
+  HOWTO (R_I370_ADDR16,		/* 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_I370_ADDR16",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 31-bit PC relative */
+  HOWTO (R_I370_REL31,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 31,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_I370_REL31",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x7fffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* 32-bit PC relative */
+  HOWTO (R_I370_REL32,		/* 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_I370_REL32",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* A standard 12 bit relocation.  */
+  HOWTO (R_I370_ADDR12,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_I370_ADDR12",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xfff,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 12-bit PC relative */
+  HOWTO (R_I370_REL12,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_I370_REL12",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xfff,			/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* A standard 8 bit relocation.  */
+  HOWTO (R_I370_ADDR8,		/* 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_I370_ADDR8",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xff,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 8-bit PC relative */
+  HOWTO (R_I370_REL8,		/* 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_I370_REL8",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xff,			/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* This is used only by the dynamic linker.  The symbol should exist
+     both in the object being run and in some shared library.  The
+     dynamic linker copies the data addressed by the symbol from the
+     shared library into the object, because the object being
+     run has to have the data at some particular address.  */
+  HOWTO (R_I370_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_I370_COPY",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* Used only by the dynamic linker.  When the object is run, this
+     longword is set to the load address of the object, plus the
+     addend.  */
+  HOWTO (R_I370_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_I370_RELATIVE",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+};
+
+
+static void i370_elf_howto_init PARAMS ((void));
+static void i370_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr,
+					    Elf32_Internal_Rela *dst));
+static boolean i370_elf_set_private_flags PARAMS ((bfd *, flagword));
+
+
+/* Initialize the i370_elf_howto_table, so that linear accesses can be done.  */
+
+static void
+i370_elf_howto_init ()
+{
+  unsigned int i, type;
+
+  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]));
+      i370_elf_howto_table[type] = &i370_elf_howto_raw[i];
+    }
+}
+
+
+static reloc_howto_type *
+i370_elf_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  enum i370_reloc_type i370_reloc = R_I370_NONE;
+
+  if (!i370_elf_howto_table[ R_I370_ADDR31 ])	/* Initialize howto table if needed */
+    i370_elf_howto_init ();
+
+  switch ((int)code)
+    {
+    default:
+      return (reloc_howto_type *)NULL;
+
+    case BFD_RELOC_NONE:	i370_reloc = R_I370_NONE;	break;
+    case BFD_RELOC_32:		i370_reloc = R_I370_ADDR31;	break;
+    case BFD_RELOC_16:		i370_reloc = R_I370_ADDR16;	break;
+    case BFD_RELOC_32_PCREL:	i370_reloc = R_I370_REL31;	break;
+    case BFD_RELOC_CTOR:	i370_reloc = R_I370_ADDR31;	break;
+    case BFD_RELOC_I370_D12:	i370_reloc = R_I370_ADDR12;	break;
+    }
+
+  return i370_elf_howto_table[ (int)i370_reloc ];
+};
+
+static boolean i370_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+static boolean i370_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
+
+static boolean i370_elf_relocate_section PARAMS ((bfd *,
+						  struct bfd_link_info *info,
+						  bfd *,
+						  asection *,
+						  bfd_byte *,
+						  Elf_Internal_Rela *relocs,
+						  Elf_Internal_Sym *local_syms,
+						  asection **));
+
+static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *,
+							 struct bfd_link_info *));
+
+static boolean i370_elf_section_from_shdr PARAMS ((bfd *,
+						   Elf32_Internal_Shdr *,
+						   char *));
+static boolean i370_elf_fake_sections PARAMS ((bfd *,
+					       Elf32_Internal_Shdr *,
+					       asection *));
+#if 0
+static elf_linker_section_t *i370_elf_create_linker_section
+  PARAMS ((bfd *abfd,
+	   struct bfd_link_info *info,
+	   enum elf_linker_section_enum));
+#endif
+static boolean i370_elf_check_relocs PARAMS ((bfd *,
+					     struct bfd_link_info *,
+					     asection *,
+					     const Elf_Internal_Rela *));
+
+static boolean i370_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *,
+						      struct elf_link_hash_entry *));
+
+static boolean i370_elf_adjust_dynindx PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static boolean i370_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
+
+static boolean i370_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 "/lib/ld.so"
+
+
+/* Set the howto pointer for an i370 ELF reloc.  */
+
+static void
+i370_elf_info_to_howto (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf32_Internal_Rela *dst;
+{
+  if (!i370_elf_howto_table[ R_I370_ADDR31 ])	/* Initialize howto table */
+    i370_elf_howto_init ();
+
+  BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_I370_max);
+  cache_ptr->howto = i370_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
+}
+
+/* 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. */
+static boolean
+i370_elf_set_private_flags (abfd, flags)
+     bfd *abfd;
+     flagword flags;
+{
+  BFD_ASSERT (!elf_flags_init (abfd)
+	      || elf_elfheader (abfd)->e_flags == flags);
+
+  elf_elfheader (abfd)->e_flags = flags;
+  elf_flags_init (abfd) = true;
+  return true;
+}
+
+/* Copy backend specific data from one object module to another */
+static boolean
+i370_elf_copy_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return true;
+
+  BFD_ASSERT (!elf_flags_init (obfd)
+	      || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
+
+  elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
+  elf_flags_init (obfd) = true;
+  return true;
+}
+
+/* Merge backend specific data from an object file to the output
+   object file when linking */
+static boolean
+i370_elf_merge_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  flagword old_flags;
+  flagword new_flags;
+
+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return true;
+
+  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;
+      elf_elfheader (obfd)->e_flags = new_flags;
+    }
+
+  else if (new_flags == old_flags)	/* Compatible flags are ok */
+    ;
+
+  else					/* Incompatible flags */
+    {
+      (*_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_set_error (bfd_error_bad_value);
+      return false;
+    }
+
+  return true;
+}
+
+
+/* Handle an i370 specific section when reading an object file.  This
+   is called when elfcode.h finds a section with an unknown type.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_section_from_shdr (abfd, hdr, name)
+     bfd *abfd;
+     Elf32_Internal_Shdr *hdr;
+     char *name;
+{
+  asection *newsect;
+  flagword flags;
+
+  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+    return false;
+
+  newsect = hdr->bfd_section;
+  flags = bfd_get_section_flags (abfd, newsect);
+  if (hdr->sh_flags & SHF_EXCLUDE)
+    flags |= SEC_EXCLUDE;
+
+  if (hdr->sh_type == SHT_ORDERED)
+    flags |= SEC_SORT_ENTRIES;
+
+  bfd_set_section_flags (abfd, newsect, flags);
+  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
+ * certainly does the wrong thing.  Its here simply because it does
+ * 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;
+     Elf32_Internal_Shdr *shdr;
+     asection *asect;
+{
+  if ((asect->flags & SEC_EXCLUDE) != 0)
+    shdr->sh_flags |= SHF_EXCLUDE;
+
+  if ((asect->flags & SEC_SORT_ENTRIES) != 0)
+    shdr->sh_type = SHT_ORDERED;
+
+  return true;
+}
+
+
+#if 0
+/* Create a special linker section */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static elf_linker_section_t *
+i370_elf_create_linker_section (abfd, info, which)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     enum elf_linker_section_enum which;
+{
+  bfd *dynobj = elf_hash_table (info)->dynobj;
+  elf_linker_section_t *lsect;
+
+  /* Record the first bfd section that needs the special section */
+  if (!dynobj)
+    dynobj = elf_hash_table (info)->dynobj = abfd;
+
+  /* If this is the first time, create the section */
+  lsect = elf_linker_section (dynobj, which);
+  if (!lsect)
+    {
+      elf_linker_section_t defaults;
+      static elf_linker_section_t zero_section;
+
+      defaults = zero_section;
+      defaults.which = which;
+      defaults.hole_written_p = false;
+      defaults.alignment = 2;
+
+      /* Both of these sections are (technically) created by the user
+	 putting data in them, so they shouldn't be marked
+	 SEC_LINKER_CREATED.
+
+	 The linker creates them so it has somewhere to attach their
+	 respective symbols. In fact, if they were empty it would
+	 be OK to leave the symbol set to 0 (or any random number), because
+	 the appropriate register should never be used.  */
+      defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+			| SEC_IN_MEMORY);
+
+      switch (which)
+	{
+	default:
+	  (*_bfd_error_handler) ("%s: Unknown special linker type %d",
+				 bfd_get_filename (abfd),
+				 (int)which);
+
+	  bfd_set_error (bfd_error_bad_value);
+	  return (elf_linker_section_t *)0;
+
+	case LINKER_SECTION_SDATA:	/* .sdata/.sbss section */
+	  defaults.name		  = ".sdata";
+	  defaults.rel_name	  = ".rela.sdata";
+	  defaults.bss_name	  = ".sbss";
+	  defaults.sym_name	  = "_SDA_BASE_";
+	  defaults.sym_offset	  = 32768;
+	  break;
+
+	case LINKER_SECTION_SDATA2:	/* .sdata2/.sbss2 section */
+	  defaults.name		  = ".sdata2";
+	  defaults.rel_name	  = ".rela.sdata2";
+	  defaults.bss_name	  = ".sbss2";
+	  defaults.sym_name	  = "_SDA2_BASE_";
+	  defaults.sym_offset	  = 32768;
+	  defaults.flags	 |= SEC_READONLY;
+	  break;
+	}
+
+      lsect = _bfd_elf_create_linker_section (abfd, info, which, &defaults);
+    }
+
+  return lsect;
+}
+#endif
+
+/* We have to create .dynsbss and .rela.sbss here so that they get mapped
+   to output sections (just like _bfd_elf_create_dynamic_sections has
+   to create .dynbss and .rela.bss).  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_create_dynamic_sections (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  register asection *s;
+  flagword flags;
+
+  if (!_bfd_elf_create_dynamic_sections(abfd, info))
+    return false;
+
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+	   | SEC_LINKER_CREATED);
+
+  s = bfd_make_section (abfd, ".dynsbss");
+  if (s == NULL
+      || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
+    return false;
+
+  if (! info->shared)
+    {
+      s = bfd_make_section (abfd, ".rela.sbss");
+      if (s == NULL
+	  || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+	  || ! bfd_set_section_alignment (abfd, s, 2))
+	return false;
+    }
+
+   /* 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)
+      || ! bfd_set_section_alignment (abfd, s, 2))
+    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.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_adjust_dynamic_symbol (info, h)
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+{
+  bfd *dynobj = elf_hash_table (info)->dynobj;
+  asection *s;
+  unsigned int power_of_two;
+
+#ifdef DEBUG
+  fprintf (stderr, "i370_elf_adjust_dynamic_symbol called for %s\n",
+	   h->root.root.string);
+#endif
+
+  /* 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)));
+
+
+  s = bfd_get_section_by_name (dynobj, ".rela.text");
+  BFD_ASSERT (s != NULL);
+  s->_raw_size += sizeof (Elf32_External_Rela);
+
+  /* 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;
+
+  /* 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.
+
+     Of course, if the symbol is sufficiently small, we must instead
+     allocate it in .sbss.  FIXME: It would be better to do this if and
+     only if there were actually SDAREL relocs for that symbol.  */
+
+  if (h->size <= elf_gp_size (dynobj))
+    s = bfd_get_section_by_name (dynobj, ".dynsbss");
+  else
+    s = bfd_get_section_by_name (dynobj, ".dynbss");
+  BFD_ASSERT (s != NULL);
+
+  /* We must generate a R_I370_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;
+
+      if (h->size <= elf_gp_size (dynobj))
+	srel = bfd_get_section_by_name (dynobj, ".rela.sbss");
+      else
+	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 > 4)
+    power_of_two = 4;
+
+  /* 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;
+}
+
+
+/* Increment the index of a dynamic symbol by a given amount.  Called
+   via elf_link_hash_traverse.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_adjust_dynindx (h, cparg)
+     struct elf_link_hash_entry *h;
+     PTR cparg;
+{
+  int *cp = (int *) cparg;
+
+#ifdef DEBUG
+  fprintf (stderr,
+	   "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n",
+	   h->dynindx, *cp);
+#endif
+
+  if (h->dynindx != -1)
+    h->dynindx += *cp;
+
+  return true;
+}
+
+
+/* Set the sizes of the dynamic sections.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_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;
+
+#ifdef DEBUG
+  fprintf (stderr, "i370_elf_size_dynamic_sections called\n");
+#endif
+
+  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, .rela.sdata, and
+	 .rela.sdata2 sections.  However, if we are not creating the
+	 dynamic sections, we will not actually use these entries.  Reset
+	 the size of .rela.got, et al, which will cause it to get
+	 stripped from the output file below.  */
+      static char *rela_sections[] = { ".rela.got", ".rela.sdata",
+				       ".rela.sdata2", ".rela.sbss",
+				       (char *)0 };
+      char **p;
+
+      for (p = rela_sections; *p != (char *)0; p++)
+	{
+	  s = bfd_get_section_by_name (dynobj, *p);
+	  if (s != NULL)
+	    s->_raw_size = 0;
+	}
+    }
+
+  /* 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;
+	      const char *outname;
+
+	      /* Remember whether there are any relocation sections. */
+	      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, ".got") != 0
+	       && strcmp (name, ".sdata") != 0
+	       && strcmp (name, ".sdata2") != 0)
+	{
+	  /* It's not one of our sections, so don't allocate space.  */
+	  continue;
+	}
+
+      if (strip)
+	{
+	  asection **spp;
+
+	  for (spp = &s->output_section->owner->sections;
+	       *spp != s->output_section;
+	       spp = &(*spp)->next)
+	    ;
+	  *spp = s->output_section->next;
+	  --s->output_section->owner->section_count;
+
+	  continue;
+	}
+      /* Allocate memory for the section contents.  */
+      s->contents = (bfd_byte *) bfd_zalloc (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 i370_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;
+	}
+    }
+
+  /* If we are generating a shared library, we generate a section
+     symbol for each output section.  These are local symbols, which
+     means that they must come first in the dynamic symbol table.
+     That means we must increment the dynamic symbol index of every
+     other dynamic symbol.
+
+     FIXME: We assume that there will never be relocations to
+     locations in linker-created sections that do not have
+     externally-visible names. Instead, we should work out precisely
+     which sections relocations are targetted at.  */
+  if (info->shared)
+    {
+      int c;
+
+      for (c = 0, s = output_bfd->sections; s != NULL; s = s->next)
+	{
+	  if ((s->flags & SEC_LINKER_CREATED) != 0
+	      || (s->flags & SEC_ALLOC) == 0)
+	    {
+	      elf_section_data (s)->dynindx = -1;
+	      continue;
+	    }
+
+	  /* These symbols will have no names, so we don't need to
+	     fiddle with dynstr_index.  */
+
+	  elf_section_data (s)->dynindx = c + 1;
+
+	  c++;
+	}
+
+      elf_link_hash_traverse (elf_hash_table (info),
+			      i370_elf_adjust_dynindx,
+			      (PTR) &c);
+      elf_hash_table (info)->dynsymcount += c;
+    }
+
+  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.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_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;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  bfd_vma *local_got_offsets;
+  asection *sreloc;
+
+  if (info->relocateable)
+    return true;
+
+#ifdef DEBUG
+  fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n",
+	   bfd_get_section_name (abfd, sec),
+	   bfd_get_filename (abfd));
+#endif
+
+  dynobj = elf_hash_table (info)->dynobj;
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_offsets = elf_local_got_offsets (abfd);
+
+  sreloc = NULL;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
+    {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+
+      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];
+
+      if (info->shared)
+	{
+#ifdef DEBUG
+	  fprintf (stderr,
+		   "i370_elf_check_relocs needs to create relocation for %s\n",
+		   (h && h->root.root.string)
+		   ? h->root.root.string : "<unknown>");
+#endif
+	  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);
+
+	  /* FIXME: We should here do what the m68k and i386
+	     backends do: if the reloc is pc-relative, record it
+	     in case it turns out that the reloc is unnecessary
+	     because the symbol is forced local by versioning or
+	     we are linking with -Bdynamic.  Fortunately this
+	     case is not frequent.  */
+	}
+    }
+
+  return true;
+}
+
+
+/* Finish up the dynamic sections.  */
+/* XXX hack alert bogus This routine is mostly all junk and almost
+ * certainly does the wrong thing.  Its here simply because it does
+ * just enough to allow glibc-2.1 ld.so to compile & link.
+ */
+
+static boolean
+i370_elf_finish_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  asection *sdyn;
+  bfd *dynobj = elf_hash_table (info)->dynobj;
+  asection *sgot = bfd_get_section_by_name (dynobj, ".got");
+
+#ifdef DEBUG
+  fprintf (stderr, "i370_elf_finish_dynamic_sections called\n");
+#endif
+
+  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      asection *splt;
+      Elf32_External_Dyn *dyncon, *dynconend;
+
+      splt = bfd_get_section_by_name (dynobj, ".plt");
+      BFD_ASSERT (splt != NULL && 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;
+	  boolean size;
+
+	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+	  switch (dyn.d_tag)
+	    {
+	    case DT_PLTGOT:   name = ".plt";	  size = false; break;
+	    case DT_PLTRELSZ: name = ".rela.plt"; size = true;  break;
+	    case DT_JMPREL:   name = ".rela.plt"; size = false; break;
+	    default:	      name = NULL;	  size = false; break;
+	    }
+
+	  if (name != NULL)
+	    {
+	      asection *s;
+
+	      s = bfd_get_section_by_name (output_bfd, name);
+	      if (s == NULL)
+		dyn.d_un.d_val = 0;
+	      else
+		{
+		  if (! size)
+		    dyn.d_un.d_ptr = s->vma;
+		  else
+		    {
+		      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);
+	    }
+	}
+    }
+
+  /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
+     easily find the address of the _GLOBAL_OFFSET_TABLE_.  */
+/* XXX this is clearly very wrong for the 370 arch */
+  if (sgot)
+    {
+      unsigned char *contents = sgot->contents;
+      bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
+
+      if (sdyn == NULL)
+	bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
+      else
+	bfd_put_32 (output_bfd,
+		    sdyn->output_section->vma + sdyn->output_offset,
+		    contents+4);
+
+      elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+    }
+
+  if (info->shared)
+    {
+      asection *sdynsym;
+      asection *s;
+      Elf_Internal_Sym sym;
+      int maxdindx = 0;
+
+      /* Set up the section symbols for the output sections.  */
+
+      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
+      BFD_ASSERT (sdynsym != NULL);
+
+      sym.st_size = 0;
+      sym.st_name = 0;
+      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+      sym.st_other = 0;
+
+      for (s = output_bfd->sections; s != NULL; s = s->next)
+	{
+	  int indx, dindx;
+
+	  sym.st_value = s->vma;
+
+	  indx = elf_section_data (s)->this_idx;
+	  dindx = elf_section_data (s)->dynindx;
+	  if (dindx != -1)
+	    {
+	      BFD_ASSERT(indx > 0);
+	      BFD_ASSERT(dindx > 0);
+
+	      if (dindx > maxdindx)
+		maxdindx = dindx;
+
+	      sym.st_shndx = indx;
+
+	      bfd_elf32_swap_symbol_out (output_bfd, &sym,
+					 (PTR) (((Elf32_External_Sym *)
+						 sdynsym->contents)
+						+ dindx));
+	    }
+	}
+
+      /* Set the sh_info field of the output .dynsym section to the
+         index of the first global symbol.  */
+      elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
+	maxdindx + 1;
+    }
+
+  return true;
+}
+
+
+/* The RELOCATE_SECTION function is called by the 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 adjust 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
+i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+			  contents, relocs, local_syms, local_sections)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     Elf_Internal_Rela *relocs;
+     Elf_Internal_Sym *local_syms;
+     asection **local_sections;
+{
+  Elf_Internal_Shdr *symtab_hdr		  = &elf_tdata (input_bfd)->symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
+  bfd *dynobj				  = elf_hash_table (info)->dynobj;
+  Elf_Internal_Rela *rel		  = relocs;
+  Elf_Internal_Rela *relend		  = relocs + input_section->reloc_count;
+  asection *sreloc			  = NULL;
+  bfd_vma *local_got_offsets;
+  boolean ret				  = true;
+
+#ifdef DEBUG
+  fprintf (stderr, "i370_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,
+	   (info->relocateable) ? " (relocatable)" : "");
+#endif
+
+  if (!i370_elf_howto_table[ R_I370_ADDR31 ])	/* Initialize howto table if needed */
+    i370_elf_howto_init ();
+
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  for (; rel < relend; rel++)
+    {
+      enum i370_reloc_type r_type	= (enum i370_reloc_type)ELF32_R_TYPE (rel->r_info);
+      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;
+      reloc_howto_type *howto;
+      unsigned long r_symndx;
+      bfd_vma relocation;
+
+      /* Unknown relocation handling */
+      if ((unsigned)r_type >= (unsigned)R_I370_max
+	  || !i370_elf_howto_table[(int)r_type])
+	{
+	  (*_bfd_error_handler) ("%s: unknown relocation type %d",
+				 bfd_get_filename (input_bfd),
+				 (int)r_type);
+
+	  bfd_set_error (bfd_error_bad_value);
+	  ret = false;
+	  continue;
+	}
+
+      howto = i370_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
+	     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 ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		{
+		  sec = local_sections[r_symndx];
+		  addend = rel->r_addend += sec->output_offset + sym->st_value;
+		}
+	    }
+
+#ifdef DEBUG
+	  fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
+		   howto->name,
+		   (int)r_type,
+		   r_symndx,
+		   (long)offset,
+		   (long)addend);
+#endif
+	  continue;
+	}
+
+      /* This is a final link.  */
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections[r_symndx];
+	  sym_name = "<local symbol>";
+
+	  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;
+	  sym_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;
+	      if (info->shared
+		  && ((! info->symbolic && h->dynindx != -1)
+		      || (h->elf_link_hash_flags
+			  & ELF_LINK_HASH_DEF_REGULAR) == 0)
+		  && (input_section->flags & SEC_ALLOC) != 0
+		  && (r_type == R_I370_ADDR31
+		      || r_type == R_I370_COPY
+		      || r_type == R_I370_ADDR16
+		      || r_type == R_I370_RELATIVE))
+		{
+		  /* In these cases, we don't need the relocation
+                     value.  We check specially because in some
+                     obscure cases sec->output_section will be NULL.  */
+		  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)
+	    relocation = 0;
+	  else
+	    {
+	      (*info->callbacks->undefined_symbol)(info,
+						   h->root.root.string,
+						   input_bfd,
+						   input_section,
+						   rel->r_offset,
+						   true);
+	      ret = false;
+	      continue;
+	    }
+	}
+
+      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);
+
+	  bfd_set_error (bfd_error_bad_value);
+	  ret = false;
+	  continue;
+
+	/* Relocations that may need to be propagated if this is a shared
+           object.  */
+	case (int)R_I370_REL31:
+	  /* 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)
+	    break;
+	/* fall through */
+
+	/* Relocations that always need to be propagated if this is a shared
+           object.  */
+	case (int)R_I370_NONE:
+	case (int)R_I370_ADDR31:
+	case (int)R_I370_ADDR16:
+	  if (info->shared)
+	    {
+	      Elf_Internal_Rela outrel;
+	      boolean skip;
+
+#ifdef DEBUG
+	      fprintf (stderr,
+		       "i370_elf_relocate_section needs to create relocation for %s\n",
+		       (h && h->root.root.string) ? h->root.root.string : "<unknown>");
+#endif
+
+	      /* 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);
+	      /* 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))
+		{
+		  BFD_ASSERT (h->dynindx != -1);
+		  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+		  outrel.r_addend = rel->r_addend;
+		}
+	      else
+		{
+		  if (r_type == R_I370_ADDR31)
+		    {
+		      outrel.r_info = ELF32_R_INFO (0, R_I370_RELATIVE);
+		      outrel.r_addend = relocation + rel->r_addend;
+		    }
+		  else
+		    {
+		      long indx;
+
+		      if (h == NULL)
+			sec = local_sections[r_symndx];
+		      else
+			{
+			  BFD_ASSERT (h->root.type == bfd_link_hash_defined
+				      || (h->root.type
+					  == bfd_link_hash_defweak));
+			  sec = h->root.u.def.section;
+			}
+		      if (sec != NULL && bfd_is_abs_section (sec))
+			indx = 0;
+		      else if (sec == NULL || sec->owner == NULL)
+			{
+			  bfd_set_error (bfd_error_bad_value);
+			  return false;
+			}
+		      else
+			{
+			  asection *osec;
+
+			  osec = sec->output_section;
+			  indx = elf_section_data (osec)->dynindx;
+			  BFD_ASSERT(indx > 0);
+#ifdef DEBUG
+			  if (indx <= 0)
+			    {
+			      printf("indx=%d section=%s flags=%08x name=%s\n",
+				     indx, osec->name, osec->flags,
+				     h->root.root.string);
+			    }
+#endif
+			}
+
+		      outrel.r_info = ELF32_R_INFO (indx, r_type);
+		      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;
+
+	      /* This reloc will be computed at runtime, so there's no
+                 need to do anything now, unless this is a RELATIVE
+                 reloc in an unallocated section.  */
+	      if (skip
+		  || (input_section->flags & SEC_ALLOC) != 0
+		  || ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE)
+		continue;
+	    }
+	  break;
+
+	case (int)R_I370_COPY:
+	case (int)R_I370_RELATIVE:
+	  (*_bfd_error_handler) ("%s: Relocation %s is not yet supported for symbol %s.",
+				 bfd_get_filename (input_bfd),
+				 i370_elf_howto_table[ (int)r_type ]->name,
+				 sym_name);
+
+	  bfd_set_error (bfd_error_invalid_operation);
+	  ret = false;
+	  continue;
+	}
+
+
+#ifdef DEBUG
+      fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
+	       howto->name,
+	       (int)r_type,
+	       sym_name,
+	       r_symndx,
+	       (long)offset,
+	       (long)addend);
+#endif
+
+      r = _bfd_final_link_relocate (howto,
+				    input_bfd,
+				    input_section,
+				    contents,
+				    offset,
+				    relocation,
+				    addend);
+
+      if (r != bfd_reloc_ok)
+	{
+	  ret = false;
+	  switch (r)
+	    {
+	    default:
+	      break;
+
+	    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)
+		      break;
+
+		    if (*name == '\0')
+		      name = bfd_section_name (input_bfd, sec);
+		  }
+
+		(*info->callbacks->reloc_overflow)(info,
+						   name,
+						   howto->name,
+						   (bfd_vma) 0,
+						   input_bfd,
+						   input_section,
+						   offset);
+	      }
+	      break;
+
+	    }
+	}
+    }
+
+
+#ifdef DEBUG
+  fprintf (stderr, "\n");
+#endif
+
+  return ret;
+}
+
+static void
+i370_elf_post_process_headers (abfd, link_info)
+    bfd * abfd;
+    struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+{
+  Elf_Internal_Ehdr * i_ehdrp;  /* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
+}
+
+#define TARGET_BIG_SYM		bfd_elf32_i370_vec
+#define TARGET_BIG_NAME		"elf32-i370"
+#define ELF_ARCH		bfd_arch_i370
+#define ELF_MACHINE_CODE	EM_S370
+#ifdef EM_I370_OLD
+#define ELF_MACHINE_ALT1	EM_I370_OLD
+#endif
+#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
+
+#define bfd_elf32_bfd_reloc_type_lookup		i370_elf_reloc_type_lookup
+#define bfd_elf32_bfd_set_private_flags		i370_elf_set_private_flags
+#define bfd_elf32_bfd_copy_private_bfd_data	i370_elf_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data	i370_elf_merge_private_bfd_data
+#define elf_backend_relocate_section		i370_elf_relocate_section
+
+/* dynamic loader support is mostly broken; just enough here to be able to
+ * link glibc's ld.so without errors.
+ */
+#define elf_backend_create_dynamic_sections	i370_elf_create_dynamic_sections
+#define elf_backend_size_dynamic_sections	i370_elf_size_dynamic_sections
+#define elf_backend_finish_dynamic_sections	i370_elf_finish_dynamic_sections
+#define elf_backend_fake_sections		i370_elf_fake_sections
+#define elf_backend_section_from_shdr		i370_elf_section_from_shdr
+#define elf_backend_adjust_dynamic_symbol	i370_elf_adjust_dynamic_symbol
+#define elf_backend_check_relocs		i370_elf_check_relocs
+
+/*
+#define elf_backend_add_symbol_hook		i370_elf_add_symbol_hook
+#define elf_backend_finish_dynamic_symbol	i370_elf_finish_dynamic_symbol
+#define elf_backend_additional_program_headers	i370_elf_additional_program_headers
+#define elf_backend_modify_segment_map		i370_elf_modify_segment_map
+*/
+
+#define elf_backend_post_process_headers	i370_elf_post_process_headers
+
+int i370_noop()
+{
+  return 1;
+}
+
+/* we need to define these at least as no-ops to link glibc ld.so */
+
+#define elf_backend_add_symbol_hook \
+  (boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \
+			const Elf_Internal_Sym *, const char **, flagword *, \
+			asection **, bfd_vma *))) 		i370_noop
+#define elf_backend_finish_dynamic_symbol \
+  (boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \
+			struct elf_link_hash_entry *, \
+			Elf_Internal_Sym *)))			i370_noop
+#define elf_backend_additional_program_headers \
+  (int (*) PARAMS ((bfd *)))					i370_noop
+#define elf_backend_modify_segment_map \
+  (boolean (*) PARAMS ((bfd *)))				i370_noop
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 830c680..90efba8 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1,5 +1,5 @@
 /* Intel 80386/80486-specific support for 32-bit ELF
-   Copyright 1993-1998, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 94-98, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -67,20 +67,20 @@
   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),
-  { 11 },
-  { 12 },
-  { 13 },
-  { 14 },
-  { 15 },
-  { 16 },
-  { 17 },
-  { 18 },
-  { 19 },
+  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),
   /* 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_bitfield, bfd_elf_generic_reloc,"R_386_PC8",	    true,0xff,0xff,true),
+  HOWTO(R_386_PC8,	 0,0,8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc,"R_386_PC8",	    true,0xff,0xff,true),
 };
 
 /* GNU extension to record C++ vtable hierarchy.  */
@@ -123,7 +123,7 @@
 
 static reloc_howto_type *
 elf_i386_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   switch (code)
@@ -211,16 +211,16 @@
 
 static void
 elf_i386_info_to_howto (abfd, cache_ptr, dst)
-     bfd		*abfd;
-     arelent		*cache_ptr;
-     Elf32_Internal_Rela *dst;
+     bfd		*abfd ATTRIBUTE_UNUSED;
+     arelent		*cache_ptr ATTRIBUTE_UNUSED;
+     Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
 {
   abort ();
 }
 
 static void
 elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
@@ -231,11 +231,14 @@
     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
     {
-      BFD_ASSERT (type < R_386_max);
-      BFD_ASSERT (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC);
-      cache_ptr->howto = &elf_howto_table[(int) type];
+      (*_bfd_error_handler) (_("%s: invalid relocation type %d"),
+			     bfd_get_filename (abfd), (int) type);
+      cache_ptr->howto = &elf_howto_table[(int) R_386_NONE];
     }
 }
 
@@ -591,6 +594,9 @@
 
 	case R_386_32:
 	case R_386_PC32:
+	  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
@@ -714,7 +720,7 @@
 static asection *
 elf_i386_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;
@@ -760,10 +766,10 @@
 
 static boolean
 elf_i386_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;
 {
   /* ??? It would seem that the existing i386 code does no sort
      of reference counting or whatnot on its GOT and PLT entries,
@@ -889,6 +895,11 @@
   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
@@ -1077,7 +1088,7 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
@@ -1139,7 +1150,7 @@
 static boolean
 elf_i386_discard_copies (h, ignore)
      struct elf_i386_link_hash_entry *h;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf_i386_pcrel_relocs_copied *s;
 
@@ -1308,7 +1319,8 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset,
+		      (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index a8537a7..6a2d2d9 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -25,9 +25,10 @@
 #define bfd_elf32_bfd_reloc_type_lookup	bfd_default_reloc_type_lookup
 #define elf_info_to_howto		_bfd_elf_no_info_to_howto
 
-#define TARGET_BIG_SYM	bfd_elf32_i860_vec
-#define TARGET_BIG_NAME "elf32-i860"
-#define ELF_ARCH	bfd_arch_i860
+#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.  */
 
 #include "elf32-target.h"
diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c
new file mode 100644
index 0000000..839fc3d
--- /dev/null
+++ b/bfd/elf32-i960.c
@@ -0,0 +1,168 @@
+/* Intel 860 specific support for 32-bit ELF
+   Copyright 1999 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"
+#include "elf-bfd.h"
+#include "elf/i960.h"
+
+static bfd_reloc_status_type elf32_i960_relocate
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *elf32_i960_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+
+#define USE_REL 1
+
+#define bfd_elf32_bfd_reloc_type_lookup	elf32_i960_reloc_type_lookup
+#define elf_info_to_howto		elf32_i960_info_to_howto
+#define elf_info_to_howto_rel		elf32_i960_info_to_howto_rel
+
+static reloc_howto_type elf_howto_table[]=
+{
+  HOWTO(R_960_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
+	elf32_i960_relocate, "R_960_NONE", true,
+	0x00000000, 0x00000000, false),
+  EMPTY_HOWTO (1),
+  HOWTO (R_960_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	elf32_i960_relocate, "R_960_32", true,
+	0xffffffff, 0xffffffff, false),
+  HOWTO (R_960_IP24, 0, 2, 24, true, 0, complain_overflow_signed,
+	elf32_i960_relocate, "R_960_IP24 ", true,
+	0x00ffffff, 0x00ffffff, false),
+  EMPTY_HOWTO (4),
+  EMPTY_HOWTO (5),
+  EMPTY_HOWTO (6),
+  EMPTY_HOWTO (7)
+};
+
+static enum elf_i960_reloc_type
+elf32_i960_bfd_to_reloc_type (bfd_reloc_code_real_type code)
+{
+  switch (code)
+    {
+    default:
+      return R_960_NONE;
+    case BFD_RELOC_I960_CALLJ:
+      return R_960_OPTCALL;
+    case BFD_RELOC_32:
+    case BFD_RELOC_CTOR:
+      return R_960_32;
+    case BFD_RELOC_24_PCREL:
+      return R_960_IP24;
+    }
+}
+
+static void
+elf32_i960_info_to_howto (abfd, cache_ptr, dst)
+     bfd		*abfd ATTRIBUTE_UNUSED;
+     arelent		*cache_ptr ATTRIBUTE_UNUSED;
+     Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
+{
+  abort ();
+}
+
+static void
+elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf32_Internal_Rel *dst;
+{
+  enum elf_i960_reloc_type type;
+
+  type = (enum elf_i960_reloc_type) ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (type < R_960_max);
+
+  cache_ptr->howto = &elf_howto_table[(int) type];
+}
+
+/* ELF relocs are against symbols.  If we are producing relocateable
+   output, and the reloc is against an external symbol, and nothing
+   has given us any additional addend, the resulting reloc will also
+   be against the same symbol.  In such a case, we don't want to
+   change anything about the way the reloc is handled, since it will
+   all be done at final link time.  Rather than put special case code
+   into bfd_perform_relocation, all the reloc types use this howto
+   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,
+		       symbol,
+		       data,
+		       input_section,
+		       output_bfd,
+		       error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  /* HACK: I think this first condition is necessary when producing
+     relocatable output.  After the end of HACK, the code is identical
+     to bfd_elf_generic_reloc().  I would _guess_ the first change
+     belongs there rather than here.  martindo 1998-10-23.  */
+  if (output_bfd != (bfd *) NULL
+      && reloc_entry->howto->pc_relative
+      && !reloc_entry->howto->pcrel_offset)
+    {
+      reloc_entry->addend -= symbol->value;
+    }
+  /* This is more dubious. */
+  else if (output_bfd != (bfd *) NULL
+	   && (symbol->flags & BSF_SECTION_SYM) != 0)
+    {
+      reloc_entry->addend -= symbol->section->output_section->vma;
+    }
+  else
+    {
+      /* end of HACK */
+      if (output_bfd != (bfd *) NULL
+	  && (symbol->flags & BSF_SECTION_SYM) == 0
+	  && (! reloc_entry->howto->partial_inplace
+	      || reloc_entry->addend == 0))
+	{
+	  reloc_entry->address += input_section->output_offset;
+	  return bfd_reloc_ok;
+	}
+    }
+
+  return bfd_reloc_continue;
+}
+
+static reloc_howto_type *
+elf32_i960_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  return elf_howto_table + elf32_i960_bfd_to_reloc_type (code);
+}
+
+#define TARGET_LITTLE_SYM	bfd_elf32_i960_vec
+#define TARGET_LITTLE_NAME	"elf32-i960"
+#define ELF_ARCH		bfd_arch_i960
+#define ELF_MACHINE_CODE	EM_960
+#define ELF_MAXPAGESIZE  	1 /* FIXME: This number is wrong,  It should be the page size in bytes.  */
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index b2f8523..efb6555 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1,5 +1,5 @@
 /* M32R-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.
 
@@ -35,6 +35,8 @@
 	   bfd_byte *, bfd_vma));
 bfd_reloc_status_type m32r_elf_lo16_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+bfd_reloc_status_type m32r_elf_generic_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static bfd_reloc_status_type m32r_elf_sda16_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
@@ -105,7 +107,7 @@
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 m32r_elf_generic_reloc,/* special_function */
 	 "R_M32R_16",		/* name */
 	 true,			/* partial_inplace */
 	 0xffff,		/* src_mask */
@@ -120,7 +122,7 @@
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 m32r_elf_generic_reloc,/* special_function */
 	 "R_M32R_32",		/* name */
 	 true,			/* partial_inplace */
 	 0xffffffff,		/* src_mask */
@@ -135,7 +137,7 @@
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_unsigned, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 m32r_elf_generic_reloc,/* special_function */
 	 "R_M32R_24",		/* name */
 	 true,			/* partial_inplace */
 	 0xffffff,		/* src_mask */
@@ -301,7 +303,7 @@
      PTR data;
      asection * input_section;
      bfd * output_bfd;
-     char ** error_message;
+     char ** error_message ATTRIBUTE_UNUSED;
 {
   /* This part is from bfd_elf_generic_reloc.  */
   if (output_bfd != (bfd *) NULL
@@ -339,7 +341,7 @@
      asection *input_section;
      bfd_byte *data;
      bfd_vma offset;
-     asection *symbol_section;
+     asection *symbol_section ATTRIBUTE_UNUSED;
      bfd_vma symbol_value;
      bfd_vma addend;
 {
@@ -403,13 +405,13 @@
 static bfd_reloc_status_type
 m32r_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
 		     input_section, output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_reloc_status_type ret;
   bfd_vma relocation;
@@ -498,9 +500,9 @@
    R_M32R_HI16_[SU]LO relocation described above.  */
 
 bfd_reloc_status_type
-m32r_elf_lo16_reloc (abfd, reloc_entry, symbol, data,
+m32r_elf_lo16_reloc (input_bfd, reloc_entry, symbol, data,
 		     input_section, output_bfd, error_message)
-     bfd *abfd;
+     bfd *input_bfd;
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
@@ -508,6 +510,17 @@
      bfd *output_bfd;
      char **error_message;
 {
+  /* This part is from bfd_elf_generic_reloc.
+     If we're relocating, and this an external symbol, we don't want
+     to change anything.  */
+  if (output_bfd != (bfd *) NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && reloc_entry->addend == 0)
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
   if (m32r_hi16_list != NULL)
     {
       struct m32r_hi16 *l;
@@ -523,8 +536,8 @@
 	  /* Do the HI16 relocation.  Note that we actually don't need
 	     to know anything about the LO16 itself, except where to
 	     find the low 16 bits of the addend needed by the LO16.  */
-	  insn = bfd_get_32 (abfd, l->addr);
-	  vallo = ((bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
+	  insn = bfd_get_32 (input_bfd, l->addr);
+	  vallo = ((bfd_get_32 (input_bfd, (bfd_byte *) data + reloc_entry->address)
 		   & 0xffff) ^ 0x8000) - 0x8000;
 	  val = ((insn & 0xffff) << 16) + vallo;
 	  val += l->addend;
@@ -534,7 +547,7 @@
 	    val += 0x10000;
 
 	  insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
-	  bfd_put_32 (abfd, insn, l->addr);
+	  bfd_put_32 (input_bfd, insn, l->addr);
 
 	  next = l->next;
 	  free (l);
@@ -544,11 +557,106 @@
       m32r_hi16_list = NULL;
     }
 
-  /* Now do the LO16 reloc in the usual way.  */
-  return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+  /* Now do the LO16 reloc in the usual way.
+     ??? It would be nice to call bfd_elf_generic_reloc here,
+     but we have partial_inplace == TRUE.  bfd_elf_generic_reloc will
+     pass the handling back to bfd_install_relocation which will install
+     a section relative addend which is wrong.  */
+  return m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data,
 				input_section, output_bfd, error_message);
 }
 
+/* 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,
+		     input_section, output_bfd, error_message)
+     bfd *input_bfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  bfd_reloc_status_type ret;
+  bfd_vma relocation;
+  bfd_byte *inplace_address;
+
+  /* This part is from bfd_elf_generic_reloc.
+     If we're relocating, and this an external symbol, we don't want
+     to change anything.  */
+  if (output_bfd != (bfd *) NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && reloc_entry->addend == 0)
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  /* Now do the the reloc in the usual way.
+     ??? It would be nice to call bfd_elf_generic_reloc here,
+     but we have partial_inplace == TRUE.  bfd_elf_generic_reloc will
+     pass the handling back to bfd_install_relocation which will install
+     a section relative addend which is wrong.  */
+
+  /* Sanity check the address (offset in section).  */
+  if (reloc_entry->address > input_section->_cooked_size)
+    return bfd_reloc_outofrange;
+
+  ret = bfd_reloc_ok;
+  if (bfd_is_und_section (symbol->section)
+      && output_bfd == (bfd *) NULL)
+    ret = bfd_reloc_undefined;
+
+  if (bfd_is_com_section (symbol->section)
+      || output_bfd != (bfd *) NULL)
+    relocation = 0;
+  else
+    relocation = symbol->value;
+
+  /* Only do this for a final link.  */
+  if (output_bfd == (bfd *) NULL)
+    {
+      relocation += symbol->section->output_section->vma;
+      relocation += symbol->section->output_offset;
+    }
+
+  relocation += reloc_entry->addend;
+  inplace_address = data + reloc_entry->address;
+
+#define DOIT(x) 					\
+  x = ( (x & ~reloc_entry->howto->dst_mask) | 		\
+  (((x & reloc_entry->howto->src_mask) +  relocation) &	\
+  reloc_entry->howto->dst_mask))
+
+  switch (reloc_entry->howto->size)
+    {
+    case 1:
+      {
+	short x = bfd_get_16 (input_bfd, inplace_address);
+	DOIT (x);
+      	bfd_put_16 (input_bfd, x, inplace_address);
+      }
+      break;
+    case 2:
+      {
+	unsigned long x = bfd_get_32 (input_bfd, inplace_address);
+	DOIT (x);
+      	bfd_put_32 (input_bfd, x, inplace_address);
+      }
+      break;
+    default:
+      BFD_ASSERT (0);
+    }
+
+  if (output_bfd != (bfd *) NULL)
+    reloc_entry->address += input_section->output_offset;
+
+  return ret;
+}
+
 /* Handle the R_M32R_SDA16 reloc.
    This reloc is used to compute the address of objects in the small data area
    and to perform loads and stores from that area.
@@ -558,13 +666,13 @@
 static bfd_reloc_status_type
 m32r_elf_sda16_reloc (abfd, reloc_entry, symbol, data,
 		      input_section, output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* This part is from bfd_elf_generic_reloc.  */
   if (output_bfd != (bfd *) NULL
@@ -614,7 +722,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;
@@ -634,7 +742,7 @@
 
 static void
 m32r_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
@@ -650,8 +758,8 @@
 
 boolean
 _bfd_m32r_elf_section_from_bfd_section (abfd, hdr, sec, retval)
-     bfd *abfd;
-     Elf32_Internal_Shdr *hdr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
      asection *sec;
      int *retval;
 {
@@ -677,7 +785,7 @@
 
 void
 _bfd_m32r_elf_symbol_processing (abfd, asym)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asymbol *asym;
 {
   elf_symbol_type *elfsym;
@@ -717,7 +825,7 @@
      struct bfd_link_info *info;
      const Elf_Internal_Sym *sym;
      const char **namep;
-     flagword *flagsp;
+     flagword *flagsp ATTRIBUTE_UNUSED;
      asection **secp;
      bfd_vma *valp;
 {
@@ -850,7 +958,7 @@
 static boolean
 m32r_elf_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;
@@ -1018,7 +1126,7 @@
 		{
 		  if (! ((*info->callbacks->undefined_symbol)
 			 (info, h->root.root.string, input_bfd,
-			  input_section, offset)))
+			  input_section, offset, true)))
 		    return false;
 		  relocation = 0;
 		}
@@ -1149,7 +1257,7 @@
 	    case bfd_reloc_undefined:
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, name, input_bfd, input_section,
-		      offset)))
+		      offset, true)))
 		return false;
 	      break;
 
@@ -1793,6 +1901,7 @@
     {
     default:
     case E_M32R_ARCH:   (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r);  break;
+    case E_M32RX_ARCH:  (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break;
     }
   return true;
 }
@@ -1801,7 +1910,7 @@
 static void
 m32r_elf_final_write_processing (abfd, linker)
      bfd *   abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   unsigned long val;
 
@@ -1809,6 +1918,7 @@
     {
     default:
     case bfd_mach_m32r:  val = E_M32R_ARCH; break;
+    case bfd_mach_m32rx: val = E_M32RX_ARCH; break;
     }
 
   elf_elfheader (abfd)->e_flags &=~ EF_M32R_ARCH;
@@ -1926,6 +2036,7 @@
     {
     default:
     case E_M32R_ARCH:  fprintf (file, _(": m32r instructions"));  break;
+    case E_M32RX_ARCH: fprintf (file, _(": m32rx instructions")); break;
     }
   
   fputc ('\n', file);
@@ -1936,7 +2047,7 @@
 asection *
 m32r_elf_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;
@@ -1958,6 +2069,9 @@
  
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -1976,10 +2090,10 @@
 
 static boolean
 m32r_elf_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 m32r */
   return true;
@@ -2049,7 +2163,7 @@
 
 #define ELF_ARCH		bfd_arch_m32r
 #define ELF_MACHINE_CODE	EM_CYGNUS_M32R
-#define ELF_MAXPAGESIZE		0x1000
+#define ELF_MAXPAGESIZE		0x1 /* Explicitly requested by Mitsubishi.  */
 
 #define TARGET_BIG_SYM          bfd_elf32_m32r_vec
 #define TARGET_BIG_NAME		"elf32-m32r"
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 2d0aba2..cc62230 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -43,8 +43,6 @@
 	   const Elf_Internal_Rela *));
 static boolean elf_m68k_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf_m68k_adjust_dynindx
-  PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_m68k_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static boolean elf_m68k_relocate_section
@@ -56,6 +54,15 @@
 static boolean elf_m68k_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
+static boolean elf32_m68k_set_private_flags
+  PARAMS ((bfd *, flagword));
+static boolean elf32_m68k_copy_private_bfd_data
+  PARAMS ((bfd *, bfd *));
+static boolean elf32_m68k_merge_private_bfd_data
+  PARAMS ((bfd *, bfd *));
+static boolean elf32_m68k_print_private_bfd_data
+  PARAMS ((bfd *, PTR));
+
 static reloc_howto_type howto_table[] = {
   HOWTO(R_68K_NONE,       0, 0, 0, false,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_NONE",      false, 0, 0x00000000,false),
   HOWTO(R_68K_32,         0, 2,32, false,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_32",        false, 0, 0xffffffff,false),
@@ -112,7 +119,7 @@
 
 static void
 rtype_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf_Internal_Rela *dst;
 {
@@ -157,7 +164,7 @@
 
 static reloc_howto_type *
 reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -211,6 +218,33 @@
   0, 0, 0, 0		  /* replaced with offset to start of .plt.  */
 };
 
+#define CPU32_FLAG(abfd)  (elf_elfheader (abfd)->e_flags & EF_CPU32)
+
+#define PLT_CPU32_ENTRY_SIZE 24
+/* 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 */
+  0, 0, 0, 0,             /* replaced with offset to .got + 4.  */
+  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
+};
+
+static const bfd_byte elf_cpu32_plt_entry[PLT_CPU32_ENTRY_SIZE] =
+{
+  0x22, 0x7b, 0x01, 0x70,  /* moveal %pc@(0xc), %a1 */
+  0, 0, 0, 0,              /* replaced with offset to symbol's .got entry.  */
+  0x4e, 0xd1,              /* jmp %a1@ */
+  0x2f, 0x3c,              /* move.l #offset,-(%sp) */
+  0, 0, 0, 0,              /* replaced with offset into relocation table.  */
+  0x60, 0xff,              /* bra.l .plt */
+  0, 0, 0, 0,              /* replaced with offset to start of .plt.  */
+  0, 0
+};
+
 /* The m68k 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
@@ -320,6 +354,88 @@
   return &ret->root.root;
 }
 
+/* Keep m68k-specific flags in the ELF header */
+static boolean
+elf32_m68k_set_private_flags (abfd, flags)
+     bfd *abfd;
+     flagword flags;
+{
+  elf_elfheader (abfd)->e_flags = flags;
+  elf_flags_init (abfd) = true;
+  return true;
+}
+
+/* Copy m68k-specific data from one module to another */
+static boolean
+elf32_m68k_copy_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  flagword in_flags;
+
+  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;
+}
+
+/* Merge backend specific data from an object file to the output
+   object file when linking.  */
+static boolean
+elf32_m68k_merge_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  flagword out_flags;
+  flagword in_flags;
+
+  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;
+  out_flags = elf_elfheader (obfd)->e_flags;
+
+  if (!elf_flags_init (obfd))
+    {
+      elf_flags_init (obfd) = true;
+      elf_elfheader (obfd)->e_flags = in_flags;
+    }
+
+  return true;
+}
+
+/* Display the flags field */
+static boolean
+elf32_m68k_print_private_bfd_data (abfd, ptr)
+     bfd *abfd;
+     PTR ptr;
+{
+  FILE *file = (FILE *) ptr;
+
+  BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+  /* Print normal ELF private data.  */
+  _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+  /* 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);
+
+  if (elf_elfheader (abfd)->e_flags & EF_CPU32)
+    fprintf (file, _ (" [cpu32]"));
+
+  fputc ('\n', file);
+
+  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.  */
@@ -673,7 +789,7 @@
 static asection *
 elf_m68k_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;
@@ -731,8 +847,8 @@
   unsigned long r_symndx;
   struct elf_link_hash_entry *h;
   bfd *dynobj;
-  asection *sgot;
-  asection *srelgot;
+  asection *sgot = NULL;
+  asection *srelgot = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
@@ -890,7 +1006,12 @@
       /* 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 (CPU32_FLAG (dynobj))
+	    s->_raw_size += PLT_CPU32_ENTRY_SIZE;
+	  else
+	    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
@@ -907,7 +1028,10 @@
       h->plt.offset = s->_raw_size;
 
       /* Make room for this entry.  */
-      s->_raw_size += PLT_ENTRY_SIZE;
+      if (CPU32_FLAG (dynobj))
+        s->_raw_size += PLT_CPU32_ENTRY_SIZE;
+      else
+        s->_raw_size += PLT_ENTRY_SIZE;
 
       /* We also need to make an entry in the .got.plt section, which
 	 will be placed in the .got section by the linker script.  */
@@ -1138,7 +1262,7 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
@@ -1186,51 +1310,6 @@
 	}
     }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section for which we might need to copy
-     relocs.  These are local symbols, which means that they must come
-     first in the dynamic symbol table.  That means we must increment
-     the dynamic symbol index of every other dynamic symbol.  */
-  if (info->shared)
-    {
-      int c;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  if ((s->flags & SEC_LINKER_CREATED) != 0
-	      || (s->flags & SEC_ALLOC) == 0)
-	    continue;
-
-	  elf_section_data (s)->dynindx = c + 1;
-
-	  /* These symbols will have no names, so we don't need to
-             fiddle with dynstr_index.  */
-
-	  ++c;
-	}
-
-      elf_link_hash_traverse (elf_hash_table (info),
-			      elf_m68k_adjust_dynindx,
-			      (PTR) &c);
-      elf_hash_table (info)->dynsymcount += c;
-    }
-
-  return true;
-}
-
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-elf_m68k_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  int *cp = (int *) cparg;
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
   return true;
 }
 
@@ -1244,7 +1323,7 @@
 static boolean
 elf_m68k_discard_copies (h, ignore)
      struct elf_m68k_link_hash_entry *h;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf_m68k_pcrel_relocs_copied *s;
 
@@ -1406,7 +1485,8 @@
 	    {
 	      if (!(info->callbacks->undefined_symbol
 		    (info, h->root.root.string, input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset,
+		     (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
@@ -1776,6 +1856,7 @@
      Elf_Internal_Sym *sym;
 {
   bfd *dynobj;
+  int plt_off1, plt_off2, plt_off3;
 
   dynobj = elf_hash_table (info)->dynobj;
 
@@ -1802,16 +1883,35 @@
 	 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 / PLT_ENTRY_SIZE - 1;
+      if ( CPU32_FLAG (output_bfd))
+        plt_index = h->plt.offset / PLT_CPU32_ENTRY_SIZE - 1;
+      else
+        plt_index = h->plt.offset / PLT_ENTRY_SIZE - 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.  */
-      memcpy (splt->contents + h->plt.offset, elf_m68k_plt_entry,
-	      PLT_ENTRY_SIZE);
+      if ( CPU32_FLAG (output_bfd))
+        {
+          /* Fill in the entry in the procedure linkage table.  */
+          memcpy (splt->contents + h->plt.offset, elf_cpu32_plt_entry,
+	          PLT_CPU32_ENTRY_SIZE);
+          plt_off1 = 4;
+          plt_off2 = 12;
+          plt_off3 = 18;
+        }
+      else
+        {
+          /* Fill in the entry in the procedure linkage table.  */
+          memcpy (splt->contents + h->plt.offset, elf_m68k_plt_entry,
+	          PLT_ENTRY_SIZE);
+          plt_off1 = 4;
+          plt_off2 = 10;
+          plt_off3 = 16;
+        }
+
       /* The offset is relative to the first extension word.  */
       bfd_put_32 (output_bfd,
 		  (sgot->output_section->vma
@@ -1819,12 +1919,12 @@
 		   + got_offset
 		   - (splt->output_section->vma
 		      + h->plt.offset + 2)),
-		  splt->contents + h->plt.offset + 4);
+		  splt->contents + h->plt.offset + plt_off1);
 
       bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
-		  splt->contents + h->plt.offset + 10);
-      bfd_put_32 (output_bfd, - (h->plt.offset + 16),
-		  splt->contents + h->plt.offset + 16);
+		  splt->contents + h->plt.offset + plt_off2);
+      bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3),
+		  splt->contents + h->plt.offset + plt_off3);
 
       /* Fill in the entry in the global offset table.  */
       bfd_put_32 (output_bfd,
@@ -2017,21 +2117,39 @@
       /* Fill in the first entry in the procedure linkage table.  */
       if (splt->_raw_size > 0)
 	{
-	  memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE);
-	  bfd_put_32 (output_bfd,
-		      (sgot->output_section->vma
-		       + sgot->output_offset + 4
-		       - (splt->output_section->vma + 2)),
-		      splt->contents + 4);
-	  bfd_put_32 (output_bfd,
-		      (sgot->output_section->vma
-		       + sgot->output_offset + 8
-		       - (splt->output_section->vma + 10)),
-		      splt->contents + 12);
+          if (!CPU32_FLAG (output_bfd))
+            {
+	      memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE);
+	      bfd_put_32 (output_bfd,
+		          (sgot->output_section->vma
+		           + sgot->output_offset + 4
+		           - (splt->output_section->vma + 2)),
+		          splt->contents + 4);
+	      bfd_put_32 (output_bfd,
+		          (sgot->output_section->vma
+		           + sgot->output_offset + 8
+		           - (splt->output_section->vma + 10)),
+		          splt->contents + 12);
+              elf_section_data (splt->output_section)->this_hdr.sh_entsize 
+               = PLT_ENTRY_SIZE;
+            }
+          else /* cpu32 */
+            {
+              memcpy (splt->contents, elf_cpu32_plt0_entry, PLT_CPU32_ENTRY_SIZE);
+	      bfd_put_32 (output_bfd,
+		          (sgot->output_section->vma
+		           + sgot->output_offset + 4
+		           - (splt->output_section->vma + 2)),
+		          splt->contents + 4);
+	      bfd_put_32 (output_bfd,
+		          (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 
+               = PLT_CPU32_ENTRY_SIZE;
+            }
 	}
-
-      elf_section_data (splt->output_section)->this_hdr.sh_entsize
-	= PLT_ENTRY_SIZE;
     }
 
   /* Fill in the first three entries in the global offset table.  */
@@ -2049,50 +2167,6 @@
 
   elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int c;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx;
-
-	  if (elf_section_data (s)->dynindx == 0)
-	    continue;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  BFD_ASSERT (indx > 0);
-	  sym.st_shndx = indx;
-
-	  bfd_elf32_swap_symbol_out (output_bfd, &sym,
-				     (PTR) (((Elf32_External_Sym *)
-					     sdynsym->contents)
-					    + elf_section_data (s)->dynindx));
-
-	  ++c;
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
-    }
-
   return true;
 }
 
@@ -2118,11 +2192,19 @@
 					elf_m68k_finish_dynamic_sections
 #define elf_backend_gc_mark_hook	elf_m68k_gc_mark_hook
 #define elf_backend_gc_sweep_hook	elf_m68k_gc_sweep_hook
+#define bfd_elf32_bfd_copy_private_bfd_data \
+                                        elf32_m68k_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data \
+                                        elf32_m68k_merge_private_bfd_data
+#define bfd_elf32_bfd_set_private_flags \
+                                        elf32_m68k_set_private_flags
+#define bfd_elf32_bfd_print_private_bfd_data \
+                                        elf32_m68k_print_private_bfd_data
+
 #define elf_backend_can_gc_sections 1
 #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-m88k.c b/bfd/elf32-m88k.c
index f3c535e..20de22a 100644
--- a/bfd/elf32-m88k.c
+++ b/bfd/elf32-m88k.c
@@ -29,6 +29,7 @@
 #define TARGET_BIG_NAME		"elf32-m88k"
 #define ELF_ARCH		bfd_arch_m88k
 #define ELF_MACHINE_CODE	EM_88K
+#define ELF_MAXPAGESIZE  	1 /* FIXME: This number is wrong,  It should be the page size in bytes.  */
 #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
 #define elf_info_to_howto		_bfd_elf_no_info_to_howto
 
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index ef3a39f..5963a9e 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -1,4 +1,4 @@
-/* Motorolla MCore specific support for 32-bit ELF
+/* Motorola MCore specific support for 32-bit ELF
    Copyright 1994, 1995, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -57,16 +57,16 @@
   HOWTO (R_MCORE_NONE,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 1,			/* bitsize */
-	 true,			/* pc_relative */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield,  /* complain_on_overflow */
-	 mcore_elf_unsupported_reloc, /* special_function */
+	 NULL,                  /* special_function */
 	 "R_MCORE_NONE",	/* name */
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 true),			/* pcrel_offset */
+	 false),		/* pcrel_offset */
 
   /* A standard 32 bit relocation.  */
   HOWTO (R_MCORE_ADDR32,	/* type */
@@ -196,6 +196,20 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
+  
+  HOWTO (R_MCORE_RELATIVE,      /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 NULL,                  /* special_function */
+	 "R_MCORE_RELATIVE",    /* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false)			/* pcrel_offset */
 };
 
 #ifndef NUM_ELEM
@@ -223,7 +237,7 @@
 
 static reloc_howto_type *
 mcore_elf_reloc_type_lookup (abfd, code)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   enum elf_mcore_reloc_type mcore_reloc = R_MCORE_NONE;
@@ -239,6 +253,7 @@
     case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2: mcore_reloc = R_MCORE_PCRELJSR_IMM11BY2; break;
     case BFD_RELOC_VTABLE_INHERIT:           mcore_reloc = R_MCORE_GNU_VTINHERIT; break;
     case BFD_RELOC_VTABLE_ENTRY:             mcore_reloc = R_MCORE_GNU_VTENTRY; break;
+    case BFD_RELOC_RVA:                      mcore_reloc = R_MCORE_RELATIVE; break;
     default:
       return (reloc_howto_type *)NULL;
     }
@@ -252,7 +267,7 @@
 /* Set the howto pointer for a RCE ELF reloc.  */
 static void
 mcore_elf_info_to_howto (abfd, cache_ptr, dst)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      arelent * cache_ptr;
      Elf32_Internal_Rela * dst;
 {
@@ -305,7 +320,6 @@
 {
   flagword old_flags;
   flagword new_flags;
-  boolean error;
 
   /* Check if we have the same endianess */
   if (   ibfd->xvec->byteorder != obfd->xvec->byteorder
@@ -335,7 +349,11 @@
     }
   else if (new_flags == old_flags)	/* Compatible flags are ok */
     ;
-  
+  else
+    {
+      /* FIXME */
+    }
+
   return true;
 }
 
@@ -348,11 +366,11 @@
 			   output_bfd, error_message)
      bfd * abfd;
      arelent * reloc_entry;
-     asymbol * symbol;
-     PTR data;
-     asection * input_section;
-     bfd * output_bfd;
-     char ** error_message;
+     asymbol * symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection * input_section ATTRIBUTE_UNUSED;
+     bfd * output_bfd ATTRIBUTE_UNUSED;
+     char ** error_message ATTRIBUTE_UNUSED;
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
   
@@ -397,7 +415,7 @@
 static boolean
 mcore_elf_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;
@@ -411,7 +429,6 @@
   Elf_Internal_Rela *           rel = relocs;
   Elf_Internal_Rela *           relend = relocs + input_section->reloc_count;
   boolean ret = true;
-  long insn;
 
 #ifdef DEBUG
   fprintf (stderr,
@@ -437,7 +454,7 @@
       Elf_Internal_Sym *           sym = (Elf_Internal_Sym *) 0;
       unsigned long                r_symndx;
       struct elf_link_hash_entry * h = (struct elf_link_hash_entry *) 0;
-      unsigned short               oldinst;
+      unsigned short               oldinst = 0;
       
       /* Unknown relocation handling */
       if ((unsigned) r_type >= (unsigned) R_MCORE_max
@@ -521,7 +538,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 			(info, h->root.root.string, input_bfd,
-		 	 input_section, rel->r_offset)))
+		 	 input_section, rel->r_offset, true)))
 		return false;
 
 	      ret = false;
@@ -532,9 +549,6 @@
       switch (r_type)
 	{
 	default:
-	case R_MCORE_PCRELIMM8BY4:	
-	case R_MCORE_PCRELIMM11BY2:
-	case R_MCORE_PCRELIMM4BY2:
 	  break;
 
 	case R_MCORE_PCRELJSR_IMM11BY2:
@@ -609,7 +623,7 @@
 static asection *
 mcore_elf_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;
@@ -631,6 +645,9 @@
 	      
 	    case bfd_link_hash_common:
 	      return h->root.u.c.p->section;
+
+	    default:
+	      break;
 	    }
 	}
     }
@@ -652,10 +669,10 @@
 
 static boolean
 mcore_elf_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;
 {
   return true;
 }
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9f03262..d91bab9 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -3,6 +3,8 @@
 
    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>
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -41,116 +43,260 @@
 #define ECOFF_32
 #include "ecoffswap.h"
 
-static bfd_reloc_status_type mips32_64bit_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
-  PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void mips_info_to_howto_rel
-  PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
-static void bfd_mips_elf32_swap_gptab_in
-  PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *));
-static void bfd_mips_elf32_swap_gptab_out
-  PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
-static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
-static boolean mips_elf32_object_p PARAMS ((bfd *));
-static boolean mips_elf_create_procedure_table
-  PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *,
-	   struct ecoff_debug_info *));
-static int mips_elf_additional_program_headers PARAMS ((bfd *));
-static boolean mips_elf_modify_segment_map PARAMS ((bfd *));
-static INLINE int elf_mips_isa PARAMS ((flagword));
-static INLINE int elf_mips_mach PARAMS ((flagword));
-static INLINE char* elf_mips_abi_name PARAMS ((flagword));
-static boolean mips_elf32_section_from_shdr
-  PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
-static boolean mips_elf32_section_processing
-  PARAMS ((bfd *, Elf32_Internal_Shdr *));
-static boolean mips_elf_is_local_label_name
-  PARAMS ((bfd *, const char *));
-static struct bfd_hash_entry *mips_elf_link_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *mips_elf_link_hash_table_create
-  PARAMS ((bfd *));
-static int gptab_compare PARAMS ((const void *, const void *));
-static boolean mips_elf_final_link
-  PARAMS ((bfd *, struct bfd_link_info *));
-static void mips_elf_relocate_hi16
-  PARAMS ((bfd *, Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_byte *,
-	   bfd_vma));
-static boolean mips_elf_relocate_got_local
-  PARAMS ((bfd *, bfd *, asection *, Elf_Internal_Rela *,
-	   Elf_Internal_Rela *, bfd_byte *, bfd_vma));
-static void mips_elf_relocate_global_got
-   PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
-static bfd_reloc_status_type mips16_jump_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips16_gprel_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean mips_elf_adjust_dynindx
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean mips_elf_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean mips_elf_link_output_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
-	   asection *));
-static boolean mips_elf_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_create_compact_rel_section
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_create_got_section
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_check_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-	   const Elf_Internal_Rela *));
-static boolean mips_elf_adjust_dynamic_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean mips_elf_always_size_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_finish_dynamic_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
-	   Elf_Internal_Sym *));
-static boolean mips_elf_finish_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf_add_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
-	   const char **, flagword *, asection **, bfd_vma *));
-static bfd_reloc_status_type mips_elf_final_gp
-  PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
-static bfd_byte *elf32_mips_get_relocated_section_contents
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
-	   bfd_byte *, boolean, asymbol **));
-
-/* This is true for Irix 5 executables, false for normal MIPS ELF ABI
-   executables.  FIXME: At the moment, we default to always generating
-   Irix 5 executables.  */
-
-#define SGI_COMPAT(abfd) (1)
-
 /* This structure is used to hold .got information when linking.  It
    is stored in the tdata field of the bfd_elf_section_data structure.  */
 
 struct mips_got_info
 {
-  /* The symbol index of the first global .got symbol.  */
-  unsigned long global_gotsym;
+  /* The global symbol in the GOT with the lowest index in the dynamic
+     symbol table.  */
+  struct elf_link_hash_entry *global_gotsym;
+  /* The number of global .got entries.  */
+  unsigned int global_gotno;
   /* The number of local .got entries.  */
   unsigned int local_gotno;
   /* The number of local .got entries we have used.  */
   unsigned int assigned_gotno;
 };
 
+/* The MIPS ELF linker needs additional information for each symbol in
+   the global hash table.  */
+
+struct mips_elf_link_hash_entry
+{
+  struct elf_link_hash_entry root;
+
+  /* External symbol information.  */
+  EXTR esym;
+
+  /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
+     this symbol.  */ 
+  unsigned int possibly_dynamic_relocs;
+
+  /* The index of the first dynamic relocation (in the .rel.dyn
+     section) against this symbol.  */
+  unsigned int min_dyn_reloc_index;
+
+  /* If there is a stub that 32 bit functions should use to call this
+     16 bit function, this points to the section containing the stub.  */
+  asection *fn_stub;
+
+  /* Whether we need the fn_stub; this is set if this symbol appears
+     in any relocs other than a 16 bit call.  */
+  boolean need_fn_stub;
+
+  /* If there is a stub that 16 bit functions should use to call this
+     32 bit function, this points to the section containing the stub.  */
+  asection *call_stub;
+
+  /* This is like the call_stub field, but it is used if the function
+     being called returns a floating point value.  */
+  asection *call_fp_stub;
+};
+
+static bfd_reloc_status_type mips32_64bit_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static reloc_howto_type *mips_rtype_to_howto
+  PARAMS ((unsigned int));
+static void mips_info_to_howto_rel
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+static void mips_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static void bfd_mips_elf32_swap_gptab_in
+  PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *));
+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 
+  PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *));
+#endif
+static void bfd_mips_elf_swap_msym_out
+  PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *));
+static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
+static boolean mips_elf_create_procedure_table
+  PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *,
+	   struct ecoff_debug_info *));
+static INLINE int elf_mips_isa PARAMS ((flagword));
+static INLINE int elf_mips_mach PARAMS ((flagword));
+static INLINE char* elf_mips_abi_name PARAMS ((bfd *));
+static boolean mips_elf_is_local_label_name
+  PARAMS ((bfd *, const char *));
+static struct bfd_hash_entry *mips_elf_link_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static int gptab_compare PARAMS ((const void *, const void *));
+static bfd_reloc_status_type mips16_jump_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips16_gprel_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static boolean mips_elf_create_compact_rel_section
+  PARAMS ((bfd *, struct bfd_link_info *));
+static boolean mips_elf_create_got_section
+  PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_reloc_status_type mips_elf_final_gp
+  PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
+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 
+  PARAMS ((bfd *));
+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));
+static bfd_vma mips_elf_high PARAMS ((bfd_vma));
+static bfd_vma mips_elf_higher PARAMS ((bfd_vma));
+static bfd_vma mips_elf_highest PARAMS ((bfd_vma));
+static bfd_vma mips_elf_global_got_index
+  PARAMS ((bfd *, struct elf_link_hash_entry *));
+static bfd_vma mips_elf_local_got_index
+  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 
+  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 *, 
+	   const Elf_Internal_Rela *));
+static bfd_reloc_status_type mips_elf_calculate_relocation
+  PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *,
+	   const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *,
+	   Elf_Internal_Sym *, asection **, bfd_vma *, const char **,
+	   boolean *));
+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 *, 
+	   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 
+  PARAMS ((struct mips_elf_link_hash_entry *, PTR));
+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 
+  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 *, 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 
+  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 
+  PARAMS ((bfd *, unsigned int));
+static boolean mips_elf_stub_section_p 
+  PARAMS ((bfd *, asection *));
+
+/* The level of IRIX compatibility we're striving for.  */
+
+typedef enum {
+  ict_none,
+  ict_irix5,
+  ict_irix6
+} irix_compat_t;
+
+/* Nonzero if ABFD is using the N32 ABI.  */
+
+#define ABI_N32_P(abfd) \
+  ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
+
+/* Nonzero if ABFD is using the 64-bit ABI.  FIXME: This is never
+   true, yet.  */
+#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.  */
+
+#define IRIX_COMPAT(abfd) \
+  ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)
+
+/* Whether we are trying to be compatible with IRIX at all.  */
+
+#define SGI_COMPAT(abfd) \
+  (IRIX_COMPAT (abfd) != ict_none)
+
+/* The name of the msym section.  */
+#define MIPS_ELF_MSYM_SECTION_NAME(abfd) ".msym"
+
+/* The name of the srdata section.  */
+#define MIPS_ELF_SRDATA_SECTION_NAME(abfd) ".srdata"
+
+/* The name of the options section.  */
+#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \
+  (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.options" : ".options")
+
+/* The name of the stub section.  */
+#define MIPS_ELF_STUB_SECTION_NAME(abfd) \
+  (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.stubs" : ".stub")
+
+/* The name of the dynamic relocation section.  */
+#define MIPS_ELF_REL_DYN_SECTION_NAME(abfd) ".rel.dyn"
+
+/* The size of an external REL relocation.  */
+#define MIPS_ELF_REL_SIZE(abfd) \
+  (get_elf_backend_data (abfd)->s->sizeof_rel)
+
+/* The size of an external dynamic table entry.  */
+#define MIPS_ELF_DYN_SIZE(abfd) \
+  (get_elf_backend_data (abfd)->s->sizeof_dyn)
+
+/* The size of a GOT entry.  */
+#define MIPS_ELF_GOT_SIZE(abfd) \
+  (get_elf_backend_data (abfd)->s->arch_size / 8)
+
+/* The size of a symbol-table entry.  */
+#define MIPS_ELF_SYM_SIZE(abfd) \
+  (get_elf_backend_data (abfd)->s->sizeof_sym)
+
+/* The default alignment for sections, as a power of two.  */
+#define MIPS_ELF_LOG_FILE_ALIGN(abfd)				\
+  (get_elf_backend_data (abfd)->s->file_align == 8 ? 3 : 2)
+
+/* Get word-sized data.  */
+#define MIPS_ELF_GET_WORD(abfd, ptr) \
+  (ABI_64_P (abfd) ? bfd_get_64 (abfd, ptr) : bfd_get_32 (abfd, ptr))
+
+/* Put out word-sized data.  */
+#define MIPS_ELF_PUT_WORD(abfd, val, ptr)	\
+  (ABI_64_P (abfd) 				\
+   ? bfd_put_64 (abfd, val, ptr) 		\
+   : bfd_put_32 (abfd, val, ptr))
+
+/* Add a dynamic symbol table-entry.  */
+#ifdef BFD64
+#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+  (ABI_64_P (elf_hash_table (info)->dynobj)	   \
+   ? bfd_elf64_add_dynamic_entry (info, tag, val)  \
+   : bfd_elf32_add_dynamic_entry (info, tag, val))
+#else
+#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+  (ABI_64_P (elf_hash_table (info)->dynobj)	   \
+   ? (abort (), false)                             \
+   : bfd_elf32_add_dynamic_entry (info, tag, val))
+#endif
+
 /* The number of local .got entries we reserve.  */
 #define MIPS_RESERVED_GOTNO (2)
 
 /* Instructions which appear in a stub.  For some reason the stub is
    slightly different on an SGI system.  */
 #define ELF_MIPS_GP_OFFSET(abfd) (SGI_COMPAT (abfd) ? 0x7ff0 : 0x8000)
-#define STUB_LW(abfd)					\
-  (SGI_COMPAT (abfd)					\
-   ? 0x8f998010			/* lw t9,0x8010(gp) */	\
+#define STUB_LW(abfd)						\
+  (SGI_COMPAT (abfd)						\
+   ? (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 */
@@ -297,6 +443,10 @@
 
 #define USE_REL	1		/* MIPS uses REL relocations instead of RELA */
 
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
+   from smaller values.  Start with zero, widen, *then* decrement.  */
+#define MINUS_ONE	(((bfd_vma)0) - 1)
+
 static reloc_howto_type elf_mips_howto_table[] =
 {
   /* No relocation.  */
@@ -448,7 +598,7 @@
 	 _bfd_mips_elf_got16_reloc,	/* special_function */
 	 "R_MIPS_GOT16",	/* name */
 	 false,			/* partial_inplace */
-	 0,			/* src_mask */
+	 0xffff,		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
@@ -465,10 +615,9 @@
 	 true,			/* partial_inplace */
 	 0xffff,		/* src_mask */
 	 0xffff,		/* dst_mask */
-	 false),		/* pcrel_offset */
+	 true),			/* pcrel_offset */
 
   /* 16 bit call through global offset table.  */
-  /* FIXME: This is not handled correctly.  */
   HOWTO (R_MIPS_CALL16,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -479,7 +628,7 @@
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_MIPS_CALL16",	/* name */
 	 false,			/* partial_inplace */
-	 0,			/* src_mask */
+	 0xffff,		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
@@ -500,9 +649,9 @@
 
     /* The remaining relocs are defined on Irix 5, although they are
        not defined by the ABI.  */
-    { 13 },
-    { 14 },
-    { 15 },
+    EMPTY_HOWTO (13),
+    EMPTY_HOWTO (14),
+    EMPTY_HOWTO (15),
 
   /* A 5 bit shift field.  */
   HOWTO (R_MIPS_SHIFT5,		/* type */
@@ -536,26 +685,22 @@
 	 0x000007c4,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* A 64 bit relocation.  This is used in 32 bit ELF when addresses
-     are 64 bits long; the upper 32 bits are simply a sign extension.
-     The fields of the howto should be the same as for R_MIPS_32,
-     other than the type, name, and special_function.  */
+  /* A 64 bit relocation.  */
   HOWTO (R_MIPS_64,		/* type */
 	 0,			/* rightshift */
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 32,			/* bitsize */
+	 4,			/* size (0 = byte, 1 = short, 2 = long) */
+	 64,			/* bitsize */
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
 	 mips32_64bit_reloc,	/* special_function */
 	 "R_MIPS_64",		/* name */
 	 true,			/* partial_inplace */
-	 0xffffffff,		/* src_mask */
-	 0xffffffff,		/* dst_mask */
+	 MINUS_ONE,		/* src_mask */
+	 MINUS_ONE,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
   /* Displacement in the global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_GOT_DISP,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -571,7 +716,6 @@
 	 false),		/* pcrel_offset */
 
   /* Displacement to page pointer in the global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_GOT_PAGE,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -587,7 +731,6 @@
 	 false),		/* pcrel_offset */
 
   /* Offset from page pointer in the global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_GOT_OFST,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -603,7 +746,6 @@
 	 false),		/* pcrel_offset */
 
   /* High 16 bits of displacement in global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_GOT_HI16,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -619,7 +761,6 @@
 	 false),		/* pcrel_offset */
 
   /* Low 16 bits of displacement in global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_GOT_LO16,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -634,21 +775,57 @@
 	 0x0000ffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* 64 bit subtraction.  Presumably not used in 32 bit ELF.  */
-  { R_MIPS_SUB },
+  /* 64 bit subtraction.  Used in the N32 ABI.  */
+  HOWTO (R_MIPS_SUB,		/* type */
+	 0,			/* rightshift */
+	 4,			/* size (0 = byte, 1 = short, 2 = long) */
+	 64,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_SUB",		/* name */
+	 true,			/* partial_inplace */
+	 MINUS_ONE,		/* src_mask */
+	 MINUS_ONE,		/* dst_mask */
+	 false),		/* pcrel_offset */
 
   /* Used to cause the linker to insert and delete instructions?  */
-  { R_MIPS_INSERT_A },
-  { R_MIPS_INSERT_B },
-  { R_MIPS_DELETE },
+  EMPTY_HOWTO (R_MIPS_INSERT_A),
+  EMPTY_HOWTO (R_MIPS_INSERT_B),
+  EMPTY_HOWTO (R_MIPS_DELETE),
 
-  /* Get the higher values of a 64 bit addend.  Presumably not used in
-     32 bit ELF.  */
-  { R_MIPS_HIGHER },
-  { R_MIPS_HIGHEST },
+  /* Get the higher value of a 64 bit addend.  */
+  HOWTO (R_MIPS_HIGHER,		/* 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_MIPS_HIGHER",	/* name */
+	 true,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* Get the highest value of a 64 bit addend.  */
+  HOWTO (R_MIPS_HIGHEST,	/* 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_MIPS_HIGHEST",	/* name */
+	 true,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
 
   /* High 16 bits of displacement in global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_CALL_HI16,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -664,7 +841,6 @@
 	 false),		/* pcrel_offset */
 
   /* Low 16 bits of displacement in global offset table.  */
-  /* FIXME: Not handled correctly.  */
   HOWTO (R_MIPS_CALL_LO16,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -679,11 +855,41 @@
 	 0x0000ffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  { R_MIPS_SCN_DISP },
-  { R_MIPS_REL16 },
-  { R_MIPS_ADD_IMMEDIATE },
-  { R_MIPS_PJUMP },
-  { R_MIPS_RELGOT }
+  /* Section displacement.  */
+  HOWTO (R_MIPS_SCN_DISP,       /* 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_MIPS_SCN_DISP",     /* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  EMPTY_HOWTO (R_MIPS_REL16),
+  EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+  EMPTY_HOWTO (R_MIPS_PJUMP),
+  EMPTY_HOWTO (R_MIPS_RELGOT),
+
+  /* Protected jump conversion.  This is an optimization hint.  No 
+     relocation is required for correctness.  */
+  HOWTO (R_MIPS_JALR,	        /* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_JALR",	        /* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 false),		/* pcrel_offset */
 };
 
 /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link.  This
@@ -722,10 +928,7 @@
 	 0x3ffffff,		/* dst_mask */
 	 false);		/* pcrel_offset */
 
-/* The reloc used for the mips16 gprel instruction.  The src_mask and
-   dsk_mask for this howto do not reflect the actual instruction, in
-   which the value is not contiguous; the masks are for the
-   convenience of the relocate_section routine.  */
+/* The reloc used for the mips16 gprel instruction.  */
 static reloc_howto_type elf_mips16_gprel_howto =
   HOWTO (R_MIPS16_GPREL,	/* type */
 	 0,			/* rightshift */
@@ -737,11 +940,92 @@
 	 mips16_gprel_reloc,	/* special_function */
 	 "R_MIPS16_GPREL",	/* name */
 	 true,			/* partial_inplace */
-	 0xffff,		/* src_mask */
-	 0xffff,		/* dst_mask */
+	 0x07ff001f,		/* src_mask */
+	 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 =
+  HOWTO (R_MIPS_GNU_REL_HI16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_hi16_reloc,	/* special_function */
+	 "R_MIPS_GNU_REL_HI16",	/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+/* Low 16 bits of symbol value, pc-relative.  */
+static reloc_howto_type elf_mips_gnu_rel_lo16 =
+  HOWTO (R_MIPS_GNU_REL_LO16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_lo16_reloc,	/* special_function */
+	 "R_MIPS_GNU_REL_LO16",	/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+/* 16 bit offset for pc-relative branches.  */
+static reloc_howto_type elf_mips_gnu_rel16_s2 =
+  HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_GNU_REL16_S2",	/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+/* 64 bit pc-relative.  */
+static reloc_howto_type elf_mips_gnu_pcrel64 =
+  HOWTO (R_MIPS_PC64,		/* type */
+	 0,			/* rightshift */
+	 4,			/* size (0 = byte, 1 = short, 2 = long) */
+	 64,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_PC64",		/* name */
+	 true,			/* partial_inplace */
+	 MINUS_ONE,		/* src_mask */
+	 MINUS_ONE,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+/* 32 bit pc-relative.  */
+static reloc_howto_type elf_mips_gnu_pcrel32 =
+  HOWTO (R_MIPS_PC32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_PC32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
 /* GNU extension to record C++ vtable hierarchy */
 static reloc_howto_type elf_mips_gnu_vtinherit_howto =
   HOWTO (R_MIPS_GNU_VTINHERIT,	/* type */
@@ -802,7 +1086,7 @@
 		     input_section,
 		     output_bfd,
 		     error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
      PTR data;
@@ -1033,6 +1317,57 @@
   abort ();
 }
 
+/* Set the GP value for OUTPUT_BFD.  Returns false if this is a
+   dangerous relocation.  */
+
+static boolean
+mips_elf_assign_gp (output_bfd, pgp)
+     bfd *output_bfd;
+     bfd_vma *pgp;
+{
+  unsigned int count;
+  asymbol **sym;
+  unsigned int i;
+
+  /* If we've already figured out what GP will be, just return it.  */
+  *pgp = _bfd_get_gp_value (output_bfd);
+  if (*pgp)
+    return true;
+
+  count = bfd_get_symcount (output_bfd);
+  sym = bfd_get_outsymbols (output_bfd);
+
+  /* The linker script will have created a symbol named `_gp' with the
+     appropriate value.  */
+  if (sym == (asymbol **) NULL)
+    i = count;
+  else
+    {
+      for (i = 0; i < count; i++, sym++)
+	{
+	  register CONST char *name;
+
+	  name = bfd_asymbol_name (*sym);
+	  if (*name == '_' && strcmp (name, "_gp") == 0)
+	    {
+	      *pgp = bfd_asymbol_value (*sym);
+	      _bfd_set_gp_value (output_bfd, *pgp);
+	      break;
+	    }
+	}
+    }
+
+  if (i >= count)
+    {
+      /* Only get the error once.  */
+      *pgp = 4;
+      _bfd_set_gp_value (output_bfd, *pgp);
+      return false;
+    }
+
+  return true;
+}
+
 /* We have to figure out the gp value, so that we can adjust the
    symbol value correctly.  We look up the symbol _gp in the output
    BFD.  If we can't find it, we're stuck.  We cache it in the ELF
@@ -1065,42 +1400,11 @@
 	  *pgp = symbol->section->output_section->vma + 0x4000;
 	  _bfd_set_gp_value (output_bfd, *pgp);
 	}
-      else
+      else if (!mips_elf_assign_gp (output_bfd, pgp))
 	{
-	  unsigned int count;
-	  asymbol **sym;
-	  unsigned int i;
-
-	  count = bfd_get_symcount (output_bfd);
-	  sym = bfd_get_outsymbols (output_bfd);
-
-	  if (sym == (asymbol **) NULL)
-	    i = count;
-	  else
-	    {
-	      for (i = 0; i < count; i++, sym++)
-		{
-		  register CONST char *name;
-
-		  name = bfd_asymbol_name (*sym);
-		  if (*name == '_' && strcmp (name, "_gp") == 0)
-		    {
-		      *pgp = bfd_asymbol_value (*sym);
-		      _bfd_set_gp_value (output_bfd, *pgp);
-		      break;
-		    }
-		}
-	    }
-
-	  if (i >= count)
-	    {
-	      /* Only get the error once.  */
-	      *pgp = 4;
-	      _bfd_set_gp_value (output_bfd, *pgp);
-	      *error_message =
-		(char *) _("GP relative relocation when _gp not defined");
-	      return bfd_reloc_dangerous;
-	    }
+	  *error_message =
+	    (char *) _("GP relative relocation when _gp not defined");
+	  return bfd_reloc_dangerous;
 	}
     }
 
@@ -1385,13 +1689,13 @@
 static bfd_reloc_status_type
 mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section,
 		   output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0
@@ -1559,12 +1863,20 @@
   return 0;
 }
 
-/* Return printable name for ABI from flagword. */
+/* Return printable name for ABI. */
 
 static INLINE char*
-elf_mips_abi_name (flags)
-     flagword flags;
+elf_mips_abi_name (abfd)
+     bfd *abfd;
 {
+  flagword flags;
+
+  if (ABI_N32_P (abfd))
+    return "N32";
+  else if (ABI_64_P (abfd))
+    return "64";
+      
+  flags = elf_elfheader (abfd)->e_flags;
   switch (flags & EF_MIPS_ABI)
     {
     case 0:
@@ -1607,7 +1919,11 @@
   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
   { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
   { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
-  { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }
+  { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
+  { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
+  { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
+  { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
+  { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }
 };
 
 /* Given a BFD reloc type, return a howto structure.  */
@@ -1648,10 +1964,63 @@
       return &elf_mips_gnu_vtinherit_howto;
     case BFD_RELOC_VTABLE_ENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case BFD_RELOC_PCREL_HI16_S:
+      return &elf_mips_gnu_rel_hi16;
+    case BFD_RELOC_PCREL_LO16:
+      return &elf_mips_gnu_rel_lo16;
+    case BFD_RELOC_16_PCREL_S2:
+      return &elf_mips_gnu_rel16_s2;
+    case BFD_RELOC_64_PCREL:
+      return &elf_mips_gnu_pcrel64;
+    case BFD_RELOC_32_PCREL:
+      return &elf_mips_gnu_pcrel32;
     }
 }
 
-/* Given a MIPS reloc type, fill in an arelent structure.  */
+/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure.  */
+
+static reloc_howto_type *
+mips_rtype_to_howto (r_type)
+     unsigned int r_type;
+{
+  switch (r_type)
+    {
+    case R_MIPS16_26:
+      return &elf_mips16_jump_howto;
+      break;
+    case R_MIPS16_GPREL:
+      return &elf_mips16_gprel_howto;
+      break;
+    case R_MIPS_GNU_VTINHERIT:
+      return &elf_mips_gnu_vtinherit_howto;
+      break;
+    case R_MIPS_GNU_VTENTRY:
+      return &elf_mips_gnu_vtentry_howto;
+      break;
+    case R_MIPS_GNU_REL_HI16:
+      return &elf_mips_gnu_rel_hi16;
+      break;
+    case R_MIPS_GNU_REL_LO16:
+      return &elf_mips_gnu_rel_lo16;
+      break;
+    case R_MIPS_GNU_REL16_S2:
+      return &elf_mips_gnu_rel16_s2;
+      break;
+    case R_MIPS_PC64:
+      return &elf_mips_gnu_pcrel64;
+      break;
+    case R_MIPS_PC32:
+      return &elf_mips_gnu_pcrel32;
+      break;
+
+    default:
+      BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
+      return &elf_mips_howto_table[r_type];
+      break;
+    }
+}
+
+/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure.  */
 
 static void
 mips_info_to_howto_rel (abfd, cache_ptr, dst)
@@ -1662,26 +2031,7 @@
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (dst->r_info);
-  switch (r_type)
-    {
-    case R_MIPS16_26:
-      cache_ptr->howto = &elf_mips16_jump_howto;
-      break;
-    case R_MIPS16_GPREL:
-      cache_ptr->howto = &elf_mips16_gprel_howto;
-      break;
-    case R_MIPS_GNU_VTINHERIT:
-      cache_ptr->howto = &elf_mips_gnu_vtinherit_howto;
-      break;
-    case R_MIPS_GNU_VTENTRY:
-      cache_ptr->howto = &elf_mips_gnu_vtentry_howto;
-      break;
-
-    default:
-      BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
-      cache_ptr->howto = &elf_mips_howto_table[r_type];
-      break;
-    }
+  cache_ptr->howto = mips_rtype_to_howto (r_type);
 
   /* The addend for a GPREL16 or LITERAL relocation comes from the GP
      value for the object file.  We get the addend now, rather than
@@ -1692,6 +2042,23 @@
 	  || r_type == (unsigned int) R_MIPS_LITERAL))
     cache_ptr->addend = elf_gp (abfd);
 }
+
+/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure.  */
+
+static void
+mips_info_to_howto_rela (abfd, cache_ptr, dst)
+     bfd *abfd;
+     arelent *cache_ptr;
+     Elf32_Internal_Rela *dst;
+{
+  /* Since an Elf32_Internal_Rel is an initial prefix of an
+     Elf32_Internal_Rela, we can just use mips_info_to_howto_rel
+     above.  */
+  mips_info_to_howto_rel (abfd, cache_ptr, (Elf32_Internal_Rel *) dst);
+
+  /* If we ever need to do any extra processing with dst->r_addend
+     (the field omitted in an Elf32_Internal_Rel) we can do it here.  */
+}
 
 /* A .reginfo section holds a single Elf32_RegInfo structure.  These
    routines swap this structure in and out.  They are used outside of
@@ -1857,6 +2224,31 @@
   bfd_h_put_16 (abfd, in->section, ex->section);
   bfd_h_put_32 (abfd, in->info, ex->info);
 }
+#if 0
+/* Swap in an MSYM entry.  */
+
+static void
+bfd_mips_elf_swap_msym_in (abfd, ex, in)
+     bfd *abfd;
+     const Elf32_External_Msym *ex;
+     Elf32_Internal_Msym *in;
+{
+  in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value);
+  in->ms_info = bfd_h_get_32 (abfd, ex->ms_info);
+}
+#endif
+/* Swap out an MSYM entry.  */
+
+static void
+bfd_mips_elf_swap_msym_out (abfd, in, ex)
+     bfd *abfd;
+     const Elf32_Internal_Msym *in;
+     Elf32_External_Msym *ex;
+{
+  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
@@ -1867,7 +2259,7 @@
 /*ARGSUSED*/
 static boolean
 mips_elf_sym_is_global (abfd, sym)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asymbol *sym;
 {
   return (sym->flags & BSF_SECTION_SYM) == 0 ? true : false;
@@ -1880,23 +2272,14 @@
 _bfd_mips_elf_object_p (abfd)
      bfd *abfd;
 {
-  bfd_default_set_arch_mach (abfd, bfd_arch_mips,
-			     elf_mips_mach (elf_elfheader (abfd)->e_flags));
-  return true;
-}
-
-/* Set the right machine number for a 32-bit MIPS ELF file.  */
-
-static boolean
-mips_elf32_object_p (abfd)
-     bfd *abfd;
-{
-  /* Irix 5 is broken.  Object file symbol tables are not always
+  /* Irix 5 and 6 is broken.  Object file symbol tables are not always
      sorted correctly such that local symbols precede global symbols,
      and the sh_info field in the symbol table is not always right.  */
   elf_bad_symtab (abfd) = true;
 
-  return _bfd_mips_elf_object_p (abfd);
+  bfd_default_set_arch_mach (abfd, bfd_arch_mips,
+			     elf_mips_mach (elf_elfheader (abfd)->e_flags));
+  return true;
 }
 
 /* The final processing done just before writing out a MIPS ELF object
@@ -1907,7 +2290,7 @@
 void
 _bfd_mips_elf_final_write_processing (abfd, linker)
      bfd *abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   unsigned long val;
   unsigned int i;
@@ -1967,6 +2350,7 @@
     {
       switch ((*hdrpp)->sh_type)
 	{
+	case SHT_MIPS_MSYM:
 	case SHT_MIPS_LIBLIST:
 	  sec = bfd_get_section_by_name (abfd, ".dynstr");
 	  if (sec != NULL)
@@ -1992,7 +2376,7 @@
 	  sec = bfd_get_section_by_name (abfd,
 					 name + sizeof ".MIPS.content" - 1);
 	  BFD_ASSERT (sec != NULL);
-	  (*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
+	  (*hdrpp)->sh_link = elf_section_data (sec)->this_idx;
 	  break;
 
 	case SHT_MIPS_SYMBOL_LIB:
@@ -2104,6 +2488,8 @@
     {
       elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = new_flags;
+      elf_elfheader (obfd)->e_ident[EI_CLASS] 
+	= elf_elfheader (ibfd)->e_ident[EI_CLASS];
 
       if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
 	  && bfd_get_arch_info (obfd)->the_default)
@@ -2191,18 +2577,22 @@
       old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
     }
 
-  /* Compare ABI's */
-  if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI))
+  /* 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 (obfd)->e_ident[EI_CLASS]))
     {
       /* Only error if both are set (to different values). */
-      if ((new_flags & EF_MIPS_ABI)
-	  && (old_flags & EF_MIPS_ABI))
+      if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI))
+	  || (elf_elfheader (ibfd)->e_ident[EI_CLASS] 
+	      != elf_elfheader (obfd)->e_ident[EI_CLASS]))
 	{
 	  (*_bfd_error_handler)
 	    (_("%s: ABI mismatch: linking %s module with previous %s modules"),
 	     bfd_get_filename (ibfd),
-	     elf_mips_abi_name (new_flags),
-	     elf_mips_abi_name (old_flags));
+	     elf_mips_abi_name (ibfd),
+	     elf_mips_abi_name (obfd));
 	  ok = false;
 	}
       new_flags &= ~EF_MIPS_ABI;
@@ -2228,7 +2618,7 @@
   return true;
 }
 
-static boolean
+boolean
 _bfd_mips_elf_print_private_bfd_data (abfd, ptr)
      bfd *abfd;
      PTR ptr;
@@ -2253,6 +2643,10 @@
     fprintf (file, _ (" [abi=EABI64]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI))
     fprintf (file, _ (" [abi unknown]"));
+  else if (ABI_N32_P (abfd))
+    fprintf (file, _ (" [abi=N32]"));
+  else if (ABI_64_P (abfd))
+    fprintf (file, _ (" [abi=64]"));
   else
     fprintf (file, _ (" [no abi set]"));
 
@@ -2288,7 +2682,7 @@
 _bfd_mips_elf_section_from_shdr (abfd, hdr, name)
      bfd *abfd;
      Elf_Internal_Shdr *hdr;
-     const char *name;
+     char *name;
 {
   flagword flags = 0;
 
@@ -2304,7 +2698,7 @@
 	return false;
       break;
     case SHT_MIPS_MSYM:
-      if (strcmp (name, ".msym") != 0)
+      if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) != 0)
 	return false;
       break;
     case SHT_MIPS_CONFLICT:
@@ -2339,8 +2733,7 @@
 	return false;
       break;
     case SHT_MIPS_OPTIONS:
-      if (strcmp (name, ".options") != 0
-	  && strcmp (name, ".MIPS.options") != 0)
+      if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0)
 	return false;
       break;
     case SHT_MIPS_DWARF:
@@ -2373,20 +2766,6 @@
 	return false;
     }
 
-  return true;
-}
-
-/* Handle a 32-bit MIPS ELF specific section.  */
-
-static boolean
-mips_elf32_section_from_shdr (abfd, hdr, name)
-     bfd *abfd;
-     Elf_Internal_Shdr *hdr;
-     char *name;
-{
-  if (! _bfd_mips_elf_section_from_shdr (abfd, hdr, name))
-    return false;
-
   /* FIXME: We should record sh_info for a .gptab section.  */
 
   /* For a .reginfo section, set the gp value in the tdata information
@@ -2430,7 +2809,18 @@
 
 	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
 					&intopt);
-	  if (intopt.kind == ODK_REGINFO)
+	  if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
+	    {
+	      Elf64_Internal_RegInfo intreg;
+
+	      bfd_mips_elf64_swap_reginfo_in
+		(abfd,
+		 ((Elf64_External_RegInfo *)
+		  (l + sizeof (Elf_External_Options))),
+		 &intreg);
+	      elf_gp (abfd) = intreg.ri_gp_value;
+	    }
+	  else if (intopt.kind == ODK_REGINFO)
 	    {
 	      Elf32_RegInfo intreg;
 
@@ -2469,12 +2859,6 @@
       hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib);
       /* The sh_link field is set in final_write_processing.  */
     }
-  else if (strcmp (name, ".msym") == 0)
-    {
-      hdr->sh_type = SHT_MIPS_MSYM;
-      hdr->sh_entsize = 8;
-      /* FIXME: Set the sh_info field.  */
-    }
   else if (strcmp (name, ".conflict") == 0)
     hdr->sh_type = SHT_MIPS_CONFLICT;
   else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0)
@@ -2517,6 +2901,7 @@
 #endif
     }
   else if (strcmp (name, ".got") == 0
+	   || strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0
 	   || strcmp (name, ".sdata") == 0
 	   || strcmp (name, ".sbss") == 0
 	   || strcmp (name, ".lit4") == 0
@@ -2527,13 +2912,13 @@
       hdr->sh_type = SHT_MIPS_IFACE;
       hdr->sh_flags |= SHF_MIPS_NOSTRIP;
     }
-  else if (strcmp (name, ".MIPS.content") == 0)
+  else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0)
     {
       hdr->sh_type = SHT_MIPS_CONTENT;
+      hdr->sh_flags |= SHF_MIPS_NOSTRIP;
       /* The sh_info field is set in final_write_processing.  */
     }
-  else if (strcmp (name, ".options") == 0
-	   || strcmp (name, ".MIPS.options") == 0)
+  else if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
     {
       hdr->sh_type = SHT_MIPS_OPTIONS;
       hdr->sh_entsize = 1;
@@ -2555,6 +2940,29 @@
       hdr->sh_flags |= SHF_MIPS_NOSTRIP;
       /* The sh_link field is set in final_write_processing.  */
     }
+  else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) == 0)
+    {
+      hdr->sh_type = SHT_MIPS_MSYM;
+      hdr->sh_flags |= SHF_ALLOC;
+      hdr->sh_entsize = 8;
+    }
+
+  /* The generic elf_fake_sections will set up REL_HDR using the
+     default kind of relocations.  But, we may actually need both
+     kinds of relocations, so we set up the second header here.  */
+  if ((sec->flags & SEC_RELOC) != 0)
+    {
+      struct bfd_elf_section_data *esd;
+
+      esd = elf_section_data (sec);
+      BFD_ASSERT (esd->rel_hdr2 == NULL);
+      esd->rel_hdr2 
+	= (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
+      if (!esd->rel_hdr2)
+	return false;
+      _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec,
+				!elf_section_data (sec)->use_rela_p);
+    }
 
   return true;
 }
@@ -2567,8 +2975,8 @@
 
 boolean
 _bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval)
-     bfd *abfd;
-     Elf32_Internal_Shdr *hdr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
      asection *sec;
      int *retval;
 {
@@ -2597,8 +3005,7 @@
      file_ptr offset;
      bfd_size_type count;
 {
-  if (strcmp (section->name, ".options") == 0
-      || strcmp (section->name, ".MIPS.options") == 0)
+  if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
     {
       bfd_byte *c;
 
@@ -2641,57 +3048,8 @@
      bfd *abfd;
      Elf_Internal_Shdr *hdr;
 {
-  if (hdr->bfd_section != NULL)
-    {
-      const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
-
-      if (strcmp (name, ".sdata") == 0)
-	{
-	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
-	  hdr->sh_type = SHT_PROGBITS;
-	}
-      else if (strcmp (name, ".sbss") == 0)
-	{
-	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
-	  hdr->sh_type = SHT_NOBITS;
-	}
-      else if (strcmp (name, ".lit8") == 0
-	       || strcmp (name, ".lit4") == 0)
-	{
-	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
-	  hdr->sh_type = SHT_PROGBITS;
-	}
-      else if (strcmp (name, ".compact_rel") == 0)
-	{
-	  hdr->sh_flags = 0;
-	  hdr->sh_type = SHT_PROGBITS;
-	}
-      else if (strcmp (name, ".rtproc") == 0)
-	{
-	  if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0)
-	    {
-	      unsigned int adjust;
-
-	      adjust = hdr->sh_size % hdr->sh_addralign;
-	      if (adjust != 0)
-		hdr->sh_size += hdr->sh_addralign - adjust;
-	    }
-	}
-    }
-
-  return true;
-}
-
-/* Work over a section just before writing it out.  We update the GP
-   value in the SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS sections based
-   on the value we are using.  */
-
-static boolean
-mips_elf32_section_processing (abfd, hdr)
-     bfd *abfd;
-     Elf32_Internal_Shdr *hdr;
-{
-  if (hdr->sh_type == SHT_MIPS_REGINFO)
+  if (hdr->sh_type == SHT_MIPS_REGINFO
+      && hdr->sh_size > 0)
     {
       bfd_byte buf[4];
 
@@ -2730,7 +3088,22 @@
 
 	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
 					&intopt);
-	  if (intopt.kind == ODK_REGINFO)
+	  if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
+	    {
+	      bfd_byte buf[8];
+
+	      if (bfd_seek (abfd,
+			    (hdr->sh_offset
+			     + (l - contents)
+			     + sizeof (Elf_External_Options)
+			     + (sizeof (Elf64_External_RegInfo) - 8)),
+			     SEEK_SET) == -1)
+		return false;
+	      bfd_h_put_64 (abfd, elf_gp (abfd), buf);
+	      if (bfd_write (buf, 1, 8, abfd) != 8)
+		return false;
+	    }
+	  else if (intopt.kind == ODK_REGINFO)
 	    {
 	      bfd_byte buf[4];
 
@@ -2749,8 +3122,48 @@
 	}
     }
 
-  return _bfd_mips_elf_section_processing (abfd, hdr);
+  if (hdr->bfd_section != NULL)
+    {
+      const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
+
+      if (strcmp (name, ".sdata") == 0
+	  || strcmp (name, ".lit8") == 0
+	  || strcmp (name, ".lit4") == 0)
+	{
+	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
+	  hdr->sh_type = SHT_PROGBITS;
+	}
+      else if (strcmp (name, ".sbss") == 0)
+	{
+	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
+	  hdr->sh_type = SHT_NOBITS;
+	}
+      else if (strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0)
+	{
+	  hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL;
+	  hdr->sh_type = SHT_PROGBITS;
+	}
+      else if (strcmp (name, ".compact_rel") == 0)
+	{
+	  hdr->sh_flags = 0;
+	  hdr->sh_type = SHT_PROGBITS;
+	}
+      else if (strcmp (name, ".rtproc") == 0)
+	{
+	  if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0)
+	    {
+	      unsigned int adjust;
+
+	      adjust = hdr->sh_size % hdr->sh_addralign;
+	      if (adjust != 0)
+		hdr->sh_size += hdr->sh_addralign - adjust;
+	    }
+	}
+    }
+
+  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
@@ -2817,8 +3230,9 @@
 
     case SHN_COMMON:
       /* Common symbols less than the GP size are automatically
-	 treated as SHN_MIPS_SCOMMON symbols.  */
-      if (asym->value > elf_gp_size (abfd))
+	 treated as SHN_MIPS_SCOMMON symbols on IRIX5.  */
+      if (asym->value > elf_gp_size (abfd)
+	  || IRIX_COMPAT (abfd) == ict_irix6)
 	break;
       /* Fall through.  */
     case SHN_MIPS_SCOMMON:
@@ -2858,39 +3272,40 @@
 /* When creating an Irix 5 executable, we need REGINFO and RTPROC
    segments.  */
 
-static int
-mips_elf_additional_program_headers (abfd)
+int
+_bfd_mips_elf_additional_program_headers (abfd)
      bfd *abfd;
 {
   asection *s;
-  int ret;
+  int ret = 0;
 
-  ret = 0;
+  if (!SGI_COMPAT (abfd))
+    return 0;
 
-  if (! SGI_COMPAT (abfd))
-    return ret;
-
+  /* See if we need a PT_MIPS_REGINFO segment.  */
   s = bfd_get_section_by_name (abfd, ".reginfo");
-  if (s != NULL && (s->flags & SEC_LOAD) != 0)
-    {
-      /* We need a PT_MIPS_REGINFO segment.  */
-      ++ret;
-    }
+  if (s && (s->flags & SEC_LOAD))
+    ++ret;
 
-  if (bfd_get_section_by_name (abfd, ".dynamic") != NULL
-      && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
-    {
-      /* We need a PT_MIPS_RTPROC segment.  */
-      ++ret;
-    }
+  /* See if we need a PT_MIPS_OPTIONS segment.  */
+  if (IRIX_COMPAT (abfd) == ict_irix6
+      && bfd_get_section_by_name (abfd, 
+				  MIPS_ELF_OPTIONS_SECTION_NAME (abfd)))
+    ++ret;
+
+  /* See if we need a PT_MIPS_RTPROC segment.  */
+  if (IRIX_COMPAT (abfd) == ict_irix5
+      && bfd_get_section_by_name (abfd, ".dynamic")
+      && bfd_get_section_by_name (abfd, ".mdebug"))
+    ++ret;
 
   return ret;
 }
 
 /* Modify the segment map for an Irix 5 executable.  */
 
-static boolean
-mips_elf_modify_segment_map (abfd)
+boolean
+_bfd_mips_elf_modify_segment_map (abfd)
      bfd *abfd;
 {
   asection *s;
@@ -2929,114 +3344,156 @@
 	}
     }
 
-  /* 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)
+  /* For IRIX 6, we don't have .mdebug sections, nor does anything but
+     .dynamic end up in PT_DYNAMIC.  However, we do have to insert a
+     PT_OPTIONS segement immediately following the program header
+     table.  */
+  if (IRIX_COMPAT (abfd) == ict_irix6)
     {
-      for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
-	if (m->p_type == PT_MIPS_RTPROC)
+      asection *s;
+
+      for (s = abfd->sections; s; s = s->next)
+	if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS)
 	  break;
-      if (m == NULL)
+
+      if (s)
 	{
-	  m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
-	  if (m == NULL)
-	    return false;
+	  struct elf_segment_map *options_segment;
 
-	  m->p_type = PT_MIPS_RTPROC;
+	  /* Usually, there's a program header table.  But, sometimes
+	     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; 
+	       *pm != NULL;
+	       pm = &(*pm)->next)
+	    if ((*pm)->p_type == PT_PHDR)
+	      break;
 
-	  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;
+	  options_segment = bfd_zalloc (abfd, 
+					sizeof (struct elf_segment_map));
+	  options_segment->next = *pm;
+	  options_segment->p_type = PT_MIPS_OPTIONS;
+	  options_segment->p_flags = PF_R;
+	  options_segment->p_flags_valid = true;
+	  options_segment->count = 1;
+	  options_segment->sections[0] = s;
+	  *pm = options_segment;
 	}
     }
-
-  /* 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)
-    if ((*pm)->p_type == PT_DYNAMIC)
-      break;
-  m = *pm;
-  if (m != NULL
-      && m->count == 1
-      && strcmp (m->sections[0]->name, ".dynamic") == 0)
+  else
     {
-      static const char *sec_names[] =
-	{ ".dynamic", ".dynstr", ".dynsym", ".hash" };
-      bfd_vma low, high;
-      unsigned int i, c;
-      struct elf_segment_map *n;
-
-      low = 0xffffffff;
-      high = 0;
-      for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++)
+      /* 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)
 	{
-	  s = bfd_get_section_by_name (abfd, sec_names[i]);
-	  if (s != NULL && (s->flags & SEC_LOAD) != 0)
+	  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+	    if (m->p_type == PT_MIPS_RTPROC)
+	      break;
+	  if (m == NULL)
 	    {
-	      bfd_size_type sz;
+	      m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+	      if (m == NULL)
+		return false;
 
-	      if (low > s->vma)
-		low = s->vma;
-	      sz = s->_cooked_size;
-	      if (sz == 0)
-		sz = s->_raw_size;
-	      if (high < s->vma + sz)
-		high = s->vma + sz;
+	      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;
+		}
+
+	      /* 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;
 	    }
 	}
 
-      c = 0;
-      for (s = abfd->sections; s != NULL; s = s->next)
-	if ((s->flags & SEC_LOAD) != 0
-	    && s->vma >= low
-	    && ((s->vma
-		 + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size))
-		<= high))
-	  ++c;
-
-      n = ((struct elf_segment_map *)
-	   bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *)));
-      if (n == NULL)
-	return false;
-      *n = *m;
-      n->count = c;
-
-      i = 0;
-      for (s = abfd->sections; s != NULL; s = s->next)
+      /* 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)
+	if ((*pm)->p_type == PT_DYNAMIC)
+	  break;
+      m = *pm;
+      if (m != NULL
+	  && m->count == 1
+	  && strcmp (m->sections[0]->name, ".dynamic") == 0)
 	{
-	  if ((s->flags & SEC_LOAD) != 0
-	      && s->vma >= low
-	      && ((s->vma
-		   + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size))
-		  <= high))
-	    {
-	      n->sections[i] = s;
-	      ++i;
-	    }
-	}
+	  static const char *sec_names[] =
+	  { ".dynamic", ".dynstr", ".dynsym", ".hash" };
+	  bfd_vma low, high;
+	  unsigned int i, c;
+	  struct elf_segment_map *n;
 
-      *pm = n;
+	  low = 0xffffffff;
+	  high = 0;
+	  for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++)
+	    {
+	      s = bfd_get_section_by_name (abfd, sec_names[i]);
+	      if (s != NULL && (s->flags & SEC_LOAD) != 0)
+		{
+		  bfd_size_type sz;
+
+		  if (low > s->vma)
+		    low = s->vma;
+		  sz = s->_cooked_size;
+		  if (sz == 0)
+		    sz = s->_raw_size;
+		  if (high < s->vma + sz)
+		    high = s->vma + sz;
+		}
+	    }
+
+	  c = 0;
+	  for (s = abfd->sections; s != NULL; s = s->next)
+	    if ((s->flags & SEC_LOAD) != 0
+		&& s->vma >= low
+		&& ((s->vma
+		     + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size))
+		    <= high))
+	      ++c;
+
+	  n = ((struct elf_segment_map *)
+	       bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *)));
+	  if (n == NULL)
+	    return false;
+	  *n = *m;
+	  n->count = c;
+
+	  i = 0;
+	  for (s = abfd->sections; s != NULL; s = s->next)
+	    {
+	      if ((s->flags & SEC_LOAD) != 0
+		  && s->vma >= low
+		  && ((s->vma
+		       + (s->_cooked_size != 0 ?
+			  s->_cooked_size : s->_raw_size))
+		      <= high))
+		{
+		  n->sections[i] = s;
+		  ++i;
+		}
+	    }
+
+	  *pm = n;
+	}
     }
 
   return true;
@@ -3225,7 +3682,8 @@
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr))
+				     line_ptr, 
+				     ABI_64_P (abfd) ? 8 : 0))
     return true;
 
   msec = bfd_get_section_by_name (abfd, ".mdebug");
@@ -3349,36 +3807,6 @@
 #define CALL_STUB ".mips16.call."
 #define CALL_FP_STUB ".mips16.call.fp."
 
-/* The MIPS ELF linker needs additional information for each symbol in
-   the global hash table.  */
-
-struct mips_elf_link_hash_entry
-{
-  struct elf_link_hash_entry root;
-
-  /* External symbol information.  */
-  EXTR esym;
-
-  /* Number of MIPS_32 or MIPS_REL32 relocs against this symbol.  */
-  unsigned int mips_32_relocs;
-
-  /* If there is a stub that 32 bit functions should use to call this
-     16 bit function, this points to the section containing the stub.  */
-  asection *fn_stub;
-
-  /* Whether we need the fn_stub; this is set if this symbol appears
-     in any relocs other than a 16 bit call.  */
-  boolean need_fn_stub;
-
-  /* If there is a stub that 16 bit functions should use to call this
-     32 bit function, this points to the section containing the stub.  */
-  asection *call_stub;
-
-  /* This is like the call_stub field, but it is used if the function
-     being called returns a floating point value.  */
-  asection *call_fp_stub;
-};
-
 /* MIPS ELF linker hash table.  */
 
 struct mips_elf_link_hash_table
@@ -3456,7 +3884,8 @@
       /* We use -2 as a marker to indicate that the information has
 	 not been set.  -1 means there is no associated ifd.  */
       ret->esym.ifd = -2;
-      ret->mips_32_relocs = 0;
+      ret->possibly_dynamic_relocs = 0;
+      ret->min_dyn_reloc_index = 0;
       ret->fn_stub = NULL;
       ret->need_fn_stub = false;
       ret->call_stub = NULL;
@@ -3468,8 +3897,8 @@
 
 /* Create a MIPS ELF linker hash table.  */
 
-static struct bfd_link_hash_table *
-mips_elf_link_hash_table_create (abfd)
+struct bfd_link_hash_table *
+_bfd_mips_elf_link_hash_table_create (abfd)
      bfd *abfd;
 {
   struct mips_elf_link_hash_table *ret;
@@ -3504,13 +3933,13 @@
    file.  We must handle the special MIPS section numbers here.  */
 
 /*ARGSUSED*/
-static boolean
-mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
+boolean
+_bfd_mips_elf_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;
+     flagword *flagsp ATTRIBUTE_UNUSED;
      asection **secp;
      bfd_vma *valp;
 {
@@ -3528,7 +3957,8 @@
     case SHN_COMMON:
       /* Common symbols less than the GP size are automatically
 	 treated as SHN_MIPS_SCOMMON symbols.  */
-      if (sym->st_size > elf_gp_size (abfd))
+      if (sym->st_size > elf_gp_size (abfd)
+	  || IRIX_COMPAT (abfd) == ict_irix6)
 	break;
       /* Fall through.  */
     case SHN_MIPS_SCOMMON:
@@ -3548,7 +3978,7 @@
 	  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;
+	  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;
@@ -3572,7 +4002,7 @@
 	  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;
+	  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;
@@ -3981,8 +4411,8 @@
    the .mdebug sections.  We need to merge all instances of these
    sections together, not write them all out sequentially.  */
 
-static boolean
-mips_elf_final_link (abfd, info)
+boolean
+_bfd_mips_elf_final_link (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
@@ -3998,22 +4428,69 @@
   HDRR *symhdr = &debug.symbolic_header;
   PTR mdebug_handle = NULL;
 
-  /* Drop the .options section, since it has special semantics which I
-     haven't bothered to figure out.  */
-  for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
+  /* If all the things we linked together were PIC, but we're
+     producing an executable (rather than a shared object), then the
+     resulting file is CPIC (i.e., it calls PIC code.)  */
+  if (!info->shared
+      && !info->relocateable
+      && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC)
     {
-      if (strcmp ((*secpp)->name, ".options") == 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;
-	  (*secpp)->link_order_head = NULL;
-	  *secpp = (*secpp)->next;
-	  --abfd->section_count;
-	  break;
-	}
+      elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC;
+      elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC;
     }
 
+  /* We'd carefully arranged the dynamic symbol indices, and then the
+     generic size_dynamic_sections renumbered them out from under us.
+     Rather than trying somehow to prevent the renumbering, just do
+     the sort again.  */
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      bfd *dynobj;
+      asection *got;
+      struct mips_got_info *g;
+
+      /* When we resort, we must tell mips_elf_sort_hash_table what
+	 the lowest index it may use is.  That's the number of section
+	 symbols we're going to add.  The generic ELF linker only
+	 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 
+					    ? bfd_count_sections (abfd) + 1
+					    : 1)))
+        return false;
+
+      /* Make sure we didn't grow the global .got region.  */
+      dynobj = elf_hash_table (info)->dynobj;
+      got = bfd_get_section_by_name (dynobj, ".got");
+      g = (struct mips_got_info *) elf_section_data (got)->tdata;
+
+      if (g->global_gotsym != NULL)
+	BFD_ASSERT ((elf_hash_table (info)->dynsymcount
+		     - g->global_gotsym->dynindx)
+		    <= g->global_gotno);
+    }
+
+  /* On IRIX5, we omit the .options section.  On IRIX6, however, we
+     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)
+    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;
+	    (*secpp)->link_order_head = NULL;
+	    *secpp = (*secpp)->next;
+	    --abfd->section_count;
+	    
+	    break;
+	  }
+      }
+
   /* Get a value for the GP register.  */
   if (elf_gp (abfd) == 0)
     {
@@ -4029,17 +4506,14 @@
 	{
 	  bfd_vma lo;
 
-	  /* Make up a value.  */
+	  /* 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
-		  && (strcmp (o->name, ".sbss") == 0
-		      || strcmp (o->name, ".sdata") == 0
-		      || strcmp (o->name, ".lit4") == 0
-		      || strcmp (o->name, ".lit8") == 0))
-		lo = o->vma;
-	    }
+	    if (o->vma < lo 
+		&& (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
+	      lo = o->vma;
+
+	  /* And calculate GP relative to that.  */
 	  elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd);
 	}
       else
@@ -4572,7 +5046,17 @@
     }
 
   /* Invoke the regular ELF backend linker to do all the work.  */
-  if (! bfd_elf32_bfd_final_link (abfd, info))
+  if (ABI_64_P (abfd))
+    {
+#ifdef BFD64
+      if (!bfd_elf64_bfd_final_link (abfd, info))
+	return false;
+#else
+      abort ();
+      return false;
+#endif /* BFD64 */
+    }
+  else if (!bfd_elf32_bfd_final_link (abfd, info))
     return false;
 
   /* Now write out the computed sections.  */
@@ -4632,129 +5116,1422 @@
   return true;
 }
 
-/* Handle a MIPS ELF HI16 reloc.  */
+/* Returns the GOT section for ABFD.  */
 
-static void
-mips_elf_relocate_hi16 (input_bfd, relhi, rello, contents, addend)
-     bfd *input_bfd;
-     Elf_Internal_Rela *relhi;
-     Elf_Internal_Rela *rello;
-     bfd_byte *contents;
-     bfd_vma addend;
+static asection *
+mips_elf_got_section (abfd)
+     bfd *abfd;
 {
-  bfd_vma insn;
-  bfd_vma addlo;
-
-  insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-
-  addlo = bfd_get_32 (input_bfd, contents + rello->r_offset);
-  addlo &= 0xffff;
-
-  addend += ((insn & 0xffff) << 16) + addlo;
-
-  if ((addlo & 0x8000) != 0)
-    addend -= 0x10000;
-  if ((addend & 0x8000) != 0)
-    addend += 0x10000;
-
-  bfd_put_32 (input_bfd,
-	      (insn & 0xffff0000) | ((addend >> 16) & 0xffff),
-	      contents + relhi->r_offset);
+  return bfd_get_section_by_name (abfd, ".got");
 }
 
-/* Handle a MIPS ELF local GOT16 reloc.  */
+/* Returns the GOT information associated with the link indicated by
+   INFO.  If SGOTP is non-NULL, it is filled in with the GOT 
+   section.  */
 
-static boolean
-mips_elf_relocate_got_local (output_bfd, input_bfd, sgot, relhi, rello,
-			     contents, addend)
-     bfd *output_bfd;
-     bfd *input_bfd;
-     asection *sgot;
-     Elf_Internal_Rela *relhi;
-     Elf_Internal_Rela *rello;
-     bfd_byte *contents;
-     bfd_vma addend;
+static struct mips_got_info *
+mips_elf_got_info (abfd, sgotp)
+     bfd *abfd;
+     asection **sgotp;
 {
-  unsigned int assigned_gotno;
-  unsigned int i;
-  bfd_vma insn;
-  bfd_vma addlo;
-  bfd_vma address;
-  bfd_vma hipage;
-  bfd_byte *got_contents;
+  asection *sgot;
   struct mips_got_info *g;
 
-  insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-
-  addlo = bfd_get_32 (input_bfd, contents + rello->r_offset);
-  addlo &= 0xffff;
-
-  addend += ((insn & 0xffff) << 16) + addlo;
-
-  if ((addlo & 0x8000) != 0)
-    addend -= 0x10000;
-  if ((addend & 0x8000) != 0)
-    addend += 0x10000;
-
-  /* Get a got entry representing requested hipage.  */
+  sgot = mips_elf_got_section (abfd);
+  BFD_ASSERT (sgot != NULL);
   BFD_ASSERT (elf_section_data (sgot) != NULL);
   g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
   BFD_ASSERT (g != NULL);
 
-  assigned_gotno = g->assigned_gotno;
-  got_contents = sgot->contents;
-  hipage = addend & 0xffff0000;
+  if (sgotp)
+    *sgotp = sgot;
+  return g;
+}
 
-  for (i = MIPS_RESERVED_GOTNO; i < assigned_gotno; i++)
+/* Return whether a relocation is against a local symbol.  */
+
+static boolean
+mips_elf_local_relocation_p (input_bfd, relocation, local_sections)
+     bfd *input_bfd;
+     const Elf_Internal_Rela *relocation;
+     asection **local_sections;
+{
+  unsigned long r_symndx;
+  Elf_Internal_Shdr *symtab_hdr;
+
+  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
     {
-      address = bfd_get_32 (input_bfd, got_contents + i * 4);
-      if (hipage == (address & 0xffff0000))
-	break;
+      /* The symbol table does not follow the rule that local symbols
+	 must come before globals.  */
+      return local_sections[r_symndx] != NULL;
     }
+}
 
-  if (i == assigned_gotno)
-    {
-      if (assigned_gotno >= g->local_gotno)
-	{
-	  (*_bfd_error_handler)
-	    (_("more got entries are needed for hipage relocations"));
-	  bfd_set_error (bfd_error_bad_value);
-	  return false;
-	}
+/* Sign-extend VALUE, which has the indicated number of BITS.  */
 
-      bfd_put_32 (input_bfd, hipage, got_contents + assigned_gotno * 4);
-      ++g->assigned_gotno;
-    }
+static bfd_vma
+mips_elf_sign_extend (value, bits)
+     bfd_vma value;
+     int bits;
+{
+  if (value & ((bfd_vma)1 << (bits - 1)))
+    /* VALUE is negative.  */
+    value |= ((bfd_vma) - 1) << bits;      
+  
+  return value;
+}
 
-  i = - ELF_MIPS_GP_OFFSET (output_bfd) + i * 4;
-  bfd_put_32 (input_bfd, (insn & 0xffff0000) | (i & 0xffff),
-	      contents + relhi->r_offset);
+/* Return non-zero if the indicated VALUE has overflowed the maximum
+   range expressable by a signed number with the indicated number of
+   BITS.  */
+
+static boolean
+mips_elf_overflow_p (value, bits)
+     bfd_vma value;
+     int bits;
+{
+  bfd_signed_vma svalue = (bfd_signed_vma) value;
+
+  if (svalue > (1 << (bits - 1)) - 1)
+    /* The value is too big.  */
+    return true;
+  else if (svalue < -(1 << (bits - 1)))
+    /* The value is too small.  */
+    return true;
+    
+  /* All is well.  */
+  return false;
+}
+
+/* Calculate the %high function.  */
+
+static bfd_vma
+mips_elf_high (value)
+     bfd_vma value;
+{
+  return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
+}
+
+/* Calculate the %higher function.  */
+
+static bfd_vma
+mips_elf_higher (value)
+     bfd_vma value ATTRIBUTE_UNUSED;
+{
+#ifdef BFD64
+  return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff;
+#else
+  abort ();
+  return (bfd_vma) -1;
+#endif
+}
+
+/* Calculate the %highest function.  */
+
+static bfd_vma 
+mips_elf_highest (value)
+     bfd_vma value ATTRIBUTE_UNUSED;
+{
+#ifdef BFD64
+  return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff;
+#else
+  abort ();
+  return (bfd_vma) -1;
+#endif
+}
+
+/* Returns the GOT index for the global symbol indicated by H.  */
+
+static bfd_vma 
+mips_elf_global_got_index (abfd, h)
+     bfd *abfd;
+     struct elf_link_hash_entry *h;
+{
+  bfd_vma index;
+  asection *sgot;
+  struct mips_got_info *g;
+
+  g = mips_elf_got_info (abfd, &sgot);
+
+  /* Once we determine the global GOT entry with the lowest dynamic
+     symbol table index, we must put all dynamic symbols with greater
+     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) 
+	   * MIPS_ELF_GOT_SIZE (abfd));
+  BFD_ASSERT (index < sgot->_raw_size);
+
+  return index;
+}
+
+/* Returns the offset for the entry at the INDEXth position
+   in the GOT.  */
+
+static bfd_vma
+mips_elf_got_offset_from_index (dynobj, output_bfd, index)
+     bfd *dynobj;
+     bfd *output_bfd;
+     bfd_vma index;
+{
+  asection *sgot;
+  bfd_vma gp;
+
+  sgot = mips_elf_got_section (dynobj);
+  gp = _bfd_get_gp_value (output_bfd);
+  return (sgot->output_section->vma + sgot->output_offset + index - 
+	  gp);
+}
+
+/* If H is a symbol that needs a global GOT entry, but has a dynamic
+   symbol table index lower than any we've seen to date, record it for
+   posterity.  */
+
+static boolean
+mips_elf_record_global_got_symbol (h, info, g)
+     struct elf_link_hash_entry *h;
+     struct bfd_link_info *info;
+     struct mips_got_info *g ATTRIBUTE_UNUSED;
+{
+  /* A global symbol in the GOT must also be in the dynamic symbol
+     table.  */
+  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)
+    return true;
+
+  /* By setting this to a value other than -1, we are indicating that
+     there needs to be a GOT entry for H.  */
+  h->got.offset = 0;
 
   return true;
 }
 
-/* Handle MIPS ELF CALL16 reloc and global GOT16 reloc.  */
-
-static void
-mips_elf_relocate_global_got (input_bfd, rel, contents, offset)
-     bfd *input_bfd;
-     Elf_Internal_Rela *rel;
-     bfd_byte *contents;
-     bfd_vma offset;
+/* This structure is passed to mips_elf_sort_hash_table_f when sorting
+   the dynamic symbols.  */
+     
+struct mips_elf_hash_sort_data
 {
-  bfd_vma insn;
+  /* The symbol in the global GOT with the lowest dynamic symbol table
+     index.  */
+  struct elf_link_hash_entry *low;
+  /* The least dynamic symbol table index corresponding to a symbol
+     with a GOT entry.  */
+  long min_got_dynindx;
+  /* The greatest dynamic symbol table index not corresponding to a
+     symbol without a GOT entry.  */
+  long max_non_got_dynindx;
+};
 
-  insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
-  bfd_put_32 (input_bfd,
-	      (insn & 0xffff0000) | (offset & 0xffff),
-	      contents + rel->r_offset);
+/* If H needs a GOT entry, assign it the highest available dynamic
+   index.  Otherwise, assign it the lowest available dynamic 
+   index.  */
+
+static boolean
+mips_elf_sort_hash_table_f (h, data)
+     struct mips_elf_link_hash_entry *h;
+     PTR data;
+{
+  struct mips_elf_hash_sort_data *hsd 
+    = (struct mips_elf_hash_sort_data *) data;
+
+  /* Symbols without dynamic symbol table entries aren't interesting
+     at all.  */
+  if (h->root.dynindx == -1)
+    return true;
+
+  if (h->root.got.offset != 0)
+    h->root.dynindx = hsd->max_non_got_dynindx++;
+  else
+    {
+      h->root.dynindx = --hsd->min_got_dynindx;
+      hsd->low = (struct elf_link_hash_entry *) h;
+    }
+
+  return true;
+}
+
+/* Sort the dynamic symbol table so that symbols that need GOT entries
+   appear towards the end.  This reduces the amount of GOT space
+   required.  MAX_LOCAL is used to set the number of local symbols
+   known to be in the dynamic symbol table.  During
+   mips_elf_size_dynamic_sections, this value is 1.  Afterward, the
+   section symbols are added and the count is higher.  */
+
+static boolean
+mips_elf_sort_hash_table (info, max_local)
+     struct bfd_link_info *info;
+     unsigned long max_local;
+{
+  struct mips_elf_hash_sort_data hsd;
+  struct mips_got_info *g;
+  bfd *dynobj;
+
+  dynobj = elf_hash_table (info)->dynobj;
+
+  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, 
+			       &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);
+
+  /* Now we know which dynamic symbol has the lowest dynamic symbol
+     table index in the GOT.  */
+  g = mips_elf_got_info (dynobj, NULL);
+  g->global_gotsym = hsd.low;
+
+  return true;
+}
+
+/* Create a local GOT entry for VALUE.  Return the index of the entry,
+   or -1 if it could not be created.  */
+
+static bfd_vma
+mips_elf_create_local_got_entry (abfd, g, sgot, value)
+     bfd *abfd;
+     struct mips_got_info *g;
+     asection *sgot;
+     bfd_vma value;
+{
+  if (g->assigned_gotno >= g->local_gotno)
+    {
+      /* We didn't allocate enough space in the GOT.  */
+      (*_bfd_error_handler)
+	(_("not enough GOT space for local GOT entries"));
+      bfd_set_error (bfd_error_bad_value);
+      return (bfd_vma) -1;
+    }
+
+  MIPS_ELF_PUT_WORD (abfd, value,
+		     (sgot->contents 
+		      + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno));
+  return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
+}
+
+/* Returns the GOT offset at which the indicated address can be found.
+   If there is not yet a GOT entry for this value, create one.  Returns
+   -1 if no satisfactory GOT offset can be found.  */
+
+static bfd_vma
+mips_elf_local_got_index (abfd, info, value)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     bfd_vma value;
+{
+  asection *sgot;
+  struct mips_got_info *g;
+  bfd_byte *entry;
+
+  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); 
+       entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
+       entry += MIPS_ELF_GOT_SIZE (abfd))
+    {
+      bfd_vma address = MIPS_ELF_GET_WORD (abfd, entry);
+      if (address == value)
+	return entry - sgot->contents;
+    }
+
+  return mips_elf_create_local_got_entry (abfd, g, sgot, value);
+}
+
+/* Find a GOT entry that is within 32KB of the VALUE.  These entries
+   are supposed to be placed at small offsets in the GOT, i.e.,
+   within 32KB of GP.  Return the index into the GOT for this page,
+   and store the offset from this entry to the desired address in
+   OFFSETP, if it is non-NULL.  */
+
+static bfd_vma
+mips_elf_got_page (abfd, info, value, offsetp)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     bfd_vma value;
+     bfd_vma *offsetp;
+{
+  asection *sgot;
+  struct mips_got_info *g;
+  bfd_byte *entry;
+  bfd_byte *last_entry;
+  bfd_vma index = 0;
+  bfd_vma address;
+
+  g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+  /* 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 
+		+ 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 (!mips_elf_overflow_p (value - address, 16))
+	{
+	  /* This entry will serve as the page pointer.  We can add a
+	     16-bit number to it to get the actual address.  */
+	  index = entry - sgot->contents;
+	  break;
+	}
+    }
+
+  /* If we didn't have an appropriate entry, we create one now.  */
+  if (entry == last_entry)
+    index = mips_elf_create_local_got_entry (abfd, g, sgot, value);
+
+  if (offsetp)
+    {
+      address = MIPS_ELF_GET_WORD (abfd, entry);
+      *offsetp = value - address;
+    }
+
+  return index;
+}
+
+/* Find a GOT entry whose higher-order 16 bits are the same as those
+   for value.  Return the index into the GOT for this entry.  */
+
+static bfd_vma
+mips_elf_got16_entry (abfd, info, value)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     bfd_vma value;
+{
+  asection *sgot;
+  struct mips_got_info *g;
+  bfd_byte *entry;
+  bfd_byte *last_entry;
+  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;
+  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 
+		+ 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)
+	{
+	  /* This entry has the right high-order 16 bits.  */
+	  index = entry - sgot->contents;
+	  break;
+	}
+    }
+
+  /* If we didn't have an appropriate entry, we create one now.  */
+  if (entry == last_entry)
+    index = mips_elf_create_local_got_entry (abfd, g, sgot, value);
+
+  return index;
+}
+
+/* Returns the first relocation of type r_type found, beginning with
+   RELOCATION.  RELEND is one-past-the-end of the relocation table.  */
+
+static const Elf_Internal_Rela *
+mips_elf_next_relocation (r_type, relocation, relend)
+     unsigned int r_type;
+     const Elf_Internal_Rela *relocation;
+     const Elf_Internal_Rela *relend;
+{
+  /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be
+     immediately following.  However, for the IRIX6 ABI, the next
+     relocation may be a composed relocation consisting of several
+     relocations for the same address.  In that case, the R_MIPS_LO16
+     relocation may occur as one of these.  We permit a similar
+     extension in general, as that is useful for GCC.  */
+  while (relocation < relend)
+    {
+      if (ELF32_R_TYPE (relocation->r_info) == r_type)
+	return relocation;
+
+      ++relocation;
+    }
+
+  /* We didn't find it.  */
+  bfd_set_error (bfd_error_bad_value);
+  return NULL;
+}
+
+/* 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
+   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)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     const Elf_Internal_Rela *rel;
+     struct mips_elf_link_hash_entry *h;
+     asection *sec;
+     bfd_vma symbol;
+     bfd_vma *addendp;
+     asection *input_section;
+{
+  Elf_Internal_Rel outrel;
+  boolean skip;
+  asection *sreloc;
+  bfd *dynobj;
+  int r_type;
+
+  r_type = ELF32_R_TYPE (rel->r_info);
+  dynobj = elf_hash_table (info)->dynobj;
+  sreloc 
+    = bfd_get_section_by_name (dynobj,
+			       MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd));
+  BFD_ASSERT (sreloc != NULL);
+
+  skip = false;
+
+  /* We begin by assuming that the offset for the dynamic relocation
+     is the same as for the original relocation.  We'll adjust this
+     later to reflect the correct output offsets.  */
+  if (elf_section_data (input_section)->stab_info == NULL)
+    outrel.r_offset = rel->r_offset;
+  else
+    {
+      /* Except that in a stab section things are more complex.
+	 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 
+	= (_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 we didn't need the relocation at all, this value will be
+	 -1.  */
+      if (outrel.r_offset == (bfd_vma) -1)
+	skip = true;
+    }
+
+  /* If we've decided to skip this relocation, just output an emtpy
+     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)
+    memset (&outrel, 0, sizeof (outrel));
+  else
+    {
+      long indx;
+      bfd_vma section_offset;
+
+      /* We must now calculate the dynamic symbol table index to use
+	 in the relocation.  */
+      if (h != NULL
+	  && (! info->symbolic || (h->root.elf_link_hash_flags
+				   & ELF_LINK_HASH_DEF_REGULAR) == 0))
+	{
+	  indx = h->root.dynindx;
+	  BFD_ASSERT (indx != -1);
+	}
+      else
+	{
+	  if (sec != NULL && bfd_is_abs_section (sec))
+	    indx = 0;
+	  else if (sec == NULL || sec->owner == NULL)
+	    {
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+	  else
+	    {
+	      indx = elf_section_data (sec->output_section)->dynindx;
+	      if (indx == 0)
+		abort ();
+	    }
+
+	  /* Figure out how far the target of the relocation is from
+	     the beginning of its section.  */
+	  section_offset = symbol - sec->output_section->vma;
+	  /* The relocation we're building is section-relative.
+	     Therefore, the original addend must be adjusted by the
+	     section offset.  */
+	  *addendp += symbol - sec->output_section->vma;
+	  /* 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)
+	*addendp += symbol;
+
+      /* The relocation is always an REL32 relocation because we don't
+	 know where the shared library will wind up at load-time.  */
+      outrel.r_info = ELF32_R_INFO (indx, R_MIPS_REL32);
+
+      /* Adjust the output offset of the relocation to reference the
+	 correct location in the output file.  */
+      outrel.r_offset += (input_section->output_section->vma
+			  + input_section->output_offset);
+    }
+
+  /* Put the relocation back out.  We have to use the special
+     relocation outputter in the 64-bit case since the 64-bit
+     relocation format is non-standard.  */
+  if (ABI_64_P (output_bfd))
+    {
+      (*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
+	(output_bfd, &outrel,
+	 (sreloc->contents 
+	  + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
+    }
+  else
+    bfd_elf32_swap_reloc_out (output_bfd, &outrel,
+			      (((Elf32_External_Rel *)
+				sreloc->contents)
+			       + sreloc->reloc_count));
+
+  /* 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 
+	  || sreloc->reloc_count < h->min_dyn_reloc_index))
+    h->min_dyn_reloc_index = sreloc->reloc_count;
+
+  /* We've now added another relocation.  */
+  ++sreloc->reloc_count;
+
+  /* Make sure the output section is writable.  The dynamic linker
+     will be writing to it.  */
+  elf_section_data (input_section->output_section)->this_hdr.sh_flags
+    |= SHF_WRITE;
+
+  /* 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");
+      bfd_byte *cr;
+
+      if (scpt)
+	{
+	  Elf32_crinfo cptrel;
+
+	  mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG);
+	  cptrel.vaddr = (rel->r_offset
+			  + input_section->output_section->vma
+			  + input_section->output_offset);
+	  if (r_type == R_MIPS_REL32)
+	    mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32);
+	  else
+	    mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD);
+	  mips_elf_set_cr_dist2to (cptrel, 0);
+	  cptrel.konst = *addendp;
+
+	  cr = (scpt->contents
+		+ sizeof (Elf32_External_compact_rel));
+	  bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
+				     ((Elf32_External_crinfo *) cr
+				      + scpt->reloc_count));
+	  ++scpt->reloc_count;
+	}
+    }
+
+  return true;
+}
+
+/* Calculate the value produced by the RELOCATION (which comes from
+   the INPUT_BFD).  The ADDEND is the addend to use for this
+   RELOCATION; RELOCATION->R_ADDEND is ignored.
+
+   The result of the relocation calculation is stored in VALUEP.
+   REQUIRE_JALXP indicates whether or not the opcode used with this
+   relocation must be JALX.
+
+   This function returns bfd_reloc_continue if the caller need take no
+   further action regarding this relocation, bfd_reloc_notsupported if
+   something goes dramatically wrong, bfd_reloc_overflow if an
+   overflow occurs, and bfd_reloc_ok to indicate success.  */
+
+static bfd_reloc_status_type
+mips_elf_calculate_relocation (abfd, 
+			       input_bfd,
+			       input_section,
+			       info,
+			       relocation,
+			       addend,
+			       howto,
+			       local_syms,
+			       local_sections,
+			       valuep,
+			       namep,
+			       require_jalxp) 
+     bfd *abfd;
+     bfd *input_bfd;
+     asection *input_section;
+     struct bfd_link_info *info;
+     const Elf_Internal_Rela *relocation;
+     bfd_vma addend;
+     reloc_howto_type *howto;
+     Elf_Internal_Sym *local_syms;
+     asection **local_sections;
+     bfd_vma *valuep;
+     const char **namep;
+     boolean *require_jalxp;
+{
+  /* The eventual value we will return.  */
+  bfd_vma value;
+  /* The address of the symbol against which the relocation is
+     occurring.  */
+  bfd_vma symbol = 0;
+  /* The final GP value to be used for the relocatable, executable, or
+     shared object file being produced.  */
+  bfd_vma gp = (bfd_vma) - 1;
+  /* The place (section offset or address) of the storage unit being
+     relocated.  */
+  bfd_vma p;
+  /* The value of GP used to create the relocatable object.  */
+  bfd_vma gp0 = (bfd_vma) - 1;
+  /* The offset into the global offset table at which the address of
+     the relocation entry symbol, adjusted by the addend, resides
+     during execution.  */
+  bfd_vma g = (bfd_vma) - 1;
+  /* The section in which the symbol referenced by the relocation is
+     located.  */
+  asection *sec = 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;
+  /* True if the symbol referred to by this relocation is "_gp_disp".  */
+  boolean gp_disp_p = false;
+  Elf_Internal_Shdr *symtab_hdr;
+  size_t extsymoff;
+  unsigned long r_symndx;
+  int r_type;
+  /* True if overflow occurred during the calculation of the
+     relocation value.  */
+  boolean overflowed_p;
+  /* True if this relocation refers to a MIPS16 function.  */
+  boolean target_is_16_bit_code_p = false;
+
+  /* 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 
+       + input_section->output_offset
+       + relocation->r_offset);
+
+  /* Assume that there will be no overflow.  */
+  overflowed_p = false;
+
+  /* Figure out whether or not the symbol is local, and get the offset
+     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);
+  if (! elf_bad_symtab (input_bfd))
+    extsymoff = symtab_hdr->sh_info;
+  else
+    {
+      /* The symbol table does not follow the rule that local symbols
+	 must come before globals.  */
+      extsymoff = 0;
+    }
+      
+  /* Figure out the value of the symbol.  */
+  if (local_p)
+    {
+      Elf_Internal_Sym *sym;
+
+      sym = local_syms + r_symndx;
+      sec = local_sections[r_symndx];
+
+      symbol = sec->output_section->vma + sec->output_offset;
+      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+	symbol += sym->st_value;
+
+      /* MIPS16 text labels should be treated as odd.  */
+      if (sym->st_other == STO_MIPS16)
+	++symbol;
+
+      /* Record the name of this symbol, for our caller.  */
+      *namep = bfd_elf_string_from_elf_section (input_bfd,
+						symtab_hdr->sh_link,
+						sym->st_name);
+      if (*namep == '\0')
+	*namep = bfd_section_name (input_bfd, sec);
+
+      target_is_16_bit_code_p = (sym->st_other == STO_MIPS16);
+    }
+  else
+    {
+      /* For global symbols we look up the symbol in the hash-table.  */
+      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)
+	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;
+
+      /* See if this is the special _gp_disp symbol.  Note that such a
+	 symbol must always be a global symbol.  */
+      if (strcmp (h->root.root.root.string, "_gp_disp") == 0)
+	{
+	  /* Relocations against _gp_disp are permitted only with
+	     R_MIPS_HI16 and R_MIPS_LO16 relocations.  */
+	  if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16)
+	    return bfd_reloc_notsupported;
+
+	  gp_disp_p = true;
+	}
+      /* If this symbol is defined, calculate its address.  Note that
+	 _gp_disp is a magic symbol, always implicitly defined by the
+	 linker, so it's inappropriate to check to see whether or not
+	 its defined.  */
+      else if ((h->root.root.type == bfd_link_hash_defined
+		|| h->root.root.type == bfd_link_hash_defweak)
+	       && h->root.root.u.def.section)
+	{
+	  sec = h->root.root.u.def.section;
+	  if (sec->output_section)
+	    symbol = (h->root.root.u.def.value 
+		      + sec->output_section->vma
+		      + sec->output_offset);
+	  else
+	    symbol = h->root.root.u.def.value;
+	}
+      else if (h->root.root.type == bfd_link_hash_undefweak)
+	/* We allow relocations against undefined weak symbols, giving
+	   it the value zero, so that you can undefined weak functions
+	   and check to see if they exist by looking at their
+	   addresses.  */
+	symbol = 0;
+      else if (info->shared && !info->symbolic && !info->no_undefined)
+	symbol = 0;
+      else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0)
+	{
+	  /* If this is a dynamic link, we should have created a
+	     _DYNAMIC_LINK symbol 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.  */
+	  BFD_ASSERT (! info->shared);
+	  BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL);
+	  symbol = 0;
+	}
+      else
+	{
+	  if (! ((*info->callbacks->undefined_symbol)
+		 (info, h->root.root.root.string, input_bfd,
+		  input_section, relocation->r_offset,
+		  (!info->shared || info->no_undefined))))
+	    return bfd_reloc_undefined;
+	  symbol = 0;
+	}
+
+      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.  */
+  if (r_type != R_MIPS16_26 && !info->relocateable
+      && ((h != NULL && h->fn_stub != NULL)
+	  || (local_p && elf_tdata (input_bfd)->local_stubs != NULL
+	      && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL))
+      && !mips_elf_stub_section_p (input_bfd, input_section))
+    {
+      /* This is a 32-bit call to a 16-bit function.  We should
+	 have already noticed that we were going to need the
+	 stub.  */
+      if (local_p)
+	sec = elf_tdata (input_bfd)->local_stubs[r_symndx];
+      else
+	{
+	  BFD_ASSERT (h->need_fn_stub);
+	  sec = h->fn_stub;
+	}
+
+      symbol = sec->output_section->vma + sec->output_offset;
+    }
+  /* 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->call_stub != NULL || h->call_fp_stub != NULL)
+	   && !target_is_16_bit_code_p)
+    {
+      /* If both call_stub and call_fp_stub are defined, we can figure
+	 out which one to use by seeing which one appears in the input
+	 file.  */
+      if (h->call_stub != NULL && h->call_fp_stub != NULL)
+	{
+	  asection *o;
+
+	  sec = NULL;
+	  for (o = input_bfd->sections; o != NULL; o = o->next)
+	    {
+	      if (strncmp (bfd_get_section_name (input_bfd, o),
+			   CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+		{
+		  sec = h->call_fp_stub;
+		  break;
+		}
+	    }
+	  if (sec == NULL)
+	    sec = h->call_stub;
+	}
+      else if (h->call_stub != NULL)
+	sec = h->call_stub;
+      else
+	sec = h->call_fp_stub;
+
+      BFD_ASSERT (sec->_raw_size > 0);
+      symbol = sec->output_section->vma + sec->output_offset;
+    }
+
+  /* Calls from 16-bit code to 32-bit code and vice versa require the
+     special jalx instruction.  */
+  *require_jalxp = (!info->relocateable
+		    && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));
+
+  /* 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)
+    {
+    case R_MIPS_CALL16:
+    case R_MIPS_GOT16:
+    case R_MIPS_GOT_DISP:
+    case R_MIPS_GOT_HI16:
+    case R_MIPS_CALL_HI16:
+    case R_MIPS_GOT_LO16:
+    case R_MIPS_CALL_LO16:
+      /* Find the index into the GOT where this value is located.  */
+      if (!local_p)
+	{
+	  BFD_ASSERT (addend == 0);
+	  g = mips_elf_global_got_index 
+	    (elf_hash_table (info)->dynobj,
+	     (struct elf_link_hash_entry*) h);
+	}
+      else if (r_type == R_MIPS_GOT16)
+	/* There's no need to create a local GOT entry here; the
+	   calculation for a local GOT16 entry does not involve G.  */
+	break;
+      else
+	{
+	  g = mips_elf_local_got_index (abfd, info, symbol + addend);
+	  if (g == (bfd_vma) -1)
+	    return false;
+	}
+
+      /* Convert GOT indices to actual offsets.  */
+      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:
+    case R_MIPS_GPREL32:
+    case R_MIPS_LITERAL:
+      gp0 = _bfd_get_gp_value (input_bfd);
+      gp = _bfd_get_gp_value (abfd);
+      break;
+
+    default:
+      break;
+    }
+
+  /* Figure out what kind of relocation is being performed.  */
+  switch (r_type)
+    {
+    case R_MIPS_NONE:
+      return bfd_reloc_continue;
+
+    case R_MIPS_16:
+      value = symbol + mips_elf_sign_extend (addend, 16);
+      overflowed_p = mips_elf_overflow_p (value, 16);
+      break;
+
+    case R_MIPS_32:
+    case R_MIPS_REL32:
+    case R_MIPS_64:
+      if ((info->shared
+	   || (elf_hash_table (info)->dynamic_sections_created
+	       && h != NULL
+	       && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
+		   == 0)))
+	  && (input_section->flags & SEC_ALLOC) != 0)
+	{
+	  /* If we're creating a shared library, or this relocation is
+	     against a symbol in a shared library, then we can't know
+	     where the symbol will end up.  So, we create a relocation
+	     record in the output, and leave the job up to the dynamic
+	     linker.  */
+	  value = addend;
+	  if (!mips_elf_create_dynamic_relocation (abfd, 
+						   info, 
+						   relocation,
+						   h,
+						   sec,
+						   symbol,
+						   &value,
+						   input_section))
+	    return false;
+	}
+      else
+	{
+	  if (r_type != R_MIPS_REL32)
+	    value = symbol + addend;
+	  else
+	    value = addend;
+	}
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_PC32:
+    case R_MIPS_PC64:
+    case R_MIPS_GNU_REL_LO16:
+      value = symbol + addend - p;
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_GNU_REL16_S2:
+      value = symbol + mips_elf_sign_extend (addend << 2, 18) - p;
+      overflowed_p = mips_elf_overflow_p (value, 18);
+      value = (value >> 2) & howto->dst_mask;
+      break;
+
+    case R_MIPS_GNU_REL_HI16:
+      value = mips_elf_high (addend + symbol - p);
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS16_26:
+      /* The calculation for R_MIPS_26 is just the same as for an
+	 R_MIPS_26.  It's only the storage of the relocated field into
+	 the output file that's different.  That's handled in
+	 mips_elf_perform_relocation.  So, we just fall through to the
+	 R_MIPS_26 case here.  */
+    case R_MIPS_26:
+      if (local_p)
+	value = (((addend << 2) | (p & 0xf0000000)) + symbol) >> 2;
+      else
+	value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2;
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_HI16:
+      if (!gp_disp_p)
+	{
+	  value = mips_elf_high (addend + symbol);
+	  value &= howto->dst_mask;
+	}
+      else
+	{
+	  value = mips_elf_high (addend + gp - p);
+	  overflowed_p = mips_elf_overflow_p (value, 16);
+	}
+      break;
+
+    case R_MIPS_LO16:
+      if (!gp_disp_p)
+	value = (symbol + addend) & howto->dst_mask;
+      else
+	{
+	  value = addend + gp - p + 4;
+	  /* The MIPS ABI requires checking the R_MIPS_LO16 relocation
+	     for overflow.  But, on, say, Irix 5, relocations against
+	     _gp_disp are normally generated from the .cpload
+	     pseudo-op.  It generates code that normally looks like
+	     this:
+
+	       lui    $gp,%hi(_gp_disp)
+	       addiu  $gp,$gp,%lo(_gp_disp)
+	       addu   $gp,$gp,$t9
+
+	     Here $t9 holds the address of the function being called,
+	     as required by the MIPS ELF ABI.  The R_MIPS_LO16
+	     relocation can easily overflow in this situation, but the
+	     R_MIPS_HI16 relocation will handle the overflow.
+	     Therefore, we consider this a bug in the MIPS ABI, and do
+	     not check for overflow here.  */
+	}
+      break;
+
+    case R_MIPS_LITERAL:
+      /* Because we don't merge literal sections, we can handle this
+	 just like R_MIPS_GPREL16.  In the long run, we should merge
+	 shared literals, and then we will need to additional work
+	 here.  */
+
+      /* Fall through.  */
+
+    case R_MIPS16_GPREL:
+      /* The R_MIPS16_GPREL performs the same calculation as
+	 R_MIPS_GPREL16, but stores the relocated bits in a different
+	 order.  We don't need to do anything special here; the
+	 differences are handled in mips_elf_perform_relocation.  */
+    case R_MIPS_GPREL16:
+      if (local_p)
+	value = mips_elf_sign_extend (addend, 16) + symbol + gp0 - gp;
+      else
+	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);
+	  if (value == (bfd_vma) -1)
+	    return false;
+	  value 
+	    = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+					      abfd,
+					      value);
+	  overflowed_p = mips_elf_overflow_p (value, 16);
+	  break;
+	}
+
+      /* Fall through.  */
+
+    case R_MIPS_CALL16:
+    case R_MIPS_GOT_DISP:
+      value = g;
+      overflowed_p = mips_elf_overflow_p (value, 16);
+      break;
+
+    case R_MIPS_GPREL32:
+      value = (addend + symbol + gp0 - gp) & howto->dst_mask;
+      break;
+
+    case R_MIPS_PC16:
+      value = mips_elf_sign_extend (addend, 16) + symbol - p;
+      value = (bfd_vma) ((bfd_signed_vma) value / 4);
+      overflowed_p = mips_elf_overflow_p (value, 16);
+      break;
+
+    case R_MIPS_GOT_HI16:
+    case R_MIPS_CALL_HI16:
+      /* We're allowed to handle these two relocations identically.
+	 The dynamic linker is allowed to handle the CALL relocations
+	 differently by creating a lazy evaluation stub.  */
+      value = g;
+      value = mips_elf_high (value);
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_GOT_LO16:
+    case R_MIPS_CALL_LO16:
+      value = g & howto->dst_mask;
+      break;
+
+    case R_MIPS_GOT_PAGE:
+      value = mips_elf_got_page (abfd, info, symbol + addend, NULL);
+      if (value == (bfd_vma) -1)
+	return false;
+      value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+					      abfd,
+					      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);
+      break;
+
+    case R_MIPS_SUB:
+      value = symbol - addend;
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_HIGHER:
+      value = mips_elf_higher (addend + symbol);
+      value &= howto->dst_mask;
+      break;
+
+    case R_MIPS_HIGHEST:
+      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;
+      break;
+
+    case R_MIPS_PJUMP:
+    case R_MIPS_JALR:
+      /* Both of these may be ignored.  R_MIPS_JALR is an optimization
+	 hint; we could improve performance by honoring that hint.  */
+      return bfd_reloc_continue;
+
+    case R_MIPS_GNU_VTINHERIT:
+    case R_MIPS_GNU_VTENTRY:
+      /* We don't do anything with these at present.  */
+      return bfd_reloc_continue;
+
+    default:
+      /* An unrecognized relocation type.  */
+      return bfd_reloc_notsupported;
+    }
+
+  /* Store the VALUE for our caller.  */
+  *valuep = value;
+  return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok;
+}
+
+/* Obtain the field relocated by RELOCATION.  */
+
+static bfd_vma
+mips_elf_obtain_contents (howto, relocation, input_bfd, contents)
+     reloc_howto_type *howto;
+     const Elf_Internal_Rela *relocation;
+     bfd *input_bfd;
+     bfd_byte *contents;
+{
+  bfd_vma x;
+  bfd_byte *location = contents + relocation->r_offset;
+
+  /* Obtain the bytes.  */
+  x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location);
+
+  if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26
+       || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL)
+      && bfd_little_endian (input_bfd))
+    /* The two 16-bit words will be reversed on a little-endian
+       system.  See mips_elf_perform_relocation for more details.  */
+    x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
+
+  return x;
+}
+
+/* It has been determined that the result of the RELOCATION is the
+   VALUE.  Use HOWTO to place VALUE into the output file at the
+   appropriate position.  The SECTION is the section to which the
+   relocation applies.  If REQUIRE_JALX is true, then the opcode used
+   for the relocation must be either JAL or JALX, and it is
+   unconditionally converted to JALX.
+
+   Returns false if anything goes wrong.  */
+
+static boolean
+mips_elf_perform_relocation (info, howto, relocation, value,
+			     input_bfd, input_section, 
+			     contents, require_jalx)
+     struct bfd_link_info *info;
+     reloc_howto_type *howto;
+     const Elf_Internal_Rela *relocation;
+     bfd_vma value;
+     bfd *input_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     boolean require_jalx;
+{
+  bfd_vma x;
+  bfd_byte *location;
+  int r_type = ELF32_R_TYPE (relocation->r_info);
+
+  /* Figure out where the relocation is occurring.  */
+  location = contents + relocation->r_offset;
+
+  /* Obtain the current value.  */
+  x = mips_elf_obtain_contents (howto, relocation, input_bfd, contents);
+
+  /* Clear the field we are setting.  */
+  x &= ~howto->dst_mask;
+
+  /* If this is the R_MIPS16_26 relocation, we must store the
+     value in a funny way.  */
+  if (r_type == R_MIPS16_26)
+    {
+      /* R_MIPS16_26 is used for the mips16 jal and jalx instructions.
+	 Most mips16 instructions are 16 bits, but these instructions
+	 are 32 bits.
+
+	 The format of these instructions is:
+
+	 +--------------+--------------------------------+
+	 !     JALX     ! X!   Imm 20:16  !   Imm 25:21  !
+	 +--------------+--------------------------------+
+	 !	  	  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.
+
+	 When producing a relocateable object file, R_MIPS16_26 is
+	 handled mostly like R_MIPS_26.  In particular, the addend is
+	 stored as a straight 26-bit value in a 32-bit instruction.
+	 (gas makes life simpler for itself by never adjusting a
+	 R_MIPS16_26 reloc to be against a section, so the addend is
+	 always zero).  However, the 32 bit instruction is stored as 2
+	 16-bit values, rather than a single 32-bit value.  In a
+	 big-endian file, the result is the same; in a little-endian
+	 file, the two 16-bit halves of the 32 bit value are swapped.
+	 This is so that a disassembler can recognize the jal
+	 instruction.
+
+	 When doing a final link, R_MIPS16_26 is treated as a 32 bit
+	 instruction stored as two 16-bit values.  The addend A is the
+	 contents of the targ26 field.  The calculation is the same as
+	 R_MIPS_26.  When storing the calculated value, reorder the
+	 immediate value as shown above, and don't forget to store the
+	 value as two 16-bit values.
+
+	 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:
+	 +----------+------+-------------+
+	 |          |      |             |
+	 |  sub1    |      |     sub2    |
+	 |0        9|10  15|16         31|
+	 +----------+--------------------+
+	 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
+	 let R = (((A < 2) | (P & 0xf0000000) + S) >> 2)
+	 ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff)  */
+
+      if (!info->relocateable)
+	/* Shuffle the bits according to the formula above.  */
+	value = (((value & 0x1f0000) << 5) 
+		 | ((value & 0x3e00000) >> 5) 
+		 | (value & 0xffff));
+      
+    }
+  else if (r_type == R_MIPS16_GPREL)
+    {
+      /* R_MIPS16_GPREL is used for GP-relative addressing in mips16
+	 mode.  A typical instruction will have a format like this:
+
+	 +--------------+--------------------------------+
+	 !    EXTEND    !     Imm 10:5    !   Imm 15:11  !
+	 +--------------+--------------------------------+
+	 !    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.  
+
+         All we need to do here is shuffle the bits appropriately.  As
+	 above, the two 16-bit halves must be swapped on a
+	 little-endian system.  */
+      value = (((value & 0x7e0) << 16)
+	       | ((value & 0xf800) << 5)
+	       | (value & 0x1f));
+    }
+
+  /* Set the field.  */
+  x |= (value & howto->dst_mask);
+
+  /* If required, turn JAL into JALX.  */
+  if (require_jalx)
+    {
+      boolean ok;
+      bfd_vma opcode = x >> 26;
+      bfd_vma jalx_opcode;
+
+      /* Check to see if the opcode is already JAL or JALX.  */
+      if (r_type == R_MIPS16_26)
+	{
+	  ok = ((opcode == 0x6) || (opcode == 0x7));
+	  jalx_opcode = 0x7;
+	}
+      else
+	{
+	  ok = ((opcode == 0x3) || (opcode == 0x1d));
+	  jalx_opcode = 0x1d;
+	}
+
+      /* If the opcode is not JAL or JALX, there's a problem.  */
+      if (!ok)
+	{
+	  (*_bfd_error_handler)
+	    (_("%s: %s+0x%lx: jump to stub routine which is not jal"),
+	     bfd_get_filename (input_bfd),
+	     input_section->name,
+	     (unsigned long) relocation->r_offset);
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+
+      /* Make this the JALX opcode.  */
+      x = (x & ~(0x3f << 26)) | (jalx_opcode << 26);
+    }
+
+  /* Swap the high- and low-order 16 bits on little-endian systems
+     when doing a MIPS16 relocation.  */
+  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;
+}
+
+/* Returns true if SECTION is a MIPS16 stub section.  */
+
+static boolean
+mips_elf_stub_section_p (abfd, section)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section;
+{
+  const char *name = bfd_get_section_name (abfd, section);
+
+  return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0
+	  || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
+	  || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0);
 }
 
 /* Relocate a MIPS ELF section.  */
 
-static boolean
-mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
-			   contents, relocs, local_syms, local_sections)
+boolean
+_bfd_mips_elf_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;
@@ -4764,897 +6541,357 @@
      Elf_Internal_Sym *local_syms;
      asection **local_sections;
 {
-  Elf_Internal_Shdr *symtab_hdr;
-  size_t locsymcount;
-  size_t extsymoff;
-  asection *sgot, *sreloc, *scpt;
-  bfd *dynobj;
-  bfd_vma gp;
   Elf_Internal_Rela *rel;
-  Elf_Internal_Rela *relend;
-  struct mips_got_info *g;
+  const Elf_Internal_Rela *relend;
+  bfd_vma addend = 0;
+  boolean use_saved_addend_p = false;
+  struct elf_backend_data *bed;
 
-  dynobj = elf_hash_table (info)->dynobj;
-  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-
-  sgot = NULL;
-  sreloc = NULL;
-  if (dynobj == NULL || ! SGI_COMPAT (output_bfd))
-    scpt = NULL;
-  else
-    scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
-  g = NULL;
-
-  if (elf_bad_symtab (input_bfd))
+  bed = get_elf_backend_data (output_bfd);
+  relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+  for (rel = relocs; rel < relend; ++rel)
     {
-      locsymcount = symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
-      extsymoff = 0;
-    }
-  else
-    {
-      locsymcount = symtab_hdr->sh_info;
-      extsymoff = symtab_hdr->sh_info;
-    }
-
-  gp = _bfd_get_gp_value (output_bfd);
-
-  rel = relocs;
-  relend = relocs + input_section->reloc_count;
-  for (; rel < relend; rel++)
-    {
-      int r_type;
+      const char *name;
+      bfd_vma value;
       reloc_howto_type *howto;
-      unsigned long r_symndx;
-      bfd_vma addend;
-      struct elf_link_hash_entry *h;
-      asection *sec;
-      Elf_Internal_Sym *sym;
-      struct mips_elf_link_hash_entry *mh;
-      int other;
-      bfd_reloc_status_type r;
+      boolean require_jalx;
+      /* True if the relocation is a RELA relocation, rather than a
+         REL relocation.  */
+      boolean rela_relocation_p = true;
+      int r_type = ELF32_R_TYPE (rel->r_info);
 
-      r_type = ELF32_R_TYPE (rel->r_info);
-      if (r_type == R_MIPS_GNU_VTINHERIT
-	  || r_type == R_MIPS_GNU_VTENTRY)
-	continue;
-      if ((r_type < 0 || r_type >= (int) R_MIPS_max)
-	  && r_type != R_MIPS16_26
-	  && r_type != R_MIPS16_GPREL)
+      /* Find the relocation howto for this relocation.  */
+      if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
 	{
-	  bfd_set_error (bfd_error_bad_value);
-	  return false;
+	  /* Some 32-bit code uses R_MIPS_64.  In particular, people use
+	     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
+	     stored value is sign-extended to 64 bits.  */
+	  howto = elf_mips_howto_table + R_MIPS_32;
+
+	  /* On big-endian systems, we need to lie about the position
+	     of the reloc.  */
+	  if (bfd_big_endian (input_bfd))
+	      rel->r_offset += 4;
 	}
-      if (r_type == R_MIPS16_26)
-	howto = &elf_mips16_jump_howto;
-      else if (r_type == R_MIPS16_GPREL)
-	howto = &elf_mips16_gprel_howto;
       else
-	howto = elf_mips_howto_table + r_type;
+	howto = mips_rtype_to_howto (r_type);
 
-      if (dynobj != NULL
-	  && (r_type == R_MIPS_CALL16
-	      || r_type == R_MIPS_GOT16
-	      || r_type == R_MIPS_CALL_HI16
-	      || r_type == R_MIPS_CALL_LO16
-	      || r_type == R_MIPS_GOT_HI16
-	      || r_type == R_MIPS_GOT_LO16))
+      if (!use_saved_addend_p)
 	{
-	  /* We need the .got section.  */
-	  if (sgot == NULL)
-	    {
-	      sgot = bfd_get_section_by_name (dynobj, ".got");
-	      BFD_ASSERT (sgot != NULL);
-	      BFD_ASSERT (elf_section_data (sgot) != NULL);
-	      g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
-	      BFD_ASSERT (g != NULL);
-	    }
-	}
+	  Elf_Internal_Shdr *rel_hdr;
 
-      r_symndx = ELF32_R_SYM (rel->r_info);
+	  /* If these relocations were originally of the REL variety,
+	     we must pull the addend out of the field that will be
+	     relocated.  Otherwise, we simply use the contents of the
+	     RELA relocation.  To determine which flavor or relocation
+	     this is, we depend on the fact that the INPUT_SECTION's
+	     REL_HDR is read before its REL_HDR2.  */
+	  rel_hdr = &elf_section_data (input_section)->rel_hdr;
+	  if ((size_t) (rel - relocs)
+	      >= (rel_hdr->sh_size / rel_hdr->sh_entsize
+		  * bed->s->int_rels_per_ext_rel))
+	    rel_hdr = elf_section_data (input_section)->rel_hdr2;
+	  if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd))
+	    {
+	      /* Note that this is a REL relocation.  */
+	      rela_relocation_p = false;
 
-      /* Mix in the change in GP address for a GP relative reloc.  */
-      if (r_type != R_MIPS_GPREL16
-	  && r_type != R_MIPS_LITERAL
-	  && r_type != R_MIPS_GPREL32
-	  && r_type != R_MIPS16_GPREL)
-	addend = 0;
-      else
-	{
-	  if (gp == 0)
-	    {
-	      if (! ((*info->callbacks->reloc_dangerous)
-		     (info,
-		      _("GP relative relocation when GP not defined"),
-		      input_bfd, input_section,
-		      rel->r_offset)))
-		return false;
-	      /* Only give the error once per link.  */
-	      gp = 4;
-	      _bfd_set_gp_value (output_bfd, gp);
-	    }
+	      /* Get the addend, which is stored in the input file.  */
+	      addend = mips_elf_obtain_contents (howto, 
+						 rel,
+						 input_bfd,
+						 contents);
+	      addend &= howto->src_mask;
 
-	  if (r_symndx < extsymoff
-	      || (elf_bad_symtab (input_bfd)
-		  && local_sections[r_symndx] != NULL))
-	    {
-	      /* This is a relocation against a section.  The current
-		 addend in the instruction is the difference between
-		 INPUT_SECTION->vma and the GP value of INPUT_BFD.  We
-		 must change this to be the difference between the
-		 final definition (which will end up in RELOCATION)
-		 and the GP value of OUTPUT_BFD (which is in GP).  */
-	      addend = elf_gp (input_bfd) - gp;
-	    }
-	  else if (! info->relocateable)
-	    {
-	      /* We are doing a final link.  The current addend in the
-		 instruction is simply the desired offset into the
-		 symbol (normally zero).  We want the instruction to
-		 hold the difference between the final definition of
-		 the symbol (which will end up in RELOCATION) and the
-		 GP value of OUTPUT_BFD (which is in GP).  */
-	      addend = - gp;
+	      /* For some kinds of relocations, the ADDEND is a
+		 combination of the addend stored in two different
+		 relocations.   */
+	      if (r_type == R_MIPS_HI16
+		  || r_type == R_MIPS_GNU_REL_HI16
+		  || (r_type == R_MIPS_GOT16
+		      && mips_elf_local_relocation_p (input_bfd, rel,
+						      local_sections)))
+		{
+		  bfd_vma l;
+		  const Elf_Internal_Rela *lo16_relocation;
+		  reloc_howto_type *lo16_howto;
+		  int lo;
+
+		  /* The combined value is the sum of the HI16 addend,
+		     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.)  
+
+		     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); 
+		  if (lo16_relocation == NULL)
+		    return false;
+
+		  /* Obtain the addend kept there.  */
+		  lo16_howto = mips_rtype_to_howto (lo);
+		  l = mips_elf_obtain_contents (lo16_howto,
+						lo16_relocation,
+						input_bfd, contents);
+		  l &= lo16_howto->src_mask;
+		  l = mips_elf_sign_extend (l, 16);
+
+		  addend <<= 16;
+
+		  /* Compute the combined addend.  */
+		  addend += l;
+		}
+	      else if (r_type == R_MIPS16_GPREL)
+		{
+		  /* The addend is scrambled in the object file.  See
+		     mips_elf_perform_relocation for details on the
+		     format.  */
+		  addend = (((addend & 0x1f0000) >> 5)
+			    | ((addend & 0x7e00000) >> 16)
+			    | (addend & 0x1f));
+		}
 	    }
 	  else
-	    {
-	      /* We are generating relocateable output, and we aren't
-		 going to define this symbol, so we just leave the
-		 instruction alone.  */
-	      addend = 0;
-	    }
+	    addend = rel->r_addend;
 	}
 
-      h = NULL;
-      sym = NULL;
-      sec = NULL;
       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 >= locsymcount
-	      || (elf_bad_symtab (input_bfd)
-		  && local_sections[r_symndx] == NULL))
-	    r = bfd_reloc_ok;
+	  Elf_Internal_Sym *sym;
+	  unsigned long r_symndx;
+
+	  if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)
+	      && bfd_big_endian (input_bfd))
+	    rel->r_offset -= 4;
+
+	  /* Since we're just relocating, all we need to do is copy
+	     the relocations back out to the object file, unless
+	     they're against a section symbol, in which case we need
+	     to adjust by the section offset, or unless they're GP
+	     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))
+	    /* There's nothing to do for non-local relocations.  */
+	    continue;
+
+	  if (r_type == R_MIPS16_GPREL 
+	      || r_type == R_MIPS_GPREL16
+	      || r_type == R_MIPS_GPREL32
+	      || r_type == R_MIPS_LITERAL)
+	    addend -= (_bfd_get_gp_value (output_bfd)
+		       - _bfd_get_gp_value (input_bfd));
+	  else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26
+		   || r_type == R_MIPS_GNU_REL16_S2)
+	    /* The addend is stored without its two least
+	       significant bits (which are always zero.)  In a
+	       non-relocateable link, calculate_relocation will do
+	       this shift; here, we must do it ourselves.  */
+	    addend <<= 2;
+
+	  r_symndx = ELF32_R_SYM (rel->r_info);
+	  sym = local_syms + r_symndx;
+	  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.  */
+	  if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16
+	      || r_type == R_MIPS_GNU_REL_HI16)
+	    addend = mips_elf_high (addend);
+	  /* If the relocation is for an R_MIPS_26 relocation, then
+	     the two low-order bits are not stored in the object file;
+	     they are implicitly zero.  */
+	  else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26
+		   || r_type == R_MIPS_GNU_REL16_S2)
+	    addend >>= 2;
+
+	  if (rela_relocation_p)
+	    /* If this is a RELA relocation, just update the addend.
+	       We have to cast away constness for REL.  */
+	    rel->r_addend = addend;
 	  else
 	    {
-	      sym = local_syms + r_symndx;
-	      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-		r = bfd_reloc_ok;
-	      else
+	      /* Otherwise, we have to write the value back out.  Note
+		 that we use the source mask, rather than the
+		 destination mask because the place to which we are
+		 writing will be source of the addend in the final
+		 link.  */
+	      addend &= howto->src_mask;
+
+	      if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
+		/* See the comment above about using R_MIPS_64 in the 32-bit
+		   ABI.  Here, we need to update the addend.  It would be
+		   possible to get away with just using the R_MIPS_32 reloc
+		   but for endianness.  */
 		{
-		  sec = local_sections[r_symndx];
-
-		  /* It would be logical to add sym->st_value here,
-		     but Irix 5 sometimes generates a garbage symbol
-		     value.  */
-		  addend += sec->output_offset;
-
-		  /* If this is HI16 or GOT16 with an associated LO16,
-		     adjust the addend accordingly.  Otherwise, just
-		     relocate.  */
-		  if (r_type == R_MIPS_64 && bfd_big_endian (input_bfd))
-		    r = _bfd_relocate_contents (howto, input_bfd,
-						addend,
-						contents + rel->r_offset + 4);
-		  else if (r_type != R_MIPS_HI16 && r_type != R_MIPS_GOT16)
-		    r = _bfd_relocate_contents (howto, input_bfd,
-						addend,
-						contents + rel->r_offset);
+		  bfd_vma sign_bits;
+		  bfd_vma low_bits;
+		  bfd_vma high_bits;
+		  
+		  if (addend & 0x80000000u)
+		    sign_bits = 0xffffffffu;
 		  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))
 		    {
-		      Elf_Internal_Rela *lorel;
-
-		      /* As a GNU extension, permit an arbitrary
-			 number of R_MIPS_HI16 relocs before the
-			 R_MIPS_LO16 reloc.  This permits gcc to emit
-			 the HI and LO relocs itself.  */
-		      if (r_type == R_MIPS_GOT16)
-			lorel = rel + 1;
-		      else
-			{
-			  for (lorel = rel + 1;
-			       (lorel < relend
-				&& (ELF32_R_TYPE (lorel->r_info)
-				    == R_MIPS_HI16));
-			       lorel++)
-			    ;
-			}
-		      if (lorel < relend
-			  && ELF32_R_TYPE (lorel->r_info) == R_MIPS_LO16)
-			{
-			  mips_elf_relocate_hi16 (input_bfd, rel, lorel,
-						  contents, addend);
-			  r = bfd_reloc_ok;
-			}
-		      else
-			r = _bfd_relocate_contents (howto, input_bfd,
-						    addend,
-						    contents + rel->r_offset);
-		    }
-		}
-	    }
-	}
-      else
-	{
-	  bfd_vma relocation;
-	  boolean local;
-	  boolean undefined_error;
-
-	  /* This is a final link.  */
-	  undefined_error = false;
-	  sym = NULL;
-	  if (r_symndx < extsymoff
-	      || (elf_bad_symtab (input_bfd)
-		  && local_sections[r_symndx] != NULL))
-	    {
-	      local = true;
-	      sym = local_syms + r_symndx;
-	      sec = local_sections[r_symndx];
-	      relocation = (sec->output_section->vma
-			    + sec->output_offset);
-
-	      /* It would be logical to always add sym->st_value here,
-		 but Irix 5 sometimes generates a garbage symbol
-		 value.  */
-	      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-		relocation += sym->st_value;
-
-	      /* mips16 text labels should be treated as odd.  */
-	      if (sym->st_other == STO_MIPS16)
-		++relocation;
-	    }
-	  else
-	    {
-	      long indx;
-
-	      local = false;
-	      indx = r_symndx - extsymoff;
-	      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 (strcmp (h->root.root.string, "_gp_disp") == 0)
-		{
-		  if (gp == 0)
-		    {
-		      if (! ((*info->callbacks->reloc_dangerous)
-			     (info,
-			      _("_gp_disp used when GP not defined"),
-			      input_bfd, input_section,
-			      rel->r_offset)))
-			return false;
-		      /* Only give the error once per link.  */
-		      gp = 4;
-		      _bfd_set_gp_value (output_bfd, gp);
-		      relocation = 0;
+		      /* Store the sign-bits (which are most significant)
+			 first.  */
+		      low_bits = sign_bits;
+		      high_bits = addend;
 		    }
 		  else
 		    {
-		      sec = input_section;
-		      if (sec->output_section != NULL)
-			relocation = (gp
-				      - (rel->r_offset
-					 + sec->output_section->vma
-					 + sec->output_offset));
-		      else
-			relocation = gp - rel->r_offset;
-		      if (r_type == R_MIPS_LO16)
-			relocation += 4;
+		      low_bits = addend;
+		      high_bits = sign_bits;
 		    }
-		}
-	      else 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)
-		    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 (strcmp (h->root.root.string, "_DYNAMIC_LINK") == 0)
-		{
-		  /* If this is a dynamic link, we should have created
-                     a _DYNAMIC_LINK symbol 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.  */
-		  BFD_ASSERT (! info->shared);
-		  BFD_ASSERT (bfd_get_section_by_name (output_bfd,
-						       ".dynamic") == NULL);
-		  relocation = 0;
-		}
-	      else
-		{
-		  if (! ((*info->callbacks->undefined_symbol)
-			 (info, h->root.root.string, input_bfd,
-			  input_section, rel->r_offset)))
-		    return false;
-		  undefined_error = true;
-		  relocation = 0;
-		}
-	    }
-
-	  mh = (struct mips_elf_link_hash_entry *) h;
-	  if (h != NULL)
-	    other = h->other;
-	  else if (sym != NULL)
-	    other = sym->st_other;
-	  else
-	    other = 0;
-
-	  /* If this function has an fn_stub, then it is a mips16
-	     function which needs a stub if it is called by a 32 bit
-	     function.  If this reloc is anything other than a 16 bit
-	     call, redirect the reloc to the stub.  We don't redirect
-	     relocs from other stub functions.  */
-	  if (r_type != R_MIPS16_26
-	      && ((mh != NULL
-		   && mh->fn_stub != NULL)
-		  || (mh == NULL
-		      && elf_tdata (input_bfd)->local_stubs != NULL
-		      && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL))
-	      && strncmp (bfd_get_section_name (input_bfd, input_section),
-			  FN_STUB, sizeof FN_STUB - 1) != 0
-	      && strncmp (bfd_get_section_name (input_bfd, input_section),
-			  CALL_STUB, sizeof CALL_STUB - 1) != 0
-	      && strncmp (bfd_get_section_name (input_bfd, input_section),
-			  CALL_FP_STUB, sizeof CALL_FP_STUB - 1) != 0)
-	    {
-	      if (mh != NULL)
-		{
-		  BFD_ASSERT (mh->need_fn_stub);
-		  relocation = (mh->fn_stub->output_section->vma
-				+ mh->fn_stub->output_offset);
-		}
-	      else
-		{
-		  asection *fn_stub;
-
-		  fn_stub = elf_tdata (input_bfd)->local_stubs[r_symndx];
-		  relocation = (fn_stub->output_section->vma
-				+ fn_stub->output_offset);
-		}
-
-	      /* RELOCATION now points to 32 bit code.  */
-	      other = 0;
-	    }
-
-	  /* If this function has a call_stub, then it is called by a
-             mips16 function; the call needs to go through a stub if
-             this function is a 32 bit function.  If this reloc is a
-             16 bit call, and the symbol is not a 16 bit function,
-             then redirect the reloc to the stub.  Note that we don't
-             need to worry about calling the function through a
-             function pointer; such calls are handled by routing
-             through a special mips16 routine.  We don't have to check
-             whether this call is from a stub; it can't be, because a
-             stub contains 32 bit code, and hence can not have a 16
-             bit reloc.  */
-	  if (r_type == R_MIPS16_26
-	      && mh != NULL
-	      && (mh->call_stub != NULL || mh->call_fp_stub != NULL)
-	      && other != STO_MIPS16)
-	    {
-	      asection *stub;
-
-	      /* If both call_stub and call_fp_stub are defined, we
-                 can figure out which one to use by seeing which one
-                 appears in the input file.  */
-	      if (mh->call_stub != NULL && mh->call_fp_stub != NULL)
-		{
-		  asection *o;
-
-		  stub = NULL;
-		  for (o = input_bfd->sections; o != NULL; o = o->next)
-		    {
-		      if (strncmp (bfd_get_section_name (input_bfd, o),
-				   CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
-			{
-			  stub = mh->call_fp_stub;
-			  break;
-			}
-		    }
-		  if (stub == NULL)
-		    stub = mh->call_stub;
-		}
-	      else if (mh->call_stub != NULL)
-		stub = mh->call_stub;
-	      else
-		stub = mh->call_fp_stub;
-
-	      BFD_ASSERT (stub->_raw_size > 0);
-	      relocation = stub->output_section->vma + stub->output_offset;
-	    }
-
-	  if (r_type == R_MIPS_HI16)
-	    {
-	      Elf_Internal_Rela *lorel;
-
-	      /* As a GNU extension, permit an arbitrary number of
-		 R_MIPS_HI16 relocs before the R_MIPS_LO16 reloc.
-		 This permits gcc to emit the HI and LO relocs itself.  */
-	      for (lorel = rel + 1;
-		   (lorel < relend
-		    && ELF32_R_TYPE (lorel->r_info) == R_MIPS_HI16);
-		   lorel++)
-		;
-	      if (lorel < relend
-		  && ELF32_R_TYPE (lorel->r_info) == R_MIPS_LO16)
-		{
-		  mips_elf_relocate_hi16 (input_bfd, rel, lorel,
-					  contents, relocation + addend);
-		  r = bfd_reloc_ok;
-		}
-	      else
-		r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					      contents, rel->r_offset,
-					      relocation, addend);
-	    }
-	  else if (r_type == R_MIPS_GOT16 && local)
-	    {
-	      /* GOT16 must also have an associated LO16 in the local
-		 case.  In this case, the addend is extracted and the
-		 section in which the referenced object is determined.
-		 Then the final address of the object is computed and
-		 the GOT entry for the hipage (an aligned 64kb chunk)
-		 is added to .got section if needed.  The offset field
-		 of the GOT16-relocated instruction is replaced by the
-		 index of this GOT entry for the hipage.  */
-	      if ((rel + 1) < relend
-		  && ELF32_R_TYPE ((rel + 1)->r_info) == R_MIPS_LO16)
-		{
-		  if (! mips_elf_relocate_got_local (output_bfd, input_bfd,
-						     sgot, rel, rel + 1,
-						     contents,
-						     relocation + addend))
-		    return false;
-		  r = bfd_reloc_ok;
-		}
-	      else
-		r = bfd_reloc_outofrange;
-	    }
-	  else if (r_type == R_MIPS_CALL16
-		   || r_type == R_MIPS_GOT16
-		   || r_type == R_MIPS_CALL_LO16
-		   || r_type == R_MIPS_GOT_LO16)
-	    {
-	      bfd_vma offset;
-
-	      /* This symbol must be registered as a global symbol
-		 having the corresponding got entry.  */
-	      BFD_ASSERT (h->got.offset != (bfd_vma) -1);
-
-	      offset = (h->dynindx - g->global_gotsym + g->local_gotno) * 4;
-	      BFD_ASSERT (g->local_gotno <= offset
-			  && offset < sgot->_raw_size);
-	      bfd_put_32 (output_bfd, relocation + addend,
-			  sgot->contents + offset);
-	      offset = (sgot->output_section->vma + sgot->output_offset
-			+ offset - gp);
-	      mips_elf_relocate_global_got (input_bfd, rel, contents,
-					    offset);
-	      r = bfd_reloc_ok;
-	    }
-	  else if (r_type == R_MIPS_CALL_HI16
-		   || r_type == R_MIPS_GOT_HI16)
-	    {
-	      bfd_vma offset;
-
-	      /* This must be a global symbol with a got entry.  The
-                 next reloc must be the corresponding LO16 reloc.  */
-	      BFD_ASSERT (h != NULL && h->got.offset != (bfd_vma) -1);
-	      BFD_ASSERT ((rel + 1) < relend);
-	      BFD_ASSERT ((int) ELF32_R_TYPE ((rel + 1)->r_info)
-			  == (r_type == R_MIPS_CALL_HI16
-			      ? (int) R_MIPS_CALL_LO16
-			      : (int) R_MIPS_GOT_LO16));
-
-	      offset = (h->dynindx - g->global_gotsym + g->local_gotno) * 4;
-	      BFD_ASSERT (g->local_gotno <= offset
-			  && offset < sgot->_raw_size);
-	      bfd_put_32 (output_bfd, relocation + addend,
-			  sgot->contents + offset);
-	      offset = (sgot->output_section->vma + sgot->output_offset
-			+ offset - gp);
-	      mips_elf_relocate_hi16 (input_bfd, rel, rel + 1, contents,
-				      offset);
-	      r = bfd_reloc_ok;
-	    }
-	  else if (r_type == R_MIPS_REL32
-		   || r_type == R_MIPS_32)
-	    {
-	      Elf_Internal_Rel outrel;
-	      Elf32_crinfo cptrel;
-	      bfd_byte *cr;
-
-	      if ((info->shared
-		   || (elf_hash_table (info)->dynamic_sections_created
-		       && h != NULL
-		       && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
-			   == 0)))
-		  && (input_section->flags & SEC_ALLOC) != 0)
-		{
-		  boolean skip;
-
-		  /* When generating a shared object, these
-		     relocations are copied into the output file to be
-		     resolved at run time.  */
-		  if (sreloc == NULL)
-		    {
-		      sreloc = bfd_get_section_by_name (dynobj, ".rel.dyn");
-		      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);
-
-		  addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
-
-		  if (skip)
-		    memset (&outrel, 0, sizeof outrel);
-		  else if (h != NULL
-			   && (! info->symbolic
-			       || (h->elf_link_hash_flags
-				   & ELF_LINK_HASH_DEF_REGULAR) == 0))
-		    {
-		      BFD_ASSERT (h->dynindx != -1);
-		      outrel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_REL32);
-		      sec = input_section;
-		    }
-		  else
-		    {
-		      long indx;
-
-		      if (h == NULL)
-			sec = local_sections[r_symndx];
-		      else
-			{
-			  BFD_ASSERT (h->root.type == bfd_link_hash_defined
-				      || (h->root.type
-					  == bfd_link_hash_defweak));
-			  sec = h->root.u.def.section;
-			}
-		      if (sec != NULL && bfd_is_abs_section (sec))
-			indx = 0;
-		      else if (sec == NULL || sec->owner == NULL)
-			{
-			  bfd_set_error (bfd_error_bad_value);
-			  return false;
-			}
-		      else
-			{
-			  asection *osec;
-
-			  osec = sec->output_section;
-			  indx = elf_section_data (osec)->dynindx;
-			  if (indx == 0)
-			    abort ();
-			}
-
-		      outrel.r_info = ELF32_R_INFO (indx, R_MIPS_REL32);
-		      addend += relocation;
-		    }
-
-		  if (! skip)
-		    bfd_put_32 (output_bfd, addend, contents + rel->r_offset);
-
-		  bfd_elf32_swap_reloc_out (output_bfd, &outrel,
-					     (((Elf32_External_Rel *)
-					       sreloc->contents)
-					      + sreloc->reloc_count));
-		  ++sreloc->reloc_count;
-
-		  if (! skip && SGI_COMPAT (output_bfd))
-		    {
-		      if (scpt == NULL)
-			continue;
-
-		      /* Make an entry of compact relocation info.  */
-		      mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG);
-		      cptrel.vaddr = (rel->r_offset
-				      + input_section->output_section->vma
-				      + input_section->output_offset);
-		      if (r_type == R_MIPS_REL32)
-			mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32);
-		      else
-			mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD);
-		      mips_elf_set_cr_dist2to (cptrel, 0);
-		      cptrel.konst = addend;
-
-		      cr = (scpt->contents
-			    + sizeof (Elf32_External_compact_rel));
-		      bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
-						 ((Elf32_External_crinfo *) cr
-						  + scpt->reloc_count));
-		      ++scpt->reloc_count;
-		    }
-
-		  /* This reloc will be computed at runtime, so
-		     there's no need to do anything now.  */
+		  bfd_put_32 (input_bfd, low_bits, 
+			      contents + rel->r_offset);
+		  bfd_put_32 (input_bfd, high_bits, 
+			      contents + rel->r_offset + 4);
 		  continue;
 		}
-	      else
-		r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					      contents, rel->r_offset,
-					      relocation, addend);
+
+	      if (!mips_elf_perform_relocation (info, howto, rel, addend,
+						input_bfd,  input_section, 
+						contents, false))
+		return false;
 	    }
-	  else if (r_type == R_MIPS_64)
-	    {
-	      bfd_size_type addr;
-	      unsigned long val;
 
-	      /* Do a 32 bit relocation, and sign extend to 64 bits.  */
-	      addr = rel->r_offset;
-	      if (bfd_big_endian (input_bfd))
-		addr += 4;
-	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					    contents, addr, relocation,
-					    addend);
-	      val = bfd_get_32 (input_bfd, contents + addr);
-	      if ((val & 0x80000000) != 0)
-		val = 0xffffffff;
-	      else
-		val = 0;
-	      addr = rel->r_offset;
-	      if (bfd_little_endian (input_bfd))
-		addr += 4;
-	      bfd_put_32 (input_bfd, val, contents + addr);
+	  /* Go on to the next relocation.  */
+	  continue;
+	}
+
+      /* In the N32 and 64-bit ABIs there may be multiple consecutive
+	 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 
+	  && rel->r_offset == rel[1].r_offset
+	  && ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE)
+	use_saved_addend_p = true;
+      else
+	use_saved_addend_p = false;
+
+      /* Figure out what value we are supposed to relocate.  */
+      switch (mips_elf_calculate_relocation (output_bfd, 
+					     input_bfd,
+					     input_section,
+					     info,
+					     rel,
+					     addend,
+					     howto,
+					     local_syms,
+					     local_sections,
+					     &value,
+					     &name,
+					     &require_jalx))
+	{
+	case bfd_reloc_continue:
+	  /* There's nothing to do.  */
+	  continue;
+
+	case bfd_reloc_undefined:
+	  /* mips_elf_calculate_relocation already called the
+	     undefined_symbol callback.  There's no real point in
+	     trying to perform the relocation at this point, so we
+	     just skip ahead to the next relocation.  */
+	  continue;
+
+	case bfd_reloc_notsupported:
+	  abort ();
+	  break;
+
+	case bfd_reloc_overflow:
+	  if (use_saved_addend_p)
+	    /* Ignore overflow until we reach the last relocation for
+	       a given location.  */
+	    ;
+	  else
+	    {
+	      BFD_ASSERT (name != NULL);
+	      if (! ((*info->callbacks->reloc_overflow)
+		     (info, name, howto->name, (bfd_vma) 0,
+		      input_bfd, input_section, rel->r_offset)))
+		return false;
 	    }
-	  else if (r_type == R_MIPS_26 && other == STO_MIPS16)
+	  break;
+
+	case bfd_reloc_ok:
+	  break;
+
+	default:
+	  abort ();
+	  break;
+	}
+
+      /* If we've got another relocation for the address, keep going
+	 until we reach the last one.  */
+      if (use_saved_addend_p)
+	{
+	  addend = value;
+	  continue;
+	}
+
+      if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
+	/* See the comment above about using R_MIPS_64 in the 32-bit
+	   ABI.  Until now, we've been using the HOWTO for R_MIPS_32;
+	   that calculated the right value.  Now, however, we
+	   sign-extend the 32-bit result to 64-bits, and store it as a
+	   64-bit value.  We are especially generous here in that we
+	   go to extreme lengths to support this usage on systems with
+	   only a 32-bit VMA.  */
+	{
+	  bfd_vma sign_bits;
+	  bfd_vma low_bits;
+	  bfd_vma high_bits;
+
+	  if (value & 0x80000000u)
+	    sign_bits = 0xffffffffu;
+	  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))
 	    {
-	      unsigned long insn;
-
-	      /* This is a jump to a mips16 routine from a mips32
-                 routine.  We need to change jal into jalx.  */
-	      insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
-	      if (((insn >> 26) & 0x3f) != 0x3
-		  && ((insn >> 26) & 0x3f) != 0x1d)
-		{
-		  (*_bfd_error_handler)
-		    (_("%s: %s+0x%lx: jump to mips16 routine which is not jal"),
-		     bfd_get_filename (input_bfd),
-		     input_section->name,
-		     (unsigned long) rel->r_offset);
-		  bfd_set_error (bfd_error_bad_value);
-		  return false;
-		}
-	      insn = (insn & 0x3ffffff) | (0x1d << 26);
-	      bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
-	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					    contents, rel->r_offset,
-					    relocation, addend);
-	    }
-	  else if (r_type == R_MIPS16_26)
-	    {
-	      /* It's easiest to do the normal relocation, and then
-                 dig out the instruction and swap the first word the
-                 way the mips16 expects it.  If this is little endian,
-                 though, we need to swap the two words first, and then
-                 swap them back again later, so that the address looks
-                 right.  */
-
-	      if (bfd_little_endian (input_bfd))
-		{
-		  unsigned long insn;
-
-		  insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
-		  insn = ((insn >> 16) & 0xffff) | ((insn & 0xffff) << 16);
-		  bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
-		}
-
-	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					    contents, rel->r_offset,
-					    relocation, addend);
-	      if (r == bfd_reloc_ok)
-		{
-		  unsigned long insn;
-
-		  if (bfd_little_endian (input_bfd))
-		    {
-		      insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
-		      insn = ((insn >> 16) & 0xffff) | ((insn & 0xffff) << 16);
-		      bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
-		    }
-
-		  insn = bfd_get_16 (input_bfd, contents + rel->r_offset);
-		  insn = ((insn & 0xfc00)
-			  | ((insn & 0x1f) << 5)
-			  | ((insn & 0x3e0) >> 5));
-		  /* If this is a jump to a 32 bit routine, then make
-		     it jalx.  */
-		  if (other != STO_MIPS16)
-		    insn |= 0x400;
-		  bfd_put_16 (input_bfd, insn, contents + rel->r_offset);
-		}
-	    }
-	  else if (r_type == R_MIPS16_GPREL)
-	    {
-	      unsigned short extend, insn;
-	      bfd_byte buf[4];
-	      unsigned long final;
-
-	      /* Extract the addend into buf, run the regular reloc,
-                 and stuff the resulting value back into the
-                 instructions.  */
-	      if (rel->r_offset > input_section->_raw_size)
-		r = bfd_reloc_outofrange;
-	      else
-		{
-		  extend = bfd_get_16 (input_bfd, contents + rel->r_offset);
-		  insn = bfd_get_16 (input_bfd, contents + rel->r_offset + 2);
-		  bfd_put_32 (input_bfd,
-			      (((extend & 0x1f) << 11)
-			       | (extend & 0x7e0)
-			       | (insn & 0x1f)),
-			      buf);
-		  r = _bfd_final_link_relocate (howto, input_bfd,
-						input_section, buf,
-						(bfd_vma) 0, relocation,
-						addend);
-		  final = bfd_get_32 (input_bfd, buf);
-		  bfd_put_16 (input_bfd,
-			      ((extend & 0xf800)
-			       | ((final >> 11) & 0x1f)
-			       | (final & 0x7e0)),
-			      contents + rel->r_offset);
-		  bfd_put_16 (input_bfd,
-			      ((insn & 0xffe0)
-			       | (final & 0x1f)),
-			      contents + rel->r_offset + 2);
-		}
+	      /* Undo what we did above.  */
+	      rel->r_offset -= 4;
+	      /* Store the sign-bits (which are most significant)
+		 first.  */
+	      low_bits = sign_bits;
+	      high_bits = value;
 	    }
 	  else
-	    r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-					  contents, rel->r_offset,
-					  relocation, addend);
-
-	  /* The jal instruction can only jump to an address which is
-             divisible by 4, and it can only jump to an address with
-             the same upper 4 bits as the PC.  */
-	  if (r == bfd_reloc_ok
-	      && (r_type == R_MIPS16_26 || r_type == R_MIPS_26))
 	    {
-	      bfd_vma addr;
-              bfd_vma pc;
-              bfd_vma target;
-
-              pc = ((input_section->output_section->vma
-                     + input_section->output_offset
-                     + rel->r_offset)
-                    & 0xf0000000);
-              target = bfd_get_32 (input_bfd, contents + rel->r_offset)
-			& (howto->dst_mask);
-              addr = (target << 2) + pc;
-	      if (other == STO_MIPS16)
-		addr &= ~ (bfd_vma) 1;
-	      if ((addr & 3) != 0
-		  || ((addr & 0xf0000000)
-                      != pc))
-		r = bfd_reloc_overflow;
+	      low_bits = value;
+	      high_bits = sign_bits;
 	    }
-
-	  /* Don't bother to report a relocation overflow for a call
-             to a weak undefined symbol with a value of zero.  This
-             permits us to use
-	         if (!f) f();
-	     even if we aren't in range to call address zero.  */
-	  if (r == bfd_reloc_overflow
-	      && (r_type == R_MIPS16_26 || r_type == R_MIPS_26)
-	      && relocation + addend == 0
-	      && h != NULL
-	      && h->root.type == bfd_link_hash_undefweak)
-	    r = bfd_reloc_ok;
-
-	  /* If we've already issued an error for an undefined symbol,
-             don't issue another useless error.  */
-	  if (undefined_error
-	      && (r == bfd_reloc_undefined || r == bfd_reloc_overflow))
-	    r = bfd_reloc_ok;
-
-	  if (SGI_COMPAT (abfd)
-	      && scpt != NULL
-	      && (input_section->flags & SEC_ALLOC) != 0)
-	    {
-	      Elf32_crinfo cptrel;
-	      bfd_byte *cr;
-
-	      /* Make an entry of compact relocation info.  */
-	      mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG);
-	      cptrel.vaddr = (rel->r_offset
-			      + input_section->output_section->vma
-			      + input_section->output_offset);
-
-	      switch (r_type)
-		{
-		case R_MIPS_26:
-		  mips_elf_set_cr_type (cptrel, CRT_MIPS_JMPAD);
-		  /* XXX How should we set dist2to in this case. */
-		  mips_elf_set_cr_dist2to (cptrel, 8);
-		  cptrel.konst = addend + relocation;
-		  cr = scpt->contents + sizeof (Elf32_External_compact_rel);
-		  bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
-					     ((Elf32_External_crinfo *) cr
-					      + scpt->reloc_count));
-		  ++scpt->reloc_count;
-		  break;
-
-		case R_MIPS_GPREL16:
-		case R_MIPS_LITERAL:
-		case R_MIPS_GPREL32:
-		  mips_elf_set_cr_type (cptrel, CRT_MIPS_GPHI_LO);
-		  cptrel.konst = gp - cptrel.vaddr;
-		  mips_elf_set_cr_dist2to (cptrel, 4);
-		  cr = scpt->contents + sizeof (Elf32_External_compact_rel);
-		  bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
-					     ((Elf32_External_crinfo *) cr
-					      + scpt->reloc_count));
-		  ++scpt->reloc_count;
-		  break;
-
-		default:
-		  break;
-		}
-	    }
+	  bfd_put_32 (input_bfd, low_bits, 
+		      contents + rel->r_offset);
+	  bfd_put_32 (input_bfd, high_bits, 
+		      contents + rel->r_offset + 4);
+	  continue;
 	}
 
-      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;
-	    }
-	}
+      /* Actually perform the relocation.  */
+      if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd, 
+					input_section, contents,
+					require_jalx))
+	return false;
     }
 
   return true;
@@ -5665,11 +6902,11 @@
    also where we undo the increment of the value for a mips16 symbol.  */
 
 /*ARGSIGNORED*/
-static boolean
-mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     const char *name;
+boolean
+_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
      Elf_Internal_Sym *sym;
      asection *input_sec;
 {
@@ -5692,12 +6929,15 @@
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
 
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
+#define ELF_DYNAMIC_INTERPRETER(abfd) 		\
+   (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" 	\
+    : ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" 	\
+    : "/usr/lib/libc.so.1")
 
 /* Create dynamic sections when linking against a dynamic object.  */
 
-static boolean
-mips_elf_create_dynamic_sections (abfd, info)
+boolean
+_bfd_mips_elf_create_dynamic_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
@@ -5721,28 +6961,42 @@
   if (! mips_elf_create_got_section (abfd, info))
     return false;
 
+  /* Create the .msym section on IRIX6.  It is used by the dynamic
+     linker to speed up dynamic relocations, and to avoid computing
+     the ELF hash for symbols.  */
+  if (IRIX_COMPAT (abfd) == ict_irix6
+      && !mips_elf_create_msym_section (abfd))
+    return false;
+  
   /* Create .stub section.  */
-  if (bfd_get_section_by_name (abfd, ".stub") == NULL)
+  if (bfd_get_section_by_name (abfd, 
+			       MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL)
     {
-      s = bfd_make_section (abfd, ".stub");
+      s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd));
       if (s == NULL
-	  || ! bfd_set_section_flags (abfd, s, flags)
-	  || ! bfd_set_section_alignment (abfd, s, 2))
+	  || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
+	  || ! bfd_set_section_alignment (abfd, s,
+					  MIPS_ELF_LOG_FILE_ALIGN (abfd)))
 	return false;
     }
 
-  if (SGI_COMPAT (abfd)
+  if (IRIX_COMPAT (abfd) == ict_irix5
       && !info->shared
       && bfd_get_section_by_name (abfd, ".rld_map") == NULL)
     {
       s = bfd_make_section (abfd, ".rld_map");
       if (s == NULL
 	  || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY)
-	  || ! bfd_set_section_alignment (abfd, s, 2))
+	  || ! bfd_set_section_alignment (abfd, s,
+					  MIPS_ELF_LOG_FILE_ALIGN (abfd)))
 	return false;
     }
 
-  if (SGI_COMPAT (abfd))
+  /* On IRIX5, we adjust add some additional symbols and change the
+     alignments of several sections.  There is no ABI documentation
+     indicating that this is necessary on IRIX6, nor any evidence that
+     the linker takes such action.  */
+  if (IRIX_COMPAT (abfd) == ict_irix5)
     {
       for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++)
 	{
@@ -5832,7 +7086,7 @@
 static boolean
 mips_elf_create_compact_rel_section (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   flagword flags;
   register asection *s;
@@ -5845,7 +7099,8 @@
       s = bfd_make_section (abfd, ".compact_rel");
       if (s == NULL
 	  || ! bfd_set_section_flags (abfd, s, flags)
-	  || ! bfd_set_section_alignment (abfd, s, 2))
+	  || ! bfd_set_section_alignment (abfd, s,
+					  MIPS_ELF_LOG_FILE_ALIGN (abfd)))
 	return false;
 
       s->_raw_size = sizeof (Elf32_External_compact_rel);
@@ -5867,7 +7122,7 @@
   struct mips_got_info *g;
 
   /* This function may be called more than once.  */
-  if (bfd_get_section_by_name (abfd, ".got") != NULL)
+  if (mips_elf_got_section (abfd))
     return true;
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -5898,13 +7153,13 @@
     return false;
 
   /* The first several global offset table entries are reserved.  */
-  s->_raw_size = MIPS_RESERVED_GOTNO * 4;
+  s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd);
 
   g = (struct mips_got_info *) bfd_alloc (abfd,
 					  sizeof (struct mips_got_info));
   if (g == NULL)
     return false;
-  g->global_gotsym = 0;
+  g->global_gotsym = NULL;
   g->local_gotno = MIPS_RESERVED_GOTNO;
   g->assigned_gotno = MIPS_RESERVED_GOTNO;
   if (elf_section_data (s) == NULL)
@@ -5915,15 +7170,66 @@
 	return false;
     }
   elf_section_data (s)->tdata = (PTR) g;
+  elf_section_data (s)->this_hdr.sh_flags 
+    |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
 
   return true;
 }
 
+/* Returns the .msym section for ABFD, creating it if it does not
+   already exist.  Returns NULL to indicate error.  */
+
+static asection *
+mips_elf_create_msym_section (abfd)
+     bfd *abfd;
+{
+  asection *s;
+
+  s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
+  if (!s) 
+    {
+      s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
+      if (!s
+	  || !bfd_set_section_flags (abfd, s, 
+				     SEC_ALLOC
+				     | SEC_LOAD
+				     | SEC_HAS_CONTENTS
+				     | SEC_LINKER_CREATED 
+				     | SEC_READONLY)
+	  || !bfd_set_section_alignment (abfd, s,
+					 MIPS_ELF_LOG_FILE_ALIGN (abfd)))
+	return NULL;
+    }
+
+  return s;
+}
+
+/* Add room for N relocations to the .rel.dyn section in ABFD.  */
+
+static void
+mips_elf_allocate_dynamic_relocations (abfd, n)
+     bfd *abfd;
+     unsigned int n;
+{
+  asection *s;
+
+  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. */
+      s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
+      ++s->reloc_count;
+    }
+  s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd);
+}
+
 /* Look through the relocs for a section during the first phase, and
    allocate space in the global offset table.  */
 
-static boolean
-mips_elf_check_relocs (abfd, info, sec, relocs)
+boolean
+_bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
      struct bfd_link_info *info;
      asection *sec;
@@ -5939,6 +7245,7 @@
   const Elf_Internal_Rela *rel_end;
   asection *sgot;
   asection *sreloc;
+  struct elf_backend_data *bed;
 
   if (info->relocateable)
     return true;
@@ -6023,7 +7330,7 @@
 	      asection **n;
 
 	      if (elf_bad_symtab (abfd))
-		symcount = symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
+		symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
 	      else
 		symcount = symtab_hdr->sh_info;
 	      n = (asection **) bfd_zalloc (abfd,
@@ -6113,7 +7420,7 @@
     }
   else
     {
-      sgot = bfd_get_section_by_name (dynobj, ".got");
+      sgot = mips_elf_got_section (dynobj);
       if (sgot == NULL)
 	g = NULL;
       else
@@ -6125,14 +7432,16 @@
     }
 
   sreloc = NULL;
-
-  rel_end = relocs + sec->reloc_count;
-  for (rel = relocs; rel < rel_end; rel++)
+  bed = get_elf_backend_data (abfd);
+  rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+  for (rel = relocs; rel < rel_end; ++rel)
     {
       unsigned long r_symndx;
+      int r_type;
       struct elf_link_hash_entry *h;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
+      r_type = ELF32_R_TYPE (rel->r_info);
 
       if (r_symndx < extsymoff)
 	h = NULL;
@@ -6151,7 +7460,7 @@
       /* Some relocs require a global offset table.  */
       if (dynobj == NULL || sgot == NULL)
 	{
-	  switch (ELF32_R_TYPE (rel->r_info))
+	  switch (r_type)
 	    {
 	    case R_MIPS_GOT16:
 	    case R_MIPS_CALL16:
@@ -6159,19 +7468,19 @@
 	    case R_MIPS_CALL_LO16:
 	    case R_MIPS_GOT_HI16:
 	    case R_MIPS_GOT_LO16:
+	    case R_MIPS_GOT_PAGE:
+	    case R_MIPS_GOT_OFST:
+	    case R_MIPS_GOT_DISP:
 	      if (dynobj == NULL)
 		elf_hash_table (info)->dynobj = dynobj = abfd;
 	      if (! mips_elf_create_got_section (dynobj, info))
 		return false;
-	      sgot = bfd_get_section_by_name (dynobj, ".got");
-	      BFD_ASSERT (sgot != NULL);
-	      BFD_ASSERT (elf_section_data (sgot) != NULL);
-	      g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
-	      BFD_ASSERT (g != NULL);
+	      g = mips_elf_got_info (dynobj, &sgot);
 	      break;
 
 	    case R_MIPS_32:
 	    case R_MIPS_REL32:
+	    case R_MIPS_64:
 	      if (dynobj == NULL
 		  && (info->shared || h != NULL)
 		  && (sec->flags & SEC_ALLOC) != 0)
@@ -6183,13 +7492,29 @@
 	    }
 	}
 
-      switch (ELF32_R_TYPE (rel->r_info))
+      if (!h && (r_type == R_MIPS_CALL_LO16
+		 || r_type == R_MIPS_GOT_LO16
+		 || r_type == R_MIPS_GOT_DISP))
+	{
+	  /* We may need a local GOT entry for this relocation.  We
+	     don't count R_MIPS_GOT_PAGE because we can estimate the
+	     maximum number of pages needed by looking at the size of
+	     the segment.  Similar comments apply to R_MIPS_GOT16.  We
+	     don't count R_MIPS_GOT_HI16, or R_MIPS_CALL_HI16 because
+	     these are always followed by an R_MIPS_GOT_LO16 or
+	     R_MIPS_CALL_LO16.
+
+	     This estimation is very conservative since we can merge
+	     duplicate entries in the GOT.  In order to be less
+	     conservative, we could actually build the GOT here,
+	     rather than in relocate_section.  */
+	  g->local_gotno++;
+	  sgot->_raw_size += MIPS_ELF_GOT_SIZE (dynobj);
+	}
+
+      switch (r_type)
 	{
 	case R_MIPS_CALL16:
-	case R_MIPS_CALL_HI16:
-	case R_MIPS_CALL_LO16:
-	  /* This symbol requires a global offset table entry.  */
-
 	  if (h == NULL)
 	    {
 	      (*_bfd_error_handler)
@@ -6198,75 +7523,42 @@
 	      bfd_set_error (bfd_error_bad_value);
 	      return false;
 	    }
+	  /* Fall through.  */
 
-	  /* Make sure this symbol is output as a dynamic symbol.  */
-	  if (h->dynindx == -1)
+	case R_MIPS_CALL_HI16:
+	case R_MIPS_CALL_LO16:
+	  if (h != NULL)
 	    {
-	      if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+	      /* This symbol requires a global offset table entry.  */
+	      if (!mips_elf_record_global_got_symbol (h, info, g))
 		return false;
+
+	      /* We need a stub, not a plt entry for the undefined
+		 function.  But we record it as if it needs plt.  See
+		 elf_adjust_dynamic_symbol in elflink.h.  */
+	      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+	      h->type = STT_FUNC;
 	    }
-
-	  if (h->got.offset != (bfd_vma) -1)
-	    {
-	      /* We have already allocated space in the .got.  */
-	      break;
-	    }
-
-	  /* Note the index of the first global got symbol in .dynsym.  */
-	  if (g->global_gotsym == 0
-	      || g->global_gotsym > (unsigned long) h->dynindx)
-	    g->global_gotsym = h->dynindx;
-
-	  /* Make this symbol to have the corresponding got entry.  */
-	  h->got.offset = 0;
-
-	  /* We need a stub, not a plt entry for the undefined
-	     function.  But we record it as if it needs plt.  See
-	     elf_adjust_dynamic_symbol in elflink.h.  */
-	  h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-	  h->type = STT_FUNC;
-
 	  break;
 
 	case R_MIPS_GOT16:
 	case R_MIPS_GOT_HI16:
 	case R_MIPS_GOT_LO16:
+	case R_MIPS_GOT_DISP:
 	  /* This symbol requires a global offset table entry.  */
-
-	  if (h != NULL)
-	    {
-	      /* 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;
-		}
-
-	      if (h->got.offset != (bfd_vma) -1)
-		{
-		  /* We have already allocated space in the .got.  */
-		  break;
-		}
-	      /* Note the index of the first global got symbol in
-                 .dynsym.  */
-	      if (g->global_gotsym == 0
-		  || g->global_gotsym > (unsigned long) h->dynindx)
-		g->global_gotsym = h->dynindx;
-
-	      /* Make this symbol to be the global got symbol.  */
-	      h->got.offset = 0;
-	    }
-
+	  if (h && !mips_elf_record_global_got_symbol (h, info, g))
+	    return false;
 	  break;
 
 	case R_MIPS_32:
 	case R_MIPS_REL32:
+	case R_MIPS_64:
 	  if ((info->shared || h != NULL)
 	      && (sec->flags & SEC_ALLOC) != 0)
 	    {
 	      if (sreloc == NULL)
 		{
-		  const char *name = ".rel.dyn";
+		  const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj);
 
 		  sreloc = bfd_get_section_by_name (dynobj, name);
 		  if (sreloc == NULL)
@@ -6286,19 +7578,11 @@
 		    }
 		}
 	      if (info->shared)
-		{
-		  /* When creating a shared object, we must copy these
-		     reloc types into the output file as R_MIPS_REL32
-		     relocs.  We make room for this reloc in the
-		     .rel.dyn reloc section */
-		  if (sreloc->_raw_size == 0)
-		    {
-		      /* Add a null element. */
-		      sreloc->_raw_size += sizeof (Elf32_External_Rel);
-		      ++sreloc->reloc_count;
-		    }
-		  sreloc->_raw_size += sizeof (Elf32_External_Rel);
-		}
+		/* When creating a shared object, we must copy these
+		   reloc types into the output file as R_MIPS_REL32
+		   relocs.  We make room for this reloc in the
+		   .rel.dyn reloc section.  */
+		mips_elf_allocate_dynamic_relocations (dynobj, 1);
 	      else
 		{
 		  struct mips_elf_link_hash_entry *hmips;
@@ -6306,21 +7590,28 @@
 		  /* We only need to copy this reloc if the symbol is
                      defined in a dynamic object.  */
 		  hmips = (struct mips_elf_link_hash_entry *) h;
-		  ++hmips->mips_32_relocs;
+		  ++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
+		 dynamic relocations against it.  */
+	      if (h != NULL
+		  && !mips_elf_record_global_got_symbol (h, info, g))
+		return false;
 	    }
 
-	  if (SGI_COMPAT (abfd))
+	  if (SGI_COMPAT (dynobj))
 	    mips_elf_hash_table (info)->compact_rel_size +=
 	      sizeof (Elf32_External_crinfo);
-
 	  break;
 
 	case R_MIPS_26:
 	case R_MIPS_GPREL16:
 	case R_MIPS_LITERAL:
 	case R_MIPS_GPREL32:
-	  if (SGI_COMPAT (abfd))
+	  if (SGI_COMPAT (dynobj))
 	    mips_elf_hash_table (info)->compact_rel_size +=
 	      sizeof (Elf32_External_crinfo);
 	  break;
@@ -6347,7 +7638,7 @@
          symbol, then we will need the fn_stub if there is one.
          References from a stub section do not count. */
       if (h != NULL
-	  && ELF32_R_TYPE (rel->r_info) != R_MIPS16_26
+	  && r_type != R_MIPS16_26
 	  && strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
 		      sizeof FN_STUB - 1) != 0
 	  && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB,
@@ -6368,10 +7659,10 @@
 /* Return the section that should be marked against GC for a given
    relocation.  */
 
-static asection *
-mips_elf_gc_mark_hook (abfd, info, rel, h, sym)
+asection *
+_bfd_mips_elf_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;
@@ -6417,12 +7708,12 @@
 
 /* Update the got entry reference counts for the section being removed.  */
 
-static boolean
-mips_elf_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+boolean
+_bfd_mips_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;
 {
 #if 0
   Elf_Internal_Shdr *symtab_hdr;
@@ -6466,8 +7757,8 @@
    change the definition to something the rest of the link can
    understand.  */
 
-static boolean
-mips_elf_adjust_dynamic_symbol (info, h)
+boolean
+_bfd_mips_elf_adjust_dynamic_symbol (info, h)
      struct bfd_link_info *info;
      struct elf_link_hash_entry *h;
 {
@@ -6493,20 +7784,10 @@
      file.  */
   hmips = (struct mips_elf_link_hash_entry *) h;
   if (! info->relocateable
-      && hmips->mips_32_relocs != 0
+      && hmips->possibly_dynamic_relocs != 0
       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-    {
-      s = bfd_get_section_by_name (dynobj, ".rel.dyn");
-      BFD_ASSERT (s != NULL);
-
-      if (s->_raw_size == 0)
-	{
-	  /* Make room for a null element. */
-	  s->_raw_size += sizeof (Elf32_External_Rel);
-	  ++s->reloc_count;
-	}
-      s->_raw_size += hmips->mips_32_relocs * sizeof (Elf32_External_Rel);
-    }
+    mips_elf_allocate_dynamic_relocations (dynobj, 
+					   hmips->possibly_dynamic_relocs);
 
   /* For a function, create a stub, if needed. */
   if (h->type == STT_FUNC
@@ -6522,7 +7803,8 @@
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	{
 	  /* We need .stub section.  */
-	  s = bfd_get_section_by_name (dynobj, ".stub");
+	  s = bfd_get_section_by_name (dynobj, 
+				       MIPS_ELF_STUB_SECTION_NAME (dynobj));
 	  BFD_ASSERT (s != NULL);
 
 	  h->root.u.def.section = s;
@@ -6565,8 +7847,8 @@
 static boolean mips_elf_check_mips16_stubs
   PARAMS ((struct mips_elf_link_hash_entry *, PTR));
 
-static boolean
-mips_elf_always_size_sections (output_bfd, info)
+boolean
+_bfd_mips_elf_always_size_sections (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
 {
@@ -6595,7 +7877,7 @@
 static boolean
 mips_elf_check_mips16_stubs (h, data)
      struct mips_elf_link_hash_entry *h;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
 {
   if (h->fn_stub != NULL
       && ! h->need_fn_stub)
@@ -6641,16 +7923,15 @@
 
 /* Set the sizes of the dynamic sections.  */
 
-static boolean
-mips_elf_size_dynamic_sections (output_bfd, info)
+boolean
+_bfd_mips_elf_size_dynamic_sections (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
 {
   bfd *dynobj;
   asection *s;
   boolean reltext;
-  asection *sgot;
-  struct mips_got_info *g;
+  struct mips_got_info *g = NULL;
 
   dynobj = elf_hash_table (info)->dynobj;
   BFD_ASSERT (dynobj != NULL);
@@ -6662,43 +7943,13 @@
 	{
 	  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;
+	  s->_raw_size 
+	    = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
+	  s->contents 
+	    = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
 	}
     }
 
-  /* Recompute the size of .got for local entires (reserved and
-     hipages) if needed.  To estimate it, get the upper bound of total
-     size of loadable sections.  */
-  sgot = bfd_get_section_by_name (dynobj, ".got");
-
-  if (sgot != NULL)
-    {
-      bfd_size_type loadable_size = 0;
-      bfd_size_type local_gotno;
-      struct _bfd *sub;
-
-      BFD_ASSERT (elf_section_data (sgot) != NULL);
-      g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
-      BFD_ASSERT (g != NULL);
-
-      for (sub = info->input_bfds; sub; sub = sub->link_next)
-	for (s = sub->sections; s != NULL; s = s->next)
-	  {
-	    if ((s->flags & SEC_ALLOC) == 0)
-	      continue;
-	    loadable_size += (s->_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 + MIPS_RESERVED_GOTNO;
-      g->local_gotno = local_gotno;
-      sgot->_raw_size += local_gotno * 4;
-    }
-
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
      memory for them.  */
@@ -6749,30 +8000,76 @@
 	      if ((target != NULL
 		   && (target->flags & SEC_READONLY) != 0
 		   && (target->flags & SEC_ALLOC) != 0)
-		  || strcmp (outname, ".rel.dyn") == 0)
+		  || 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, ".rel.dyn") != 0)
+	      if (strcmp (name, 
+			  MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0)
 		s->reloc_count = 0;
 	    }
 	}
       else if (strncmp (name, ".got", 4) == 0)
 	{
 	  int i;
+ 	  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);
 
-	  /* Fix the size of .got section for the correspondence of
-	     global symbols and got entries. This adds some useless
-	     got entries. Is this required by ABI really?  */
-	  i = elf_hash_table (info)->dynsymcount - g->global_gotsym;
-	  s->_raw_size += i * 4;
+ 	  /* 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;
+
+ 	  /* 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);
+
+ 	  /* 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;
+
+	  if (g->global_gotsym != NULL)
+	    i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
+	  else
+	    /* If there are no global symbols, or none requiring
+	       relocations, then GLOBAL_GOTSYM will be NULL.  */
+	    i = 0;
+	  g->global_gotno = i;
+	  s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj);
 	}
-      else if (strncmp (name, ".stub", 5) == 0)
+      else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0)
 	{
 	  /* Irix rld assumes that the function stub isn't at the end
 	     of .text section. So put a dummy. XXX  */
@@ -6789,6 +8086,11 @@
       else if (SGI_COMPAT (output_bfd)
 	       && strncmp (name, ".compact_rel", 12) == 0)
 	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) 
+			* (elf_hash_table (info)->dynsymcount
+			   + bfd_count_sections (output_bfd)));
       else if (strncmp (name, ".init", 5) != 0)
 	{
 	  /* It's not one of our sections, so don't allocate space.  */
@@ -6797,18 +8099,17 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
       /* Allocate memory for the section contents.  */
-      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)
 	{
 	  bfd_set_error (bfd_error_no_memory);
 	  return false;
 	}
-      memset (s->contents, 0, s->_raw_size);
     }
 
   if (elf_hash_table (info)->dynamic_sections_created)
@@ -6824,206 +8125,166 @@
 	    {
 	      /* SGI object has the equivalence of DT_DEBUG in the
 		 DT_MIPS_RLD_MAP entry.  */
-	      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_RLD_MAP, 0))
+	      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
 		return false;
 	    }
 	  else
-	    if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+	    if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
 	      return false;
 	}
 
       if (reltext)
 	{
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
 	    return false;
 	}
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
 	return false;
 
-      if (bfd_get_section_by_name (dynobj, ".rel.dyn"))
+      if (bfd_get_section_by_name (dynobj,
+				   MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)))
 	{
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_REL, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0))
 	    return false;
 
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
 	    return false;
 
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_RELENT, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
 	    return false;
 	}
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_CONFLICTNO, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_LIBLISTNO, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
 	return false;
 
       if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
 	{
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_CONFLICT, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0))
 	    return false;
 
 	  s = bfd_get_section_by_name (dynobj, ".liblist");
 	  BFD_ASSERT (s != NULL);
 
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_LIBLIST, 0))
+	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0))
 	    return false;
 	}
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_RLD_VERSION, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_FLAGS, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0))
 	return false;
 
 #if 0
       /* Time stamps in executable files are a bad idea.  */
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_TIME_STAMP, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_TIME_STAMP, 0))
 	return false;
 #endif
 
 #if 0 /* FIXME  */
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_ICHECKSUM, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0))
 	return false;
 #endif
 
 #if 0 /* FIXME  */
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_IVERSION, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_IVERSION, 0))
 	return false;
 #endif
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_BASE_ADDRESS, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_LOCAL_GOTNO, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LOCAL_GOTNO, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_SYMTABNO, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_SYMTABNO, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_UNREFEXTNO, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_GOTSYM, 0))
+      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
 	return false;
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_MIPS_HIPAGENO, 0))
+      if (IRIX_COMPAT (dynobj) == ict_irix5
+	  && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0))
 	return false;
 
-#if 0 /* (SGI_COMPAT) */
-      if (! bfd_get_section_by_name (dynobj, ".init"))
-	if (! bfd_elf32_add_dynamic_entry (info, DT_INIT, 0))
-	  return false;
+      if (IRIX_COMPAT (dynobj) == ict_irix6
+	  && (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, ".fini"))
-	if (! bfd_elf32_add_dynamic_entry (info, DT_FINI, 0))
-	  return false;
-#endif
+      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;
     }
 
-  /* If we use dynamic linking, we generate a section symbol for each
-     output section.  These are local symbols, which means that they
-     must come first in the dynamic symbol table.
-     That means we must increment the dynamic symbol index of every
-     other dynamic symbol.  */
-  {
-    unsigned int c, i;
-    struct mips_got_info *g;
-
-    c = 0;
-    if (elf_hash_table (info)->dynamic_sections_created)
-      {
-#if 0
-	/* We no longer try to restrict the set of sections which get
-           dynamic symbol table entries, since it fails if we have
-           other random sections which need dynamic relocations.  */
-	const char * const *namep;
-	bfd_size_type strindex;
-	struct bfd_strtab_hash *dynstr;
-
-	if (SGI_COMPAT (output_bfd))
-	  {
-	    c = SIZEOF_MIPS_DYNSYM_SECNAMES - 1;
-	    elf_link_hash_traverse (elf_hash_table (info),
-				    mips_elf_adjust_dynindx,
-				    (PTR) &c);
-	    elf_hash_table (info)->dynsymcount += c;
-
-	    dynstr = elf_hash_table (info)->dynstr;
-	    BFD_ASSERT (dynstr != NULL);
-
-	    for (i = 1, namep = mips_elf_dynsym_sec_names;
-		 *namep != NULL;
-		 i++, namep++)
-	      {
-		s = bfd_get_section_by_name (output_bfd, *namep);
-		if (s != NULL)
-		  elf_section_data (s)->dynindx = i;
-
-		strindex = _bfd_stringtab_add (dynstr, *namep, true, false);
-		if (strindex == (bfd_size_type) -1)
-		  return false;
-
-		mips_elf_hash_table (info)->dynsym_sec_strindex[i] = strindex;
-	      }
-	  }
-	else
-#endif /* 0 */
-	  {
-	    c = bfd_count_sections (output_bfd);
-	    elf_link_hash_traverse (elf_hash_table (info),
-				    mips_elf_adjust_dynindx,
-				    (PTR) &c);
-	    elf_hash_table (info)->dynsymcount += c;
-
-	    for (i = 1, s = output_bfd->sections; s != NULL; s = s->next, i++)
-	      {
-		elf_section_data (s)->dynindx = i;
-		/* These symbols will have no names, so we don't need to
-		   fiddle with dynstr_index.  */
-	      }
-	  }
-      }
-
-    if (sgot != NULL)
-      {
-	BFD_ASSERT (elf_section_data (sgot) != NULL);
-	g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
-	BFD_ASSERT (g != NULL);
-
-	/* If there are no global got symbols, fake the last symbol so
-	   for safety.  */
-	if (g->global_gotsym)
-	  g->global_gotsym += c;
-	else
-	  g->global_gotsym = elf_hash_table (info)->dynsymcount - 1;
-      }
-  }
-
   return true;
 }
 
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
+/* If NAME is one of the special IRIX6 symbols defined by the linker,
+   adjust it appropriately now.  */
 
-static boolean
-mips_elf_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
+static void
+mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     const char *name;
+     Elf_Internal_Sym *sym;
 {
-  unsigned int *cp = (unsigned int *) cparg;
+  /* The linker script takes care of providing names and values for
+     these, but we must place them into the right sections.  */
+  static const char* const text_section_symbols[] = {
+    "_ftext",
+    "_etext",
+    "__dso_displacement",
+    "__elf_header",
+    "__program_header_table",
+    NULL
+  };
 
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
-  return true;
+  static const char* const data_section_symbols[] = {
+    "_fdata",
+    "_edata",
+    "_end",
+    "_fbss",
+    NULL
+  };
+
+  const char* const *p;
+  int i;
+
+  for (i = 0; i < 2; ++i)
+    for (p = (i == 0) ? text_section_symbols : data_section_symbols; 
+	 *p;
+	 ++p)
+      if (strcmp (*p, name) == 0)
+	{
+	  /* 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;
+	}
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
    dynamic sections here.  */
 
-static boolean
-mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+boolean
+_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
      bfd *output_bfd;
      struct bfd_link_info *info;
      struct elf_link_hash_entry *h;
@@ -7032,11 +8293,14 @@
   bfd *dynobj;
   bfd_vma gval;
   asection *sgot;
+  asection *smsym;
   struct mips_got_info *g;
   const char *name;
+  struct mips_elf_link_hash_entry *mh;
 
   dynobj = elf_hash_table (info)->dynobj;
   gval = sym->st_value;
+  mh = (struct mips_elf_link_hash_entry *) h;
 
   if (h->plt.offset != (bfd_vma) -1)
     {
@@ -7048,7 +8312,8 @@
 
       BFD_ASSERT (h->dynindx != -1);
 
-      s = bfd_get_section_by_name (dynobj, ".stub");
+      s = bfd_get_section_by_name (dynobj, 
+				   MIPS_ELF_STUB_SECTION_NAME (dynobj));
       BFD_ASSERT (s != NULL);
 
       /* Fill the stub.  */
@@ -7082,25 +8347,48 @@
 
   BFD_ASSERT (h->dynindx != -1);
 
-  sgot = bfd_get_section_by_name (dynobj, ".got");
+  sgot = mips_elf_got_section (dynobj);
   BFD_ASSERT (sgot != NULL);
   BFD_ASSERT (elf_section_data (sgot) != NULL);
   g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
   BFD_ASSERT (g != NULL);
 
-  if ((unsigned long) h->dynindx >= g->global_gotsym)
+  /* Run through the global symbol table, creating GOT entries for all
+     the symbols that need them.  */
+  if (g->global_gotsym != NULL
+      && h->dynindx >= g->global_gotsym->dynindx)
     {
-      bfd_size_type offset;
+      bfd_vma offset;
+      bfd_vma value;
 
-      /* This symbol has an entry in the global offset table.  Set its
-	 value to the corresponding got entry, if needed.  */
-      if (h->got.offset == (bfd_vma) -1)
-	{
-	  offset = (h->dynindx - g->global_gotsym + g->local_gotno) * 4;
-	  BFD_ASSERT (g->local_gotno * 4 <= offset
-		      && offset < sgot->_raw_size);
-	  bfd_put_32 (output_bfd, gval, sgot->contents + offset);
-	}
+      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;
+
+      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, 
+				   MIPS_ELF_MSYM_SECTION_NAME (dynobj));
+  if (smsym)
+    {
+      Elf32_Internal_Msym msym;
+
+      msym.ms_hash_value = bfd_elf_hash (h->root.root.string);
+      /* 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 
+	(dynobj, &msym,
+	 ((Elf32_External_Msym *) smsym->contents) + h->dynindx);
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
@@ -7146,6 +8434,10 @@
 	}
     }
 
+  /* Handle the IRIX6-specific symbols.  */
+  if (IRIX_COMPAT (output_bfd) == ict_irix6)
+    mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym);
+
   if (SGI_COMPAT (output_bfd)
       && ! info->shared)
     {
@@ -7162,8 +8454,10 @@
       else if (mips_elf_hash_table (info)->use_rld_obj_head
 	       && strcmp (name, "__rld_obj_head") == 0)
 	{
-	  asection *s = bfd_get_section_by_name (dynobj, ".rld_map");
-	  BFD_ASSERT (s != NULL);
+	  /* 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") 
+			!= NULL);
 	  mips_elf_hash_table (info)->rld_value = sym->st_value;
 	}
     }
@@ -7178,8 +8472,8 @@
 
 /* Finish up the dynamic sections.  */
 
-static boolean
-mips_elf_finish_dynamic_sections (output_bfd, info)
+boolean
+_bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
 {
@@ -7192,7 +8486,7 @@
 
   sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
 
-  sgot = bfd_get_section_by_name (dynobj, ".got");
+  sgot = mips_elf_got_section (dynobj);
   if (sgot == NULL)
     g = NULL;
   else
@@ -7204,39 +8498,41 @@
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
-      Elf32_External_Dyn *dyncon, *dynconend;
+      bfd_byte *b;
 
       BFD_ASSERT (sdyn != NULL);
       BFD_ASSERT (g != NULL);
 
-      dyncon = (Elf32_External_Dyn *) sdyn->contents;
-      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
-      for (; dyncon < dynconend; dyncon++)
+      for (b = sdyn->contents;
+	   b < sdyn->contents + sdyn->_raw_size;
+	   b += MIPS_ELF_DYN_SIZE (dynobj))
 	{
 	  Elf_Internal_Dyn dyn;
 	  const char *name;
 	  size_t elemsize;
 	  asection *s;
+	  boolean swap_out_p;
 
-	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+	  /* 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)
 	    {
-	    default:
-	      break;
-
 	    case DT_RELENT:
-	      s = bfd_get_section_by_name (dynobj, ".rel.dyn");
+	      s = (bfd_get_section_by_name 
+		   (dynobj,
+		    MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)));
 	      BFD_ASSERT (s != NULL);
-	      dyn.d_un.d_val = sizeof (Elf32_External_Rel);
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj);
 	      break;
 
 	    case DT_STRSZ:
 	      /* Rewrite DT_STRSZ.  */
 	      dyn.d_un.d_val =
 		_bfd_stringtab_size (elf_hash_table (info)->dynstr);
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_PLTGOT:
@@ -7251,17 +8547,14 @@
 	      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_MIPS_RLD_VERSION:
 	      dyn.d_un.d_val = 1; /* XXX */
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_FLAGS:
 	      dyn.d_un.d_val = RHF_NOTPOT; /* XXX */
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_CONFLICTNO:
@@ -7283,38 +8576,52 @@
 		}
 	      else
 		    dyn.d_un.d_val = 0;
-
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_TIME_STAMP:
 	      time ((time_t *) &dyn.d_un.d_val);
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_ICHECKSUM:
 	      /* XXX FIXME: */
+	      swap_out_p = false;
 	      break;
 
 	    case DT_MIPS_IVERSION:
 	      /* XXX FIXME: */
+	      swap_out_p = false;
 	      break;
 
 	    case DT_MIPS_BASE_ADDRESS:
 	      s = output_bfd->sections;
 	      BFD_ASSERT (s != NULL);
 	      dyn.d_un.d_ptr = s->vma & ~(0xffff);
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_LOCAL_GOTNO:
 	      dyn.d_un.d_val = g->local_gotno;
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
+	    case DT_MIPS_UNREFEXTNO:
+	      /* The index into the dynamic symbol table which is the
+		 entry of the first external symbol that is not
+		 referenced within the same object.  */
+	      dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
+	      break;
+
+	    case DT_MIPS_GOTSYM:
+	      if (g->global_gotsym)
+		{
+		  dyn.d_un.d_val = g->global_gotsym->dynindx;
+		  break;
+		}
+	      /* In case if we don't have global got symbols we default
+		 to setting DT_MIPS_GOTSYM to the same value as
+		 DT_MIPS_SYMTABNO, so we just fall through.  */
+
 	    case DT_MIPS_SYMTABNO:
 	      name = ".dynsym";
-	      elemsize = sizeof (Elf32_External_Sym);
+	      elemsize = MIPS_ELF_SYM_SIZE (output_bfd);
 	      s = bfd_get_section_by_name (output_bfd, name);
 	      BFD_ASSERT (s != NULL);
 
@@ -7322,34 +8629,36 @@
 		dyn.d_un.d_val = s->_cooked_size / elemsize;
 	      else
 		dyn.d_un.d_val = s->_raw_size / elemsize;
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
-	      break;
-
-	    case DT_MIPS_UNREFEXTNO:
-#if 0
-	      dyn.d_un.d_val = SIZEOF_MIPS_DYNSYM_SECNAMES;
-#else
-	      dyn.d_un.d_val = bfd_count_sections (output_bfd);
-#endif
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
-	      break;
-
-	    case DT_MIPS_GOTSYM:
-	      dyn.d_un.d_val = g->global_gotsym;
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_HIPAGENO:
 	      dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO;
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_MIPS_RLD_MAP:
 	      dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value;
-	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
+	    case DT_MIPS_OPTIONS:
+	      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 
+		   (output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)));
+	      dyn.d_un.d_ptr = s->vma;
+	      break;
+
+	    default:
+	      swap_out_p = false;
+	      break;
 	    }
+
+	  if (swap_out_p)
+	    (*get_elf_backend_data (dynobj)->s->swap_dyn_out) 
+	      (dynobj, &dyn, b);
 	}
     }
 
@@ -7358,106 +8667,41 @@
      This isn't the case of Irix rld. */
   if (sgot != NULL && sgot->_raw_size > 0)
     {
-      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
-      bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, sgot->contents + 4);
+      MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents);
+      MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, 
+			 sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
     }
 
   if (sgot != NULL)
-    elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+    elf_section_data (sgot->output_section)->this_hdr.sh_entsize
+      = MIPS_ELF_GOT_SIZE (output_bfd);
 
   {
-    asection *sdynsym;
+    asection *smsym;
     asection *s;
-    Elf_Internal_Sym sym;
     Elf32_compact_rel cpt;
 
-    /* Set up the section symbols for the output sections. SGI sets
-       the STT_NOTYPE attribute for these symbols.  Should we do so?  */
+    /* ??? The section symbols for the output sections were set up in
+       _bfd_elf_final_link.  SGI sets the STT_NOTYPE attribute for these
+       symbols.  Should we do so?  */
 
-    sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-    if (sdynsym != NULL)
+    smsym = bfd_get_section_by_name (dynobj, 
+				     MIPS_ELF_MSYM_SECTION_NAME (dynobj));
+    if (smsym != NULL)
       {
-#if 0
-	const char *name;
-	const char * const * namep = mips_elf_dynsym_sec_names;
-	unsigned int i;
-	bfd_vma last;
-	long dindx;
+	Elf32_Internal_Msym msym;
 
-	/* We no longer try to restrict the set of sections which get
-           dynamic symbol table entries, since it fails if we have
-           other random sections which need dynamic relocations.  */
-	if (SGI_COMPAT (output_bfd))
+	msym.ms_hash_value = 0;
+	msym.ms_info = ELF32_MS_INFO (0, 1);
+
+	for (s = output_bfd->sections; s != NULL; s = s->next)
 	  {
-	    sym.st_size = 0;
-	    sym.st_name = 0;
-	    sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
-	    sym.st_other = 0;
+	    long dynindx = elf_section_data (s)->dynindx;
 
-	    i = 0;
-	    last = 0;
-	    dindx = 0;
-	    while ((name = *namep++) != NULL)
-	      {
-		s = bfd_get_section_by_name (output_bfd, name);
-		if (s != NULL)
-		  {
-		    sym.st_value = s->vma;
-		    dindx = elf_section_data (s)->dynindx;
-		    last = s->vma + s->_raw_size;
-		  }
-		else
-		  {
-		    sym.st_value = last;
-		    dindx++;
-		  }
-
-		sym.st_shndx = (i < MIPS_TEXT_DYNSYM_SECNO
-				? SHN_MIPS_TEXT
-				: SHN_MIPS_DATA);
-		++i;
-		sym.st_name =
-		  mips_elf_hash_table (info)->dynsym_sec_strindex[dindx];
-
-		bfd_elf32_swap_symbol_out (output_bfd, &sym,
-					   (((Elf32_External_Sym *)
-					     sdynsym->contents)
-					    + dindx));
-	      }
-
-	    /* Set the sh_info field of the output .dynsym section to
-	       the index of the first global symbol.  */
-	    elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
-	      SIZEOF_MIPS_DYNSYM_SECNAMES;
-	  }
-	else
-#endif /* 0 */
-	  {
-	    sym.st_size = 0;
-	    sym.st_name = 0;
-	    sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-	    sym.st_other = 0;
-
-	    for (s = output_bfd->sections; s != NULL; s = s->next)
-	      {
-		int indx;
-
-		sym.st_value = s->vma;
-
-		indx = elf_section_data (s)->this_idx;
-		BFD_ASSERT (indx > 0);
-		sym.st_shndx = indx;
-
-		bfd_elf32_swap_symbol_out (output_bfd, &sym,
-					   (((Elf32_External_Sym *)
-					     sdynsym->contents)
-					    + elf_section_data (s)->dynindx));
-	      }
-
-	    /* Set the sh_info field of the output .dynsym section to
-	       the index of the first global symbol.  */
-	    elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
-	      bfd_count_sections (output_bfd) + 1;
+	    bfd_mips_elf_swap_msym_out 
+	      (output_bfd, &msym,
+	       (((Elf32_External_Msym *) smsym->contents)
+		+ dynindx));
 	  }
       }
 
@@ -7479,7 +8723,8 @@
 					     s->contents));
 
 	    /* Clean up a dummy stub function entry in .text.  */
-	    s = bfd_get_section_by_name (dynobj, ".stub");
+	    s = bfd_get_section_by_name (dynobj, 
+					 MIPS_ELF_STUB_SECTION_NAME (dynobj));
 	    if (s != NULL)
 	      {
 		file_ptr dummy_offset;
@@ -7493,9 +8738,10 @@
       }
 
     /* Clean up a first relocation in .rel.dyn.  */
-    s = bfd_get_section_by_name (dynobj, ".rel.dyn");
+    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, sizeof (Elf32_External_Rel));
+      memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj));
   }
 
   return true;
@@ -7648,7 +8894,8 @@
 		case bfd_reloc_undefined:
 		  if (!((*link_info->callbacks->undefined_symbol)
 			(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
-			 input_bfd, input_section, (*parent)->address)))
+			 input_bfd, input_section, (*parent)->address,
+			 true)))
 		    goto error_return;
 		  break;
 		case bfd_reloc_dangerous:
@@ -7743,30 +8990,53 @@
 #define elf_backend_collect		true
 #define elf_backend_type_change_ok	true
 #define elf_backend_can_gc_sections	true
-#define elf_info_to_howto		0
+#define elf_backend_sign_extend_vma	true
+#define elf_info_to_howto		mips_info_to_howto_rela
 #define elf_info_to_howto_rel		mips_info_to_howto_rel
 #define elf_backend_sym_is_global	mips_elf_sym_is_global
-#define elf_backend_object_p		mips_elf32_object_p
-#define elf_backend_section_from_shdr	mips_elf32_section_from_shdr
+#define elf_backend_object_p		_bfd_mips_elf_object_p
+#define elf_backend_section_from_shdr	_bfd_mips_elf_section_from_shdr
 #define elf_backend_fake_sections	_bfd_mips_elf_fake_sections
 #define elf_backend_section_from_bfd_section \
 					_bfd_mips_elf_section_from_bfd_section
-#define elf_backend_section_processing	mips_elf32_section_processing
+#define elf_backend_section_processing	_bfd_mips_elf_section_processing
 #define elf_backend_symbol_processing	_bfd_mips_elf_symbol_processing
 #define elf_backend_additional_program_headers \
-					mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map	mips_elf_modify_segment_map
+					_bfd_mips_elf_additional_program_headers
+#define elf_backend_modify_segment_map	_bfd_mips_elf_modify_segment_map
 #define elf_backend_final_write_processing \
 					_bfd_mips_elf_final_write_processing
 #define elf_backend_ecoff_debug_swap	&mips_elf32_ecoff_debug_swap
+#define elf_backend_add_symbol_hook	_bfd_mips_elf_add_symbol_hook
+#define elf_backend_create_dynamic_sections \
+					_bfd_mips_elf_create_dynamic_sections
+#define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
+#define elf_backend_adjust_dynamic_symbol \
+					_bfd_mips_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+					_bfd_mips_elf_always_size_sections
+#define elf_backend_size_dynamic_sections \
+					_bfd_mips_elf_size_dynamic_sections
+#define elf_backend_relocate_section	_bfd_mips_elf_relocate_section
+#define elf_backend_link_output_symbol_hook \
+					_bfd_mips_elf_link_output_symbol_hook
+#define elf_backend_finish_dynamic_symbol \
+					_bfd_mips_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+					_bfd_mips_elf_finish_dynamic_sections
+#define elf_backend_gc_mark_hook	_bfd_mips_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook	_bfd_mips_elf_gc_sweep_hook
+
+#define elf_backend_got_header_size	(4*MIPS_RESERVED_GOTNO)
+#define elf_backend_plt_header_size	0
 
 #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
 #define bfd_elf32_set_section_contents	_bfd_mips_elf_set_section_contents
 #define bfd_elf32_bfd_link_hash_table_create \
-					mips_elf_link_hash_table_create
-#define bfd_elf32_bfd_final_link	mips_elf_final_link
+					_bfd_mips_elf_link_hash_table_create
+#define bfd_elf32_bfd_final_link	_bfd_mips_elf_final_link
 #define bfd_elf32_bfd_copy_private_bfd_data \
 					_bfd_mips_elf_copy_private_bfd_data
 #define bfd_elf32_bfd_merge_private_bfd_data \
@@ -7774,27 +9044,4 @@
 #define bfd_elf32_bfd_set_private_flags	_bfd_mips_elf_set_private_flags
 #define bfd_elf32_bfd_print_private_bfd_data \
 					_bfd_mips_elf_print_private_bfd_data
-#define elf_backend_add_symbol_hook	mips_elf_add_symbol_hook
-#define elf_backend_create_dynamic_sections \
-					mips_elf_create_dynamic_sections
-#define elf_backend_check_relocs	mips_elf_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
-					mips_elf_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
-					mips_elf_always_size_sections
-#define elf_backend_size_dynamic_sections \
-					mips_elf_size_dynamic_sections
-#define elf_backend_relocate_section	mips_elf_relocate_section
-#define elf_backend_link_output_symbol_hook \
-					mips_elf_link_output_symbol_hook
-#define elf_backend_finish_dynamic_symbol \
-					mips_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
-					mips_elf_finish_dynamic_sections
-#define elf_backend_gc_mark_hook	mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook	mips_elf_gc_sweep_hook
-
-#define elf_backend_got_header_size	(4*MIPS_RESERVED_GOTNO)
-#define elf_backend_plt_header_size	0
-
 #include "elf32-target.h"
diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c
new file mode 100644
index 0000000..3b96949
--- /dev/null
+++ b/bfd/elf32-pj.c
@@ -0,0 +1,349 @@
+/* picoJava specific support for 32-bit ELF
+   Copyright 1999 Free Software Foundation, Inc.
+   Contributed by Steve Chamberlan of Transmeta (sac@pobox.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 "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/pj.h"
+
+static bfd_reloc_status_type pj_elf_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *pj_elf_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void pj_elf_info_to_howto
+  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+
+static reloc_howto_type pj_elf_howto_table[] =
+{
+  /* No relocation.  */
+  HOWTO (R_PJ_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 32 bit absolute relocation.  Setting partial_inplace to true and
+     src_mask to a non-zero value is similar to the COFF toolchain.  */
+  HOWTO (R_PJ_DATA_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 */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_DIR32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 32 bit PC relative relocation.  */
+  HOWTO (R_PJ_CODE_REL32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_REL32",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+/* 16 bit PC relative relocation.  */
+  HOWTO (R_PJ_CODE_REL16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overf6w */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_REL16",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+  EMPTY_HOWTO (4),
+  EMPTY_HOWTO (5),
+  HOWTO (R_PJ_CODE_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 */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_CODE_DIR32",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  EMPTY_HOWTO (7),
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9),
+  EMPTY_HOWTO (10),
+  EMPTY_HOWTO (11),
+  EMPTY_HOWTO (12),
+
+  HOWTO (R_PJ_CODE_LO16,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_unsigned, /* complain_on_overflow */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_LO16",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+
+    HOWTO (R_PJ_CODE_HI16,	/* type */
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_unsigned, /* complain_on_overflow */
+	 pj_elf_reloc,		/* special_function */
+	 "R_PJ_HI16",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy */
+  HOWTO (R_PJ_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_PJ_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_PJ_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_PJ_GNU_VTENTRY",   /* name */
+         false,                 /* partial_inplace */
+         0,                     /* src_mask */
+         0,                     /* dst_mask */
+         false),                /* pcrel_offset */
+
+
+};
+
+/* This function is used for normal relocs.  This is like the COFF
+   function, and is almost certainly incorrect for other ELF targets.  */
+
+static bfd_reloc_status_type
+pj_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
+	  error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol_in;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  unsigned long insn;
+  bfd_vma sym_value;
+  enum elf_pj_reloc_type r_type;
+  bfd_vma addr = reloc_entry->address;
+  bfd_byte *hit_data = addr + (bfd_byte *) data;
+
+  r_type = (enum elf_pj_reloc_type) reloc_entry->howto->type;
+
+  if (output_bfd != NULL)
+    {
+      /* Partial linking--do nothing.  */
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (symbol_in != NULL
+      && bfd_is_und_section (symbol_in->section))
+    return bfd_reloc_undefined;
+
+  if (bfd_is_com_section (symbol_in->section))
+    sym_value = 0;                           
+  else 
+    sym_value = (symbol_in->value +
+		 symbol_in->section->output_section->vma +
+		 symbol_in->section->output_offset);
+
+  switch (r_type)
+    {
+    case R_PJ_DATA_DIR32:
+      insn = bfd_get_32 (abfd, hit_data);
+      insn += sym_value + reloc_entry->addend;
+      bfd_put_32 (abfd, insn, hit_data);
+      break;
+
+      /* Relocations in code are always bigendian, no matter what the
+	 data endianness is. */
+
+    case R_PJ_CODE_DIR32:
+      insn = bfd_getb32 (hit_data);
+      insn += sym_value + reloc_entry->addend;
+      bfd_putb32 (insn, hit_data);
+      break;
+
+    case R_PJ_CODE_REL16:
+      insn = bfd_getb16 (hit_data);
+      insn += sym_value + reloc_entry->addend
+        -  (input_section->output_section->vma
+            + input_section->output_offset);
+      bfd_putb16 (insn, hit_data);
+      break;
+    case R_PJ_CODE_LO16:
+      insn = bfd_getb16 (hit_data);
+      insn += sym_value + reloc_entry->addend;
+      bfd_putb16 (insn, hit_data);
+      break;
+
+    case R_PJ_CODE_HI16:
+      insn = bfd_getb16 (hit_data);
+      insn += (sym_value + reloc_entry->addend) >> 16;
+      bfd_putb16 (insn, hit_data);
+      break;
+      
+    default:
+      abort ();
+      break;
+    }
+
+  return bfd_reloc_ok;
+}
+
+/* This structure is used to map BFD reloc codes to PJ ELF relocs.  */
+
+struct elf_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned char elf_reloc_val;
+};
+
+/* An array mapping BFD reloc codes to PJ ELF relocs.  */
+
+static const struct elf_reloc_map pj_reloc_map[] =
+{
+    { BFD_RELOC_NONE, 		R_PJ_NONE          },
+    { BFD_RELOC_32, 		R_PJ_DATA_DIR32    },
+    { BFD_RELOC_PJ_CODE_DIR16, 	R_PJ_CODE_DIR16    },
+    { BFD_RELOC_PJ_CODE_DIR32, 	R_PJ_CODE_DIR32    },
+    { BFD_RELOC_PJ_CODE_LO16, 	R_PJ_CODE_LO16     },
+    { BFD_RELOC_PJ_CODE_HI16, 	R_PJ_CODE_HI16     },
+    { BFD_RELOC_PJ_CODE_REL32,  R_PJ_CODE_REL32    },
+    { BFD_RELOC_PJ_CODE_REL16,  R_PJ_CODE_REL16    },
+    { BFD_RELOC_VTABLE_INHERIT, R_PJ_GNU_VTINHERIT },
+    { BFD_RELOC_VTABLE_ENTRY,   R_PJ_GNU_VTENTRY   },
+};
+
+/* Given a BFD reloc code, return the howto structure for the
+   corresponding PJ ELf reloc.  */
+
+static reloc_howto_type *
+pj_elf_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     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)
+	return &pj_elf_howto_table[(int) pj_reloc_map[i].elf_reloc_val];
+    }
+
+  return NULL;
+}
+
+/* Given an ELF reloc, fill in the howto field of a relent.  */
+
+static void
+pj_elf_info_to_howto (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf_Internal_Rela *dst;
+{
+  unsigned int r;
+
+  r = ELF32_R_TYPE (dst->r_info);
+
+  BFD_ASSERT (r < (unsigned int) R_PJ_max);
+
+  cache_ptr->howto = &pj_elf_howto_table[r];
+}
+
+/* Take this moment to fill in the special picoJava bits in the
+   e_flags field. */
+
+static void
+pj_elf_final_write_processing (abfd, linker)
+     bfd *abfd;
+     boolean linker ATTRIBUTE_UNUSED;
+{
+    elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_ARCH;
+    elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_GNUCALLS;
+}
+
+#define TARGET_BIG_SYM		bfd_elf32_pj_vec
+#define TARGET_BIG_NAME		"elf32-pj"
+#define TARGET_LITTLE_SYM	bfd_elf32_pjl_vec
+#define TARGET_LITTLE_NAME	"elf32-pjl"
+#define ELF_ARCH		bfd_arch_pj
+#define ELF_MACHINE_CODE	EM_PJ
+#define ELF_MAXPAGESIZE		0x1000
+#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define bfd_elf32_bfd_reloc_type_lookup	             pj_elf_reloc_type_lookup
+#define elf_backend_final_write_processing           pj_elf_final_write_processing
+#define elf_info_to_howto		             pj_elf_info_to_howto
+#include "elf32-target.h"
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 25bb24a..242cfb7 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -80,8 +80,6 @@
 static boolean ppc_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *,
 						      struct elf_link_hash_entry *));
 
-static boolean ppc_elf_adjust_dynindx PARAMS ((struct elf_link_hash_entry *, PTR));
-
 static boolean ppc_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
 
 static boolean ppc_elf_relocate_section PARAMS ((bfd *,
@@ -1231,7 +1229,7 @@
 
 static reloc_howto_type *
 ppc_elf_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
@@ -1307,7 +1305,7 @@
 
 static void
 ppc_elf_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
@@ -1323,13 +1321,13 @@
 static bfd_reloc_status_type
 ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
 			 output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
 
@@ -1523,7 +1521,7 @@
 
 static boolean
 ppc_elf_fake_sections (abfd, shdr, asect)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      Elf32_Internal_Shdr *shdr;
      asection *asect;
 {
@@ -1640,7 +1638,7 @@
 
 static boolean
 ppc_elf_modify_segment_map (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -1881,27 +1879,6 @@
 }
 
 
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-ppc_elf_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  int *cp = (int *) cparg;
-
-#ifdef DEBUG
-  fprintf (stderr, "ppc_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n", h->dynindx, *cp);
-#endif
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
-
-  return true;
-}
-
-
 /* Set the sizes of the dynamic sections.  */
 
 static boolean
@@ -2035,7 +2012,7 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
@@ -2083,43 +2060,6 @@
 	}
     }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section.  These are local symbols, which
-     means that they must come first in the dynamic symbol table.
-     That means we must increment the dynamic symbol index of every
-     other dynamic symbol.
-
-     FIXME: We assume that there will never be relocations to
-     locations in linker-created sections that do not have
-     externally-visible names. Instead, we should work out precisely
-     which sections relocations are targetted at.  */
-  if (info->shared)
-    {
-      int c;
-
-      for (c = 0, s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  if ((s->flags & SEC_LINKER_CREATED) != 0
-	      || (s->flags & SEC_ALLOC) == 0)
-	    {
-	      elf_section_data (s)->dynindx = -1;
-	      continue;
-	    }
-
-	  /* These symbols will have no names, so we don't need to
-	     fiddle with dynstr_index.  */
-
-	  elf_section_data (s)->dynindx = c + 1;
-
-	  c++;
-	}
-
-      elf_link_hash_traverse (elf_hash_table (info),
-			      ppc_elf_adjust_dynindx,
-			      (PTR) &c);
-      elf_hash_table (info)->dynsymcount += c;
-    }
-
   return true;
 }
 
@@ -2523,7 +2463,7 @@
 static asection *
 ppc_elf_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;
@@ -2570,7 +2510,7 @@
 static boolean
 ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
@@ -2637,8 +2577,8 @@
      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;
 {
@@ -2924,54 +2864,6 @@
       elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
     }
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int maxdindx = 0;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx, dindx;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  dindx = elf_section_data (s)->dynindx;
-	  if (dindx != -1)
-	    {
-	      BFD_ASSERT(indx > 0);
-	      BFD_ASSERT(dindx > 0);
-
-	      if (dindx > maxdindx)
-		maxdindx = dindx;
-
-	      sym.st_shndx = indx;
-
-	      bfd_elf32_swap_symbol_out (output_bfd, &sym,
-					 (PTR) (((Elf32_External_Sym *)
-						 sdynsym->contents)
-						+ dindx));
-	    }
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
-	maxdindx + 1;
-    }
-
   return true;
 }
 
@@ -3146,7 +3038,12 @@
 		      && ((! 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
+			  /* Testing SEC_DEBUGGING here may be wrong.
+                             It's here to avoid a crash when
+                             generating a shared library with DWARF
+                             debugging information.  */
+		          || (input_section->flags & SEC_DEBUGGING) != 0)
 		      && (r_type == R_PPC_ADDR32
 			  || r_type == R_PPC_ADDR24
 			  || r_type == R_PPC_ADDR16
@@ -3189,6 +3086,14 @@
                      obscure cases sec->output_section will be NULL.  */
 		  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
@@ -3200,13 +3105,15 @@
 	    relocation = 0;
 	  else
 	    {
-	      (*info->callbacks->undefined_symbol)(info,
-						   h->root.root.string,
-						   input_bfd,
-						   input_section,
-						   rel->r_offset);
-	      ret = false;
-	      continue;
+	      if (! (*info->callbacks->undefined_symbol)(info,
+							 h->root.root.string,
+							 input_bfd,
+							 input_section,
+							 rel->r_offset,
+							 (!info->shared
+							  || info->no_undefined)))
+		return false;
+	      relocation = 0;
 	    }
 	}
 
@@ -3230,12 +3137,13 @@
 		  || h->root.type == bfd_link_hash_defweak)
 	      && sec->output_section == NULL)
 	    {
-	      (*info->callbacks->undefined_symbol) (info,
-						    h->root.root.string,
-						    input_bfd,
-						    input_section,
-						    rel->r_offset);
-	      ret = false;
+	      if (! (*info->callbacks->undefined_symbol) (info,
+							  h->root.root.string,
+							  input_bfd,
+							  input_section,
+							  rel->r_offset,
+							  true))
+		return false;
 	      continue;
 	    }
 	  break;
@@ -3751,47 +3659,52 @@
 				    relocation,
 				    addend);
 
-      if (r != bfd_reloc_ok)
+      if (r == bfd_reloc_ok)
+	;
+      else if (r == bfd_reloc_overflow)
 	{
-	  ret = false;
-	  switch (r)
+	  const char *name;
+
+	  if (h != NULL)
 	    {
-	    default:
-	      break;
+	      if (h->root.type == bfd_link_hash_undefweak
+		  && howto->pc_relative)
+		{
+		  /* 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
+		     program is hosed anyway, and a little warning isn't
+		     going to help.  */
 
-	    case bfd_reloc_overflow:
-	      {
-		const char *name;
+		  continue;
+		}
 
-		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)
-		      break;
+	      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)
+		continue;
+	      if (*name == '\0')
+		name = bfd_section_name (input_bfd, sec);
+	    }
 
-		    if (*name == '\0')
-		      name = bfd_section_name (input_bfd, sec);
-		  }
-
-		(*info->callbacks->reloc_overflow)(info,
+	  if (! (*info->callbacks->reloc_overflow)(info,
 						   name,
 						   howto->name,
 						   (bfd_vma) 0,
 						   input_bfd,
 						   input_section,
-						   offset);
-	      }
-	      break;
-
-	    }
+						   offset))
+	    return false;
 	}
+      else
+	ret = false;
     }
 
-
 #ifdef DEBUG
   fprintf (stderr, "\n");
 #endif
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index ebbe352..ad60e07 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -1,5 +1,5 @@
 /* Hitachi SH specific support for 32-bit ELF
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 97, 98, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -33,6 +33,14 @@
   PARAMS ((bfd *, bfd_reloc_code_real_type));
 static void sh_elf_info_to_howto
   PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static boolean sh_elf_set_private_flags
+  PARAMS ((bfd *, flagword));
+static boolean sh_elf_copy_private_data
+  PARAMS ((bfd *, bfd *));
+static boolean sh_elf_merge_private_data
+  PARAMS ((bfd *, bfd *));
+boolean sh_elf_set_mach_from_flags
+  PARAMS ((bfd *));
 static boolean sh_elf_relax_section
   PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
 static boolean sh_elf_relax_delete_bytes
@@ -207,21 +215,21 @@
 	 0xff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  { 10 },
-  { 11 },
-  { 12 },
-  { 13 },
-  { 14 },
-  { 15 },
-  { 16 },
-  { 17 },
-  { 18 },
-  { 19 },
-  { 20 },
-  { 21 },
-  { 22 },
-  { 23 },
-  { 24 },
+  EMPTY_HOWTO (10),
+  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),
+  EMPTY_HOWTO (20),
+  EMPTY_HOWTO (21),
+  EMPTY_HOWTO (22),
+  EMPTY_HOWTO (23),
+  EMPTY_HOWTO (24),
 
   /* The remaining relocs are a GNU extension used for relaxing.  The
      final pass of the linker never needs to do anything with any of
@@ -426,7 +434,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   unsigned long insn;
   bfd_vma sym_value;
@@ -497,13 +505,13 @@
 static bfd_reloc_status_type
 sh_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section,
 		     output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd != NULL)
     reloc_entry->address += input_section->output_offset;
@@ -548,7 +556,7 @@
 
 static reloc_howto_type *
 sh_elf_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -566,7 +574,7 @@
 
 static void
 sh_elf_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf_Internal_Rela *dst;
 {
@@ -1161,13 +1169,15 @@
 	case R_SH_SWITCH32:
 	  /* These relocs types represent
 	       .word L2-L1
-	     The r_offset field holds the difference between the reloc
+	     The r_addend field holds the difference between the reloc
 	     address and L1.  That is the start of the reloc, and
 	     adding in the contents gives us the top.  We must adjust
-	     both the r_offset field and the section contents.  */
+	     both the r_offset field and the section contents.
+	     N.B. in gas / coff bfd, the elf bfd r_addend is called r_offset,
+	     and the elf bfd r_offset is called r_vaddr.  */
 
-	  start = irel->r_offset;
-	  stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_addend);
+	  stop = irel->r_offset;
+	  start = (bfd_vma) ((bfd_signed_vma) stop - (long) irel->r_addend);
 
 	  if (start > addr
 	      && start < toaddr
@@ -1178,8 +1188,6 @@
 		   && (start <= addr || start >= toaddr))
 	    irel->r_addend -= count;
 
-	  start = stop;
-
 	  if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16)
 	    voff = bfd_get_signed_16 (abfd, contents + nraddr);
 	  else if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH8)
@@ -1307,6 +1315,56 @@
 	{
 	  Elf_Internal_Sym sym;
 
+	  /* Dwarf line numbers use R_SH_SWITCH32 relocs.  */
+	  if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_SWITCH32)
+	    {
+	      bfd_vma start, stop;
+	      bfd_signed_vma voff;
+
+	      if (ocontents == NULL)
+		{
+		  if (elf_section_data (o)->this_hdr.contents != NULL)
+		    ocontents = elf_section_data (o)->this_hdr.contents;
+		  else
+		    {
+		      /* We always cache the section contents.
+                         Perhaps, if info->keep_memory is false, we
+                         should free them, if we are permitted to,
+                         when we leave sh_coff_relax_section.  */
+		      ocontents = (bfd_byte *) bfd_malloc (o->_raw_size);
+		      if (ocontents == NULL)
+			return false;
+		      if (! bfd_get_section_contents (abfd, o, ocontents,
+						      (file_ptr) 0,
+						      o->_raw_size))
+			return false;
+		      elf_section_data (o)->this_hdr.contents = ocontents;
+		    }
+		}
+
+	      stop = irelscan->r_offset;
+	      start
+		= (bfd_vma) ((bfd_signed_vma) stop - (long) irelscan->r_addend);
+
+	      /* STOP is in a different section, so it won't change.  */
+	      if (start > addr && start < toaddr)
+		irelscan->r_addend += count;
+
+	      voff = bfd_get_signed_32 (abfd, ocontents + irelscan->r_offset);
+	      stop = (bfd_vma) ((bfd_signed_vma) start + voff);
+
+	      if (start > addr
+		  && start < toaddr
+		  && (stop <= addr || stop >= toaddr))
+		bfd_put_signed_32 (abfd, voff + count,
+				   ocontents + irelscan->r_offset);
+	      else if (stop > addr
+		       && stop < toaddr
+		       && (start <= addr || start >= toaddr))
+		bfd_put_signed_32 (abfd, voff - count,
+				   ocontents + irelscan->r_offset);
+	    }
+
 	  if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32)
 	    continue;
 
@@ -1621,7 +1679,7 @@
 static boolean
 sh_elf_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;
@@ -1731,7 +1789,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset, true)))
 		return false;
 	      relocation = 0;
 	    }
@@ -1927,7 +1985,7 @@
 static asection *
 sh_elf_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;
@@ -1949,6 +2007,9 @@
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -1967,10 +2028,10 @@
 
 static boolean
 sh_elf_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 sh. */
   return true;
@@ -2034,6 +2095,109 @@
   return true;
 }
 
+boolean
+sh_elf_set_mach_from_flags (abfd)
+     bfd *    abfd;
+{
+  flagword flags = elf_elfheader (abfd)->e_flags;
+
+  switch (flags & EF_SH_MACH_MASK)
+    {
+    case EF_SH1:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh);
+      break;
+    case EF_SH2:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh2);
+      break;
+    case EF_SH_DSP:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh_dsp);
+      break;
+    case EF_SH3:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3);
+      break;
+    case EF_SH3_DSP:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3_dsp);
+      break;
+    case EF_SH3E:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3e);
+      break;
+    case EF_SH_UNKNOWN:
+    case EF_SH4:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4);
+      break;
+    default:
+      return false;
+    }
+  return true;
+}
+
+/* Function to keep SH specific file flags. */
+static boolean
+sh_elf_set_private_flags (abfd, flags)
+     bfd *    abfd;
+     flagword flags;
+{
+  BFD_ASSERT (! elf_flags_init (abfd)
+	      || elf_elfheader (abfd)->e_flags == flags);
+
+  elf_elfheader (abfd)->e_flags = flags;
+  elf_flags_init (abfd) = true;
+  return sh_elf_set_mach_from_flags (abfd);
+}
+
+/* Copy backend specific data from one object module to another */
+static boolean
+sh_elf_copy_private_data (ibfd, obfd)
+     bfd * ibfd;
+     bfd * obfd;
+{
+  if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return true;
+
+  return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
+}
+
+/* This routine checks for linking big and little endian objects
+   together, and for linking sh-dsp with sh3e / sh4 objects.  */
+
+static boolean
+sh_elf_merge_private_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))
+    {
+      elf_flags_init (obfd) = true;
+      elf_elfheader (obfd)->e_flags = 0;
+    }
+  old_flags = elf_elfheader (obfd)->e_flags;
+  new_flags = elf_elfheader (ibfd)->e_flags;
+  if ((EF_SH_HAS_DSP (old_flags) && EF_SH_HAS_FP (new_flags))
+      || (EF_SH_HAS_DSP (new_flags) && EF_SH_HAS_FP (old_flags)))
+    {
+      (*_bfd_error_handler)
+	("%s: uses %s instructions while previous modules use %s instructions",
+	 bfd_get_filename (ibfd),
+	 EF_SH_HAS_DSP (new_flags) ? "dsp" : "floating point",
+	 EF_SH_HAS_DSP (new_flags) ? "floating point" : "dsp");
+      bfd_set_error (bfd_error_bad_value);
+      return false;
+    }
+  elf_elfheader (obfd)->e_flags = EF_SH_MERGE_MACH (old_flags, new_flags);
+
+  return sh_elf_set_mach_from_flags (obfd);
+}
+
 #define TARGET_BIG_SYM		bfd_elf32_sh_vec
 #define TARGET_BIG_NAME		"elf32-sh"
 #define TARGET_LITTLE_SYM	bfd_elf32_shl_vec
@@ -2050,6 +2214,13 @@
 #define elf_backend_relocate_section	sh_elf_relocate_section
 #define bfd_elf32_bfd_get_relocated_section_contents \
 					sh_elf_get_relocated_section_contents
+#define elf_backend_object_p		sh_elf_set_mach_from_flags
+#define bfd_elf32_bfd_set_private_bfd_flags \
+					sh_elf_set_private_flags
+#define bfd_elf32_bfd_copy_private_bfd_data \
+					sh_elf_copy_private_data
+#define bfd_elf32_bfd_merge_private_bfd_data \
+					sh_elf_merge_private_data
 
 #define elf_backend_gc_mark_hook        sh_elf_gc_mark_hook
 #define elf_backend_gc_sweep_hook       sh_elf_gc_sweep_hook
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index ec57c8c..e61a82f 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1,5 +1,6 @@
 /* SPARC-specific support for 32-bit ELF
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -33,8 +34,6 @@
 	   const Elf_Internal_Rela *));
 static boolean elf32_sparc_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf32_sparc_adjust_dynindx
-  PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf32_sparc_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static boolean elf32_sparc_relocate_section
@@ -182,7 +181,7 @@
 
 static reloc_howto_type *
 elf32_sparc_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -211,12 +210,24 @@
 
 static void
 elf32_sparc_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf_Internal_Rela *dst;
 {
-  BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max);
-  cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)];
+  switch (ELF32_R_TYPE(dst->r_info))
+    {
+    case R_SPARC_GNU_VTINHERIT:
+      cache_ptr->howto = &elf32_sparc_vtinherit_howto;
+      break;
+
+    case R_SPARC_GNU_VTENTRY:
+      cache_ptr->howto = &elf32_sparc_vtentry_howto;
+      break;
+
+    default:
+      BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max_std);
+      cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)];
+    }
 }
 
 /* For unsupported relocs.  */
@@ -229,13 +240,13 @@
 			     input_section,
 			     output_bfd,
 			     error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   return bfd_reloc_notsupported;
 }
@@ -256,7 +267,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
   bfd_vma x;
@@ -500,6 +511,9 @@
 
 	case R_SPARC_PC10:
 	case R_SPARC_PC22:
+	  if (h != NULL)
+	    h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
 	  if (h != NULL
 	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
 	    break;
@@ -511,6 +525,9 @@
 	case R_SPARC_WDISP22:
 	case R_SPARC_WDISP19:
 	case R_SPARC_WDISP16:
+	  if (h != NULL)
+	    h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
 	  /* If we are linking with -Bsymbolic, we do not need to copy
              a PC relative reloc against a global symbol which is
              defined in an object we are including in the link (i.e.,
@@ -533,6 +550,9 @@
 	case R_SPARC_13:
 	case R_SPARC_LO10:
 	case R_SPARC_UA32:
+	  if (h != NULL)
+	    h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
 	  if (info->shared)
 	    {
 	      /* When creating a shared object, we must copy these
@@ -596,7 +616,7 @@
 static asection *
 elf32_sparc_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;
@@ -619,6 +639,9 @@
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -640,7 +663,7 @@
 static boolean
 elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
@@ -821,6 +844,11 @@
   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
@@ -983,7 +1011,7 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
@@ -1028,51 +1056,6 @@
 	}
     }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section for which we might need to copy
-     relocs.  These are local symbols, which means that they must come
-     first in the dynamic symbol table.  That means we must increment
-     the dynamic symbol index of every other dynamic symbol.  */
-  if (info->shared)
-    {
-      int c;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  if ((s->flags & SEC_LINKER_CREATED) != 0
-	      || (s->flags & SEC_ALLOC) == 0)
-	    continue;
-
-	  elf_section_data (s)->dynindx = c + 1;
-
-	  /* These symbols will have no names, so we don't need to
-             fiddle with dynstr_index.  */
-
-	  ++c;
-	}
-
-      elf_link_hash_traverse (elf_hash_table (info),
-			      elf32_sparc_adjust_dynindx,
-			      (PTR) &c);
-      elf_hash_table (info)->dynsymcount += c;
-    }
-
-  return true;
-}
-
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-elf32_sparc_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  int *cp = (int *) cparg;
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
   return true;
 }
 
@@ -1134,7 +1117,7 @@
           || r_type == R_SPARC_GNU_VTENTRY)
         continue;
 
-      if (r_type < 0 || r_type >= (int) R_SPARC_max)
+      if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
 	{
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
@@ -1236,7 +1219,8 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset,
+		      (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
@@ -1507,15 +1491,7 @@
 			}
 
 		      outrel.r_info = ELF32_R_INFO (indx, r_type);
-
-		      /* For non-RELATIVE dynamic relocations, we keep the
-			 same symbol, and so generally the same addend.  But
-			 we do need to adjust those relocations referencing
-			 sections.  */
-		      outrel.r_addend = rel->r_addend;
-		      if (r_symndx < symtab_hdr->sh_info
-			  && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-		        outrel.r_addend += sec->output_offset+sym->st_value;
+		      outrel.r_addend = relocation + rel->r_addend;
 		    }
 		}
 
@@ -1835,50 +1811,6 @@
 
   elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int c;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx;
-
-	  if (elf_section_data (s)->dynindx == 0)
-	    continue;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  BFD_ASSERT (indx > 0);
-	  sym.st_shndx = indx;
-
-	  bfd_elf32_swap_symbol_out (output_bfd, &sym,
-				     (PTR) (((Elf32_External_Sym *)
-					     sdynsym->contents)
-					    + elf_section_data (s)->dynindx));
-
-	  ++c;
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
-    }
-
   return true;
 }
 
@@ -1898,7 +1830,8 @@
      bfd *obfd;
 {
   boolean error;
-  static int previous_ibfd_e_flags = -1;
+  /* FIXME: This should not be static.  */
+  static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
 
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@@ -1940,13 +1873,16 @@
 	(_("%s: compiled for a 64 bit system and target is 32 bit"),
 	 bfd_get_filename (ibfd));
     }
-  else if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
-    bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
+  else if ((ibfd->flags & DYNAMIC) == 0)
+    {
+      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)
-      && previous_ibfd_e_flags >= 0)
+      && previous_ibfd_e_flags != (unsigned long) -1)
     {
       (*_bfd_error_handler)
 	(_("%s: linking little endian files with big endian files"),
@@ -1994,7 +1930,7 @@
 static void
 elf32_sparc_final_write_processing (abfd, linker)
      bfd *abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   switch (bfd_get_mach (abfd))
     {
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index e71353d..4fe28fc 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1,5 +1,5 @@
 /* V850-specific support for 32-bit ELF
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -143,7 +143,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 v850_elf_reloc,		/* special_function */
 	 "R_V850_HI16_S",		/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xffff,			/* src_mask */
 	 0xffff,			/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -158,7 +158,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 v850_elf_reloc,		/* special_function */
 	 "R_V850_HI16",			/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xffff,			/* src_mask */
 	 0xffff,			/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -173,7 +173,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 v850_elf_reloc,		/* special_function */
 	 "R_V850_LO16",			/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xffff,			/* src_mask */
 	 0xffff,			/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -188,7 +188,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 v850_elf_reloc,		/* special_function */
 	 "R_V850_32",			/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xffffffff,			/* src_mask */
 	 0xffffffff,			/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -203,7 +203,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 bfd_elf_generic_reloc,		/* special_function */
 	 "R_V850_16",			/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xffff,			/* src_mask */
 	 0xffff,			/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -218,7 +218,7 @@
 	 complain_overflow_dont,	/* complain_on_overflow */
 	 bfd_elf_generic_reloc,		/* special_function */
 	 "R_V850_8",			/* name */
-	 true,				/* partial_inplace */
+	 false,				/* partial_inplace */
 	 0xff,				/* src_mask */
 	 0xff,				/* dst_mask */
 	 false),			/* pcrel_offset */
@@ -509,7 +509,7 @@
 /* Map a bfd relocation into the appropriate howto structure */
 static reloc_howto_type *
 v850_elf_reloc_type_lookup (abfd, code)
-     bfd *                     abfd;
+     bfd *                     abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type  code;
 {
   unsigned int i;
@@ -533,7 +533,7 @@
 /* Set the howto pointer for an V850 ELF reloc.  */
 static void
 v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *                 abfd;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      arelent *             cache_ptr;
      Elf32_Internal_Rel *  dst;
 {
@@ -547,7 +547,7 @@
 /* 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;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      arelent *             cache_ptr;
      Elf32_Internal_Rela   *dst;
 {
@@ -797,7 +797,6 @@
   hi16s_location * entry;
   hi16s_location * previous = NULL;
   hi16s_location * prev;
-  int              i;
   bfd_byte *       addr;
   
   /* Search the table.  Record the most recent entry that matches.  */
@@ -1253,13 +1252,13 @@
 /* Insert the addend into the instruction.  */
 static bfd_reloc_status_type
 v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
-     bfd *       abfd;
+     bfd *       abfd ATTRIBUTE_UNUSED;
      arelent *   reloc;
      asymbol *   symbol;
-     PTR         data;
+     PTR         data ATTRIBUTE_UNUSED;
      asection *  isection;
      bfd *       obfd;
-     char **     err;
+     char **     err ATTRIBUTE_UNUSED;
 {
   long relocation;
   
@@ -1327,7 +1326,7 @@
 /*ARGSUSED*/
 static boolean
 v850_elf_is_local_label_name (abfd, name)
-     bfd *         abfd;
+     bfd *         abfd ATTRIBUTE_UNUSED;
      const char *  name;
 {
   return (   (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
@@ -1342,7 +1341,7 @@
 				    addend, info, sym_sec, is_local)
      reloc_howto_type *      howto;
      bfd *                   input_bfd;
-     bfd *                   output_bfd;
+     bfd *                   output_bfd ATTRIBUTE_UNUSED;
      asection *              input_section;
      bfd_byte *              contents;
      bfd_vma                 offset;
@@ -1350,7 +1349,7 @@
      bfd_vma                 addend;
      struct bfd_link_info *  info;
      asection *              sym_sec;
-     int                     is_local;
+     int                     is_local ATTRIBUTE_UNUSED;
 {
   unsigned long  r_type   = howto->type;
   bfd_byte *     hit_data = contents + offset;
@@ -1369,6 +1368,10 @@
 		+ input_section->output_offset
 		+ offset);
 
+      /* 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;
       
@@ -1622,7 +1625,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset, true)))
 		return false;
 #if 0
 fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
@@ -1666,7 +1669,7 @@
 	    case bfd_reloc_undefined:
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, name, input_bfd, input_section,
-		      rel->r_offset)))
+		      rel->r_offset, true)))
 		return false;
 	      break;
 
@@ -1713,10 +1716,10 @@
 
 static boolean
 v850_elf_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;
 {
   /* No got and plt entries for v850-elf */
   return true;
@@ -1725,7 +1728,7 @@
 static asection *
 v850_elf_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;
@@ -1747,6 +1750,9 @@
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+	  default:
+	    break;
           }
        }
      }
@@ -1781,7 +1787,7 @@
 static void
 v850_elf_final_write_processing (abfd, linker)
      bfd *   abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   unsigned long val;
 
@@ -1934,8 +1940,8 @@
 
 static boolean
 v850_elf_section_from_bfd_section (abfd, hdr, sec, retval)
-     bfd *                 abfd;
-     Elf32_Internal_Shdr * hdr;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
+     Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED;
      asection *            sec;
      int *                 retval;
 {
@@ -2053,10 +2059,10 @@
 static boolean
 v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *                    abfd;
-     struct bfd_link_info *   info;
+     struct bfd_link_info *   info ATTRIBUTE_UNUSED;
      const Elf_Internal_Sym * sym;
-     const char **            namep;
-     flagword *               flagsp;
+     const char **            namep ATTRIBUTE_UNUSED;
+     flagword *               flagsp ATTRIBUTE_UNUSED;
      asection **              secp;
      bfd_vma *                valp;
 {
@@ -2114,9 +2120,9 @@
 /*ARGSIGNORED*/
 static boolean
 v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
-     bfd *                  abfd;
-     struct bfd_link_info * info;
-     const char *           name;
+     bfd *                  abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info * info ATTRIBUTE_UNUSED;
+     const char *           name ATTRIBUTE_UNUSED;
      Elf_Internal_Sym *     sym;
      asection *             input_sec;
 {
@@ -2169,7 +2175,7 @@
    section name, which is a hack, but ought to work.  */
 static boolean
 v850_elf_fake_sections (abfd, hdr, sec)
-     bfd *                 abfd;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      Elf32_Internal_Shdr * hdr;
      asection *            sec;
 {
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 1964f86..c8d8f0e 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -115,8 +115,6 @@
   PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));
 static boolean elf64_alpha_size_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_alpha_adjust_dynindx
-  PARAMS((struct elf_link_hash_entry *, PTR));
 static boolean elf64_alpha_relocate_section
   PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
 	  Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -127,6 +125,10 @@
   PARAMS((bfd *, struct bfd_link_info *));
 static boolean elf64_alpha_final_link
   PARAMS((bfd *, struct bfd_link_info *));
+static boolean elf64_alpha_merge_ind_symbols
+  PARAMS((struct alpha_elf_link_hash_entry *, PTR));
+static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
+  PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
 
 
 struct alpha_elf_link_hash_entry
@@ -974,6 +976,17 @@
   {BFD_RELOC_16_PCREL,		R_ALPHA_SREL16},
   {BFD_RELOC_32_PCREL,		R_ALPHA_SREL32},
   {BFD_RELOC_64_PCREL,		R_ALPHA_SREL64},
+
+/* 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. */
+  {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},
+  {BFD_RELOC_ALPHA_USER_LITUSE_JSR,	R_ALPHA_LITUSE},
+  {BFD_RELOC_ALPHA_USER_GPDISP,		R_ALPHA_GPDISP},
+  {BFD_RELOC_ALPHA_USER_GPRELHIGH,	R_ALPHA_GPRELHIGH},
+  {BFD_RELOC_ALPHA_USER_GPRELLOW,	R_ALPHA_GPRELLOW},
 };
 
 /* Given a BFD reloc type, return a HOWTO structure.  */
@@ -3254,7 +3267,7 @@
 	}
 
       if (strip)
-	_bfd_strip_section_from_output (s);
+	_bfd_strip_section_from_output (info, s);
       else
 	{
 	  /* Allocate memory for the section contents.  */
@@ -3264,34 +3277,6 @@
 	}
     }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section.  These are local symbols, which
-     means that they must come first in the dynamic symbol table.
-     That means we must increment the dynamic symbol index of every
-     other dynamic symbol.  */
-  if (info->shared)
-    {
-      long c[2], i;
-      asection *p;
-
-      c[0] = 0;
-      c[1] = bfd_count_sections (output_bfd);
-
-      elf_hash_table (info)->dynsymcount += c[1];
-      elf_link_hash_traverse (elf_hash_table(info),
-			      elf64_alpha_adjust_dynindx,
-			      (PTR) c);
-
-      for (i = 1, p = output_bfd->sections;
-	   p != NULL;
-	   p = p->next, i++)
-	{
-	  elf_section_data (p)->dynindx = i;
-	  /* These symbols will have no names, so we don't need to
-	     fiddle with dynstr_index.  */
-	}
-    }
-
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       /* Add some entries to the .dynamic section.  We fill in the
@@ -3332,22 +3317,6 @@
   return true;
 }
 
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-elf64_alpha_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  long *cp = (long *)cparg;
-
-  if (h->dynindx >= cp[0])
-    h->dynindx += cp[1];
-
-  return true;
-}
-
 /* Relocate an Alpha ELF section.  */
 
 static boolean
@@ -3423,6 +3392,12 @@
 	     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.  */
+
+	  /* 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;
+
 	  if (r_symndx < symtab_hdr->sh_info)
 	    {
 	      sym = local_syms + r_symndx;
@@ -3505,7 +3480,8 @@
 	    {
 	      if (!((*info->callbacks->undefined_symbol)
 		    (info, h->root.root.root.string, input_bfd,
-		     input_section, rel->r_offset)))
+		     input_section, rel->r_offset,
+		     (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
@@ -3985,44 +3961,6 @@
 	}
     }
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  BFD_ASSERT (indx > 0);
-	  sym.st_shndx = indx;
-
-	  bfd_elf64_swap_symbol_out (output_bfd, &sym,
-				     (PTR) (((Elf64_External_Sym *)
-					     sdynsym->contents)
-					    + elf_section_data (s)->dynindx));
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
-	bfd_count_sections (output_bfd) + 1;
-    }
-
   return true;
 }
 
diff --git a/bfd/elf64-gen.c b/bfd/elf64-gen.c
index 2f470ff..78dc09d 100644
--- a/bfd/elf64-gen.c
+++ b/bfd/elf64-gen.c
@@ -64,6 +64,7 @@
 #define TARGET_BIG_NAME			"elf64-big"
 #define ELF_ARCH			bfd_arch_unknown
 #define ELF_MACHINE_CODE		EM_NONE
+#define ELF_MAXPAGESIZE			0x1
 #define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
 #define elf_info_to_howto		elf_generic_info_to_howto
 #define elf_info_to_howto_rel		elf_generic_info_to_howto_rel
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 9fb8bb9..6fc0dcd 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1,6 +1,8 @@
 /* MIPS-specific support for 64-bit ELF
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Ian Lance Taylor, Cygnus Support
+   Linker support added by Mark Mitchell, CodeSourcery, LLC.
+   <mark@codesourcery.com>
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -52,14 +54,20 @@
 static void mips_elf64_swap_reloca_in
   PARAMS ((bfd *, const Elf64_Mips_External_Rela *,
 	   Elf64_Mips_Internal_Rela *));
-#if 0
 static void mips_elf64_swap_reloc_out
   PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *,
 	   Elf64_Mips_External_Rel *));
-#endif
 static void mips_elf64_swap_reloca_out
   PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
 	   Elf64_Mips_External_Rela *));
+static void mips_elf64_be_swap_reloc_in
+  PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+static void mips_elf64_be_swap_reloc_out
+  PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+static void mips_elf64_be_swap_reloca_in
+  PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+static void mips_elf64_be_swap_reloca_out
+  PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
 static reloc_howto_type *mips_elf64_reloc_type_lookup
   PARAMS ((bfd *, bfd_reloc_code_real_type));
 static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
@@ -68,10 +76,6 @@
 static boolean mips_elf64_slurp_reloc_table
   PARAMS ((bfd *, asection *, asymbol **, boolean));
 static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR));
-static boolean mips_elf64_section_from_shdr
-  PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
-static boolean mips_elf64_section_processing
-  PARAMS ((bfd *, Elf_Internal_Shdr *));
 static boolean mips_elf64_slurp_armap PARAMS ((bfd *));
 static boolean mips_elf64_write_armap
   PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
@@ -80,6 +84,9 @@
    from smaller values.  Start with zero, widen, *then* decrement.  */
 #define MINUS_ONE	(((bfd_vma)0) - 1)
 
+/* The number of local .got entries we reserve.  */
+#define MIPS_RESERVED_GOTNO (2)
+
 /* The relocation table used for SHT_REL sections.  */
 
 static reloc_howto_type mips_elf64_howto_table_rel[] =
@@ -614,7 +621,23 @@
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 false)			/* pcrel_offset */
+	 false),		/* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No 
+     relocation is required for correctness.  */
+  HOWTO (R_MIPS_JALR,	        /* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_JALR",	        /* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 false),		/* pcrel_offset */
 };
 
 /* The relocation table used for SHT_RELA sections.  */
@@ -1152,7 +1175,23 @@
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 false)			/* pcrel_offset */
+	 false),		/* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No 
+     relocation is required for correctness.  */
+  HOWTO (R_MIPS_JALR,	        /* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_JALR",	        /* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 false),		/* pcrel_offset */
 };
 
 /* Swap in a MIPS 64-bit Rel reloc.  */
@@ -1188,10 +1227,6 @@
   dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend);
 }
 
-#if 0
-
-/* This is not currently used.  */
-
 /* Swap out a MIPS 64-bit Rel reloc.  */
 
 static void
@@ -1208,8 +1243,6 @@
   bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
 }
 
-#endif /* 0 */
-
 /* Swap out a MIPS 64-bit Rela reloc.  */
 
 static void
@@ -1227,6 +1260,96 @@
   bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend);
 }
 
+/* Swap in a MIPS 64-bit Rel reloc.  */
+
+static void
+mips_elf64_be_swap_reloc_in (abfd, src, dst)
+     bfd *abfd;
+     const bfd_byte *src;
+     Elf_Internal_Rel *dst;
+{
+  Elf64_Mips_Internal_Rel mirel;
+
+  mips_elf64_swap_reloc_in (abfd, 
+			    (const Elf64_Mips_External_Rel *) src,
+			    &mirel);
+
+  dst[0].r_offset = mirel.r_offset;
+  dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type);
+  dst[1].r_offset = mirel.r_offset;
+  dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2);
+  dst[2].r_offset = mirel.r_offset;
+  dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3);
+}
+
+/* Swap in a MIPS 64-bit Rela reloc.  */
+
+static void
+mips_elf64_be_swap_reloca_in (abfd, src, dst)
+     bfd *abfd;
+     const bfd_byte *src;
+     Elf_Internal_Rela *dst;
+{
+  Elf64_Mips_Internal_Rela mirela;
+
+  mips_elf64_swap_reloca_in (abfd, 
+			     (const Elf64_Mips_External_Rela *) src,
+			     &mirela);
+
+  dst[0].r_offset = mirela.r_offset;
+  dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type);
+  dst[0].r_addend = mirela.r_addend;
+  dst[1].r_offset = mirela.r_offset;
+  dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2);
+  dst[1].r_addend = 0;
+  dst[2].r_offset = mirela.r_offset;
+  dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3);
+  dst[2].r_addend = 0;
+}
+
+/* Swap out a MIPS 64-bit Rel reloc.  */
+
+static void
+mips_elf64_be_swap_reloc_out (abfd, src, dst)
+     bfd *abfd;
+     const Elf_Internal_Rel *src;
+     bfd_byte *dst;
+{
+  Elf64_Mips_Internal_Rel mirel;
+
+  mirel.r_offset = src->r_offset;
+  mirel.r_type = ELF32_R_TYPE (src->r_info);
+  mirel.r_sym = ELF32_R_SYM (src->r_info);
+  mirel.r_type2 = R_MIPS_NONE;
+  mirel.r_ssym = STN_UNDEF;
+  mirel.r_type3 = R_MIPS_NONE;
+
+  mips_elf64_swap_reloc_out (abfd, &mirel, 
+			     (Elf64_Mips_External_Rel *) dst);
+}
+
+/* Swap out a MIPS 64-bit Rela reloc.  */
+
+static void
+mips_elf64_be_swap_reloca_out (abfd, src, dst)
+     bfd *abfd;
+     const Elf_Internal_Rela *src;
+     bfd_byte *dst;
+{
+  Elf64_Mips_Internal_Rela mirela;
+
+  mirela.r_offset = src->r_offset;
+  mirela.r_type = ELF32_R_TYPE (src->r_info);
+  mirela.r_addend = src->r_addend;
+  mirela.r_sym = ELF32_R_SYM (src->r_info);
+  mirela.r_type2 = R_MIPS_NONE;
+  mirela.r_ssym = STN_UNDEF;
+  mirela.r_type3 = R_MIPS_NONE;
+
+  mips_elf64_swap_reloca_out (abfd, &mirela, 
+			      (Elf64_Mips_External_Rela *) dst);
+}
+
 /* A mapping from BFD reloc types to MIPS ELF reloc types.  */
 
 struct elf_reloc_map
@@ -1255,7 +1378,11 @@
   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
   { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
   { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
-  { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }
+  { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
+  { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
+  { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
+  { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
+  { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }
 };
 
 /* Given a BFD reloc type, return a howto structure.  */
@@ -1688,115 +1815,6 @@
 	      == count);
 }
 
-/* Handle a 64-bit MIPS ELF specific section.  */
-
-static boolean
-mips_elf64_section_from_shdr (abfd, hdr, name)
-     bfd *abfd;
-     Elf_Internal_Shdr *hdr;
-     char *name;
-{
-  if (! _bfd_mips_elf_section_from_shdr (abfd, hdr, name))
-    return false;
-
-  /* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and
-     set the gp value based on what we find.  We may see both
-     SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case,
-     they should agree.  */
-  if (hdr->sh_type == SHT_MIPS_OPTIONS)
-    {
-      bfd_byte *contents, *l, *lend;
-
-      contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
-      if (contents == NULL)
-	return false;
-      if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents,
-				      (file_ptr) 0, hdr->sh_size))
-	{
-	  free (contents);
-	  return false;
-	}
-      l = contents;
-      lend = contents + hdr->sh_size;
-      while (l + sizeof (Elf_External_Options) <= lend)
-	{
-	  Elf_Internal_Options intopt;
-
-	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
-					&intopt);
-	  if (intopt.kind == ODK_REGINFO)
-	    {
-	      Elf64_Internal_RegInfo intreg;
-
-	      bfd_mips_elf64_swap_reginfo_in
-		(abfd,
-		 ((Elf64_External_RegInfo *)
-		  (l + sizeof (Elf_External_Options))),
-		 &intreg);
-	      elf_gp (abfd) = intreg.ri_gp_value;
-	    }
-	  l += intopt.size;
-	}
-      free (contents);
-    }
-
-  return true;
-}
-
-/* Work over a section just before writing it out.  We update the GP
-   value in the SHT_MIPS_OPTIONS section based on the value we are
-   using.  */
-
-static boolean
-mips_elf64_section_processing (abfd, hdr)
-     bfd *abfd;
-     Elf_Internal_Shdr *hdr;
-{
-  if (hdr->sh_type == SHT_MIPS_OPTIONS
-      && hdr->bfd_section != NULL
-      && elf_section_data (hdr->bfd_section) != NULL
-      && elf_section_data (hdr->bfd_section)->tdata != NULL)
-    {
-      bfd_byte *contents, *l, *lend;
-
-      /* We stored the section contents in the elf_section_data tdata
-	 field in the set_section_contents routine.  We save the
-	 section contents so that we don't have to read them again.
-	 At this point we know that elf_gp is set, so we can look
-	 through the section contents to see if there is an
-	 ODK_REGINFO structure.  */
-
-      contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata;
-      l = contents;
-      lend = contents + hdr->sh_size;
-      while (l + sizeof (Elf_External_Options) <= lend)
-	{
-	  Elf_Internal_Options intopt;
-
-	  bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
-					&intopt);
-	  if (intopt.kind == ODK_REGINFO)
-	    {
-	      bfd_byte buf[8];
-
-	      if (bfd_seek (abfd,
-			    (hdr->sh_offset
-			     + (l - contents)
-			     + sizeof (Elf_External_Options)
-			     + (sizeof (Elf64_External_RegInfo) - 8)),
-			     SEEK_SET) == -1)
-		return false;
-	      bfd_h_put_64 (abfd, elf_gp (abfd), buf);
-	      if (bfd_write (buf, 1, 8, abfd) != 8)
-		return false;
-	    }
-	  l += intopt.size;
-	}
-    }
-
-  return _bfd_mips_elf_section_processing (abfd, hdr);
-}
-
 /* Irix 6 defines a brand new archive map format, so that they can
    have archives more than 4 GB in size.  */
 
@@ -2063,6 +2081,8 @@
   sizeof (Elf64_External_Sym),
   sizeof (Elf64_External_Dyn),
   sizeof (Elf_External_Note),
+  4,            /* hash-table entry size */
+  3,            /* internal relocations per external relocations */
   64,		/* arch_size */
   8,		/* file_align */
   ELFCLASS64,
@@ -2073,7 +2093,12 @@
   bfd_elf64_swap_symbol_out,
   mips_elf64_slurp_reloc_table,
   bfd_elf64_slurp_symbol_table,
-  bfd_elf64_swap_dyn_in
+  bfd_elf64_swap_dyn_in,
+  bfd_elf64_swap_dyn_out,
+  mips_elf64_be_swap_reloc_in,
+  mips_elf64_be_swap_reloc_out,
+  mips_elf64_be_swap_reloca_in,
+  mips_elf64_be_swap_reloca_out
 };
 
 #define TARGET_LITTLE_SYM		bfd_elf64_littlemips_vec
@@ -2082,29 +2107,67 @@
 #define TARGET_BIG_NAME			"elf64-bigmips"
 #define ELF_ARCH			bfd_arch_mips
 #define ELF_MACHINE_CODE		EM_MIPS
+
 #define ELF_MAXPAGESIZE			0x1000
+
+#define elf_backend_collect		true
+#define elf_backend_type_change_ok	true
+#define elf_backend_can_gc_sections	true
 #define elf_backend_size_info		mips_elf64_size_info
 #define elf_backend_object_p		_bfd_mips_elf_object_p
-#define elf_backend_section_from_shdr	mips_elf64_section_from_shdr
+#define elf_backend_section_from_shdr	_bfd_mips_elf_section_from_shdr
 #define elf_backend_fake_sections	_bfd_mips_elf_fake_sections
 #define elf_backend_section_from_bfd_section \
 					_bfd_mips_elf_section_from_bfd_section
-#define elf_backend_section_processing	mips_elf64_section_processing
+#define elf_backend_section_processing	_bfd_mips_elf_section_processing
 #define elf_backend_symbol_processing	_bfd_mips_elf_symbol_processing
+#define elf_backend_additional_program_headers \
+					_bfd_mips_elf_additional_program_headers
+#define elf_backend_modify_segment_map	_bfd_mips_elf_modify_segment_map
 #define elf_backend_final_write_processing \
 					_bfd_mips_elf_final_write_processing
 #define elf_backend_ecoff_debug_swap	&mips_elf64_ecoff_debug_swap
+#define elf_backend_add_symbol_hook	_bfd_mips_elf_add_symbol_hook
+#define elf_backend_create_dynamic_sections \
+					_bfd_mips_elf_create_dynamic_sections
+#define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
+#define elf_backend_adjust_dynamic_symbol \
+					_bfd_mips_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+					_bfd_mips_elf_always_size_sections
+#define elf_backend_size_dynamic_sections \
+					_bfd_mips_elf_size_dynamic_sections
+#define elf_backend_relocate_section    _bfd_mips_elf_relocate_section
+#define elf_backend_link_output_symbol_hook \
+					_bfd_mips_elf_link_output_symbol_hook
+#define elf_backend_finish_dynamic_symbol \
+					_bfd_mips_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+					_bfd_mips_elf_finish_dynamic_sections
+#define elf_backend_gc_mark_hook	_bfd_mips_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook	_bfd_mips_elf_gc_sweep_hook
+#define elf_backend_got_header_size	(4*MIPS_RESERVED_GOTNO)
+#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 
+   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
-#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
-#define bfd_elf64_bfd_reloc_type_lookup	mips_elf64_reloc_type_lookup
 #define bfd_elf64_set_section_contents	_bfd_mips_elf_set_section_contents
+#define bfd_elf64_bfd_link_hash_table_create \
+					_bfd_mips_elf_link_hash_table_create
+#define bfd_elf64_bfd_final_link	_bfd_mips_elf_final_link
 #define bfd_elf64_bfd_copy_private_bfd_data \
 					_bfd_mips_elf_copy_private_bfd_data
 #define bfd_elf64_bfd_merge_private_bfd_data \
 					_bfd_mips_elf_merge_private_bfd_data
 #define bfd_elf64_bfd_set_private_flags	_bfd_mips_elf_set_private_flags
+#define bfd_elf64_bfd_print_private_bfd_data \
+					_bfd_mips_elf_print_private_bfd_data
 
+#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
+#define bfd_elf64_bfd_reloc_type_lookup	mips_elf64_reloc_type_lookup
 #define bfd_elf64_archive_functions
 #define bfd_elf64_archive_slurp_armap	mips_elf64_slurp_armap
 #define bfd_elf64_archive_slurp_extended_name_table \
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 17fe98d..46e7775 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1,5 +1,6 @@
 /* SPARC-specific support for 64-bit ELF
-   Copyright (C) 1993, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -32,6 +33,8 @@
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value.  */
 #define MINUS_ONE (~ (bfd_vma) 0)
 
+static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create
+  PARAMS((bfd *));
 static reloc_howto_type *sparc64_elf_reloc_type_lookup
   PARAMS ((bfd *, bfd_reloc_code_real_type));
 static void sparc64_elf_info_to_howto
@@ -51,8 +54,13 @@
   PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));
 static boolean sparc64_elf_size_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
-static boolean sparc64_elf_adjust_dynindx
-  PARAMS((struct elf_link_hash_entry *, PTR));
+static int sparc64_elf_get_symbol_type
+  PARAMS (( Elf_Internal_Sym *, int));
+static boolean sparc64_elf_add_symbol_hook
+  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+        const char **, flagword *, asection **, bfd_vma *));
+static void sparc64_elf_symbol_processing
+  PARAMS ((bfd *, asymbol *));
 
 static boolean sparc64_elf_merge_private_bfd_data
   PARAMS ((bfd *, bfd *));
@@ -61,6 +69,15 @@
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
 	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 static boolean sparc64_elf_object_p PARAMS ((bfd *));
+static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *));
+static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
+static boolean sparc64_elf_slurp_one_reloc_table
+  PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, boolean));
+static boolean sparc64_elf_slurp_reloc_table
+  PARAMS ((bfd *, asection *, asymbol **, boolean));
+static long sparc64_elf_canonicalize_dynamic_reloc
+  PARAMS ((bfd *, arelent **, asymbol **));
+static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));
 
 /* The relocation "howto" table.  */
 
@@ -213,10 +230,428 @@
      arelent *cache_ptr;
      Elf64_Internal_Rela *dst;
 {
-  BFD_ASSERT (ELF64_R_TYPE (dst->r_info) < (unsigned int) R_SPARC_max);
-  cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE (dst->r_info)];
+  BFD_ASSERT (ELF64_R_TYPE_ID (dst->r_info) < (unsigned int) R_SPARC_max_std);
+  cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)];
 }
 
+/* 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;
+     asection *sec;
+{
+  return (sec->reloc_count * 2 + 1) * sizeof (arelent *);
+}
+
+static long
+sparc64_elf_get_dynamic_reloc_upper_bound (abfd)
+     bfd *abfd;
+{
+  return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;
+}
+
+/* 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.  */
+
+static boolean
+sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
+     bfd *abfd;
+     asection *asect;
+     Elf_Internal_Shdr *rel_hdr;
+     asymbol **symbols;
+     boolean dynamic;
+{
+  struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+  PTR allocated = NULL;
+  bfd_byte *native_relocs;
+  arelent *relent;
+  unsigned int i;
+  int entsize;
+  bfd_size_type count;
+  arelent *relents;
+
+  allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
+  if (allocated == NULL)
+    goto error_return;
+
+  if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
+      || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd)
+	  != rel_hdr->sh_size))
+    goto error_return;
+
+  native_relocs = (bfd_byte *) allocated;
+
+  relents = asect->relocation + asect->reloc_count;
+
+  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;
+       i++, relent++, native_relocs += entsize)
+    {
+      Elf_Internal_Rela rela;
+
+      bfd_elf64_swap_reloca_in (abfd, (Elf64_External_Rela *) native_relocs, &rela);
+
+      /* The address of an ELF reloc is section relative for an object
+	 file, and absolute for an executable file or shared library.
+	 The address of a normal BFD reloc is always section relative,
+	 and the address of a dynamic reloc is absolute..  */
+      if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
+	relent->address = rela.r_offset;
+      else
+	relent->address = rela.r_offset - asect->vma;
+
+      if (ELF64_R_SYM (rela.r_info) == 0)
+	relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+      else
+	{
+	  asymbol **ps, *s;
+
+	  ps = symbols + ELF64_R_SYM (rela.r_info) - 1;
+	  s = *ps;
+
+	  /* Canonicalize ELF section symbols.  FIXME: Why?  */
+	  if ((s->flags & BSF_SECTION_SYM) == 0)
+	    relent->sym_ptr_ptr = ps;
+	  else
+	    relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
+	}
+
+      relent->addend = rela.r_addend;
+
+      BFD_ASSERT (ELF64_R_TYPE_ID (rela.r_info) < (unsigned int) R_SPARC_max_std);
+      if (ELF64_R_TYPE_ID (rela.r_info) == R_SPARC_OLO10)
+	{
+	  relent->howto = &sparc64_elf_howto_table[R_SPARC_LO10];
+	  relent[1].address = relent->address;
+	  relent++;
+	  relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+	  relent->addend = ELF64_R_TYPE_DATA (rela.r_info);
+	  relent->howto = &sparc64_elf_howto_table[R_SPARC_13];
+	}
+      else
+	relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)];
+    }
+
+  asect->reloc_count += relent - relents;
+
+  if (allocated != NULL)
+    free (allocated);
+
+  return true;
+
+ error_return:
+  if (allocated != NULL)
+    free (allocated);
+  return false;
+}
+
+/* Read in and swap the external relocs.  */
+
+static boolean
+sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
+     bfd *abfd;
+     asection *asect;
+     asymbol **symbols;
+     boolean dynamic;
+{
+  struct bfd_elf_section_data * const d = elf_section_data (asect);
+  Elf_Internal_Shdr *rel_hdr;
+  Elf_Internal_Shdr *rel_hdr2;
+
+  if (asect->relocation != NULL)
+    return true;
+
+  if (! dynamic)
+    {
+      if ((asect->flags & SEC_RELOC) == 0
+	  || asect->reloc_count == 0)
+	return true;
+
+      rel_hdr = &d->rel_hdr;
+      rel_hdr2 = d->rel_hdr2;
+
+      BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
+		  || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
+    }
+  else
+    {
+      /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
+	 case because relocations against this section may use the
+	 dynamic symbol table, and in that case bfd_section_from_shdr
+	 in elf.c does not update the RELOC_COUNT.  */
+      if (asect->_raw_size == 0)
+	return true;
+
+      rel_hdr = &d->this_hdr;
+      asect->reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
+      rel_hdr2 = NULL;
+    }
+
+  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 
+      && !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
+					     dynamic))
+    return false;
+
+  return true;
+}
+
+/* Canonicalize the dynamic relocation entries.  Note that we return
+   the dynamic relocations as a single block, although they are
+   actually associated with particular sections; the interface, which
+   was designed for SunOS style shared libraries, expects that there
+   is only one set of dynamic relocs.  Any section that was actually
+   installed in the BFD, and has type SHT_REL or SHT_RELA, and uses
+   the dynamic symbol table, is considered to be a dynamic reloc
+   section.  */
+
+static long
+sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
+     bfd *abfd;
+     arelent **storage;
+     asymbol **syms;
+{
+  asection *s;
+  long ret;
+
+  if (elf_dynsymtab (abfd) == 0)
+    {
+      bfd_set_error (bfd_error_invalid_operation);
+      return -1;
+    }
+
+  ret = 0;
+  for (s = abfd->sections; s != NULL; s = s->next)
+    {
+      if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
+	  && (elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
+	{
+	  arelent *p;
+	  long count, i;
+
+	  if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, true))
+	    return -1;
+	  count = s->reloc_count;
+	  p = s->relocation;
+	  for (i = 0; i < count; i++)
+	    *storage++ = p++;
+	  ret += count;
+	}
+    }
+
+  *storage = NULL;
+
+  return ret;
+}
+
+/* Write out the relocs.  */
+
+static void
+sparc64_elf_write_relocs (abfd, sec, data)
+     bfd *abfd;
+     asection *sec;
+     PTR data;
+{
+  boolean *failedp = (boolean *) data;
+  Elf_Internal_Shdr *rela_hdr;
+  Elf64_External_Rela *outbound_relocas, *src_rela;
+  unsigned int idx, count;
+  asymbol *last_sym = 0;
+  int last_sym_idx = 0;
+
+  /* If we have already failed, don't do anything.  */
+  if (*failedp)
+    return;
+
+  if ((sec->flags & SEC_RELOC) == 0)
+    return;
+
+  /* The linker backend writes the relocs out itself, and sets the
+     reloc_count field to zero to inhibit writing them here.  Also,
+     sometimes the SEC_RELOC flag gets set even when there aren't any
+     relocs.  */
+  if (sec->reloc_count == 0)
+    return;
+
+  /* We can combine two relocs that refer to the same address
+     into R_SPARC_OLO10 if first one is R_SPARC_LO10 and the
+     latter is R_SPARC_13 with no associated symbol.  */
+  count = 0;
+  for (idx = 0; idx < sec->reloc_count; idx++)
+    {
+      bfd_vma addr;
+      unsigned int i;
+
+      ++count;
+
+      addr = sec->orelocation[idx]->address;
+      if (sec->orelocation[idx]->howto->type == R_SPARC_LO10
+	  && idx < sec->reloc_count - 1)
+	{
+	  arelent *r = sec->orelocation[idx + 1];
+
+	  if (r->howto->type == R_SPARC_13
+	      && r->address == addr
+	      && bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
+	      && (*r->sym_ptr_ptr)->value == 0)
+	    ++idx;
+	}
+    }
+
+  rela_hdr = &elf_section_data (sec)->rel_hdr;
+
+  rela_hdr->sh_size = rela_hdr->sh_entsize * count;
+  rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
+  if (rela_hdr->contents == NULL)
+    {
+      *failedp = true;
+      return;
+    }
+
+  /* Figure out whether the relocations are RELA or REL relocations.  */
+  if (rela_hdr->sh_type != SHT_RELA)
+    abort ();
+
+  /* orelocation has the data, reloc_count has the count... */
+  outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
+  src_rela = outbound_relocas;
+
+  for (idx = 0; idx < sec->reloc_count; idx++)
+    {
+      Elf_Internal_Rela dst_rela;
+      arelent *ptr;
+      asymbol *sym;
+      int n;
+
+      ptr = sec->orelocation[idx];
+
+      /* The address of an ELF reloc is section relative for an object
+	 file, and absolute for an executable file or shared library.
+	 The address of a BFD reloc is always section relative.  */
+      if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+	dst_rela.r_offset = ptr->address;
+      else
+	dst_rela.r_offset = ptr->address + sec->vma;
+
+      sym = *ptr->sym_ptr_ptr;
+      if (sym == last_sym)
+	n = last_sym_idx;
+      else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+	n = STN_UNDEF;
+      else
+	{
+	  last_sym = sym;
+	  n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
+	  if (n < 0)
+	    {
+	      *failedp = true;
+	      return;
+	    }
+	  last_sym_idx = n;
+	}
+
+      if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+	  && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+	  && ! _bfd_elf_validate_reloc (abfd, ptr))
+	{
+	  *failedp = true;
+	  return;
+	}
+
+      if (ptr->howto->type == R_SPARC_LO10
+	  && idx < sec->reloc_count - 1)
+	{
+	  arelent *r = sec->orelocation[idx + 1];
+
+	  if (r->howto->type == R_SPARC_13
+	      && r->address == ptr->address
+	      && bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
+	      && (*r->sym_ptr_ptr)->value == 0)
+	    {
+	      idx++;
+	      dst_rela.r_info
+		= ELF64_R_INFO (n, ELF64_R_TYPE_INFO (r->addend,
+						      R_SPARC_OLO10));
+	    }
+	  else
+	    dst_rela.r_info = ELF64_R_INFO (n, R_SPARC_LO10);
+	}
+      else
+	dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
+
+      dst_rela.r_addend = ptr->addend;
+      bfd_elf64_swap_reloca_out (abfd, &dst_rela, src_rela);
+      ++src_rela;
+    }
+}
+
+/* Sparc64 ELF linker hash table.  */
+
+struct sparc64_elf_app_reg
+{
+  unsigned char bind;
+  unsigned short shndx;
+  bfd *abfd;
+  char *name;
+};
+
+struct sparc64_elf_link_hash_table
+{
+  struct elf_link_hash_table root;
+
+  struct sparc64_elf_app_reg app_regs [4];
+};
+
+/* Get the Sparc64 ELF linker hash table from a link_info structure.  */
+
+#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 *
+sparc64_elf_bfd_link_hash_table_create (abfd)
+     bfd *abfd;
+{
+  struct sparc64_elf_link_hash_table *ret;
+
+  ret = ((struct sparc64_elf_link_hash_table *)
+	 bfd_zalloc (abfd, sizeof (struct sparc64_elf_link_hash_table)));
+  if (ret == (struct sparc64_elf_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;
+}
+
+
 /* Utility for performing the standard initial work of an instruction
    relocation.
    *PRELOCATION will contain the relocated item.
@@ -441,8 +876,8 @@
       /* sethi (. - plt0), %g1 */
       sethi = 0x03000000 | (i * PLT_ENTRY_SIZE);
 
-      /* ba,a,pt %icc, plt1 */
-      ba = 0x30480000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
+      /* ba,a,pt %xcc, plt1 */
+      ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
 
       bfd_put_32 (output_bfd, sethi, entry);
       bfd_put_32 (output_bfd, ba, entry+4);
@@ -479,7 +914,7 @@
 	  bfd_put_32 (output_bfd, 0x83c3c001, entry+16); /* jmpl %o7+%g1,%g1 */
 	  bfd_put_32 (output_bfd, 0x9e100005, entry+20); /* mov %g5,%o7 */
 
-	  bfd_put_64 (output_bfd, contents - entry+4, ptr);
+	  bfd_put_64 (output_bfd, contents - (entry+4), ptr);
 	}
     }
 }
@@ -514,11 +949,15 @@
 
   /* See above for details.  */
 
-  block = (index - LARGE_PLT_THRESHOLD) / 160;
-  ofs = (index - LARGE_PLT_THRESHOLD) % 160;
-  last = (max - LARGE_PLT_THRESHOLD) % 160;
+  block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160)
+	  + LARGE_PLT_THRESHOLD;
+  ofs = index - block;
+  if (block + 160 > max)
+    last = (max - LARGE_PLT_THRESHOLD) % 160;
+  else
+    last = 160;
 
-  return ((LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
+  return (block * PLT_ENTRY_SIZE
 	  + last * 6*4
 	  + ofs * 8);
 }
@@ -570,7 +1009,7 @@
       else
 	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 
-      switch (ELF64_R_TYPE (rel->r_info))
+      switch (ELF64_R_TYPE_ID (rel->r_info))
 	{
 	case R_SPARC_GOT10:
 	case R_SPARC_GOT13:
@@ -809,7 +1248,7 @@
 	default:
 	  (*_bfd_error_handler)(_("%s: check_relocs: unhandled reloc type %d"),
 				bfd_get_filename(abfd),
-				ELF64_R_TYPE (rel->r_info));
+				ELF64_R_TYPE_ID (rel->r_info));
 	  return false;
 	}
     }
@@ -817,6 +1256,223 @@
   return true;
 }
 
+/* Hook called by the linker routine which adds symbols from an object
+   file.  We use it for STT_REGISTER symbols.  */
+
+static boolean
+sparc64_elf_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;
+     asection **secp;
+     bfd_vma *valp;
+{
+  static char *stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
+
+  if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
+    {
+      int reg;
+      struct sparc64_elf_app_reg *p;
+      
+      reg = (int)sym->st_value;
+      switch (reg & ~1)
+	{
+	case 2: reg -= 2; break;
+	case 6: reg -= 4; break;
+	default:
+          (*_bfd_error_handler)
+            (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
+             bfd_get_filename (abfd));
+	  return false;
+	}
+
+      if (info->hash->creator != abfd->xvec
+	  || (abfd->flags & DYNAMIC) != 0)
+        {
+	  /* STT_REGISTER only works when linking an elf64_sparc object.
+	     If STT_REGISTER comes from a dynamic object, don't put it into
+	     the output bfd.  The dynamic linker will recheck it.  */
+	  *namep = NULL;
+	  return true;
+        }
+
+      p = sparc64_elf_hash_table(info)->app_regs + reg;
+
+      if (p->name != NULL && strcmp (p->name, *namep))
+	{
+          (*_bfd_error_handler)
+            (_("Register %%g%d used incompatibly: "
+               "previously declared in %s to %s, in %s redefined to %s"),
+             (int)sym->st_value,
+             bfd_get_filename (p->abfd), *p->name ? p->name : "#scratch",
+             bfd_get_filename (abfd), **namep ? *namep : "#scratch");
+	  return false;
+	}
+
+      if (p->name == NULL)
+	{
+	  if (**namep)
+	    {
+	      struct elf_link_hash_entry *h;
+	      
+	      h = (struct elf_link_hash_entry *)
+		bfd_link_hash_lookup (info->hash, *namep, false, false, false);
+
+	      if (h != NULL)
+		{
+		  unsigned char type = h->type;
+
+		  if (type > STT_FUNC) type = 0;
+		  (*_bfd_error_handler)
+		    (_("Symbol `%s' has differing types: "
+		       "previously %s, REGISTER in %s"),
+		     *namep, stt_types [type], bfd_get_filename (abfd));
+		  return false;
+		}
+
+	      p->name = bfd_hash_allocate (&info->hash->table,
+					   strlen (*namep) + 1);
+	      if (!p->name)
+		return false;
+
+	      strcpy (p->name, *namep);
+	    }
+	  else
+	    p->name = "";
+	  p->bind = ELF_ST_BIND (sym->st_info);
+	  p->abfd = abfd;
+	  p->shndx = sym->st_shndx;
+	}
+      else
+	{
+	  if (p->bind == STB_WEAK
+	      && ELF_ST_BIND (sym->st_info) == STB_GLOBAL)
+	    {
+	      p->bind = STB_GLOBAL;
+	      p->abfd = abfd;
+	    }
+	}
+      *namep = NULL;
+      return true;
+    }
+  else if (! *namep || ! **namep)
+    return true;
+  else
+    {
+      int i;
+      struct sparc64_elf_app_reg *p;
+
+      p = sparc64_elf_hash_table(info)->app_regs;
+      for (i = 0; i < 4; i++, p++)
+	if (p->name != NULL && ! strcmp (p->name, *namep))
+	  {
+	    unsigned char type = ELF_ST_TYPE (sym->st_info);
+
+	    if (type > STT_FUNC) type = 0;
+	    (*_bfd_error_handler)
+	      (_("Symbol `%s' has differing types: "
+		 "REGISTER in %s, %s in %s"),
+	       *namep, bfd_get_filename (p->abfd), stt_types [type],
+	       bfd_get_filename (abfd));
+	    return false;
+	  }
+    }
+  return true;
+}
+
+/* This function takes care of emiting STT_REGISTER symbols
+   which we cannot easily keep in the symbol hash table.  */
+
+static boolean
+sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     PTR finfo;
+     boolean (*func) PARAMS ((PTR, const char *,
+			      Elf_Internal_Sym *, asection *));
+{
+  int reg;
+  struct sparc64_elf_app_reg *app_regs =
+    sparc64_elf_hash_table(info)->app_regs;
+  Elf_Internal_Sym sym;
+
+  /* We arranged in size_dynamic_sections to put the STT_REGISTER entries
+     at the end of the dynlocal list, so they came at the end of the local
+     symbols in the symtab.  Except that they aren't STB_LOCAL, so we need
+     to back up symtab->sh_info.  */
+  if (elf_hash_table (info)->dynlocal)
+    {
+      bfd * dynobj = elf_hash_table (info)->dynobj;
+      asection *dynsymsec = bfd_get_section_by_name (dynobj, ".dynsym");
+      struct elf_link_local_dynamic_entry *e;
+
+      for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
+	if (e->input_indx == -1)
+	  break;
+      if (e)
+	{
+	  elf_section_data (dynsymsec->output_section)->this_hdr.sh_info
+	    = e->dynindx;
+	}
+    }
+
+  if (info->strip == strip_all)
+    return true;
+
+  for (reg = 0; reg < 4; reg++)
+    if (app_regs [reg].name != NULL)
+      {
+	if (info->strip == strip_some
+	    && bfd_hash_lookup (info->keep_hash,
+				app_regs [reg].name,
+				false, false) == NULL)
+	  continue;
+
+	sym.st_value = reg < 2 ? reg + 2 : reg + 4;
+	sym.st_size = 0;
+	sym.st_other = 0;
+	sym.st_info = ELF_ST_INFO (app_regs [reg].bind, STT_REGISTER);
+	sym.st_shndx = app_regs [reg].shndx;
+	if (! (*func) (finfo, app_regs [reg].name, &sym,
+		       sym.st_shndx == SHN_ABS
+			 ? bfd_abs_section_ptr : bfd_und_section_ptr))
+	  return false;
+      }
+
+  return true;
+}
+
+static int
+sparc64_elf_get_symbol_type (elf_sym, type)
+     Elf_Internal_Sym * elf_sym;
+     int type;
+{
+  if (ELF_ST_TYPE (elf_sym->st_info) == STT_REGISTER)
+    return STT_REGISTER;
+  else
+    return type;
+}
+
+/* A STB_GLOBAL,STT_REGISTER symbol should be BSF_GLOBAL
+   even in SHN_UNDEF section.  */
+
+static void
+sparc64_elf_symbol_processing (abfd, asym)
+     bfd *abfd;
+     asymbol *asym;
+{
+  elf_symbol_type *elfsym;
+
+  elfsym = (elf_symbol_type *) asym;
+  if (elfsym->internal_elf_sym.st_info
+      == ELF_ST_INFO (STB_GLOBAL, STT_REGISTER))
+    {
+      asym->flags |= BSF_GLOBAL;
+    }
+}
+
 /* 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
@@ -1097,7 +1753,7 @@
 
       if (strip)
 	{
-	  _bfd_strip_section_from_output (s);
+	  _bfd_strip_section_from_output (info, s);
 	  continue;
 	}
 
@@ -1116,6 +1772,11 @@
 	 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.  */
+      int reg;
+      struct sparc64_elf_app_reg * app_regs;
+      struct bfd_strtab_hash *dynstr;
+      struct elf_link_hash_table *eht = elf_hash_table (info);
+
       if (! info->shared)
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
@@ -1127,9 +1788,7 @@
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)
 	      || ! 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)
-	      || ! bfd_elf64_add_dynamic_entry (info, DT_SPARC_PLTFMT,
-						(info->shared != 0) + 1))
+	      || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0))
 	    return false;
 	}
 
@@ -1144,56 +1803,57 @@
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
 	}
-    }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section for which we might need to copy
-     relocs.  These are local symbols, which means that they must come
-     first in the dynamic symbol table.  That means we must increment
-     the dynamic symbol index of every other dynamic symbol.  */
-  if (info->shared)
-    {
-      int c;
+      /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
+	 entries if needed.  */
+      app_regs = sparc64_elf_hash_table (info)->app_regs;
+      dynstr = eht->dynstr;
 
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  if ((s->flags & SEC_LINKER_CREATED) != 0
-	      || (s->flags & SEC_ALLOC) == 0)
-	    continue;
+      for (reg = 0; reg < 4; reg++)
+	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;
 
-	  elf_section_data (s)->dynindx = c + 1;
+	    entry = (struct elf_link_local_dynamic_entry *)
+	      bfd_hash_allocate (&info->hash->table, sizeof (*entry));
+	    if (entry == NULL)
+	      return false;
 
-	  /* These symbols will have no names, so we don't need to
-             fiddle with dynstr_index.  */
+	    /* We cheat here a little bit: the symbol will not be local, so we
+	       put it at the end of the dynlocal linked list.  We will fix it
+	       later on, as we have to fix other fields anyway.  */
+	    entry->isym.st_value = reg < 2 ? reg + 2 : reg + 4;
+	    entry->isym.st_size = 0;
+	    if (*app_regs [reg].name != '\0')
+	      entry->isym.st_name
+		= _bfd_stringtab_add (dynstr, app_regs[reg].name, true, false);
+	    else
+	      entry->isym.st_name = 0;
+	    entry->isym.st_other = 0;
+	    entry->isym.st_info = ELF_ST_INFO (app_regs [reg].bind,
+					       STT_REGISTER);
+	    entry->isym.st_shndx = app_regs [reg].shndx;
+	    entry->next = NULL;
+	    entry->input_bfd = output_bfd;
+	    entry->input_indx = -1;
 
-	  ++c;
-	}
-
-      elf_link_hash_traverse (elf_hash_table (info),
-			      sparc64_elf_adjust_dynindx,
-			      (PTR) &c);
-      elf_hash_table (info)->dynsymcount += c;
+	    if (eht->dynlocal == NULL)
+	      eht->dynlocal = entry;
+	    else
+	      {
+		for (e = eht->dynlocal; e->next; e = e->next)
+		  ;
+		e->next = entry;
+	      }
+	    eht->dynsymcount++;
+	  }
     }
 
   return true;
 }
-
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-sparc64_elf_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  int *cp = (int *) cparg;
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
-  return true;
-}
-
 
 /* Relocate a SPARC64 ELF section.  */
 
@@ -1245,8 +1905,8 @@
       bfd_vma relocation;
       bfd_reloc_status_type r;
 
-      r_type = ELF64_R_TYPE (rel->r_info);
-      if (r_type < 0 || r_type >= (int) R_SPARC_max)
+      r_type = ELF64_R_TYPE_ID (rel->r_info);
+      if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
 	{
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
@@ -1395,7 +2055,8 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd,
-		      input_section, rel->r_offset)))
+		      input_section, rel->r_offset,
+		      (!info->shared || info->no_undefined))))
 		return false;
 	      relocation = 0;
 	    }
@@ -1531,7 +2192,11 @@
 				 & ELF_LINK_HASH_DEF_REGULAR) == 0))
 		  {
 		    BFD_ASSERT (h->dynindx != -1);
-		    outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
+		    outrel.r_info
+		      = ELF64_R_INFO (h->dynindx,
+				      ELF64_R_TYPE_INFO (
+					ELF64_R_TYPE_DATA (rel->r_info),
+							   r_type));
 		    outrel.r_addend = rel->r_addend;
 		  }
 		else
@@ -1581,16 +2246,12 @@
 			      }
 			  }
 
-			outrel.r_info = ELF64_R_INFO (indx, r_type);
-
-			/* For non-RELATIVE dynamic relocations, we keep the
-			   same symbol, and so generally the same addend.  But
-			   we do need to adjust those relocations referencing
-			   sections.  */
-			outrel.r_addend = rel->r_addend;
-			if (r_symndx < symtab_hdr->sh_info
-			    && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-			  outrel.r_addend += sec->output_offset+sym->st_value;
+			outrel.r_info
+			  = ELF64_R_INFO (indx,
+					  ELF64_R_TYPE_INFO (
+					    ELF64_R_TYPE_DATA (rel->r_info),
+							       r_type));
+			outrel.r_addend = relocation + rel->r_addend;
 		      }
 		  }
 
@@ -1605,7 +2266,7 @@
 		   reloc in an unallocated section.  */
 		if (skip
 		    || (input_section->flags & SEC_ALLOC) != 0
-		    || ELF64_R_TYPE (outrel.r_info) != R_SPARC_RELATIVE)
+		    || ELF64_R_TYPE_ID (outrel.r_info) != R_SPARC_RELATIVE)
 		  continue;
 	      }
 	    break;
@@ -1905,7 +2566,8 @@
 	{
 	  int max = splt->_raw_size / PLT_ENTRY_SIZE;
 	  rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max);
-	  rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4);
+	  rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4)
+			  -(splt->output_section->vma + splt->output_offset);
 	}
       rela.r_offset += (splt->output_section->vma + splt->output_offset);
       rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
@@ -2007,6 +2669,7 @@
      struct bfd_link_info *info;
 {
   bfd *dynobj;
+  int stt_regidx = -1;
   asection *sdyn;
   asection *sgot;
 
@@ -2037,6 +2700,17 @@
 	    case DT_PLTGOT:   name = ".plt"; size = false; break;
 	    case DT_PLTRELSZ: name = ".rela.plt"; size = true; break;
 	    case DT_JMPREL:   name = ".rela.plt"; size = false; break;
+	    case DT_SPARC_REGISTER:
+	      if (stt_regidx == -1)
+		{
+		  stt_regidx =
+		    _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1);
+		  if (stt_regidx == -1)
+		    return false;
+		}
+	      dyn.d_un.d_val = stt_regidx++;
+	      bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      /* fallthrough */
 	    default:	      name = NULL; size = false; break;
 	    }
 
@@ -2090,50 +2764,6 @@
 
   elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int c;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-	{
-	  int indx;
-
-	  if (elf_section_data (s)->dynindx == 0)
-	    continue;
-
-	  sym.st_value = s->vma;
-
-	  indx = elf_section_data (s)->this_idx;
-	  BFD_ASSERT (indx > 0);
-	  sym.st_shndx = indx;
-
-	  bfd_elf64_swap_symbol_out (output_bfd, &sym,
-				     (PTR) (((Elf64_External_Sym *)
-					     sdynsym->contents)
-					    + elf_section_data (s)->dynindx));
-
-	  ++c;
-	}
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
-    }
-
   return true;
 }
 
@@ -2171,25 +2801,40 @@
     {
       error = false;
   
-      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))
-        {
-          error = true;
-          (*_bfd_error_handler)
-            (_("%s: linking UltraSPARC specific with HAL specific code"),
-             bfd_get_filename (ibfd));
-        }
-        
-      /* Choose the most restrictive memory ordering */
-      old_mm = (old_flags & EF_SPARCV9_MM);
-      new_mm = (new_flags & EF_SPARCV9_MM);
-      old_flags &= ~EF_SPARCV9_MM;
-      new_flags &= ~EF_SPARCV9_MM;
-      if (new_mm < old_mm) old_mm = new_mm;
-      old_flags |= old_mm;
-      new_flags |= old_mm;
+      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.  */
+	  old_flags &= ~(EF_SPARCV9_MM | EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1);
+	  old_flags |= (new_flags
+			& (EF_SPARCV9_MM
+			   | EF_SPARC_SUN_US1
+			   | EF_SPARC_HAL_R1));
+	}
+      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))
+	    {
+	      error = true;
+	      (*_bfd_error_handler)
+		(_("%s: linking UltraSPARC specific with HAL specific code"),
+		 bfd_get_filename (ibfd));
+	    }
+	  /* Choose the most restrictive memory ordering.  */
+	  old_mm = (old_flags & EF_SPARCV9_MM);
+	  new_mm = (new_flags & EF_SPARCV9_MM);
+	  old_flags &= ~EF_SPARCV9_MM;
+	  new_flags &= ~EF_SPARCV9_MM;
+	  if (new_mm < old_mm)
+	    old_mm = new_mm;
+	  old_flags |= old_mm;
+	  new_flags |= old_mm;
+	}
 
       /* Warn about any other mismatches */
       if (new_flags != old_flags)
@@ -2210,7 +2855,34 @@
     }
   return true;
 }
+
+/* Print a STT_REGISTER symbol to file FILE.  */
 
+static const char *
+sparc64_elf_print_symbol_all (abfd, filep, symbol)
+     bfd *abfd;
+     PTR filep;
+     asymbol *symbol;
+{
+  FILE *file = (FILE *) filep;
+  int reg, type;
+  
+  if (ELF_ST_TYPE (((elf_symbol_type *) symbol)->internal_elf_sym.st_info)
+      != STT_REGISTER)
+    return NULL;
+
+  reg = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
+  type = symbol->flags;
+  fprintf (file, "REG_%c%c%11s%c%c    R", "GOLI" [reg / 8], '0' + (reg & 7), "",
+		 ((type & BSF_LOCAL)
+		  ? (type & BSF_GLOBAL) ? '!' : 'l'
+  	          : (type & BSF_GLOBAL) ? 'g' : ' '),
+  	         (type & BSF_WEAK) ? 'w' : ' ');
+  if (symbol->name == NULL || symbol->name [0] == '\0')
+    return "#scratch";
+  else
+    return symbol->name;
+}
 
 /* Set the right machine number for a SPARC64 ELF file.  */
 
@@ -2225,6 +2897,45 @@
   return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach);
 }
 
+/* Relocations in the 64 bit SPARC ELF ABI are more complex than in
+   standard ELF, because R_SPARC_OLO10 has secondary addend in
+   ELF64_R_TYPE_DATA field.  This structure is used to redirect the
+   relocation handling routines.  */
+
+const struct elf_size_info sparc64_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),
+  4,		/* hash-table entry size */
+  /* 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. */
+  1,
+  64,		/* arch_size */
+  8,		/* file_align */
+  ELFCLASS64,
+  EV_CURRENT,
+  bfd_elf64_write_out_phdrs,
+  bfd_elf64_write_shdrs_and_ehdr,
+  sparc64_elf_write_relocs,
+  bfd_elf64_swap_symbol_out,
+  sparc64_elf_slurp_reloc_table,
+  bfd_elf64_slurp_symbol_table,
+  bfd_elf64_swap_dyn_in,
+  bfd_elf64_swap_dyn_out,
+  NULL,
+  NULL,
+  NULL,
+  NULL
+};
+
 #define TARGET_BIG_SYM	bfd_elf64_sparc_vec
 #define TARGET_BIG_NAME	"elf64-sparc"
 #define ELF_ARCH	bfd_arch_sparc
@@ -2236,13 +2947,28 @@
 /* This is the value that we used before the ABI was released.  */
 #define ELF_MACHINE_ALT1 EM_OLD_SPARCV9
 
+#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 \
+  sparc64_elf_get_reloc_upper_bound
+#define bfd_elf64_get_dynamic_reloc_upper_bound \
+  sparc64_elf_get_dynamic_reloc_upper_bound
+#define bfd_elf64_canonicalize_dynamic_reloc \
+  sparc64_elf_canonicalize_dynamic_reloc
 #define bfd_elf64_bfd_reloc_type_lookup \
   sparc64_elf_reloc_type_lookup
 
 #define elf_backend_create_dynamic_sections \
   _bfd_elf_create_dynamic_sections
+#define elf_backend_add_symbol_hook \
+  sparc64_elf_add_symbol_hook
+#define elf_backend_get_symbol_type \
+  sparc64_elf_get_symbol_type
+#define elf_backend_symbol_processing \
+  sparc64_elf_symbol_processing
 #define elf_backend_check_relocs \
   sparc64_elf_check_relocs
 #define elf_backend_adjust_dynamic_symbol \
@@ -2255,10 +2981,16 @@
   sparc64_elf_finish_dynamic_symbol
 #define elf_backend_finish_dynamic_sections \
   sparc64_elf_finish_dynamic_sections
+#define elf_backend_print_symbol_all \
+  sparc64_elf_print_symbol_all
+#define elf_backend_output_arch_syms \
+  sparc64_elf_output_arch_syms
 
 #define bfd_elf64_bfd_merge_private_bfd_data \
   sparc64_elf_merge_private_bfd_data
 
+#define elf_backend_size_info \
+  sparc64_elf_size_info
 #define elf_backend_object_p \
   sparc64_elf_object_p
 
diff --git a/bfd/elfarm-nabi.c b/bfd/elfarm-nabi.c
index 5952e74..38778b7 100644
--- a/bfd/elfarm-nabi.c
+++ b/bfd/elfarm-nabi.c
@@ -35,8 +35,10 @@
 #define TARGET_BIG_NAME                 "elf32-bigarm"
 
 #define elf_info_to_howto               0
-#define elf_info_to_howto_rel           elf32_arm_info_to_howto_rel 
+#define elf_info_to_howto_rel           elf32_arm_info_to_howto
 
+#define ARM_ELF_ABI_VERSION		0
+#define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
 
 static reloc_howto_type * elf32_arm_reloc_type_lookup
   PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
@@ -574,8 +576,8 @@
 
  
 static void
-elf32_arm_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
-     bfd * abfd;
+elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
+     bfd * abfd ATTRIBUTE_UNUSED;
      arelent * bfd_reloc;
      Elf32_Internal_Rel * elf_reloc;
 {
@@ -639,7 +641,7 @@
 
 static reloc_howto_type *
 elf32_arm_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
diff --git a/bfd/elfarm-oabi.c b/bfd/elfarm-oabi.c
index f219b92..72f62f2 100644
--- a/bfd/elfarm-oabi.c
+++ b/bfd/elfarm-oabi.c
@@ -23,6 +23,10 @@
 #include "libbfd.h"
 #include "elf-bfd.h"
 
+#ifndef NUM_ELEM
+#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
+#endif
+
 #define USE_RELA
 
 #define TARGET_LITTLE_SYM               bfd_elf32_littlearm_oabi_vec
@@ -33,6 +37,9 @@
 #define elf_info_to_howto               elf32_arm_info_to_howto
 #define elf_info_to_howto_rel           0
 
+#define ARM_ELF_ABI_VERSION		0
+#define ARM_ELF_OS_ABI_VERSION		0
+
 static reloc_howto_type elf32_arm_howto_table[] =
 {
   /* No relocation */
@@ -173,7 +180,7 @@
 	 0,			/* bitsize */
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont,	/* complain_on_overflow */
+	 complain_overflow_dont,/* complain_on_overflow */
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_ARM_SBREL32",	/* name */
 	 false,			/* partial_inplace */
@@ -254,7 +261,24 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
- 
+
+  /* XXX - gap in index numbering here.  */
+  
+  HOWTO (R_ARM_PLT32,		/* 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_ARM_PLT32",		/* name */
+         true,			/* partial_inplace */
+         0x00ffffff,		/* src_mask */
+         0x00ffffff,		/* dst_mask */
+         true),			/* pcrel_offset */
+  
+  /* XXX - gap in index numbering here.  */
 
   HOWTO (R_ARM_RREL32,		/* type */
 	 0,			/* rightshift */
@@ -310,22 +334,38 @@
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 false),		/* pcrel_offset */
-
+	 false)			/* pcrel_offset */
 };
 
+/* Locate a reloc in the howto table.  This function must be used
+   when the entry number is is > R_ARM_GNU_VTINHERIT.  */
+static reloc_howto_type *
+find_howto (r_type)
+     unsigned int r_type;
+{
+  int i;
+  
+  for (i = NUM_ELEM (elf32_arm_howto_table); i--;)
+    if (elf32_arm_howto_table [i].type == r_type)
+      return elf32_arm_howto_table + i;
+
+  return NULL;
+}
+
 static void
 elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *bfd_reloc;
      Elf32_Internal_Rela *elf_reloc;
 {
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (elf_reloc->r_info);
-  /* fixme: need range test */
-  /* BFD_ASSERT (r_type < (unsigned int) R_ELF32_ARM_MAX); */
-  bfd_reloc->howto = &elf32_arm_howto_table[r_type];
+
+  if (r_type <= R_ARM_GNU_VTINHERIT)
+    bfd_reloc->howto = & elf32_arm_howto_table[r_type];
+  else
+    bfd_reloc->howto = find_howto (r_type);
 }
 
 struct elf32_arm_reloc_map
@@ -336,38 +376,37 @@
 
 static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
 {
-  {BFD_RELOC_NONE, R_ARM_NONE,},
-  {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24,},
-  {BFD_RELOC_32, R_ARM_ABS32,},
-  {BFD_RELOC_32_PCREL, R_ARM_REL32,},
-  {BFD_RELOC_8, R_ARM_ABS8,},
-  {BFD_RELOC_16, R_ARM_ABS16,},
-  {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12,},
-  {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5,},
-  {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22,},
-  {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
-  {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY },
-  {BFD_RELOC_NONE, R_ARM_SBREL32,},
-  {BFD_RELOC_NONE, R_ARM_AMP_VCALL9,},
-  {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11,},
-  {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9,}
+  {BFD_RELOC_NONE,                 R_ARM_NONE },
+  {BFD_RELOC_ARM_PCREL_BRANCH,     R_ARM_PC24 },
+  {BFD_RELOC_32,                   R_ARM_ABS32 },
+  {BFD_RELOC_32_PCREL,             R_ARM_REL32 },
+  {BFD_RELOC_8,                    R_ARM_ABS8 },
+  {BFD_RELOC_16,                   R_ARM_ABS16 },
+  {BFD_RELOC_ARM_OFFSET_IMM,       R_ARM_ABS12 },
+  {BFD_RELOC_ARM_THUMB_OFFSET,     R_ARM_THM_ABS5 },
+  {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
+  {BFD_RELOC_NONE,                 R_ARM_SBREL32 },
+  {BFD_RELOC_NONE,                 R_ARM_AMP_VCALL9 },
+  {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
+  {BFD_RELOC_THUMB_PCREL_BRANCH9,  R_ARM_THM_PC9 },  
+  {BFD_RELOC_VTABLE_INHERIT,       R_ARM_GNU_VTINHERIT },
+  {BFD_RELOC_VTABLE_ENTRY,         R_ARM_GNU_VTENTRY }
 };
 
 static reloc_howto_type *
 elf32_arm_reloc_type_lookup (abfd, code)
-     bfd * abfd;
+     bfd * abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
 
-  for (i = 0;
-     i < sizeof (elf32_arm_reloc_map) / sizeof (struct elf32_arm_reloc_map);
-       i++)
-    {
-      if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
-	return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
-    }
+  for (i = NUM_ELEM (elf32_arm_reloc_map); i--;)
+    if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
+      return & elf32_arm_howto_table [elf32_arm_reloc_map[i].elf_reloc_val];
 
+  if (code == BFD_RELOC_ARM_PLT32)
+    return find_howto (R_ARM_PLT32);
+  
   return NULL;
 }
 
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 22f6488..c5edf9b 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1,5 +1,6 @@
 /* ELF executable support for BFD.
-   Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software
+   Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -129,6 +130,8 @@
 #define elf_gc_common_final_link	NAME(_bfd_elf,gc_common_final_link)
 #define elf_gc_record_vtinherit		NAME(_bfd_elf,gc_record_vtinherit)
 #define elf_gc_record_vtentry		NAME(_bfd_elf,gc_record_vtentry)
+#define elf_link_record_local_dynamic_symbol \
+  NAME(_bfd_elf,link_record_local_dynamic_symbol)
 
 #if ARCH_SIZE == 64
 #define ELF_R_INFO(X,Y)	ELF64_R_INFO(X,Y)
@@ -162,6 +165,9 @@
 
 #define section_from_elf_index bfd_section_from_elf_index
 
+static boolean elf_slurp_reloc_table_from_section 
+  PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
+	   arelent *, asymbol **, boolean));
 static boolean elf_slurp_reloc_table
   PARAMS ((bfd *, asection *, asymbol **, boolean));
 
@@ -201,8 +207,13 @@
      const Elf_External_Sym *src;
      Elf_Internal_Sym *dst;
 {
+  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
   dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
-  dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
+  if (signed_vma)
+    dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value);
+  else
+    dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
   dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
   dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
   dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
@@ -289,10 +300,15 @@
      const Elf_External_Shdr *src;
      Elf_Internal_Shdr *dst;
 {
+  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
   dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
   dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
   dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
-  dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
+  if (signed_vma)
+    dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr);
+  else
+    dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
   dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
   dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
   dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
@@ -335,11 +351,21 @@
      const Elf_External_Phdr *src;
      Elf_Internal_Phdr *dst;
 {
+  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
   dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
   dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
   dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
-  dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
-  dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
+  if (signed_vma)
+    {
+      dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr);
+      dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr);
+    }
+  else
+    {
+      dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
+      dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
+    }
   dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
   dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
   dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);
@@ -419,11 +445,13 @@
 }
 
 INLINE void
-elf_swap_dyn_out (abfd, src, dst)
+elf_swap_dyn_out (abfd, src, p)
      bfd *abfd;
      const Elf_Internal_Dyn *src;
-     Elf_External_Dyn *dst;
+     PTR p;
 {
+  Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
+
   put_word (abfd, src->d_tag, dst->d_tag);
   put_word (abfd, src->d_un.d_val, dst->d_un.d_val);
 }
@@ -729,7 +757,7 @@
   Elf_External_Rela *outbound_relocas;
   Elf_External_Rel *outbound_relocs;
   unsigned int idx;
-  int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
+  int use_rela_p;
   asymbol *last_sym = 0;
   int last_sym_idx = 0;
 
@@ -757,6 +785,16 @@
       return;
     }
 
+  /* Figure out whether the relocations are RELA or REL relocations.  */
+  if (rela_hdr->sh_type == SHT_RELA)
+    use_rela_p = true;
+  else if (rela_hdr->sh_type == SHT_REL)
+    use_rela_p = false;
+  else
+    /* Every relocation section should be either an SHT_RELA or an
+       SHT_REL section.  */
+    abort ();
+
   /* orelocation has the data, reloc_count has the count... */
   if (use_rela_p)
     {
@@ -839,6 +877,8 @@
 
 	  if (sym == last_sym)
 	    n = last_sym_idx;
+	  else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+	    n = STN_UNDEF;
 	  else
 	    {
 	      last_sym = sym;
@@ -851,7 +891,8 @@
 	      last_sym_idx = n;
 	    }
 
-	  if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+	  if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+	      && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
 	      && ! _bfd_elf_validate_reloc (abfd, ptr))
 	    {
 	      *failedp = true;
@@ -1185,50 +1226,27 @@
   return -1;
 }
 
-/* Read in and swap the external relocs.  */
+/* Read  relocations for ASECT from REL_HDR.  There are RELOC_COUNT of 
+   them.  */
 
 static boolean
-elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
+elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
+				    relents, symbols, dynamic)
      bfd *abfd;
      asection *asect;
+     Elf_Internal_Shdr *rel_hdr;
+     bfd_size_type reloc_count;
+     arelent *relents;
      asymbol **symbols;
      boolean dynamic;
 {
   struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
-  struct bfd_elf_section_data * const d = elf_section_data (asect);
-  Elf_Internal_Shdr *rel_hdr;
-  bfd_size_type reloc_count;
   PTR allocated = NULL;
   bfd_byte *native_relocs;
-  arelent *relents;
   arelent *relent;
   unsigned int i;
   int entsize;
 
-  if (asect->relocation != NULL)
-    return true;
-
-  if (! dynamic)
-    {
-      if ((asect->flags & SEC_RELOC) == 0
-	  || asect->reloc_count == 0)
-	return true;
-
-      rel_hdr = &d->rel_hdr;
-      reloc_count = asect->reloc_count;
-
-      BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
-		  && reloc_count == rel_hdr->sh_size / rel_hdr->sh_entsize);
-    }
-  else
-    {
-      if (asect->_raw_size == 0)
-	return true;
-
-      rel_hdr = &d->this_hdr;
-      reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
-    }
-
   allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
   if (allocated == NULL)
     goto error_return;
@@ -1240,10 +1258,6 @@
 
   native_relocs = (bfd_byte *) allocated;
 
-  relents = (arelent *) bfd_alloc (abfd, reloc_count * sizeof (arelent));
-  if (relents == NULL)
-    goto error_return;
-
   entsize = rel_hdr->sh_entsize;
   BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
 	      || entsize == sizeof (Elf_External_Rela));
@@ -1298,8 +1312,6 @@
 	(*ebd->elf_info_to_howto_rel) (abfd, relent, &rel);
     }
 
-  asect->relocation = relents;
-
   if (allocated != NULL)
     free (allocated);
 
@@ -1311,6 +1323,82 @@
   return false;
 }
 
+/* Read in and swap the external relocs.  */
+
+static boolean
+elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
+     bfd *abfd;
+     asection *asect;
+     asymbol **symbols;
+     boolean dynamic;
+{
+  struct bfd_elf_section_data * const d = elf_section_data (asect);
+  Elf_Internal_Shdr *rel_hdr;
+  Elf_Internal_Shdr *rel_hdr2;
+  bfd_size_type reloc_count;
+  bfd_size_type reloc_count2;
+  arelent *relents;
+
+  if (asect->relocation != NULL)
+    return true;
+
+  if (! dynamic)
+    {
+      if ((asect->flags & SEC_RELOC) == 0
+	  || asect->reloc_count == 0)
+	return true;
+
+      rel_hdr = &d->rel_hdr;
+      reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
+      rel_hdr2 = d->rel_hdr2;
+      reloc_count2 = (rel_hdr2 
+		      ? (rel_hdr2->sh_size / rel_hdr2->sh_entsize)
+		      : 0);
+
+      BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
+      BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
+		  || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
+
+    }
+  else
+    {
+      /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
+	 case because relocations against this section may use the
+	 dynamic symbol table, and in that case bfd_section_from_shdr
+	 in elf.c does not update the RELOC_COUNT.  */
+      if (asect->_raw_size == 0)
+	return true;
+
+      rel_hdr = &d->this_hdr;
+      reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
+      rel_hdr2 = NULL;
+      reloc_count2 = 0;
+    }
+
+  relents = ((arelent *) 
+	     bfd_alloc (abfd, 
+			(reloc_count + reloc_count2) * sizeof (arelent)));
+  if (relents == NULL)
+    return false;
+
+  if (!elf_slurp_reloc_table_from_section (abfd, asect,
+					   rel_hdr, reloc_count,
+					   relents,
+					   symbols, dynamic))
+    return false;
+  
+  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;
+}
+
 #ifdef DEBUG
 static void
 elf_debug_section (num, hdr)
@@ -1439,7 +1527,8 @@
   sizeof (Elf_External_Sym),
   sizeof (Elf_External_Dyn),
   sizeof (Elf_External_Note),
-
+  ARCH_SIZE / 8,
+  1,
   ARCH_SIZE, FILE_ALIGN,
   ELFCLASS, EV_CURRENT,
   elf_write_out_phdrs,
@@ -1448,5 +1537,10 @@
   elf_swap_symbol_out,
   elf_slurp_reloc_table,
   elf_slurp_symbol_table,
-  elf_swap_dyn_in
+  elf_swap_dyn_in,
+  elf_swap_dyn_out,
+  NULL,
+  NULL,
+  NULL,
+  NULL
 };
diff --git a/bfd/elflink.c b/bfd/elflink.c
index dc0b042..6534d84 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1,5 +1,5 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -100,7 +100,7 @@
   flagword flags, pltflags;
   register asection *s;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  int ptralign;
+  int ptralign = 0;
 
   switch (bed->s->arch_size)
     {
@@ -147,7 +147,8 @@
 	return false;
     }
 
-  s = bfd_make_section (abfd, bed->use_rela_p ? ".rela.plt" : ".rel.plt");
+  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))
@@ -156,18 +157,20 @@
   if (! _bfd_elf_create_got_section (abfd, info))
     return false;
 
-  /* 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;
+  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
+      /* 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
@@ -178,13 +181,16 @@
      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->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;
+      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;
@@ -212,6 +218,32 @@
       boolean copy;
       bfd_size_type indx;
 
+      /* XXX: The ABI draft says the linker must turn hidden and
+	 internal symbols into STB_LOCAL symbols when producing the
+	 DSO. However, if ld.so honors st_other in the dynamic table,
+	 this would not be necessary.  */
+      switch (ELF_ST_VISIBILITY (h->other))
+	{
+	case STV_INTERNAL:
+	case STV_HIDDEN:
+	  /* This symbol must be defined in the shared object or
+	     executable.  */
+	  if (h->root.type == bfd_link_hash_undefined)
+	    {
+	      bfd * abfd = h->root.u.undef.abfd;
+	      const char * name = h->root.root.string;
+	      
+	      (*info->callbacks->undefined_symbol)
+		(info, name, abfd, bfd_und_section_ptr, 0, true);
+	    }
+	  
+	  h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+	  break;
+	  
+	default:
+	  break;
+	}
+
       h->dynindx = elf_hash_table (info)->dynsymcount;
       ++elf_hash_table (info)->dynsymcount;
 
@@ -256,8 +288,84 @@
 
   return true;
 }
+
+/* Return the dynindex of a local dynamic symbol.  */
+
+long
+_bfd_elf_link_lookup_local_dynindx (info, input_bfd, input_indx)
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     long input_indx;
+{
+  struct elf_link_local_dynamic_entry *e;
+
+  for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
+    if (e->input_bfd == input_bfd && e->input_indx == input_indx)
+      return e->dynindx;
+  return -1;
+}
+
+/* This function is used to renumber the dynamic symbols, if some of
+   them are removed because they are marked as local.  This is called
+   via elf_link_hash_traverse.  */
+
+static boolean elf_link_renumber_hash_table_dynsyms
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static boolean
+elf_link_renumber_hash_table_dynsyms (h, data)
+     struct elf_link_hash_entry *h;
+     PTR data;
+{
+  size_t *count = (size_t *) data;
+
+  if (h->dynindx != -1)
+    h->dynindx = ++(*count);
+
+  return true;
+}
+
+/* Assign dynsym indicies.  In a shared library we generate a section
+   symbol for each output section, which come first.  Next come all of
+   the back-end allocated local dynamic syms, followed by the rest of
+   the global symbols.  */
+
+unsigned long
+_bfd_elf_link_renumber_dynsyms (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  unsigned long dynsymcount = 0;
+
+  if (info->shared)
+    {
+      asection *p;
+      for (p = output_bfd->sections; p ; p = p->next)
+	elf_section_data (p)->dynindx = ++dynsymcount;
+    }
+
+  if (elf_hash_table (info)->dynlocal)
+    {
+      struct elf_link_local_dynamic_entry *p;
+      for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
+	p->dynindx = ++dynsymcount;
+    }
+
+  elf_link_hash_traverse (elf_hash_table (info),
+			  elf_link_renumber_hash_table_dynsyms,
+			  &dynsymcount);
+
+  /* There is an unused NULL entry at the head of the table which
+     we must account for in our count.  Unless there weren't any
+     symbols, which means we'll have no table at all.  */
+  if (dynsymcount != 0)
+    ++dynsymcount;
+
+  return elf_hash_table (info)->dynsymcount = dynsymcount;
+}
 
-/* Create a special linker section, or return a pointer to a linker section already created  */
+/* Create a special linker section, or return a pointer to a linker
+   section already created */
 
 elf_linker_section_t *
 _bfd_elf_create_linker_section (abfd, info, which, defaults)
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 32bfab0..bddf290 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -1,5 +1,5 @@
 /* ELF linker support.
-   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -48,10 +48,17 @@
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_link_assign_sym_version
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_renumber_dynsyms
-  PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_collect_hash_codes
   PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean elf_link_read_relocs_from_section 
+  PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
+static void elf_link_output_relocs
+  PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
+static boolean elf_link_size_reloc_section
+  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+static void elf_link_adjust_relocs 
+  PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int, 
+	   struct elf_link_hash_entry **));
 
 /* Given an ELF BFD, add symbols to the global hash table as
    appropriate.  */
@@ -73,6 +80,138 @@
     }
 }
 
+/* Return true iff this is a non-common definition of a symbol.  */
+static boolean
+is_global_symbol_definition (abfd, sym)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     Elf_Internal_Sym * sym;
+{
+  /* Local symbols do not count, but target specific ones might.  */
+  if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
+      && ELF_ST_BIND (sym->st_info) < STB_LOOS)
+    return false;
+
+  /* If the section is undefined, then so is the symbol.  */
+  if (sym->st_shndx == SHN_UNDEF)
+    return false;
+  
+  /* If the symbol is defined in the common section, then
+     it is a common definition and so does not count.  */
+  if (sym->st_shndx == SHN_COMMON)
+    return false;
+
+  /* If the symbol is in a target specific section then we
+     must rely upon the backend to tell us what it is.  */
+  if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS)
+    /* FIXME - this function is not coded yet:
+       
+       return _bfd_is_global_symbol_definition (abfd, sym);
+       
+       Instead for now assume that the definition is not global,
+       Even if this is wrong, at least the linker will behave
+       in the same way that it used to do.  */
+    return false;
+      
+  return true;
+}
+
+
+/* Search the symbol table of the archive element of the archive ABFD
+   whoes archove map contains a mention of SYMDEF, and determine if
+   the symbol is defined in this element.  */
+static boolean
+elf_link_is_defined_archive_symbol (abfd, symdef)
+     bfd * abfd;
+     carsym * symdef;
+{
+  Elf_Internal_Shdr * hdr;
+  Elf_External_Sym *  esym;
+  Elf_External_Sym *  esymend;
+  Elf_External_Sym *  buf = NULL;
+  size_t symcount;
+  size_t extsymcount;
+  size_t extsymoff;
+  boolean result = false;
+  
+  abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
+  if (abfd == (bfd *) NULL)
+    return false;
+
+  if (! bfd_check_format (abfd, bfd_object))
+    return false;
+
+  /* If we have already included the element containing this symbol in the
+     link then we do not need to include it again.  Just claim that any symbol
+     it contains is not a definition, so that our caller will not decide to
+     (re)include this element.  */
+  if (abfd->archive_pass)
+    return false;
+  
+  /* Select the appropriate symbol table.  */
+  if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
+    hdr = &elf_tdata (abfd)->symtab_hdr;
+  else
+    hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+
+  symcount = hdr->sh_size / sizeof (Elf_External_Sym);
+
+  /* The sh_info field of the symtab header tells us where the
+     external symbols start.  We don't care about the local symbols.  */
+  if (elf_bad_symtab (abfd))
+    {
+      extsymcount = symcount;
+      extsymoff = 0;
+    }
+  else
+    {
+      extsymcount = symcount - hdr->sh_info;
+      extsymoff = hdr->sh_info;
+    }
+
+  buf = ((Elf_External_Sym *)
+	 bfd_malloc (extsymcount * sizeof (Elf_External_Sym)));
+  if (buf == NULL && extsymcount != 0)
+    return false;
+
+  /* Read in the symbol table.
+     FIXME:  This ought to be cached somewhere.  */
+  if (bfd_seek (abfd,
+		hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym),
+		SEEK_SET) != 0
+      || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd)
+	  != extsymcount * sizeof (Elf_External_Sym)))
+    {
+      free (buf);
+      return false;
+    }
+
+  /* Scan the symbol table looking for SYMDEF.  */
+  esymend = buf + extsymcount;
+  for (esym = buf;
+       esym < esymend;
+       esym++)
+    {
+      Elf_Internal_Sym sym;
+      const char * name;
+
+      elf_swap_symbol_in (abfd, esym, & sym);
+
+      name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name);
+      if (name == (const char *) NULL)
+	break;
+
+      if (strcmp (name, symdef->name) == 0)
+	{
+	  result = is_global_symbol_definition (abfd, & sym);
+	  break;
+	}
+    }
+
+  free (buf);
+  
+  return result;
+}
+
 
 /* Add symbols from an ELF archive file to the linker hash table.  We
    don't use _bfd_generic_link_add_archive_symbols because of a
@@ -193,7 +332,24 @@
 	  if (h == NULL)
 	    continue;
 
-	  if (h->root.type != bfd_link_hash_undefined)
+	  if (h->root.type == bfd_link_hash_common)
+	    {
+	      /* We currently have a common symbol.  The archive map contains
+		 a reference to this symbol, so we may want to include it.  We
+		 only want to include it however, if this archive element
+		 contains a definition of the symbol, not just another common
+		 declaration of it.
+
+		 Unfortunately some archivers (including GNU ar) will put
+		 declarations of common symbols into their archive maps, as
+		 well as real definitions, so we cannot just go by the archive
+		 map alone.  Instead we must read in the element's symbol
+		 table and check that to see what kind of symbol definition
+		 this is.  */
+	      if (! elf_link_is_defined_archive_symbol (abfd, symdef))
+		continue;
+	    }
+	  else if (h->root.type != bfd_link_hash_undefined)
 	    {
 	      if (h->root.type != bfd_link_hash_undefweak)
 		defined[i] = true;
@@ -358,6 +514,17 @@
       break;
     }
 
+  /* In cases involving weak versioned symbols, we may wind up trying
+     to merge a symbol with itself.  Catch that here, to avoid the
+     confusion that results if we try to override a symbol with
+     itself.  The additional tests catch cases like
+     _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
+     dynamic object, which we do want to handle here.  */
+  if (abfd == oldbfd
+      && ((abfd->flags & DYNAMIC) == 0
+	  || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
+    return true;
+
   /* NEWDYN and OLDDYN indicate whether the new or old symbol,
      respectively, is from a dynamic object.  */
 
@@ -366,10 +533,35 @@
   else
     newdyn = false;
 
-  if (oldbfd == NULL || (oldbfd->flags & DYNAMIC) == 0)
-    olddyn = false;
+  if (oldbfd != NULL)
+    olddyn = (oldbfd->flags & DYNAMIC) != 0;
   else
-    olddyn = true;
+    {
+      asection *hsec;
+
+      /* This code handles the special SHN_MIPS_{TEXT,DATA} section
+         indices used by MIPS ELF.  */
+      switch (h->root.type)
+	{
+	default:
+	  hsec = NULL;
+	  break;
+
+	case bfd_link_hash_defined:
+	case bfd_link_hash_defweak:
+	  hsec = h->root.u.def.section;
+	  break;
+
+	case bfd_link_hash_common:
+	  hsec = h->root.u.c.p->section;
+	  break;
+	}
+
+      if (hsec == NULL)
+	olddyn = false;
+      else
+	olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0;
+    }
 
   /* NEWDEF and OLDDEF indicate whether the new or old symbol,
      respectively, appear to be a definition rather than reference.  */
@@ -484,14 +676,19 @@
      represent variables; this can cause confusion in principle, but
      any such confusion would seem to indicate an erroneous program or
      shared library.  We also permit a common symbol in a regular
-     object to override a weak symbol in a shared object.  */
+     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.  */
 
   if (newdyn
       && newdef
       && (olddef
 	  || (h->root.type == bfd_link_hash_common
 	      && (bind == STB_WEAK
-		  || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
+		  || ELF_ST_TYPE (sym->st_info) == STT_FUNC)))
+      && (h->root.type != bfd_link_hash_defweak
+	  || bind == STB_WEAK))
     {
       *override = true;
       newdef = false;
@@ -535,7 +732,10 @@
 
      As above, we again permit a common symbol in a regular object to
      override a definition in a shared object if the shared object
-     symbol is a function or is weak.  */
+     symbol is a function or is weak.
+
+     As above, we permit a non-weak definition in a shared object to
+     override a weak definition in a regular object.  */
 
   if (! newdyn
       && (newdef
@@ -544,7 +744,9 @@
 		  || h->type == STT_FUNC)))
       && olddyn
       && olddef
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+      && (bind != STB_WEAK
+	  || h->root.type == bfd_link_hash_defweak))
     {
       /* Change the hash table entry to undefined, and let
 	 _bfd_generic_link_add_one_symbol do the right thing with the
@@ -618,6 +820,45 @@
       h->verinfo.vertree = NULL;
     }
 
+  /* 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.  */
+  if (olddef
+      && h->root.type == bfd_link_hash_defweak
+      && newdef
+      && newdyn
+      && bind != STB_WEAK)
+    {
+      /* To make this work we have to frob the flags so that the rest
+         of the code does not think we are using the regular
+         definition.  */
+      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+	h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
+      else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+	h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+      h->elf_link_hash_flags &= ~ (ELF_LINK_HASH_DEF_REGULAR
+				   | ELF_LINK_HASH_DEF_DYNAMIC);
+
+      /* If H is the target of an indirection, we want the caller to
+         use H rather than the indirect symbol.  Otherwise if we are
+         defining a new indirect symbol we will wind up attaching it
+         to the entry we are overriding.  */
+      *sym_hash = h;
+    }
+
+  /* Handle the special case of a non-weak definition in a shared
+     object followed by a weak definition in a regular object.  In
+     this case we prefer to definition in the shared object.  To make
+     this work we have to tell the caller to not treat the new symbol
+     as a definition.  */
+  if (olddef
+      && olddyn
+      && h->root.type != bfd_link_hash_defweak
+      && newdef
+      && ! newdyn
+      && bind == STB_WEAK)
+    *override = true;
+
   return true;
 }
 
@@ -649,9 +890,11 @@
   struct elf_link_hash_entry *weaks;
   Elf_External_Sym *esym;
   Elf_External_Sym *esymend;
+  struct elf_backend_data *bed;
 
-  add_symbol_hook = get_elf_backend_data (abfd)->elf_add_symbol_hook;
-  collect = get_elf_backend_data (abfd)->collect;
+  bed = get_elf_backend_data (abfd);
+  add_symbol_hook = bed->elf_add_symbol_hook;
+  collect = bed->collect;
 
   if ((abfd->flags & DYNAMIC) == 0)
     dynamic = false;
@@ -866,6 +1109,23 @@
 	    goto error_return;
 	  link = elf_elfsections (abfd)[elfsec]->sh_link;
 
+	  {
+	    /* The shared libraries distributed with hpux11 have a bogus
+	       sh_link field for the ".dynamic" section.  This code detects
+	       when LINK refers to a section that is not a string table and
+	       tries to find the string table for the ".dynsym" section
+	       instead.  */
+	    Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[link];
+	    if (hdr->sh_type != SHT_STRTAB)
+	      {
+		asection *s = bfd_get_section_by_name (abfd, ".dynsym");
+		int elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
+		if (elfsec == -1)
+		  goto error_return;
+		link = elf_elfsections (abfd)[elfsec]->sh_link;
+	      }
+	  }
+
 	  extdyn = dynbuf;
 	  extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn);
 	  for (; extdyn < extdynend; extdyn++)
@@ -1184,7 +1444,11 @@
 		  strcpy (newname, name);
 		  p = newname + namelen;
 		  *p++ = ELF_VER_CHR;
-		  if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
+		  /* If this is a defined non-hidden version symbol,
+		     we add another @ to the name.  This indicates the
+		     default version of the symbol.  */
+		  if ((iver.vs_vers & VERSYM_HIDDEN) == 0
+		      && sym.st_shndx != SHN_UNDEF)
 		    *p++ = ELF_VER_CHR;
 		  strcpy (p, verstr);
 
@@ -1308,9 +1572,24 @@
 	      h->type = ELF_ST_TYPE (sym.st_info);
 	    }
 
-	  if (sym.st_other != 0
-	      && (definition || h->other == 0))
-	    h->other = sym.st_other;
+	  /* If st_other has a processor-specific meaning, specific code
+	     might be needed here.  */
+	  if (sym.st_other != 0)
+	    {
+	      /* Combine visibilities, using the most constraining one.  */
+	      unsigned char hvis   = ELF_ST_VISIBILITY (h->other);
+	      unsigned char symvis = ELF_ST_VISIBILITY (sym.st_other);
+	      
+	      if (symvis && (hvis > symvis || hvis == 0))
+		h->other = sym.st_other;
+	      
+	      /* If neither has visibility, use the st_other of the
+	         definition.  This is an arbitrary choice, since the
+	         other bits have no general meaning.  */
+	      if (!symvis && !hvis
+		  && (definition || h->other == 0))
+		h->other = sym.st_other;
+	    }
 
 	  /* Set a flag in the hash table entry indicating the type of
 	     reference or definition we just found.  Keep a count of
@@ -1461,44 +1740,7 @@
 				  == 0);
 
 		      ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
-
-		      /* Copy down any references that we may have
-			 already seen to the symbol which just became
-			 indirect.  */
-		      ht->elf_link_hash_flags |=
-			(hi->elf_link_hash_flags
-			 & (ELF_LINK_HASH_REF_DYNAMIC
-			    | ELF_LINK_HASH_REF_REGULAR
-			    | ELF_LINK_HASH_REF_REGULAR_NONWEAK));
-
-		      /* Copy over the global and procedure linkage table
-			 offset entries.  These may have been already set
-			 up by a check_relocs routine.  */
-		      if (ht->got.offset == (bfd_vma) -1)
-			{
-			  ht->got.offset = hi->got.offset;
-			  hi->got.offset = (bfd_vma) -1;
-			}
-		      BFD_ASSERT (hi->got.offset == (bfd_vma) -1);
-
-		      if (ht->plt.offset == (bfd_vma) -1)
-			{
-			  ht->plt.offset = hi->plt.offset;
-			  hi->plt.offset = (bfd_vma) -1;
-			}
-		      BFD_ASSERT (hi->plt.offset == (bfd_vma) -1);
-
-		      if (ht->dynindx == -1)
-			{
-			  ht->dynindx = hi->dynindx;
-			  ht->dynstr_index = hi->dynstr_index;
-			  hi->dynindx = -1;
-			  hi->dynstr_index = 0;
-			}
-		      BFD_ASSERT (hi->dynindx == -1);
-
-		      /* FIXME: There may be other information to copy
-			 over for particular targets.  */
+		      (*bed->elf_backend_copy_indirect_symbol) (ht, hi);
 
 		      /* See if the new flags lead us to realize that
 			 the symbol must be dynamic.  */
@@ -1571,43 +1813,7 @@
 					  | ELF_LINK_HASH_DEF_REGULAR))
 				      == 0);
 
-			  /* Copy down any references that we may have
-                             already seen to the symbol which just
-                             became indirect.  */
-			  h->elf_link_hash_flags |=
-			    (hi->elf_link_hash_flags
-			     & (ELF_LINK_HASH_REF_DYNAMIC
-				| ELF_LINK_HASH_REF_REGULAR
-				| ELF_LINK_HASH_REF_REGULAR_NONWEAK));
-
-			  /* Copy over the global and procedure linkage
-                             table offset entries.  These may have been
-                             already set up by a check_relocs routine.  */
-			  if (h->got.offset == (bfd_vma) -1)
-			    {
-			      h->got.offset = hi->got.offset;
-			      hi->got.offset = (bfd_vma) -1;
-			    }
-			  BFD_ASSERT (hi->got.offset == (bfd_vma) -1);
-
-			  if (h->plt.offset == (bfd_vma) -1)
-			    {
-			      h->plt.offset = hi->plt.offset;
-			      hi->plt.offset = (bfd_vma) -1;
-			    }
-			  BFD_ASSERT (hi->got.offset == (bfd_vma) -1);
-
-			  if (h->dynindx == -1)
-			    {
-			      h->dynindx = hi->dynindx;
-			      h->dynstr_index = hi->dynstr_index;
-			      hi->dynindx = -1;
-			      hi->dynstr_index = 0;
-			    }
-			  BFD_ASSERT (hi->dynindx == -1);
-
-			  /* FIXME: There may be other information to
-                             copy over for particular targets.  */
+		          (*bed->elf_backend_copy_indirect_symbol) (h, hi);
 
 			  /* See if the new flags lead us to realize
                              that the symbol must be dynamic.  */
@@ -1937,16 +2143,18 @@
       && ! _bfd_elf_link_record_dynamic_symbol (info, h))
     return false;
 
+  bed = get_elf_backend_data (abfd);
+
   s = bfd_make_section (abfd, ".hash");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
     return false;
+  elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
 
   /* Let the backend create the rest of the sections.  This lets the
      backend set the right flags.  The backend will normally create
      the .got and .plt sections.  */
-  bed = get_elf_backend_data (abfd);
   if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
     return false;
 
@@ -1989,14 +2197,174 @@
 
   return true;
 }
+
+/* Record a new local dynamic symbol.  */
+
+boolean
+elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     long input_indx;
+{
+  struct elf_link_local_dynamic_entry *entry;
+  struct elf_link_hash_table *eht;
+  struct bfd_strtab_hash *dynstr;
+  Elf_External_Sym esym;
+  unsigned long dynstr_index;
+  char *name;
+
+  /* See if the entry exists already.  */
+  for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
+    if (entry->input_bfd == input_bfd && entry->input_indx == input_indx)
+      return true;
+
+  entry = (struct elf_link_local_dynamic_entry *)
+    bfd_alloc (input_bfd, sizeof (*entry));
+  if (entry == NULL)
+    return false;
+
+  /* Go find the symbol, so that we can find it's name.  */
+  if (bfd_seek (input_bfd,
+		(elf_tdata (input_bfd)->symtab_hdr.sh_offset
+		 + input_indx * sizeof (Elf_External_Sym)),
+		SEEK_SET) != 0
+      || (bfd_read (&esym, sizeof (Elf_External_Sym), 1, input_bfd)
+	  != sizeof (Elf_External_Sym)))
+    return false;
+  elf_swap_symbol_in (input_bfd, &esym, &entry->isym);
+
+  name = (bfd_elf_string_from_elf_section
+	  (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
+	   entry->isym.st_name));
+
+  dynstr = elf_hash_table (info)->dynstr;
+  if (dynstr == NULL)
+    {
+      /* Create a strtab to hold the dynamic symbol names.  */
+      elf_hash_table (info)->dynstr = dynstr = _bfd_elf_stringtab_init ();
+      if (dynstr == NULL)
+	return false;
+    }
+
+  dynstr_index = _bfd_stringtab_add (dynstr, name, true, false);
+  if (dynstr_index == (unsigned long) -1)
+    return false;
+  entry->isym.st_name = dynstr_index;
+
+  eht = elf_hash_table (info);
+
+  entry->next = eht->dynlocal;
+  eht->dynlocal = entry;
+  entry->input_bfd = input_bfd;
+  entry->input_indx = input_indx;
+  eht->dynsymcount++;
+
+  /* Whatever binding the symbol had before, it's now local.  */
+  entry->isym.st_info
+    = ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info));
+
+  /* The dynindx will be set at the end of size_dynamic_sections.  */
+
+  return true;
+}
 
 
-/* Read and swap the relocs for a section.  They may have been cached.
-   If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are not NULL,
-   they are used as buffers to read into.  They are known to be large
-   enough.  If the INTERNAL_RELOCS relocs argument is NULL, the return
-   value is allocated using either malloc or bfd_alloc, according to
-   the KEEP_MEMORY argument.  */
+/* Read and swap the relocs from the section indicated by SHDR.  This
+   may be either a REL or a RELA section.  The relocations are
+   translated into RELA relocations and stored in INTERNAL_RELOCS,
+   which should have already been allocated to contain enough space.
+   The EXTERNAL_RELOCS are a buffer where the external form of the
+   relocations should be stored.
+
+   Returns false if something goes wrong.  */
+
+static boolean
+elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
+				   internal_relocs)
+     bfd *abfd;
+     Elf_Internal_Shdr *shdr;
+     PTR external_relocs;
+     Elf_Internal_Rela *internal_relocs;
+{
+  struct elf_backend_data *bed;
+
+  /* If there aren't any relocations, that's OK.  */
+  if (!shdr)
+    return true;
+
+  /* Position ourselves at the start of the section.  */
+  if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
+    return false;
+
+  /* Read the relocations.  */
+  if (bfd_read (external_relocs, 1, shdr->sh_size, abfd)
+      != shdr->sh_size)
+    return false;
+
+  bed = get_elf_backend_data (abfd);
+
+  /* Convert the external relocations to the internal format.  */
+  if (shdr->sh_entsize == sizeof (Elf_External_Rel))
+    {
+      Elf_External_Rel *erel;
+      Elf_External_Rel *erelend;
+      Elf_Internal_Rela *irela;
+      Elf_Internal_Rel *irel;
+
+      erel = (Elf_External_Rel *) external_relocs;
+      erelend = erel + shdr->sh_size / shdr->sh_entsize;
+      irela = internal_relocs;
+      irel = bfd_alloc (abfd, (bed->s->int_rels_per_ext_rel
+			       * sizeof (Elf_Internal_Rel)));
+      for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel)
+	{
+	  unsigned char i;
+
+	  if (bed->s->swap_reloc_in)
+	    (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
+	  else
+	    elf_swap_reloc_in (abfd, erel, irel);
+
+	  for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i)
+	    {
+	      irela[i].r_offset = irel[i].r_offset;
+	      irela[i].r_info = irel[i].r_info;
+	      irela[i].r_addend = 0;
+	    }
+	}
+    }
+  else
+    {
+      Elf_External_Rela *erela;
+      Elf_External_Rela *erelaend;
+      Elf_Internal_Rela *irela;
+
+      BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela));
+
+      erela = (Elf_External_Rela *) external_relocs;
+      erelaend = erela + shdr->sh_size / shdr->sh_entsize;
+      irela = internal_relocs;
+      for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel)
+	{
+	  if (bed->s->swap_reloca_in)
+	    (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
+	  else
+	    elf_swap_reloca_in (abfd, erela, irela);
+	}
+    }
+
+  return true;
+}
+
+/* Read and swap the relocs for a section O.  They may have been
+   cached.  If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are
+   not NULL, they are used as buffers to read into.  They are known to
+   be large enough.  If the INTERNAL_RELOCS relocs argument is NULL,
+   the return value is allocated using either malloc or bfd_alloc,
+   according to the KEEP_MEMORY argument.  If O has two relocation
+   sections (both REL and RELA relocations), then the REL_HDR
+   relocations will appear first in INTERNAL_RELOCS, followed by the
+   REL_HDR2 relocations.  */
 
 Elf_Internal_Rela *
 NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
@@ -2010,6 +2378,7 @@
   Elf_Internal_Shdr *rel_hdr;
   PTR alloc1 = NULL;
   Elf_Internal_Rela *alloc2 = NULL;
+  struct elf_backend_data *bed = get_elf_backend_data (abfd);
 
   if (elf_section_data (o)->relocs != NULL)
     return elf_section_data (o)->relocs;
@@ -2023,7 +2392,8 @@
     {
       size_t size;
 
-      size = o->reloc_count * sizeof (Elf_Internal_Rela);
+      size = (o->reloc_count * bed->s->int_rels_per_ext_rel 
+	      * sizeof (Elf_Internal_Rela));
       if (keep_memory)
 	internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
       else
@@ -2034,53 +2404,27 @@
 
   if (external_relocs == NULL)
     {
-      alloc1 = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
+      size_t size = (size_t) rel_hdr->sh_size;
+
+      if (elf_section_data (o)->rel_hdr2)
+	size += (size_t) elf_section_data (o)->rel_hdr2->sh_size;
+      alloc1 = (PTR) bfd_malloc (size);
       if (alloc1 == NULL)
 	goto error_return;
       external_relocs = alloc1;
     }
 
-  if ((bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0)
-      || (bfd_read (external_relocs, 1, rel_hdr->sh_size, abfd)
-	  != rel_hdr->sh_size))
+  if (!elf_link_read_relocs_from_section (abfd, rel_hdr,
+					  external_relocs,
+					  internal_relocs))
     goto error_return;
-
-  /* Swap in the relocs.  For convenience, we always produce an
-     Elf_Internal_Rela array; if the relocs are Rel, we set the addend
-     to 0.  */
-  if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
-    {
-      Elf_External_Rel *erel;
-      Elf_External_Rel *erelend;
-      Elf_Internal_Rela *irela;
-
-      erel = (Elf_External_Rel *) external_relocs;
-      erelend = erel + o->reloc_count;
-      irela = internal_relocs;
-      for (; erel < erelend; erel++, irela++)
-	{
-	  Elf_Internal_Rel irel;
-
-	  elf_swap_reloc_in (abfd, erel, &irel);
-	  irela->r_offset = irel.r_offset;
-	  irela->r_info = irel.r_info;
-	  irela->r_addend = 0;
-	}
-    }
-  else
-    {
-      Elf_External_Rela *erela;
-      Elf_External_Rela *erelaend;
-      Elf_Internal_Rela *irela;
-
-      BFD_ASSERT (rel_hdr->sh_entsize == sizeof (Elf_External_Rela));
-
-      erela = (Elf_External_Rela *) external_relocs;
-      erelaend = erela + o->reloc_count;
-      irela = internal_relocs;
-      for (; erela < erelaend; erela++, irela++)
-	elf_swap_reloca_in (abfd, erela, irela);
-    }
+  if (!elf_link_read_relocs_from_section 
+      (abfd, 
+       elf_section_data (o)->rel_hdr2,
+       ((bfd_byte *) external_relocs) + rel_hdr->sh_size,
+       internal_relocs + (rel_hdr->sh_size / rel_hdr->sh_entsize
+			  * bed->s->int_rels_per_ext_rel)))
+    goto error_return;
 
   /* Cache the results for next time, if we can.  */
   if (keep_memory)
@@ -2109,7 +2453,7 @@
 /*ARGSUSED*/
 boolean
 NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      const char *name;
      boolean provide;
@@ -2145,7 +2489,10 @@
     h->verinfo.verdef = NULL;
 
   h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-  h->type = STT_OBJECT;
+
+  /* When possible, keep the original type of the symbol */
+  if (h->type == STT_NOTYPE)
+    h->type = STT_OBJECT;
 
   if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
 				  | ELF_LINK_HASH_REF_DYNAMIC)) != 0
@@ -2182,8 +2529,6 @@
   struct bfd_elf_version_tree *verdefs;
   /* Whether we are exporting all dynamic symbols.  */
   boolean export_dynamic;
-  /* Whether we removed any symbols from the dynamic symbol table.  */
-  boolean removed_dynamic;
   /* Whether we had a failure.  */
   boolean failed;
 };
@@ -2228,7 +2573,7 @@
      struct bfd_link_info *info;
 {
   size_t dynsymcount = elf_hash_table (info)->dynsymcount;
-  size_t best_size;
+  size_t best_size = 0;
   unsigned long int *hashcodes;
   unsigned long int *hashcodesp;
   unsigned long int i;
@@ -2381,7 +2726,6 @@
   bfd_size_type soname_indx;
   bfd *dynobj;
   struct elf_backend_data *bed;
-  bfd_size_type old_dynsymcount;
   struct elf_assign_sym_version_info asvinfo;
 
   *sinterpptr = NULL;
@@ -2405,20 +2749,6 @@
   if (dynobj == NULL)
     return true;
 
-  /* If we are supposed to export all symbols into the dynamic symbol
-     table (this is not the normal case), then do so.  */
-  if (export_dynamic)
-    {
-      struct elf_info_failed eif;
-
-      eif.failed = false;
-      eif.info = info;
-      elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
-			      (PTR) &eif);
-      if (eif.failed)
-	return false;
-    }
-
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       struct elf_info_failed eif;
@@ -2481,12 +2811,25 @@
 	    }
 	}
 
+      /* If we are supposed to export all symbols into the dynamic symbol
+         table (this is not the normal case), then do so.  */
+      if (export_dynamic)
+	{
+	  struct elf_info_failed eif;
+
+	  eif.failed = false;
+	  eif.info = info;
+	  elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
+			          (PTR) &eif);
+	  if (eif.failed)
+	    return false;
+	}
+
       /* Attach all the symbols to their version information.  */
       asvinfo.output_bfd = output_bfd;
       asvinfo.info = info;
       asvinfo.verdefs = verdefs;
       asvinfo.export_dynamic = export_dynamic;
-      asvinfo.removed_dynamic = false;
       asvinfo.failed = false;
 
       elf_link_hash_traverse (elf_hash_table (info),
@@ -2508,8 +2851,14 @@
       /* Add some entries to the .dynamic section.  We fill in some of the
 	 values later, in elf_bfd_final_link, but we must add the entries
 	 now so that we know the final size of the .dynamic section.  */
-      h =  elf_link_hash_lookup (elf_hash_table (info), "_init", false,
-				false, false);
+
+      /* If there are initialization and/or finalization functions to
+	 call then add the corresponding DT_INIT/DT_FINI entries.  */
+      h = (info->init_function
+	   ? elf_link_hash_lookup (elf_hash_table (info), 
+				   info->init_function, false,
+				   false, false)
+	   : NULL);
       if (h != NULL
 	  && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
 					| ELF_LINK_HASH_DEF_REGULAR)) != 0)
@@ -2517,8 +2866,11 @@
 	  if (! elf_add_dynamic_entry (info, DT_INIT, 0))
 	    return false;
 	}
-      h =  elf_link_hash_lookup (elf_hash_table (info), "_fini", false,
-				 false, false);
+      h = (info->fini_function
+	   ? elf_link_hash_lookup (elf_hash_table (info), 
+				   info->fini_function, false,
+				   false, false)
+	   : NULL);
       if (h != NULL
 	  && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
 					| ELF_LINK_HASH_DEF_REGULAR)) != 0)
@@ -2526,6 +2878,7 @@
 	  if (! elf_add_dynamic_entry (info, DT_FINI, 0))
 	    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)
@@ -2538,7 +2891,6 @@
 
   /* The backend must work out the sizes of all the other dynamic
      sections.  */
-  old_dynsymcount = elf_hash_table (info)->dynsymcount;
   if (bed->elf_backend_size_dynamic_sections
       && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
     return false;
@@ -2549,6 +2901,7 @@
       asection *s;
       size_t bucketcount = 0;
       Elf_Internal_Sym isym;
+      size_t hash_entry_size;
 
       /* Set up the version definition section.  */
       s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
@@ -2559,17 +2912,7 @@
       verdefs = asvinfo.verdefs;
 
       if (verdefs == NULL)
-	{
-	  asection **spp;
-
-	  /* Don't include this section in the output file.  */
-	  for (spp = &output_bfd->sections;
-	       *spp != s->output_section;
-	       spp = &(*spp)->next)
-	    ;
-	  *spp = s->output_section->next;
-	  --output_bfd->section_count;
-	}
+	_bfd_strip_section_from_output (info, s);
       else
 	{
 	  unsigned int cdefs;
@@ -2579,23 +2922,6 @@
 	  Elf_Internal_Verdef def;
 	  Elf_Internal_Verdaux defaux;
 
-	  if (asvinfo.removed_dynamic)
-	    {
-	      /* Some dynamic symbols were changed to be local
-		 symbols.  In this case, we renumber all of the
-		 dynamic symbols, so that we don't have a hole.  If
-		 the backend changed dynsymcount, then assume that the
-		 new symbols are at the start.  This is the case on
-		 the MIPS.  FIXME: The names of the removed symbols
-		 will still be in the dynamic string table, wasting
-		 space.  */
-	      elf_hash_table (info)->dynsymcount =
-		1 + (elf_hash_table (info)->dynsymcount - old_dynsymcount);
-	      elf_link_hash_traverse (elf_hash_table (info),
-				      elf_link_renumber_dynsyms,
-				      (PTR) info);
-	    }
-
 	  cdefs = 0;
 	  size = 0;
 
@@ -2635,7 +2961,7 @@
 
 	  if (soname_indx != (bfd_size_type) -1)
 	    {
-	      def.vd_hash = bfd_elf_hash ((const unsigned char *) soname);
+	      def.vd_hash = bfd_elf_hash (soname);
 	      defaux.vda_name = soname_indx;
 	    }
 	  else
@@ -2644,7 +2970,7 @@
 	      bfd_size_type indx;
 
 	      name = output_bfd->filename;
-	      def.vd_hash = bfd_elf_hash ((const unsigned char *) name);
+	      def.vd_hash = bfd_elf_hash (name);
 	      indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
 					    name, true, false);
 	      if (indx == (bfd_size_type) -1)
@@ -2692,7 +3018,7 @@
 		def.vd_flags |= VER_FLG_WEAK;
 	      def.vd_ndx = t->vernum + 1;
 	      def.vd_cnt = cdeps + 1;
-	      def.vd_hash = bfd_elf_hash ((const unsigned char *) t->name);
+	      def.vd_hash = bfd_elf_hash (t->name);
 	      def.vd_aux = sizeof (Elf_External_Verdef);
 	      if (t->next != NULL)
 		def.vd_next = (sizeof (Elf_External_Verdef)
@@ -2762,19 +3088,7 @@
 				(PTR) &sinfo);
 
 	if (elf_tdata (output_bfd)->verref == NULL)
-	  {
-	    asection **spp;
-
-	    /* We don't have any version definitions, so we can just
-               remove the section.  */
-
-	    for (spp = &output_bfd->sections;
-		 *spp != s->output_section;
-		 spp = &(*spp)->next)
-	      ;
-	    *spp = s->output_section->next;
-	    --output_bfd->section_count;
-	  }
+	  _bfd_strip_section_from_output (info, s);
 	else
 	  {
 	    Elf_Internal_Verneed *t;
@@ -2840,8 +3154,7 @@
 
 		for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
 		  {
-		    a->vna_hash = bfd_elf_hash ((const unsigned char *)
-						a->vna_nodename);
+		    a->vna_hash = bfd_elf_hash (a->vna_nodename);
 		    indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
 					       a->vna_nodename, true, false);
 		    if (indx == (bfd_size_type) -1)
@@ -2866,7 +3179,12 @@
 	  }
       }
 
-      dynsymcount = elf_hash_table (info)->dynsymcount;
+      /* Assign dynsym indicies.  In a shared library we generate a 
+	 section symbol for each output section, which come first.
+	 Next come all of the back-end allocated local dynamic syms,
+	 followed by the rest of the global symbols.  */
+
+      dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
 
       /* Work out the size of the symbol version section.  */
       s = bfd_get_section_by_name (dynobj, ".gnu.version");
@@ -2874,16 +3192,10 @@
       if (dynsymcount == 0
 	  || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL))
 	{
-	  asection **spp;
-
-	  /* We don't need any symbol versions; just discard the
-             section.  */
-	  for (spp = &output_bfd->sections;
-	       *spp != s->output_section;
-	       spp = &(*spp)->next)
-	    ;
-	  *spp = s->output_section->next;
-	  --output_bfd->section_count;
+	  _bfd_strip_section_from_output (info, s);
+	  /* The DYNSYMCOUNT might have changed if we were going to
+	     output a dynamic symbol table entry for S.  */
+	  dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
 	}
       else
 	{
@@ -2925,14 +3237,16 @@
 
       s = bfd_get_section_by_name (dynobj, ".hash");
       BFD_ASSERT (s != NULL);
-      s->_raw_size = (2 + bucketcount + dynsymcount) * (ARCH_SIZE / 8);
+      hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
+      s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
       s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
       if (s->contents == NULL)
 	return false;
       memset (s->contents, 0, (size_t) s->_raw_size);
 
-      put_word (output_bfd, bucketcount, s->contents);
-      put_word (output_bfd, dynsymcount, s->contents + (ARCH_SIZE / 8));
+      bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
+      bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, 
+	       s->contents + hash_entry_size);
 
       elf_hash_table (info)->bucketcount = bucketcount;
 
@@ -3035,6 +3349,33 @@
       h->plt.offset = (bfd_vma) -1;
     }
 
+  /* If this is a weak defined symbol in a dynamic object, and we know
+     the real definition in the dynamic object, copy interesting flags
+     over to the real definition.  */
+  if (h->weakdef != NULL)
+    {
+      struct elf_link_hash_entry *weakdef;
+
+      BFD_ASSERT (h->root.type == bfd_link_hash_defined
+		  || h->root.type == bfd_link_hash_defweak);
+      weakdef = h->weakdef;
+      BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
+		  || weakdef->root.type == bfd_link_hash_defweak);
+      BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
+
+      /* If the real definition is defined by a regular object file,
+	 don't do anything special.  See the longer description in
+	 elf_adjust_dynamic_symbol, below.  */
+      if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+	h->weakdef = NULL;
+      else
+	weakdef->elf_link_hash_flags |=
+	  (h->elf_link_hash_flags
+	   & (ELF_LINK_HASH_REF_REGULAR
+	      | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+	      | ELF_LINK_NON_GOT_REF));
+    }
+
   return true;
 }
 
@@ -3117,32 +3458,14 @@
 
   if (h->weakdef != NULL)
     {
-      struct elf_link_hash_entry *weakdef;
+      /* If we get to this point, we know there is an implicit
+	 reference by a regular object file via the weak symbol H.
+	 FIXME: Is this really true?  What if the traversal finds
+	 H->WEAKDEF before it finds H?  */
+      h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
 
-      BFD_ASSERT (h->root.type == bfd_link_hash_defined
-		  || h->root.type == bfd_link_hash_defweak);
-      weakdef = h->weakdef;
-      BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
-		  || weakdef->root.type == bfd_link_hash_defweak);
-      BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
-      if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
-	{
-	  /* This symbol is defined by a regular object file, so we
-	     will not do anything special.  Clear weakdef for the
-	     convenience of the processor backend.  */
-	  h->weakdef = NULL;
-	}
-      else
-	{
-	  /* There is an implicit reference by a regular object file
-	     via the weak symbol.  */
-	  weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
-	  if (h->weakdef->elf_link_hash_flags
-	      & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
-	    weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR_NONWEAK;
-	  if (! elf_adjust_dynamic_symbol (weakdef, (PTR) eif))
-	    return false;
-	}
+      if (! elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif))
+	return false;
     }
 
   /* If a symbol has no type and no size and does not require a PLT
@@ -3281,6 +3604,7 @@
   struct elf_assign_sym_version_info *sinfo =
     (struct elf_assign_sym_version_info *) data;
   struct bfd_link_info *info = sinfo->info;
+  struct elf_backend_data *bed;
   struct elf_info_failed eif;
   char *p;
 
@@ -3299,6 +3623,7 @@
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
     return true;
 
+  bed = get_elf_backend_data (sinfo->output_bfd);
   p = strchr (h->root.root.string, ELF_VER_CHR);
   if (p != NULL && h->verinfo.vertree == NULL)
     {
@@ -3365,12 +3690,8 @@
 			      && info->shared
 			      && ! sinfo->export_dynamic)
 			    {
-			      sinfo->removed_dynamic = true;
 			      h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-			      h->elf_link_hash_flags &=~
-				ELF_LINK_HASH_NEEDS_PLT;
-			      h->dynindx = -1;
-			      h->plt.offset = (bfd_vma) -1;
+			      (*bed->elf_backend_hide_symbol) (h);
 			      /* FIXME: The name of the symbol has
 				 already been recorded in the dynamic
 				 string table section.  */
@@ -3481,11 +3802,8 @@
 			  && info->shared
 			  && ! sinfo->export_dynamic)
 			{
-			  sinfo->removed_dynamic = true;
 			  h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-			  h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
-			  h->dynindx = -1;
-			  h->plt.offset = (bfd_vma) -1;
+			  (*bed->elf_backend_hide_symbol) (h);
 			  /* FIXME: The name of the symbol has already
 			     been recorded in the dynamic string table
 			     section.  */
@@ -3506,11 +3824,8 @@
 	      && info->shared
 	      && ! sinfo->export_dynamic)
 	    {
-	      sinfo->removed_dynamic = true;
 	      h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-	      h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
-	      h->dynindx = -1;
-	      h->plt.offset = (bfd_vma) -1;
+	      (*bed->elf_backend_hide_symbol) (h);
 	      /* FIXME: The name of the symbol has already been
 		 recorded in the dynamic string table section.  */
 	    }
@@ -3519,26 +3834,6 @@
 
   return true;
 }
-
-/* This function is used to renumber the dynamic symbols, if some of
-   them are removed because they are marked as local.  This is called
-   via elf_link_hash_traverse.  */
-
-static boolean
-elf_link_renumber_dynsyms (h, data)
-     struct elf_link_hash_entry *h;
-     PTR data;
-{
-  struct bfd_link_info *info = (struct bfd_link_info *) data;
-
-  if (h->dynindx != -1)
-    {
-      h->dynindx = elf_hash_table (info)->dynsymcount;
-      ++elf_hash_table (info)->dynsymcount;
-    }
-
-  return true;
-}
 
 /* Final phase of ELF linker.  */
 
@@ -3606,6 +3901,101 @@
   struct elf_final_link_info *finfo;
 };
 
+/* Compute the size of, and allocate space for, REL_HDR which is the
+   section header for a section containing relocations for O.  */
+
+static boolean
+elf_link_size_reloc_section (abfd, rel_hdr, o)
+     bfd *abfd;
+     Elf_Internal_Shdr *rel_hdr;
+     asection *o;
+{
+  register struct elf_link_hash_entry **p, **pend;
+  unsigned reloc_count;
+
+  /* Figure out how many relocations there will be.  */
+  if (rel_hdr == &elf_section_data (o)->rel_hdr)
+    reloc_count = elf_section_data (o)->rel_count;
+  else
+    reloc_count = elf_section_data (o)->rel_count2;
+
+  /* That allows us to calculate the size of the section.  */
+  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);
+  if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
+    return false;
+  
+  /* We only allocate one set of hash entries, so we only do it the
+     first time we are called.  */
+  if (elf_section_data (o)->rel_hashes == NULL)
+    {
+      p = ((struct elf_link_hash_entry **)
+	   bfd_malloc (o->reloc_count
+		       * sizeof (struct elf_link_hash_entry *)));
+      if (p == NULL && o->reloc_count != 0)
+	return false;
+
+      elf_section_data (o)->rel_hashes = p;
+      pend = p + o->reloc_count;
+      for (; p < pend; p++)
+	*p = NULL;
+    }
+
+  return true;
+}
+
+/* When performing a relocateable link, the input relocations are
+   preserved.  But, if they reference global symbols, the indices
+   referenced must be updated.  Update all the relocations in
+   REL_HDR (there are COUNT of them), using the data in REL_HASH.  */
+
+static void
+elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
+     bfd *abfd;
+     Elf_Internal_Shdr *rel_hdr;
+     unsigned int count;
+     struct elf_link_hash_entry **rel_hash;
+{
+  unsigned int i;
+
+  for (i = 0; i < count; i++, rel_hash++)
+    {
+      if (*rel_hash == NULL)
+	continue;
+
+      BFD_ASSERT ((*rel_hash)->indx >= 0);
+
+      if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
+	{
+	  Elf_External_Rel *erel;
+	  Elf_Internal_Rel irel;
+	  
+	  erel = (Elf_External_Rel *) rel_hdr->contents + i;
+	  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);
+	}
+      else
+	{
+	  Elf_External_Rela *erela;
+	  Elf_Internal_Rela irela;
+	  
+	  BFD_ASSERT (rel_hdr->sh_entsize
+		      == sizeof (Elf_External_Rela));
+	  
+	  erela = (Elf_External_Rela *) rel_hdr->contents + i;
+	  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);
+	}
+    }
+}
+
 /* Do the final step of an ELF link.  */
 
 boolean
@@ -3761,39 +4151,76 @@
   if (! _bfd_elf_compute_section_file_positions (abfd, info))
     goto error_return;
 
+  /* Figure out how many relocations we will have in each section.
+     Just using RELOC_COUNT isn't good enough since that doesn't
+     maintain a separate value for REL vs. RELA relocations.  */
+  if (info->relocateable)
+    for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+      for (o = sub->sections; o != NULL; o = o->next)
+	{
+	  asection *output_section;
+
+	  if (! o->linker_mark)
+	    {
+	      /* This section was omitted from the link.  */
+	      continue;
+	    }
+
+	  output_section = o->output_section;
+
+	  if (output_section != NULL
+	      && (o->flags & SEC_RELOC) != 0)
+	    {
+	      struct bfd_elf_section_data *esdi 
+		= elf_section_data (o);
+	      struct bfd_elf_section_data *esdo 
+		= elf_section_data (output_section);
+	      unsigned int *rel_count;
+	      unsigned int *rel_count2;
+
+	      /* We must be careful to add the relocation froms the
+		 input section to the right output count.  */
+	      if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize)
+		{
+		  rel_count = &esdo->rel_count;
+		  rel_count2 = &esdo->rel_count2;
+		}
+	      else
+		{
+		  rel_count = &esdo->rel_count2;
+		  rel_count2 = &esdo->rel_count;
+		}
+	      
+	      *rel_count += (esdi->rel_hdr.sh_size 
+			     / esdi->rel_hdr.sh_entsize);
+	      if (esdi->rel_hdr2)
+		*rel_count2 += (esdi->rel_hdr2->sh_size 
+				/ esdi->rel_hdr2->sh_entsize);
+	    }
+	}
+
   /* That created the reloc sections.  Set their sizes, and assign
      them file positions, and allocate some buffers.  */
   for (o = abfd->sections; o != NULL; o = o->next)
     {
       if ((o->flags & SEC_RELOC) != 0)
 	{
-	  Elf_Internal_Shdr *rel_hdr;
-	  register struct elf_link_hash_entry **p, **pend;
-
-	  rel_hdr = &elf_section_data (o)->rel_hdr;
-
-	  rel_hdr->sh_size = rel_hdr->sh_entsize * o->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);
-	  if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
+	  if (!elf_link_size_reloc_section (abfd,
+					    &elf_section_data (o)->rel_hdr,
+					    o))
 	    goto error_return;
 
-	  p = ((struct elf_link_hash_entry **)
-	       bfd_malloc (o->reloc_count
-			   * sizeof (struct elf_link_hash_entry *)));
-	  if (p == NULL && o->reloc_count != 0)
+	  if (elf_section_data (o)->rel_hdr2
+	      && !elf_link_size_reloc_section (abfd,
+					       elf_section_data (o)->rel_hdr2,
+					       o))
 	    goto error_return;
-	  elf_section_data (o)->rel_hashes = p;
-	  pend = p + o->reloc_count;
-	  for (; p < pend; p++)
-	    *p = NULL;
-
-	  /* Use the reloc_count field as an index when outputting the
-	     relocs.  */
-	  o->reloc_count = 0;
 	}
+
+      /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
+	 to count upwards while actually outputting the relocations. */
+      elf_section_data (o)->rel_count = 0;
+      elf_section_data (o)->rel_count2 = 0;
     }
 
   _bfd_elf_assign_file_positions_for_relocs (abfd);
@@ -3895,7 +4322,8 @@
   finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
   finfo.internal_relocs = ((Elf_Internal_Rela *)
 			   bfd_malloc (max_internal_reloc_count
-				       * sizeof (Elf_Internal_Rela)));
+				       * sizeof (Elf_Internal_Rela)
+				       * bed->s->int_rels_per_ext_rel));
   finfo.external_syms = ((Elf_External_Sym *)
 			 bfd_malloc (max_sym_count
 				     * sizeof (Elf_External_Sym)));
@@ -3967,9 +4395,11 @@
     }
 
   /* That wrote out all the local symbols.  Finish up the symbol table
-     with the global symbols.  */
+     with the global symbols. Even if we want to strip everything we
+     can, we still need to deal with those global symbols that got
+     converted to local in a version script. */
 
-  if (info->strip != strip_all && info->shared)
+  if (info->shared)
     {
       /* Output any global symbols that got converted to local in a
          version script.  We do this in a separate step since ELF
@@ -3986,11 +4416,79 @@
 	return false;
     }
 
-  /* The sh_info field records the index of the first non local
-     symbol.  */
+  /* The sh_info field records the index of the first non local symbol.  */
   symtab_hdr->sh_info = bfd_get_symcount (abfd);
+
   if (dynamic)
-    elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info = 1;
+    {
+      Elf_Internal_Sym sym;
+      Elf_External_Sym *dynsym =
+	(Elf_External_Sym *)finfo.dynsym_sec->contents;
+      long last_local = 0;
+
+      /* Write out the section symbols for the output sections.  */
+      if (info->shared)
+	{
+	  asection *s;
+
+	  sym.st_size = 0;
+	  sym.st_name = 0;
+	  sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+	  sym.st_other = 0;
+
+	  for (s = abfd->sections; s != NULL; s = s->next)
+	    {
+	      int indx;
+	      indx = elf_section_data (s)->this_idx;
+	      BFD_ASSERT (indx > 0);
+	      sym.st_shndx = indx;
+	      sym.st_value = s->vma;
+
+	      elf_swap_symbol_out (abfd, &sym,
+				   dynsym + elf_section_data (s)->dynindx);
+	    }
+
+	  last_local = bfd_count_sections (abfd);
+	}
+
+      /* Write out the local dynsyms.  */
+      if (elf_hash_table (info)->dynlocal)
+	{
+	  struct elf_link_local_dynamic_entry *e;
+	  for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
+	    {
+	      asection *s;
+
+	      sym.st_size = e->isym.st_size;
+	      sym.st_other = e->isym.st_other;
+
+	      /* Copy the internal symbol as is.
+		 Note that we saved a word of storage and overwrote
+                 the original st_name with the dynstr_index.  */
+              sym = e->isym;
+
+	      if (e->isym.st_shndx > 0 && e->isym.st_shndx < SHN_LORESERVE)
+		{
+		  s = bfd_section_from_elf_index (e->input_bfd,
+						  e->isym.st_shndx);
+
+		  sym.st_shndx =
+		    elf_section_data (s->output_section)->this_idx;
+		  sym.st_value = (s->output_section->vma
+				  + s->output_offset
+				  + e->isym.st_value);
+		}
+
+	      if (last_local < e->dynindx)
+		last_local = e->dynindx;
+
+	      elf_swap_symbol_out (abfd, &sym, dynsym + e->dynindx);
+	    }
+	}
+
+      elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info =
+	last_local + 1;
+    }
 
   /* We get the global symbols from the hash table.  */
   eoinfo.failed = false;
@@ -4001,6 +4499,18 @@
   if (eoinfo.failed)
     return false;
 
+  /* If backend needs to output some symbols not present in the hash
+     table, do it now.  */
+  if (bed->elf_backend_output_arch_syms)
+    {
+      if (! (*bed->elf_backend_output_arch_syms)
+	      (abfd, info, (PTR) &finfo,
+	       (boolean (*) PARAMS ((PTR, const char *,
+	                    Elf_Internal_Sym *, asection *)))
+	       elf_link_output_sym))
+	return false;
+    }      
+
   /* Flush all symbols to the file.  */
   if (! elf_link_flush_output_syms (&finfo))
     return false;
@@ -4035,47 +4545,17 @@
   /* Adjust the relocs to have the correct symbol indices.  */
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      struct elf_link_hash_entry **rel_hash;
-      Elf_Internal_Shdr *rel_hdr;
-
       if ((o->flags & SEC_RELOC) == 0)
 	continue;
 
-      rel_hash = elf_section_data (o)->rel_hashes;
-      rel_hdr = &elf_section_data (o)->rel_hdr;
-      for (i = 0; i < o->reloc_count; i++, rel_hash++)
-	{
-	  if (*rel_hash == NULL)
-	    continue;
-
-	  BFD_ASSERT ((*rel_hash)->indx >= 0);
-
-	  if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
-	    {
-	      Elf_External_Rel *erel;
-	      Elf_Internal_Rel irel;
-
-	      erel = (Elf_External_Rel *) rel_hdr->contents + i;
-	      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);
-	    }
-	  else
-	    {
-	      Elf_External_Rela *erela;
-	      Elf_Internal_Rela irela;
-
-	      BFD_ASSERT (rel_hdr->sh_entsize
-			  == sizeof (Elf_External_Rela));
-
-	      erela = (Elf_External_Rela *) rel_hdr->contents + i;
-	      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);
-	    }
-	}
+      elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr, 
+			      elf_section_data (o)->rel_count,
+			      elf_section_data (o)->rel_hashes);
+      if (elf_section_data (o)->rel_hdr2 != NULL)
+	elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2,
+				elf_section_data (o)->rel_count2,
+				(elf_section_data (o)->rel_hashes 
+				 + elf_section_data (o)->rel_count));
 
       /* Set the reloc_count field to 0 to prevent write_relocs from
 	 trying to swap the relocs out itself.  */
@@ -4106,15 +4586,11 @@
 	    {
 	    default:
 	      break;
-
-	      /* SVR4 linkers seem to set DT_INIT and DT_FINI based on
-                 magic _init and _fini symbols.  This is pretty ugly,
-                 but we are compatible.  */
 	    case DT_INIT:
-	      name = "_init";
+	      name = info->init_function;
 	      goto get_sym;
 	    case DT_FINI:
-	      name = "_fini";
+	      name = info->fini_function;
 	    get_sym:
 	      {
 		struct elf_link_hash_entry *h;
@@ -4423,7 +4899,6 @@
      warnings for them.  */
   if (! finfo->info->relocateable
       && ! (finfo->info->shared
-	    && !finfo->info->symbolic
 	    && !finfo->info->no_undefined)
       && h->root.type == bfd_link_hash_undefined
       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
@@ -4431,7 +4906,7 @@
     {
       if (! ((*finfo->info->callbacks->undefined_symbol)
 	     (finfo->info, h->root.root.string, h->root.u.undef.abfd,
-	      (asection *) NULL, 0)))
+	      (asection *) NULL, 0, true)))
 	{
 	  eoinfo->failed = true;
 	  return false;
@@ -4459,8 +4934,10 @@
     strip = false;
 
   /* If we're stripping it, and it's not a dynamic symbol, there's
-     nothing else to do.  */
-  if (strip && h->dynindx == -1)
+     nothing else to do unless it is a forced local symbol.  */
+  if (strip
+      && h->dynindx == -1
+      && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
     return true;
 
   sym.st_value = 0;
@@ -4577,14 +5054,23 @@
 
   /* If we are marking the symbol as undefined, and there are no
      non-weak references to this symbol from a regular object, then
-     mark the symbol as weak undefined.  We can't do this earlier,
+     mark the symbol as weak undefined; if there are non-weak
+     references, mark the symbol as strong.  We can't do this earlier,
      because it might not be marked as undefined until the
      finish_dynamic_symbol routine gets through with it.  */
   if (sym.st_shndx == SHN_UNDEF
-      && sym.st_info == ELF_ST_INFO (STB_GLOBAL, h->type)
       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) == 0)
-    sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
+      && (ELF_ST_BIND(sym.st_info) == STB_GLOBAL
+	  || ELF_ST_BIND(sym.st_info) == STB_WEAK))
+    {
+      int bindtype;
+
+      if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
+	bindtype = STB_GLOBAL;
+      else
+	bindtype = STB_WEAK;
+      sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
+    }
 
   /* If this symbol should be put in the .dynsym section, then put it
      there now.  We have already know the symbol index.  We also fill
@@ -4594,6 +5080,7 @@
     {
       size_t bucketcount;
       size_t bucket;
+      size_t hash_entry_size;
       bfd_byte *bucketpos;
       bfd_vma chain;
 
@@ -4606,13 +5093,15 @@
 
       bucketcount = elf_hash_table (finfo->info)->bucketcount;
       bucket = h->elf_hash_value % bucketcount;
+      hash_entry_size 
+	= elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
       bucketpos = ((bfd_byte *) finfo->hash_sec->contents
-		   + (bucket + 2) * (ARCH_SIZE / 8));
-      chain = get_word (finfo->output_bfd, bucketpos);
-      put_word (finfo->output_bfd, h->dynindx, bucketpos);
-      put_word (finfo->output_bfd, chain,
-		((bfd_byte *) finfo->hash_sec->contents
-		 + (bucketcount + 2 + h->dynindx) * (ARCH_SIZE / 8)));
+		   + (bucket + 2) * hash_entry_size);
+      chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
+      bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
+      bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
+	       ((bfd_byte *) finfo->hash_sec->contents
+		+ (bucketcount + 2 + h->dynindx) * hash_entry_size));
 
       if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
 	{
@@ -4659,6 +5148,76 @@
   return true;
 }
 
+/* Copy the relocations indicated by the INTERNAL_RELOCS (which
+   originated from the section given by INPUT_REL_HDR) to the
+   OUTPUT_BFD.  */
+
+static void
+elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, 
+			internal_relocs)
+     bfd *output_bfd;
+     asection *input_section;
+     Elf_Internal_Shdr *input_rel_hdr;
+     Elf_Internal_Rela *internal_relocs;
+{
+  Elf_Internal_Rela *irela;
+  Elf_Internal_Rela *irelaend;
+  Elf_Internal_Shdr *output_rel_hdr;
+  asection *output_section;
+  unsigned int *rel_countp = NULL;
+
+  output_section = input_section->output_section;
+  output_rel_hdr = NULL;
+
+  if (elf_section_data (output_section)->rel_hdr.sh_entsize 
+      == input_rel_hdr->sh_entsize)
+    {
+      output_rel_hdr = &elf_section_data (output_section)->rel_hdr;
+      rel_countp = &elf_section_data (output_section)->rel_count;
+    }
+  else if (elf_section_data (output_section)->rel_hdr2
+	   && (elf_section_data (output_section)->rel_hdr2->sh_entsize
+	       == input_rel_hdr->sh_entsize))
+    {
+      output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
+      rel_countp = &elf_section_data (output_section)->rel_count2;
+    }
+
+  BFD_ASSERT (output_rel_hdr != NULL);
+  
+  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))
+    {
+      Elf_External_Rel *erel;
+
+      erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp);
+      for (; irela < irelaend; irela++, erel++)
+	{
+	  Elf_Internal_Rel irel;
+
+	  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);
+	}
+    }
+  else
+    {
+      Elf_External_Rela *erela;
+
+      BFD_ASSERT (input_rel_hdr->sh_entsize
+		  == 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);
+    }
+
+  /* Bump the counter, so that we know where to add the next set of
+     relocations.  */
+  *rel_countp += input_rel_hdr->sh_size / input_rel_hdr->sh_entsize;
+}
+
 /* Link an input file into the linker output file.  This function
    handles all the sections and relocations of the input file at once.
    This is so that we only have to read the local symbols once, and
@@ -4684,10 +5243,11 @@
   long *pindex;
   asection **ppsection;
   asection *o;
+  struct elf_backend_data *bed;
 
   output_bfd = finfo->output_bfd;
-  relocate_section =
-    get_elf_backend_data (output_bfd)->elf_backend_relocate_section;
+  bed = get_elf_backend_data (output_bfd);
+  relocate_section = bed->elf_backend_relocate_section;
 
   /* If this is a dynamic object, we don't want to do anything here:
      we don't want the local symbols, and we don't want the section
@@ -4920,14 +5480,15 @@
 	      Elf_Internal_Rela *irelaend;
 	      struct elf_link_hash_entry **rel_hash;
 	      Elf_Internal_Shdr *input_rel_hdr;
-	      Elf_Internal_Shdr *output_rel_hdr;
 
 	      /* Adjust the reloc addresses and symbol indices.  */
 
 	      irela = internal_relocs;
-	      irelaend = irela + o->reloc_count;
+	      irelaend = 
+		irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
 	      rel_hash = (elf_section_data (o->output_section)->rel_hashes
-			  + o->output_section->reloc_count);
+			  + elf_section_data (o->output_section)->rel_count
+			  + elf_section_data (o->output_section)->rel_count2);
 	      for (; irela < irelaend; irela++, rel_hash++)
 		{
 		  unsigned long r_symndx;
@@ -5051,40 +5612,16 @@
 
 	      /* Swap out the relocs.  */
 	      input_rel_hdr = &elf_section_data (o)->rel_hdr;
-	      output_rel_hdr = &elf_section_data (o->output_section)->rel_hdr;
-	      BFD_ASSERT (output_rel_hdr->sh_entsize
-			  == input_rel_hdr->sh_entsize);
-	      irela = internal_relocs;
-	      irelaend = irela + o->reloc_count;
-	      if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
-		{
-		  Elf_External_Rel *erel;
-
-		  erel = ((Elf_External_Rel *) output_rel_hdr->contents
-			  + o->output_section->reloc_count);
-		  for (; irela < irelaend; irela++, erel++)
-		    {
-		      Elf_Internal_Rel irel;
-
-		      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);
-		    }
-		}
-	      else
-		{
-		  Elf_External_Rela *erela;
-
-		  BFD_ASSERT (input_rel_hdr->sh_entsize
-			      == sizeof (Elf_External_Rela));
-		  erela = ((Elf_External_Rela *) output_rel_hdr->contents
-			   + o->output_section->reloc_count);
-		  for (; irela < irelaend; irela++, erela++)
-		    elf_swap_reloca_out (output_bfd, irela, erela);
-		}
-
-	      o->output_section->reloc_count += o->reloc_count;
+	      elf_link_output_relocs (output_bfd, o, 
+				      input_rel_hdr,
+				      internal_relocs);
+	      internal_relocs 
+		+= input_rel_hdr->sh_size / input_rel_hdr->sh_entsize;
+	      input_rel_hdr = elf_section_data (o)->rel_hdr2;
+	      if (input_rel_hdr)
+		elf_link_output_relocs (output_bfd, o, 
+					input_rel_hdr,
+					internal_relocs);
 	    }
 	}
 
@@ -5141,7 +5678,8 @@
 
   /* Figure out the symbol index.  */
   rel_hash_ptr = (elf_section_data (output_section)->rel_hashes
-		  + output_section->reloc_count);
+		  + elf_section_data (output_section)->rel_count
+		  + elf_section_data (output_section)->rel_count2);
   if (link_order->type == bfd_section_reloc_link_order)
     {
       indx = link_order->u.reloc.p->u.section->target_index;
@@ -5250,7 +5788,7 @@
       irel.r_offset = offset;
       irel.r_info = ELF_R_INFO (indx, howto->type);
       erel = ((Elf_External_Rel *) rel_hdr->contents
-	      + output_section->reloc_count);
+	      + elf_section_data (output_section)->rel_count);
       elf_swap_reloc_out (output_bfd, &irel, erel);
     }
   else
@@ -5262,11 +5800,11 @@
       irela.r_info = ELF_R_INFO (indx, howto->type);
       irela.r_addend = addend;
       erela = ((Elf_External_Rela *) rel_hdr->contents
-	       + output_section->reloc_count);
+	       + elf_section_data (output_section)->rel_count);
       elf_swap_reloca_out (output_bfd, &irela, erela);
     }
 
-  ++output_section->reloc_count;
+  ++elf_section_data (output_section)->rel_count;
 
   return true;
 }
@@ -5486,8 +6024,8 @@
 	      elf_swap_reloca_out (output_bfd, &outrel,
 				   (((Elf_External_Rela *)
 				     lsect->section->contents)
-				    + lsect->section->reloc_count));
-	      ++lsect->section->reloc_count;
+				    + elf_section_data (lsect->section)->rel_count));
+	      ++elf_section_data (lsect->section)->rel_count;
 	    }
 	}
     }
@@ -5559,6 +6097,7 @@
       size_t extsymoff;
       Elf_External_Sym *locsyms, *freesyms = NULL;
       bfd *input_bfd = sec->owner;
+      struct elf_backend_data *bed = get_elf_backend_data (input_bfd);
 
       /* GCFIXME: how to arrange so that relocs and symbols are not
 	 reread continually?  */
@@ -5602,7 +6141,7 @@
 	  ret = false;
 	  goto out1;
 	}
-      relend = relstart + sec->reloc_count;
+      relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
 
       for (rel = relstart; rel < relend; rel++)
 	{
@@ -5671,6 +6210,9 @@
     {
       asection *o;
 
+      if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+	continue;
+
       for (o = sub->sections; o != NULL; o = o->next)
 	{
 	  /* Keep special sections.  Keep .debug sections.  */
@@ -5808,6 +6350,7 @@
   asection *sec;
   bfd_vma hstart, hend;
   Elf_Internal_Rela *relstart, *relend, *rel;
+  struct elf_backend_data *bed;
 
   /* Take care of both those symbols that do not describe vtables as
      well as those that are not loaded.  */
@@ -5825,7 +6368,8 @@
 	      (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true));
   if (!relstart)
     return *(boolean *)okp = false;
-  relend = relstart + sec->reloc_count;
+  bed = get_elf_backend_data (sec->owner);
+  relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
 
   for (rel = relstart; rel < relend; ++rel)
     if (rel->r_offset >= hstart && rel->r_offset < hend)
@@ -5883,6 +6427,10 @@
   for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
     {
       asection *o;
+
+      if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+	continue;
+
       for (o = sub->sections; o != NULL; o = o->next)
 	{
 	  if (o->flags & SEC_KEEP)
@@ -5959,8 +6507,8 @@
 
 boolean
 elf_gc_record_vtentry (abfd, sec, h, addend)
-     bfd *abfd;
-     asection *sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *h;
      bfd_vma addend;
 {
@@ -5986,30 +6534,31 @@
 
       /* Allocate one extra entry for use as a "done" flag for the
 	 consolidation pass.  */
-      bytes = (size / FILE_ALIGN + 1) * sizeof(boolean);
+      bytes = (size / FILE_ALIGN + 1) * sizeof (boolean);
 
       if (ptr)
 	{
-	  size_t oldbytes;
+	  ptr = bfd_realloc (ptr - 1, bytes);
+	  
+	  if (ptr != NULL)
+	    {
+	      size_t oldbytes;
 
-	  ptr = realloc (ptr-1, bytes);
-	  if (ptr == NULL)
-	    return false;
-
-	  oldbytes = (h->vtable_entries_size/FILE_ALIGN + 1) * sizeof(boolean);
-	  memset (ptr + oldbytes, 0, bytes - oldbytes);
+	      oldbytes = (h->vtable_entries_size/FILE_ALIGN + 1) * sizeof (boolean);
+	      memset (((char *)ptr) + oldbytes, 0, bytes - oldbytes);
+	    }
 	}
       else
-	{
-	  ptr = calloc (1, bytes);
-	  if (ptr == NULL)
-	    return false;
-	}
+	ptr = bfd_zmalloc (bytes);
 
+      if (ptr == NULL)
+	return false;
+      
       /* And arrange for that done flag to be at index -1.  */
-      h->vtable_entries_used = ptr+1;
+      h->vtable_entries_used = ptr + 1;
       h->vtable_entries_size = size;
     }
+  
   h->vtable_entries_used[addend / FILE_ALIGN] = true;
 
   return true;
@@ -6037,10 +6586,14 @@
   /* Do the local .got entries first.  */
   for (i = info->input_bfds; i; i = i->link_next)
     {
-      bfd_signed_vma *local_got = elf_local_got_refcounts (i);
+      bfd_signed_vma *local_got;
       bfd_size_type j, locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
 
+      if (bfd_get_flavour (i) != bfd_target_elf_flavour)
+	continue;
+
+      local_got = elf_local_got_refcounts (i);
       if (!local_got)
 	continue;
 
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 9acabd1..b1f4867 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -80,6 +80,9 @@
 #ifndef elf_backend_plt_alignment
 #define elf_backend_plt_alignment 2
 #endif
+#ifndef elf_backend_want_dynbss
+#define elf_backend_want_dynbss 1
+#endif
 
 #define bfd_elfNN_bfd_debug_info_start	bfd_void
 #define bfd_elfNN_bfd_debug_info_end	bfd_void
@@ -202,6 +205,7 @@
 #endif
 
 #ifndef ELF_MAXPAGESIZE
+  #error ELF_MAXPAGESIZE is not defined
 #define ELF_MAXPAGESIZE 1
 #endif
 
@@ -233,6 +237,9 @@
 #ifndef elf_backend_section_from_shdr
 #define elf_backend_section_from_shdr	0
 #endif
+#ifndef elf_backend_section_from_phdr
+#define elf_backend_section_from_phdr	0
+#endif
 #ifndef elf_backend_fake_sections
 #define elf_backend_fake_sections	0
 #endif
@@ -290,6 +297,44 @@
 #ifndef elf_backend_plt_header_size
 #define elf_backend_plt_header_size	0
 #endif
+#ifndef elf_backend_post_process_headers
+#define elf_backend_post_process_headers	NULL
+#endif
+#ifndef elf_backend_print_symbol_all
+#define elf_backend_print_symbol_all		NULL
+#endif
+#ifndef elf_backend_output_arch_syms
+#define elf_backend_output_arch_syms		NULL
+#endif
+#ifndef elf_backend_copy_indirect_symbol
+#define elf_backend_copy_indirect_symbol  _bfd_elf_link_hash_copy_indirect
+#endif
+#ifndef elf_backend_hide_symbol
+#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.
+   For backwards compatibility, we still support this usage.  */
+#ifndef USE_REL
+#define USE_REL 0
+#else
+#undef USE_REL
+#define USE_REL 1
+#endif 
+
+/* Use these in new code.  */
+#ifndef elf_backend_may_use_rel_p 
+#define elf_backend_may_use_rel_p USE_REL
+#endif 
+#ifndef elf_backend_may_use_rela_p
+#define elf_backend_may_use_rela_p !USE_REL
+#endif
+#ifndef elf_backend_default_use_rela_p 
+#define elf_backend_default_use_rela_p !USE_REL
+#endif
 
 #ifndef ELF_MACHINE_ALT1
 #define ELF_MACHINE_ALT1 0
@@ -303,20 +348,17 @@
 #define elf_backend_size_info _bfd_elfNN_size_info
 #endif
 
+#ifndef elf_backend_sign_extend_vma
+#define elf_backend_sign_extend_vma 0
+#endif
+
 extern const struct elf_size_info _bfd_elfNN_size_info;
 
 static CONST struct elf_backend_data elfNN_bed =
 {
-#ifdef USE_REL
-  0,				/* use_rela_p */
-#else
-  1,				/* use_rela_p */
-#endif
   ELF_ARCH,			/* arch */
   ELF_MACHINE_CODE,		/* elf_machine_code */
   ELF_MAXPAGESIZE,		/* maxpagesize */
-  elf_backend_collect,
-  elf_backend_type_change_ok,
   elf_info_to_howto,
   elf_info_to_howto_rel,
   elf_backend_sym_is_global,
@@ -326,6 +368,7 @@
   elf_backend_get_symbol_type,
   elf_backend_section_processing,
   elf_backend_section_from_shdr,
+  elf_backend_section_from_phdr,
   elf_backend_fake_sections,
   elf_backend_section_from_bfd_section,
   elf_backend_add_symbol_hook,
@@ -344,6 +387,11 @@
   elf_backend_modify_segment_map,
   elf_backend_gc_mark_hook,
   elf_backend_gc_sweep_hook,
+  elf_backend_post_process_headers,
+  elf_backend_print_symbol_all,
+  elf_backend_output_arch_syms,
+  elf_backend_copy_indirect_symbol,
+  elf_backend_hide_symbol,
   elf_backend_ecoff_debug_swap,
   ELF_MACHINE_ALT1,
   ELF_MACHINE_ALT2,
@@ -351,14 +399,26 @@
   elf_backend_got_symbol_offset,
   elf_backend_got_header_size,
   elf_backend_plt_header_size,
+  elf_backend_collect,
+  elf_backend_type_change_ok,
+  elf_backend_may_use_rel_p,
+  elf_backend_may_use_rela_p,
+  elf_backend_default_use_rela_p,
+  elf_backend_sign_extend_vma,
   elf_backend_want_got_plt,
   elf_backend_plt_readonly,
   elf_backend_want_plt_sym,
   elf_backend_plt_not_loaded,
   elf_backend_plt_alignment,
-  elf_backend_can_gc_sections
+  elf_backend_can_gc_sections,
+  elf_backend_want_dynbss
 };
 
+/* Forward declaration for use when initialising alternative_target field.  */
+#ifdef TARGET_LITTLE_SYM
+extern const bfd_target TARGET_LITTLE_SYM;
+#endif
+
 #ifdef TARGET_BIG_SYM
 const bfd_target TARGET_BIG_SYM =
 {
@@ -442,8 +502,15 @@
       BFD_JUMP_TABLE_LINK (bfd_elfNN),
       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+
   /* backend_data: */
-  (PTR) &elfNN_bed,
+  (PTR) &elfNN_bed
 };
 #endif
 
@@ -530,7 +597,14 @@
       BFD_JUMP_TABLE_LINK (bfd_elfNN),
       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
-  (PTR) &elfNN_bed,
+  (PTR) &elfNN_bed
 };
 #endif
diff --git a/bfd/epoc-pe-arm.c b/bfd/epoc-pe-arm.c
index ea89a0b..48a277a 100644
--- a/bfd/epoc-pe-arm.c
+++ b/bfd/epoc-pe-arm.c
@@ -25,6 +25,12 @@
 #define TARGET_BIG_SYM       arm_epoc_pe_big_vec
 #define TARGET_BIG_NAME      "epoc-pe-arm-big"
 
+#define bfd_arm_allocate_interworking_sections \
+	bfd_arm_epoc_pe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+	bfd_arm_epoc_pe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+	bfd_arm_epoc_pe_process_before_allocation
 
 #include "pe-arm.c"
 
diff --git a/bfd/freebsd.h b/bfd/freebsd.h
index 8bb19ac..e80c213 100644
--- a/bfd/freebsd.h
+++ b/bfd/freebsd.h
@@ -1,5 +1,5 @@
 /* BFD back-end definitions used by all FreeBSD targets.
-   Copyright (C) 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1992, 1996, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -76,11 +76,7 @@
   struct external_exec exec_bytes;
   struct internal_exec *execp = exec_hdr (abfd);
 
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE(abfd);
-#else
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
 
   /* Magic number, maestro, please!  */
   switch (bfd_get_arch(abfd)) {
diff --git a/bfd/hash.c b/bfd/hash.c
index 4c6e987..173eaf7 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -1,5 +1,5 @@
 /* hash.c -- hash table routines for BFD
-   Copyright (C) 1993, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 97, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -73,7 +73,7 @@
 	The function <<bfd_hash_table_init>> take as an argument a
 	function to use to create new entries.  For a basic hash
 	table, use the function <<bfd_hash_newfunc>>.  @xref{Deriving
-	a New Hash Table Type} for why you would want to use a
+	a New Hash Table Type}, for why you would want to use a
 	different value for this argument.
 
 @findex bfd_hash_allocate
@@ -450,7 +450,7 @@
 bfd_hash_newfunc (entry, table, string)
      struct bfd_hash_entry *entry;
      struct bfd_hash_table *table;
-     const char *string;
+     const char *string ATTRIBUTE_UNUSED;
 {
   if (entry == (struct bfd_hash_entry *) NULL)
     entry = ((struct bfd_hash_entry *)
diff --git a/bfd/hosts/alphalinux.h b/bfd/hosts/alphalinux.h
index d9ba1b7..09b8d69 100644
--- a/bfd/hosts/alphalinux.h
+++ b/bfd/hosts/alphalinux.h
@@ -1,6 +1,6 @@
 /* Linux dumps "struct task_struct" at the end of the core-file.  This
-   structure is currently 920 bytes long, but we allow up to 1024
+   structure is currently 1080 bytes long, but we allow up to 4096
    bytes to allow for some future growth.  */
-#define TRAD_CORE_EXTRA_SIZE_ALLOWED		1024
+#define TRAD_CORE_EXTRA_SIZE_ALLOWED		4096
 #define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
   ((abfd)->tdata.trad_core_data->u.signal)
diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c
index 9552318..46bfea0 100644
--- a/bfd/hp300hpux.c
+++ b/bfd/hp300hpux.c
@@ -1,5 +1,5 @@
 /* BFD backend for hp-ux 9000/300
-   Copyright (C) 1990, 1991, 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 94, 95, 97, 99, 2000 Free Software Foundation, Inc.
    Written by Glenn Engel.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -270,11 +270,8 @@
   file_ptr text_end;
 
   memset (&exec_bytes, 0, sizeof (exec_bytes));
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE (abfd);
-#else
+
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
 
   if (adata (abfd).magic == undecided_magic)
     NAME (aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
@@ -336,9 +333,9 @@
 
 static void
 convert_sym_type (sym_pointer, cache_ptr, abfd)
-     struct external_nlist *sym_pointer;
+     struct external_nlist *sym_pointer ATTRIBUTE_UNUSED;
      aout_symbol_type *cache_ptr;
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   int name_type;
   int new_type;
@@ -626,7 +623,7 @@
      struct hp300hpux_reloc *bytes;
      arelent *cache_ptr;
      asymbol **symbols;
-     bfd_size_type symcount;
+     bfd_size_type symcount ATTRIBUTE_UNUSED;
 {
   int r_index;
   int r_extern = 0;
diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c
index a7c22f5..0a3e6b2 100644
--- a/bfd/hppabsd-core.c
+++ b/bfd/hppabsd-core.c
@@ -298,6 +298,8 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
 #endif
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index 6be709f..bfaa2c2 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -400,5 +400,7 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/i386linux.c b/bfd/i386linux.c
index 804bdcd..5df2a11 100644
--- a/bfd/i386linux.c
+++ b/bfd/i386linux.c
@@ -1,5 +1,6 @@
 /* BFD back-end for linux flavored i386 a.out binaries.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -297,7 +298,7 @@
 static boolean
 linux_link_create_dynamic_sections (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   flagword flags;
   register asection *s;
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index 1f0344e..a999dd0 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -1,5 +1,6 @@
 /* BFD back-end for i386 a.out binaries under LynxOS.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1999
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -324,7 +325,7 @@
      struct reloc_ext_external *bytes;
      arelent *cache_ptr;
      asymbol **symbols;
-     bfd_size_type symcount;
+     bfd_size_type symcount ATTRIBUTE_UNUSED;
 {
   int r_index;
   int r_extern;
@@ -348,7 +349,7 @@
      struct reloc_std_external *bytes;
      arelent *cache_ptr;
      asymbol **symbols;
-     bfd_size_type symcount;
+     bfd_size_type symcount ATTRIBUTE_UNUSED;
 {
   int r_index;
   int r_extern;
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index c6f24b2..c9ec864 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -1,5 +1,6 @@
 /* BFD back-end for MS-DOS executables.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Bryan Ford of the University of Utah.
 
    Contributed by the Center for Software Science at the
@@ -58,8 +59,8 @@
 
 static int
 msdos_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -238,6 +239,8 @@
   BFD_JUMP_TABLE_LINK (msdos),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 2a01f5b..0aadee5 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -1,5 +1,5 @@
 /* BFD back-end for os9000 i386 binaries.
-   Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 98, 1999 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -305,8 +305,8 @@
 
 static int
 os9k_sizeof_headers (ignore_abfd, ignore)
-     bfd *ignore_abfd;
-     boolean ignore;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
+     boolean ignore ATTRIBUTE_UNUSED;
 {
   return sizeof (struct internal_exec);
 }
@@ -367,5 +367,7 @@
      BFD_JUMP_TABLE_LINK (os9k),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0,
 };
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 126b136..82b3bac 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -1,5 +1,5 @@
 /* BFD back-end for ieee-695 objects.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    Written by Steve Chamberlain of Cygnus Support.
@@ -685,7 +685,7 @@
 	    max_index,
 	    this_type
 )
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      ieee_data_type *ieee;
      ieee_symbol_type *last_symbol;
      unsigned int *symbol_count;
@@ -1010,7 +1010,7 @@
   static bfd dummy_bfd;
   static asymbol empty_symbol =
   /* the_bfd, name, value, attr, section */
-  {&dummy_bfd, " ieee empty", (symvalue) 0, BSF_DEBUGGING, bfd_abs_section_ptr};
+  {&dummy_bfd, " ieee empty", (symvalue) 0, BSF_DEBUGGING, bfd_abs_section_ptr, { 0 }};
 
   if (abfd->symcount)
     {
@@ -1280,6 +1280,7 @@
 {
   ieee_data_type *ieee = IEEE_DATA (abfd);
   asection *sec;
+  file_ptr debug_end;
 
   if (ieee->w.r.debug_information_part == 0)
     return true;
@@ -1289,7 +1290,13 @@
     return false;
   sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
   sec->filepos = ieee->w.r.debug_information_part;
-  sec->_raw_size = ieee->w.r.data_part - ieee->w.r.debug_information_part;
+
+  debug_end = ieee->w.r.data_part;
+  if (debug_end == 0)
+    debug_end = ieee->w.r.trailer_part;
+  if (debug_end == 0)
+    debug_end = ieee->w.r.me_record;
+  sec->_raw_size = debug_end - ieee->w.r.debug_information_part;
 
   return true;
 }
@@ -1329,7 +1336,7 @@
   if (this_byte (&(ieee->h)) != Module_Beginning)
     {
       abfd->tdata.ieee_ar_data = save;
-      goto error_return;
+      goto got_wrong_format_error;
     }
 
   next_byte (&(ieee->h));
@@ -1338,7 +1345,7 @@
     {
       bfd_release (abfd, ieee);
       abfd->tdata.ieee_ar_data = save;
-      goto error_return;
+      goto got_wrong_format_error;
     }
   /* Throw away the filename */
   read_id (&(ieee->h));
@@ -1441,6 +1448,8 @@
 
   return abfd->xvec;
 
+ got_wrong_format_error:
+  bfd_set_error (bfd_error_wrong_format);
  error_return:
   if (elts != NULL)
     free (elts);
@@ -1652,7 +1661,7 @@
 
 void
 ieee_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -1665,7 +1674,7 @@
 
 void
 ieee_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -3163,7 +3172,7 @@
 
 static void
 relocate_debug (output, input)
-     bfd *output;
+     bfd *output ATTRIBUTE_UNUSED;
      bfd *input;
 {
 #define IBS 400
@@ -3762,13 +3771,13 @@
 			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;
 }
@@ -3807,8 +3816,8 @@
 
 static int
 ieee_sizeof_headers (abfd, x)
-     bfd *abfd;
-     boolean x;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean x ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -3966,5 +3975,7 @@
   BFD_JUMP_TABLE_LINK (ieee),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/ihex.c b/bfd/ihex.c
index b9953d3..d00c59b 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel Hex objects.
-   Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -146,7 +146,7 @@
 
 /* The number of bytes we put on one line during output.  */
 
-#define CHUNK (21)
+#define CHUNK 16
 
 /* Macros for converting between hex and binary. */
 
@@ -947,8 +947,8 @@
 /*ARGSUSED*/
 static int
 ihex_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -1037,5 +1037,7 @@
   BFD_JUMP_TABLE_LINK (ihex),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/irix-core.c b/bfd/irix-core.c
index 964ca20..006e6a7 100644
--- a/bfd/irix-core.c
+++ b/bfd/irix-core.c
@@ -270,6 +270,8 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
 
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index cb4a4df..79a176d 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -1,6 +1,7 @@
 /* libbfd.h -- Declarations used by bfd library *implementation*.
    (This include file is not for users of the library.)
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 ** NOTE: libbfd.h is a GENERATED file.  Don't change it; instead,
@@ -364,7 +365,7 @@
 /* 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 *));
+	   const char **, unsigned int *, unsigned int));
 
 /* A routine to create entries for a bfd_link_hash_table.  */
 extern struct bfd_hash_entry *_bfd_link_hash_newfunc
@@ -478,6 +479,9 @@
 
 /* Write out a string table.  */
 extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
+
+/* Check that endianness of input and output file match.  */
+extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
 
 /* Macros to tell if bfds are read or write enabled.
 
@@ -499,6 +503,17 @@
 #define BFD_FAIL() \
 { bfd_assert(__FILE__,__LINE__); }
 
+extern void _bfd_abort PARAMS ((const char *, int, const char *))
+     ATTRIBUTE_NORETURN;
+
+/* if gcc, we can give a function name, too */
+#if !defined (__GNUC__) || __GNUC_MINOR__ <= 5
+#define __PRETTY_FUNCTION__  ((char *) NULL)
+#endif
+
+#undef abort
+#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
 FILE *	bfd_cache_lookup_worker PARAMS ((bfd *));
 
 extern bfd *bfd_last_cache;
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 8abd1f5..881af73 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1,5 +1,5 @@
 /* Assorted BFD support routines, only used internally.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -45,7 +45,7 @@
 /*ARGSUSED*/
 boolean
 bfd_false (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return false;
@@ -57,7 +57,7 @@
 /*ARGSUSED*/
 boolean
 bfd_true (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -68,7 +68,7 @@
 /*ARGSUSED*/
 PTR
 bfd_nullvoidptr (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return NULL;
@@ -77,7 +77,7 @@
 /*ARGSUSED*/
 int 
 bfd_0 (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -85,7 +85,7 @@
 /*ARGSUSED*/
 unsigned int 
 bfd_0u (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
    return 0;
 }
@@ -93,7 +93,7 @@
 /*ARGUSED*/
 long
 bfd_0l (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -104,7 +104,7 @@
 /*ARGSUSED*/
 long
 _bfd_n1 (ignore_abfd)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return -1;
@@ -113,15 +113,15 @@
 /*ARGSUSED*/
 void 
 bfd_void (ignore)
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
 }
 
 /*ARGSUSED*/
 boolean
 _bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
-     bfd *ignore_core_bfd;
-     bfd *ignore_exec_bfd;
+     bfd *ignore_core_bfd ATTRIBUTE_UNUSED;
+     bfd *ignore_exec_bfd ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return false;
@@ -133,7 +133,7 @@
 /*ARGSUSED*/
 char *
 _bfd_nocore_core_file_failing_command (ignore_abfd)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return (char *)NULL;
@@ -145,7 +145,7 @@
 /*ARGSUSED*/
 int
 _bfd_nocore_core_file_failing_signal (ignore_abfd)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_invalid_operation);
   return 0;
@@ -154,7 +154,7 @@
 /*ARGSUSED*/
 const bfd_target *
 _bfd_dummy_target (ignore_abfd)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
 {
   bfd_set_error (bfd_error_wrong_format);
   return 0;
@@ -274,7 +274,10 @@
       get = size * nitems;
       if (abfd->where + get > bim->size)
 	{
-	  get = bim->size - abfd->where;
+	  if (bim->size < (bfd_size_type) abfd->where)
+	    get = 0;
+	  else
+	    get = bim->size - abfd->where;
 	  bfd_set_error (bfd_error_file_truncated);
 	}
       memcpy (ptr, bim->buffer + abfd->where, get);
@@ -293,7 +296,7 @@
 
      A BFD backend may wish to override bfd_error_file_truncated to
      provide something more useful (eg. no_symbols or wrong_format).  */
-  if (nread < (int)(size * nitems))
+  if (nread != (int) (size * nitems))
     {
       if (ferror (bfd_cache_lookup (abfd)))
 	bfd_set_error (bfd_error_system_call);
@@ -677,10 +680,22 @@
 
   if ((abfd->flags & BFD_IN_MEMORY) != 0)
     {
+      struct bfd_in_memory *bim;
+
+      bim = (struct bfd_in_memory *) abfd->iostream;
+      
       if (direction == SEEK_SET)
 	abfd->where = position;
       else
 	abfd->where += position;
+      
+      if ((bfd_size_type) abfd->where > bim->size)
+	{
+	  abfd->where = bim->size;
+	  bfd_set_error (bfd_error_file_truncated);
+	  return -1;
+	}
+      
       return 0;
     }
 
@@ -792,7 +807,7 @@
 .{* Byte swapping macros for user section data.  *}
 .
 .#define bfd_put_8(abfd, val, ptr) \
-.                (*((unsigned char *)(ptr)) = (unsigned char)(val))
+.                ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
 .#define bfd_put_signed_8 \
 .		bfd_put_8
 .#define bfd_get_8(abfd, ptr) \
@@ -827,6 +842,20 @@
 .#define bfd_get_signed_64(abfd, ptr) \
 .		 BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
 .
+.#define bfd_get(bits, abfd, ptr)				\
+.                ((bits) == 8 ? bfd_get_8 (abfd, ptr)		\
+.		 : (bits) == 16 ? bfd_get_16 (abfd, ptr)	\
+.		 : (bits) == 32 ? bfd_get_32 (abfd, ptr)	\
+.		 : (bits) == 64 ? bfd_get_64 (abfd, ptr)	\
+.		 : (abort (), (bfd_vma) - 1))
+.
+.#define bfd_put(bits, abfd, val, ptr)				\
+.                ((bits) == 8 ? bfd_put_8 (abfd, val, ptr)	\
+.		 : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)	\
+.		 : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)	\
+.		 : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)	\
+.		 : (abort (), (void) 0))
+.
 */ 
 
 /*
@@ -989,7 +1018,7 @@
 
 bfd_vma
 bfd_getb64 (addr)
-     register const bfd_byte *addr;
+     register const bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   bfd_vma low, high;
@@ -1013,7 +1042,7 @@
 
 bfd_vma
 bfd_getl64 (addr)
-     register const bfd_byte *addr;
+     register const bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   bfd_vma low, high;
@@ -1037,7 +1066,7 @@
 
 bfd_signed_vma
 bfd_getb_signed_64 (addr)
-     register const bfd_byte *addr;
+     register const bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   bfd_vma low, high;
@@ -1061,7 +1090,7 @@
 
 bfd_signed_vma
 bfd_getl_signed_64 (addr)
-     register const bfd_byte *addr;
+     register const bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   bfd_vma low, high;
@@ -1106,8 +1135,8 @@
 
 void
 bfd_putb64 (data, addr)
-     bfd_vma data;
-     register bfd_byte *addr;
+     bfd_vma data ATTRIBUTE_UNUSED;
+     register bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   addr[0] = (bfd_byte)(data >> (7*8));
@@ -1125,8 +1154,8 @@
 
 void
 bfd_putl64 (data, addr)
-     bfd_vma data;
-     register bfd_byte *addr;
+     bfd_vma data ATTRIBUTE_UNUSED;
+     register bfd_byte *addr ATTRIBUTE_UNUSED;
 {
 #ifdef BFD64
   addr[7] = (bfd_byte)(data >> (7*8));
@@ -1152,22 +1181,29 @@
      file_ptr offset;
      bfd_size_type count;
 {
-    if (count == 0)
-        return true;
-    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);
+  if (count == 0)
+    return true;
+
+  if ((bfd_size_type) (offset + count) > section->_raw_size)
+    {
+      bfd_set_error (bfd_error_invalid_operation);
+      return false;
+    }
+
+  if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
+      || bfd_read (location, (bfd_size_type) 1, count, abfd) != count)
+    return false;
+
+  return true;
 }
 
 boolean
 _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
-     bfd *abfd;
-     sec_ptr section;
-     bfd_window *w;
-     file_ptr offset;
-     bfd_size_type count;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     sec_ptr section ATTRIBUTE_UNUSED;
+     bfd_window *w ATTRIBUTE_UNUSED;
+     file_ptr offset ATTRIBUTE_UNUSED;
+     bfd_size_type count ATTRIBUTE_UNUSED;
 {
 #ifdef USE_MMAP
   if (count == 0)
@@ -1246,7 +1282,7 @@
 {
   unsigned int result = 0;
 
-  while ((((bfd_vma) 1) << result) < x)
+  while ((x = (x >> 1)) != 0)
     ++result;
   return result;
 }
@@ -1261,3 +1297,26 @@
   return (name[0] == locals_prefix);
 }
 
+/*  Can be used from / for bfd_merge_private_bfd_data to check that
+    endianness matches between input and output file.  Returns
+    true for a match, otherwise returns false and emits an error.  */
+boolean
+_bfd_generic_verify_endian_match (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  if (ibfd->xvec->byteorder != obfd->xvec->byteorder
+      && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
+    {
+      (*_bfd_error_handler)
+	("%s: compiled for a %s endian system and target is %s endian",
+	 bfd_get_filename (ibfd),
+	 bfd_big_endian (ibfd) ? "big" : "little",
+	 bfd_big_endian (obfd) ? "big" : "little");
+
+      bfd_set_error (bfd_error_wrong_format);
+      return false;
+    }
+
+  return true;
+}
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index f804bde..f9baf5a 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1,6 +1,7 @@
 /* libbfd.h -- Declarations used by bfd library *implementation*.
    (This include file is not for users of the library.)
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 ** NOTE: libbfd.h is a GENERATED file.  Don't change it; instead,
@@ -364,7 +365,7 @@
 /* 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 *));
+	   const char **, unsigned int *, unsigned int));
 
 /* A routine to create entries for a bfd_link_hash_table.  */
 extern struct bfd_hash_entry *_bfd_link_hash_newfunc
@@ -478,6 +479,9 @@
 
 /* Write out a string table.  */
 extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
+
+/* Check that endianness of input and output file match.  */
+extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
 
 /* Macros to tell if bfds are read or write enabled.
 
@@ -499,6 +503,17 @@
 #define BFD_FAIL() \
 { bfd_assert(__FILE__,__LINE__); }
 
+extern void _bfd_abort PARAMS ((const char *, int, const char *))
+     ATTRIBUTE_NORETURN;
+
+/* if gcc, we can give a function name, too */
+#if !defined (__GNUC__) || __GNUC_MINOR__ <= 5
+#define __PRETTY_FUNCTION__  ((char *) NULL)
+#endif
+
+#undef abort
+#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
 FILE *	bfd_cache_lookup_worker PARAMS ((bfd *));
 
 extern bfd *bfd_last_cache;
@@ -661,6 +676,13 @@
   "BFD_RELOC_ALPHA_LITERAL",
   "BFD_RELOC_ALPHA_ELF_LITERAL",
   "BFD_RELOC_ALPHA_LITUSE",
+  "BFD_RELOC_ALPHA_USER_LITERAL",
+  "BFD_RELOC_ALPHA_USER_LITUSE_BASE",
+  "BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF",
+  "BFD_RELOC_ALPHA_USER_LITUSE_JSR",
+  "BFD_RELOC_ALPHA_USER_GPDISP",
+  "BFD_RELOC_ALPHA_USER_GPRELHIGH",
+  "BFD_RELOC_ALPHA_USER_GPRELLOW",
   "BFD_RELOC_ALPHA_HINT",
   "BFD_RELOC_ALPHA_LINKAGE",
   "BFD_RELOC_ALPHA_CODEADDR",
@@ -679,6 +701,10 @@
   "BFD_RELOC_MIPS_GOT_LO16",
   "BFD_RELOC_MIPS_CALL_HI16",
   "BFD_RELOC_MIPS_CALL_LO16",
+  "BFD_RELOC_MIPS_SUB",
+  "BFD_RELOC_MIPS_GOT_PAGE",
+  "BFD_RELOC_MIPS_GOT_OFST",
+  "BFD_RELOC_MIPS_GOT_DISP",
 
   "BFD_RELOC_386_GOT32",
   "BFD_RELOC_386_PLT32",
@@ -700,6 +726,12 @@
   "BFD_RELOC_NS32K_DISP_8_PCREL",
   "BFD_RELOC_NS32K_DISP_16_PCREL",
   "BFD_RELOC_NS32K_DISP_32_PCREL",
+  "BFD_RELOC_PJ_CODE_HI16",
+  "BFD_RELOC_PJ_CODE_LO16",
+  "BFD_RELOC_PJ_CODE_DIR16",
+  "BFD_RELOC_PJ_CODE_DIR32",
+  "BFD_RELOC_PJ_CODE_REL16",
+  "BFD_RELOC_PJ_CODE_REL32",
   "BFD_RELOC_PPC_B26",
   "BFD_RELOC_PPC_BA26",
   "BFD_RELOC_PPC_TOC16",
@@ -730,9 +762,11 @@
   "BFD_RELOC_PPC_EMB_RELST_HA",
   "BFD_RELOC_PPC_EMB_BIT_FLD",
   "BFD_RELOC_PPC_EMB_RELSDA",
+  "BFD_RELOC_I370_D12",
   "BFD_RELOC_CTOR",
   "BFD_RELOC_ARM_PCREL_BRANCH",
   "BFD_RELOC_ARM_IMMEDIATE",
+  "BFD_RELOC_ARM_ADRL_IMMEDIATE",
   "BFD_RELOC_ARM_OFFSET_IMM",
   "BFD_RELOC_ARM_SHIFT_IMM",
   "BFD_RELOC_ARM_SWI",
@@ -836,6 +870,23 @@
   "BFD_RELOC_MCORE_PCREL_IMM4BY2",
   "BFD_RELOC_MCORE_PCREL_32",
   "BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
+  "BFD_RELOC_MCORE_RVA",
+  "BFD_RELOC_AVR_7_PCREL",
+  "BFD_RELOC_AVR_13_PCREL",
+  "BFD_RELOC_AVR_16_PM",
+  "BFD_RELOC_AVR_LO8_LDI",
+  "BFD_RELOC_AVR_HI8_LDI",
+  "BFD_RELOC_AVR_HH8_LDI",
+  "BFD_RELOC_AVR_LO8_LDI_NEG",
+  "BFD_RELOC_AVR_HI8_LDI_NEG",
+  "BFD_RELOC_AVR_HH8_LDI_NEG",
+  "BFD_RELOC_AVR_LO8_LDI_PM",
+  "BFD_RELOC_AVR_HI8_LDI_PM",
+  "BFD_RELOC_AVR_HH8_LDI_PM",
+  "BFD_RELOC_AVR_LO8_LDI_PM_NEG",
+  "BFD_RELOC_AVR_HI8_LDI_PM_NEG",
+  "BFD_RELOC_AVR_HH8_LDI_PM_NEG",
+  "BFD_RELOC_AVR_CALL",
   "BFD_RELOC_VTABLE_INHERIT",
   "BFD_RELOC_VTABLE_ENTRY",
  "@@overflow: BFD_RELOC_UNUSED@@",
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 0dc2121..9b1a026 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -1,5 +1,5 @@
 /* BFD COFF object file private structure.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -56,7 +56,7 @@
   file_ptr sym_filepos;
 
   struct coff_ptr_struct *raw_syments;
-  unsigned int raw_syment_count;
+  unsigned long raw_syment_count;
 
   /* These are only valid once writing has begun */
   long int relocbase;
@@ -97,6 +97,9 @@
   /* Used by coff_find_nearest_line.  */
   PTR line_info;
 
+  /* The timestamp from the COFF file header.  */
+  long timestamp;
+
   /* Copy of some of the f_flags bits in the COFF filehdr structure,
      used by ARM code.  */
   flagword flags;
@@ -213,12 +216,14 @@
 #define xcoff_section_data(abfd, sec) \
   ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
 
-/* Tdata for sections in PEI image files.  */
+/* Tdata for sections in PE files.  */
 
 struct pei_section_tdata
 {
   /* The virtual size of the section.  */
   bfd_size_type virt_size;
+  /* The PE section flags.  */
+  long pe_flags;
 };
 
 /* An accessor macro for the pei_section_tdata structure.  */
@@ -249,6 +254,11 @@
 
   /* Pointer to array of auxiliary entries, if any.  */
   union internal_auxent *aux;
+
+  /* Flag word; legal values follow.  */
+  unsigned short coff_link_hash_flags;
+  /* Symbol is a PE section symbol.  */
+#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
 };
 
 /* COFF linker hash table.  */
@@ -462,6 +472,41 @@
   struct internal_reloc *internal_relocs;
 };
 
+/* Most COFF variants have no way to record the alignment of a
+   section.  This struct is used to set a specific alignment based on
+   the name of the section.  */
+
+struct coff_section_alignment_entry
+{
+  /* The section name.  */
+  const char *name;
+
+  /* This is either (unsigned int) -1, indicating that the section
+     name must match exactly, or it is the number of letters which
+     must match at the start of the name.  */
+  unsigned int comparison_length;
+
+  /* These macros may be used to fill in the first two fields in a
+     structure initialization.  */
+#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
+#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
+
+  /* Only use this entry if the default section alignment for this
+     target is at least that much (as a power of two).  If this field
+     is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored.  */
+  unsigned int default_alignment_min;
+
+  /* Only use this entry if the default section alignment for this
+     target is no greater than this (as a power of two).  If this
+     field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored.  */
+  unsigned int default_alignment_max;
+
+#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
+
+  /* The desired alignment for this section (as a power of two).  */
+  unsigned int alignment_power;
+};
+
 extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 extern boolean _bfd_coff_link_hash_table_init
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index c418a4d..bee4ce9 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -1,5 +1,5 @@
 /* BFD COFF object file private structure.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -56,7 +56,7 @@
   file_ptr sym_filepos;
 
   struct coff_ptr_struct *raw_syments;
-  unsigned int raw_syment_count;
+  unsigned long raw_syment_count;
 
   /* These are only valid once writing has begun */
   long int relocbase;
@@ -97,6 +97,9 @@
   /* Used by coff_find_nearest_line.  */
   PTR line_info;
 
+  /* The timestamp from the COFF file header.  */
+  long timestamp;
+
   /* Copy of some of the f_flags bits in the COFF filehdr structure,
      used by ARM code.  */
   flagword flags;
@@ -213,12 +216,14 @@
 #define xcoff_section_data(abfd, sec) \
   ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
 
-/* Tdata for sections in PEI image files.  */
+/* Tdata for sections in PE files.  */
 
 struct pei_section_tdata
 {
   /* The virtual size of the section.  */
   bfd_size_type virt_size;
+  /* The PE section flags.  */
+  long pe_flags;
 };
 
 /* An accessor macro for the pei_section_tdata structure.  */
@@ -249,6 +254,11 @@
 
   /* Pointer to array of auxiliary entries, if any.  */
   union internal_auxent *aux;
+
+  /* Flag word; legal values follow.  */
+  unsigned short coff_link_hash_flags;
+  /* Symbol is a PE section symbol.  */
+#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
 };
 
 /* COFF linker hash table.  */
@@ -462,6 +472,41 @@
   struct internal_reloc *internal_relocs;
 };
 
+/* Most COFF variants have no way to record the alignment of a
+   section.  This struct is used to set a specific alignment based on
+   the name of the section.  */
+
+struct coff_section_alignment_entry
+{
+  /* The section name.  */
+  const char *name;
+
+  /* This is either (unsigned int) -1, indicating that the section
+     name must match exactly, or it is the number of letters which
+     must match at the start of the name.  */
+  unsigned int comparison_length;
+
+  /* These macros may be used to fill in the first two fields in a
+     structure initialization.  */
+#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
+#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
+
+  /* Only use this entry if the default section alignment for this
+     target is at least that much (as a power of two).  If this field
+     is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored.  */
+  unsigned int default_alignment_min;
+
+  /* Only use this entry if the default section alignment for this
+     target is no greater than this (as a power of two).  If this
+     field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored.  */
+  unsigned int default_alignment_max;
+
+#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
+
+  /* The desired alignment for this section (as a power of two).  */
+  unsigned int alignment_power;
+};
+
 extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 extern boolean _bfd_coff_link_hash_table_init
@@ -581,6 +626,22 @@
     /* Have the line numbers been relocated yet ? */
 boolean done_lineno;
 } coff_symbol_type;
+ /* COFF symbol classifications.  */
+
+enum coff_symbol_classification
+{
+   /* Global symbol.  */
+  COFF_SYMBOL_GLOBAL,
+   /* Common symbol.  */
+  COFF_SYMBOL_COMMON,
+   /* Undefined symbol.  */
+  COFF_SYMBOL_UNDEFINED,
+   /* Local symbol.  */
+  COFF_SYMBOL_LOCAL,
+   /* PE section symbol.  */
+  COFF_SYMBOL_PE_SECTION
+};
+
 typedef struct
 {
   void (*_bfd_coff_swap_aux_in) PARAMS ((
@@ -648,6 +709,7 @@
  unsigned int _bfd_auxesz;
  unsigned int _bfd_relsz;
  unsigned int _bfd_linesz;
+ unsigned int _bfd_filnmlen;
  boolean _bfd_coff_long_filenames;
  boolean _bfd_coff_long_section_names;
  unsigned int _bfd_coff_default_section_alignment_power;
@@ -680,7 +742,8 @@
  flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
        bfd     *abfd,
        PTR     internal_scnhdr,
-       const char *name));
+       const char *name,
+       asection *section));
  void (*_bfd_set_alignment_hook) PARAMS ((
        bfd     *abfd,
        asection *sec,
@@ -717,7 +780,7 @@
        arelent *r,
        unsigned int shrink,
        struct bfd_link_info *link_info));
- boolean (*_bfd_coff_sym_is_global) PARAMS ((
+ enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
        bfd *abfd,
        struct internal_syment *));
  boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
@@ -808,6 +871,7 @@
 #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
 #define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
 #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
+#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
 #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
 #define bfd_coff_long_section_names(abfd) \
         (coff_backend_info (abfd)->_bfd_coff_long_section_names)
@@ -833,8 +897,9 @@
 #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
         ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
 
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
-        ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
+#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
+        ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
+         (abfd, scnhdr, name, section))
 
 #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
         ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
@@ -857,8 +922,8 @@
         ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
          (abfd, section, reloc, shrink, link_info))
 
-#define bfd_coff_sym_is_global(abfd, sym)\
-        ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
+#define bfd_coff_classify_symbol(abfd, sym)\
+        ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
          (abfd, sym))
 
 #define bfd_coff_compute_section_file_positions(abfd)\
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index ad269a5..4561805 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -1,5 +1,5 @@
 /* BFD ECOFF object file private structure.
-   Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -341,7 +341,7 @@
   ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
 extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
 extern flagword _bfd_ecoff_styp_to_sec_flags
-  PARAMS ((bfd *abfd, PTR hdr, const char *name));
+  PARAMS ((bfd *abfd, PTR hdr, const char *name, asection *section));
 extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
 
 /* ECOFF auxiliary information swapping routines.  These are the same
diff --git a/bfd/libhppa.h b/bfd/libhppa.h
index 35b40ef..c32eabe 100644
--- a/bfd/libhppa.h
+++ b/bfd/libhppa.h
@@ -1,5 +1,6 @@
 /* HP PA-RISC SOM object file format:  definitions internal to BFD.
-   Copyright (C) 1990, 91, 92, 93, 94 , 95, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 98, 1999
+   Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -51,6 +52,10 @@
 static INLINE void dis_assemble_17 (unsigned int, unsigned int *,
 				    unsigned int *, unsigned int *)
      __attribute__ ((__unused__));
+static INLINE void dis_assemble_22 (unsigned int, unsigned int *,
+				    unsigned int *, unsigned int *,
+				    unsigned int *)
+     __attribute__ ((__unused__));
 static INLINE unsigned long assemble_21 (unsigned int)
      __attribute ((__unused__));
 static INLINE void dis_assemble_21 (unsigned int, unsigned int *)
@@ -67,7 +72,7 @@
 static INLINE unsigned long hppa_field_adjust (unsigned long, unsigned long,
 					       unsigned short)
      __attribute__ ((__unused__));
-static INLINE char bfd_hppa_insn2fmt (unsigned long)
+static INLINE int bfd_hppa_insn2fmt (unsigned long)
      __attribute__ ((__unused__));
 static INLINE  unsigned long hppa_rebuild_insn (bfd *, unsigned long,
 						unsigned long, unsigned long)
@@ -99,7 +104,9 @@
     R_HPPA_RPSEL = 0xe,
     R_HPPA_TSEL = 0xf,
     R_HPPA_LTSEL = 0x10,
-    R_HPPA_RTSEL = 0x11
+    R_HPPA_RTSEL = 0x11,
+    R_HPPA_LTPSEL = 0x12,
+    R_HPPA_RTPSEL = 0x13
   };
 
 /* /usr/include/reloc.h defines these to constants.  We want to use
@@ -152,7 +159,9 @@
     e_rpsel = R_HPPA_RPSEL,
     e_tsel = R_HPPA_TSEL,
     e_ltsel = R_HPPA_LTSEL,
-    e_rtsel = R_HPPA_RTSEL
+    e_rtsel = R_HPPA_RTSEL,
+    e_ltpsel = R_HPPA_LTPSEL,
+    e_rtpsel = R_HPPA_RTPSEL
   };
 
 enum hppa_reloc_expr_type
@@ -192,7 +201,7 @@
 #define HPPA_R_ARG_RELOC(a)	(((a) >> 22) & 0x3FF)
 #define HPPA_R_CONSTANT(a)	((((int)(a)) << 10) >> 10)
 #define HPPA_R_ADDEND(r,c)	(((r) << 22) + ((c) & 0x3FFFFF))
-#define HPPA_WIDE               (0) /* PSW W-bit, need to check! FIXME */
+#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
@@ -202,17 +211,17 @@
 #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 GET_BIT(X, WHICH) \
+  GET_FIELD (X, WHICH, WHICH)
 
-#define MASK( SIZE ) \
+#define MASK(SIZE) \
   (~((-1) << SIZE))
   
-#define CATENATE( X, XSIZE, Y, YSIZE ) \
-  (((X & MASK( XSIZE )) << YSIZE) | (Y & MASK( YSIZE )))
+#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)
+#define ELEVEN(X) \
+  CATENATE (GET_BIT (X, 10), 1, GET_FIELD (X, 0, 9), 10)
   
 /* Some functions to manipulate PA instructions.  */
 
@@ -233,7 +242,7 @@
 assemble_3 (x)
      unsigned int x;
 {
-  return (((x & 1) << 2) | ((x & 6) >> 1)) & 7;
+  return CATENATE (GET_BIT (x, 2), 1, GET_FIELD (x, 0, 1), 2);
 }
 
 static INLINE void
@@ -244,7 +253,7 @@
   *r = (((x & 4) >> 2) | ((x & 3) << 1)) & 7;
 }
 
-static INLINE unsigned int      /* PA 2.0 */
+static INLINE unsigned int
 assemble_6 (x, y)
      unsigned int x, y;
 {
@@ -255,9 +264,8 @@
 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);
+  return CATENATE (CATENATE (y, 1, GET_BIT (x, 10), 1), 2,
+ 		   GET_FIELD (x, 0, 9), 9);
 }
 
 static INLINE void
@@ -269,53 +277,40 @@
   *x = ((as12 & 0x3ff) << 1) | ((as12 & 0x400) >> 10);
 }
 
-static INLINE unsigned long     /* PA 2.0 */
+static INLINE unsigned long
 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 );
-  }
+  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 );
+  return sign_extend (temp, 16);
 }
 
 
-static INLINE unsigned long     /* PA 2.0 */
+static INLINE unsigned long
 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);
+  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 );
+  return sign_extend ((temp << 2), 16);
 }
 
 static INLINE unsigned long
@@ -323,12 +318,9 @@
      unsigned int x, y, z;
 {
   unsigned long temp;
-  int           q;
 
-  temp = CATENATE( CATENATE( z, q,
-                             x, q), q,
-                   CATENATE( GET_BIT( y, 1 ), 1,
-                             GET_FIELD( y, 0, 9 ), 10), 11);
+  temp = CATENATE (CATENATE (z, 1, x, 5), 6,
+		   CATENATE (GET_BIT (y, 10), 1, GET_FIELD (y, 0, 9), 10), 11);
   
   return temp;
 }
@@ -344,6 +336,18 @@
   *y = (((as17 & 0x00400) >> 10) | ((as17 & 0x3ff) << 1)) & 0x7ff;
 }
 
+static INLINE void
+dis_assemble_22 (as22, a, b, c, d)
+     unsigned int as22;
+     unsigned int *a, *b, *c, *d;
+{
+
+  *d = (as22 & 0x200000) >> 21;
+  *a = (as22 & 0x1f0000) >> 16;
+  *b = (as22 & 0x0f800) >> 11;
+  *c = (((as22 & 0x00400) >> 10) | ((as22 & 0x3ff) << 1)) & 0x7ff;
+}
+
 static INLINE unsigned long
 assemble_21 (x)
      unsigned int x;
@@ -358,18 +362,16 @@
   return temp & 0x1fffff;
 }
 
-static INLINE unsigned long     /* PA 2.0 */
+static INLINE unsigned long
 assemble_22 (a,b,c,d)
      unsigned int a,b,c,d;
 {
   unsigned long temp;
   
-  temp = CATENATE( CATENATE( d, 1,
-                             a, 5 ), 6,
-                   CATENATE( b, 5,
-                             ELEVEN( c ), 11 ), 16 );
+  temp = CATENATE (CATENATE (d, 1, a, 5), 6,
+		   CATENATE (b, 5, ELEVEN (c), 11), 16);
 
-  return sign_extend( temp, 22 );
+  return sign_extend (temp, 22);
 }
 
 static INLINE void
@@ -458,7 +460,7 @@
 {
   switch (r_field)
     {
-    case e_fsel:		/* F  : no change                      */
+    case e_fsel:		/* F  : no change		      */
     case e_nsel:		/* N  : no change		       */
       value += constant_value;
       break;
@@ -471,7 +473,7 @@
       value = (value & 0xfffff800) >> 11;
       break;
 
-    case e_rssel:		/* RS : Sign extend from bit 21        */
+    case e_rssel:		/* RS : Sign extend from bit 21	*/
       value += constant_value;
       if (value & 0x00000400)
 	value |= 0xfffff800;
@@ -485,19 +487,19 @@
       value = (value & 0xfffff800) >> 11;
       break;
 
-    case e_rsel:		/* R  : Set bits 0-20 to zero          */
+    case e_rsel:		/* R  : Set bits 0-20 to zero	  */
       value += constant_value;
       value = value & 0x7ff;
       break;
 
     case e_ldsel:		/* LD : Add 0x800, arithmetic shift
-				   right 11 bits                  */
+				   right 11 bits		  */
       value += constant_value;
       value += 0x800;
       value = (value & 0xfffff800) >> 11;
       break;
 
-    case e_rdsel:		/* RD : Set bits 0-20 to one           */
+    case e_rdsel:		/* RD : Set bits 0-20 to one	   */
       value += constant_value;
       value |= 0xfffff800;
       break;
@@ -562,17 +564,26 @@
 #define BLE	0x39
 #define BE	0x38
 
+#define CMPBDT	0x27
+#define CMPBDF	0x2f
+#define CMPIBD	0x3b
+#define LDD	0x14
+#define STD	0x1c
+#define LDWL	0x17
+#define STWL	0x1f
+#define FDLW    0x16
+#define FSTW    0x1e
   
 /* Given a machine instruction, return its format.
 
    FIXME:  opcodes which do not map to a known format
    should return an error of some sort.  */
 
-static INLINE char
+static INLINE int
 bfd_hppa_insn2fmt (insn)
      unsigned long insn;
 {
-  char fmt = -1;
+  int fmt = -1;
   unsigned char op = get_opcode (insn);
   
   switch (op)
@@ -594,6 +605,9 @@
     case ADDIBF:
     case BVB:
     case BB:
+    case CMPBDT:
+    case CMPBDF:
+    case CMPIBD:
       fmt = 12;
       break;
     case LDO:
@@ -607,9 +621,24 @@
     case STWM:
       fmt = 14;
       break;
+    case LDWL:
+    case STWL:
+    case FDLW:
+    case FSTW:
+      /* 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 10a format.  */
+      fmt = -11;
+      break;
+    case LDD:
+    case STD:
+      fmt = 10;
+      break;
     case BL:
     case BE:
     case BLE:
+      if ((insn & 0x00008000) == 0x00008000)
+	return 22;
       fmt = 17;
       break;
     case LDIL:
@@ -629,7 +658,7 @@
    
 static INLINE unsigned long
 hppa_rebuild_insn (abfd, insn, value, r_format)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      unsigned long insn;
      unsigned long value;
      unsigned long r_format;
diff --git a/bfd/libpei.h b/bfd/libpei.h
new file mode 100644
index 0000000..88f9f73
--- /dev/null
+++ b/bfd/libpei.h
@@ -0,0 +1,254 @@
+/* Support for the generic parts of PE/PEI; common header information.
+   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Written by Cygnus Solutions.
+
+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.  */
+
+/*
+Most of this hacked by  Steve Chamberlain,
+			sac@cygnus.com
+
+PE/PEI rearrangement (and code added): Donn Terry
+				       Softway Systems, Inc.
+*/
+
+/* Hey look, some documentation [and in a place you expect to find it]!
+
+   The main reference for the pei format is "Microsoft Portable Executable
+   and Common Object File Format Specification 4.1".  Get it if you need to
+   do some serious hacking on this code.
+
+   Another reference:
+   "Peering Inside the PE: A Tour of the Win32 Portable Executable
+   File Format", MSJ 1994, Volume 9.
+
+   The *sole* difference between the pe format and the pei format is that the
+   latter has an MSDOS 2.0 .exe header on the front that prints the message
+   "This app must be run under Windows." (or some such).
+   (FIXME: Whether that statement is *really* true or not is unknown.
+   Are there more subtle differences between pe and pei formats?
+   For now assume there aren't.  If you find one, then for God sakes
+   document it here!)
+
+   The Microsoft docs use the word "image" instead of "executable" because
+   the former can also refer to a DLL (shared library).  Confusion can arise
+   because the `i' in `pei' also refers to "image".  The `pe' format can
+   also create images (i.e. executables), it's just that to run on a win32
+   system you need to use the pei format.
+
+   FIXME: Please add more docs here so the next poor fool that has to hack
+   on this code has a chance of getting something accomplished without
+   wasting too much time.
+*/
+
+#ifndef GET_FCN_LNNOPTR
+#define GET_FCN_LNNOPTR(abfd, ext) \
+     bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#endif
+
+#ifndef GET_FCN_ENDNDX
+#define GET_FCN_ENDNDX(abfd, ext)  \
+	bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#endif
+
+#ifndef PUT_FCN_LNNOPTR
+#define PUT_FCN_LNNOPTR(abfd, in, ext)  bfd_h_put_32(abfd,  in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#endif
+#ifndef PUT_FCN_ENDNDX
+#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#endif
+#ifndef GET_LNSZ_LNNO
+#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
+#endif
+#ifndef GET_LNSZ_SIZE
+#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
+#endif
+#ifndef PUT_LNSZ_LNNO
+#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
+#endif
+#ifndef PUT_LNSZ_SIZE
+#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
+#endif
+#ifndef GET_SCN_SCNLEN
+#define GET_SCN_SCNLEN(abfd,  ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
+#endif
+#ifndef GET_SCN_NRELOC
+#define GET_SCN_NRELOC(abfd,  ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
+#endif
+#ifndef GET_SCN_NLINNO
+#define GET_SCN_NLINNO(abfd, ext)  bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
+#endif
+#ifndef PUT_SCN_SCNLEN
+#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
+#endif
+#ifndef PUT_SCN_NRELOC
+#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
+#endif
+#ifndef PUT_SCN_NLINNO
+#define PUT_SCN_NLINNO(abfd,in, ext)  bfd_h_put_16(abfd,in, (bfd_byte  *) ext->x_scn.x_nlinno)
+#endif
+#ifndef GET_LINENO_LNNO
+#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#endif
+#ifndef PUT_LINENO_LNNO
+#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
+#endif
+
+/* The f_symptr field in the filehdr is sometimes 64 bits.  */
+#ifndef GET_FILEHDR_SYMPTR
+#define GET_FILEHDR_SYMPTR bfd_h_get_32
+#endif
+#ifndef PUT_FILEHDR_SYMPTR
+#define PUT_FILEHDR_SYMPTR bfd_h_put_32
+#endif
+
+/* Some fields in the aouthdr are sometimes 64 bits.  */
+#ifndef GET_AOUTHDR_TSIZE
+#define GET_AOUTHDR_TSIZE bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_TSIZE
+#define PUT_AOUTHDR_TSIZE bfd_h_put_32
+#endif
+#ifndef GET_AOUTHDR_DSIZE
+#define GET_AOUTHDR_DSIZE bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_DSIZE
+#define PUT_AOUTHDR_DSIZE bfd_h_put_32
+#endif
+#ifndef GET_AOUTHDR_BSIZE
+#define GET_AOUTHDR_BSIZE bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_BSIZE
+#define PUT_AOUTHDR_BSIZE bfd_h_put_32
+#endif
+#ifndef GET_AOUTHDR_ENTRY
+#define GET_AOUTHDR_ENTRY bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_ENTRY
+#define PUT_AOUTHDR_ENTRY bfd_h_put_32
+#endif
+#ifndef GET_AOUTHDR_TEXT_START
+#define GET_AOUTHDR_TEXT_START bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_TEXT_START
+#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
+#endif
+#ifndef GET_AOUTHDR_DATA_START
+#define GET_AOUTHDR_DATA_START bfd_h_get_32
+#endif
+#ifndef PUT_AOUTHDR_DATA_START
+#define PUT_AOUTHDR_DATA_START bfd_h_put_32
+#endif
+
+/* Some fields in the scnhdr are sometimes 64 bits.  */
+#ifndef GET_SCNHDR_PADDR
+#define GET_SCNHDR_PADDR bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_PADDR
+#define PUT_SCNHDR_PADDR bfd_h_put_32
+#endif
+#ifndef GET_SCNHDR_VADDR
+#define GET_SCNHDR_VADDR bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_VADDR
+#define PUT_SCNHDR_VADDR bfd_h_put_32
+#endif
+#ifndef GET_SCNHDR_SIZE
+#define GET_SCNHDR_SIZE bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_SIZE
+#define PUT_SCNHDR_SIZE bfd_h_put_32
+#endif
+#ifndef GET_SCNHDR_SCNPTR
+#define GET_SCNHDR_SCNPTR bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_SCNPTR
+#define PUT_SCNHDR_SCNPTR bfd_h_put_32
+#endif
+#ifndef GET_SCNHDR_RELPTR
+#define GET_SCNHDR_RELPTR bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_RELPTR
+#define PUT_SCNHDR_RELPTR bfd_h_put_32
+#endif
+#ifndef GET_SCNHDR_LNNOPTR
+#define GET_SCNHDR_LNNOPTR bfd_h_get_32
+#endif
+#ifndef PUT_SCNHDR_LNNOPTR
+#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
+#endif
+
+/* These functions are architecture dependent, and are in peicode.h:
+   coff_swap_reloc_in
+   int coff_swap_reloc_out
+   coff_swap_filehdr_in
+   coff_swap_scnhdr_in
+   pe_mkobject
+   pe_mkobject_hook  */
+
+/* The functions described below are common across all PE/PEI
+   implementations architecture types, and actually appear in
+   peigen.c.  */
+
+void _bfd_pei_swap_sym_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_sym_in _bfd_pei_swap_sym_in
+
+unsigned int _bfd_pei_swap_sym_out PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_sym_out _bfd_pei_swap_sym_out
+
+void _bfd_pei_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+#define coff_swap_aux_in _bfd_pei_swap_aux_in
+
+unsigned int _bfd_pei_swap_aux_out \
+  PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+#define coff_swap_aux_out _bfd_pei_swap_aux_out
+
+void _bfd_pei_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_lineno_in _bfd_pei_swap_lineno_in
+
+unsigned int _bfd_pei_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_lineno_out _bfd_pei_swap_lineno_out
+
+void _bfd_pei_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
+
+unsigned int _bfd_pei_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
+#define coff_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
+
+unsigned int _bfd_pei_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
+#define coff_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
+
+boolean _bfd_pe_print_private_bfd_data_common PARAMS ((bfd *, PTR));
+
+boolean _bfd_pe_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
+
+void _bfd_pe_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
+
+boolean _bfd_pei_final_link_postscript
+  PARAMS ((bfd *, struct coff_final_link_info *));
+
+#ifndef coff_final_link_postscript
+#define coff_final_link_postscript _bfd_pei_final_link_postscript
+#endif
+/* The following are needed only for ONE of pe or pei, but don't
+   otherwise vary; peicode.h fixes up ifdefs but we provide the
+   prototype.  */
+
+unsigned int _bfd_pe_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
+unsigned int _bfd_pei_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
+boolean _bfd_pe_bfd_copy_private_section_data
+  PARAMS ((bfd *, asection *, bfd *, asection *));
diff --git a/bfd/linker.c b/bfd/linker.c
index 947514c..6e9ee65 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1,5 +1,6 @@
 /* linker.c -- BFD linker routines
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -74,7 +75,7 @@
 @cindex target vector (_bfd_link_hash_table_create)
 	The linker routines must create a hash table, which must be
 	derived from <<struct bfd_link_hash_table>> described in
-	<<bfdlink.c>>.  @xref{Hash Tables} for information on how to
+	<<bfdlink.c>>.  @xref{Hash Tables}, for information on how to
 	create a derived hash table.  This entry point is called using
 	the target vector of the linker output file.
 
@@ -1748,8 +1749,8 @@
 	case MDEF:
 	  /* Handle a multiple definition.  */
 	  {
-	    asection *msec;
-	    bfd_vma mval;
+	    asection *msec = NULL;
+	    bfd_vma mval = 0;
 
 	    switch (h->type)
 	      {
@@ -2523,7 +2524,9 @@
 	  break;
 	}
       ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
-				     (file_ptr) link_order->offset, size);
+				     (file_ptr) 
+                                     (link_order->offset *
+                                      bfd_octets_per_byte (abfd)), size);
       free (buf);
       if (! ok)
 	return false;
@@ -2591,7 +2594,9 @@
     case bfd_data_link_order:
       return bfd_set_section_contents (abfd, sec,
 				       (PTR) link_order->u.data.contents,
-				       (file_ptr) link_order->offset,
+				       (file_ptr) 
+                                       (link_order->offset *
+                                        bfd_octets_per_byte (abfd)),
 				       link_order->size);
     }
 }
@@ -2602,7 +2607,7 @@
 static boolean
 default_fill_link_order (abfd, info, sec, link_order)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      asection *sec;
      struct bfd_link_order *link_order;
 {
@@ -2625,7 +2630,9 @@
   for (i = 1; i < size; i += 2)
     space[i] = fill;
   result = bfd_set_section_contents (abfd, sec, space,
-				     (file_ptr) link_order->offset,
+				     (file_ptr) 
+                                     (link_order->offset * 
+                                      bfd_octets_per_byte (abfd)),
 				     link_order->size);
   free (space);
   return result;
@@ -2742,7 +2749,10 @@
   /* Output the section contents.  */
   if (! bfd_set_section_contents (output_bfd, output_section,
 				  (PTR) new_contents,
-				  link_order->offset, link_order->size))
+				  (file_ptr)
+                                  (link_order->offset * 
+                                   bfd_octets_per_byte (output_bfd)), 
+                                  link_order->size))
     goto error_return;
 
   if (contents != NULL)
@@ -2797,8 +2807,8 @@
 
 boolean
 _bfd_generic_link_split_section (abfd, sec)
-     bfd *abfd;
-     asection *sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
 {
   return false;
 }
diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c
index c8f47a8..2251757 100644
--- a/bfd/m68klinux.c
+++ b/bfd/m68klinux.c
@@ -1,5 +1,6 @@
 /* BFD back-end for linux flavored m68k a.out binaries.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -301,7 +302,7 @@
 static boolean
 linux_link_create_dynamic_sections (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   flagword flags;
   register asection *s;
diff --git a/bfd/makefile.dos b/bfd/makefile.dos
deleted file mode 100644
index 8a22c6a..0000000
--- a/bfd/makefile.dos
+++ /dev/null
@@ -1,49 +0,0 @@
-CFLAGS=-O2
-
-.c.o :
-	gcc $(CFLAGS) -I. -I../include -c $<
-
-all : libbfd.a
-
-targets.o : targets.c
-	gcc $(CFLAGS) -I. -I../include -DSELECT_VECS=&go32coff_vec,&i386aout_vec -DDEFAULT_VECTOR=go32coff_vec -c $*.c
-
-archures.o : archures.c
-	gcc $(CFLAGS) -I. -I../include -DSELECT_ARCHITECTURES=bfd_i386_arch -c $*.c
-
-OBJS = \
-	libbfd.o \
-	opncls.o \
-	bfd.o \
-	archive.o \
-	targets.o \
-	cache.o \
-	archures.o \
-	corefile.o \
-	section.o \
-	format.o \
-	syms.o \
-	reloc.o \
-	init.o \
-	coffgen.o \
-	srec.o \
-	hash.o \
-	linker.o \
-	ecoff.o \
-	ecofflink.o \
-	elf.o \
-	aout32.o \
-	stab-sym.o \
-	i386aout.o \
-	cpu-i386.o \
-	coff-go32.o \
-	cofflink.o \
-	elf32.o \
-	binary.o \
-	tekhex.o \
-	$E
-
-libbfd.a : $(OBJS)
-	-rm libbfd.a
-	ar rvs libbfd.a $(OBJS)
-	ranlib libbfd.a
diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c
index e7ba68d..7a680fb 100644
--- a/bfd/mipsbsd.c
+++ b/bfd/mipsbsd.c
@@ -1,5 +1,5 @@
 /* BFD backend for MIPS BSD (a.out) binaries.
-   Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation, Inc.
    Written by Ralph Campbell.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -187,10 +187,10 @@
  */
 static bfd_reloc_status_type
 mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      struct symbol_cache_entry *symbol;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
 {
@@ -240,13 +240,13 @@
 static bfd_reloc_status_type
 mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
 		 output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol;
-     PTR data;
-     asection *input_section;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
  
@@ -389,6 +389,8 @@
   0				/* finish_dynamic_link */
 };
 
+extern const bfd_target aout_mips_big_vec;
+
 const bfd_target aout_mips_little_vec =
 {
   "a.out-mips-little",		/* name */
@@ -425,7 +427,9 @@
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  (PTR) MY_backend_data,
+  & aout_mips_big_vec,
+  
+  (PTR) MY_backend_data
 };
 
 const bfd_target aout_mips_big_vec =
@@ -464,5 +468,7 @@
      BFD_JUMP_TABLE_LINK (MY),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  (PTR) MY_backend_data,
+  & aout_mips_little_vec,
+  
+  (PTR) MY_backend_data
 };
diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c
index 21b184d..828c2a1 100644
--- a/bfd/netbsd-core.c
+++ b/bfd/netbsd-core.c
@@ -247,5 +247,7 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/netbsd.h b/bfd/netbsd.h
index a5482f0..760ed95 100644
--- a/bfd/netbsd.h
+++ b/bfd/netbsd.h
@@ -1,5 +1,5 @@
 /* BFD back-end definitions used by all NetBSD targets.
-   Copyright (C) 1990, 91, 92, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 94, 95, 96, 97, 98, 2000
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -91,11 +91,7 @@
       NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
     }
 
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE(abfd);
-#else
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
 
   /* Magic number, maestro, please!  */
   switch (bfd_get_arch(abfd)) {
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 6f1d47d..5c1e255 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -55,6 +55,10 @@
    There are two such structures here:  one for big-endian machines and
    one for little-endian machines.   */
 
+/* Forward declaration for use when initialising alternative_target field.  */
+#ifdef TARGET_LITTLE_SYM
+extern const bfd_target TARGET_LITTLE_SYM;
+#endif
 
 #ifdef TARGET_BIG_SYM
 const bfd_target TARGET_BIG_SYM =
@@ -137,6 +141,13 @@
   BFD_JUMP_TABLE_LINK (nlm),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_LITTLE_SYM
+  & TARGET_LITTLE_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
@@ -223,6 +234,13 @@
   BFD_JUMP_TABLE_LINK (nlm),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  /* Alternative endian target.  */
+#ifdef TARGET_BIG_SYM
+  & TARGET_BIG_SYM,
+#else
+  NULL,
+#endif
+  
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c
index ecf2de8..5af4834 100644
--- a/bfd/nlm32-ppc.c
+++ b/bfd/nlm32-ppc.c
@@ -1,5 +1,5 @@
 /* Support for 32-bit PowerPC NLM (NetWare Loadable Module)
-   Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -639,11 +639,11 @@
 
 static boolean
 nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count)
-     bfd *abfd;
-     asection *sec;
-     PTR data;
-     bfd_vma offset;
-     bfd_size_type count;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     bfd_size_type count ATTRIBUTE_UNUSED;
 {
   return true;
 }
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
index 5963adb..ab4d80a 100644
--- a/bfd/nlm32-sparc.c
+++ b/bfd/nlm32-sparc.c
@@ -1,5 +1,5 @@
 /* Support for 32-bit SPARC NLM (NetWare Loadable Module)
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -118,7 +118,7 @@
 static boolean
 nlm_sparc_read_reloc (abfd, sym, secp, rel)
      bfd *abfd;
-     nlmNAME(symbol_type) *sym;
+     nlmNAME(symbol_type) *sym ATTRIBUTE_UNUSED;
      asection **secp;
      arelent *rel;
 {
@@ -232,11 +232,11 @@
 
 static boolean
 nlm_sparc_mangle_relocs (abfd, sec, data, offset, count)
-     bfd *abfd;
-     asection *sec;
-     PTR data;
-     bfd_vma offset;
-     bfd_size_type count;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     bfd_size_type count ATTRIBUTE_UNUSED;
 {
   return true;
 }
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
index 63ac0c3..ad1a2f8 100644
--- a/bfd/nlmcode.h
+++ b/bfd/nlmcode.h
@@ -1,5 +1,5 @@
 /* NLM (NetWare Loadable Module) executable support for BFD.
-   Copyright (C) 1993, 94, 95, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 98, 1999 Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, using ELF support as the
    template.
@@ -971,7 +971,7 @@
 
 void
 nlm_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -982,7 +982,7 @@
 
 void
 nlm_print_symbol (abfd, afile, symbol, how)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
diff --git a/bfd/oasys.c b/bfd/oasys.c
index b51560e..e69053b 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1,5 +1,5 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
 
@@ -515,7 +515,7 @@
 
 static void
 oasys_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -526,7 +526,7 @@
 
 static void
 oasys_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -844,10 +844,10 @@
 
 long
 oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      sec_ptr section;
      arelent **relptr;
-     asymbol **symbols;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
   unsigned int reloc_count = 0;
   oasys_reloc_type *src = (oasys_reloc_type *) (section->relocation);
@@ -1403,13 +1403,13 @@
 			 filename_ptr,
 			 functionname_ptr,
 			 line_ptr)
-     bfd *abfd;
-     asection *section;
-     asymbol **symbols;
-     bfd_vma offset;
-     char **filename_ptr;
-     char **functionname_ptr;
-     unsigned int *line_ptr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     char **filename_ptr ATTRIBUTE_UNUSED;
+     char **functionname_ptr ATTRIBUTE_UNUSED;
+     unsigned int *line_ptr ATTRIBUTE_UNUSED;
 {
   return false;
 
@@ -1436,8 +1436,8 @@
 
 static int
 oasys_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -1531,5 +1531,7 @@
   BFD_JUMP_TABLE_LINK (oasys),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/osf-core.c b/bfd/osf-core.c
index 671f4af..4f4fc12 100644
--- a/bfd/osf-core.c
+++ b/bfd/osf-core.c
@@ -250,5 +250,7 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/pc532-mach.c b/bfd/pc532-mach.c
index 73f4ac4..3b77d5d 100644
--- a/bfd/pc532-mach.c
+++ b/bfd/pc532-mach.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Mach3/532 a.out-ish binaries.
-   Copyright (C) 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1992, 1994, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -92,11 +92,7 @@
   struct external_exec exec_bytes;
   struct internal_exec *execp = exec_hdr (abfd);
   
-#if CHOOSE_RELOC_SIZE
-  CHOOSE_RELOC_SIZE(abfd);
-#else
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
   
   BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k);
   switch (bfd_get_mach (abfd))
diff --git a/bfd/pe-arm.c b/bfd/pe-arm.c
index d315888..6c6b659 100644
--- a/bfd/pe-arm.c
+++ b/bfd/pe-arm.c
@@ -31,4 +31,17 @@
 #define PCRELOFFSET          true
 #define COFF_LONG_SECTION_NAMES
 
+#ifndef bfd_arm_allocate_interworking_sections 
+#define bfd_arm_allocate_interworking_sections \
+	bfd_arm_pe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+	bfd_arm_pe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+	bfd_arm_pe_process_before_allocation
+#endif
+	
+#ifdef ARM_WINCE
+#define TARGET_UNDERSCORE 0
+#endif
+
 #include "coff-arm.c"
diff --git a/bfd/pe-i386.c b/bfd/pe-i386.c
index bcdbe44..a2eb784 100644
--- a/bfd/pe-i386.c
+++ b/bfd/pe-i386.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 386 PECOFF files.
-   Copyright 1995 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -27,5 +27,12 @@
 #define PCRELOFFSET true
 #define TARGET_UNDERSCORE '_'
 #define COFF_LONG_SECTION_NAMES
+#define COFF_LONG_FILENAMES
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
 
 #include "coff-i386.c"
diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c
new file mode 100644
index 0000000..9b89369
--- /dev/null
+++ b/bfd/pe-mips.c
@@ -0,0 +1,998 @@
+/* BFD back-end for MIPS PE COFF files.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+   Modified from coff-i386.c by DJ Delorie, dj@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.  */
+
+#define COFF_WITH_PE
+#define COFF_LONG_SECTION_NAMES
+#define PCRELOFFSET true
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+#include "coff/mipspe.h"
+
+#include "coff/internal.h"
+
+#include "coff/pe.h"
+
+#include "libcoff.h"
+
+static bfd_reloc_status_type coff_mips_reloc 
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *coff_mips_rtype_to_howto
+  PARAMS ((bfd *, asection *, struct internal_reloc *,
+	   struct coff_link_hash_entry *, struct internal_syment *,
+
+	   bfd_vma *));
+#if 0
+static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
+					      struct internal_reloc *));
+static void mips_ecoff_swap_reloc_out PARAMS ((bfd *,
+					       const struct internal_reloc *,
+					       PTR));
+static void mips_adjust_reloc_in PARAMS ((bfd *,
+					  const struct internal_reloc *,
+					  arelent *));
+static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
+					   struct internal_reloc *));
+#endif
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+/* The page size is a guess based on ELF.  */
+
+#define COFF_PAGE_SIZE 0x1000
+
+/* For some reason when using mips COFF the value stored in the .text
+   section for a reference to a common symbol is the value itself plus
+   any desired offset.  Ian Taylor, Cygnus Support.  */
+
+/* If we are producing relocateable output, we need to do some
+   adjustments to the object file that are not done by the
+   bfd_perform_relocation function.  This function is called by every
+   reloc type to make any required adjustments.  */
+
+static bfd_reloc_status_type
+coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
+		 error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  symvalue diff;
+
+  if (output_bfd == (bfd *) NULL)
+    return bfd_reloc_continue;
+
+  if (bfd_is_com_section (symbol->section))
+    {
+#ifndef COFF_WITH_PE
+      /* We are relocating a common symbol.  The current value in the
+	 object file is ORIG + OFFSET, where ORIG is the value of the
+	 common symbol as seen by the object file when it was compiled
+	 (this may be zero if the symbol was undefined) and OFFSET is
+	 the offset into the common symbol (normally zero, but may be
+	 non-zero when referring to a field in a common structure).
+	 ORIG is the negative of reloc_entry->addend, which is set by
+	 the CALC_ADDEND macro below.  We want to replace the value in
+	 the object file with NEW + OFFSET, where NEW is the value of
+	 the common symbol which we are going to put in the final
+	 object file.  NEW is symbol->value.  */
+      diff = symbol->value + reloc_entry->addend;
+#else
+      /* In PE mode, we do not offset the common symbol.  */
+      diff = reloc_entry->addend;
+#endif
+    }
+  else
+    {
+      /* For some reason bfd_perform_relocation always effectively
+	 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 0
+  /* dj - handle it like any other reloc? */
+  /* FIXME: How should this case be handled?  */
+  if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0)
+    abort ();
+#endif
+#endif
+
+#define DOIT(x) \
+  x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
+
+    if (diff != 0)
+      {
+	reloc_howto_type *howto = reloc_entry->howto;
+	unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+	switch (howto->size)
+	  {
+	  case 0:
+	    {
+	      char x = bfd_get_8 (abfd, addr);
+	      DOIT (x);
+	      bfd_put_8 (abfd, x, addr);
+	    }
+	    break;
+
+	  case 1:
+	    {
+	      short x = bfd_get_16 (abfd, addr);
+	      DOIT (x);
+	      bfd_put_16 (abfd, x, addr);
+	    }
+	    break;
+
+	  case 2:
+	    {
+	      long x = bfd_get_32 (abfd, addr);
+	      DOIT (x);
+	      bfd_put_32 (abfd, x, addr);
+	    }
+	    break;
+
+	  default:
+	    abort ();
+	  }
+      }
+
+  /* Now let bfd_perform_relocation finish everything up.  */
+  return bfd_reloc_continue;
+}
+
+#ifdef COFF_WITH_PE
+/* Return true if this relocation should
+   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 && howto->type != MIPS_R_RVA;
+}     
+#endif
+
+#ifndef PCRELOFFSET
+#define PCRELOFFSET false
+#endif
+
+static reloc_howto_type howto_table[] = 
+{
+  /* Reloc type 0 is ignored.  The reloc reading code ensures that
+     this is a reference to the .abs section, which will cause
+     bfd_perform_relocation to do nothing.  */
+  HOWTO (MIPS_R_ABSOLUTE,	/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 0,			/* special_function */
+	 "IGNORE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit reference to a symbol, normally from a data section.  */
+  HOWTO (MIPS_R_REFHALF,	/* 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_mips_reloc,	/* special_function */
+	 "REFHALF",		/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32 bit reference to a symbol, normally from a data section.  */
+  HOWTO (MIPS_R_REFWORD,	/* 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_mips_reloc,	/* special_function */
+	 "REFWORD",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 26 bit absolute jump address.  */
+  HOWTO (MIPS_R_JMPADDR,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 26,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 			/* This needs complex overflow
+				   detection, because the upper four
+				   bits must match the PC.  */
+	 coff_mips_reloc,	/* special_function */
+	 "JMPADDR",		/* name */
+	 true,			/* partial_inplace */
+	 0x3ffffff,		/* src_mask */
+	 0x3ffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* The high 16 bits of a symbol value.  Handled by the function
+     mips_refhi_reloc.  */
+  HOWTO (MIPS_R_REFHI,		/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 coff_mips_reloc,	/* special_function */
+	 "REFHI",		/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* The low 16 bits of a symbol value.  */
+  HOWTO (MIPS_R_REFLO,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 coff_mips_reloc,	/* special_function */
+	 "REFLO",		/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A reference to an offset from the gp register.  Handled by the
+     function mips_gprel_reloc.  */
+  HOWTO (MIPS_R_GPREL,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 coff_mips_reloc,	/* special_function */
+	 "GPREL",		/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A reference to a literal using an offset from the gp register.
+     Handled by the function mips_gprel_reloc.  */
+  HOWTO (MIPS_R_LITERAL,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 coff_mips_reloc,	/* special_function */
+	 "LITERAL",		/* name */
+	 true,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9),
+  EMPTY_HOWTO (10),
+  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),
+  EMPTY_HOWTO (20),
+  EMPTY_HOWTO (21),
+  EMPTY_HOWTO (22),
+  EMPTY_HOWTO (23),
+  EMPTY_HOWTO (24),
+  EMPTY_HOWTO (25),
+  EMPTY_HOWTO (26),
+  EMPTY_HOWTO (27),
+  EMPTY_HOWTO (28),
+  EMPTY_HOWTO (29),
+  EMPTY_HOWTO (30),
+  EMPTY_HOWTO (31),
+  EMPTY_HOWTO (32),
+  EMPTY_HOWTO (33),
+  HOWTO (MIPS_R_RVA,            /* 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_mips_reloc,       /* special_function */                     
+	 "rva32",	        /* name */                                 
+	 true,	                /* partial_inplace */                      
+	 0xffffffff,            /* src_mask */                             
+	 0xffffffff,            /* dst_mask */                             
+	 false),                /* pcrel_offset */
+  EMPTY_HOWTO (35),
+  EMPTY_HOWTO (36),
+  HOWTO (MIPS_R_PAIR,           /* 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_mips_reloc,       /* special_function */                     
+	 "PAIR",	        /* name */                                 
+	 true,	                /* partial_inplace */                      
+	 0xffffffff,            /* src_mask */                             
+	 0xffffffff,            /* dst_mask */                             
+	 false),                /* pcrel_offset */
+};
+
+/* Turn a howto into a reloc  nunmber */
+
+#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
+#define BADMAG(x) MIPSBADMAG(x)
+#define MIPS 1			/* Customize coffcode.h */
+
+#define RTYPE2HOWTO(cache_ptr, dst) \
+	    (cache_ptr)->howto = howto_table + (dst)->r_type;
+
+/* Compute the addend of a reloc.  If the reloc is to a common symbol,
+   the object file contains the value of the common symbol.  By the
+   time this is called, the linker may be using a different symbol
+   from a different object file with a different value.  Therefore, we
+   hack wildly to locate the original symbol from this file so that we
+   can make the correct adjustment.  This macro sets coffsym to the
+   symbol from the original file, and uses it to set the addend value
+   correctly.  If this is not a common symbol, the usual addend
+   calculation is done, except that an additional tweak is needed for
+   PC relative relocs.
+   FIXME: This macro refers to symbols and asect; these are from the
+   calling function, not the macro arguments.  */
+
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr)		\
+  {								\
+    coff_symbol_type *coffsym = (coff_symbol_type *) NULL;	\
+    if (ptr && bfd_asymbol_bfd (ptr) != abfd)			\
+      coffsym = (obj_symbols (abfd)				\
+	         + (cache_ptr->sym_ptr_ptr - symbols));		\
+    else if (ptr)						\
+      coffsym = coff_symbol_from (abfd, ptr);			\
+    if (coffsym != (coff_symbol_type *) NULL			\
+	&& coffsym->native->u.syment.n_scnum == 0)		\
+      cache_ptr->addend = - coffsym->native->u.syment.n_value;	\
+    else if (ptr && bfd_asymbol_bfd (ptr) == abfd		\
+	     && ptr->section != (asection *) NULL)		\
+      cache_ptr->addend = - (ptr->section->vma + ptr->value);	\
+    else							\
+      cache_ptr->addend = 0;					\
+    if (ptr && howto_table[reloc.r_type].pc_relative)		\
+      cache_ptr->addend += asect->vma;				\
+  }
+
+
+/* Convert an rtype to howto for the COFF backend linker.  */
+
+static reloc_howto_type *
+coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec;
+     struct internal_reloc *rel;
+     struct coff_link_hash_entry *h;
+     struct internal_syment *sym;
+     bfd_vma *addendp;
+{
+
+  reloc_howto_type *howto;
+
+  howto = howto_table + rel->r_type;
+
+#ifdef COFF_WITH_PE
+  *addendp = 0;
+#endif
+
+  if (howto->pc_relative)
+    *addendp += sec->vma;
+
+  if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+    {
+      /* This is a common symbol.  The section contents include the
+	 size (sym->n_value) as an addend.  The relocate_section
+	 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);
+
+#ifndef COFF_WITH_PE
+      /* I think we *do* want to bypass this.  If we don't, I have
+	 seen some data parameters get the wrong relocation 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 case in which
+	 this section has been bypassed has addresses which correspond
+	 to values I can find in the map.  */
+      *addendp -= sym->n_value;
+#endif
+    }
+
+#ifndef COFF_WITH_PE
+  /* 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) 
+    *addendp += h->root.u.c.size;
+#endif
+
+#ifdef COFF_WITH_PE
+  if (howto->pc_relative)
+    {
+      *addendp -= 4;
+
+      /* 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
+         to 0 at the start of this function.  We need to adjust here,
+         to avoid the adjustment the generic code will make.  FIXME:
+         This is getting a bit hackish.  */
+      if (sym != NULL && sym->n_scnum != 0)
+	*addendp -= sym->n_value;
+    }
+
+  if (rel->r_type == MIPS_R_RVA)
+    {
+      *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
+    }
+#endif
+
+  return howto;
+}
+
+#define coff_rtype_to_howto coff_mips_rtype_to_howto
+
+
+#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
+
+
+
+/* Get the howto structure for a generic reloc type.  */
+
+static reloc_howto_type *
+coff_mips_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  int mips_type;
+
+  switch (code)
+    {
+    case BFD_RELOC_16:
+      mips_type = MIPS_R_REFHALF;
+      break;
+    case BFD_RELOC_32:
+    case BFD_RELOC_CTOR:
+      mips_type = MIPS_R_REFWORD;
+      break;
+    case BFD_RELOC_MIPS_JMP:
+      mips_type = MIPS_R_JMPADDR;
+      break;
+    case BFD_RELOC_HI16_S:
+      mips_type = MIPS_R_REFHI;
+      break;
+    case BFD_RELOC_LO16:
+      mips_type = MIPS_R_REFLO;
+      break;
+    case BFD_RELOC_MIPS_GPREL:
+      mips_type = MIPS_R_GPREL;
+      break;
+    case BFD_RELOC_MIPS_LITERAL:
+      mips_type = MIPS_R_LITERAL;
+      break;
+/* FIXME?
+    case BFD_RELOC_16_PCREL_S2:
+      mips_type = MIPS_R_PCREL16;
+      break;
+    case BFD_RELOC_PCREL_HI16_S:
+      mips_type = MIPS_R_RELHI;
+      break;
+    case BFD_RELOC_PCREL_LO16:
+      mips_type = MIPS_R_RELLO;
+      break;
+    case BFD_RELOC_GPREL32:
+      mips_type = MIPS_R_SWITCH;
+      break;
+*/
+    case BFD_RELOC_RVA:
+      mips_type = MIPS_R_RVA;
+      break;
+    default:
+      return (reloc_howto_type *) NULL;
+    }
+
+  return &howto_table[mips_type];
+}
+
+static void
+mips_swap_reloc_in (abfd, src, dst)
+     bfd *abfd;
+     PTR src;
+     PTR dst;
+{
+  static struct internal_reloc pair_prev;
+  RELOC *reloc_src = (RELOC *) src;
+  struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
+
+  reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
+  reloc_dst->r_symndx =
+    bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
+  reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
+  reloc_dst->r_size = 0;
+  reloc_dst->r_extern = 0;
+  reloc_dst->r_offset = 0;
+
+  switch (reloc_dst->r_type)
+  {
+  case MIPS_R_REFHI:
+    pair_prev = *reloc_dst;
+    break;
+  case MIPS_R_PAIR:
+    reloc_dst->r_offset = reloc_dst->r_symndx;
+    if (reloc_dst->r_offset & 0x8000)
+      reloc_dst->r_offset -= 0x10000;
+    /*printf("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
+    reloc_dst->r_symndx = pair_prev.r_symndx;
+    break;
+  }
+}
+
+static unsigned int
+mips_swap_reloc_out (abfd, src, dst)
+     bfd       *abfd;
+     PTR	src;
+     PTR	dst;
+{
+  static int prev_offset = 1;
+  static bfd_vma prev_addr = 0;
+  struct internal_reloc *reloc_src = (struct internal_reloc *)src;
+  struct external_reloc *reloc_dst = (struct external_reloc *)dst;
+
+  switch (reloc_src->r_type)
+    {
+    case MIPS_R_REFHI:
+      prev_addr = reloc_src->r_vaddr;
+      prev_offset = reloc_src->r_offset;
+      break;
+    case MIPS_R_REFLO:
+      if (reloc_src->r_vaddr == prev_addr)
+	{
+	  /* FIXME: only slightly hackish.  If we see a REFLO pointing to
+	     the same address as a REFHI, we assume this is the matching
+	     PAIR reloc and output it accordingly.  The symndx is really
+	     the low 16 bits of the addend */
+	  bfd_h_put_32 (abfd, reloc_src->r_vaddr,
+			(bfd_byte *) reloc_dst->r_vaddr);
+	  bfd_h_put_32 (abfd, reloc_src->r_symndx,
+			(bfd_byte *) reloc_dst->r_symndx);
+
+	  bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *)
+		       reloc_dst->r_type);
+	  return RELSZ;
+	}
+      break;
+    }
+
+  bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
+  bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
+
+  bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
+	       reloc_dst->r_type);
+  return RELSZ;
+}
+
+#define coff_swap_reloc_in mips_swap_reloc_in
+#define coff_swap_reloc_out mips_swap_reloc_out
+#define NO_COFF_RELOCS
+
+static boolean
+coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
+			       input_section, contents, relocs, syms,
+			       sections)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     struct internal_reloc *relocs;
+     struct internal_syment *syms;
+     asection **sections;
+{
+  bfd_vma gp;
+  boolean gp_undefined;
+  size_t adjust;
+  struct internal_reloc *rel;
+  struct internal_reloc *rel_end;
+  unsigned int i;
+  boolean got_lo;
+
+  if (info->relocateable)
+  {
+    (*_bfd_error_handler)(_("\
+%s: `ld -r' not supported with PE MIPS objects\n"),
+			  bfd_get_filename (input_bfd));
+    bfd_set_error (bfd_error_bad_value);
+    return false;
+  }
+
+  BFD_ASSERT (input_bfd->xvec->byteorder
+	      == output_bfd->xvec->byteorder);
+
+#if 0
+  printf("dj: relocate %s(%s) %08x\n",
+	 input_bfd->filename, input_section->name,
+	 input_section->output_section->vma + input_section->output_offset);
+#endif
+
+  gp = _bfd_get_gp_value (output_bfd);
+  if (gp == 0)
+    gp_undefined = true;
+  else
+    gp_undefined = false;
+
+  got_lo = false;
+
+  adjust = 0;
+
+  rel = relocs;
+  rel_end = rel + input_section->reloc_count;
+  for (i = 0; rel < rel_end; rel++, i++)
+    {
+      long symndx;
+      struct coff_link_hash_entry *h;
+      struct internal_syment *sym;
+      bfd_vma addend = 0;
+      bfd_vma val, tmp, targ, src, low;
+      reloc_howto_type *howto;
+      unsigned char *mem = contents + rel->r_vaddr;
+
+      symndx = rel->r_symndx;
+
+      if (symndx == -1)
+	{
+	  h = NULL;
+	  sym = NULL;
+	}
+      else
+	{    
+	  h = obj_coff_sym_hashes (input_bfd)[symndx];
+	  sym = syms + symndx;
+	}
+
+      /* COFF treats common symbols in one of two ways.  Either the
+         size of the symbol is included in the section contents, or it
+         is not.  We assume that the size is not included, and force
+         the rtype_to_howto function to adjust the addend as needed.  */
+
+      if (sym != NULL && sym->n_scnum != 0)
+	addend = - sym->n_value;
+      else
+	addend = 0;
+
+
+      howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
+				       sym, &addend);
+      if (howto == NULL)
+	return false;
+
+      /* 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,
+         then we should ignore the symbol value.  */
+      if (howto->pc_relative && howto->pcrel_offset)
+	{
+	  if (info->relocateable)
+	    continue;
+	  if (sym != NULL && sym->n_scnum != 0)
+	    addend += sym->n_value;
+	}
+
+      val = 0;
+
+      if (h == NULL)
+	{
+	  asection *sec;
+
+	  if (symndx == -1)
+	    {
+	      sec = bfd_abs_section_ptr;
+	      val = 0;
+	    }
+	  else
+	    {
+	      sec = sections[symndx];
+              val = (sec->output_section->vma
+		     + sec->output_offset
+		     + sym->n_value);
+	      if (! obj_pe (input_bfd))
+		val -= sec->vma;
+	    }
+	}
+      else
+	{
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    {
+	      asection *sec;
+
+	      sec = h->root.u.def.section;
+	      val = (h->root.u.def.value
+		     + sec->output_section->vma
+		     + sec->output_offset);
+	      }
+
+	  else if (! info->relocateable)
+	    {
+	      if (! ((*info->callbacks->undefined_symbol)
+		     (info, h->root.root.string, input_bfd, input_section,
+		      rel->r_vaddr - input_section->vma, true)))
+		return false;
+	    }
+	}
+
+      src = rel->r_vaddr + input_section->output_section->vma
+	+ input_section->output_offset;
+#if 0
+      printf("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n",
+	     rel->r_type, howto_table[rel->r_type].name,
+	     src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset,
+	     h?h->root.root.string:"(none)");
+#endif
+
+      /* 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
+      */
+
+#define UI(x) (*_bfd_error_handler)(_("%s: unimplemented %s\n"), \
+				    bfd_get_filename (input_bfd), x); \
+	      bfd_set_error (bfd_error_bad_value);
+
+      switch (rel->r_type)
+	{
+	case MIPS_R_ABSOLUTE:
+	  /* ignore these */
+	  break;
+
+	case MIPS_R_REFHALF:
+	  UI("refhalf");
+	  break;
+
+	case MIPS_R_REFWORD:
+	  tmp = bfd_get_32(input_bfd, mem);
+	  /* printf("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
+	  tmp += val;
+	  bfd_put_32(input_bfd, tmp, mem);
+	  break;
+
+	case MIPS_R_JMPADDR:
+	  tmp = bfd_get_32(input_bfd, mem);
+	  targ = val + (tmp&0x03ffffff)*4;
+	  if ((src & 0xf0000000) != (targ & 0xf0000000))
+	    {
+	      (*_bfd_error_handler)(_("%s: jump too far away\n"),
+				    bfd_get_filename (input_bfd));
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+	  tmp &= 0xfc000000;
+	  tmp |= (targ/4) & 0x3ffffff;
+	  bfd_put_32(input_bfd, tmp, mem);
+	  break;
+
+	case MIPS_R_REFHI:
+	  tmp = bfd_get_32(input_bfd, mem);
+	  switch (rel[1].r_type)
+	    {
+	    case MIPS_R_PAIR:
+	      /* MS PE object */
+	      targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16);
+	      break;
+	    case MIPS_R_REFLO:
+	      /* GNU COFF object */
+	      low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
+	      low &= 0xffff;
+	      if (low & 0x8000)
+		low -= 0x10000;
+	      targ = val + low + ((tmp & 0xffff) << 16);
+	      break;
+	    default:
+	      (*_bfd_error_handler)(_("%s: bad pair/reflo after refhi\n"),
+				    bfd_get_filename (input_bfd));
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+	  tmp &= 0xffff0000;
+	  tmp |= (targ >> 16) & 0xffff;
+	  bfd_put_32(input_bfd, tmp, mem);
+	  break;
+
+	case MIPS_R_REFLO:
+	  tmp = bfd_get_32(input_bfd, mem);
+	  targ = val + (tmp & 0xffff);
+	  /* printf("refword: src=%08x targ=%08x\n", src, targ); */
+	  tmp &= 0xffff0000;
+	  tmp |= targ & 0xffff;
+	  bfd_put_32(input_bfd, tmp, mem);
+	  break;
+
+	case MIPS_R_GPREL:
+	case MIPS_R_LITERAL:
+	  UI("gprel");
+	  break;
+
+	case MIPS_R_SECTION:
+	  UI("section");
+	  break;
+
+	case MIPS_R_SECREL:
+	  UI("secrel");
+	  break;
+
+	case MIPS_R_SECRELLO:
+	  UI("secrello");
+	  break;
+
+	case MIPS_R_SECRELHI:
+	  UI("secrelhi");
+	  break;
+
+	case MIPS_R_RVA:
+	  tmp = bfd_get_32 (input_bfd, mem);
+	  /* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
+	  tmp += val
+	    - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
+	  bfd_put_32 (input_bfd, tmp, mem);
+	  break;
+
+	case MIPS_R_PAIR:
+	  /* ignore these */
+	  break;
+	}
+    }
+
+  return true;
+}
+
+#define coff_relocate_section coff_pe_mips_relocate_section
+
+#ifdef TARGET_UNDERSCORE
+
+/* If mips gcc uses underscores for symbol names, then it does not use
+   a leading dot for local labels, so if TARGET_UNDERSCORE is defined
+   we treat all symbols starting with L as local.  */
+
+static boolean coff_mips_is_local_label_name PARAMS ((bfd *, const char *));
+
+static boolean
+coff_mips_is_local_label_name (abfd, name)
+     bfd *abfd;
+     const char *name;
+{
+  if (name[0] == 'L')
+    return true;
+
+  return _bfd_coff_is_local_label_name (abfd, name);
+}
+
+#define coff_bfd_is_local_label_name coff_mips_is_local_label_name
+
+#endif /* TARGET_UNDERSCORE */
+
+#define COFF_NO_HACK_SCNHDR_SIZE
+
+#include "coffcode.h"
+
+const bfd_target
+#ifdef TARGET_SYM
+  TARGET_SYM =
+#else
+  mipslpe_vec =
+#endif
+{
+#ifdef TARGET_NAME
+  TARGET_NAME,
+#else
+  "pe-mips",			/* name */
+#endif
+  bfd_target_coff_flavour,
+  BFD_ENDIAN_LITTLE,		/* data byte order is little */
+  BFD_ENDIAN_LITTLE,		/* header byte order is little */
+
+  (HAS_RELOC | EXEC_P |		/* 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 */
+   | SEC_CODE | SEC_DATA),
+#else
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
+   | SEC_CODE | SEC_DATA
+   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+#endif
+
+#ifdef TARGET_UNDERSCORE
+  TARGET_UNDERSCORE,		/* leading underscore */
+#else
+  0,				/* leading underscore */
+#endif
+  '/',				/* ar_pad_char */
+  15,				/* ar_max_namelen */
+
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+  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 */
+
+/* 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 */
+       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),
+     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+     BFD_JUMP_TABLE_SYMBOLS (coff),
+     BFD_JUMP_TABLE_RELOCS (coff),
+     BFD_JUMP_TABLE_WRITE (coff),
+     BFD_JUMP_TABLE_LINK (coff),
+     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  NULL,
+  
+  COFF_SWAP_TABLE
+};
diff --git a/bfd/pe-ppc.c b/bfd/pe-ppc.c
index a2bac04..7d4a547 100644
--- a/bfd/pe-ppc.c
+++ b/bfd/pe-ppc.c
@@ -38,4 +38,7 @@
 
 /* FIXME: verify PCRELOFFSET is always false */
 
+/* FIXME: This target no longer works.  Search for POWERPC_LE_PE in
+   coff-ppc.c and peigen.c.  */
+
 #include "coff-ppc.c"
diff --git a/bfd/pe-sh.c b/bfd/pe-sh.c
new file mode 100644
index 0000000..7e48b0e
--- /dev/null
+++ b/bfd/pe-sh.c
@@ -0,0 +1,31 @@
+/* BFD back-end for SH PECOFF files.
+   Copyright 1995, 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"
+
+
+#define TARGET_SHL_SYM shlpe_vec
+#define TARGET_SHL_NAME "pe-shl"
+#define COFF_WITH_PE
+#define PCRELOFFSET true
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+
+#include "coff-sh.c"
diff --git a/bfd/pei-arm.c b/bfd/pei-arm.c
index 4ba5b3a..b7ae01e 100644
--- a/bfd/pei-arm.c
+++ b/bfd/pei-arm.c
@@ -27,7 +27,6 @@
 #define TARGET_BIG_NAME    "pei-arm-big"
 #endif
 
-#define IMAGE_BASE         NT_IMAGE_BASE
 #define COFF_IMAGE_WITH_PE
 #define COFF_WITH_PE
 #define PCRELOFFSET        true
diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c
index 8b52968..8f0f77a 100644
--- a/bfd/pei-i386.c
+++ b/bfd/pei-i386.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 386 PE IMAGE COFF files.
-   Copyright 1995 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -22,14 +22,17 @@
 
 #define TARGET_SYM i386pei_vec
 #define TARGET_NAME "pei-i386"
-#define IMAGE_BASE NT_IMAGE_BASE
 #define COFF_IMAGE_WITH_PE
 #define COFF_WITH_PE
 #define PCRELOFFSET true
 #define TARGET_UNDERSCORE '_'
 #define COFF_LONG_SECTION_NAMES
+#define COFF_LONG_FILENAMES
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
 
 #include "coff-i386.c"
-
-
-
diff --git a/bfd/pei-mcore.c b/bfd/pei-mcore.c
index d4a872c..78c3b95 100644
--- a/bfd/pei-mcore.c
+++ b/bfd/pei-mcore.c
@@ -27,7 +27,6 @@
 #define TARGET_LITTLE_NAME   "pei-mcore-little"
 #endif
 
-#define IMAGE_BASE         NT_IMAGE_BASE
 #define COFF_IMAGE_WITH_PE
 #define COFF_WITH_PE
 #define PCRELOFFSET        true
diff --git a/bfd/pei-mips.c b/bfd/pei-mips.c
new file mode 100644
index 0000000..472d35d
--- /dev/null
+++ b/bfd/pei-mips.c
@@ -0,0 +1,32 @@
+/* BFD back-end for MIPS PE IMAGE COFF files.
+   Copyright 1995, 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"
+
+#define TARGET_SYM mipslpei_vec
+#define TARGET_NAME "pei-mips"
+#define COFF_IMAGE_WITH_PE
+#define PCRELOFFSET true
+#define COFF_LONG_SECTION_NAMES
+
+#include "pe-mips.c"
+
+
+
diff --git a/bfd/pei-ppc.c b/bfd/pei-ppc.c
index 839bc0f..86e1a5d 100644
--- a/bfd/pei-ppc.c
+++ b/bfd/pei-ppc.c
@@ -32,8 +32,6 @@
 #define TARGET_BIG_SYM      bfd_powerpc_pei_vec
 #define TARGET_BIG_NAME    "pei-powerpc"
 
-#define IMAGE_BASE          NT_IMAGE_BASE
-
 #define COFF_IMAGE_WITH_PE
 #define COFF_WITH_PE
 
@@ -41,7 +39,7 @@
 
 /* FIXME: Verify PCRELOFFSET is always false */
 
+/* FIXME: This target no longer works.  Search for POWERPC_LE_PE in
+   coff-ppc.c and peigen.c.  */
+
 #include "coff-ppc.c"
-
-
-
diff --git a/bfd/pei-sh.c b/bfd/pei-sh.c
new file mode 100644
index 0000000..2fb8b1c
--- /dev/null
+++ b/bfd/pei-sh.c
@@ -0,0 +1,35 @@
+/* BFD back-end for SH PE IMAGE COFF files.
+   Copyright 1995, 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"
+
+#define TARGET_SHL_SYM shlpei_vec
+#define TARGET_SHL_NAME "pei-shl"
+#define IMAGE_BASE NT_IMAGE_BASE
+#define COFF_IMAGE_WITH_PE
+#define COFF_WITH_PE
+#define PCRELOFFSET true
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+
+#include "coff-sh.c"
+
+
+
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 79d16e5..7238c78 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1,6 +1,6 @@
-/* Support for the generic parts of most COFF variants, for BFD.
-   Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
-   Written by Cygnus Support.
+/* Support for the generic parts of PE/PEI, for BFD.
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Written by Cygnus Solutions.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -21,6 +21,9 @@
 /*
 Most of this hacked by  Steve Chamberlain,
 			sac@cygnus.com
+
+PE/PEI rearrangement (and code added): Donn Terry
+                                       Softway Systems, Inc.
 */
 
 /* Hey look, some documentation [and in a place you expect to find it]!
@@ -52,186 +55,98 @@
    wasting too much time.
 */
 
-#ifdef coff_bfd_print_private_bfd_data
+#include "libpei.h"
+
 static boolean (*pe_saved_coff_bfd_print_private_bfd_data)
-     PARAMS ((bfd *, PTR))
-     = coff_bfd_print_private_bfd_data;
-#undef coff_bfd_print_private_bfd_data
+    PARAMS ((bfd *, PTR)) =
+#ifndef coff_bfd_print_private_bfd_data
+     NULL;
 #else
-static boolean (*pe_saved_coff_bfd_print_private_bfd_data)
-     PARAMS ((bfd *, PTR))
-     = NULL;
+     coff_bfd_print_private_bfd_data;
+#undef coff_bfd_print_private_bfd_data
 #endif
+
+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
+     NULL;
+#else
+     coff_bfd_copy_private_bfd_data;
+#undef coff_bfd_copy_private_bfd_data
+#endif
+
+static boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
+
 #define coff_mkobject      pe_mkobject
 #define coff_mkobject_hook pe_mkobject_hook
 
-#ifndef GET_FCN_LNNOPTR
-#define GET_FCN_LNNOPTR(abfd, ext) \
-     bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-
-#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext)  \
-	bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-
-#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext)  bfd_h_put_32(abfd,  in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd,  ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
-#endif
-#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd,  ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
-#endif
-#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext)  bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
-#endif
-#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
-#endif
-#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
-#endif
-#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd,in, ext)  bfd_h_put_16(abfd,in, (bfd_byte  *) ext->x_scn.x_nlinno)
-#endif
-#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
-#endif
-#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
-#endif
-
-/* The f_symptr field in the filehdr is sometimes 64 bits.  */
-#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR bfd_h_get_32
-#endif
-#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR bfd_h_put_32
-#endif
-
-/* Some fields in the aouthdr are sometimes 64 bits.  */
-#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE bfd_h_put_32
-#endif
-#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE bfd_h_put_32
-#endif
-#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE bfd_h_put_32
-#endif
-#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY bfd_h_put_32
-#endif
-#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
-#endif
-#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START bfd_h_get_32
-#endif
-#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START bfd_h_put_32
-#endif
-
-/* Some fields in the scnhdr are sometimes 64 bits.  */
-#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR bfd_h_put_32
-#endif
-#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR bfd_h_put_32
-#endif
-#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE bfd_h_put_32
-#endif
-#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR bfd_h_put_32
-#endif
-#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR bfd_h_put_32
-#endif
-#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR bfd_h_get_32
-#endif
-#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
-#endif
-
+#ifndef NO_COFF_RELOCS
 static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
 static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
+#endif
 static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static unsigned int coff_swap_aux_out
-  PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
-static void add_data_entry
-  PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
-static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
 static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-static boolean pe_print_idata PARAMS ((bfd *, PTR));
-static boolean pe_print_edata PARAMS ((bfd *, PTR));
-static boolean pe_print_pdata PARAMS ((bfd *, PTR));
-static boolean pe_print_reloc PARAMS ((bfd *, PTR));
-static boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
 static boolean pe_mkobject PARAMS ((bfd *));
 static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR));
-static boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+
+#ifdef COFF_IMAGE_WITH_PE
+/* This structure contains static variables used by the ILF code.  */
+typedef asection * asection_ptr;
+
+typedef struct
+{
+  bfd *			abfd;
+  bfd_byte *		data;
+  struct bfd_in_memory * bim;
+  unsigned short        magic;
+  
+  arelent *		reltab;
+  unsigned int 		relcount;
+
+  coff_symbol_type * 	sym_cache;
+  coff_symbol_type * 	sym_ptr;
+  unsigned int       	sym_index;
+  
+  unsigned int * 	sym_table;
+  unsigned int * 	table_ptr;
+  
+  combined_entry_type * native_syms;
+  combined_entry_type * native_ptr;
+
+  coff_symbol_type **	sym_ptr_table;
+  coff_symbol_type **	sym_ptr_ptr;
+  
+  unsigned int		sec_index;
+
+  char *                string_table;
+  char *                string_ptr;
+  char *		end_string_ptr;
+  
+  SYMENT *              esym_table;
+  SYMENT *              esym_ptr;
+
+  struct internal_reloc * int_reltab;
+}
+pe_ILF_vars;
+
+static asection_ptr       pe_ILF_make_a_section   PARAMS ((pe_ILF_vars *, const char *, unsigned int, flagword));
+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 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 *));
+#endif /* COFF_IMAGE_WITH_PE */
 
 /**********************************************************************/
 
+#ifndef NO_COFF_RELOCS
 static void
 coff_swap_reloc_in (abfd, src, dst)
      bfd *abfd;
@@ -277,7 +192,7 @@
 #endif
   return RELSZ;
 }
-
+#endif /* not NO_COFF_RELOCS */
 
 static void
 coff_swap_filehdr_in (abfd, src, dst)
@@ -295,6 +210,21 @@
   filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
   filehdr_dst->f_symptr = bfd_h_get_32 (abfd, (bfd_byte *) filehdr_src->f_symptr);
 
+#ifdef COFF_IMAGE_WITH_PE
+  /* There are really two magic numbers involved; the magic number
+     that says this is a NT executable (PEI) and the magic number that
+     determines the architecture.  The former is DOSMAGIC, stored in
+     the e_magic field.  The latter is stored in the f_magic field.
+     If the NT magic number isn't valid, the architecture magic number
+     could be mimicked by some other field (specifically, the number
+     of relocs in section 3).  Since this routine can only be called
+     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 (bfd_h_get_16 (abfd, (bfd_byte *) filehdr_src->e_magic) != DOSMAGIC)
+    filehdr_dst->f_magic = -1;
+#endif
+
   /* Other people's tools sometimes generate headers with an nsyms but
      a zero symptr.  */
   if (filehdr_dst->f_nsyms != 0 && filehdr_dst->f_symptr == 0)
@@ -308,748 +238,17 @@
 }
 
 #ifdef COFF_IMAGE_WITH_PE
-
-static  unsigned int
-coff_swap_filehdr_out (abfd, in, out)
-     bfd       *abfd;
-     PTR	in;
-     PTR	out;
-{
-  int idx;
-  struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
-  FILHDR *filehdr_out = (FILHDR *)out;
-
-  if (pe_data (abfd)->has_reloc_section)
-    filehdr_in->f_flags &= ~F_RELFLG;
-
-  if (pe_data (abfd)->dll)
-    filehdr_in->f_flags |= F_DLL;
-
-  filehdr_in->pe.e_magic    = DOSMAGIC;
-  filehdr_in->pe.e_cblp     = 0x90;
-  filehdr_in->pe.e_cp       = 0x3;
-  filehdr_in->pe.e_crlc     = 0x0;
-  filehdr_in->pe.e_cparhdr  = 0x4;
-  filehdr_in->pe.e_minalloc = 0x0;
-  filehdr_in->pe.e_maxalloc = 0xffff;
-  filehdr_in->pe.e_ss       = 0x0;
-  filehdr_in->pe.e_sp       = 0xb8;
-  filehdr_in->pe.e_csum     = 0x0;
-  filehdr_in->pe.e_ip       = 0x0;
-  filehdr_in->pe.e_cs       = 0x0;
-  filehdr_in->pe.e_lfarlc   = 0x40;
-  filehdr_in->pe.e_ovno     = 0x0;
-
-  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++)
-    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 */
-  filehdr_in->pe.dos_message[0]  = 0x0eba1f0e;
-  filehdr_in->pe.dos_message[1]  = 0xcd09b400;
-  filehdr_in->pe.dos_message[2]  = 0x4c01b821;
-  filehdr_in->pe.dos_message[3]  = 0x685421cd;
-  filehdr_in->pe.dos_message[4]  = 0x70207369;
-  filehdr_in->pe.dos_message[5]  = 0x72676f72;
-  filehdr_in->pe.dos_message[6]  = 0x63206d61;
-  filehdr_in->pe.dos_message[7]  = 0x6f6e6e61;
-  filehdr_in->pe.dos_message[8]  = 0x65622074;
-  filehdr_in->pe.dos_message[9]  = 0x6e757220;
-  filehdr_in->pe.dos_message[10] = 0x206e6920;
-  filehdr_in->pe.dos_message[11] = 0x20534f44;
-  filehdr_in->pe.dos_message[12] = 0x65646f6d;
-  filehdr_in->pe.dos_message[13] = 0x0a0d0d2e;
-  filehdr_in->pe.dos_message[14] = 0x24;
-  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_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);
-
-  /* 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_byte *) filehdr_out->e_cparhdr);
-  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_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);
-  {
-    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]);
-  }
-  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]);
-  }
-  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]);
-  }
-
-  /* also put in the NT signature */
-  bfd_h_put_32(abfd, filehdr_in->pe.nt_signature, 
-	       (bfd_byte *) filehdr_out->nt_signature);
-
-
-
-
-  return FILHSZ;
-}
+#define coff_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
 #else
-
-static  unsigned int
-coff_swap_filehdr_out (abfd, in, out)
-     bfd       *abfd;
-     PTR	in;
-     PTR	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);
-  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);
-
-  return FILHSZ;
-}
-
+#define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
 #endif
 
 
 static void
-coff_swap_sym_in (abfd, ext1, in1)
+coff_swap_scnhdr_in (abfd, ext, in)
      bfd            *abfd;
-     PTR ext1;
-     PTR 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 {
-#if SYMNMLEN != E_SYMNMLEN
-    -> Error, we need to cope with truncating or extending SYMNMLEN!;
-#else
-    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_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);
-
-  /* The section symbols for the .idata$ sections have class 0x68
-     (C_SECTION), which MS documentation indicates is a section
-     symbol.  Unfortunately, the value field in the symbol is simply a
-     copy of the .idata section's flags rather than something useful.
-     When these symbols are encountered, change the value to 0 so that
-     they will be handled somewhat correctly in the bfd code.  */
-  if (in->n_sclass == C_SECTION)
-    {
-      in->n_value = 0x0;
-
-      /* FIXME: This is clearly wrong.  The problem seems to be that
-         undefined C_SECTION symbols appear in the first object of a
-         MS generated .lib file, and the symbols are not defined
-         anywhere.  */
-      in->n_scnum = 1;
-
-      /* 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; */
-    }
-
-#ifdef coff_swap_sym_in_hook
-  coff_swap_sym_in_hook(abfd, ext1, in1);
-#endif
-}
-
-static unsigned int
-coff_swap_sym_out (abfd, inp, extp)
-     bfd       *abfd;
-     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 {
-#if SYMNMLEN != E_SYMNMLEN
-    -> Error, we need to cope with truncating or extending SYMNMLEN!;
-#else
-    memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
-#endif
-  }
-
-  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;
-}
-
-static void
-coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
-     bfd            *abfd;
-     PTR 	      ext1;
-     int             type;
-     int             class;
-     int	      indx;
-     int	      numaux;
-     PTR 	      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 {
-#if FILNMLEN != E_FILNMLEN
-      -> Error, we need to cope with truncating or extending FILNMLEN!;
-#else
-      memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
-#endif
-    }
-    return;
-
-
-  case C_STAT:
-#ifdef C_LEAFSTAT
-  case C_LEAFSTAT:
-#endif
-  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);
-#ifndef NO_TVNDX
-  in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
-#endif
-
-  if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
-    {
-      in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
-      in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
-    }
-  else
-    {
-#if DIMNUM != E_DIMNUM
- #error we need to cope with truncating or extending DIMNUM
-#endif
-      in->x_sym.x_fcnary.x_ary.x_dimen[0] =
-	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
-      in->x_sym.x_fcnary.x_ary.x_dimen[1] =
-	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
-      in->x_sym.x_fcnary.x_ary.x_dimen[2] =
-	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
-      in->x_sym.x_fcnary.x_ary.x_dimen[3] =
-	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);
-  }
-}
-
-static unsigned int
-coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
-     bfd   *abfd;
-     PTR 	inp;
-     int   type;
-     int   class;
-     int   indx;
-     int   numaux;
-     PTR	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 {
-#if FILNMLEN != E_FILNMLEN
-      -> Error, we need to cope with truncating or extending FILNMLEN!;
-#else
-      memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
-#endif
-    }
-    return AUXESZ;
-
-
-  case C_STAT:
-#ifdef C_LEAFSTAT
-  case C_LEAFSTAT:
-#endif
-  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);
-#ifndef NO_TVNDX
-  bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
-#endif
-
-  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);
-    }
-  else
-    {
-#if DIMNUM != E_DIMNUM
- #error we need to cope with truncating or extending DIMNUM
-#endif
-      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
-		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
-      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
-		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
-      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
-		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
-      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
-		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
-    }
-
-  if (ISFCN (type))
-    bfd_h_put_32 (abfd, in->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);
-      PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
-    }
-
-  return AUXESZ;
-}
-
-
-static void
-coff_swap_lineno_in (abfd, ext1, in1)
-     bfd            *abfd;
-     PTR ext1;
-     PTR 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);
-}
-
-static unsigned int
-coff_swap_lineno_out (abfd, inp, outp)
-     bfd       *abfd;
-     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 *)
-	  ext->l_addr.l_symndx);
-
-  PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
-  return LINESZ;
-}
-
-
-
-static void
-coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
-     bfd            *abfd;
-     PTR aouthdr_ext1;
-     PTR aouthdr_int1;
-{
-  struct internal_extra_pe_aouthdr *a;
-  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->tsize =
-    GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
-  aouthdr_int->dsize =
-    GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize);
-  aouthdr_int->bsize =
-    GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize);
-  aouthdr_int->entry =
-    GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
-  aouthdr_int->text_start =
-    GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
-  aouthdr_int->data_start =
-    GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
-
-  a = &aouthdr_int->pe;
-  a->ImageBase = bfd_h_get_32 (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);
-  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 = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfStackReserve);
-  a->SizeOfStackCommit = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfStackCommit);
-  a->SizeOfHeapReserve = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfHeapReserve);
-  a->SizeOfHeapCommit = bfd_h_get_32 (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++)
-      {
-	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 (aouthdr_int->entry)
-    {
-      aouthdr_int->entry += a->ImageBase;
-      aouthdr_int->entry &= 0xffffffff;
-    }
-  if (aouthdr_int->tsize) 
-    {
-      aouthdr_int->text_start += a->ImageBase;
-      aouthdr_int->text_start &= 0xffffffff;
-    }
-  if (aouthdr_int->dsize) 
-    {
-      aouthdr_int->data_start += a->ImageBase;
-      aouthdr_int->data_start &= 0xffffffff;
-    }
-
-#ifdef POWERPC_LE_PE
-  /* 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 ;
-  thunk_size = a->DataDirectory[12].Size;
-  import_table_size = a->DataDirectory[1].Size;
-#endif
-}
-
-
-static void add_data_entry (abfd, aout, idx, name, base)
-     bfd *abfd;
-     struct internal_extra_pe_aouthdr *aout;
-     int idx;
-     char *name;
-     bfd_vma base;
-{
-  asection *sec = bfd_get_section_by_name (abfd, name);
-
-  /* add import directory information if it exists */
-  if ((sec != NULL)
-      && (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;
-    }
-}
-
-static unsigned int
-coff_swap_aouthdr_out (abfd, in, out)
-     bfd       *abfd;
-     PTR	in;
-     PTR	out;
-{
-  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;
-
-  bfd_vma sa = extra->SectionAlignment;
-  bfd_vma fa = extra->FileAlignment;
-  bfd_vma ib = extra->ImageBase ;
-
-  if (aouthdr_in->tsize) 
-    {
-      aouthdr_in->text_start -= ib;
-      aouthdr_in->text_start &= 0xffffffff;
-    }
-  if (aouthdr_in->dsize) 
-    {
-      aouthdr_in->data_start -= ib;
-      aouthdr_in->data_start &= 0xffffffff;
-    }
-  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))
-
-  /* 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 .. */
-  memset (extra->DataDirectory, sizeof (extra->DataDirectory), 0);
-
-  add_data_entry (abfd, extra, 0, ".edata", ib);
-  add_data_entry (abfd, extra, 1, ".idata", ib);
-  add_data_entry (abfd, extra, 2, ".rsrc" ,ib);
-
-#ifdef POWERPC_LE_PE
-  /* FIXME: do other PE platforms use this? */
-  add_data_entry (abfd, extra, 3, ".pdata" ,ib);
-#endif
-
-  add_data_entry (abfd, extra, 5, ".reloc", ib);
-
-#ifdef POWERPC_LE_PE
-  /* On the PPC NT system, this field is set up as follows. It is
-     not an "officially" reserved field, so it currently has no title.
-     first_thunk_address is idata$5, and the thunk_size is the size
-     of the idata$5 chunk of the idata section.
-  */
-  extra->DataDirectory[12].VirtualAddress = first_thunk_address;
-  extra->DataDirectory[12].Size = thunk_size;
-
-  /* On the PPC NT system, the size of the directory entry is not the
-     size of the entire section. It's actually offset to the end of 
-     the idata$3 component of the idata section. This is the size of
-     the entire import table. (also known as the start of idata$4)
-  */
-  extra->DataDirectory[1].Size = import_table_size;
-#endif
-
-  {
-    asection *sec;
-    bfd_vma dsize= 0;
-    bfd_vma isize = SA(abfd->sections->filepos);
-    bfd_vma tsize= 0;
-
-    for (sec = abfd->sections; sec; sec = sec->next)
-      {
-	int rounded = FA(sec->_raw_size);
-
-	if (sec->flags & SEC_DATA) 
-	  dsize += rounded;
-	if (sec->flags & SEC_CODE)
-	  tsize += rounded;
-	isize += SA(rounded);
-      }
-
-    aouthdr_in->dsize = dsize;
-    aouthdr_in->tsize = tsize;
-    extra->SizeOfImage = isize;
-  }
-
-  extra->SizeOfHeaders = abfd->sections->filepos;
-  bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic);
-
-#ifdef POWERPC_LE_PE
-  /* this little piece of magic sets the "linker version" field to 2.60 */
-  bfd_h_put_16(abfd, 2  + 60 * 256, (bfd_byte *) aouthdr_out->standard.vstamp);
-#else
-  /* this little piece of magic sets the "linker version" field to 2.55 */
-  bfd_h_put_16(abfd, 2  + 55 * 256, (bfd_byte *) aouthdr_out->standard.vstamp);
-#endif
-
-  PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->standard.tsize);
-  PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->standard.dsize);
-  PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->standard.bsize);
-  PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->standard.entry);
-  PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
-			  (bfd_byte *) aouthdr_out->standard.text_start);
-
-  PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
-			  (bfd_byte *) aouthdr_out->standard.data_start);
-
-
-  bfd_h_put_32 (abfd, extra->ImageBase, 
-		(bfd_byte *) aouthdr_out->ImageBase);
-  bfd_h_put_32 (abfd, extra->SectionAlignment,
-		(bfd_byte *) aouthdr_out->SectionAlignment);
-  bfd_h_put_32 (abfd, extra->FileAlignment,
-		(bfd_byte *) aouthdr_out->FileAlignment);
-  bfd_h_put_16 (abfd, extra->MajorOperatingSystemVersion,
-		(bfd_byte *) aouthdr_out->MajorOperatingSystemVersion);
-  bfd_h_put_16 (abfd, extra->MinorOperatingSystemVersion,
-		(bfd_byte *) aouthdr_out->MinorOperatingSystemVersion);
-  bfd_h_put_16 (abfd, extra->MajorImageVersion,
-		(bfd_byte *) aouthdr_out->MajorImageVersion);
-  bfd_h_put_16 (abfd, extra->MinorImageVersion,
-		(bfd_byte *) aouthdr_out->MinorImageVersion);
-  bfd_h_put_16 (abfd, extra->MajorSubsystemVersion,
-		(bfd_byte *) aouthdr_out->MajorSubsystemVersion);
-  bfd_h_put_16 (abfd, extra->MinorSubsystemVersion,
-		(bfd_byte *) aouthdr_out->MinorSubsystemVersion);
-  bfd_h_put_32 (abfd, extra->Reserved1,
-		(bfd_byte *) aouthdr_out->Reserved1);
-  bfd_h_put_32 (abfd, extra->SizeOfImage,
-		(bfd_byte *) aouthdr_out->SizeOfImage);
-  bfd_h_put_32 (abfd, extra->SizeOfHeaders,
-		(bfd_byte *) aouthdr_out->SizeOfHeaders);
-  bfd_h_put_32 (abfd, extra->CheckSum,
-		(bfd_byte *) aouthdr_out->CheckSum);
-  bfd_h_put_16 (abfd, extra->Subsystem,
-		(bfd_byte *) aouthdr_out->Subsystem);
-  bfd_h_put_16 (abfd, extra->DllCharacteristics,
-		(bfd_byte *) aouthdr_out->DllCharacteristics);
-  bfd_h_put_32 (abfd, extra->SizeOfStackReserve,
-		(bfd_byte *) aouthdr_out->SizeOfStackReserve);
-  bfd_h_put_32 (abfd, extra->SizeOfStackCommit,
-		(bfd_byte *) aouthdr_out->SizeOfStackCommit);
-  bfd_h_put_32 (abfd, extra->SizeOfHeapReserve,
-		(bfd_byte *) aouthdr_out->SizeOfHeapReserve);
-  bfd_h_put_32 (abfd, extra->SizeOfHeapCommit,
-		(bfd_byte *) aouthdr_out->SizeOfHeapCommit);
-  bfd_h_put_32 (abfd, extra->LoaderFlags,
-		(bfd_byte *) aouthdr_out->LoaderFlags);
-  bfd_h_put_32 (abfd, extra->NumberOfRvaAndSizes,
-		(bfd_byte *) aouthdr_out->NumberOfRvaAndSizes);
-  {
-    int idx;
-    for (idx=0; idx < 16; idx++)
-      {
-	bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
-		      (bfd_byte *) aouthdr_out->DataDirectory[idx][0]);
-	bfd_h_put_32 (abfd, extra->DataDirectory[idx].Size,
-		      (bfd_byte *) aouthdr_out->DataDirectory[idx][1]);
-      }
-  }
-
-  return AOUTSZ;
-}
-
-static void
-    coff_swap_scnhdr_in (abfd, ext, in)
-      bfd            *abfd;
-  PTR	     ext;
-  PTR	     in;
+     PTR	     ext;
+     PTR	     in;
 {
   SCNHDR *scnhdr_ext = (SCNHDR *) ext;
   struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -1069,931 +268,39 @@
     GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
   scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
 
-  scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
-  scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
+  /* MS handles overflow of line numbers by carrying into the reloc
+     field (it appears).  Since it's supposed to be zero for PE
+     *IMAGE* format, that's safe.  This is still a bit iffy.  */
+#ifdef COFF_IMAGE_WITH_PE
+  scnhdr_int->s_nlnno =
+    (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nlnno)
+     + (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nreloc) << 16));
+  scnhdr_int->s_nreloc = 0;
+#else
+  scnhdr_int->s_nreloc = bfd_h_get_16 (abfd,
+				       (bfd_byte *) scnhdr_ext->s_nreloc);
+  scnhdr_int->s_nlnno = bfd_h_get_16 (abfd,
+				      (bfd_byte *) scnhdr_ext->s_nlnno);
+#endif
 
   if (scnhdr_int->s_vaddr != 0) 
     {
       scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
       scnhdr_int->s_vaddr &= 0xffffffff;
     }
-  if (strcmp (scnhdr_int->s_name, _BSS) == 0) 
+
+#ifndef COFF_NO_HACK_SCNHDR_SIZE
+  /* If this section holds uninitialized data, use the virtual size
+     (stored in s_paddr) instead of the physical size.  */
+  if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
     {
       scnhdr_int->s_size = scnhdr_int->s_paddr;
-      scnhdr_int->s_paddr = 0;
-    }
-}
-
-static unsigned int
-coff_swap_scnhdr_out (abfd, in, out)
-     bfd       *abfd;
-     PTR	in;
-     PTR	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));
-
-  PUT_SCNHDR_VADDR (abfd, 
-		    ((scnhdr_int->s_vaddr 
-		      - pe_data(abfd)->pe_opthdr.ImageBase)
-		     & 0xffffffff),
-		    (bfd_byte *) scnhdr_ext->s_vaddr);
-
-  /* NT wants the size data to be rounded up to the next NT_FILE_ALIGNMENT
-     value except for the BSS section, its s_size should be 0 */
-
-
-  if (strcmp (scnhdr_int->s_name, _BSS) == 0) 
-    {
-      ps = scnhdr_int->s_size;
-      ss = 0;
-    }
-  else
-    {
-      ps = scnhdr_int->s_paddr;
-      ss = scnhdr_int->s_size;
-    }
-
-  PUT_SCNHDR_SIZE (abfd, ss,
-		   (bfd_byte *) scnhdr_ext->s_size);
-
-
-  PUT_SCNHDR_PADDR (abfd, ps, (bfd_byte *) scnhdr_ext->s_paddr);
-
-  PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
-		     (bfd_byte *) scnhdr_ext->s_scnptr);
-  PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
-		     (bfd_byte *) scnhdr_ext->s_relptr);
-  PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
-		      (bfd_byte *) scnhdr_ext->s_lnnoptr);
-
-  /* Extra flags must be set when dealing with NT.  All sections should also
-     have the IMAGE_SCN_MEM_READ (0x40000000) flag set.  In addition, the
-     .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data
-     sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set
-     (this is especially important when dealing with the .idata section since
-     the addresses for routines from .dlls must be overwritten).  If .reloc
-     section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE
-     (0x02000000).  Also, the resource data should also be read and
-     writable.  */
-
-  /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */
-  /* FIXME: even worse, I don't see how to get the original alignment field*/
-  /*        back...                                                        */
-
-  /* FIXME: Basing this on section names is bogus.  Also, this should
-     be in sec_to_styp_flags.  */
-
-  {
-    int flags = scnhdr_int->s_flags;
-    if (strcmp (scnhdr_int->s_name, ".data")  == 0 ||
-	strcmp (scnhdr_int->s_name, ".CRT")   == 0 ||
-	strcmp (scnhdr_int->s_name, ".bss")   == 0)
-      flags |= IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE;
-    else if (strcmp (scnhdr_int->s_name, ".text") == 0)
-      flags |= IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_EXECUTE;
-    else if (strcmp (scnhdr_int->s_name, ".reloc") == 0)
-      flags = (SEC_DATA | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_DISCARDABLE
-	       | IMAGE_SCN_MEM_SHARED);
-    else if (strcmp (scnhdr_int->s_name, ".idata") == 0)
-      flags = IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE | SEC_DATA;     
-    else if (strcmp (scnhdr_int->s_name, ".rdata") == 0
-	     || strcmp (scnhdr_int->s_name, ".edata") == 0)
-      flags =  IMAGE_SCN_MEM_READ | SEC_DATA;     
-    else if (strcmp (scnhdr_int->s_name, ".pdata") == 0)
-      flags = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES |
-			  IMAGE_SCN_MEM_READ ;
-    /* Remember this field is a max of 8 chars, so the null is _not_ there
-       for an 8 character name like ".reldata". (yep. Stupid bug) */
-    else if (strncmp (scnhdr_int->s_name, ".reldata", 8) == 0)
-      flags =  IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_8BYTES |
-	       IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE ;
-    else if (strcmp (scnhdr_int->s_name, ".ydata") == 0)
-      flags =  IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_8BYTES |
-	       IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE ;
-    else if (strncmp (scnhdr_int->s_name, ".drectve", 8) == 0)
-      flags =  IMAGE_SCN_LNK_INFO | IMAGE_SCN_LNK_REMOVE ;
-    else if (strncmp (scnhdr_int->s_name, ".stab", 5) == 0)
-      flags |= (IMAGE_SCN_LNK_INFO | IMAGE_SCN_MEM_DISCARDABLE
-		| IMAGE_SCN_MEM_SHARED | IMAGE_SCN_MEM_READ);
-    else if (strcmp (scnhdr_int->s_name, ".rsrc")  == 0)
-      flags |= IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_SHARED;
-    else
-      flags |= IMAGE_SCN_MEM_READ;
-
-    bfd_h_put_32(abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
-  }
-
-  if (scnhdr_int->s_nlnno <= 0xffff)
-    bfd_h_put_16(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
-  else
-    {
-      (*_bfd_error_handler) (_("%s: line number overflow: 0x%lx > 0xffff"),
-			     bfd_get_filename (abfd),
-			     scnhdr_int->s_nlnno);
-      bfd_set_error (bfd_error_file_truncated);
-      bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
-      ret = 0;
-    }
-  if (scnhdr_int->s_nreloc <= 0xffff)
-    bfd_h_put_16(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
-  else
-    {
-      (*_bfd_error_handler) (_("%s: reloc overflow: 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;
-    }
-  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_ ("Reserved"),
-  N_ ("Reserved"),
-  N_ ("Reserved")
-};
-
-/**********************************************************************/
-static boolean
-pe_print_idata(abfd, vfile)
-     bfd *abfd;
-     PTR vfile;
-{
-  FILE *file = (FILE *) vfile;
-  bfd_byte *data = 0;
-  asection *section = bfd_get_section_by_name (abfd, ".idata");
-  unsigned long adj;
-
-#ifdef POWERPC_LE_PE
-  asection *rel_section = bfd_get_section_by_name (abfd, ".reldata");
-#endif
-
-  bfd_size_type datasize;
-  bfd_size_type dataoff;
-  bfd_size_type secsize;
-  bfd_size_type i;
-  bfd_size_type start, stop;
-  int onaline = 20;
-
-  pe_data_type *pe = pe_data (abfd);
-  struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
-
-  if (section != NULL)
-    {
-      datasize = bfd_section_size (abfd, section);
-      dataoff = 0;
-
-      if (datasize == 0)
-	return true;
-    }
-  else
-    {
-      bfd_vma addr, size;
-
-      addr = extra->DataDirectory[1].VirtualAddress;
-      size = extra->DataDirectory[1].Size;
-
-      if (addr == 0 || size == 0)
-	return true;
-
-      for (section = abfd->sections; section != NULL; section = section->next)
-	{
-	  if (section->vma - extra->ImageBase <= addr
-	      && ((section->vma - extra->ImageBase
-		   + bfd_section_size (abfd, section))
-		  >= addr + size))
-	    break;
-	}
-      if (section == NULL)
-	return true;
-
-      /* For some reason the import table size is not reliable.  The
-         import data will extend past the indicated size, and before
-         the indicated address.  */
-      dataoff = addr - (section->vma - extra->ImageBase);
-      datasize = size;
-    }
-
-#ifdef POWERPC_LE_PE
-  if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0)
-    {
-      /* The toc address can be found by taking the starting address,
-	 which on the PPC locates a function descriptor. The descriptor
-	 consists of the function code starting address followed by the
-	 address of the toc. The starting address we get from the bfd,
-	 and the descriptor is supposed to be in the .reldata section. 
-      */
-
-      bfd_vma loadable_toc_address;
-      bfd_vma toc_address;
-      bfd_vma start_address;
-      bfd_byte *data = 0;
-      int offset;
-      data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, 
-								 rel_section));
-      if (data == NULL && bfd_section_size (abfd, rel_section) != 0)
-	return false;
-
-      datasize = bfd_section_size (abfd, rel_section);
-  
-      bfd_get_section_contents (abfd, 
-				rel_section, 
-				(PTR) data, 0, 
-				bfd_section_size (abfd, rel_section));
-
-      offset = abfd->start_address - rel_section->vma;
-
-      start_address = bfd_get_32(abfd, data+offset);
-      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,
-	       _("\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"));
+      /* This code used to set scnhdr_int->s_paddr to 0.  However,
+         coff_set_alignment_hook stores s_paddr in virt_size, which
+         only works if it correctly holds the virtual size of the
+         section.  */
     }
 #endif
-
-  fprintf(file,
-	  _("\nThe Import Tables (interpreted .idata section contents)\n"));
-  fprintf(file,
-	  _(" vma:            Hint    Time      Forward  DLL       First\n"));
-  fprintf(file,
-	  _("                 Table   Stamp     Chain    Name      Thunk\n"));
-
-  secsize = bfd_section_size (abfd, section);
-  data = (bfd_byte *) bfd_malloc (secsize);
-  if (data == NULL && secsize != 0)
-    return false;
-
-  if (! bfd_get_section_contents (abfd, section, (PTR) data, 0, secsize))
-    return false;
-
-  adj = (extra->ImageBase - section->vma) & 0xffffffff;
-
-  start = dataoff;
-  stop = dataoff + datasize;
-  for (i = start; i < stop; i += onaline)
-    {
-      bfd_vma hint_addr;
-      bfd_vma time_stamp;
-      bfd_vma forward_chain;
-      bfd_vma dll_name;
-      bfd_vma first_thunk;
-      int idx = 0;
-      bfd_size_type j;
-      char *dll;
-
-      fprintf (file,
-	       " %08lx\t", 
-	       (unsigned long int) (i + section->vma + dataoff));
-      
-      if (i+20 > stop)
-	{
-	  /* check stuff */
-	  ;
-	}
-      
-      hint_addr = bfd_get_32(abfd, data+i);
-      time_stamp = bfd_get_32(abfd, data+i+4);
-      forward_chain = bfd_get_32(abfd, data+i+8);
-      dll_name = bfd_get_32(abfd, data+i+12);
-      first_thunk = bfd_get_32(abfd, data+i+16);
-      
-      fprintf(file, "%08lx %08lx %08lx %08lx %08lx\n",
-	      hint_addr,
-	      time_stamp,
-	      forward_chain,
-	      dll_name,
-	      first_thunk);
-
-      if (hint_addr == 0 && first_thunk == 0)
-	break;
-
-      /* the image base is present in the section->vma */
-      dll = (char *) data + dll_name + adj;
-      fprintf(file, _("\n\tDLL Name: %s\n"), dll);
-
-      if (hint_addr != 0)
-	{
-	  fprintf (file, _("\tvma:  Hint/Ord Member-Name\n"));
-
-	  idx = hint_addr + adj;
-
-	  for (j = 0; j < stop; j += 4)
-	    {
-	      unsigned long member = bfd_get_32 (abfd, data + idx + j);
-
-	      if (member == 0)
-		break;
-	      if (member & 0x80000000)
-		fprintf (file, "\t%04lx\t %4lu", member,
-			 member & 0x7fffffff);
-	      else
-		{
-		  int ordinal;
-		  char *member_name;
-
-		  ordinal = bfd_get_16 (abfd, data + member + adj);
-		  member_name = (char *) data + member + adj + 2;
-		  fprintf (file, "\t%04lx\t %4d  %s",
-			   member, ordinal, member_name);
-		}
-
-	      /* If the time stamp is not zero, the import address
-                 table holds actual addresses.  */
-	      if (time_stamp != 0
-		  && first_thunk != 0
-		  && first_thunk != hint_addr)
-		fprintf (file, "\t%04lx",
-			 bfd_get_32 (abfd, data + first_thunk + adj + j));
-
-	      fprintf (file, "\n");
-	    }
-	}
-
-      if (hint_addr != first_thunk && time_stamp == 0)
-	{
-	  int differ = 0;
-	  int idx2;
-
-	  idx2 = first_thunk + adj;
-
-	  for (j=0;j<stop;j+=4)
-	    {
-	      int ordinal;
-	      char *member_name;
-	      bfd_vma hint_member = 0;
-	      bfd_vma iat_member;
-
-	      if (hint_addr != 0)
-		hint_member = bfd_get_32 (abfd, data + idx + j);
-	      iat_member = bfd_get_32 (abfd, data + idx2 + j);
-
-	      if (hint_addr == 0 && iat_member == 0)
-		break;
-
-	      if (hint_addr == 0 || hint_member != iat_member)
-		{
-		  if (differ == 0)
-		    {
-		      fprintf (file, 
-			       _("\tThe Import Address Table (difference found)\n"));
-		      fprintf(file, _("\tvma:  Hint/Ord Member-Name\n"));
-		      differ = 1;
-		    }
-		  if (iat_member == 0)
-		    {
-		      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",
-			      iat_member, ordinal, member_name);
-		    }
-		}
-
-	      if (hint_addr != 0 && hint_member == 0)
-		break;
-	    }
-	  if (differ == 0)
-	    {
-	      fprintf(file,
-		      _("\tThe Import Address Table is identical\n"));
-	    }
-	}
-
-      fprintf(file, "\n");
-
-    }
-
-  free (data);
-
-  return true;
-}
-
-static boolean
-pe_print_edata (abfd, vfile)
-     bfd *abfd;
-     PTR vfile;
-{
-  FILE *file = (FILE *) vfile;
-  bfd_byte *data = 0;
-  asection *section = bfd_get_section_by_name (abfd, ".edata");
-
-  bfd_size_type datasize;
-  bfd_size_type dataoff;
-  bfd_size_type i;
-
-  int 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;
-
-  pe_data_type *pe = pe_data (abfd);
-  struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
-
-  if (section != NULL)
-    {
-      datasize = bfd_section_size (abfd, section);
-      dataoff = 0;
-    }
-  else
-    {
-      bfd_vma addr, size;
-
-      addr = extra->DataDirectory[0].VirtualAddress;
-      size = extra->DataDirectory[0].Size;
-
-      if (addr == 0 || size == 0)
-	return true;
-
-      for (section = abfd->sections; section != NULL; section = section->next)
-	{
-	  if (section->vma - extra->ImageBase <= addr
-	      && ((section->vma - extra->ImageBase
-		   + bfd_section_size (abfd, section))
-		  >= addr + size))
-	    break;
-	}
-      if (section == NULL)
-	return true;
-
-      datasize = size;
-      dataoff = addr - (section->vma - extra->ImageBase);
-    }
-
-  data = (bfd_byte *) bfd_malloc (datasize);
-  if (data == NULL && datasize != 0)
-    return false;
-
-  if (! bfd_get_section_contents (abfd, section, (PTR) data, dataoff,
-				  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);
-
-  adj = (extra->ImageBase - (section->vma + dataoff)) & 0xffffffff;
-
-
-  /* Dump the EDT first first */
-  fprintf(file,
-	  _("\nThe Export Tables (interpreted .edata section contents)\n\n"));
-
-  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,
-	  _("Major/Minor \t\t\t%d/%d\n"), edt.major_ver, edt.minor_ver);
-
-  fprintf (file,
-	   _("Name \t\t\t\t"));
-  fprintf_vma (file, edt.name);
-  fprintf (file,
-	   " %s\n", data + edt.name + adj);
-
-  fprintf(file,
-	  _("Ordinal Base \t\t\t%ld\n"), edt.base);
-
-  fprintf(file,
-	  _("Number in:\n"));
-
-  fprintf(file,
-	  _("\tExport Address Table \t\t%lx\n"),
-	  edt.num_functions);
-
-  fprintf(file,
-	  _("\t[Name Pointer/Ordinal] Table\t%lu\n"), edt.num_names);
-
-  fprintf(file,
-	  _("Table Addresses\n"));
-
-  fprintf (file,
-	   _("\tExport Address Table \t\t"));
-  fprintf_vma (file, edt.eat_addr);
-  fprintf (file, "\n");
-
-  fprintf (file,
-	  _("\tName Pointer Table \t\t"));
-  fprintf_vma (file, edt.npt_addr);
-  fprintf (file, "\n");
-
-  fprintf (file,
-	   _("\tOrdinal Table \t\t\t"));
-  fprintf_vma (file, edt.ot_addr);
-  fprintf (file, "\n");
-
-  
-  /* The next table to find si 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 
-      {
-        long export_rva;
-        long forwarder_rva;
-      } export_address_table_entry;
-  */
-
-  fprintf(file,
-	  _("\nExport Address Table -- Ordinal Base %ld\n"),
-	  edt.base);
-
-  for (i = 0; i < edt.num_functions; ++i)
-    {
-      bfd_vma eat_member = bfd_get_32 (abfd, 
-				       data + edt.eat_addr + (i * 4) + adj);
-      bfd_vma eat_actual = (extra->ImageBase + eat_member) & 0xffffffff;
-      bfd_vma edata_start = bfd_get_section_vma (abfd,section) + dataoff;
-      bfd_vma edata_end = edata_start + datasize;
-
-      if (eat_member == 0)
-	continue;
-
-      if (edata_start < eat_actual && eat_actual < edata_end) 
-	{
-	  /* this rva is to a name (forwarding function) in our section */
-	  /* Should locate a function descriptor */
-	  fprintf(file,
-		  "\t[%4ld] +base[%4ld] %04lx %s -- %s\n", 
-		  (long) i, (long) (i + edt.base), eat_member,
-		  "Forwarder RVA", data + eat_member + adj);
-	}
-      else
-	{
-	  /* Should locate a function descriptor in the reldata section */
-	  fprintf(file,
-		  "\t[%4ld] +base[%4ld] %04lx %s\n", 
-		  (long) i, (long) (i + edt.base), eat_member, "Export RVA");
-	}
-    }
-
-  /* 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, 
-				    data + 
-				    edt.npt_addr
-				    + (i*4) + adj);
-      
-      char *name = (char *) data + name_ptr + adj;
-
-      bfd_vma ord = bfd_get_16(abfd, 
-				    data + 
-				    edt.ot_addr
-				    + (i*2) + adj);
-      fprintf(file,
-	      "\t[%4ld] %s\n", (long) ord, name);
-
-    }
-
-  free (data);
-
-  return true;
-}
-
-static boolean
-pe_print_pdata (abfd, vfile)
-     bfd  *abfd;
-     PTR vfile;
-{
-  FILE *file = (FILE *) vfile;
-  bfd_byte *data = 0;
-  asection *section = bfd_get_section_by_name (abfd, ".pdata");
-  bfd_size_type datasize = 0;
-  bfd_size_type i;
-  bfd_size_type start, stop;
-  int onaline = 20;
-
-  if (section == 0)
-    return true;
-
-  stop = bfd_section_size (abfd, section);
-  if ((stop % onaline) != 0)
-    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"));
-  fprintf(file,
-	  _(" vma:\t\tBegin    End      EH       EH       PrologEnd\n"));
-  fprintf(file,
-	  _("     \t\tAddress  Address  Handler  Data     Address\n"));
-
-  if (bfd_section_size (abfd, section) == 0)
-    return true;
-
-  data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
-  datasize = bfd_section_size (abfd, section);
-  if (data == NULL && datasize != 0)
-    return false;
-
-  bfd_get_section_contents (abfd, 
-			    section, 
-			    (PTR) data, 0, 
-			    bfd_section_size (abfd, section));
-
-  start = 0;
-
-  for (i = start; i < stop; i += onaline)
-    {
-      bfd_vma begin_addr;
-      bfd_vma end_addr;
-      bfd_vma eh_handler;
-      bfd_vma eh_data;
-      bfd_vma prolog_end_addr;
-
-      if (i+20 > stop)
-	  break;
-      
-      begin_addr = bfd_get_32(abfd, data+i);
-      end_addr = bfd_get_32(abfd, data+i+4);
-      eh_handler = bfd_get_32(abfd, data+i+8);
-      eh_data = bfd_get_32(abfd, data+i+12);
-      prolog_end_addr = bfd_get_32(abfd, data+i+16);
-      
-      if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
-	  && eh_data == 0 && prolog_end_addr == 0)
-	{
-	  /* We are probably into the padding of the
-	     section now */
-	  break;
-	}
-
-      fprintf (file,
-	       " %08lx\t", 
-	       (unsigned long int) (i + section->vma));
-
-      fprintf(file, "%08lx %08lx %08lx %08lx %08lx",
-	      begin_addr,
-	      end_addr,
-	      eh_handler,
-	      eh_data,
-	      prolog_end_addr);
-
-#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.                           */
-	  /* Code Significance                           */
-	  /* 0x00 None                                   */
-	  /* 0x01 Register Save Millicode                */
-	  /* 0x02 Register Restore Millicode             */
-	  /* 0x03 Glue Code Sequence                     */
-	  switch (eh_data)
-	    {
-	    case 0x01:
-	      fprintf(file, _(" Register save millicode"));
-	      break;
-	    case 0x02:
-	      fprintf(file, _(" Register restore millicode"));
-	      break;
-	    case 0x03:
-	      fprintf(file, _(" Glue code sequence"));
-	      break;
-	    default:
-	      break;
-	    }
-	}
-#endif	   
-      fprintf(file, "\n");
-    }
-
-  free (data);
-
-  return true;
-}
-
-static const char *tbl[6] =
-{
-"ABSOLUTE",
-"HIGH",
-"LOW",
-"HIGHLOW",
-"HIGHADJ",
-"MIPS_JMPADDR"
-};
-
-static boolean
-pe_print_reloc (abfd, vfile)
-     bfd *abfd;
-     PTR vfile;
-{
-  FILE *file = (FILE *) vfile;
-  bfd_byte *data = 0;
-  asection *section = bfd_get_section_by_name (abfd, ".reloc");
-  bfd_size_type datasize = 0;
-  bfd_size_type i;
-  bfd_size_type start, stop;
-
-  if (section == 0)
-    return true;
-
-  if (bfd_section_size (abfd, section) == 0)
-    return true;
-
-  fprintf(file,
-	  _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
-
-  data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
-  datasize = bfd_section_size (abfd, section);
-  if (data == NULL && datasize != 0)
-    return false;
-
-  bfd_get_section_contents (abfd, 
-			    section, 
-			    (PTR) data, 0, 
-			    bfd_section_size (abfd, section));
-
-  start = 0;
-
-  stop = bfd_section_size (abfd, section);
-
-  for (i = start; i < stop;)
-    {
-      int j;
-      bfd_vma virtual_address;
-      long number, size;
-
-      /* 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);
-      number = (size - 8) / 2;
-
-      if (size == 0) 
-	{
-	  break;
-	}
-
-      fprintf (file,
-	       _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
-	       virtual_address, size, size, number);
-
-      for (j = 0; j < number; ++j)
-	{
-	  unsigned short e = bfd_get_16(abfd, data + i + 8 + j*2);
-	  int t =   (e & 0xF000) >> 12;
-	  int off = e & 0x0FFF;
-
-	  if (t > 5) 
-	    abort();
-
-	  fprintf(file,
-		  _("\treloc %4d offset %4x [%4lx] %s\n"), 
-		  j, off, (long) (off + virtual_address), tbl[t]);
-	  
-	}
-      i += size;
-    }
-
-  free (data);
-
-  return true;
-}
-
-static boolean
-pe_print_private_bfd_data (abfd, vfile)
-     bfd *abfd;
-     PTR vfile;
-{
-  FILE *file = (FILE *) vfile;
-  int j;
-  pe_data_type *pe = pe_data (abfd);
-  struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
-
-  /* The MS dumpbin program reportedly ands with 0xff0f before
-     printing the characteristics field.  Not sure why.  No reason to
-     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); }
-  PF (F_RELFLG, "relocations stripped");
-  PF (F_EXEC, "executable");
-  PF (F_LNNO, "line numbers stripped");
-  PF (F_LSYMS, "symbols stripped");
-  PF (0x80, "little endian");
-  PF (F_AR32WR, "32 bit words");
-  PF (0x200, "debugging information removed");
-  PF (0x1000, "system file");
-  PF (F_DLL, "DLL");
-  PF (0x8000, "big endian");
-#undef PF
-
-  fprintf (file,"\nImageBase\t\t");
-  fprintf_vma (file, i->ImageBase);
-  fprintf (file,"\nSectionAlignment\t");
-  fprintf_vma (file, i->SectionAlignment);
-  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,"Reserved1\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,"Subsystem\t\t%08x\n", i->Subsystem);
-  fprintf (file,"DllCharacteristics\t%08x\n", i->DllCharacteristics);
-  fprintf (file,"SizeOfStackReserve\t");
-  fprintf_vma (file, i->SizeOfStackReserve);
-  fprintf (file,"\nSizeOfStackCommit\t");
-  fprintf_vma (file, i->SizeOfStackCommit);
-  fprintf (file,"\nSizeOfHeapReserve\t");
-  fprintf_vma (file, i->SizeOfHeapReserve);
-  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,"\nThe Data Directory\n");
-  for (j = 0; j < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; j++) 
-    {
-      fprintf (file, "Entry %1x ", j);
-      fprintf_vma (file, i->DataDirectory[j].VirtualAddress);
-      fprintf (file, " %08lx ", i->DataDirectory[j].Size);
-      fprintf (file, "%s\n", dir_names[j]);
-    }
-
-  pe_print_idata (abfd, vfile);
-  pe_print_edata (abfd, vfile);
-  pe_print_pdata (abfd, vfile);
-  pe_print_reloc (abfd, vfile);
-
-  if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
-    {
-      fputc ('\n', file);
-  
-      return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
-    }
-
-  return true;
 }
 
 static boolean
@@ -2010,6 +317,8 @@
   pe = pe_data (abfd);
 
   pe->coff.pe = 1;
+
+  /* in_reloc_p is architecture dependent.  */
   pe->in_reloc_p = in_reloc_p;
   return true;
 }
@@ -2019,7 +328,7 @@
 pe_mkobject_hook (abfd, filehdr, aouthdr)
      bfd * abfd;
      PTR filehdr;
-     PTR aouthdr;
+     PTR aouthdr ATTRIBUTE_UNUSED;
 {
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
   pe_data_type *pe;
@@ -2040,6 +349,8 @@
   pe->coff.local_auxesz = AUXESZ;
   pe->coff.local_linesz = LINESZ;
 
+  pe->coff.timestamp = internal_f->f_timdat;
+
   obj_raw_syment_count (abfd) =
     obj_conv_table_size (abfd) =
       internal_f->f_nsyms;
@@ -2049,6 +360,9 @@
   if ((internal_f->f_flags & F_DLL) != 0)
     pe->dll = 1;
 
+  if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
+    abfd->flags |= HAS_DEBUG;
+
 #ifdef COFF_IMAGE_WITH_PE
   if (aouthdr) 
     pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe;
@@ -2062,83 +376,952 @@
   return (PTR) pe;
 }
 
-
-
-/* Copy any private info we understand from the input bfd
-   to the output bfd.  */
-
-#ifdef coff_bfd_copy_private_bfd_data
-static boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
-     PARAMS ((bfd *, bfd *))
-     = coff_bfd_copy_private_bfd_data;
-#undef coff_bfd_copy_private_bfd_data
-#else
-static boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
-     PARAMS ((bfd *, bfd *))
-     = NULL;
-#endif
-#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
-
 static boolean
-pe_bfd_copy_private_bfd_data (ibfd, obfd)
-     bfd *ibfd, *obfd;
+pe_print_private_bfd_data (abfd, vfile)
+     bfd *abfd;
+     PTR vfile;
 {
-  /* One day we may try to grok other private data.  */
-  if (ibfd->xvec->flavour != bfd_target_coff_flavour
-      || obfd->xvec->flavour != bfd_target_coff_flavour)
-    return true;
+  FILE *file = (FILE *) vfile;
 
-  pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
-  pe_data (obfd)->dll = pe_data (ibfd)->dll;
+  if (!_bfd_pe_print_private_bfd_data_common (abfd, vfile))
+    return false;
 
-  if (pe_saved_coff_bfd_copy_private_bfd_data)
-    return pe_saved_coff_bfd_copy_private_bfd_data (ibfd, obfd);
-  
-  return true;
-}
-
-#ifdef COFF_IMAGE_WITH_PE
-
-/* Copy private section data.  */
-
-#define coff_bfd_copy_private_section_data pe_bfd_copy_private_section_data
-
-static boolean pe_bfd_copy_private_section_data
-  PARAMS ((bfd *, asection *, bfd *, asection *));
-
-static boolean
-pe_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
-     bfd *ibfd;
-     asection *isec;
-     bfd *obfd;
-     asection *osec;
-{
-  if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
-      || bfd_get_flavour (obfd) != bfd_target_coff_flavour)
-    return true;
-
-  if (coff_section_data (ibfd, isec) != NULL
-      && pei_section_data (ibfd, isec) != NULL)
+  if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
     {
-      if (coff_section_data (obfd, osec) == NULL)
-	{
-	  osec->used_by_bfd =
-	    (PTR) bfd_zalloc (obfd, sizeof (struct coff_section_tdata));
-	  if (osec->used_by_bfd == NULL)
-	    return false;
-	}
-      if (pei_section_data (obfd, osec) == NULL)
-	{
-	  coff_section_data (obfd, osec)->tdata =
-	    (PTR) bfd_zalloc (obfd, sizeof (struct pei_section_tdata));
-	  if (coff_section_data (obfd, osec)->tdata == NULL)
-	    return false;
-	}
-      pei_section_data (obfd, osec)->virt_size =
-	pei_section_data (ibfd, isec)->virt_size;
+      fputc ('\n', file);
+
+      return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
     }
 
   return true;
 }
 
+/* Copy any private info we understand from the input bfd
+   to the output bfd.  */
+
+static boolean
+pe_bfd_copy_private_bfd_data (ibfd, obfd)
+     bfd *ibfd, *obfd;
+{
+  if (!_bfd_pe_bfd_copy_private_bfd_data_common (ibfd, obfd))
+    return false;
+
+  if (pe_saved_coff_bfd_copy_private_bfd_data)
+    return pe_saved_coff_bfd_copy_private_bfd_data (ibfd, obfd);
+
+  return true;
+}
+
+#define coff_bfd_copy_private_section_data \
+  _bfd_pe_bfd_copy_private_section_data
+
+#define coff_get_symbol_info _bfd_pe_get_symbol_info
+
+#ifdef COFF_IMAGE_WITH_PE
+
+/* Code to handle Microsoft's Image Library Format.
+   Also known as LINK6 format.
+   Documentation about this format can be found at: 
+
+   http://msdn.microsoft.com/library/specs/pecoff_section8.htm  */
+
+/* The following constants specify the sizes of the various data
+   structures that we have to create in order to build a bfd describing
+   an ILF object file.  The final "+ 1" in the definitions of SIZEOF_IDATA6
+   and SIZEOF_IDATA7 below is to allow for the possibility that we might
+   need a padding byte in order to ensure 16 bit alignment for the section's
+   contents.
+
+   The value for SIZEOF_ILF_STRINGS is computed as follows:
+
+      There will be NUM_ILF_SECTIONS section symbols.  Allow 9 characters
+      per symbol for their names (longest section name is .idata$x).
+
+      There will be two symbols for the imported value, one the symbol name
+      and one with _imp__ prefixed.  Allowing for the terminating nul's this
+      is strlen (symbol_name) * 2 + 8 + 21 + strlen (source_dll).
+
+      The strings in the string table must start STRING__SIZE_SIZE bytes into
+      the table in order to for the string lookup code in coffgen/coffcode to
+      work.  */
+#define NUM_ILF_RELOCS		8
+#define NUM_ILF_SECTIONS        6
+#define NUM_ILF_SYMS 		(2 + NUM_ILF_SECTIONS)
+  
+#define SIZEOF_ILF_SYMS		(NUM_ILF_SYMS * sizeof (* vars.sym_cache))
+#define SIZEOF_ILF_SYM_TABLE	(NUM_ILF_SYMS * sizeof (* vars.sym_table))
+#define SIZEOF_ILF_NATIVE_SYMS	(NUM_ILF_SYMS * sizeof (* vars.native_syms))
+#define SIZEOF_ILF_SYM_PTR_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_ptr_table))
+#define SIZEOF_ILF_EXT_SYMS	(NUM_ILF_SYMS * sizeof (* vars.esym_table))
+#define SIZEOF_ILF_RELOCS	(NUM_ILF_RELOCS * sizeof (* vars.reltab))
+#define SIZEOF_ILF_INT_RELOCS	(NUM_ILF_RELOCS * sizeof (* vars.int_reltab))
+#define SIZEOF_ILF_STRINGS	(strlen (symbol_name) * 2 + 8 \
+					+ 21 + strlen (source_dll) \
+					+ NUM_ILF_SECTIONS * 9 \
+					+ STRING_SIZE_SIZE)
+#define SIZEOF_IDATA2		(5 * 4)
+#define SIZEOF_IDATA4		(1 * 4)
+#define SIZEOF_IDATA5		(1 * 4)
+#define SIZEOF_IDATA6		(2 + strlen (symbol_name) + 1 + 1)
+#define SIZEOF_IDATA7		(strlen (source_dll) + 1 + 1)
+#define SIZEOF_ILF_SECTIONS     (NUM_ILF_SECTIONS * sizeof (struct coff_section_tdata))
+  
+#define ILF_DATA_SIZE				\
+      sizeof (* vars.bim)			\
+    + SIZEOF_ILF_SYMS				\
+    + SIZEOF_ILF_SYM_TABLE			\
+    + SIZEOF_ILF_NATIVE_SYMS			\
+    + SIZEOF_ILF_SYM_PTR_TABLE			\
+    + SIZEOF_ILF_EXT_SYMS			\
+    + SIZEOF_ILF_RELOCS				\
+    + SIZEOF_ILF_INT_RELOCS			\
+    + SIZEOF_ILF_STRINGS			\
+    + SIZEOF_IDATA2				\
+    + SIZEOF_IDATA4				\
+    + SIZEOF_IDATA5				\
+    + SIZEOF_IDATA6				\
+    + SIZEOF_IDATA7				\
+    + SIZEOF_ILF_SECTIONS			\
+    + MAX_TEXT_SECTION_SIZE
+
+
+/* Create an empty relocation against the given symbol.  */
+static void
+pe_ILF_make_a_symbol_reloc (pe_ILF_vars *                 vars,
+			    bfd_vma                       address,
+			    bfd_reloc_code_real_type      reloc,
+			    struct symbol_cache_entry **  sym,
+			    unsigned int                  sym_index)
+{
+  arelent * entry;
+  struct internal_reloc * internal;
+
+  entry = vars->reltab + vars->relcount;
+  internal = vars->int_reltab + vars->relcount;
+  
+  entry->address     = address;
+  entry->addend      = 0;
+  entry->howto       = bfd_reloc_type_lookup (vars->abfd, reloc);
+  entry->sym_ptr_ptr = sym;
+
+  internal->r_vaddr  = address;
+  internal->r_symndx = sym_index;
+  internal->r_type   = entry->howto->type;
+#if 0  /* These fields do not need to be initialised.  */
+  internal->r_size   = 0;
+  internal->r_extern = 0;
+  internal->r_offset = 0;
 #endif
+  
+  vars->relcount ++;
+  
+  BFD_ASSERT (vars->relcount <= NUM_ILF_RELOCS);
+}
+
+/* Create an empty relocation against the given section.  */
+static void
+pe_ILF_make_a_reloc (pe_ILF_vars *             vars,
+		     bfd_vma                   address,
+		     bfd_reloc_code_real_type  reloc,
+		     asection_ptr              sec)
+{
+  pe_ILF_make_a_symbol_reloc (vars, address, reloc, sec->symbol_ptr_ptr,
+			      coff_section_data (vars->abfd, sec)->i);
+}
+
+/* Move the queued relocs into the given section.  */
+static void
+pe_ILF_save_relocs (pe_ILF_vars * vars,
+		    asection_ptr  sec)
+{
+  /* Make sure that there is somewhere to store the internal relocs.  */
+  if (coff_section_data (vars->abfd, sec) == NULL)
+    /* We should probably return an error indication here.  */
+    abort ();
+
+  coff_section_data (vars->abfd, sec)->relocs = vars->int_reltab;
+  coff_section_data (vars->abfd, sec)->keep_relocs = true;
+
+  sec->relocation  = vars->reltab;
+  sec->reloc_count = vars->relcount;
+  sec->flags      |= SEC_RELOC;
+
+  vars->reltab     += vars->relcount;
+  vars->int_reltab += vars->relcount;
+  vars->relcount   = 0;
+
+  BFD_ASSERT ((bfd_byte *)vars->int_reltab < (bfd_byte *)vars->string_table);
+}
+
+/* Create a global symbol and add it to the relevant tables.  */
+static void
+pe_ILF_make_a_symbol (pe_ILF_vars *  vars,
+		      const char *   prefix,
+		      const char *   symbol_name,
+		      asection_ptr   section,
+		      flagword       extra_flags)
+{
+  coff_symbol_type * sym;
+  combined_entry_type * ent;
+  SYMENT * esym;
+  unsigned short sclass;
+
+  if (extra_flags & BSF_LOCAL)
+    sclass = C_STAT;
+  else
+    sclass = C_EXT;
+  
+#ifdef THUMBPEMAGIC  
+  if (vars->magic == THUMBPEMAGIC)
+    {
+      if (extra_flags & BSF_FUNCTION)
+	sclass = C_THUMBEXTFUNC;
+      else if (extra_flags & BSF_LOCAL)
+	sclass = C_THUMBSTAT;
+      else
+	sclass = C_THUMBEXT;
+    }
+#endif
+
+  BFD_ASSERT (vars->sym_index < NUM_ILF_SYMS);
+  
+  sym = vars->sym_ptr;
+  ent = vars->native_ptr;
+  esym = vars->esym_ptr;
+
+  /* Copy the symbol's name into the string table.  */
+  sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
+
+  if (section == NULL)
+    section = (asection_ptr) & bfd_und_section;
+  
+  /* Initialise the external symbol.  */
+  bfd_h_put_32 (vars->abfd, vars->string_ptr - vars->string_table, (bfd_byte *) esym->e.e.e_offset);
+  bfd_h_put_16 (vars->abfd, section->target_index, (bfd_byte *) esym->e_scnum);
+  esym->e_sclass[0] = sclass;
+
+  /* The following initialisations are unnecessary - the memory is
+     zero initialised.  They are just kept here as reminders.  */
+#if 0
+  esym->e.e.e_zeroes = 0;
+  esym->e_value = 0;
+  esym->e_type = T_NULL;
+  esym->e_numaux = 0;
+#endif
+  
+  /* Initialise the internal symbol structure.  */
+  ent->u.syment.n_sclass          = sclass;
+  ent->u.syment.n_scnum           = section->target_index;
+  ent->u.syment._n._n_n._n_offset = (long) sym;
+  
+#if 0 /* See comment above.  */
+  ent->u.syment.n_value  = 0;
+  ent->u.syment.n_flags  = 0;
+  ent->u.syment.n_type   = T_NULL;
+  ent->u.syment.n_numaux = 0;
+  ent->fix_value         = 0;
+#endif
+  
+  sym->symbol.the_bfd = vars->abfd;
+  sym->symbol.name    = vars->string_ptr;
+  sym->symbol.flags   = BSF_EXPORT | BSF_GLOBAL | extra_flags;
+  sym->symbol.section = section;
+  sym->native         = ent;
+  
+#if 0 /* See comment above.  */
+  sym->symbol.value   = 0;
+  sym->symbol.udata.i = 0;
+  sym->done_lineno    = false;
+  sym->lineno         = NULL;
+#endif
+  
+  * vars->table_ptr = vars->sym_index;
+  * vars->sym_ptr_ptr = sym;
+  
+  /* Adjust pointers for the next symbol.  */
+  vars->sym_index ++;
+  vars->sym_ptr ++;
+  vars->sym_ptr_ptr ++;
+  vars->table_ptr ++;
+  vars->native_ptr ++;
+  vars->esym_ptr ++;
+  vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1;
+
+  BFD_ASSERT (vars->string_ptr < vars->end_string_ptr);
+}
+
+/* Create a section.  */
+static asection_ptr
+pe_ILF_make_a_section (pe_ILF_vars * vars,
+		       const char *  name,
+		       unsigned int  size,
+		       flagword      extra_flags)
+{
+  asection_ptr sec;
+  flagword     flags;
+  
+  sec = bfd_make_section_old_way (vars->abfd, name);
+  if (sec == NULL)
+    return NULL;
+  
+  flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_IN_MEMORY;
+  
+  bfd_set_section_flags (vars->abfd, sec, flags | extra_flags);
+     
+  bfd_set_section_alignment (vars->abfd, sec, 2);
+  
+  /* Check that we will not run out of space.  */
+  BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);
+  
+  /* Set the section size and contents.  The actual
+     contents are filled in by our parent.  */
+  bfd_set_section_size (vars->abfd, sec, size);
+  sec->contents = vars->data;
+  sec->target_index = vars->sec_index ++;
+
+  /* Advance data pointer in the vars structure.  */
+  vars->data += size;
+  
+  /* Skip the padding byte if it was not needed.
+     The logic here is that if the string length is odd,
+     then the entire string length, including the null byte,
+     is even and so the extra, padding byte, is not needed.  */
+  if (size & 1)
+    vars->data --;
+  
+  /* Create a coff_section_tdata structure for our use.  */
+  sec->used_by_bfd = (struct coff_section_tdata *) vars->data;
+  vars->data += sizeof (struct coff_section_tdata);
+
+  BFD_ASSERT (vars->data <= vars->bim->buffer + vars->bim->size);
+  
+  /* Create a symbol to refer to this section.  */
+  pe_ILF_make_a_symbol (vars, "", name, sec, BSF_LOCAL);
+
+  /* Cache the index to the symbol in the coff_section_data structure.  */
+  coff_section_data (vars->abfd, sec)->i = vars->sym_index - 1;
+  
+  return sec;
+}
+
+/* This structure contains the code that goes into the .text section
+   in order to perform a jump into the DLL lookup table.  The entries
+   in the table are index by the magic number used to represent the
+   machine type in the PE file.  The contents of the data[] arrays in
+   these entries are stolen from the jtab[] arrays in ld/pe-dll.c.
+   The SIZE field says how many bytes in the DATA array are actually
+   used.  The OFFSET field says where in the data array the address
+   of the .idata$5 section should be placed.  */
+#define MAX_TEXT_SECTION_SIZE 32
+
+typedef struct
+{
+  unsigned short magic;
+  unsigned char  data[MAX_TEXT_SECTION_SIZE];
+  unsigned int   size;
+  unsigned int   offset;
+}
+jump_table;
+
+static jump_table jtab[] =
+{
+#ifdef I386MAGIC
+  { I386MAGIC,
+    { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 },
+    8, 2
+  },
+#endif
+  
+#ifdef  MC68MAGIC
+  { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 },
+#endif
+#ifdef  MIPS_ARCH_MAGIC_WINCE
+  { MIPS_ARCH_MAGIC_WINCE,
+    { 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d,
+      0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 },
+    16, 0
+  },
+#endif
+  
+#ifdef  SH_ARCH_MAGIC_WINCE
+  { SH_ARCH_MAGIC_WINCE,
+    { 0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40,
+      0x09, 0x00, 0x00, 0x00, 0x00, 0x00 },
+    12, 8
+  },
+#endif
+  
+#ifdef  ARMPEMAGIC
+  { ARMPEMAGIC,
+    { 0x00, 0xc0, 0x9f, 0xe5, 0x00, 0xf0,
+      0x9c, 0xe5, 0x00, 0x00, 0x00, 0x00},
+    12, 8
+  },
+#endif
+  
+#ifdef  THUMBPEMAGIC
+  { THUMBPEMAGIC,
+    { 0x40, 0xb4, 0x02, 0x4e, 0x36, 0x68, 0xb4, 0x46,
+      0x40, 0xbc, 0x60, 0x47, 0x00, 0x00, 0x00, 0x00 },
+    16, 12
+  },
+#endif
+  { 0, { 0 }, 0, 0 }
+};
+
+#ifndef NUM_ENTRIES
+#define NUM_ENTRIES(a) (sizeof (a) / sizeof (a)[0])
+#endif
+
+/* Build a full BFD from the information supplied in a ILF object.  */
+static boolean
+pe_ILF_build_a_bfd (bfd *           abfd,
+		    unsigned short  magic,
+		    bfd_byte *      symbol_name,
+		    bfd_byte *      source_dll,
+		    unsigned int    ordinal,
+		    unsigned int    types)
+{ 
+  bfd_byte *               ptr;
+  pe_ILF_vars              vars;
+  struct internal_filehdr  internal_f;
+  unsigned int             import_type;
+  unsigned int             import_name_type;
+  asection_ptr             id4, id5, id6 = NULL, text = NULL;
+  coff_symbol_type **      imp_sym;
+  unsigned int             imp_index;
+
+  /* Decode and verify the types field of the ILF structure.  */
+  import_type = types & 0x3;
+  import_name_type = (types & 0x1c) >> 2;
+
+  switch (import_type)
+    {
+    case IMPORT_CODE:
+    case IMPORT_DATA:
+      break;
+      
+    case IMPORT_CONST:
+      /* XXX code yet to be written.  */
+      _bfd_error_handler (_("%s: Unhandled import type; %x"),
+			  bfd_get_filename (abfd), import_type);
+      return false;
+      
+    default:
+      _bfd_error_handler (_("%s: Unrecognised import type; %x"),
+			  bfd_get_filename (abfd), import_type);
+      return false;
+    }
+
+  switch (import_name_type)
+    {
+    case IMPORT_ORDINAL:
+    case IMPORT_NAME:
+    case IMPORT_NAME_NOPREFIX:
+    case IMPORT_NAME_UNDECORATE:
+      break;
+      
+    default:
+      _bfd_error_handler (_("%s: Unrecognised import name type; %x"),
+			  bfd_get_filename (abfd), import_name_type);
+      return false;
+    }
+
+  /* Initialise local variables.
+     
+     Note these are kept in a structure rather than being
+     declared as statics since bfd frowns on global variables.
+     
+     We are going to construct the contents of the BFD in memory,
+     so allocate all the space that we will need right now.  */
+  ptr = bfd_zalloc (abfd, ILF_DATA_SIZE);
+  if (ptr == NULL)
+    return false;
+
+  /* Create a bfd_in_memory structure.  */
+  vars.bim = (struct bfd_in_memory *) ptr;
+  vars.bim->buffer = ptr;
+  vars.bim->size   = ILF_DATA_SIZE;
+  ptr += sizeof (* vars.bim);
+  
+  /* Initialise the pointers to regions of the memory and the
+     other contents of the pe_ILF_vars structure as well.  */
+  vars.sym_cache = (coff_symbol_type *) ptr;
+  vars.sym_ptr   = (coff_symbol_type *) ptr;
+  vars.sym_index = 0;
+  ptr += SIZEOF_ILF_SYMS;
+  
+  vars.sym_table = (unsigned int *) ptr;
+  vars.table_ptr = (unsigned int *) ptr;
+  ptr += SIZEOF_ILF_SYM_TABLE;
+
+  vars.native_syms = (combined_entry_type *) ptr;
+  vars.native_ptr  = (combined_entry_type *) ptr;
+  ptr += SIZEOF_ILF_NATIVE_SYMS;
+
+  vars.sym_ptr_table = (coff_symbol_type **) ptr;
+  vars.sym_ptr_ptr   = (coff_symbol_type **) ptr;
+  ptr += SIZEOF_ILF_SYM_PTR_TABLE;
+  
+  vars.esym_table = (SYMENT *) ptr;
+  vars.esym_ptr   = (SYMENT *) ptr;
+  ptr += SIZEOF_ILF_EXT_SYMS;
+  
+  vars.reltab   = (arelent *) ptr;
+  vars.relcount = 0;
+  ptr += SIZEOF_ILF_RELOCS;
+
+  vars.int_reltab  = (struct internal_reloc *) ptr;
+  ptr += SIZEOF_ILF_INT_RELOCS;
+
+  vars.string_table = ptr;
+  vars.string_ptr   = ptr + STRING_SIZE_SIZE;
+  ptr += SIZEOF_ILF_STRINGS;
+  vars.end_string_ptr = ptr;
+  
+  /* The remaining space in bim->buffer is used
+     by the pe_ILF_make_a_section() function.  */
+  vars.data = ptr;
+  vars.abfd = abfd;
+  vars.sec_index = 0;
+  vars.magic = magic;
+  
+  /* Create the initial .idata$<n> sections:
+     [.idata$2:  Import Directory Table -- not needed]
+     .idata$4:  Import Lookup Table
+     .idata$5:  Import Address Table
+
+     Note we do not create a .idata$3 section as this is
+     created for us by the linker script.  */
+  id4 = pe_ILF_make_a_section (& vars, ".idata$4", SIZEOF_IDATA4, 0);
+  id5 = pe_ILF_make_a_section (& vars, ".idata$5", SIZEOF_IDATA5, 0);
+  if (id4 == NULL || id5 == NULL)
+    return false;
+  
+  /* Fill in the contents of these sections.  */
+  if (import_name_type == IMPORT_ORDINAL)
+    {
+      if (ordinal == 0)
+	/* XXX - treat as IMPORT_NAME ??? */
+	abort ();
+      
+      * (unsigned int *) id4->contents = ordinal | 0x80000000UL;
+      * (unsigned int *) id5->contents = ordinal | 0x80000000UL;
+    }
+  else
+    {
+      char * symbol;
+      
+      /* Create .idata$6 - the Hint Name Table.  */
+      id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0);
+      if (id6 == NULL)
+	return false;
+
+      /* If necessary, trim the import symbol name.  */
+      symbol = symbol_name;
+
+      if (import_name_type != IMPORT_NAME)
+	/* Skip any prefix in symbol_name.  */
+	while (*symbol == '@' || * symbol == '?' || * symbol == '_')
+	  ++ symbol;
+
+      if (import_name_type == IMPORT_NAME_UNDECORATE)
+	{
+	  /* Truncate at the first '@'  */
+	  while (* symbol != 0 && * symbol != '@')
+	    symbol ++;
+
+	  * symbol = 0;
+	}
+      
+      id6->contents[0] = ordinal & 0xff;
+      id6->contents[1] = ordinal >> 8;
+      
+      strcpy (id6->contents + 2, symbol);
+    }
+
+  if (import_name_type != IMPORT_ORDINAL)
+    {
+      pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6);
+      pe_ILF_save_relocs (& vars, id4);
+      
+      pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6);
+      pe_ILF_save_relocs (& vars, id5);
+    }
+
+  /* Create extra sections depending upon the type of import we are dealing with.  */
+  switch (import_type)
+    {
+      int i;
+      
+    case IMPORT_CODE:
+      /* Create a .text section.
+	 First we need to look up its contents in the jump table.  */
+      for (i = NUM_ENTRIES (jtab); i--;)
+	{
+	  if (jtab[i].size == 0)
+	    continue;
+	  if (jtab[i].magic == magic)
+	    break;
+	}
+      /* If we did not find a matching entry something is wrong.  */
+      if (i < 0)
+	abort ();
+
+      /* Create the .text section.  */
+      text = pe_ILF_make_a_section (& vars, ".text", jtab[i].size, SEC_CODE);
+      if (text == NULL)
+	return false;
+
+      /* Copy in the jump code.  */
+      memcpy (text->contents, jtab[i].data, jtab[i].size);
+
+      /* Create an import symbol.  */
+      pe_ILF_make_a_symbol (& vars, "__imp_", symbol_name, id5, 0);
+      imp_sym   = vars.sym_ptr_ptr - 1;
+      imp_index = vars.sym_index - 1;
+    
+      /* Create a reloc for the data in the text section.  */
+#ifdef MIPS_ARCH_MAGIC_WINCE      
+      if (magic == MIPS_ARCH_MAGIC_WINCE)
+	{
+	  pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S,
+				      (asection **) 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);
+	}
+      else
+#endif
+	pe_ILF_make_a_symbol_reloc (& vars, jtab[i].offset, BFD_RELOC_32,
+				    (asymbol **) imp_sym, imp_index);
+      
+      pe_ILF_save_relocs (& vars, text);
+      break;
+
+    case IMPORT_DATA:
+      break;
+
+    default:
+      /* XXX code not yet written.  */
+      abort ();
+    }
+  
+  /* Initialise the bfd.  */
+  memset (& internal_f, 0, sizeof (internal_f));
+  
+  internal_f.f_magic  = magic;
+  internal_f.f_symptr = 0;
+  internal_f.f_nsyms  = 0;
+  internal_f.f_flags  = F_AR32WR | F_LNNO; /* XXX is this correct ?  */
+  
+  if (   ! bfd_set_start_address (abfd, 0)
+      || ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
+    return false;
+
+  if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL)
+    return false;
+
+  coff_data (abfd)->pe = 1;
+#ifdef THUMBPEMAGIC  
+  if (vars.magic == THUMBPEMAGIC)
+    /* Stop some linker warnings about thumb code not supporting interworking.  */
+    coff_data (abfd)->flags |= F_INTERWORK | F_INTERWORK_SET;
+#endif
+    
+  /* Switch from file contents to memory contents.  */
+  bfd_cache_close (abfd);
+
+  abfd->iostream = (PTR) vars.bim;
+  abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */;
+  abfd->where = 0;
+  obj_sym_filepos (abfd) = 0;
+
+  /* Now create a symbol describing the imported value.  */
+  switch (import_type)
+    {
+      bfd_byte * ptr;
+      
+    case IMPORT_CODE:
+      pe_ILF_make_a_symbol (& vars, "", symbol_name, text,
+			    BSF_NOT_AT_END | BSF_FUNCTION);
+      
+      /* Create an import symbol for the DLL, without the
+       .dll suffix.  */
+      ptr = strrchr (source_dll, '.');
+      if (ptr)
+	* ptr = 0;
+      pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0);
+      if (ptr)
+	* ptr = '.';
+      break;
+
+    case IMPORT_DATA:
+      /* Nothing to do here.  */
+      break;
+      
+    default:
+      /* XXX code not yet written.  */
+      abort ();
+    }
+
+  /* Point the bfd at the symbol table.  */
+  obj_symbols (abfd) = vars.sym_cache;
+  bfd_get_symcount (abfd) = vars.sym_index;
+  
+  obj_raw_syments (abfd) = vars.native_syms;
+  obj_raw_syment_count (abfd) = vars.sym_index;
+
+  obj_coff_external_syms (abfd) = (PTR) vars.esym_table;
+  obj_coff_keep_syms (abfd) = true;
+  
+  obj_convert (abfd) = vars.sym_table;
+  obj_conv_table_size (abfd) = vars.sym_index;
+  
+  obj_coff_strings (abfd) = vars.string_table;
+  obj_coff_keep_strings (abfd) = true;
+
+  abfd->flags |= HAS_SYMS;
+
+  return true;
+}
+
+/* We have detected a Image Library Format archive element.
+   Decode the element and return the appropriate target.  */
+static const bfd_target *
+pe_ILF_object_p (bfd * abfd)
+{
+  bfd_byte        buffer[16];
+  bfd_byte *      ptr;
+  bfd_byte *      symbol_name;
+  bfd_byte *      source_dll;
+  unsigned int    machine;
+  unsigned long   size;
+  unsigned int    ordinal;
+  unsigned int    types;
+  unsigned short  magic;
+  
+  /* Upon entry the first four buyes of the ILF header have
+      already been read.  Now read the rest of the header.  */
+  if (bfd_read (buffer, 1, 16, abfd) != 16)
+    return NULL;
+
+  ptr = buffer;
+  
+  /*  We do not bother to check the version number.
+      version = bfd_h_get_16 (abfd, ptr);  */
+  ptr += 2;
+
+  machine = bfd_h_get_16 (abfd, ptr);
+  ptr += 2;
+
+  /* Check that the machine type is recognised.  */
+  magic = 0;
+  
+  switch (machine)
+    {
+    case IMAGE_FILE_MACHINE_UNKNOWN:
+    case IMAGE_FILE_MACHINE_ALPHA:
+    case IMAGE_FILE_MACHINE_ALPHA64:
+    case IMAGE_FILE_MACHINE_IA64:
+      break;
+      
+    case IMAGE_FILE_MACHINE_I386:
+#ifdef I386MAGIC
+      magic = I386MAGIC;
+#endif
+      break;
+      
+    case IMAGE_FILE_MACHINE_M68K:
+#ifdef MC68AGIC
+      magic = MC68MAGIC;
+#endif
+      break;
+      
+    case IMAGE_FILE_MACHINE_R3000:
+    case IMAGE_FILE_MACHINE_R4000:
+    case IMAGE_FILE_MACHINE_R10000:
+      
+    case IMAGE_FILE_MACHINE_MIPS16:
+    case IMAGE_FILE_MACHINE_MIPSFPU:
+    case IMAGE_FILE_MACHINE_MIPSFPU16:
+#ifdef MIPS_ARCH_MAGIC_WINCE
+      magic = MIPS_ARCH_MAGIC_WINCE;
+#endif
+      break;
+      
+    case IMAGE_FILE_MACHINE_SH3:
+    case IMAGE_FILE_MACHINE_SH4:
+#ifdef SH_ARCH_MAGIC_WINCE
+      magic = SH_ARCH_MAGIC_WINCE;
+#endif
+      break;
+      
+    case IMAGE_FILE_MACHINE_ARM:
+#ifdef ARMPEMAGIC
+      magic = ARMPEMAGIC;
+#endif      
+      break;
+      
+    case IMAGE_FILE_MACHINE_THUMB:
+#ifdef THUMBPEMAGIC
+      {
+	extern bfd_target armpei_little_vec;
+	
+	if (abfd->xvec == & armpei_little_vec)
+	  magic = THUMBPEMAGIC;
+      }
+#endif      
+      break;
+      
+    case IMAGE_FILE_MACHINE_POWERPC:
+      /* We no longer support PowerPC.  */
+    default:
+      _bfd_error_handler
+	(
+_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"),
+         bfd_get_filename (abfd), machine);
+      bfd_set_error (bfd_error_malformed_archive);
+	
+      return NULL;
+      break;
+    }
+
+  if (magic == 0)
+    {
+      _bfd_error_handler
+	(
+_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"),
+	 bfd_get_filename (abfd), machine);
+      bfd_set_error (bfd_error_wrong_format);
+	
+      return NULL;
+    }  
+
+  /* We do not bother to check the date.
+     date = bfd_h_get_32 (abfd, ptr);  */
+  ptr += 4;
+  
+  size = bfd_h_get_32 (abfd, ptr);
+  ptr += 4;
+
+  if (size == 0)
+    {
+      _bfd_error_handler
+	(_("%s: size field is zero in Import Library Format header"),
+	 bfd_get_filename (abfd));
+      bfd_set_error (bfd_error_malformed_archive);
+	
+      return NULL;
+    }
+
+  ordinal = bfd_h_get_16 (abfd, ptr);
+  ptr += 2;
+
+  types = bfd_h_get_16 (abfd, ptr);
+  /* ptr += 2; */
+
+  /* Now read in the two strings that follow.  */
+  ptr = bfd_alloc (abfd, size);
+  if (ptr == NULL)
+    return NULL;
+  
+  if (bfd_read (ptr, 1, size, abfd) != size)
+    return NULL;
+
+  symbol_name = ptr;
+  source_dll  = ptr + strlen (ptr) + 1;
+  
+  /* Verify that the strings are null terminated.  */
+  if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size))
+    {
+      _bfd_error_handler
+	(_("%s: string not null terminated in ILF object file."),
+	 bfd_get_filename (abfd));
+      bfd_set_error (bfd_error_malformed_archive);
+	
+      return NULL;
+    }
+  
+  /* Now construct the bfd.  */
+  if (! pe_ILF_build_a_bfd (abfd, magic, symbol_name,
+			    source_dll, ordinal, types))
+    return NULL;
+  
+  return abfd->xvec;
+}
+
+static const bfd_target *
+pe_bfd_object_p (bfd * abfd)
+{
+  /* We need to handle a PE image correctly.  In PE images created by
+     the GNU linker, the offset to the COFF header is always the size.
+     However, this is not the case in images generated by other PE
+     linkers.  The PE format stores a four byte offset to the PE
+     signature just before the COFF header at location 0x3c of the file.
+     We pick up that offset, verify that the PE signature is there, and
+     then set ourselves up to read in the COFF header.  */
+  bfd_byte buffer[4];
+  file_ptr offset;
+  unsigned long signature;
+
+  /* Detect if this a Microsoft Import Library Format element.  */
+  if (bfd_seek (abfd, 0x00, SEEK_SET) != 0
+      || bfd_read (buffer, 1, 4, abfd) != 4)
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+	bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+  
+  signature = bfd_h_get_32 (abfd, buffer);
+  
+  if (signature == 0xffff0000)
+    return pe_ILF_object_p (abfd);
+  
+  if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
+      || bfd_read (buffer, 1, 4, abfd) != 4)
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+	bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+
+  offset = bfd_h_get_32 (abfd, buffer);
+
+  if (bfd_seek (abfd, offset, SEEK_SET) != 0
+      || bfd_read (buffer, 1, 4, abfd) != 4)
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+	bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+
+  signature = bfd_h_get_32 (abfd, buffer);
+
+  if (signature != 0x4550)
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+  
+  /* Here is the hack.  coff_object_p wants to read filhsz bytes to
+     pick up the COFF header.  We adjust so that that will work.  20
+     is the size of the i386 COFF filehdr.  */
+  if (bfd_seek (abfd,
+		(bfd_tell (abfd)
+		 - bfd_coff_filhsz (abfd)
+		 + 20),
+		SEEK_SET)
+      != 0)
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+	bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+
+  return coff_object_p (abfd);
+}
+
+#define coff_object_p pe_bfd_object_p
+#endif /* COFF_IMAGE_WITH_PE */
diff --git a/bfd/peigen.c b/bfd/peigen.c
new file mode 100644
index 0000000..639ea89
--- /dev/null
+++ b/bfd/peigen.c
@@ -0,0 +1,1911 @@
+/* Support for the generic parts of PE/PEI; the common executable parts.
+   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Written by Cygnus Solutions.
+
+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.  */
+
+/*
+Most of this hacked by  Steve Chamberlain,
+			sac@cygnus.com
+
+PE/PEI rearrangement (and code added): Donn Terry
+				       Softway Systems, Inc.
+*/
+
+/* Hey look, some documentation [and in a place you expect to find it]!
+
+   The main reference for the pei format is "Microsoft Portable Executable
+   and Common Object File Format Specification 4.1".  Get it if you need to
+   do some serious hacking on this code.
+
+   Another reference:
+   "Peering Inside the PE: A Tour of the Win32 Portable Executable
+   File Format", MSJ 1994, Volume 9.
+
+   The *sole* difference between the pe format and the pei format is that the
+   latter has an MSDOS 2.0 .exe header on the front that prints the message
+   "This app must be run under Windows." (or some such).
+   (FIXME: Whether that statement is *really* true or not is unknown.
+   Are there more subtle differences between pe and pei formats?
+   For now assume there aren't.  If you find one, then for God sakes
+   document it here!)
+
+   The Microsoft docs use the word "image" instead of "executable" because
+   the former can also refer to a DLL (shared library).  Confusion can arise
+   because the `i' in `pei' also refers to "image".  The `pe' format can
+   also create images (i.e. executables), it's just that to run on a win32
+   system you need to use the pei format.
+
+   FIXME: Please add more docs here so the next poor fool that has to hack
+   on this code has a chance of getting something accomplished without
+   wasting too much time.
+*/
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "coff/internal.h"
+
+/* NOTE: it's strange to be including an architecture specific header
+   in what's supposed to be general (to PE/PEI) code.  However, that's
+   where the definitions are, and they don't vary per architecture
+   within PE/PEI, so we get them from there.  FIXME: The lack of
+   variance is an assumption which may prove to be incorrect if new
+   PE/PEI targets are created.  */
+#include "coff/i386.h"
+
+#include "coff/pe.h"
+#include "libcoff.h"
+#include "libpei.h"
+
+/* FIXME: This file has various tests of POWERPC_LE_PE.  Those tests
+   worked when the code was in peicode.h, but no longer work now that
+   the code is in peigen.c.  PowerPC NT is said to be dead.  If
+   anybody wants to revive the code, you will have to figure out how
+   to handle those issues.  */
+
+static void add_data_entry
+  PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
+static boolean pe_print_pdata PARAMS ((bfd *, PTR));
+static boolean pe_print_reloc PARAMS ((bfd *, PTR));
+
+/**********************************************************************/
+
+void
+_bfd_pei_swap_sym_in (abfd, ext1, in1)
+     bfd *abfd;
+     PTR ext1;
+     PTR 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);
+  }
+
+  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 */
+
+  /* The section symbols for the .idata$ sections have class 0x68
+     (C_SECTION), which MS documentation indicates is a section
+     symbol.  Unfortunately, the value field in the symbol is simply a
+     copy of the .idata section's flags rather than something useful.
+     When these symbols are encountered, change the value to 0 so that
+     they will be handled somewhat correctly in the bfd code.  */
+  if (in->n_sclass == C_SECTION)
+    {
+      in->n_value = 0x0;
+
+#if 0
+      /* FIXME: This is clearly wrong.  The problem seems to be that
+         undefined C_SECTION symbols appear in the first object of a
+         MS generated .lib file, and the symbols are not defined
+         anywhere.  */
+      in->n_scnum = 1;
+
+      /* 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; */
+#else
+      /* Create synthetic empty sections as needed.  DJ */
+      if (in->n_scnum == 0)
+	{
+	  asection *sec;
+	  for (sec=abfd->sections; sec; sec=sec->next)
+	    {
+	      if (strcmp (sec->name, in->n_name) == 0)
+		{
+		  in->n_scnum = sec->target_index;
+		  break;
+		}
+	    }
+	}
+      if (in->n_scnum == 0)
+	{
+	  int unused_section_number = 0;
+	  asection *sec;
+	  char *name;
+	  for (sec=abfd->sections; sec; sec=sec->next)
+	    if (unused_section_number <= sec->target_index)
+	      unused_section_number = sec->target_index+1;
+
+	  name = bfd_alloc (abfd, strlen (in->n_name) + 10);
+	  if (name == NULL)
+	    return;
+	  strcpy (name, in->n_name);
+	  sec = bfd_make_section_anyway (abfd, name);
+
+	  sec->vma = 0;
+	  sec->lma = 0;
+	  sec->_cooked_size = 0;
+	  sec->_raw_size = 0;
+	  sec->filepos = 0;
+	  sec->rel_filepos = 0;
+	  sec->reloc_count = 0;
+	  sec->line_filepos = 0;
+	  sec->lineno_count = 0;
+	  sec->userdata = NULL;
+	  sec->next = (asection *) NULL;
+	  sec->flags = 0;
+	  sec->alignment_power = 2;
+	  sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
+
+	  sec->target_index = unused_section_number;
+
+	  in->n_scnum = unused_section_number;
+	}
+      in->n_sclass = C_STAT;
+#endif
+    }
+#endif
+
+#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);
+#endif
+}
+
+unsigned int
+_bfd_pei_swap_sym_out (abfd, inp, extp)
+     bfd       *abfd;
+     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)
+    {
+      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;
+}
+
+void
+_bfd_pei_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
+     bfd            *abfd;
+     PTR	     ext1;
+     int             type;
+     int             class;
+     int	     indx ATTRIBUTE_UNUSED;
+     int	     numaux ATTRIBUTE_UNUSED;
+     PTR 	     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);
+      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))
+    {
+      in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
+      in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
+    }
+  else
+    {
+      in->x_sym.x_fcnary.x_ary.x_dimen[0] =
+	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+      in->x_sym.x_fcnary.x_ary.x_dimen[1] =
+	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+      in->x_sym.x_fcnary.x_ary.x_dimen[2] =
+	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+      in->x_sym.x_fcnary.x_ary.x_dimen[3] =
+	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);
+  }
+}
+
+unsigned int
+_bfd_pei_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
+     bfd  *abfd;
+     PTR   inp;
+     int   type;
+     int   class;
+     int   indx ATTRIBUTE_UNUSED;
+     int   numaux ATTRIBUTE_UNUSED;
+     PTR   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);
+      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);
+    }
+  else
+    {
+      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
+		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
+		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
+		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+      bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
+		    (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+    }
+
+  if (ISFCN (type))
+    bfd_h_put_32 (abfd, in->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);
+      PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
+    }
+
+  return AUXESZ;
+}
+
+void
+_bfd_pei_swap_lineno_in (abfd, ext1, in1)
+     bfd *abfd;
+     PTR ext1;
+     PTR 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);
+}
+
+unsigned int
+_bfd_pei_swap_lineno_out (abfd, inp, outp)
+     bfd       *abfd;
+     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 *)
+	  ext->l_addr.l_symndx);
+
+  PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
+  return LINESZ;
+}
+
+void
+_bfd_pei_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
+     bfd *abfd;
+     PTR aouthdr_ext1;
+     PTR aouthdr_int1;
+{
+  struct internal_extra_pe_aouthdr *a;
+  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->tsize =
+    GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
+  aouthdr_int->dsize =
+    GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize);
+  aouthdr_int->bsize =
+    GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize);
+  aouthdr_int->entry =
+    GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
+  aouthdr_int->text_start =
+    GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
+  aouthdr_int->data_start =
+    GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
+
+  a = &aouthdr_int->pe;
+  a->ImageBase = bfd_h_get_32 (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);
+  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 = bfd_h_get_32 (abfd, (bfd_byte *)src->SizeOfStackReserve);
+  a->SizeOfStackCommit = bfd_h_get_32 (abfd, (bfd_byte *)src->SizeOfStackCommit);
+  a->SizeOfHeapReserve = bfd_h_get_32 (abfd, (bfd_byte *)src->SizeOfHeapReserve);
+  a->SizeOfHeapCommit = bfd_h_get_32 (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++)
+      {
+	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 (aouthdr_int->entry)
+    {
+      aouthdr_int->entry += a->ImageBase;
+      aouthdr_int->entry &= 0xffffffff;
+    }
+  if (aouthdr_int->tsize) 
+    {
+      aouthdr_int->text_start += a->ImageBase;
+      aouthdr_int->text_start &= 0xffffffff;
+    }
+  if (aouthdr_int->dsize) 
+    {
+      aouthdr_int->data_start += a->ImageBase;
+      aouthdr_int->data_start &= 0xffffffff;
+    }
+
+#ifdef POWERPC_LE_PE
+  /* 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 ;
+  thunk_size = a->DataDirectory[12].Size;
+  import_table_size = a->DataDirectory[1].Size;
+#endif
+
+}
+
+/* A support function for below.  */
+
+static void
+add_data_entry (abfd, aout, idx, name, base)
+     bfd *abfd;
+     struct internal_extra_pe_aouthdr *aout;
+     int idx;
+     char *name;
+     bfd_vma base;
+{
+  asection *sec = bfd_get_section_by_name (abfd, name);
+
+  /* add import directory information if it exists */
+  if ((sec != NULL)
+      && (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;
+    }
+}
+
+unsigned int
+_bfd_pei_swap_aouthdr_out (abfd, in, out)
+     bfd       *abfd;
+     PTR	in;
+     PTR	out;
+{
+  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;
+
+  bfd_vma sa = extra->SectionAlignment;
+  bfd_vma fa = extra->FileAlignment;
+  bfd_vma ib = extra->ImageBase ;
+
+  if (aouthdr_in->tsize) 
+    {
+      aouthdr_in->text_start -= ib;
+      aouthdr_in->text_start &= 0xffffffff;
+    }
+  if (aouthdr_in->dsize) 
+    {
+      aouthdr_in->data_start -= ib;
+      aouthdr_in->data_start &= 0xffffffff;
+    }
+  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))
+
+  /* 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 .. */
+  memset (extra->DataDirectory, sizeof (extra->DataDirectory), 0);
+
+  add_data_entry (abfd, extra, 0, ".edata", 0);
+
+  /* Don't call add_data_entry for .idata$2 or .idata$5.  It's done in
+     bfd_coff_final_link where all the required information is
+     available.  */
+
+  /* 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" ,0);
+
+  add_data_entry (abfd, extra, 2, ".rsrc" ,0);
+
+  add_data_entry (abfd, extra, 3, ".pdata", 0);
+
+  /* For some reason, the virtual size (which is what's set by
+     add_data_entry) for .reloc is not the same as the size recorded
+     in this slot by MSVC; it doesn't seem to cause problems (so far),
+     but since it's the best we've got, use it.  It does do the right
+     thing for .pdata.  */
+  if (pe_data (abfd)->has_reloc_section)
+    add_data_entry (abfd, extra, 5, ".reloc", 0);
+
+  {
+    asection *sec;
+    bfd_vma dsize= 0;
+    bfd_vma isize = SA(abfd->sections->filepos);
+    bfd_vma tsize= 0;
+
+    for (sec = abfd->sections; sec; sec = sec->next)
+      {
+	int rounded = FA(sec->_raw_size);
+
+	if (sec->flags & SEC_DATA)
+	  dsize += rounded;
+	if (sec->flags & SEC_CODE)
+	  tsize += rounded;
+	/* The image size is the total VIRTUAL size (which is what is
+	   in the virt_size field).  Files have been seen (from MSVC
+	   5.0 link.exe) where the file size of the .data segment is
+	   quite small compared to the virtual size.  Without this
+	   fix, strip munges the file.  */
+	isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
+      }
+
+    aouthdr_in->dsize = dsize;
+    aouthdr_in->tsize = tsize;
+    extra->SizeOfImage = isize;
+  }
+
+  extra->SizeOfHeaders = abfd->sections->filepos;
+  bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic);
+
+#define LINKER_VERSION 256 /* That is, 2.56 */
+
+  /* This piece of magic sets the "linker version" field to
+     LINKER_VERSION.  */
+  bfd_h_put_16 (abfd,
+		LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256,
+		(bfd_byte *) aouthdr_out->standard.vstamp);
+
+  PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->standard.tsize);
+  PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->standard.dsize);
+  PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->standard.bsize);
+  PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->standard.entry);
+  PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
+			  (bfd_byte *) aouthdr_out->standard.text_start);
+
+  PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
+			  (bfd_byte *) aouthdr_out->standard.data_start);
+
+
+  bfd_h_put_32 (abfd, extra->ImageBase,
+		(bfd_byte *) aouthdr_out->ImageBase);
+  bfd_h_put_32 (abfd, extra->SectionAlignment,
+		(bfd_byte *) aouthdr_out->SectionAlignment);
+  bfd_h_put_32 (abfd, extra->FileAlignment,
+		(bfd_byte *) aouthdr_out->FileAlignment);
+  bfd_h_put_16 (abfd, extra->MajorOperatingSystemVersion,
+		(bfd_byte *) aouthdr_out->MajorOperatingSystemVersion);
+  bfd_h_put_16 (abfd, extra->MinorOperatingSystemVersion,
+		(bfd_byte *) aouthdr_out->MinorOperatingSystemVersion);
+  bfd_h_put_16 (abfd, extra->MajorImageVersion,
+		(bfd_byte *) aouthdr_out->MajorImageVersion);
+  bfd_h_put_16 (abfd, extra->MinorImageVersion,
+		(bfd_byte *) aouthdr_out->MinorImageVersion);
+  bfd_h_put_16 (abfd, extra->MajorSubsystemVersion,
+		(bfd_byte *) aouthdr_out->MajorSubsystemVersion);
+  bfd_h_put_16 (abfd, extra->MinorSubsystemVersion,
+		(bfd_byte *) aouthdr_out->MinorSubsystemVersion);
+  bfd_h_put_32 (abfd, extra->Reserved1,
+		(bfd_byte *) aouthdr_out->Reserved1);
+  bfd_h_put_32 (abfd, extra->SizeOfImage,
+		(bfd_byte *) aouthdr_out->SizeOfImage);
+  bfd_h_put_32 (abfd, extra->SizeOfHeaders,
+		(bfd_byte *) aouthdr_out->SizeOfHeaders);
+  bfd_h_put_32 (abfd, extra->CheckSum,
+		(bfd_byte *) aouthdr_out->CheckSum);
+  bfd_h_put_16 (abfd, extra->Subsystem,
+		(bfd_byte *) aouthdr_out->Subsystem);
+  bfd_h_put_16 (abfd, extra->DllCharacteristics,
+		(bfd_byte *) aouthdr_out->DllCharacteristics);
+  bfd_h_put_32 (abfd, extra->SizeOfStackReserve,
+		(bfd_byte *) aouthdr_out->SizeOfStackReserve);
+  bfd_h_put_32 (abfd, extra->SizeOfStackCommit,
+		(bfd_byte *) aouthdr_out->SizeOfStackCommit);
+  bfd_h_put_32 (abfd, extra->SizeOfHeapReserve,
+		(bfd_byte *) aouthdr_out->SizeOfHeapReserve);
+  bfd_h_put_32 (abfd, extra->SizeOfHeapCommit,
+		(bfd_byte *) aouthdr_out->SizeOfHeapCommit);
+  bfd_h_put_32 (abfd, extra->LoaderFlags,
+		(bfd_byte *) aouthdr_out->LoaderFlags);
+  bfd_h_put_32 (abfd, extra->NumberOfRvaAndSizes,
+		(bfd_byte *) aouthdr_out->NumberOfRvaAndSizes);
+  {
+    int idx;
+    for (idx=0; idx < 16; idx++)
+      {
+	bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
+		      (bfd_byte *) aouthdr_out->DataDirectory[idx][0]);
+	bfd_h_put_32 (abfd, extra->DataDirectory[idx].Size,
+		      (bfd_byte *) aouthdr_out->DataDirectory[idx][1]);
+      }
+  }
+
+  return AOUTSZ;
+}
+
+unsigned int
+_bfd_pei_only_swap_filehdr_out (abfd, in, out)
+     bfd       *abfd;
+     PTR	in;
+     PTR	out;
+{
+  int idx;
+  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;
+
+  if (pe_data (abfd)->dll)
+    filehdr_in->f_flags |= F_DLL;
+
+  filehdr_in->pe.e_magic    = DOSMAGIC;
+  filehdr_in->pe.e_cblp     = 0x90;
+  filehdr_in->pe.e_cp       = 0x3;
+  filehdr_in->pe.e_crlc     = 0x0;
+  filehdr_in->pe.e_cparhdr  = 0x4;
+  filehdr_in->pe.e_minalloc = 0x0;
+  filehdr_in->pe.e_maxalloc = 0xffff;
+  filehdr_in->pe.e_ss       = 0x0;
+  filehdr_in->pe.e_sp       = 0xb8;
+  filehdr_in->pe.e_csum     = 0x0;
+  filehdr_in->pe.e_ip       = 0x0;
+  filehdr_in->pe.e_cs       = 0x0;
+  filehdr_in->pe.e_lfarlc   = 0x40;
+  filehdr_in->pe.e_ovno     = 0x0;
+
+  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++)
+    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 */
+  filehdr_in->pe.dos_message[0]  = 0x0eba1f0e;
+  filehdr_in->pe.dos_message[1]  = 0xcd09b400;
+  filehdr_in->pe.dos_message[2]  = 0x4c01b821;
+  filehdr_in->pe.dos_message[3]  = 0x685421cd;
+  filehdr_in->pe.dos_message[4]  = 0x70207369;
+  filehdr_in->pe.dos_message[5]  = 0x72676f72;
+  filehdr_in->pe.dos_message[6]  = 0x63206d61;
+  filehdr_in->pe.dos_message[7]  = 0x6f6e6e61;
+  filehdr_in->pe.dos_message[8]  = 0x65622074;
+  filehdr_in->pe.dos_message[9]  = 0x6e757220;
+  filehdr_in->pe.dos_message[10] = 0x206e6920;
+  filehdr_in->pe.dos_message[11] = 0x20534f44;
+  filehdr_in->pe.dos_message[12] = 0x65646f6d;
+  filehdr_in->pe.dos_message[13] = 0x0a0d0d2e;
+  filehdr_in->pe.dos_message[14] = 0x24;
+  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_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);
+
+  /* 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_byte *) filehdr_out->e_cparhdr);
+  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_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);
+  {
+    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]);
+  }
+  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]);
+  }
+  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]);
+  }
+
+  /* also put in the NT signature */
+  bfd_h_put_32(abfd, filehdr_in->pe.nt_signature,
+	       (bfd_byte *) filehdr_out->nt_signature);
+
+
+
+
+  return FILHSZ;
+}
+
+unsigned int
+_bfd_pe_only_swap_filehdr_out (abfd, in, out)
+     bfd       *abfd;
+     PTR	in;
+     PTR	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);
+  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);
+
+  return FILHSZ;
+}
+
+unsigned int
+_bfd_pei_swap_scnhdr_out (abfd, in, out)
+     bfd       *abfd;
+     PTR	in;
+     PTR	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));
+
+  PUT_SCNHDR_VADDR (abfd,
+		    ((scnhdr_int->s_vaddr 
+		      - pe_data(abfd)->pe_opthdr.ImageBase)
+		     & 0xffffffff),
+		    (bfd_byte *) scnhdr_ext->s_vaddr);
+
+  /* NT wants the size data to be rounded up to the next
+     NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss,
+     sometimes).  */
+
+  if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
+    {
+      ps = scnhdr_int->s_size;
+      ss = 0;
+    }
+  else
+    {
+      ps = scnhdr_int->s_paddr;
+      ss = scnhdr_int->s_size;
+    }
+
+  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);
+
+  PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
+		     (bfd_byte *) scnhdr_ext->s_scnptr);
+  PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
+		     (bfd_byte *) scnhdr_ext->s_relptr);
+  PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
+		      (bfd_byte *) scnhdr_ext->s_lnnoptr);
+
+  /* Extra flags must be set when dealing with NT.  All sections should also
+     have the IMAGE_SCN_MEM_READ (0x40000000) flag set.  In addition, the
+     .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data
+     sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set
+     (this is especially important when dealing with the .idata section since
+     the addresses for routines from .dlls must be overwritten).  If .reloc
+     section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE
+     (0x02000000).  Also, the resource data should also be read and
+     writable.  */
+
+  /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */
+  /* FIXME: even worse, I don't see how to get the original alignment field*/
+  /*        back...                                                        */
+
+  {
+    int flags = scnhdr_int->s_flags;
+    bfd_h_put_32(abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
+  }
+
+  if (coff_data (abfd)->link_info
+      && ! coff_data (abfd)->link_info->relocateable
+      && ! coff_data (abfd)->link_info->shared
+      && strcmp (scnhdr_int->s_name, ".text") == 0)
+    {
+      /* By inference from looking at MS output, the 32 bit field
+	 which is the combintion of the number_of_relocs and
+	 number_of_linenos is used for the line number count in
+	 executables.  A 16-bit field won't do for cc1.  The MS
+	 document says that the number of relocs is zero for
+	 executables, but the 17-th bit has been observed to be there.
+	 Overflow is not an issue: a 4G-line program will overflow a
+	 bunch of other fields long before this!  */
+      bfd_h_put_16 (abfd, scnhdr_int->s_nlnno & 0xffff,
+		    (bfd_byte *) scnhdr_ext->s_nlnno);
+      bfd_h_put_16 (abfd, scnhdr_int->s_nlnno >> 16,
+		    (bfd_byte *) scnhdr_ext->s_nreloc);
+    }
+  else
+    {
+      if (scnhdr_int->s_nlnno <= 0xffff)
+	bfd_h_put_16 (abfd, scnhdr_int->s_nlnno,
+		      (bfd_byte *) scnhdr_ext->s_nlnno);
+      else
+	{
+	  (*_bfd_error_handler) (_("%s: line number overflow: 0x%lx > 0xffff"),
+				 bfd_get_filename (abfd),
+				 scnhdr_int->s_nlnno);
+	  bfd_set_error (bfd_error_file_truncated);
+	  bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
+	  ret = 0;
+	}
+      if (scnhdr_int->s_nreloc <= 0xffff)
+	bfd_h_put_16 (abfd, scnhdr_int->s_nreloc,
+		      (bfd_byte *) scnhdr_ext->s_nreloc);
+      else
+	{
+	  (*_bfd_error_handler) (_("%s: reloc overflow: 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;
+	}
+    }
+  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_ ("Reserved"),
+  N_ ("Reserved"),
+  N_ ("Reserved")
+};
+
+/**********************************************************************/
+#ifdef POWERPC_LE_PE
+/* The code for the PPC really falls in the "architecture dependent"
+   category.  However, it's not clear that anyone will ever care, so
+   we're ignoring the issue for now; if/when PPC matters, some of this
+   may need to go into peicode.h, or arguments passed to enable the
+   PPC- specific code.  */
+#endif
+
+/**********************************************************************/
+static boolean
+pe_print_idata (abfd, vfile)
+     bfd *abfd;
+     PTR vfile;
+{
+  FILE *file = (FILE *) vfile;
+  bfd_byte *data = 0;
+  asection *section = bfd_get_section_by_name (abfd, ".idata");
+  unsigned long adj;
+
+#ifdef POWERPC_LE_PE
+  asection *rel_section = bfd_get_section_by_name (abfd, ".reldata");
+#endif
+
+  bfd_size_type datasize;
+  bfd_size_type dataoff;
+  bfd_size_type secsize;
+  bfd_size_type i;
+  int onaline = 20;
+
+  pe_data_type *pe = pe_data (abfd);
+  struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
+
+  if (section != NULL)
+    {
+      datasize = bfd_section_size (abfd, section);
+      dataoff = 0;
+
+      if (datasize == 0)
+	return true;
+
+      fprintf (file, _("\nThe import table is the .idata section\n"));
+    }
+  else
+    {
+      /* idata buried in some other section: e.g. KERNEL32.DLL.  */
+      bfd_vma addr, size;
+
+      addr = extra->DataDirectory[1].VirtualAddress;
+      size = extra->DataDirectory[1].Size;
+
+      if (addr == 0 || size == 0)
+	return true;
+
+      for (section = abfd->sections; section != NULL; section = section->next)
+	{
+	   if (addr >= section->vma
+	       && addr < section->vma + bfd_section_size(abfd,section))
+	         break;
+	}
+      if (section == NULL)
+	{
+	   fprintf (file,
+		    _("\nThere is an import table, but the section containing it could not be found\n"));
+	   return true;
+	}
+
+      fprintf (file, _("\nThere is an import table in %s at 0x%lx\n"),
+	       section->name, (unsigned long)addr);
+
+      dataoff = addr - section->vma;
+      datasize = size;
+    }
+
+#ifdef POWERPC_LE_PE
+  if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0)
+    {
+      /* The toc address can be found by taking the starting address,
+	 which on the PPC locates a function descriptor. The
+	 descriptor consists of the function code starting address
+	 followed by the address of the toc. The starting address we
+	 get from the bfd, and the descriptor is supposed to be in the
+	 .reldata section.  */
+
+      bfd_vma loadable_toc_address;
+      bfd_vma toc_address;
+      bfd_vma start_address;
+      bfd_byte *data = 0;
+      int offset;
+      data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd,
+								 rel_section));
+      if (data == NULL && bfd_section_size (abfd, rel_section) != 0)
+	return false;
+
+      datasize = bfd_section_size (abfd, rel_section);
+  
+      bfd_get_section_contents (abfd,
+				rel_section,
+				(PTR) data, 0,
+				bfd_section_size (abfd, rel_section));
+
+      offset = abfd->start_address - rel_section->vma;
+
+      start_address = bfd_get_32(abfd, data+offset);
+      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,
+	       _("\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"));
+    }
+#endif
+
+  fprintf(file,
+	  _("\nThe Import Tables (interpreted .idata section contents)\n"));
+  fprintf(file,
+	  _(" vma:            Hint    Time      Forward  DLL       First\n"));
+  fprintf(file,
+	  _("                 Table   Stamp     Chain    Name      Thunk\n"));
+
+  secsize = bfd_section_size (abfd, section);
+  data = (bfd_byte *) bfd_malloc (secsize);
+  if (data == NULL && secsize != 0)
+    return false;
+
+  if (! bfd_get_section_contents (abfd, section, (PTR) data, 0, secsize))
+    return false;
+
+  adj = - section->vma;
+
+  for (i = 0; i < datasize; i += onaline)
+    {
+      bfd_vma hint_addr;
+      bfd_vma time_stamp;
+      bfd_vma forward_chain;
+      bfd_vma dll_name;
+      bfd_vma first_thunk;
+      int idx = 0;
+      bfd_size_type j;
+      char *dll;
+
+      fprintf (file,
+	       " %08lx\t",
+	       (unsigned long int) (i + section->vma + dataoff));
+      
+      if (i + 20 > datasize)
+	{
+	  /* check stuff */
+	  ;
+	}
+
+      hint_addr = bfd_get_32 (abfd, data + i + dataoff);
+      time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
+      forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff);
+      dll_name = bfd_get_32 (abfd, data + i + 12 + dataoff);
+      first_thunk = bfd_get_32 (abfd, data + i + 16 + dataoff);
+
+      fprintf (file, "%08lx %08lx %08lx %08lx %08lx\n",
+	       hint_addr,
+	       time_stamp,
+	       forward_chain,
+	       dll_name,
+	       first_thunk);
+
+      if (hint_addr == 0 && first_thunk == 0)
+	break;
+
+      dll = (char *) data + dll_name - section->vma + dataoff;
+      fprintf(file, _("\n\tDLL Name: %s\n"), dll);
+
+      if (hint_addr != 0)
+	{
+	  fprintf (file, _("\tvma:  Hint/Ord Member-Name\n"));
+
+	  idx = hint_addr + adj;
+
+	  for (j = 0; j < datasize; j += 4)
+	    {
+	      unsigned long member = bfd_get_32 (abfd, data + idx + j);
+
+	      if (member == 0)
+		break;
+	      if (member & 0x80000000)
+		fprintf (file, "\t%04lx\t %4lu", member,
+			 member & 0x7fffffff);
+	      else
+		{
+		  int ordinal;
+		  char *member_name;
+
+		  ordinal = bfd_get_16 (abfd, data + member + adj);
+		  member_name = (char *) data + member + adj + 2;
+		  fprintf (file, "\t%04lx\t %4d  %s",
+			   member, ordinal, member_name);
+		}
+
+	      /* If the time stamp is not zero, the import address
+                 table holds actual addresses.  */
+	      if (time_stamp != 0
+		  && first_thunk != 0
+		  && first_thunk != hint_addr)
+		fprintf (file, "\t%04lx",
+			 bfd_get_32 (abfd, data + first_thunk + adj + j));
+
+	      fprintf (file, "\n");
+	    }
+	}
+
+      if (hint_addr != first_thunk && time_stamp == 0)
+	{
+	  int differ = 0;
+	  int idx2;
+
+	  idx2 = first_thunk + adj;
+
+	  for (j = 0; j < datasize; j += 4)
+	    {
+	      int ordinal;
+	      char *member_name;
+	      bfd_vma hint_member = 0;
+	      bfd_vma iat_member;
+
+	      if (hint_addr != 0)
+		hint_member = bfd_get_32 (abfd, data + idx + j);
+	      iat_member = bfd_get_32 (abfd, data + idx2 + j);
+
+	      if (hint_addr == 0 && iat_member == 0)
+		break;
+
+	      if (hint_addr == 0 || hint_member != iat_member)
+		{
+		  if (differ == 0)
+		    {
+		      fprintf (file,
+			       _("\tThe Import Address Table (difference found)\n"));
+		      fprintf(file, _("\tvma:  Hint/Ord Member-Name\n"));
+		      differ = 1;
+		    }
+		  if (iat_member == 0)
+		    {
+		      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",
+			      iat_member, ordinal, member_name);
+		    }
+		}
+
+	      if (hint_addr != 0 && hint_member == 0)
+		break;
+	    }
+	  if (differ == 0)
+	    {
+	      fprintf(file,
+		      _("\tThe Import Address Table is identical\n"));
+	    }
+	}
+
+      fprintf(file, "\n");
+
+    }
+
+  free (data);
+
+  return true;
+}
+
+static boolean
+pe_print_edata (abfd, vfile)
+     bfd *abfd;
+     PTR vfile;
+{
+  FILE *file = (FILE *) vfile;
+  bfd_byte *data = 0;
+  asection *section = bfd_get_section_by_name (abfd, ".edata");
+
+  bfd_size_type datasize;
+  bfd_size_type dataoff;
+  bfd_size_type i;
+
+  int 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;
+
+  pe_data_type *pe = pe_data (abfd);
+  struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
+
+  if (section != NULL)
+    {
+      datasize = bfd_section_size (abfd, section);
+      dataoff = 0;
+      fprintf (file, _("\nThe export table is the .edata section\n"));
+    }
+  else
+    {
+      /* edata is buried in some other section: e.g. NTDLL.DLL.  */
+      bfd_vma addr, size;
+
+      addr = extra->DataDirectory[0].VirtualAddress;
+      size = extra->DataDirectory[0].Size;
+
+      if (addr == 0 || size == 0)
+	return true;
+
+      for (section = abfd->sections; section != NULL; section = section->next)
+	{
+	   if (addr >= section->vma
+	       && addr < section->vma + bfd_section_size (abfd, section))
+	     break;
+	}
+      if (section == NULL)
+	{
+	   fprintf (file,
+		    _("\nThere is an export table, but the section containing it could not be found\n"));
+	   return true;
+	}
+
+      fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
+	       section->name, (unsigned long) addr);
+
+      datasize = size;
+      dataoff = addr - section->vma;
+    }
+
+  data = (bfd_byte *) bfd_malloc (datasize);
+  if (data == NULL && datasize != 0)
+    return false;
+
+  if (! bfd_get_section_contents (abfd, section, (PTR) data, dataoff,
+				  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);
+
+  adj = - (section->vma + dataoff);
+
+  /* Dump the EDT first first */
+  fprintf(file,
+	  _("\nThe Export Tables (interpreted .edata section contents)\n\n"));
+
+  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,
+	  _("Major/Minor \t\t\t%d/%d\n"), edt.major_ver, edt.minor_ver);
+
+  fprintf (file,
+	   _("Name \t\t\t\t"));
+  fprintf_vma (file, edt.name);
+  fprintf (file,
+	   " %s\n", data + edt.name + adj);
+
+  fprintf(file,
+	  _("Ordinal Base \t\t\t%ld\n"), edt.base);
+
+  fprintf(file,
+	  _("Number in:\n"));
+
+  fprintf(file,
+	  _("\tExport Address Table \t\t%lx\n"),
+	  edt.num_functions);
+
+  fprintf(file,
+	  _("\t[Name Pointer/Ordinal] Table\t%lu\n"), edt.num_names);
+
+  fprintf(file,
+	  _("Table Addresses\n"));
+
+  fprintf (file,
+	   _("\tExport Address Table \t\t"));
+  fprintf_vma (file, edt.eat_addr);
+  fprintf (file, "\n");
+
+  fprintf (file,
+	  _("\tName Pointer Table \t\t"));
+  fprintf_vma (file, edt.npt_addr);
+  fprintf (file, "\n");
+
+  fprintf (file,
+	   _("\tOrdinal Table \t\t\t"));
+  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
+      {
+        long export_rva;
+        long forwarder_rva;
+      } export_address_table_entry;
+  */
+
+  fprintf(file,
+	  _("\nExport Address Table -- Ordinal Base %ld\n"),
+	  edt.base);
+
+  for (i = 0; i < edt.num_functions; ++i)
+    {
+      bfd_vma eat_member = bfd_get_32 (abfd,
+				       data + edt.eat_addr + (i * 4) + adj);
+      bfd_vma eat_actual = eat_member;
+      bfd_vma edata_start = bfd_get_section_vma (abfd, section);
+      bfd_vma edata_end = edata_start + datasize;
+
+      if (eat_member == 0)
+	continue;
+
+      if (edata_start < eat_actual && eat_actual < edata_end)
+	{
+	  /* this rva is to a name (forwarding function) in our section */
+	  /* Should locate a function descriptor */
+	  fprintf (file,
+		   "\t[%4ld] +base[%4ld] %04lx %s -- %s\n",
+		   (long) i, (long) (i + edt.base), eat_member,
+		   _("Forwarder RVA"), data + eat_member + adj);
+	}
+      else
+	{
+	  /* Should locate a function descriptor in the reldata section */
+	  fprintf (file,
+		   "\t[%4ld] +base[%4ld] %04lx %s\n",
+		   (long) i, (long) (i + edt.base), eat_member,
+		   _("Export RVA"));
+	}
+    }
+
+  /* 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,
+				    data +
+				    edt.npt_addr
+				    + (i*4) + adj);
+      
+      char *name = (char *) data + name_ptr + adj;
+
+      bfd_vma ord = bfd_get_16(abfd,
+				    data +
+				    edt.ot_addr
+				    + (i*2) + adj);
+      fprintf(file,
+	      "\t[%4ld] %s\n", (long) ord, name);
+
+    }
+
+  free (data);
+
+  return true;
+}
+
+static boolean
+pe_print_pdata (abfd, vfile)
+     bfd  *abfd;
+     PTR vfile;
+{
+  FILE *file = (FILE *) vfile;
+  bfd_byte *data = 0;
+  asection *section = bfd_get_section_by_name (abfd, ".pdata");
+  bfd_size_type datasize = 0;
+  bfd_size_type i;
+  bfd_size_type start, stop;
+  int onaline = 20;
+
+  if (section == NULL
+      || coff_section_data (abfd, section) == NULL
+      || pei_section_data (abfd, section) == NULL)
+     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,
+	   _("\nThe Function Table (interpreted .pdata section contents)\n"));
+  fprintf (file,
+	   _(" vma:\t\tBegin    End      EH       EH       PrologEnd  Exception\n"));
+  fprintf (file,
+	   _("     \t\tAddress  Address  Handler  Data     Address    Mask\n"));
+
+  if (bfd_section_size (abfd, section) == 0)
+    return true;
+
+  data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
+  datasize = bfd_section_size (abfd, section);
+  if (data == NULL && datasize != 0)
+    return false;
+
+  bfd_get_section_contents (abfd,
+			    section,
+			    (PTR) data, 0,
+			    bfd_section_size (abfd, section));
+
+  start = 0;
+
+  for (i = start; i < stop; i += onaline)
+    {
+      bfd_vma begin_addr;
+      bfd_vma end_addr;
+      bfd_vma eh_handler;
+      bfd_vma eh_data;
+      bfd_vma prolog_end_addr;
+      int em_data;
+
+      if (i + 20 > stop)
+	break;
+
+      begin_addr = bfd_get_32(abfd, data+i);
+      end_addr = bfd_get_32(abfd, data+i+4);
+      eh_handler = bfd_get_32(abfd, data+i+8);
+      eh_data = bfd_get_32(abfd, data+i+12);
+      prolog_end_addr = bfd_get_32(abfd, data+i+16);
+      
+      if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
+	  && eh_data == 0 && prolog_end_addr == 0)
+	{
+	  /* We are probably into the padding of the section now.  */
+	  break;
+	}
+
+      fprintf (file,
+	       " %08lx\t",
+	       (unsigned long int) (i + section->vma));
+
+      em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
+      eh_handler &= 0xfffffffc;
+      prolog_end_addr &= 0xfffffffc;
+
+      fprintf (file, "%08lx %08lx %08lx %08lx %08lx   %x",
+	       begin_addr,
+	       end_addr,
+	       eh_handler,
+	       eh_data,
+	       prolog_end_addr,
+	       em_data);
+
+#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.                           */
+	  /* Code Significance                           */
+	  /* 0x00 None                                   */
+	  /* 0x01 Register Save Millicode                */
+	  /* 0x02 Register Restore Millicode             */
+	  /* 0x03 Glue Code Sequence                     */
+	  switch (eh_data)
+	    {
+	    case 0x01:
+	      fprintf(file, _(" Register save millicode"));
+	      break;
+	    case 0x02:
+	      fprintf(file, _(" Register restore millicode"));
+	      break;
+	    case 0x03:
+	      fprintf(file, _(" Glue code sequence"));
+	      break;
+	    default:
+	      break;
+	    }
+	}
+#endif
+      fprintf(file, "\n");
+    }
+
+  free (data);
+
+  return true;
+}
+
+#define IMAGE_REL_BASED_HIGHADJ 4
+static const char * const tbl[] =
+{
+"ABSOLUTE",
+"HIGH",
+"LOW",
+"HIGHLOW",
+"HIGHADJ",
+"MIPS_JMPADDR",
+"UNKNOWN",   /* MUST be last */
+};
+
+static boolean
+pe_print_reloc (abfd, vfile)
+     bfd *abfd;
+     PTR vfile;
+{
+  FILE *file = (FILE *) vfile;
+  bfd_byte *data = 0;
+  asection *section = bfd_get_section_by_name (abfd, ".reloc");
+  bfd_size_type datasize = 0;
+  bfd_size_type i;
+  bfd_size_type start, stop;
+
+  if (section == NULL)
+    return true;
+
+  if (bfd_section_size (abfd, section) == 0)
+    return true;
+
+  fprintf (file,
+	   _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
+
+  data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
+  datasize = bfd_section_size (abfd, section);
+  if (data == NULL && datasize != 0)
+    return false;
+
+  bfd_get_section_contents (abfd,
+			    section,
+			    (PTR) data, 0,
+			    bfd_section_size (abfd, section));
+
+  start = 0;
+
+  stop = bfd_section_size (abfd, section);
+
+  for (i = start; i < stop;)
+    {
+      int j;
+      bfd_vma virtual_address;
+      long number, size;
+
+      /* 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);
+      number = (size - 8) / 2;
+
+      if (size == 0)
+	{
+	  break;
+	}
+
+      fprintf (file,
+	       _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
+	       virtual_address, size, size, number);
+
+      for (j = 0; j < number; ++j)
+	{
+	  unsigned short e = bfd_get_16 (abfd, data + i + 8 + j * 2);
+	  unsigned int t = (e & 0xF000) >> 12;
+	  int off = e & 0x0FFF;
+
+	  if (t >= sizeof (tbl) / sizeof (tbl[0]))
+	    t = (sizeof (tbl) / sizeof (tbl[0])) - 1;
+
+	  fprintf (file,
+		   _("\treloc %4d offset %4x [%4lx] %s"),
+		   j, off, (long) (off + virtual_address), tbl[t]);
+
+	  /* HIGHADJ takes an argument, - the next record *is* the
+	     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, "\n");
+	}
+      i += size;
+    }
+
+  free (data);
+
+  return true;
+}
+
+/* Print out the program headers.  */
+
+boolean
+_bfd_pe_print_private_bfd_data_common (abfd, vfile)
+     bfd *abfd;
+     PTR vfile;
+{
+  FILE *file = (FILE *) vfile;
+  int j;
+  pe_data_type *pe = pe_data (abfd);
+  struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
+
+  /* The MS dumpbin program reportedly ands with 0xff0f before
+     printing the characteristics field.  Not sure why.  No reason to
+     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); }
+  PF (F_RELFLG, "relocations stripped");
+  PF (F_EXEC, "executable");
+  PF (F_LNNO, "line numbers stripped");
+  PF (F_LSYMS, "symbols stripped");
+  PF (0x80, "little endian");
+  PF (F_AR32WR, "32 bit words");
+  PF (0x200, "debugging information removed");
+  PF (0x1000, "system file");
+  PF (F_DLL, "DLL");
+  PF (0x8000, "big endian");
+#undef PF
+
+  /* ctime implies '\n'.  */
+  fprintf (file, "\nTime/Date\t\t%s", ctime (&pe->coff.timestamp));
+  fprintf (file,"\nImageBase\t\t");
+  fprintf_vma (file, i->ImageBase);
+  fprintf (file,"\nSectionAlignment\t");
+  fprintf_vma (file, i->SectionAlignment);
+  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,"Reserved1\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,"Subsystem\t\t%08x\n", i->Subsystem);
+  fprintf (file,"DllCharacteristics\t%08x\n", i->DllCharacteristics);
+  fprintf (file,"SizeOfStackReserve\t");
+  fprintf_vma (file, i->SizeOfStackReserve);
+  fprintf (file,"\nSizeOfStackCommit\t");
+  fprintf_vma (file, i->SizeOfStackCommit);
+  fprintf (file,"\nSizeOfHeapReserve\t");
+  fprintf_vma (file, i->SizeOfHeapReserve);
+  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,"\nThe Data Directory\n");
+  for (j = 0; j < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; j++)
+    {
+      fprintf (file, "Entry %1x ", j);
+      fprintf_vma (file, i->DataDirectory[j].VirtualAddress);
+      fprintf (file, " %08lx ", i->DataDirectory[j].Size);
+      fprintf (file, "%s\n", dir_names[j]);
+    }
+
+  pe_print_idata (abfd, vfile);
+  pe_print_edata (abfd, vfile);
+  pe_print_pdata (abfd, vfile);
+  pe_print_reloc (abfd, vfile);
+
+  return true;
+}
+
+/* Copy any private info we understand from the input bfd
+   to the output bfd.  */
+
+boolean
+_bfd_pe_bfd_copy_private_bfd_data_common (ibfd, obfd)
+     bfd *ibfd, *obfd;
+{
+  /* One day we may try to grok other private data.  */
+  if (ibfd->xvec->flavour != bfd_target_coff_flavour
+      || obfd->xvec->flavour != bfd_target_coff_flavour)
+    return true;
+
+  pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
+  pe_data (obfd)->dll = pe_data (ibfd)->dll;
+
+  /* for strip: if we removed .reloc, we'll make a real mess of things
+     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;
+    }
+  return true;
+}
+
+/* Copy private section data. */
+boolean
+_bfd_pe_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
+     bfd *ibfd;
+     asection *isec;
+     bfd *obfd;
+     asection *osec;
+{
+  if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
+      || bfd_get_flavour (obfd) != bfd_target_coff_flavour)
+    return true;
+
+  if (coff_section_data (ibfd, isec) != NULL
+      && pei_section_data (ibfd, isec) != NULL)
+    {
+      if (coff_section_data (obfd, osec) == NULL)
+	{
+	  osec->used_by_bfd =
+	    (PTR) bfd_zalloc (obfd, sizeof (struct coff_section_tdata));
+	  if (osec->used_by_bfd == NULL)
+	    return false;
+	}
+      if (pei_section_data (obfd, osec) == NULL)
+	{
+	  coff_section_data (obfd, osec)->tdata =
+	    (PTR) bfd_zalloc (obfd, sizeof (struct pei_section_tdata));
+	  if (coff_section_data (obfd, osec)->tdata == NULL)
+	    return false;
+	}
+      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;
+    }
+
+  return true;
+}
+
+void
+_bfd_pe_get_symbol_info (abfd, symbol, ret)
+     bfd *abfd;
+     asymbol *symbol;
+     symbol_info *ret;
+{
+  coff_get_symbol_info (abfd, symbol, ret);
+
+  if (pe_data (abfd) != NULL
+      && ((symbol->flags & BSF_DEBUGGING) == 0
+	  || (symbol->flags & BSF_DEBUGGING_RELOC) != 0)
+      && ! bfd_is_abs_section (symbol->section))
+    ret->value += pe_data (abfd)->pe_opthdr.ImageBase;
+}
+
+/* Handle the .idata section and other things that need symbol table
+   access.  */
+
+boolean
+_bfd_pei_final_link_postscript (abfd, pfinfo)
+     bfd *abfd;
+     struct coff_final_link_info *pfinfo;
+{
+  struct coff_link_hash_entry *h1;
+  struct bfd_link_info *info = pfinfo->info;
+
+  /* There are a few fields that need to be filled in now while we
+     have symbol table access.
+
+     The .idata subsections aren't directly available as sections, but
+     they are in the symbol table, so get them from there.  */
+
+  /* The import directory.  This is the address of .idata$2, with size
+     of .idata$2 + .idata$3.  */
+  h1 = coff_link_hash_lookup (coff_hash_table (info),
+			      ".idata$2", false, false, true);
+  if (h1 != NULL)
+    {
+      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);
+      h1 = coff_link_hash_lookup (coff_hash_table (info),
+				  ".idata$4", false, false, true);
+      pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
+	((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);
+
+      /* The import address table.  This is the size/address of
+         .idata$5.  */
+      h1 = coff_link_hash_lookup (coff_hash_table (info),
+				  ".idata$5", false, false, true);
+      pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
+	(h1->root.u.def.value
+	 + h1->root.u.def.section->output_section->vma
+	 + h1->root.u.def.section->output_offset);
+      h1 = coff_link_hash_lookup (coff_hash_table (info),
+				  ".idata$6", false, false, true);
+      pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
+	((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);
+    }
+
+  /* If we couldn't find idata$2, we either have an excessively
+     trivial program or are in DEEP trouble; we have to assume trivial
+     program....  */
+  return true;
+}
diff --git a/bfd/po/POTFILES.in b/bfd/po/POTFILES.in
index ae49966..51a980b 100644
--- a/bfd/po/POTFILES.in
+++ b/bfd/po/POTFILES.in
@@ -1,9 +1,6 @@
-archures.c
-bfd-in2.h
 aix386-core.c
 aout-adobe.c
 aout-arm.c
-aout-encap.c
 aout-ns32k.c
 aout-sparcle.c
 aout-target.h
@@ -14,7 +11,8 @@
 aoutf1.h
 aoutx.h
 archive.c
-bfd-in.h
+archures.c
+armnetbsd.c
 bfd.c
 binary.c
 bout.c
@@ -36,10 +34,8 @@
 coff-i960.c
 coff-m68k.c
 coff-m88k.c
-coff-mcore.c
 coff-mips.c
 coff-pmac.c
-coff-ppc.c
 coff-rs6000.c
 coff-sh.c
 coff-sparc.c
@@ -55,9 +51,6 @@
 coffgen.c
 cofflink.c
 coffswap.h
-cpu-m10300.c
-cpu-m32r.c
-cpu-mips.c
 corefile.c
 cpu-a29k.c
 cpu-alpha.c
@@ -69,26 +62,27 @@
 cpu-h8300.c
 cpu-h8500.c
 cpu-hppa.c
+cpu-i370.c
 cpu-i386.c
 cpu-i860.c
 cpu-i960.c
 cpu-m10200.c
-cpu-sh.c
-elf-m10300.c
+cpu-m10300.c
+cpu-m32r.c
 cpu-m68k.c
 cpu-m88k.c
 cpu-mcore.c
-elf32-m32r.c
+cpu-mips.c
 cpu-ns32k.c
+cpu-pj.c
 cpu-powerpc.c
 cpu-rs6000.c
-libbfd.h
+cpu-sh.c
 cpu-sparc.c
 cpu-tic30.c
 cpu-tic80.c
 cpu-v850.c
 cpu-vax.c
-elf32-mips.c
 cpu-w65.c
 cpu-we32k.c
 cpu-z8k.c
@@ -100,7 +94,7 @@
 ecoffswap.h
 elf-bfd.h
 elf-m10200.c
-libhppa.h
+elf-m10300.c
 elf.c
 elf32-arc.c
 elf32-arm.h
@@ -108,15 +102,16 @@
 elf32-d30v.c
 elf32-fr30.c
 elf32-gen.c
-elf32-hppa.c
-elf32-hppa.h
+elf32-i370.c
 elf32-i386.c
 elf32-i860.c
-reloc.c
+elf32-i960.c
+elf32-m32r.c
 elf32-m68k.c
 elf32-m88k.c
 elf32-mcore.c
-targets.c
+elf32-mips.c
+elf32-pj.c
 elf32-ppc.c
 elf32-sh.c
 elf32-sparc.c
@@ -133,20 +128,15 @@
 elfcore.h
 elflink.c
 elflink.h
-elfxx-target.h
 epoc-pe-arm.c
 epoc-pei-arm.c
 format.c
 freebsd.h
-gen-aout.c
 genlink.h
 go32stub.h
 hash.c
-host-aout.c
 hp300bsd.c
 hp300hpux.c
-hppa_stubs.h
-hppabsd-core.c
 hpux-core.c
 i386aout.c
 i386bsd.c
@@ -163,24 +153,23 @@
 init.c
 irix-core.c
 libaout.h
-libbfd-in.h
 libbfd.c
-libcoff-in.h
+libbfd.h
 libcoff.h
 libecoff.h
+libhppa.h
 libieee.h
 libnlm.h
 liboasys.h
+libpei.h
 linker.c
 lynx-core.c
 m68k4knetbsd.c
 m68klinux.c
 m68klynx.c
 m68knetbsd.c
-doc/chew.c
 m88kmach3.c
 mipsbsd.c
-netbsd-core.c
 netbsd.h
 newsos3.c
 nlm-target.h
@@ -208,11 +197,11 @@
 pei-mcore.c
 pei-ppc.c
 peicode.h
+peigen.c
 ppcboot.c
-ptrace-core.c
+reloc.c
 reloc16.c
 riscix.c
-rs6000-core.c
 sco5-core.c
 section.c
 som.c
@@ -225,7 +214,7 @@
 stabs.c
 sunos.c
 syms.c
-sysdep.h
+targets.c
 tekhex.c
 trad-core.c
 vaxnetbsd.c
@@ -237,28 +226,3 @@
 vms.c
 vms.h
 xcofflink.c
-hosts/alphalinux.h
-hosts/alphavms.h
-hosts/decstation.h
-hosts/delta68.h
-hosts/dpx2.h
-hosts/hp300bsd.h
-hosts/i386bsd.h
-hosts/i386linux.h
-hosts/i386mach3.h
-hosts/i386sco.h
-hosts/i860mach3.h
-hosts/m68kaux.h
-hosts/m68klinux.h
-hosts/m88kmach3.h
-hosts/mipsbsd.h
-hosts/mipsmach3.h
-hosts/news-mips.h
-hosts/news.h
-hosts/pc532mach.h
-hosts/riscos.h
-hosts/symmetry.h
-hosts/tahoe.h
-hosts/vaxbsd.h
-hosts/vaxult.h
-hosts/vaxult2.h
diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
index f7ffbb4..b423792 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: 1999-04-18 18:26-0400\n"
+"POT-Creation-Date: 2000-02-25 22:13-0500\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,41 +14,41 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: aout-adobe.c:182
+#: aout-adobe.c:183
 #, c-format
 msgid "%s: Unknown section type in a.out.adobe file: %x\n"
 msgstr ""
 
-#: aoutx.h:1237 aoutx.h:1651
+#: aoutx.h:1244 aoutx.h:1658
 #, c-format
 msgid "%s: can not represent section `%s' in a.out object file format"
 msgstr ""
 
-#: aoutx.h:1621
+#: aoutx.h:1628
 #, c-format
 msgid ""
 "%s: can not represent section for symbol `%s' in a.out object file format"
 msgstr ""
 
-#: aoutx.h:1623
+#: aoutx.h:1630
 msgid "*unknown*"
 msgstr ""
 
-#: aoutx.h:3667
+#: aoutx.h:3674
 #, c-format
 msgid "%s: relocateable link from %s to %s not supported"
 msgstr ""
 
-#: archive.c:1716
+#: archive.c:1724
 msgid "Warning: writing archive was slow: rewriting timestamp\n"
 msgstr ""
 
-#: archive.c:1987
+#: archive.c:1990
 msgid "Reading archive file mod timestamp"
 msgstr ""
 
 #. FIXME: bfd can't call perror.
-#: archive.c:2011
+#: archive.c:2014
 msgid "Writing updated armap timestamp"
 msgstr ""
 
@@ -133,28 +133,42 @@
 msgid "bfd assertion fail %s:%d"
 msgstr ""
 
+#: bfd.c:697
+#, c-format
+msgid "BFD internal error, aborting at %s line %d in %s\n"
+msgstr ""
+
+#: bfd.c:701
+#, c-format
+msgid "BFD internal error, aborting at %s line %d\n"
+msgstr ""
+
+#: bfd.c:703
+msgid "Please report this bug.\n"
+msgstr ""
+
 #: binary.c:298
 #, c-format
 msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
 msgstr ""
 
-#: coff-a29k.c:121
+#: coff-a29k.c:122
 msgid "Missing IHCONST"
 msgstr ""
 
-#: coff-a29k.c:181
+#: coff-a29k.c:182
 msgid "Missing IHIHALF"
 msgstr ""
 
-#: coff-a29k.c:213
+#: coff-a29k.c:214
 msgid "Unrecognized reloc"
 msgstr ""
 
-#: coff-a29k.c:406
+#: coff-a29k.c:427
 msgid "missing IHCONST reloc"
 msgstr ""
 
-#: coff-a29k.c:497
+#: coff-a29k.c:518
 msgid "missing IHIHALF reloc"
 msgstr ""
 
@@ -162,141 +176,146 @@
 msgid "GP relative relocation used when GP not defined"
 msgstr ""
 
-#: coff-alpha.c:1486 elf64-alpha.c:4051
+#: coff-alpha.c:1486 elf64-alpha.c:3984
 msgid "using multiple gp values"
 msgstr ""
 
-#: coff-alpha.c:1992 coff-mips.c:1435 elf32-mips.c:5175
+#: coff-alpha.c:1992 coff-mips.c:1435
 msgid "GP relative relocation when GP not defined"
 msgstr ""
 
-#: coff-arm.c:884
+#: coff-arm.c:895 elf32-arm.h:258
 #, c-format
 msgid "%s: unable to find THUMB glue '%s' for `%s'"
 msgstr ""
 
-#: coff-arm.c:913
+#: coff-arm.c:924 elf32-arm.h:291
 #, c-format
 msgid "%s: unable to find ARM glue '%s' for `%s'"
 msgstr ""
 
-#: coff-arm.c:1192 coff-arm.c:1286
+#: coff-arm.c:1199 coff-arm.c:1293 elf32-arm.h:857 elf32-arm.h:955
 #, c-format
 msgid "%s(%s): warning: interworking not enabled."
 msgstr ""
 
-#: coff-arm.c:1196
+#: coff-arm.c:1203 elf32-arm.h:958
 #, c-format
 msgid "  first occurrence: %s: arm call to thumb"
 msgstr ""
 
-#: coff-arm.c:1290
+#: coff-arm.c:1297 elf32-arm.h:860
 #, c-format
 msgid "  first occurrence: %s: thumb call to arm"
 msgstr ""
 
-#: coff-arm.c:1293
+#: coff-arm.c:1300
 msgid "  consider relinking with --support-old-code enabled"
 msgstr ""
 
-#: coff-arm.c:1581 coff-tic80.c:682 cofflink.c:2722
+#: coff-arm.c:1586 coff-tic80.c:682 cofflink.c:2980
 #, c-format
 msgid "%s: bad reloc address 0x%lx in section `%s'"
 msgstr ""
 
-#: coff-arm.c:2036
+#: coff-arm.c:1923
+#, c-format
+msgid "%s: illegal symbol index in reloc: %d"
+msgstr ""
+
+#: coff-arm.c:2050
 #, c-format
 msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d"
 msgstr ""
 
-#: coff-arm.c:2051
+#: coff-arm.c:2065
 #, c-format
 msgid ""
 "%s: ERROR: passes floats in float registers whereas target %s uses integer "
 "registers"
 msgstr ""
 
-#: coff-arm.c:2054
+#: coff-arm.c:2068
 #, c-format
 msgid ""
 "%s: ERROR: passes floats in integer registers whereas target %s uses float "
 "registers"
 msgstr ""
 
-#: coff-arm.c:2069
+#: coff-arm.c:2083
 #, c-format
 msgid ""
 "%s: ERROR: compiled as position independent code, whereas target %s is "
 "absolute position"
 msgstr ""
 
-#: coff-arm.c:2072
+#: coff-arm.c:2086
 #, c-format
 msgid ""
 "%s: ERROR: compiled as absolute position code, whereas target %s is position "
 "independent"
 msgstr ""
 
-#: coff-arm.c:2101
+#: coff-arm.c:2115
 #, c-format
 msgid "Warning: input file %s supports interworking, whereas %s does not."
 msgstr ""
 
-#: coff-arm.c:2104
+#: coff-arm.c:2118
 #, c-format
 msgid "Warning: input file %s does not support interworking, whereas %s does."
 msgstr ""
 
-#: coff-arm.c:2132
+#: coff-arm.c:2146
 #, c-format
 msgid "private flags = %x:"
 msgstr ""
 
-#: coff-arm.c:2140
+#: coff-arm.c:2154 elf32-arm.h:2088
 msgid " [floats passed in float registers]"
 msgstr ""
 
-#: coff-arm.c:2142
+#: coff-arm.c:2156 elf32-arm.h:2090
 msgid " [floats passed in integer registers]"
 msgstr ""
 
-#: coff-arm.c:2145
+#: coff-arm.c:2159 elf32-arm.h:2093
 msgid " [position independent]"
 msgstr ""
 
-#: coff-arm.c:2147
+#: coff-arm.c:2161 elf32-arm.h:2095
 msgid " [absolute position]"
 msgstr ""
 
-#: coff-arm.c:2151
+#: coff-arm.c:2165
 msgid " [interworking flag not initialised]"
 msgstr ""
 
-#: coff-arm.c:2153
+#: coff-arm.c:2167
 msgid " [interworking supported]"
 msgstr ""
 
-#: coff-arm.c:2155
+#: coff-arm.c:2169
 msgid " [interworking not supported]"
 msgstr ""
 
-#: coff-arm.c:2204
+#: coff-arm.c:2218
 #, c-format
 msgid ""
 "Warning: Not setting interworking flag of %s, since it has already been "
 "specified as non-interworking"
 msgstr ""
 
-#: coff-arm.c:2208
+#: coff-arm.c:2222
 #, c-format
 msgid "Warning: Clearing the interworking flag of %s due to outside request"
 msgstr ""
 
-#: coff-i960.c:135 coff-i960.c:484
+#: coff-i960.c:136 coff-i960.c:485
 msgid "uncertain calling convention for non-COFF symbol"
 msgstr ""
 
-#: coff-mips.c:875 elf32-mips.c:1183
+#: coff-mips.c:875 elf32-mips.c:1322
 msgid "GP relative relocation when _gp not defined"
 msgstr ""
 
@@ -324,289 +343,410 @@
 msgid "ignoring reloc %s\n"
 msgstr ""
 
-#: coffcode.h:3413
+#: coffcode.h:3928
 #, c-format
 msgid "%s: warning: illegal symbol index %ld in line numbers"
 msgstr ""
 
-#: coffcode.h:3427
+#: coffcode.h:3942
 #, c-format
 msgid "%s: warning: duplicate line number information for `%s'"
 msgstr ""
 
-#: coffcode.h:3748
+#: coffcode.h:4297
 #, c-format
 msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
 msgstr ""
 
-#: coffcode.h:3932
+#: coffcode.h:4428
+#, c-format
+msgid "warning: %s: local symbol `%s' has no section"
+msgstr ""
+
+#: coffcode.h:4541
 #, c-format
 msgid "%s: warning: illegal symbol index %ld in relocs"
 msgstr ""
 
-#: coffcode.h:3970
+#: coffcode.h:4579
 #, c-format
 msgid "%s: illegal relocation type %d at address 0x%lx"
 msgstr ""
 
-#: coffgen.c:1607
+#: coffgen.c:1613
 #, c-format
 msgid "%s: bad string table size %lu"
 msgstr ""
 
-#: cofflink.c:423
+#: coffgen.c:2076
+#, c-format
+msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"
+msgstr ""
+
+#: cofflink.c:518 elflink.h:1568
 #, c-format
 msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
 msgstr ""
 
-#: cofflink.c:2093
+#: cofflink.c:2285
 #, c-format
 msgid "%s: relocs in section `%s', but it has no contents"
 msgstr ""
 
-#: coffswap.h:879
-#, c-format
-msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
-msgstr ""
-
-#: coffswap.h:892
+#: cofflink.c:2619 coffswap.h:904
 #, c-format
 msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
 msgstr ""
 
-#: dwarf2.c:420
+#: cofflink.c:2628 coffswap.h:891
+#, c-format
+msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
+msgstr ""
+
+#: dwarf2.c:429
 msgid "Dwarf Error: Can't find .debug_abbrev section."
 msgstr ""
 
-#: dwarf2.c:438
+#: dwarf2.c:447
 #, c-format
 msgid "Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."
 msgstr ""
 
-#: dwarf2.c:614
+#: dwarf2.c:627
 #, c-format
 msgid "Dwarf Error: Invalid or unhandled FORM value: %d."
 msgstr ""
 
-#: dwarf2.c:720
+#: dwarf2.c:700
+msgid "Dwarf Error: mangled line number section (bad file number)."
+msgstr ""
+
+#: dwarf2.c:791
 msgid "Dwarf Error: Can't find .debug_line section."
 msgstr ""
 
-#: dwarf2.c:881
+#: dwarf2.c:963
 msgid "Dwarf Error: mangled line number section."
 msgstr ""
 
-#: dwarf2.c:1054 dwarf2.c:1201
+#: dwarf2.c:1151 dwarf2.c:1307
 #, c-format
 msgid "Dwarf Error: Could not find abbrev number %d."
 msgstr ""
 
-#: dwarf2.c:1162
+#: dwarf2.c:1268
 #, c-format
 msgid ""
 "Dwarf Error: found dwarf version '%hu', this reader only handles version 2 "
 "information."
 msgstr ""
 
-#: dwarf2.c:1169
+#: dwarf2.c:1275
 #, c-format
 msgid ""
 "Dwarf Error: found address size '%u', this reader can not handle sizes "
 "greater than '%u'."
 msgstr ""
 
-#: dwarf2.c:1192
+#: dwarf2.c:1298
 #, c-format
 msgid "Dwarf Error: Bad abbrev number: %d."
 msgstr ""
 
-#: ecoff.c:1308
+#: ecoff.c:1325
 #, c-format
 msgid "Unknown basic type %d"
 msgstr ""
 
-#: ecoff.c:1580
+#: ecoff.c:1597
 #, c-format
 msgid ""
 "\n"
 "      End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1587 ecoff.c:1590
+#: ecoff.c:1604 ecoff.c:1607
 #, c-format
 msgid ""
 "\n"
 "      First symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1602
+#: ecoff.c:1619
 #, c-format
 msgid ""
 "\n"
 "      End+1 symbol: %-7ld   Type:  %s"
 msgstr ""
 
-#: ecoff.c:1609
+#: ecoff.c:1626
 #, c-format
 msgid ""
 "\n"
 "      Local symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1617
+#: ecoff.c:1634
 #, c-format
 msgid ""
 "\n"
 "      struct; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1622
+#: ecoff.c:1639
 #, c-format
 msgid ""
 "\n"
 "      union; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1627
+#: ecoff.c:1644
 #, c-format
 msgid ""
 "\n"
 "      enum; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1633
+#: ecoff.c:1650
 #, c-format
 msgid ""
 "\n"
 "      Type: %s"
 msgstr ""
 
-#: elf-m10200.c:455 elf-m10300.c:667 elf32-d10v.c:490 elf32-fr30.c:650
-#: elf32-m32r.c:1157 elf32-v850.c:1674
+#: elf-m10200.c:455 elf-m10300.c:670 elf32-arm.h:1852 elf32-d10v.c:493
+#: elf32-fr30.c:650 elf32-m32r.c:1157 elf32-v850.c:1677
 msgid "internal error: out of range error"
 msgstr ""
 
-#: elf-m10200.c:459 elf-m10300.c:671 elf32-d10v.c:494 elf32-fr30.c:654
-#: elf32-m32r.c:1161 elf32-v850.c:1678
+#: elf-m10200.c:459 elf-m10300.c:674 elf32-arm.h:1856 elf32-d10v.c:497
+#: elf32-fr30.c:654 elf32-m32r.c:1161 elf32-v850.c:1681
 msgid "internal error: unsupported relocation error"
 msgstr ""
 
-#: elf-m10200.c:463 elf-m10300.c:675 elf32-d10v.c:498 elf32-m32r.c:1165
+#: elf-m10200.c:463 elf-m10300.c:678 elf32-arm.h:1860 elf32-d10v.c:501
+#: elf32-m32r.c:1165
 msgid "internal error: dangerous error"
 msgstr ""
 
-#: elf-m10200.c:467 elf-m10300.c:679 elf32-d10v.c:502 elf32-fr30.c:662
-#: elf32-m32r.c:1169 elf32-v850.c:1698
+#: elf-m10200.c:467 elf-m10300.c:682 elf32-arm.h:1864 elf32-d10v.c:505
+#: elf32-fr30.c:662 elf32-m32r.c:1169 elf32-v850.c:1701
 msgid "internal error: unknown error"
 msgstr ""
 
-#: elf.c:320
+#: elf.c:323
 #, c-format
 msgid "%s: invalid string offset %u >= %lu for section `%s'"
 msgstr ""
 
-#: elf.c:543
+#: elf.c:546
 msgid ""
 "\n"
 "Program Header:\n"
 msgstr ""
 
-#: elf.c:591
+#: elf.c:594
 msgid ""
 "\n"
 "Dynamic Section:\n"
 msgstr ""
 
-#: elf.c:693
+#: elf.c:696
 msgid ""
 "\n"
 "Version definitions:\n"
 msgstr ""
 
-#: elf.c:716
+#: elf.c:719
 msgid ""
 "\n"
 "Version References:\n"
 msgstr ""
 
-#: elf.c:721
+#: elf.c:724
 #, c-format
 msgid "  required from %s:\n"
 msgstr ""
 
-#: elf.c:1882
+#: 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:2481
+#: elf.c:2648
 #, c-format
 msgid "%s: Not enough room for program headers (allocated %u, need %u)"
 msgstr ""
 
-#: elf.c:2584
+#: elf.c:2747
 #, c-format
 msgid "%s: Not enough room for program headers, try linking with -N"
 msgstr ""
 
-#: elf.c:2710
+#: elf.c:2873
 #, c-format
 msgid "Error: First section in segment (%s) starts at 0x%x"
 msgstr ""
 
-#: elf.c:2713
+#: elf.c:2876
 #, c-format
 msgid "       whereas segment starts at 0x%x"
 msgstr ""
 
-#: elf.c:2983
+#: elf.c:3146
 #, c-format
 msgid "%s: warning: allocated section `%s' not in segment"
 msgstr ""
 
-#: elf.c:3350
+#: elf.c:3525
 #, c-format
 msgid "%s: symbol `%s' required but not present"
 msgstr ""
 
-#: elf.c:3359
+#: elf.c:3534
 #, c-format
 msgid ""
 "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = "
 "0x%.8lx%s\n"
 msgstr ""
 
-#: elf.c:3501
+#: elf.c:3676
 #, c-format
 msgid "%s: warning: Empty loadable segment detected\n"
 msgstr ""
 
-#: elf.c:4774
+#: elf.c:4952
 #, c-format
 msgid "%s: unsupported relocation type %s"
 msgstr ""
 
-#: elf32-fr30.c:658 elf32-v850.c:1682
-msgid "internal error: dangerous relocation"
-msgstr ""
-
-#: elf32-hppa.c:1215
-msgid "Unsupported call to hppa_elf_reloc"
-msgstr ""
-
-#: elf32-i386.c:1293
+#: elf32-arm.h:1787 elf32-i386.c:1299 elf32-ppc.c:3092
 #, c-format
 msgid ""
 "%s: warning: unresolvable relocation against symbol `%s' from %s section"
 msgstr ""
 
+#: elf32-arm.h:1890
+#, c-format
+msgid ""
+"Warning: Not setting interwork flag of %s since it has already been "
+"specified as non-interworking"
+msgstr ""
+
+#: elf32-arm.h:1894
+#, c-format
+msgid "Warning: Clearing the interwork flag of %s due to outside request"
+msgstr ""
+
+#: elf32-arm.h:1942
+#, 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:1976
+#, c-format
+msgid "%s: compiled for a %s endian system and target is %s endian"
+msgstr ""
+
+#: elf32-arm.h:2022
+#, c-format
+msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"
+msgstr ""
+
+#: elf32-arm.h:2030
+#, c-format
+msgid ""
+"Error: %s passes floats in %s registers, whereas %s passes them in %s "
+"registers"
+msgstr ""
+
+#: elf32-arm.h:2033 elf32-arm.h:2035
+msgid "float"
+msgstr ""
+
+#: elf32-arm.h:2033 elf32-arm.h:2035
+msgid "integer"
+msgstr ""
+
+#: elf32-arm.h:2038
+#, c-format
+msgid "Error: %s is compiled as position %s code, whereas %s is not"
+msgstr ""
+
+#: elf32-arm.h:2041
+msgid "independent"
+msgstr ""
+
+#: elf32-arm.h:2041
+msgid "dependent"
+msgstr ""
+
+#: elf32-arm.h:2047
+#, c-format
+msgid "Warning: %s %s interworking, whereas %s %s"
+msgstr ""
+
+#: elf32-arm.h:2050
+msgid "supports"
+msgstr ""
+
+#: elf32-arm.h:2050
+msgid "does not support"
+msgstr ""
+
+#: elf32-arm.h:2052
+msgid "does not"
+msgstr ""
+
+#: elf32-arm.h:2052
+msgid "does"
+msgstr ""
+
+#. Ignore init flag - it may not be set, despite the flags field containing valid data.
+#: elf32-arm.h:2075 elf32-m68k.c:430 elf32-mips.c:2525
+#, c-format
+msgid "private flags = %lx:"
+msgstr ""
+
+#: elf32-arm.h:2078
+msgid " [interworking enabled]"
+msgstr ""
+
+#: elf32-arm.h:2080
+msgid " [interworking not enabled]"
+msgstr ""
+
+#: elf32-arm.h:2083
+msgid " [APCS-26]"
+msgstr ""
+
+#: elf32-arm.h:2085
+msgid " [APCS-32]"
+msgstr ""
+
+#: elf32-fr30.c:658 elf32-v850.c:1685
+msgid "internal error: dangerous relocation"
+msgstr ""
+
+#: elf32-i386.c:239
+#, c-format
+msgid "%s: invalid relocation type %d"
+msgstr ""
+
 #: elf32-m32r.c:808
 msgid "SDA relocation when _SDA_BASE_ not defined"
 msgstr ""
 
-#: elf32-m32r.c:892 elf32-ppc.c:3071
+#: elf32-m32r.c:892 elf32-ppc.c:2963
 #, c-format
 msgid "%s: unknown relocation type %d"
 msgstr ""
@@ -616,17 +756,1248 @@
 msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)"
 msgstr ""
 
-#: elf32-m32r.c:1906
+#: elf32-m32r.c:1902
 #, c-format
 msgid "%s: Instruction set mismatch with previous modules"
 msgstr ""
 
-#: elf32-m32r.c:1929
+#: elf32-m32r.c:1925
 #, c-format
 msgid "private flags = %lx"
 msgstr ""
 
-#: elf32-m32r.c:1934
+#: elf32-m32r.c:1930
 msgid ": m32r instructions"
 msgstr ""
 
+#: elf32-m32r.c:1931
+msgid ": m32rx instructions"
+msgstr ""
+
+#: elf32-m68k.c:433
+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
+#, c-format
+msgid "%s: Relocation %s (%d) is not currently supported.\n"
+msgstr ""
+
+#: elf32-mcore.c:463
+#, c-format
+msgid "%s: Unknown relocation type %d\n"
+msgstr ""
+
+#: elf32-mips.c:1481
+msgid "32bits gp relative relocation occurs for an external symbol"
+msgstr ""
+
+#: elf32-mips.c:1630
+#, c-format
+msgid "Linking mips16 objects into %s format is not supported"
+msgstr ""
+
+#: elf32-mips.c:2360 elf32-ppc.c:1408
+#, c-format
+msgid "%s: compiled for a big endian system and target is little endian"
+msgstr ""
+
+#: elf32-mips.c:2362 elf32-ppc.c:1410
+#, c-format
+msgid "%s: compiled for a little endian system and target is big endian"
+msgstr ""
+
+#: elf32-mips.c:2411
+#, c-format
+msgid "%s: linking PIC files with non-PIC files"
+msgstr ""
+
+#: elf32-mips.c:2421
+#, c-format
+msgid "%s: linking abicalls files with non-abicalls files"
+msgstr ""
+
+#: elf32-mips.c:2451
+#, c-format
+msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"
+msgstr ""
+
+#: elf32-mips.c:2460
+#, c-format
+msgid "%s: ISA mismatch (%d) with previous modules (%d)"
+msgstr ""
+
+#: elf32-mips.c:2483
+#, c-format
+msgid "%s: ABI mismatch: linking %s module with previous %s modules"
+msgstr ""
+
+#: elf32-mips.c:2497 elf32-ppc.c:1477 elf64-sparc.c:2827
+#, c-format
+msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
+msgstr ""
+
+#: elf32-mips.c:2528
+msgid " [abi=O32]"
+msgstr ""
+
+#: elf32-mips.c:2530
+msgid " [abi=O64]"
+msgstr ""
+
+#: elf32-mips.c:2532
+msgid " [abi=EABI32]"
+msgstr ""
+
+#: elf32-mips.c:2534
+msgid " [abi=EABI64]"
+msgstr ""
+
+#: elf32-mips.c:2536
+msgid " [abi unknown]"
+msgstr ""
+
+#: elf32-mips.c:2538
+msgid " [abi=N32]"
+msgstr ""
+
+#: elf32-mips.c:2540
+msgid " [abi=64]"
+msgstr ""
+
+#: elf32-mips.c:2542
+msgid " [no abi set]"
+msgstr ""
+
+#: elf32-mips.c:2545
+msgid " [mips1]"
+msgstr ""
+
+#: elf32-mips.c:2547
+msgid " [mips2]"
+msgstr ""
+
+#: elf32-mips.c:2549
+msgid " [mips3]"
+msgstr ""
+
+#: elf32-mips.c:2551
+msgid " [mips4]"
+msgstr ""
+
+#: elf32-mips.c:2553
+msgid " [unknown ISA]"
+msgstr ""
+
+#: elf32-mips.c:2556
+msgid " [32bitmode]"
+msgstr ""
+
+#: elf32-mips.c:2558
+msgid " [not 32bitmode]"
+msgstr ""
+
+#: elf32-mips.c:4161
+msgid "static procedure (no name)"
+msgstr ""
+
+#: elf32-mips.c:4778 elf64-alpha.c:4358
+#, c-format
+msgid "%s: illegal section name `%s'"
+msgstr ""
+
+#: elf32-mips.c:5305
+msgid "not enough GOT space for local GOT entries"
+msgstr ""
+
+#: elf32-mips.c:6363
+#, c-format
+msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
+msgstr ""
+
+#: elf32-mips.c:7342
+#, c-format
+msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
+msgstr ""
+
+#: elf32-ppc.c:1443
+#, c-format
+msgid ""
+"%s: compiled with -mrelocatable and linked with modules compiled normally"
+msgstr ""
+
+#: elf32-ppc.c:1451
+#, c-format
+msgid ""
+"%s: compiled normally and linked with modules compiled with -mrelocatable"
+msgstr ""
+
+#: elf32-ppc.c:1578
+#, c-format
+msgid "%s: Unknown special linker type %d"
+msgstr ""
+
+#: elf32-ppc.c:2251 elf32-ppc.c:2285 elf32-ppc.c:2320
+#, c-format
+msgid "%s: relocation %s cannot be used when making a shared object"
+msgstr ""
+
+#: elf32-ppc.c:3121
+#, c-format
+msgid "%s: unknown relocation type %d for symbol %s"
+msgstr ""
+
+#: elf32-ppc.c:3488 elf32-ppc.c:3510 elf32-ppc.c:3559
+#, c-format
+msgid ""
+"%s: The target (%s) of a %s relocation is in the wrong output section (%s)"
+msgstr ""
+
+#: elf32-ppc.c:3625
+#, c-format
+msgid "%s: Relocation %s is not yet supported for symbol %s."
+msgstr ""
+
+#: elf32-sh.c:681
+#, c-format
+msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
+msgstr ""
+
+#: elf32-sh.c:693
+#, c-format
+msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
+msgstr ""
+
+#: elf32-sh.c:710
+#, c-format
+msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
+msgstr ""
+
+#: elf32-sh.c:725
+#, c-format
+msgid "%s: 0x%lx: warning: could not find expected reloc"
+msgstr ""
+
+#: elf32-sh.c:762
+#, c-format
+msgid "%s: 0x%lx: warning: symbol in unexpected section"
+msgstr ""
+
+#: elf32-sh.c:884
+#, c-format
+msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
+msgstr ""
+
+#: elf32-sh.c:893
+#, c-format
+msgid "%s: 0x%lx: warning: bad count"
+msgstr ""
+
+#: elf32-sh.c:1279 elf32-sh.c:1666
+#, c-format
+msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
+msgstr ""
+
+#: elf32-sparc.c:1484 elf64-sparc.c:2240
+#, c-format
+msgid "%s: probably compiled without -fPIC?"
+msgstr ""
+
+#: elf32-sparc.c:1854
+#, c-format
+msgid "%s: compiled for a v8plus system and target is v8"
+msgstr ""
+
+#: elf32-sparc.c:1863
+#, c-format
+msgid "%s: compiled for a v8plusa system and target is v8plus"
+msgstr ""
+
+#: elf32-sparc.c:1871
+#, c-format
+msgid "%s: compiled for a 64 bit system and target is 32 bit"
+msgstr ""
+
+#: elf32-sparc.c:1883
+#, c-format
+msgid "%s: linking little endian files with big endian files"
+msgstr ""
+
+#: elf32-v850.c:680
+#, c-format
+msgid "Variable `%s' cannot occupy in multiple small data regions"
+msgstr ""
+
+#: elf32-v850.c:683
+#, c-format
+msgid ""
+"Variable `%s' can only be in one of the small, zero, and tiny data regions"
+msgstr ""
+
+#: elf32-v850.c:686
+#, c-format
+msgid ""
+"Variable `%s' cannot be in both small and zero data regions simultaneously"
+msgstr ""
+
+#: elf32-v850.c:689
+#, c-format
+msgid ""
+"Variable `%s' cannot be in both small and tiny data regions simultaneously"
+msgstr ""
+
+#: elf32-v850.c:692
+#, c-format
+msgid ""
+"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
+msgstr ""
+
+#: elf32-v850.c:1070
+msgid "FAILED to find previous HI16 reloc\n"
+msgstr ""
+
+#: elf32-v850.c:1689
+msgid "could not locate special linker symbol __gp"
+msgstr ""
+
+#: elf32-v850.c:1693
+msgid "could not locate special linker symbol __ep"
+msgstr ""
+
+#: elf32-v850.c:1697
+msgid "could not locate special linker symbol __ctbp"
+msgstr ""
+
+#: elf32-v850.c:1886
+#, c-format
+msgid "%s: Architecture mismatch with previous modules"
+msgstr ""
+
+#: elf32-v850.c:1905
+#, c-format
+msgid "private flags = %lx: "
+msgstr ""
+
+#: elf32-v850.c:1910
+msgid "v850 architecture"
+msgstr ""
+
+#: elf32-v850.c:1911
+msgid "v850e architecture"
+msgstr ""
+
+#: elf32-v850.c:1912
+msgid "v850ea architecture"
+msgstr ""
+
+#: elf64-alpha.c:947
+msgid "GPDISP relocation did not find ldah and lda instructions"
+msgstr ""
+
+#: elf64-alpha.c:2999
+#, c-format
+msgid "%s: .got subsegment exceeds 64K (size %d)"
+msgstr ""
+
+#: elf64-sparc.c:1248
+#, c-format
+msgid "%s: check_relocs: unhandled reloc type %d"
+msgstr ""
+
+#: elf64-sparc.c:1285
+msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
+msgstr ""
+
+#: 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:1328
+#, c-format
+msgid "Symbol `%s' has differing types: previously %s, REGISTER in %s"
+msgstr ""
+
+#: elf64-sparc.c:1374
+#, c-format
+msgid "Symbol `%s' has differing types: REGISTER in %s, %s in %s"
+msgstr ""
+
+#: elf64-sparc.c:2809
+#, c-format
+msgid "%s: linking UltraSPARC specific with HAL specific code"
+msgstr ""
+
+#: elfcode.h:1061
+#, c-format
+msgid "%s: version count (%ld) does not match symbol count (%ld)"
+msgstr ""
+
+#: elflink.c:423
+#, c-format
+msgid "%s: Section %s is already to large to put hole of %ld bytes in"
+msgstr ""
+
+#: elflink.h:1388
+#, c-format
+msgid "%s: %s: invalid version %u (max %d)"
+msgstr ""
+
+#: elflink.h:1429
+#, c-format
+msgid "%s: %s: invalid needed version %d"
+msgstr ""
+
+#: elflink.h:1546
+#, c-format
+msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s"
+msgstr ""
+
+#: elflink.h:1790
+#, c-format
+msgid "%s: warning: unexpected redefinition of `%s'"
+msgstr ""
+
+#: elflink.h:3480
+#, c-format
+msgid "warning: type and size of dynamic symbol `%s' are not defined"
+msgstr ""
+
+#: elflink.h:3752
+#, c-format
+msgid "%s: undefined versioned symbol name %s"
+msgstr ""
+
+#: elflink.h:4981
+#, c-format
+msgid "%s: could not find output section %s for input section %s"
+msgstr ""
+
+#: i386linux.c:450 m68klinux.c:454 sparclinux.c:452
+#, c-format
+msgid "Output file requires shared library `%s'\n"
+msgstr ""
+
+#: i386linux.c:458 m68klinux.c:462 sparclinux.c:460
+#, c-format
+msgid "Output file requires shared library `%s.so.%s'\n"
+msgstr ""
+
+#: i386linux.c:646 i386linux.c:696 m68klinux.c:653 m68klinux.c:701
+#: sparclinux.c:649 sparclinux.c:699
+#, c-format
+msgid "Symbol %s not defined for fixups\n"
+msgstr ""
+
+#: i386linux.c:720 m68klinux.c:725 sparclinux.c:723
+msgid "Warning: fixup count mismatch\n"
+msgstr ""
+
+#: ieee.c:167
+#, c-format
+msgid "%s: string too long (%d chars, max 65535)"
+msgstr ""
+
+#: ieee.c:297
+#, c-format
+msgid "%s: unrecognized symbol `%s' flags 0x%x"
+msgstr ""
+
+#: ieee.c:793
+#, c-format
+msgid "%s: unimplemented ATI record  %u for symbol %u"
+msgstr ""
+
+#: ieee.c:818
+#, c-format
+msgid "%s: unexpected ATN type %d in external part"
+msgstr ""
+
+#: ieee.c:840
+#, c-format
+msgid "%s: unexpected type after ATN"
+msgstr ""
+
+#: ihex.c:259
+#, c-format
+msgid "%s:%d: unexpected character `%s' in Intel Hex file\n"
+msgstr ""
+
+#: ihex.c:369
+#, c-format
+msgid "%s:%d: bad checksum in Intel Hex file (expected %u, found %u)"
+msgstr ""
+
+#: ihex.c:421
+#, c-format
+msgid "%s:%d: bad extended address record length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:438
+#, c-format
+msgid "%s:%d: bad extended start address length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:455
+#, c-format
+msgid "%s:%d: bad extended linear address record length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:472
+#, c-format
+msgid "%s:%d: bad extended linear start address length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:489
+#, c-format
+msgid "%s:%d: unrecognized ihex type %u in Intel Hex file\n"
+msgstr ""
+
+#: ihex.c:609
+#, c-format
+msgid "%s: internal error in ihex_read_section"
+msgstr ""
+
+#: ihex.c:644
+#, c-format
+msgid "%s: bad section length in ihex_read_section"
+msgstr ""
+
+#: ihex.c:858
+#, c-format
+msgid "%s: address 0x%s out of range for Intex Hex file"
+msgstr ""
+
+#: libbfd.c:484
+#, c-format
+msgid "not mapping: data=%lx mapped=%d\n"
+msgstr ""
+
+#: libbfd.c:487
+msgid "not mapping: env var not set\n"
+msgstr ""
+
+#: linker.c:2679
+#, c-format
+msgid "Attempt to do relocateable link with %s input and %s output"
+msgstr ""
+
+#: oasys.c:1016
+#, c-format
+msgid "%s: can not represent section `%s' in oasys"
+msgstr ""
+
+#: osf-core.c:146
+#, c-format
+msgid "Unhandled OSF/1 core file section type %d\n"
+msgstr ""
+
+#: peicode.h:395
+#, c-format
+msgid "%s: Import Library Format archives are not currently supported"
+msgstr ""
+
+#: peigen.c:938
+#, c-format
+msgid "%s: line number overflow: 0x%lx > 0xffff"
+msgstr ""
+
+#: peigen.c:950
+#, c-format
+msgid "%s: reloc overflow: 0x%lx > 0xffff"
+msgstr ""
+
+#: peigen.c:963
+msgid "Export Directory [.edata (or where ever we found it)]"
+msgstr ""
+
+#: peigen.c:964
+msgid "Import Directory [parts of .idata]"
+msgstr ""
+
+#: peigen.c:965
+msgid "Resource Directory [.rsrc]"
+msgstr ""
+
+#: peigen.c:966
+msgid "Exception Directory [.pdata]"
+msgstr ""
+
+#: peigen.c:967
+msgid "Security Directory"
+msgstr ""
+
+#: peigen.c:968
+msgid "Base Relocation Directory [.reloc]"
+msgstr ""
+
+#: peigen.c:969
+msgid "Debug Directory"
+msgstr ""
+
+#: peigen.c:970
+msgid "Description Directory"
+msgstr ""
+
+#: peigen.c:971
+msgid "Special Directory"
+msgstr ""
+
+#: peigen.c:972
+msgid "Thread Storage Directory [.tls]"
+msgstr ""
+
+#: peigen.c:973
+msgid "Load Configuration Directory"
+msgstr ""
+
+#: peigen.c:974
+msgid "Bound Import Directory"
+msgstr ""
+
+#: peigen.c:975
+msgid "Import Address Table Directory"
+msgstr ""
+
+#: peigen.c:976 peigen.c:977 peigen.c:978
+msgid "Reserved"
+msgstr ""
+
+#: peigen.c:1022
+msgid ""
+"\n"
+"The import table is the .idata section\n"
+msgstr ""
+
+#: peigen.c:1044
+msgid ""
+"\n"
+"There is an import table, but the section containing it could not be found\n"
+msgstr ""
+
+#: peigen.c:1048
+#, c-format
+msgid ""
+"\n"
+"There is an import table in %s at 0x%lx\n"
+msgstr ""
+
+#: peigen.c:1089
+#, c-format
+msgid ""
+"\n"
+"Function descriptor located at the start address: %04lx\n"
+msgstr ""
+
+#: peigen.c:1092
+#, c-format
+msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
+msgstr ""
+
+#: peigen.c:1098
+msgid ""
+"\n"
+"No reldata section! Function descriptor not decoded.\n"
+msgstr ""
+
+#: peigen.c:1103
+msgid ""
+"\n"
+"The Import Tables (interpreted .idata section contents)\n"
+msgstr ""
+
+#: peigen.c:1105
+msgid " vma:            Hint    Time      Forward  DLL       First\n"
+msgstr ""
+
+#: peigen.c:1107
+msgid "                 Table   Stamp     Chain    Name      Thunk\n"
+msgstr ""
+
+#: peigen.c:1157
+#, c-format
+msgid ""
+"\n"
+"\tDLL Name: %s\n"
+msgstr ""
+
+#: peigen.c:1161 peigen.c:1224
+msgid "\tvma:  Hint/Ord Member-Name\n"
+msgstr ""
+
+#: peigen.c:1223
+msgid "\tThe Import Address Table (difference found)\n"
+msgstr ""
+
+#: peigen.c:1230
+msgid "\t>>> Ran out of IAT members!\n"
+msgstr ""
+
+#: peigen.c:1248
+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
+msgid ""
+"\n"
+"There is an export table, but the section containing it could not be found\n"
+msgstr ""
+
+#: peigen.c:1323
+#, c-format
+msgid ""
+"\n"
+"There is an export table in %s at 0x%lx\n"
+msgstr ""
+
+#: peigen.c:1355
+msgid ""
+"\n"
+"The Export Tables (interpreted .edata section contents)\n"
+"\n"
+msgstr ""
+
+#: peigen.c:1358
+#, c-format
+msgid "Export Flags \t\t\t%lx\n"
+msgstr ""
+
+#: peigen.c:1361
+#, c-format
+msgid "Time/Date stamp \t\t%lx\n"
+msgstr ""
+
+#: peigen.c:1364
+#, c-format
+msgid "Major/Minor \t\t\t%d/%d\n"
+msgstr ""
+
+#: peigen.c:1367
+msgid "Name \t\t\t\t"
+msgstr ""
+
+#: peigen.c:1373
+#, c-format
+msgid "Ordinal Base \t\t\t%ld\n"
+msgstr ""
+
+#: peigen.c:1376
+msgid "Number in:\n"
+msgstr ""
+
+#: peigen.c:1379
+#, c-format
+msgid "\tExport Address Table \t\t%lx\n"
+msgstr ""
+
+#: peigen.c:1383
+#, c-format
+msgid "\t[Name Pointer/Ordinal] Table\t%lu\n"
+msgstr ""
+
+#: peigen.c:1386
+msgid "Table Addresses\n"
+msgstr ""
+
+#: peigen.c:1389
+msgid "\tExport Address Table \t\t"
+msgstr ""
+
+#: peigen.c:1394
+msgid "\tName Pointer Table \t\t"
+msgstr ""
+
+#: peigen.c:1399
+msgid "\tOrdinal Table \t\t\t"
+msgstr ""
+
+#: peigen.c:1415
+#, c-format
+msgid ""
+"\n"
+"Export Address Table -- Ordinal Base %ld\n"
+msgstr ""
+
+#: peigen.c:1436
+msgid "Forwarder RVA"
+msgstr ""
+
+#: peigen.c:1444
+msgid "Export RVA"
+msgstr ""
+
+#: peigen.c:1451
+msgid ""
+"\n"
+"[Ordinal/Name Pointer] Table\n"
+msgstr ""
+
+#: peigen.c:1496
+#, c-format
+msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
+msgstr ""
+
+#: peigen.c:1500
+msgid ""
+"\n"
+"The Function Table (interpreted .pdata section contents)\n"
+msgstr ""
+
+#: peigen.c:1502
+msgid " vma:\t\tBegin    End      EH       EH       PrologEnd  Exception\n"
+msgstr ""
+
+#: peigen.c:1504
+msgid "     \t\tAddress  Address  Handler  Data     Address    Mask\n"
+msgstr ""
+
+#: peigen.c:1576
+msgid " Register save millicode"
+msgstr ""
+
+#: peigen.c:1579
+msgid " Register restore millicode"
+msgstr ""
+
+#: peigen.c:1582
+msgid " Glue code sequence"
+msgstr ""
+
+#: peigen.c:1628
+msgid ""
+"\n"
+"\n"
+"PE File Base Relocations (interpreted .reloc section contents)\n"
+msgstr ""
+
+#: peigen.c:1663
+#, c-format
+msgid ""
+"\n"
+"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
+msgstr ""
+
+#: peigen.c:1676
+#, c-format
+msgid "\treloc %4d offset %4x [%4lx] %s"
+msgstr ""
+
+#. The MS dumpbin program reportedly ands with 0xff0f before
+#. printing the characteristics field.  Not sure why.  No reason to
+#. emulate it here.
+#: peigen.c:1715
+#, c-format
+msgid ""
+"\n"
+"Characteristics 0x%x\n"
+msgstr ""
+
+#: ppcboot.c:418
+msgid ""
+"\n"
+"ppcboot header:\n"
+msgstr ""
+
+#: ppcboot.c:419
+#, c-format
+msgid "Entry offset        = 0x%.8lx (%ld)\n"
+msgstr ""
+
+#: ppcboot.c:420
+#, c-format
+msgid "Length              = 0x%.8lx (%ld)\n"
+msgstr ""
+
+#: ppcboot.c:423
+#, c-format
+msgid "Flag field          = 0x%.2x\n"
+msgstr ""
+
+#: ppcboot.c:429
+#, c-format
+msgid "Partition name      = \"%s\"\n"
+msgstr ""
+
+#: ppcboot.c:448
+#, c-format
+msgid ""
+"\n"
+"Partition[%d] start  = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
+msgstr ""
+
+#: ppcboot.c:454
+#, c-format
+msgid "Partition[%d] end    = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
+msgstr ""
+
+#: ppcboot.c:460
+#, c-format
+msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
+msgstr ""
+
+#: ppcboot.c:461
+#, c-format
+msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
+msgstr ""
+
+#: som.c:5335
+msgid "som_sizeof_headers unimplemented"
+msgstr ""
+
+#: srec.c:290
+#, c-format
+msgid "%s:%d: Unexpected character `%s' in S-record file\n"
+msgstr ""
+
+#: syms.c:974
+msgid "Unsupported .stab relocation"
+msgstr ""
+
+#: vms-gsd.c:357
+#, c-format
+msgid "bfd_make_section (%s) failed"
+msgstr ""
+
+#: vms-gsd.c:371
+#, c-format
+msgid "bfd_set_section_flags (%s, %x) failed"
+msgstr ""
+
+#: vms-gsd.c:407
+#, c-format
+msgid "Size mismatch section %s=%lx, %s=%lx"
+msgstr ""
+
+#: vms-gsd.c:702
+#, c-format
+msgid "unknown gsd/egsd subtype %d"
+msgstr ""
+
+#: vms-hdr.c:405
+msgid "Object module NOT error-free !\n"
+msgstr ""
+
+#: vms-misc.c:541
+#, c-format
+msgid "Stack overflow (%d) in _bfd_vms_push"
+msgstr ""
+
+#: vms-misc.c:560
+msgid "Stack underflow in _bfd_vms_pop"
+msgstr ""
+
+#: vms-misc.c:931
+msgid "_bfd_vms_output_counted called with zero bytes"
+msgstr ""
+
+#: vms-misc.c:936
+msgid "_bfd_vms_output_counted called with too many bytes"
+msgstr ""
+
+#: vms-misc.c:1069
+#, c-format
+msgid "Symbol %s replaced by %s\n"
+msgstr ""
+
+#: vms-misc.c:1133
+#, c-format
+msgid "failed to enter %s"
+msgstr ""
+
+#: vms-tir.c:69
+msgid "No Mem !"
+msgstr ""
+
+#: vms-tir.c:309
+msgid "Bad section index in ETIR_S_C_STA_PQ"
+msgstr ""
+
+#: vms-tir.c:324
+#, c-format
+msgid "Unsupported STA cmd %d"
+msgstr ""
+
+#: vms-tir.c:329 vms-tir.c:1287
+#, c-format
+msgid "Reserved STA cmd %d"
+msgstr ""
+
+#: vms-tir.c:436
+#, c-format
+msgid "ETIR_S_C_STO_GBL: no symbol \"%s\""
+msgstr ""
+
+#: vms-tir.c:457
+#, c-format
+msgid "ETIR_S_C_STO_CA: no symbol \"%s\""
+msgstr ""
+
+#: vms-tir.c:470
+msgid "ETIR_S_C_STO_RB/AB: Not supported"
+msgstr ""
+
+#: vms-tir.c:528
+msgid "ETIR_S_C_STO_LP_PSB: Not supported"
+msgstr ""
+
+#: vms-tir.c:534
+msgid "ETIR_S_C_STO_HINT_GBL: not implemented"
+msgstr ""
+
+#: vms-tir.c:540
+msgid "ETIR_S_C_STO_HINT_PS: not implemented"
+msgstr ""
+
+#: vms-tir.c:544 vms-tir.c:1460
+#, c-format
+msgid "Reserved STO cmd %d"
+msgstr ""
+
+#: vms-tir.c:657
+msgid "ETIR_S_C_OPR_INSV: Not supported"
+msgstr ""
+
+#: vms-tir.c:675
+msgid "ETIR_S_C_OPR_USH: Not supported"
+msgstr ""
+
+#: vms-tir.c:681
+msgid "ETIR_S_C_OPR_ROT: Not supported"
+msgstr ""
+
+#: vms-tir.c:700
+msgid "ETIR_S_C_OPR_REDEF: Not supported"
+msgstr ""
+
+#: vms-tir.c:706
+msgid "ETIR_S_C_OPR_DFLIT: Not supported"
+msgstr ""
+
+#: vms-tir.c:710 vms-tir.c:1656
+#, c-format
+msgid "Reserved OPR cmd %d"
+msgstr ""
+
+#: vms-tir.c:779 vms-tir.c:1726
+#, c-format
+msgid "Reserved CTL cmd %d"
+msgstr ""
+
+#: vms-tir.c:808
+msgid "ETIR_S_C_STC_LP: not supported"
+msgstr ""
+
+#: vms-tir.c:826
+msgid "ETIR_S_C_STC_GBL: not supported"
+msgstr ""
+
+#: vms-tir.c:834
+msgid "ETIR_S_C_STC_GCA: not supported"
+msgstr ""
+
+#: vms-tir.c:843
+msgid "ETIR_S_C_STC_PS: not supported"
+msgstr ""
+
+#.
+#. * stack byte from image
+#. * arg: -
+#. *
+#.
+#: vms-tir.c:1187
+msgid "Stack-from-image not implemented"
+msgstr ""
+
+#: vms-tir.c:1207
+msgid "Stack-entry-mask not fully implemented"
+msgstr ""
+
+#.
+#. * compare procedure argument
+#. * arg: cs	symbol name
+#. *	by	argument index
+#. *	da	argument descriptor
+#. *
+#. * compare argument descriptor with symbol argument (ARG$V_PASSMECH)
+#. * and stack TRUE (args match) or FALSE (args dont match) value
+#.
+#: vms-tir.c:1223
+msgid "PASSMECH not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1243
+msgid "Stack-local-symbol not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1258
+msgid "Stack-literal not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1280
+msgid "Stack-local-symbol-entry-point-mask not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1456
+#, c-format
+msgid "Unimplemented STO cmd %d"
+msgstr ""
+
+#: vms-tir.c:1596
+msgid "TIR_S_C_OPR_ASH incomplete"
+msgstr ""
+
+#: vms-tir.c:1610
+msgid "TIR_S_C_OPR_USH incomplete"
+msgstr ""
+
+#: vms-tir.c:1624
+msgid "TIR_S_C_OPR_ROT incomplete"
+msgstr ""
+
+#.
+#. * redefine symbol to current location
+#.
+#: vms-tir.c:1645
+msgid "TIR_S_C_OPR_REDEF not supported"
+msgstr ""
+
+#.
+#. * define a literal
+#.
+#: vms-tir.c:1652
+msgid "TIR_S_C_OPR_DFLIT not supported"
+msgstr ""
+
+#: vms-tir.c:1707
+msgid "TIR_S_C_CTL_DFLOC not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1715
+msgid "TIR_S_C_CTL_STLOC not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1723
+msgid "TIR_S_C_CTL_STKDL not fully implemented"
+msgstr ""
+
+#: vms-tir.c:1778
+#, c-format
+msgid "Obj code %d not found"
+msgstr ""
+
+#: vms-tir.c:2127
+#, c-format
+msgid "SEC_RELOC with no relocs in section %s"
+msgstr ""
+
+#: vms-tir.c:2401
+#, c-format
+msgid "Unhandled relocation %s"
+msgstr ""
+
+#: xcofflink.c:1661
+#, c-format
+msgid "%s: `%s' has line numbers but no enclosing section"
+msgstr ""
+
+#: xcofflink.c:1713
+#, c-format
+msgid "%s: class %d symbol `%s' has no aux entries"
+msgstr ""
+
+#: xcofflink.c:1736
+#, c-format
+msgid "%s: symbol `%s' has unrecognized csect type %d"
+msgstr ""
+
+#: xcofflink.c:1748
+#, c-format
+msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
+msgstr ""
+
+#: xcofflink.c:1787
+#, c-format
+msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
+msgstr ""
+
+#: xcofflink.c:1911
+#, c-format
+msgid "%s: symbol `%s' has unrecognized smclas %d"
+msgstr ""
+
+#: xcofflink.c:1930
+#, c-format
+msgid "%s: csect `%s' not in enclosing section"
+msgstr ""
+
+#: xcofflink.c:2034
+#, c-format
+msgid "%s: misplaced XTY_LD `%s'"
+msgstr ""
+
+#: xcofflink.c:2345
+#, c-format
+msgid "%s: reloc %s:%d not in csect"
+msgstr ""
+
+#: xcofflink.c:2480
+#, c-format
+msgid "%s: XCOFF shared object when not producing XCOFF output"
+msgstr ""
+
+#: xcofflink.c:2501
+#, c-format
+msgid "%s: dynamic object with no .loader section"
+msgstr ""
+
+#: xcofflink.c:3141
+#, c-format
+msgid "%s: no such symbol"
+msgstr ""
+
+#: xcofflink.c:3733
+#, c-format
+msgid "warning: attempt to export undefined symbol `%s'"
+msgstr ""
+
+#: xcofflink.c:4709
+#, 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
+#, c-format
+msgid "%s: loader reloc in unrecognized section `%s'"
+msgstr ""
+
+#: xcofflink.c:5556 xcofflink.c:6255
+#, c-format
+msgid "%s: `%s' in loader reloc but not loader sym"
+msgstr ""
+
+#: xcofflink.c:5571
+#, c-format
+msgid "%s: loader reloc in read-only section %s"
+msgstr ""
+
+#: xcofflink.c:6451
+#, c-format
+msgid "%s: unsupported relocation type 0x%02x"
+msgstr ""
+
+#: xcofflink.c:6497
+#, c-format
+msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
+msgstr ""
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index cbda407..d9db826 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -1,5 +1,5 @@
 /* BFD back-end for PPCbug boot records.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -225,7 +225,7 @@
 static boolean
 ppcboot_get_section_contents (abfd, section, location, offset, count)
      bfd *abfd;
-     asection *section;
+     asection *section ATTRIBUTE_UNUSED;
      PTR location;
      file_ptr offset;
      bfd_size_type count;
@@ -241,7 +241,7 @@
 
 static long
 ppcboot_get_symtab_upper_bound (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   return (PPCBOOT_SYMS + 1) * sizeof (asymbol *);
 }
@@ -340,7 +340,7 @@
 
 static void
 ppcboot_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -395,8 +395,8 @@
 
 static int
 ppcboot_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return sizeof (ppcboot_hdr_t);
 }
@@ -531,5 +531,7 @@
   BFD_JUMP_TABLE_LINK (ppcboot),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   NULL
 };
diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c
index 2b4fdbb..0969dce 100644
--- a/bfd/ptrace-core.c
+++ b/bfd/ptrace-core.c
@@ -224,6 +224,8 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
 
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 8885814..a3318e6 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1,5 +1,5 @@
 /* BFD support for handling relocation entries.
-   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.
 
@@ -25,7 +25,7 @@
 
 	BFD maintains relocations in much the same way it maintains
 	symbols: they are left alone until required, then read in
-	en-mass and translated into an internal form.  A common
+	en-masse and translated into an internal form.  A common
 	routine <<bfd_perform_relocation>> acts upon the
 	canonical form to do the fixup.
 
@@ -340,13 +340,26 @@
 .       {* The textual name of the relocation type. *}
 .  char *name;
 .
-.       {* When performing a partial link, some formats must modify the
-.          relocations rather than the data - this flag signals this.*}
+.       {* 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
+.          addend is recorded with the section contents; when performing a
+.          partial link (ld -r) the section contents (the data) will be
+.          modified.  The value of this field is FALSE if addends are
+.          recorded with the relocation (in arelent.addend); when performing
+.          a partial link the relocation will be modified.
+.          All relocations for all ELF USE_RELA targets should set this field
+.          to FALSE (values of TRUE should be looked on with suspicion).
+.          However, the converse is not true: not all relocations of all ELF
+.          USE_REL targets set this field to TRUE.  Why this is so is peculiar
+.          to each particular target.  For relocs that aren't used in partial
+.          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
 .          are to be used in the relocation sum.  E.g., if this was an 8 bit
-.          bit of data which we read and relocated, this would be
+.          byte of data which we read and relocated, this would be
 .          0x000000ff. When we have relocs which have an addend, such as
 .          sun4 extended relocs, the value in the offset part of a
 .          relocating field is garbage so we never use it. In this case
@@ -389,6 +402,14 @@
 
 .#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
 .
+
+DESCRIPTION
+	This is used to fill in an empty howto entry in an array.
+
+.#define EMPTY_HOWTO(C) \
+.  HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false)
+.
+
 DESCRIPTION
 	Helper routine to turn a symbol into a relocation value.
 
@@ -519,17 +540,14 @@
 
     case complain_overflow_bitfield:
       /* Bitfields are sometimes signed, sometimes unsigned.  We
-         overflow if the value has some, but not all, bits set outside
-         the field, or if it has any bits set outside the field but
-         the sign bit is not set.  */
+	 explicitly allow an address wrap too, which means a bitfield
+	 of n bits is allowed to store -2**n to 2**n-1.  Thus overflow
+	 if the value has some, but not all, bits set outside the
+	 field.  */
       a >>= rightshift;
-      if ((a & ~ fieldmask) != 0)
-	{
-	  signmask = (fieldmask >> 1) + 1;
-	  ss = (signmask << rightshift) - 1;
-	  if ((ss | relocation) != ~ (bfd_vma) 0)
-	    flag = bfd_reloc_overflow;
-	}
+      ss = a & ~ fieldmask;
+      if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & ~ fieldmask))
+	flag = bfd_reloc_overflow;
       break;
 
     default:
@@ -584,7 +602,7 @@
 {
   bfd_vma relocation;
   bfd_reloc_status_type flag = bfd_reloc_ok;
-  bfd_size_type addr = reloc_entry->address;
+  bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   bfd_vma output_base = 0;
   reloc_howto_type *howto = reloc_entry->howto;
   asection *reloc_target_output_section;
@@ -620,7 +638,8 @@
     }
 
   /* Is the address of the relocation really within the section?  */
-  if (reloc_entry->address > input_section->_cooked_size)
+  if (reloc_entry->address > input_section->_cooked_size /
+      bfd_octets_per_byte (abfd))
     return bfd_reloc_outofrange;
 
   /* Work out which section the relocation is targetted at and the
@@ -863,23 +882,23 @@
      R result
 
      Do this:
-     i i i i i o o o o o        from bfd_get<size>
-     and           S S S S S    to get the size offset we want
-     +   r r r r r r r r r r  to get the final value to place
+     ((  i i i i i o o o o o  from bfd_get<size>
+     and           S S S S S) to get the size offset we want
+     +   r r r r r r r r r r) to get the final value to place
      and           D D D D D  to chop to right size
      -----------------------
-     A A A A A
+     =             A A A A A
      And this:
-     ...   i i i i i o o o o o  from bfd_get<size>
-     and   N N N N N            get instruction
+     (   i i i i i o o o o o  from bfd_get<size>
+     and N N N N N          ) get instruction
      -----------------------
-     ...   B B B B B
+     =   B B B B B
 
      And then:
-     B B B B B
-     or              A A A A A
+     (   B B B B B
+     or            A A A A A)
      -----------------------
-     R R R R R R R R R R        put into bfd_put<size>
+     =   R R R R R R R R R R  put into bfd_put<size>
      */
 
 #define DOIT(x) \
@@ -889,41 +908,41 @@
     {
     case 0:
       {
-	char x = bfd_get_8 (abfd, (char *) data + addr);
+	char x = bfd_get_8 (abfd, (char *) data + octets);
 	DOIT (x);
-	bfd_put_8 (abfd, x, (unsigned char *) data + addr);
+	bfd_put_8 (abfd, x, (unsigned char *) data + octets);
       }
       break;
 
     case 1:
       {
-	short x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
+	short x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
 	DOIT (x);
-	bfd_put_16 (abfd, x, (unsigned char *) data + addr);
+	bfd_put_16 (abfd, x, (unsigned char *) data + octets);
       }
       break;
     case 2:
       {
-	long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+	long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
 	DOIT (x);
-	bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
+	bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
       }
       break;
     case -2:
       {
-	long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+	long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
 	relocation = -relocation;
 	DOIT (x);
-	bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
+	bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
       }
       break;
 
     case -1:
       {
-	long x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
+	long x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
 	relocation = -relocation;
 	DOIT (x);
-	bfd_put_16 (abfd, x, (bfd_byte *) data + addr);
+	bfd_put_16 (abfd, x, (bfd_byte *) data + octets);
       }
       break;
 
@@ -934,9 +953,9 @@
     case 4:
 #ifdef BFD64
       {
-	bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
+	bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + octets);
 	DOIT (x);
-	bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
+	bfd_put_64 (abfd, x, (bfd_byte *) data + octets);
       }
 #else
       abort ();
@@ -986,7 +1005,7 @@
 {
   bfd_vma relocation;
   bfd_reloc_status_type flag = bfd_reloc_ok;
-  bfd_size_type addr = reloc_entry->address;
+  bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   bfd_vma output_base = 0;
   reloc_howto_type *howto = reloc_entry->howto;
   asection *reloc_target_output_section;
@@ -1006,7 +1025,7 @@
   if (howto->special_function)
     {
       bfd_reloc_status_type cont;
-  
+
       /* XXX - The special_function calls haven't been fixed up to deal
 	 with creating new relocations and section contents.  */
       cont = howto->special_function (abfd, reloc_entry, symbol,
@@ -1253,29 +1272,29 @@
      R result
 
      Do this:
-     i i i i i o o o o o        from bfd_get<size>
-     and           S S S S S    to get the size offset we want
-     +   r r r r r r r r r r  to get the final value to place
+     ((  i i i i i o o o o o  from bfd_get<size>
+     and           S S S S S) to get the size offset we want
+     +   r r r r r r r r r r) to get the final value to place
      and           D D D D D  to chop to right size
      -----------------------
-     A A A A A
+     =             A A A A A
      And this:
-     ...   i i i i i o o o o o  from bfd_get<size>
-     and   N N N N N            get instruction
+     (   i i i i i o o o o o  from bfd_get<size>
+     and N N N N N          ) get instruction
      -----------------------
-     ...   B B B B B
+     =   B B B B B
 
      And then:
-     B B B B B
-     or              A A A A A
+     (   B B B B B
+     or            A A A A A)
      -----------------------
-     R R R R R R R R R R        put into bfd_put<size>
+     =   R R R R R R R R R R  put into bfd_put<size>
      */
 
 #define DOIT(x) \
   x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) +  relocation) & howto->dst_mask))
 
-  data = (bfd_byte *) data_start + (addr - data_start_offset);
+  data = (bfd_byte *) data_start + (octets - data_start_offset);
 
   switch (howto->size)
     {
@@ -1405,8 +1424,8 @@
      bfd_byte *location;
 {
   int size;
-  bfd_vma x;
-  boolean overflow;
+  bfd_vma x = 0;
+  bfd_reloc_status_type flag;
   unsigned int rightshift = howto->rightshift;
   unsigned int bitpos = howto->bitpos;
 
@@ -1444,7 +1463,7 @@
      which we don't check for.  We must either check at every single
      operation, which would be tedious, or we must do the computations
      in a type larger than bfd_vma, which would be inefficient.  */
-  overflow = false;
+  flag = bfd_reloc_ok;
   if (howto->complain_on_overflow != complain_overflow_dont)
     {
       bfd_vma addrmask, fieldmask, signmask, ss;
@@ -1470,7 +1489,7 @@
 	  signmask = ~ (fieldmask >> 1);
 	  ss = a & signmask;
 	  if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
-	    overflow = true;
+	    flag = bfd_reloc_overflow;
 
 	  /* We only need this next bit of code if the sign bit of B
              is below the sign bit of A.  This would only happen if
@@ -1482,7 +1501,7 @@
 	  if ((b & signmask) != 0)
 	    {
 	      /* Set all the bits above the sign bit.  */
-	      b -= signmask <<= 1;
+	      b -= signmask << 1;
 	    }
 
 	  b = (b & addrmask) >> bitpos;
@@ -1500,7 +1519,7 @@
 	     */
 	  signmask = (fieldmask >> 1) + 1;
 	  if (((~ (a ^ b)) & (a ^ sum)) & signmask)
-	    overflow = true;
+	    flag = bfd_reloc_overflow;
 
 	  break;
 
@@ -1520,55 +1539,35 @@
 	  b = (b & addrmask) >> bitpos;
 	  sum = (a + b) & addrmask;
 	  if ((a | b | sum) & ~ fieldmask)
-	    overflow = true;
+	    flag = bfd_reloc_overflow;
 
 	  break;
 
 	case complain_overflow_bitfield:
-	  /* Much like unsigned, except no trimming with addrmask.  In
-             addition, the sum overflows if there is a carry out of
-             the bfd_vma, i.e., the sum is less than either input
-             operand.  */
+	  /* Much like the signed check, but for a field one bit
+	     wider, and no trimming with addrmask.  We allow a
+	     bitfield to represent numbers in the range -2**n to
+	     2**n-1, where n is the number of bits in the field.
+	     Note that when bfd_vma is 32 bits, a 32-bit reloc can't
+	     overflow, which is exactly what we want.  */
 	  a >>= rightshift;
+
+	  signmask = ~ fieldmask;
+	  ss = a & signmask;
+	  if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & signmask))
+	    flag = bfd_reloc_overflow;
+
+	  signmask = ((~ howto->src_mask) >> 1) & howto->src_mask;
+	  if ((b & signmask) != 0)
+	    b -= signmask << 1;
+
 	  b >>= bitpos;
 
-	  /* Bitfields are sometimes used for signed numbers; for
-             example, a 13-bit field sometimes represents values in
-             0..8191 and sometimes represents values in -4096..4095.
-             If the field is signed and a is -4095 (0x1001) and b is
-             -1 (0x1fff), the sum is -4096 (0x1000), but (0x1001 +
-             0x1fff is 0x3000).  It's not clear how to handle this
-             everywhere, since there is not way to know how many bits
-             are significant in the relocation, but the original code
-             assumed that it was fully sign extended, and we will keep
-             that assumption.  */
-	  signmask = (fieldmask >> 1) + 1;
-
-	  if ((a & ~ fieldmask) != 0)
-	    {
-	      /* Some bits out of the field are set.  This might not
-                 be a problem: if this is a signed bitfield, it is OK
-                 iff all the high bits are set, including the sign
-                 bit.  We'll try setting all but the most significant
-                 bit in the original relocation value: if this is all
-                 ones, we are OK, assuming a signed bitfield.  */
-	      ss = (signmask << rightshift) - 1;
-	      if ((ss | relocation) != ~ (bfd_vma) 0)
-		overflow = true;
-	      a &= fieldmask;
-	    }
-
-	  /* We just assume (b & ~ fieldmask) == 0.  */
-
 	  sum = a + b;
-	  if (sum < a || (sum & ~ fieldmask) != 0)
-	    {
-	      /* There was a carry out, or the field overflow.  Test
-                 for signed operands again.  Here is the overflow test
-                 is as for complain_overflow_signed.  */
-	      if (((~ (a ^ b)) & (a ^ sum)) & signmask)
-		overflow = true;
-	    }
+
+	  signmask = fieldmask + 1;
+	  if (((~ (a ^ b)) & (a ^ sum)) & signmask)
+	    flag = bfd_reloc_overflow;
 
 	  break;
 
@@ -1609,7 +1608,7 @@
       break;
     }
 
-  return overflow ? bfd_reloc_overflow : bfd_reloc_ok;
+  return flag;
 }
 
 /*
@@ -1944,6 +1943,25 @@
      The GNU linker currently doesn't do any of this optimizing.
 
 ENUM
+  BFD_RELOC_ALPHA_USER_LITERAL
+ENUMX
+  BFD_RELOC_ALPHA_USER_LITUSE_BASE
+ENUMX
+  BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF
+ENUMX
+  BFD_RELOC_ALPHA_USER_LITUSE_JSR
+ENUMX
+  BFD_RELOC_ALPHA_USER_GPDISP
+ENUMX
+  BFD_RELOC_ALPHA_USER_GPRELHIGH
+ENUMX
+  BFD_RELOC_ALPHA_USER_GPRELLOW
+ENUMDOC
+  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.
+
+ENUM
   BFD_RELOC_ALPHA_HINT
 ENUMDOC
   The HINT relocation indicates a value that should be filled into the
@@ -2028,6 +2046,14 @@
   BFD_RELOC_MIPS_CALL_HI16
 ENUMX
   BFD_RELOC_MIPS_CALL_LO16
+ENUMX
+  BFD_RELOC_MIPS_SUB
+ENUMX
+  BFD_RELOC_MIPS_GOT_PAGE
+ENUMX
+  BFD_RELOC_MIPS_GOT_OFST
+ENUMX
+  BFD_RELOC_MIPS_GOT_DISP
 COMMENT
 ENUMDOC
   MIPS ELF relocations.
@@ -2081,6 +2107,21 @@
   ns32k relocations
 
 ENUM
+  BFD_RELOC_PJ_CODE_HI16
+ENUMX
+  BFD_RELOC_PJ_CODE_LO16
+ENUMX
+  BFD_RELOC_PJ_CODE_DIR16
+ENUMX
+  BFD_RELOC_PJ_CODE_DIR32
+ENUMX
+  BFD_RELOC_PJ_CODE_REL16
+ENUMX
+  BFD_RELOC_PJ_CODE_REL32
+ENUMDOC
+  Picojava relocs.  Not all of these appear in object files.
+
+ENUM
   BFD_RELOC_PPC_B26
 ENUMX
   BFD_RELOC_PPC_BA26
@@ -2144,6 +2185,11 @@
   Power(rs6000) and PowerPC relocations.
 
 ENUM
+  BFD_RELOC_I370_D12
+ENUMDOC
+  IBM 370/390 relocations
+
+ENUM
   BFD_RELOC_CTOR
 ENUMDOC
   The type of reloc used to build a contructor table - at the moment
@@ -2158,6 +2204,8 @@
 ENUM
   BFD_RELOC_ARM_IMMEDIATE
 ENUMX
+  BFD_RELOC_ARM_ADRL_IMMEDIATE
+ENUMX
   BFD_RELOC_ARM_OFFSET_IMM
 ENUMX
   BFD_RELOC_ARM_SHIFT_IMM
@@ -2305,46 +2353,46 @@
 ENUM
   BFD_RELOC_D30V_9_PCREL
 ENUMDOC
-  This is a 6-bit pc-relative reloc with 
-  the right 3 bits assumed to be 0.  
+  This is a 6-bit pc-relative reloc with
+  the right 3 bits assumed to be 0.
 ENUM
   BFD_RELOC_D30V_9_PCREL_R
 ENUMDOC
-  This is a 6-bit pc-relative reloc with 
+  This is a 6-bit pc-relative reloc with
   the right 3 bits assumed to be 0. Same
   as the previous reloc but on the right side
-  of the container.  
+  of the container.
 ENUM
   BFD_RELOC_D30V_15
 ENUMDOC
-  This is a 12-bit absolute reloc with the 
-  right 3 bitsassumed to be 0.  
+  This is a 12-bit absolute reloc with the
+  right 3 bitsassumed to be 0.
 ENUM
   BFD_RELOC_D30V_15_PCREL
 ENUMDOC
-  This is a 12-bit pc-relative reloc with 
-  the right 3 bits assumed to be 0.  
+  This is a 12-bit pc-relative reloc with
+  the right 3 bits assumed to be 0.
 ENUM
   BFD_RELOC_D30V_15_PCREL_R
 ENUMDOC
-  This is a 12-bit pc-relative reloc with 
+  This is a 12-bit pc-relative reloc with
   the right 3 bits assumed to be 0. Same
   as the previous reloc but on the right side
-  of the container.  
+  of the container.
 ENUM
   BFD_RELOC_D30V_21
 ENUMDOC
-  This is an 18-bit absolute reloc with 
+  This is an 18-bit absolute reloc with
   the right 3 bits assumed to be 0.
 ENUM
   BFD_RELOC_D30V_21_PCREL
 ENUMDOC
-  This is an 18-bit pc-relative reloc with 
+  This is an 18-bit pc-relative reloc with
   the right 3 bits assumed to be 0.
 ENUM
   BFD_RELOC_D30V_21_PCREL_R
 ENUMDOC
-  This is an 18-bit pc-relative reloc with 
+  This is an 18-bit pc-relative reloc with
   the right 3 bits assumed to be 0. Same
   as the previous reloc but on the right side
   of the container.
@@ -2526,7 +2574,7 @@
 ENUMDOC
   This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
   short offset into 11 bits.
-  
+
 ENUM
   BFD_RELOC_MCORE_PCREL_IMM8BY4
 ENUMX
@@ -2537,15 +2585,102 @@
   BFD_RELOC_MCORE_PCREL_32
 ENUMX
   BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
+ENUMX
+  BFD_RELOC_MCORE_RVA
 ENUMDOC
   Motorola Mcore relocations.
-  
+
+ENUM
+  BFD_RELOC_AVR_7_PCREL
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit pc relative
+  short offset into 7 bits.
+ENUM
+  BFD_RELOC_AVR_13_PCREL
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 13 bit pc relative
+  short offset into 12 bits.
+ENUM
+  BFD_RELOC_AVR_16_PM
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 17 bit value (usually
+  program memory address) into 16 bits.  
+ENUM
+  BFD_RELOC_AVR_LO8_LDI
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+  data memory address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_HI8_LDI
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+  of data memory address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_HH8_LDI
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+  of program memory address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_LO8_LDI_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (usually data memory address) into 8 bit immediate value of SUBI insn.
+ENUM
+  BFD_RELOC_AVR_HI8_LDI_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (high 8 bit of data memory address) into 8 bit immediate value of
+  SUBI insn.
+ENUM
+  BFD_RELOC_AVR_HH8_LDI_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (most high 8 bit of program memory address) into 8 bit immediate value
+  of LDI or SUBI insn.
+ENUM
+  BFD_RELOC_AVR_LO8_LDI_PM
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+  command address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_HI8_LDI_PM
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+  of command address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_HH8_LDI_PM
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+  of command address) into 8 bit immediate value of LDI insn.
+ENUM
+  BFD_RELOC_AVR_LO8_LDI_PM_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (usually command address) into 8 bit immediate value of SUBI insn.
+ENUM
+  BFD_RELOC_AVR_HI8_LDI_PM_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (high 8 bit of 16 bit command address) into 8 bit immediate value
+  of SUBI insn.
+ENUM
+  BFD_RELOC_AVR_HH8_LDI_PM_NEG
+ENUMDOC
+  This is a 16 bit reloc for the AVR that stores negated 8 bit value
+  (high 6 bit of 22 bit command address) into 8 bit immediate
+  value of SUBI insn.
+ENUM
+  BFD_RELOC_AVR_CALL
+ENUMDOC
+  This is a 32 bit reloc for the AVR that stores 23 bit value
+  into 22 bits.
+
 ENUM
   BFD_RELOC_VTABLE_INHERIT
 ENUMX
   BFD_RELOC_VTABLE_ENTRY
 ENUMDOC
-  These two relocations are used by the linker to determine which of 
+  These two relocations are used by the linker to determine which of
   the entries in a C++ virtual function table are actually used.  When
   the --gc-sections option is given, the linker will zero out the entries
   that are not used, so that the code for those functions need not be
@@ -2559,7 +2694,7 @@
   VTABLE_ENTRY is a zero-space relocation that describes the use of a
   virtual function table entry.  The reloc's symbol should refer to the
   table of the class mentioned in the code.  Off of that base, an offset
-  describes the entry that is being used.  For Rela hosts, this offset 
+  describes the entry that is being used.  For Rela hosts, this offset
   is stored in the reloc's addend.  For Rel hosts, we are forced to put
   this offset in the reloc's section offset.
 
@@ -2680,9 +2815,9 @@
 /*ARGSUSED*/
 boolean
 bfd_generic_relax_section (abfd, section, link_info, again)
-     bfd *abfd;
-     asection *section;
-     struct bfd_link_info *link_info;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
      boolean *again;
 {
   *again = false;
@@ -2705,8 +2840,8 @@
 /*ARGSUSED*/
 boolean
 bfd_generic_gc_sections (abfd, link_info)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -2805,7 +2940,8 @@
 		case bfd_reloc_undefined:
 		  if (!((*link_info->callbacks->undefined_symbol)
 			(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
-			 input_bfd, input_section, (*parent)->address)))
+			 input_bfd, input_section, (*parent)->address,
+			 true)))
 		    goto error_return;
 		  break;
 		case bfd_reloc_dangerous:
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index 7e7952e..0e7c18a 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -81,7 +81,8 @@
 	{
 	  if (! ((*link_info->callbacks->undefined_symbol)
 		 (link_info, bfd_asymbol_name (symbol),
-		  input_section->owner, input_section, reloc->address)))
+		  input_section->owner, input_section, reloc->address,
+		  true)))
 	    abort ();
 	  value = 0;
 	}
@@ -194,9 +195,10 @@
     {
       int another_pass = 0;
 
-      /* Allocate and initialize the shrinks array for this section.  */
-      shrinks = (int *) bfd_malloc (reloc_count * sizeof (int));
-      memset (shrinks, 0, reloc_count * sizeof (int));
+      /* Allocate and initialize the shrinks array for this section.
+         The last element is used as an accumlator of shrinks.  */
+      shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int));
+      memset (shrinks, 0, (reloc_count + 1) * sizeof (int));
 
       /* Loop until nothing changes in this section.  */
       do {
@@ -218,13 +220,14 @@
 	    if (shrink != shrinks[i])
 	      {
 	        another_pass = 1;
-		for (j = i + 1; j < reloc_count; j++)
+		for (j = i + 1; j <= reloc_count; j++)
 		  shrinks[j] += shrink - shrinks[i];
 	      }
 	  }
   
       } while (another_pass);
 
+      shrink = shrinks[reloc_count];
       free((char *)shrinks);
     }
 
diff --git a/bfd/riscix.c b/bfd/riscix.c
index f5ab49a..b3eb18c 100644
--- a/bfd/riscix.c
+++ b/bfd/riscix.c
@@ -1,5 +1,5 @@
 /* BFD back-end for RISC iX (Acorn, arm) binaries.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   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.
@@ -154,7 +154,7 @@
   HOWTO( 5,              0,  1,   16, true,  0, complain_overflow_signed,  0,"DISP16",    true, 0x0000ffff,0x0000ffff, true),
   HOWTO( 6,              0,  2,   32, true,  0, complain_overflow_signed,  0,"DISP32",    true, 0xffffffff,0xffffffff, true),
   HOWTO( 7,              2,  3,   26, false, 0, complain_overflow_signed,  riscix_fix_pcrel_26_done, "ARM26D",true,0x00ffffff,0x00ffffff, false),
-  {-1},
+  EMPTY_HOWTO (-1),
   HOWTO( 9,              0, -1,   16, false, 0, complain_overflow_bitfield,0,"NEG16",        true, 0x0000ffff,0x0000ffff, false),
   HOWTO( 10,              0, -2,   32, false, 0, complain_overflow_bitfield,0,"NEG32",        true, 0xffffffff,0xffffffff, false)
 };
@@ -166,13 +166,13 @@
 static bfd_reloc_status_type
 riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
 			  output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc_entry;
-     asymbol *symbol;
-     PTR data;
-     asection *input_section;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   /* This is dead simple at present.  */
   return bfd_reloc_ok;
@@ -187,7 +187,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
   bfd_size_type addr = reloc_entry->address;
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index b20555f..6de7441 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -1,5 +1,5 @@
 /* IBM RS/6000 "XCOFF" back-end 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.
    FIXME: Can someone provide a transliteration of this name into ASCII?
    Using the following chars caused a compiler warning on HIUX (so I replaced
@@ -81,26 +81,47 @@
 #define	core_hdr(bfd)		(((Rs6kCorData*)(bfd->tdata.any))->hdr)
 
 /* AIX 4.1 Changed the names and locations of a few items in the core file,
-   this seems to be the quickest easiet way to deal with it. 
+   this seems to be the quickest/easiest way to deal with it. 
 
    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.  */
+   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.  */
+
+#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
+#else
 #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
 #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
 #endif
 
 /* These are stored in the bfd's tdata */
 typedef struct {
-  struct core_dump hdr;		/* core file header */
+  struct CORE_DUMP hdr;		/* core file header */
 } Rs6kCorData;
 
 static asection *make_bfd_asection PARAMS ((bfd *, CONST char *, flagword,
@@ -137,7 +158,7 @@
 rs6000coff_core_p (abfd)
      bfd *abfd;
 {
-  struct core_dump coredata;
+  struct CORE_DUMP coredata;
   struct stat statbuf;
   bfd_size_type nread;
   char *tmpptr;
@@ -145,8 +166,8 @@
   if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     return NULL;
 
-  nread = bfd_read (&coredata, 1, sizeof (struct core_dump), abfd);
-  if (nread != sizeof (struct core_dump))
+  nread = bfd_read (&coredata, 1, sizeof (struct CORE_DUMP), abfd);
+  if (nread != sizeof (struct CORE_DUMP))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -197,6 +218,15 @@
       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 ||
@@ -205,6 +235,7 @@
       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)
@@ -253,9 +284,9 @@
      See if we can just fake it.  */
   if (!make_bfd_asection (abfd, ".ldinfo",
   			  SEC_HAS_CONTENTS,
-			  (bfd_size_type) 0x7fffffff,
+			  (bfd_size_type) LOADER_REGION_SIZE,
 			  (bfd_vma) 0,
-			  (file_ptr) coredata.c_tab))
+			  (file_ptr) coredata.LOADER_OFFSET_FIELD))
     return NULL;
 
 #ifndef CORE_VERSION_1
@@ -284,7 +315,7 @@
   {
     struct ld_info ldinfo;
     bfd_size_type ldinfo_size;
-    file_ptr ldinfo_offset = (file_ptr) coredata.c_tab;
+    file_ptr ldinfo_offset = (file_ptr) coredata.LOADER_OFFSET_FIELD;
 
     /* .data section from executable.  */
     if (coredata.c_datasize)
@@ -360,7 +391,7 @@
      bfd *core_bfd;
      bfd *exec_bfd;
 {
-  struct core_dump coredata;
+  struct CORE_DUMP coredata;
   struct ld_info ldinfo;
   bfd_size_type size;
   char *path, *s;
@@ -372,7 +403,7 @@
       || bfd_read (&coredata, sizeof coredata, 1, core_bfd) != sizeof coredata)
     return false;
 
-  if (bfd_seek (core_bfd, (long) coredata.c_tab, SEEK_SET) != 0)
+  if (bfd_seek (core_bfd, (long) coredata.LOADER_OFFSET_FIELD, SEEK_SET) != 0)
     return false;
 
   size = (char *) &ldinfo.ldinfo_filename[0] - (char *) &ldinfo.ldinfo_next;
diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c
index f10c8f1..46c97d2 100644
--- a/bfd/sco5-core.c
+++ b/bfd/sco5-core.c
@@ -425,5 +425,7 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0                     /* backend_data */
 };
diff --git a/bfd/section.c b/bfd/section.c
index 18778b5..b3b7608 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, 1997
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -150,6 +150,27 @@
 
 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. *}
+.
+.struct bfd_comdat_info
+.{
+.  {* The name of the symbol associated with a comdat section.  *}
+.  const char *name;
+.
+.  {* 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
@@ -307,6 +328,14 @@
 .	{* 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.  *}
+.#define SEC_SMALL_DATA 0x2000000
+.
+. 	{* This section contains data which may be shared with other
+.	   executables or shared objects.  *}
+.#define SEC_SHARED 0x4000000
+.
 .	{*  End of section flags.  *}
 .
 .	{* Some internal packed boolean fields.  *}
@@ -340,22 +369,25 @@
 .
 .   bfd_vma lma;
 .
-.        {* The size of the section in bytes, 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 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_size_type _cooked_size;
 .
-.        {* The original size on disk of the section, in bytes.  Normally this
+.        {* 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 _raw_size;
 .
 .        {* If this section is going to be output, then this value is the
-.           offset into the output section of the first byte in the input
-.           section. E.g., if this was going to start at the 100th byte in
-.           the output section, this value would be 100. *}
+.           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_vma output_offset;
 .
@@ -413,6 +445,10 @@
 .
 .   unsigned int lineno_count;
 .
+.	 {* Optional information about a COMDAT entry; NULL if not COMDAT *}
+.
+.   struct bfd_comdat_info *comdat;
+.
 .        {* When a section is being output, this value changes as more
 .           linenumbers are written out *}
 .
@@ -472,28 +508,60 @@
 .extern const struct symbol_cache_entry * const bfd_und_symbol;
 .extern const struct symbol_cache_entry * const bfd_ind_symbol;
 .#define bfd_get_section_size_before_reloc(section) \
-.     (section->reloc_done ? (abort(),1): (section)->_raw_size)
+.     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
+.                            : (section)->_raw_size)
 .#define bfd_get_section_size_after_reloc(section) \
-.     ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
+.     ((section)->reloc_done ? (section)->_cooked_size \
+.                            : (abort (), (bfd_size_type) 1))
 */
 
+/* We use a macro to initialize the static asymbol structures because
+   traditional C does not permit us to initialize a union member while
+   gcc warns if we don't initialize it.  */
+ /* the_bfd, name, value, attr, section [, udata] */
+#ifdef __STDC__
+#define GLOBAL_SYM_INIT(NAME, SECTION) \
+  { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
+#else
+#define GLOBAL_SYM_INIT(NAME, SECTION) \
+  { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
+#endif
+
 /* These symbols are global, not specific to any BFD.  Therefore, anything
    that tries to change them is broken, and should be repaired.  */
+
 static const asymbol global_syms[] =
 {
- /* the_bfd, name, value, attr, section [, udata] */
-  {0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_com_section},
-  {0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_und_section},
-  {0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_abs_section},
-  {0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_ind_section},
+  GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section),
+  GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section),
+  GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section),
+  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, 0, 0, FLAGS, 0, 0, 0, 0, 0, 0, 0, 0, 0, (asection *) &SEC, \
-      0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, \
-      (asymbol *) &global_syms[IDX], (asymbol **) &SYM, 0, 0 }
+    /* 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                \
+    }
 
 STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
 	     BFD_COM_SECTION_NAME, 0);
@@ -636,6 +704,7 @@
   newsect->reloc_count = 0;
   newsect->line_filepos = 0;
   newsect->owner = abfd;
+  newsect->comdat = 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
@@ -733,7 +802,7 @@
 /*ARGSUSED*/
 boolean
 bfd_set_section_flags (abfd, section, flags)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr section;
      flagword flags;
 {
@@ -856,7 +925,7 @@
 	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} bytes.
+	@var{offset} for @var{count} octets.
 
 
 
@@ -1033,43 +1102,73 @@
 
 SYNOPSIS
 	void _bfd_strip_section_from_output
-	(asection *section);
+	(struct bfd_link_info *info, asection *section);
 
 DESCRIPTION
-	Remove @var{section} from the output.  If the output section becomes
-	empty, remove it from the output bfd.
+	Remove @var{section} from the output.  If the output section
+	becomes empty, remove it from the output bfd.  @var{info} may
+	be NULL; if it is not, it is used to decide whether the output
+	section is empty.
 */
 void
-_bfd_strip_section_from_output (s)
+_bfd_strip_section_from_output (info, s)
+     struct bfd_link_info *info;
      asection *s;
 {
   asection **spp, *os;
   struct bfd_link_order *p, *pp;
+  boolean keep_os;
 
+  /* Excise the input section from the link order.
+
+     FIXME: For all calls that I can see to this function, the link
+     orders have not yet been set up.  So why are we checking them? --
+     Ian */
   os = s->output_section;
   for (p = os->link_order_head, pp = NULL; p != NULL; pp = p, p = p->next)
     if (p->type == bfd_indirect_link_order
 	&& p->u.indirect.section == s)
       {
-	/* Excise the input section.  */
 	if (pp)
 	  pp->next = p->next;
 	else
 	  os->link_order_head = p->next;
 	if (!p->next)
 	  os->link_order_tail = pp;
-
-	if (!os->link_order_head)
-	  {
-	    /* Excise the output section.  */
-	    for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
-	      if (*spp == os)
-		{
-		  *spp = os->next;
-		  os->owner->section_count--;
-		  break;
-		}
-	  }
 	break;
       }
+
+  keep_os = os->link_order_head != NULL;
+
+  if (! keep_os && info != NULL)
+    {
+      bfd *abfd;
+      for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+	{
+	  asection *is;
+	  for (is = abfd->sections; is != NULL; is = is->next)
+	    {
+	      if (is != s && is->output_section == os)
+		break;
+	    }
+	  if (is != NULL)
+	    break;
+	}
+      if (abfd != NULL)
+	keep_os = true;
+    }
+
+  /* If the output section is empty, remove it too.  Careful about sections
+     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)
+    {
+      for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
+	if (*spp == os)
+	  {
+	    *spp = os->next;
+	    os->owner->section_count--;
+	    break;
+	  }
+    }
 }
diff --git a/bfd/som.c b/bfd/som.c
index b5786b5..cd61cc6 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -148,6 +148,7 @@
   unsigned int symbol_info;
   unsigned int symbol_value;
   unsigned int priv_level;
+  unsigned int secondary_def;
 };
 
 /* Forward declarations */
@@ -440,9 +441,7 @@
   1,    "Lb4*=Mb1+L*=",	/* 0x2b */
   2,    "Lb4*=Md1+4*=",	/* 0x2c */
   3,    "Ld1+=Me1+=",	/* 0x2d */
-  /* R_SHORT_PCREL_MODE */
   0,   	"",	        /* 0x2e */
-  /* R_LONG_PCREL_MODE */
   0,   	"",	        /* 0x2f */
   /* R_PCREL_CALL */
   0,    "L4=RD=Sb=",	/* 0x30 */
@@ -459,8 +458,9 @@
   1,    "L4=RD8<b+=Sb=",/* 0x3b */
   0,    "L4=RD8<b+=Sd=",/* 0x3c */
   1,    "L4=RD8<b+=Sd=",/* 0x3d */
-  /* R_RESERVED */
+  /* R_SHORT_PCREL_MODE */
   0,    "",	        /* 0x3e */
+  /* R_LONG_PCREL_MODE */
   0,    "",	        /* 0x3f */
   /* R_ABS_CALL */
   0,    "L4=RD=Sb=",	/* 0x40 */
@@ -635,8 +635,8 @@
   4,    "Ve=",	        /* 0xcd */
   /* R_TRANSLATED */
   0,    "",	        /* 0xce */
-  /* R_RESERVED */
-  0,    "",	        /* 0xcf */
+  /* R_AUX_UNWIND */
+  0,    "Sd=Vf=Ef=",    /* 0xcf */
   /* R_COMP1 */
   0,    "Ob=",	        /* 0xd0 */
   /* R_COMP2 */
@@ -655,13 +655,13 @@
   /* R_N1SEL */
   0,	"",		/* 0xd9 */
   /* R_LINETAB */
-  0,	"",		/* 0xda */
+  0,	"Eb=Sd=Ve=",	/* 0xda */
   /* R_LINETAB_ESC */
-  0,	"",		/* 0xdb */
+  0,	"Eb=Mb=",	/* 0xdb */
   /* R_LTP_OVERRIDE */
   0,	"",		/* 0xdc */
   /* R_COMMENT */
-  0,	"",		/* 0xdd */
+  0,    "Ob=Ve=",	/* 0xdd */
   /* R_RESERVED */
   0,	"",		/* 0xde */
   0,	"",		/* 0xdf */
@@ -752,6 +752,7 @@
 
 /* And these first appeared in hpux10.  */
 #ifndef R_SHORT_PCREL_MODE
+#define NO_PCREL_MODES
 #define R_SHORT_PCREL_MODE 0x3e
 #endif
 
@@ -783,6 +784,9 @@
 #define R_COMMENT 0xdd
 #endif
 
+#define SOM_HOWTO(TYPE, NAME)	\
+  HOWTO(TYPE, 0, 0, 32, false, 0, 0, hppa_som_reloc, NAME, false, 0, 0, false)
+
 static reloc_howto_type som_hppa_howto_table[] =
 {
   {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
@@ -1685,9 +1689,28 @@
 
     case R_HPPA_NONE:
     case R_HPPA_ABS_CALL:
-    case R_HPPA_PCREL_CALL:
       /* Right now we can default all these.  */
       break;
+
+    case R_HPPA_PCREL_CALL:
+      {
+#ifndef NO_PCREL_MODES
+	/* If we have short and long pcrel modes, then generate the proper
+	   mode selector, then the pcrel relocation.  Redundant selectors
+	   will be eliminted as the relocs are sized and emitted.  */
+	final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));
+	if (!final_types[0])
+	  return NULL;
+	if (format == 17)
+	  *final_types[0] = R_SHORT_PCREL_MODE;
+	else
+	  *final_types[0] = R_LONG_PCREL_MODE;
+	final_types[1] = final_type;
+	final_types[2] = NULL;
+	*final_type = base_type;
+#endif
+	break;
+      }
     }
   return final_types;
 }
@@ -2666,6 +2689,9 @@
 	   subsection = subsection->next)
 	{
 	  int reloc_offset, current_rounding_mode;
+#ifndef NO_PCREL_MODES
+ 	  int current_call_mode;
+#endif
 
 	  /* Find a subspace of this space.  */
 	  if (!som_is_subspace (subsection)
@@ -2700,6 +2726,9 @@
 	  reloc_offset = 0;
 	  som_initialize_reloc_queue (reloc_queue);
 	  current_rounding_mode = R_N_MODE;
+#ifndef NO_PCREL_MODES
+	  current_call_mode = R_SHORT_PCREL_MODE;
+#endif
 
 	  /* Translate each BFD relocation into one or more SOM 
 	     relocations.  */
@@ -2764,6 +2793,10 @@
 		case R_END_TRY:
 		case R_N0SEL:
 		case R_N1SEL:
+#ifndef NO_PCREL_MODES
+		case R_SHORT_PCREL_MODE:
+		case R_LONG_PCREL_MODE:
+#endif
 		  reloc_offset = bfd_reloc->address;
 		  break;
 
@@ -2888,6 +2921,19 @@
 		    }
 		  break;
 
+#ifndef NO_PCREL_MODES
+		case R_LONG_PCREL_MODE:
+		case R_SHORT_PCREL_MODE:
+		  if (bfd_reloc->howto->type != current_call_mode)
+		    {
+		      bfd_put_8 (abfd, bfd_reloc->howto->type, p);
+		      subspace_reloc_size += 1;
+		      p += 1;
+		      current_call_mode = bfd_reloc->howto->type;
+		    }
+		  break;
+#endif
+
 		case R_EXIT:
 		case R_ALT_ENTRY:
 		case R_FSEL:
@@ -4010,6 +4056,13 @@
 
   /* Set the symbol's value.  */
   info->symbol_value = sym->value + sym->section->vma;
+
+  /* The secondary_def field is for weak symbols.  */
+  if (sym->flags & BSF_WEAK)
+    info->secondary_def = true;
+  else
+    info->secondary_def = false;
+
 }
 
 /* Build and write, in one big chunk, the entire symbol table for
@@ -4053,6 +4106,7 @@
       som_symtab[i].symbol_info = info.symbol_info;
       som_symtab[i].xleast = 3;
       som_symtab[i].symbol_value = info.symbol_value | info.priv_level;
+      som_symtab[i].secondary_def = info.secondary_def;
     }
 
   /* Everything is ready, seek to the right location and
@@ -4292,7 +4346,7 @@
 	  som_symbol_data (sym)->tc_data.ap.hppa_priv_level =
 	    sym->symbol.value & 0x3;
 	  sym->symbol.value &= ~0x3;
-	  /* If the symbol's scope is ST_UNSAT, then these are
+	  /* If the symbol's scope is SS_UNSAT, then these are
 	     undefined function symbols.  */
 	  if (bufp->symbol_scope == SS_UNSAT)
 	    sym->symbol.flags |= BSF_FUNCTION;
@@ -4340,6 +4394,10 @@
 	  break;
 	}
 
+      /* Check for a weak symbol.  */
+      if (bufp->secondary_def)
+        sym->symbol.flags |= BSF_WEAK;
+
       /* Mark section symbols and symbols used by the debugger.
 	 Note $START$ is a magic code symbol, NOT a section symbol.  */
       if (sym->symbol.name[0] == '$'
@@ -5882,7 +5940,7 @@
 
 	  /* Fill in the lst symbol record.  */
 	  curr_lst_sym->hidden = 0;
-	  curr_lst_sym->secondary_def = 0;
+	  curr_lst_sym->secondary_def = info.secondary_def;
 	  curr_lst_sym->symbol_type = info.symbol_type;
 	  curr_lst_sym->symbol_scope = info.symbol_scope;
 	  curr_lst_sym->check_level = 0;
@@ -6258,6 +6316,8 @@
   BFD_JUMP_TABLE_LINK (som),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c
index 86d4e7e..73a29b3 100644
--- a/bfd/sparclinux.c
+++ b/bfd/sparclinux.c
@@ -1,5 +1,6 @@
 /* BFD back-end for linux flavored sparc a.out binaries.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -299,7 +300,7 @@
 static boolean
 linux_link_create_dynamic_sections (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   flagword flags;
   register asection *s;
diff --git a/bfd/srec.c b/bfd/srec.c
index 70d2f96..31f69b0 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -171,7 +171,7 @@
 /* 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 21
+#define CHUNK 16
 
 /* 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.  */
@@ -1000,31 +1000,28 @@
      tdata_type *tdata;
      srec_data_list_type *list;
 {
-  unsigned int bytes_written = 0;
+  unsigned int octets_written = 0;
   bfd_byte *location = list->data;
 
-  while (bytes_written < list->size)
+  while (octets_written < list->size)
     {
       bfd_vma address;
+      unsigned int octets_this_chunk = list->size - octets_written;
 
-      unsigned int bytes_this_chunk = list->size - bytes_written;
+      if (octets_this_chunk > CHUNK)
+	octets_this_chunk = CHUNK;
 
-      if (bytes_this_chunk > CHUNK)
-	{
-	  bytes_this_chunk = CHUNK;
-	}
-
-      address = list->where + bytes_written;
+      address = list->where + octets_written / bfd_octets_per_byte (abfd);
 
       if (! srec_write_record (abfd,
 			       tdata->type,
 			       address,
 			       location,
-			       location + bytes_this_chunk))
+			       location + octets_this_chunk))
 	return false;
 
-      bytes_written += bytes_this_chunk;
-      location += bytes_this_chunk;
+      octets_written += octets_this_chunk;
+      location += octets_this_chunk;
     }
 
   return true;
@@ -1139,8 +1136,8 @@
 /*ARGSUSED*/
 static int
 srec_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -1209,7 +1206,7 @@
 /*ARGSUSED*/
 static void
 srec_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -1219,7 +1216,7 @@
 /*ARGSUSED*/
 static void
 srec_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -1318,6 +1315,8 @@
   BFD_JUMP_TABLE_LINK (srec),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
 
@@ -1373,5 +1372,7 @@
   BFD_JUMP_TABLE_LINK (srec),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/stabs.c b/bfd/stabs.c
index ffc000d..e9ac167 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -1,5 +1,5 @@
 /* Stabs in sections linking support.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -230,6 +230,8 @@
       sinfo->strings = _bfd_stringtab_init ();
       if (sinfo->strings == NULL)
 	goto error_return;
+      /* Make sure the first byte is zero.  */
+      (void) _bfd_stringtab_add (sinfo->strings, "", true, true);
       if (! bfd_hash_table_init_n (&sinfo->includes.root,
 				   stab_link_includes_newfunc,
 				   251))
@@ -619,8 +621,8 @@
 
 bfd_vma
 _bfd_stab_section_offset (output_bfd, psinfo, stabsec, psecinfo, offset)
-     bfd *output_bfd;
-     PTR *psinfo;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     PTR *psinfo ATTRIBUTE_UNUSED;
      asection *stabsec;
      PTR *psecinfo;
      bfd_vma offset;
diff --git a/bfd/sunos.c b/bfd/sunos.c
index e34f878..ada6857 100644
--- a/bfd/sunos.c
+++ b/bfd/sunos.c
@@ -1,5 +1,5 @@
 /* BFD backend for SunOS binaries.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1257,7 +1257,7 @@
 /*ARGSUSED*/
 struct bfd_link_needed_list *
 bfd_sunos_get_needed_list (abfd, info)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
   if (info->hash->creator != &MY(vec))
@@ -1607,7 +1607,7 @@
 sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
      struct bfd_link_info *info;
      bfd *abfd;
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
      const struct reloc_std_external *relocs;
      bfd_size_type rel_size;
 {
@@ -1767,7 +1767,7 @@
 sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
      struct bfd_link_info *info;
      bfd *abfd;
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
      const struct reloc_ext_external *relocs;
      bfd_size_type rel_size;
 {
@@ -2173,8 +2173,8 @@
 /*ARGSUSED*/
 static boolean
 sunos_link_dynamic_object (info, abfd)
-     struct bfd_link_info *info;
-     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -2427,7 +2427,7 @@
      asection *input_section;
      struct aout_link_hash_entry *harg;
      PTR reloc;
-     bfd_byte *contents;
+     bfd_byte *contents ATTRIBUTE_UNUSED;
      boolean *skip;
      bfd_vma *relocationp;
 {
diff --git a/bfd/syms.c b/bfd/syms.c
index f69d1f2..6546f58 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, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -227,7 +227,7 @@
 .	   <<BSF_GLOBAL>> *}
 .
 .	{* The symbol is a debugging record. The value has an arbitary
-.	   meaning. *}
+.	   meaning, unless BSF_DEBUGGING_RELOC is also set.  *}
 .#define BSF_DEBUGGING	0x08
 .
 .	{* The symbol denotes a function entry point.  Used in ELF,
@@ -285,6 +285,11 @@
 .          others someday.  *}
 .#define BSF_OBJECT	   0x10000
 .
+.       {* 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
@@ -523,6 +528,11 @@
   {".sdata", 'g'},		/* Small initialized data.  */
   {".text", 't'},
   {"code", 't'},		/* MRI .text */
+  {".drectve", 'i'},            /* MSVC's .drective section */
+  {".idata", 'i'},              /* MSVC's .idata (import) section */
+  {".edata", 'e'},              /* MSVC's .edata (export) section */
+  {".pdata", 'p'},              /* MSVC's .pdata (stack unwind) section */
+  {".debug", 'N'},              /* MSVC's .debug (non-standard debug syms) */
   {0, 0}
 };
 
@@ -572,11 +582,30 @@
   if (bfd_is_com_section (symbol->section))
     return 'C';
   if (bfd_is_und_section (symbol->section))
-    return 'U';
+    {
+      if (symbol->flags & BSF_WEAK)
+	{
+	  /* If weak, determine if it's specifically an object
+	     or non-object weak.  */
+	  if (symbol->flags & BSF_OBJECT)
+	    return 'v';
+	  else
+	    return 'w';
+	}
+      else
+	return 'U';
+    }
   if (bfd_is_ind_section (symbol->section))
     return 'I';
   if (symbol->flags & BSF_WEAK)
-    return 'W';
+    {
+      /* If weak, determine if it's specifically an object
+	 or non-object weak.  */
+      if (symbol->flags & BSF_OBJECT)
+	return 'V';
+      else
+	return 'W';
+    }
   if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
     return '?';
 
@@ -602,6 +631,26 @@
 
 /*
 FUNCTION
+	bfd_is_undefined_symclass 
+
+DESCRIPTION
+	Returns non-zero if the class symbol returned by
+	bfd_decode_symclass represents an undefined symbol.
+	Returns zero otherwise.
+
+SYNOPSIS
+	boolean bfd_is_undefined_symclass (int symclass);
+*/
+
+boolean
+bfd_is_undefined_symclass (symclass)
+     int symclass;
+{
+  return symclass == 'U' || symclass == 'w' || symclass == 'v';
+}
+
+/*
+FUNCTION
 	bfd_symbol_info
 
 DESCRIPTION
@@ -619,10 +668,12 @@
      symbol_info *ret;
 {
   ret->type = bfd_decode_symclass (symbol);
-  if (ret->type != 'U')
-    ret->value = symbol->value + symbol->section->vma;
-  else
+  
+  if (bfd_is_undefined_symclass (ret->type))
     ret->value = 0;
+  else
+    ret->value = symbol->value + symbol->section->vma;
+  
   ret->name = symbol->name;
 }
 
@@ -698,10 +749,10 @@
 /*ARGSUSED*/
 asymbol *
 _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
-     bfd *abfd;
-     boolean dynamic;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean dynamic ATTRIBUTE_UNUSED;
      const PTR minisym;
-     asymbol *sym;
+     asymbol *sym ATTRIBUTE_UNUSED;
 {
   return *(asymbol **) minisym;
 }
@@ -796,7 +847,8 @@
 {
   struct stab_find_info *info;
   bfd_size_type stabsize, strsize;
-  bfd_byte *stab, *str, *last_stab;
+  bfd_byte *stab, *str;
+  bfd_byte *last_stab = NULL;
   bfd_size_type stroff;
   struct indexentry *indexentry;
   char *directory_name, *file_name;
@@ -1032,23 +1084,24 @@
 		  file_name = NULL;
 		  saw_fun = 1;
 		}
-	      else {
-		last_stab = stab;
-		if (stab + STABSIZE >= info->stabs + stabsize
-		    || *(stab + STABSIZE + TYPEOFF) != N_SO)
-		  {
-		    directory_name = NULL;
-		  }
-		else
-		  {
-		    /* Two consecutive N_SOs are a directory and a file
-		       name.  */
-		    stab += STABSIZE;
-		    directory_name = file_name;
-		    file_name = ((char *) str
-				 + bfd_get_32 (abfd, stab + STRDXOFF));
-		  }
-	      }
+	      else
+		{
+		  last_stab = stab;
+		  if (stab + STABSIZE >= info->stabs + stabsize
+		      || *(stab + STABSIZE + TYPEOFF) != N_SO)
+		    {
+		      directory_name = NULL;
+		    }
+		  else
+		    {
+		      /* Two consecutive N_SOs are a directory and a
+			 file name.  */
+		      stab += STABSIZE;
+		      directory_name = file_name;
+		      file_name = ((char *) str
+				   + bfd_get_32 (abfd, stab + STRDXOFF));
+		    }
+		}
 	      break;
 
 	    case N_SOL:
diff --git a/bfd/targets.c b/bfd/targets.c
index bb6e51d..1f2217b 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -1,5 +1,5 @@
 /* Generic target-file-type support for the BFD library.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -245,7 +245,8 @@
 
 .  boolean             (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
 
-The general target vector.
+The general target vector.  These vectors are initialized using the
+BFD_JUMP_TABLE macros.
 
 .
 .  {* Generic entry points.  *}
@@ -460,10 +461,21 @@
 .    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
 .
 
+A pointer to an alternative bfd_target in case the current one is not
+satisfactory.  This can happen when the target cpu supports both big
+and little endian code, and target chosen by the linker has the wrong
+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.  *}  
+. 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;
 
 */
@@ -482,6 +494,7 @@
 extern const bfd_target apollocoff_vec;
 extern const bfd_target armcoff_little_vec;
 extern const bfd_target armcoff_big_vec;
+extern const bfd_target armnetbsd_vec;
 extern const bfd_target armpe_little_vec;
 extern const bfd_target armpe_big_vec;
 extern const bfd_target armpei_little_vec;
@@ -493,6 +506,7 @@
 extern const bfd_target b_out_vec_big_host;
 extern const bfd_target b_out_vec_little_host;
 extern const bfd_target bfd_elf64_alpha_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;
 extern const bfd_target bfd_elf32_bigarm_oabi_vec;
@@ -505,8 +519,10 @@
 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_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;
@@ -515,6 +531,8 @@
 extern const bfd_target bfd_elf32_m88k_vec;
 extern const bfd_target bfd_elf32_mn10200_vec;
 extern const bfd_target bfd_elf32_mn10300_vec;
+extern const bfd_target bfd_elf32_pj_vec;
+extern const bfd_target bfd_elf32_pjl_vec;
 extern const bfd_target bfd_elf32_powerpc_vec;
 extern const bfd_target bfd_elf32_powerpcle_vec;
 extern const bfd_target bfd_elf32_sh_vec;
@@ -573,6 +591,8 @@
 extern const bfd_target m68k4knetbsd_vec;
 extern const bfd_target m88kbcs_vec;
 extern const bfd_target m88kmach3_vec;
+extern const bfd_target mipslpe_vec;
+extern const bfd_target mipslpei_vec;
 extern const bfd_target mcore_pe_big_vec;
 extern const bfd_target mcore_pe_little_vec;
 extern const bfd_target mcore_pei_big_vec;
@@ -593,6 +613,8 @@
 extern const bfd_target shlcoff_vec;
 extern const bfd_target shcoff_small_vec;
 extern const bfd_target shlcoff_small_vec;
+extern const bfd_target shlpe_vec;
+extern const bfd_target shlpei_vec;
 extern const bfd_target sparcle_aout_vec;
 extern const bfd_target sparclinux_vec;
 extern const bfd_target sparclynx_aout_vec;
@@ -624,7 +646,8 @@
 
 /* All of the xvecs for core files.  */
 extern const bfd_target aix386_core_vec;
-extern const bfd_target cisco_core_vec;
+extern const bfd_target cisco_core_big_vec;
+extern const bfd_target cisco_core_little_vec;
 extern const bfd_target hpux_core_vec;
 extern const bfd_target hppabsd_core_vec;
 extern const bfd_target irix_core_vec;
@@ -668,6 +691,7 @@
 #ifdef BFD64
 	&bfd_elf64_alpha_vec,
 #endif
+	&bfd_elf32_avr_vec,
 	&bfd_elf32_bigarc_vec,
         &bfd_elf32_bigarm_vec,
         &bfd_elf32_bigarm_oabi_vec,
@@ -677,9 +701,13 @@
 #endif
 	&bfd_elf32_d10v_vec,
 	&bfd_elf32_d30v_vec,
+#if 0
 	&bfd_elf32_hppa_vec,
+#endif
+	&bfd_elf32_i370_vec,
 	&bfd_elf32_i386_vec,
 	&bfd_elf32_i860_vec,
+	&bfd_elf32_i960_vec,
 	&bfd_elf32_little_generic_vec,
 	&bfd_elf32_littlearc_vec,
         &bfd_elf32_littlearm_vec,
@@ -694,6 +722,8 @@
 	&bfd_elf32_m68k_vec,
 	&bfd_elf32_m88k_vec,
 	&bfd_elf32_sparc_vec,
+	&bfd_elf32_pj_vec,
+	&bfd_elf32_pjl_vec,
 	&bfd_elf32_powerpc_vec,
 	&bfd_elf32_powerpcle_vec,
 	&bfd_elf32_v850_vec,
@@ -707,7 +737,7 @@
 #if 0
 	&bfd_elf64_sparc_vec,
 #endif
-	/* We don't include cisco_core_vec.  Although it has a magic number,
+	/* 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.  */
 #ifdef BFD64
@@ -762,6 +792,7 @@
 	&i386pei_vec,
 	&armcoff_little_vec,
 	&armcoff_big_vec,
+	&armnetbsd_vec,
 	&armpe_little_vec,
 	&armpe_big_vec,
 	&armpei_little_vec,
@@ -1077,3 +1108,32 @@
 
   return name_list;
 }
+
+/*
+FUNCTION
+	bfd_seach_for_target
+
+SYNOPSIS
+	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
+	transfer vectors maintained by BFD that produces a non-zero
+	result when passed to the function @var{search_func}.  The
+	parameter @var{data} is passed, unexamined, to the search
+	function.
+*/
+
+const bfd_target *
+bfd_search_for_target (search_func, data)
+     int (* search_func) PARAMS ((const bfd_target * target, void * data));
+     void * data;
+{
+  const bfd_target * const * target;
+
+  for (target = bfd_target_vector; * target != NULL; target ++)
+    if (search_func (* target, data))
+      return * target;
+
+  return NULL;
+}
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index c88fe2d..b1ffe75 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -1,5 +1,6 @@
 /* BFD backend for Extended Tektronix Hex Format  objects.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -599,7 +600,7 @@
      bfd *abfd;
      asection *section;
      PTR locationp;
-     file_ptr offset;
+     file_ptr offset ATTRIBUTE_UNUSED;
      bfd_size_type count;
      boolean get;
 {
@@ -928,8 +929,8 @@
 
 static int
 tekhex_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 
 {
   return 0;
@@ -951,7 +952,7 @@
 
 static void
 tekhex_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -960,7 +961,7 @@
 
 static void
 tekhex_print_symbol (ignore_abfd, filep, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR filep;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -1061,5 +1062,7 @@
   BFD_JUMP_TABLE_LINK (tekhex),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/trad-core.c b/bfd/trad-core.c
index 21d920b..633c53d 100644
--- a/bfd/trad-core.c
+++ b/bfd/trad-core.c
@@ -1,5 +1,5 @@
 /* BFD back end for traditional Unix core files (U-area and raw sections)
-   Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 1998
+   Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by John Gilmore of Cygnus Support.
 
@@ -105,22 +105,24 @@
 	bfd_set_error (bfd_error_system_call);
 	return 0;
       }
-    if (NBPG * (UPAGES + u.u_dsize
+    if ((unsigned long) (NBPG * (UPAGES + u.u_dsize
 #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
-		- u.u_tsize
+				 - u.u_tsize
 #endif
-		+ u.u_ssize) > statbuf.st_size)
+				 + u.u_ssize))
+	> (unsigned long) statbuf.st_size)
       {
 	bfd_set_error (bfd_error_file_truncated);
 	return 0;
       }
 #ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE
-    if (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
+    if ((unsigned long) (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
 #ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
 	/* Some systems write the file too big.  */
-	+ TRAD_CORE_EXTRA_SIZE_ALLOWED
+			 + TRAD_CORE_EXTRA_SIZE_ALLOWED
 #endif
-	< statbuf.st_size)
+			 )
+	< (unsigned long) statbuf.st_size)
       {
 	/* The file is too big.  Maybe it's not a core file
 	   or we otherwise have bad values for u_dsize and u_ssize).  */
@@ -200,7 +202,7 @@
      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. */
-  core_regsec (abfd)->vma = 0 - (bfd_vma) u.u_ar0;
+  core_regsec (abfd)->vma = - (bfd_vma) u.u_ar0;
 
   core_datasec (abfd)->filepos = NBPG * UPAGES;
   core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
@@ -239,7 +241,7 @@
 /* ARGSUSED */
 int
 trad_unix_core_file_failing_signal (ignore_abfd)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
 {
 #ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
   return TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd);
@@ -251,7 +253,8 @@
 /* ARGSUSED */
 boolean
 trad_unix_core_file_matches_executable_p  (core_bfd, exec_bfd)
-     bfd *core_bfd, *exec_bfd;
+     bfd *core_bfd ATTRIBUTE_UNUSED;
+     bfd *exec_bfd ATTRIBUTE_UNUSED;
 {
   return true;		/* FIXME, We have no way of telling at this point */
 }
@@ -312,5 +315,7 @@
        BFD_JUMP_TABLE_LINK (_bfd_nolink),
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+    NULL,
+    
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/versados.c b/bfd/versados.c
index 0dcd108..27f4f88 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -1,5 +1,5 @@
 /* BFD back-end for VERSAdos-E objects.
-   Copyright 1995, 96, 1997 Free Software Foundation, Inc.
+   Copyright 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    Versados is a Motorola trademark.
@@ -690,11 +690,11 @@
 
 static boolean
 versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
-     bfd *abfd;
-     sec_ptr section;
-     PTR location;
-     file_ptr offset;
-     bfd_size_type bytes_to_do;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     sec_ptr section ATTRIBUTE_UNUSED;
+     PTR location ATTRIBUTE_UNUSED;
+     file_ptr offset ATTRIBUTE_UNUSED;
+     bfd_size_type bytes_to_do ATTRIBUTE_UNUSED;
 {
   return false;
 }
@@ -703,8 +703,8 @@
 /*ARGSUSED */
 static int
 versados_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -756,7 +756,7 @@
 /*ARGSUSED */
 void
 versados_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -766,7 +766,7 @@
 /*ARGSUSED */
 void
 versados_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -788,7 +788,7 @@
 
 long
 versados_get_reloc_upper_bound (abfd, asect)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr asect;
 {
   return (asect->reloc_count + 1) * sizeof (arelent *);
@@ -919,5 +919,7 @@
   BFD_JUMP_TABLE_LINK (versados),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
+  NULL,
+  
   (PTR) 0
 };
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index 6a52462..ac3fe69 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -1,6 +1,6 @@
 /* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and
    EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997, 1998 Free Software Foundation Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation Inc.
 
    go and read the openVMS linker manual (esp. appendix B)
    if you don't know what's going on here :-)
@@ -282,7 +282,7 @@
   vms_symbol_entry *entry;
   unsigned long base_addr;
   unsigned long align_addr;
-  static int psect_idx = 0;
+  static unsigned int psect_idx = 0;
 
 #if VMS_DEBUG
   vms_debug (2, "GSD/EGSD (%d/%x)\n", objtype, objtype);
@@ -354,7 +354,8 @@
 	      section = bfd_make_section (abfd, name);
 	      if (!section)
 		{
-		  fprintf (stderr, "bfd_make_section (%s) failed\n", name);
+		  (*_bfd_error_handler) (_("bfd_make_section (%s) failed"),
+					 name);
 		  return -1;
 		}
 	      old_flags = bfd_getl16 (vms_rec + 2);
@@ -366,7 +367,9 @@
 		new_flags |= SEC_IS_COMMON;
 	      if (!bfd_set_section_flags (abfd, section, new_flags))
 		{
-		  fprintf (stderr, "bfd_set_section_flags (%s, %x) failed\n", name, new_flags);
+		  (*_bfd_error_handler)
+		    (_("bfd_set_section_flags (%s, %x) failed"),
+		     name, new_flags);
 		  return -1;
 		}
 	      section->alignment_power = vms_rec[1];
@@ -400,7 +403,12 @@
 		  section->contents = old_section->contents;
 		  if (section->_raw_size < old_section->_raw_size)
 		    {
-		      fprintf (stderr, "Size mismatch section %s=%d, %s=%d\n", old_section->name, old_section->_raw_size, section->name, section->_raw_size);
+		      (*_bfd_error_handler)
+			(_("Size mismatch section %s=%lx, %s=%lx"),
+			 old_section->name,
+			 (unsigned long) old_section->_raw_size,
+			 section->name,
+			 (unsigned long) section->_raw_size);
 		      return -1;
 		    }
 		  else if (section->_raw_size > old_section->_raw_size)
@@ -716,16 +724,15 @@
 int
 _bfd_vms_write_gsd (abfd, objtype)
      bfd *abfd;
-     int objtype;
+     int objtype ATTRIBUTE_UNUSED;
 {
   asection *section;
   asymbol *symbol;
-  int symnum;
+  unsigned int symnum;
   int last_index = -1;
   char dummy_name[10];
   char *sname;
   flagword new_flags, old_flags;
-  char *nptr, *uptr;
 
 #if VMS_DEBUG
   vms_debug (2, "vms_write_gsd (%p, %d)\n", abfd, objtype);
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index 01d20aa..3b36b32 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -1,6 +1,6 @@
 /* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and
    EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    HDR record handling functions
    EMH record handling functions
@@ -249,7 +249,7 @@
      int objtype;
 {
   asymbol *symbol;
-  int symnum;
+  unsigned int symnum;
   int had_case = 0;
   int had_file = 0;
 
@@ -334,8 +334,6 @@
 
       if (symbol->flags & BSF_FILE)
 	{
-	  char *s;
-
 	  if (strncmp ((char *)symbol->name, "<CASE:", 6) == 0)
 	    {
 	      PRIV(flag_hash_long_names) = symbol->name[6] - '0';
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index a5fdae4..311192c 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -1,6 +1,6 @@
 /* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and
    EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    Written by Klaus K"ampf (kkaempf@rmi.de)
 
@@ -198,11 +198,12 @@
 	  bfd_set_error (bfd_error_no_memory);
 	  return (struct bfd_hash_entry *)NULL;
 	}
+      entry = (struct bfd_hash_entry *) ret;
     }
 
   /* Call the allocation method of the base class.  */
 
-  ret = (vms_symbol_entry *) bfd_hash_newfunc ((struct bfd_hash_entry *)ret, table, string);
+  ret = (vms_symbol_entry *) bfd_hash_newfunc (entry, table, string);
 #if VMS_DEBUG
   vms_debug (6, "_bfd_vms_hash_newfunc ret %p\n", ret);
 #endif
@@ -219,7 +220,7 @@
 
 void
 _bfd_vms_get_header_values (abfd, buf, type, length)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      unsigned char *buf;
      int *type;
      int *length;
@@ -343,7 +344,8 @@
   /* read the record header on Alpha.  */
 
   if ((test_len != 0)
-      && (bfd_read (PRIV(vms_buf), 1, test_len, abfd) != test_len))
+      && (bfd_read (PRIV(vms_buf), 1, test_len, abfd)
+	  != (bfd_size_type) test_len))
     {
       bfd_set_error (bfd_error_file_truncated);
       return 0;
@@ -418,7 +420,8 @@
 #if VMS_DEBUG
       vms_debug (10, "bfd_read remaining %d\n", remaining);
 #endif
-      if (bfd_read (vms_buf + test_len, 1, remaining, abfd) != remaining)
+      if (bfd_read (vms_buf + test_len, 1, remaining, abfd) !=
+	  (bfd_size_type) remaining)
 	{
 	  bfd_set_error (bfd_error_file_truncated);
 	  return 0;
@@ -1007,10 +1010,8 @@
      const char *in;
      int maxlen;
 {
-  long int init;
   long int result;
   int in_len;
-  char *pnt = 0;
   char *new_name;
   const char *old_name;
   int i;
@@ -1054,7 +1055,7 @@
 
   if ((in_len > maxlen)
       && PRIV(flag_hash_long_names))
-    sprintf (out, "_%08x", result);
+    sprintf (out, "_%08lx", result);
   else
     *out = 0;
 
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index 782f52b..124b1b3 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -1,6 +1,6 @@
 /* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and
    EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    TIR record handling functions
    ETIR record handling functions
@@ -61,7 +61,7 @@
   int offset;
 
   offset = PRIV(image_ptr) - PRIV(image_section)->contents;
-  if ((offset + size) > PRIV(image_section)->_raw_size)
+  if ((bfd_size_type) (offset + size) > PRIV(image_section)->_raw_size)
     {
       PRIV(image_section)->contents = bfd_realloc (PRIV(image_section)->contents, offset + size);
       if (PRIV(image_section)->contents == 0)
@@ -121,7 +121,7 @@
     bfd *abfd;
     unsigned char *ptr;
     int size;
-    int offset;
+    int offset ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size, PRIV(image_ptr));
@@ -301,7 +301,7 @@
       case ETIR_S_C_STA_PQ:
   	{
 	  uquad dummy;
-	  int psect;
+	  unsigned int psect;
 
 	  psect = bfd_getl32 (ptr);
 	  if (psect >= PRIV(section_count))
@@ -559,7 +559,7 @@
 etir_opr (abfd, cmd, ptr)
      bfd *abfd;
      int cmd;
-     unsigned char *ptr;
+     unsigned char *ptr ATTRIBUTE_UNUSED;
 {
   long op1, op2;
 
@@ -791,7 +791,7 @@
 etir_stc (abfd, cmd, ptr)
      bfd *abfd;
      int cmd;
-     unsigned char *ptr;
+     unsigned char *ptr ATTRIBUTE_UNUSED;
 {
 
 #if VMS_DEBUG
@@ -907,7 +907,7 @@
 
 static asection *
 new_section (abfd, idx)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      int idx;
 {
   asection *section;
@@ -947,10 +947,8 @@
 static int
 alloc_section (abfd, idx)
      bfd *abfd;
-     int idx;
+     unsigned int idx;
 {
-  asection *section;
-
 #if VMS_DEBUG
   _bfd_vms_debug (4,  "alloc_section %d\n", idx);
 #endif
@@ -1060,7 +1058,7 @@
 	 */
   	{
 	  unsigned long dummy;
-	  int psect;
+	  unsigned int psect;
 
 	  if (cmd == TIR_S_C_STA_PB)
 	    psect = *ptr++;
@@ -1092,7 +1090,7 @@
 	 */
   	{
 	  unsigned long dummy;
-	  int psect;
+	  unsigned int psect;
 
 	  if (cmd == TIR_S_C_STA_PW)
 	    psect = *ptr++;
@@ -1124,7 +1122,7 @@
 	 */
   	{
 	  unsigned long dummy;
-	  int psect;
+	  unsigned int psect;
 
 	  if (cmd == TIR_S_C_STA_PL)
 	    psect = *ptr++;
@@ -1672,7 +1670,7 @@
  */
 {
   unsigned long dummy;
-  int psect;
+  unsigned int psect;
 
 #if VMS_DEBUG
   _bfd_vms_debug (5, "tir_ctl %d\n", *ptr);
@@ -1942,7 +1940,7 @@
 int
 _bfd_vms_slurp_dbg (abfd, objtype)
      bfd *abfd;
-     int objtype;
+     int objtype ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (2, "DBG/EDBG\n");
@@ -1960,8 +1958,8 @@
 
 int
 _bfd_vms_slurp_tbt (abfd, objtype)
-     bfd *abfd;
-     int objtype;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     int objtype ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (2, "TBT/ETBT\n");
@@ -1978,8 +1976,8 @@
 
 int
 _bfd_vms_slurp_lnk (abfd, objtype)
-     bfd *abfd;
-     int objtype;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     int objtype ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (2, "LNK\n");
@@ -2094,7 +2092,7 @@
 int
 _bfd_vms_write_tir (abfd, objtype)
      bfd *abfd;
-     int objtype;
+     int objtype ATTRIBUTE_UNUSED;
 {
   asection *section;
   vms_section *sptr;
@@ -2177,10 +2175,10 @@
 		  for (;;)
 		    {
 		      bfd_size_type addr = (*rptr)->address;
-		      int len = bfd_get_reloc_size ((*rptr)->howto);
+		      bfd_size_type len = bfd_get_reloc_size ((*rptr)->howto);
 		      if (sptr->offset < addr)		/* sptr starts before reloc */
 			{
-			  int before = addr - sptr->offset;
+			  bfd_size_type before = addr - sptr->offset;
 			  if (sptr->size <= before)		/* complete before */
 			    {
 			      sto_imm (abfd, sptr, vaddr, section->index);
@@ -2463,8 +2461,8 @@
 
 int
 _bfd_vms_write_tbt (abfd, objtype)
-     bfd *abfd;
-     int objtype;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     int objtype ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (2, "vms_write_tbt (%p, %d)\n", abfd, objtype);
@@ -2478,8 +2476,8 @@
 
 int
 _bfd_vms_write_dbg (abfd, objtype)
-     bfd *abfd;
-     int objtype;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     int objtype ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   _bfd_vms_debug (2, "vms_write_dbg (%p, objtype)\n", abfd, objtype);
diff --git a/bfd/vms.c b/bfd/vms.c
index a5fc13a..f0ea63f 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -1,6 +1,6 @@
 /* vms.c -- BFD back-end for VAX (openVMS/VAX) and
    EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    Written by Klaus K"ampf (kkaempf@rmi.de)
 
@@ -26,7 +26,7 @@
 #include "vms.h"
 
 static boolean vms_initialize PARAMS ((bfd *));
-static int priv_section_count;
+static unsigned int priv_section_count;
 static boolean fill_section_ptr PARAMS ((struct bfd_hash_entry *, PTR));
 static boolean vms_fixup_sections PARAMS ((bfd *));
 static boolean copy_symbols PARAMS ((struct bfd_hash_entry *, PTR));
@@ -132,11 +132,10 @@
 
 const bfd_target vms_alpha_vec =
 {
-
   "vms-alpha",			/* name */
   bfd_target_evax_flavour,
-  false,			/* data byte order is little */
-  false,			/* header byte order is little */
+  BFD_ENDIAN_LITTLE,		/* data byte order is little */
+  BFD_ENDIAN_LITTLE,		/* header byte order is little */
 
   (HAS_RELOC | HAS_SYMS
    | WP_TEXT | D_PAGED),	/* object flags */
@@ -170,16 +169,17 @@
   BFD_JUMP_TABLE_LINK (vms),
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
+  NULL,
+  
   (PTR) 0
 };
 
 const bfd_target vms_vax_vec =
 {
-
   "vms-vax",			/* name */
   bfd_target_ovax_flavour,
-  false,			/* data byte order is little */
-  false,			/* header byte order is little */
+  BFD_ENDIAN_LITTLE,		/* data byte order is little */
+  BFD_ENDIAN_LITTLE,		/* header byte order is little */
 
   (HAS_RELOC | HAS_SYMS 	/* object flags */
    | WP_TEXT | D_PAGED
@@ -215,6 +215,8 @@
   BFD_JUMP_TABLE_LINK (vms),
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
+  NULL,
+  
   (PTR) 0
 };
 
@@ -331,7 +333,7 @@
 
   /* fill forward references (these contain section number, not section ptr).  */
 
-  if ((int)sec < priv_section_count)
+  if ((unsigned int) sec < priv_section_count)
     {
       sec = ((vms_symbol_entry *)entry)->symbol->section =
 	((asection **)sections)[(int)sec];
@@ -357,8 +359,6 @@
 vms_fixup_sections (abfd)
      bfd *abfd;
 {
-  asection *s;
-
   if (PRIV(fixup_done))
     return true;
 
@@ -538,7 +538,7 @@
 
 static const struct bfd_target *
 vms_archive_p (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_archive_p(%p)\n", abfd);
@@ -646,7 +646,6 @@
 {
   asection *sec;
   vms_section *es, *es1;
-  vms_reloc *er, *er1;
   int i;
 
 #if VMS_DEBUG
@@ -722,7 +721,7 @@
 /* Ask the BFD to free all cached information.  */
 static boolean
 vms_bfd_free_cached_info (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd);
@@ -769,11 +768,11 @@
 
 static boolean
 vms_get_section_contents (abfd, section, buf, offset, buf_size)
-     bfd *abfd;
-     asection *section;
-     PTR buf;
-     file_ptr offset;
-     bfd_size_type buf_size;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     PTR buf ATTRIBUTE_UNUSED;
+     file_ptr offset ATTRIBUTE_UNUSED;
+     bfd_size_type buf_size ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n",
@@ -791,11 +790,11 @@
 
 static boolean
 vms_get_section_contents_in_window (abfd, section, w, offset, count)
-     bfd *abfd;
-     asection *section;
-     bfd_window *w;
-     file_ptr offset;
-     bfd_size_type count;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     bfd_window *w ATTRIBUTE_UNUSED;
+     file_ptr offset ATTRIBUTE_UNUSED;
+     bfd_size_type count ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n",
@@ -814,8 +813,8 @@
 
 static boolean
 vms_bfd_copy_private_bfd_data (src, dest)
-     bfd *src;
-     bfd *dest;
+     bfd *src ATTRIBUTE_UNUSED;
+     bfd *dest ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest);
@@ -833,8 +832,8 @@
 
 static boolean
 vms_bfd_merge_private_bfd_data (ibfd, obfd)
-     bfd *ibfd;
-     bfd *obfd;
+     bfd *ibfd ATTRIBUTE_UNUSED;
+     bfd *obfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd);
@@ -852,8 +851,8 @@
 
 static boolean
 vms_bfd_set_private_flags (abfd, flags)
-     bfd *abfd;
-     flagword flags;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     flagword flags ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags);
@@ -867,10 +866,10 @@
 
 static boolean
 vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
-     bfd *srcbfd;
-     asection *srcsec;
-     bfd *dstbfd;
-     asection *dstsec;
+     bfd *srcbfd ATTRIBUTE_UNUSED;
+     asection *srcsec ATTRIBUTE_UNUSED;
+     bfd *dstbfd ATTRIBUTE_UNUSED;
+     asection *dstsec ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n",
@@ -884,10 +883,10 @@
 
 static boolean 
 vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
-     bfd *ibfd;
-     asymbol *isym;
-     bfd *obfd;
-     asymbol *osym;
+     bfd *ibfd ATTRIBUTE_UNUSED;
+     asymbol *isym ATTRIBUTE_UNUSED;
+     bfd *obfd ATTRIBUTE_UNUSED;
+     asymbol *osym ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n",
@@ -903,7 +902,7 @@
 
 static char *
 vms_core_file_failing_command (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd);
@@ -917,7 +916,7 @@
 
 static int
 vms_core_file_failing_signal (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd);
@@ -931,8 +930,8 @@
 
 static boolean
 vms_core_file_matches_executable_p (abfd, bbfd)
-     bfd *abfd;
-     bfd *bbfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd *bbfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd);
@@ -947,7 +946,7 @@
 
 static boolean
 vms_slurp_armap (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_slurp_armap(%p)\n", abfd);
@@ -961,7 +960,7 @@
 
 static boolean
 vms_slurp_extended_name_table (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd);
@@ -975,10 +974,10 @@
 
 static boolean
 vms_construct_extended_name_table (abfd, tabloc, tablen, name)
-     bfd *abfd;
-     char **tabloc;
-     bfd_size_type *tablen;
-     const char **name;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     char **tabloc ATTRIBUTE_UNUSED;
+     bfd_size_type *tablen ATTRIBUTE_UNUSED;
+     const char **name ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd);
@@ -991,9 +990,9 @@
 
 static void
 vms_truncate_arname (abfd, pathname, arhdr)
-     bfd *abfd;
-     CONST char *pathname;
-     char *arhdr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     CONST char *pathname ATTRIBUTE_UNUSED;
+     char *arhdr ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr);
@@ -1006,11 +1005,11 @@
 
 static boolean
 vms_write_armap (arch, elength, map, orl_count, stridx)
-     bfd *arch;
-     unsigned int elength;
-     struct orl *map;
-     unsigned int orl_count;
-     int stridx;
+     bfd *arch ATTRIBUTE_UNUSED;
+     unsigned int elength ATTRIBUTE_UNUSED;
+     struct orl *map ATTRIBUTE_UNUSED;
+     unsigned int orl_count ATTRIBUTE_UNUSED;
+     int stridx ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n",
@@ -1023,7 +1022,7 @@
 
 static PTR
 vms_read_ar_hdr (abfd)
-    bfd * abfd;
+    bfd * abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd);
@@ -1040,8 +1039,8 @@
 
 static bfd *
 vms_openr_next_archived_file (arch, prev)
-     bfd *arch;
-     bfd *prev;
+     bfd *arch ATTRIBUTE_UNUSED;
+     bfd *prev ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev);
@@ -1084,7 +1083,7 @@
 
 static boolean
 vms_update_armap_timestamp (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd);
@@ -1193,7 +1192,7 @@
 
 static void
 vms_print_symbol (abfd, file, symbol, how)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR file;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -1241,7 +1240,7 @@
 
 static void
 vms_get_symbol_info (abfd, symbol, ret)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -1288,7 +1287,7 @@
 
 static boolean
 vms_bfd_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
 #if VMS_DEBUG
@@ -1302,8 +1301,8 @@
 
 static alent *
 vms_get_lineno (abfd, symbol)
-     bfd *abfd;
-     asymbol *symbol;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asymbol *symbol ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol);
@@ -1318,13 +1317,13 @@
 
 static boolean
 vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
-     bfd *abfd;
-     asection *section;
-     asymbol **symbols;
-     bfd_vma offset;
-     CONST char **file;
-     CONST char **func;
-     unsigned int *line;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     CONST char **file ATTRIBUTE_UNUSED;
+     CONST char **func ATTRIBUTE_UNUSED;
+     unsigned int *line ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
@@ -1340,9 +1339,9 @@
 
 static asymbol *
 vms_bfd_make_debug_symbol (abfd, ptr, size)
-     bfd *abfd;
-     void *ptr;
-     unsigned long size;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     void *ptr ATTRIBUTE_UNUSED;
+     unsigned long size ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size);
@@ -1393,8 +1392,8 @@
 
 static long
 vms_get_reloc_upper_bound (abfd, section)
-     bfd *abfd;
-     asection *section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name);
@@ -1411,10 +1410,10 @@
 
 static long
 vms_canonicalize_reloc (abfd, section, location, symbols)
-     bfd *abfd;
-     asection *section;
-     arelent **location;
-     asymbol **symbols;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     arelent **location ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name);
@@ -1429,13 +1428,13 @@
 
 static bfd_reloc_status_type
 reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
-     bfd *abfd;
-     arelent *reloc;
-     asymbol *sym;
-     PTR data;
-     asection *sec;
-     bfd *output_bfd;
-     char **error_message;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc ATTRIBUTE_UNUSED;
+     asymbol *sym ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     char **error_message ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd);
@@ -1679,7 +1678,7 @@
 
 static const struct reloc_howto_struct *
 vms_bfd_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   int alpha_type;
@@ -1721,8 +1720,8 @@
 static boolean
 vms_set_arch_mach (abfd, arch, mach)
      bfd *abfd;
-     enum bfd_architecture arch;
-     unsigned long mach;
+     enum bfd_architecture arch ATTRIBUTE_UNUSED;
+     unsigned long mach ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach);
@@ -1765,8 +1764,8 @@
 
 static int
 vms_sizeof_headers (abfd, reloc)
-     bfd *abfd;
-     boolean reloc;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean reloc ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False");
@@ -1781,12 +1780,12 @@
 static bfd_byte *
 vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
 					 relocateable, symbols)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
-     struct bfd_link_order *link_order;
-     bfd_byte *data;
-     boolean relocateable;
-     asymbol **symbols;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+     struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
+     bfd_byte *data ATTRIBUTE_UNUSED;
+     boolean relocateable ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n",
@@ -1800,10 +1799,10 @@
 
 static boolean
 vms_bfd_relax_section (abfd, section, link_info, again)
-     bfd *abfd;
-     asection *section;
-     struct bfd_link_info *link_info;
-     boolean *again;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+     boolean *again ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n",
@@ -1814,8 +1813,8 @@
 
 static boolean
 vms_bfd_gc_sections (abfd, link_info)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info);
@@ -1829,7 +1828,7 @@
 
 static struct bfd_link_hash_table *
 vms_bfd_link_hash_table_create (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd);
@@ -1842,8 +1841,8 @@
 
 static boolean
 vms_bfd_link_add_symbols (abfd, link_info)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info);
@@ -1857,8 +1856,8 @@
 
 static boolean
 vms_bfd_final_link (abfd, link_info)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info);
@@ -1870,8 +1869,8 @@
 
 static boolean
 vms_bfd_link_split_section (abfd, section)
-     bfd *abfd;
-     asection *section;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name);
@@ -1885,7 +1884,7 @@
 
 static long
 vms_get_dynamic_symtab_upper_bound (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd);
@@ -1895,8 +1894,8 @@
 
 static boolean
 vms_bfd_print_private_bfd_data (abfd, file)
-    bfd *abfd;
-    void *file;
+    bfd *abfd ATTRIBUTE_UNUSED;
+    void *file ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd);
@@ -1909,8 +1908,8 @@
 
 static long
 vms_canonicalize_dynamic_symtab (abfd, symbols)
-     bfd *abfd;
-     asymbol **symbols;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd);
@@ -1923,7 +1922,7 @@
 
 static long
 vms_get_dynamic_reloc_upper_bound (abfd)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd);
@@ -1936,9 +1935,9 @@
 
 static long
 vms_canonicalize_dynamic_reloc (abfd, arel, symbols)
-     bfd *abfd;
-     arelent **arel;
-     asymbol **symbols;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent **arel ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
 #if VMS_DEBUG
   vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd);
diff --git a/bfd/vms.h b/bfd/vms.h
index d6bdd02..7143986 100644
--- a/bfd/vms.h
+++ b/bfd/vms.h
@@ -1,6 +1,6 @@
 #undef vms
 /* vms.h -- Header file for VMS (Alpha and Vax) support.
-   Copyright 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
    Written by Klaus K"ampf (kkaempf@rmi.de)
 
@@ -583,7 +583,7 @@
 
   struct hdr_struc hdr_data;		/* data from HDR/EMH record  */
   struct eom_struc eom_data;		/* data from EOM/EEOM record  */
-  int section_count;			/* # of sections in following array  */
+  unsigned int section_count;		/* # of sections in following array  */
   asection **sections;			/* array of GSD/EGSD sections  */
   int gsd_sym_count;			/* # of GSD/EGSD symbols  */
   asymbol **symbols;			/* vector of GSD/EGSD symbols  */
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index c882d23..3f488d7 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -1,5 +1,5 @@
 /* POWER/PowerPC XCOFF linker support.
-   Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -3061,7 +3061,7 @@
      bfd *output_bfd;
      struct bfd_link_info *info;
      struct bfd_link_hash_entry *harg;
-     boolean syscall;
+     boolean syscall ATTRIBUTE_UNUSED;
 {
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
 
@@ -3272,10 +3272,15 @@
   xcoff_hash_table (info)->file_align = file_align;
   xcoff_hash_table (info)->textro = textro;
 
-  hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
-				   false, false, true);
-  if (hentry != NULL)
-    hentry->flags |= XCOFF_ENTRY;
+  if (entry == NULL)
+    hentry = NULL;
+  else
+    {
+      hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
+				       false, false, true);
+      if (hentry != NULL)
+	hentry->flags |= XCOFF_ENTRY;
+    }
 
   /* Garbage collect unused sections.  */
   if (info->relocateable
@@ -6416,7 +6421,7 @@
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
 		     (info, h->root.root.string, input_bfd, input_section,
-		      rel->r_vaddr - input_section->vma)))
+		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 
 	      /* Don't try to process the reloc.  It can't help, and
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b8a3d27..f89a4e8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,894 @@
+2000-03-31  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+	* readelf.c: Include sys/types.h before sys/stat.h for ultrix.
+
+2000-03-27  Nick Clifton  <nickc@cygnus.com>
+
+	* rddbg.c (read_section_stabs_debugging_info): Catch out of range
+	string offsets in corrupt stabs entries.
+
+2000-03-27  Alan Modra  <alan@linuxcare.com>
+
+	* readelf.c: Include elf/avr.h
+	(dump_relocations): Add EM_AVR case.
+
+2000-03-09  Tim Waugh  <twaugh@redhat.com>
+
+	* strings.1: Correct '-bytes' to '--bytes'.
+
+2000-03-08  H.J. Lu  <hjl@gnu.org>
+
+	* Makefile.am (install-exec-local): Depend on
+	install-binPROGRAMS for parallel make.
+	* Makefile.in: Regenerated.
+
+2000-02-27  Ian Lance Taylor  <ian@zembu.com>
+
+	From Brad Lucier <lucier@math.purdue.edu>:
+	* readelf.c (process_dynamic_segment): Add cast to make sure
+	argument to %* is int.
+
+2000-02-25  H.J. Lu  <hjl@gnu.org>
+
+	* configure.in (AC_SEARCH_LIBS): Pass m, not -lm.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* configure.in: Add arm-wince, mips-pe and sh-pe targets.
+	* configure: Regenerate.
+
+	* dlltoolc.: Add support for sh-pe and mips-pe targets.
+	* rescoff.c: Add support for sh-pe and mips-pe targets.
+
+2000-02-23  H.J. Lu  <hjl@gnu.org>
+
+	* readelf.c (get_osabi_name): Handle ELFOSABI_LINUX.
+
+2000-02-22  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (process_symbol_table): Remove use of ELF_ST_OTHER.
+
+2000-02-22  Ian Lance Taylor  <ian@zembu.com>
+
+	From Brad Lucier <lucier@math.purdue.edu>:
+	* readelf.c (process_version_sections): Add casts to make sure
+	argument to %* is an int.
+	(process_mips_specific): Add casts to make printf arguments match
+	format.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* objdump.c (dump_section_header): Change `opb' to unsigned.
+	(find_symbol_for_address): Same here.
+	(disassemble_data): And here.  Change `addr_offset',
+	`stop_offset', `nextstop_offset' to unsigned long.
+	(dump_data): Change opb to unsigned.
+
+2000-02-18  Frank Ch. Eigler  <fche@redhat.com>
+
+	* resrc.c: Remove unmatched #if for cygwin.
+
+2000-02-14  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* binutils.texi: Document the change of flavor name from atpcs-special
+	to special-atpcs to prevent name conflict in gdb.
+
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+	* objdump.c (show_line): Fix bug preventing printing of the very
+	first line (line zero) of a file when interlisting source and
+	assembly.  Added option to print entire context from start of file
+	when the first line from that file is encountered.
+
+2000-02-03  Timothy Wall <twall@redhat.com>
+
+	* binutils/objdump.c (dump_section_header, find_symbol_for_address,
+	show_line, disassemble_bytes, disassemble_data, dump_data):
+	distinguish between octets and bytes.
+	
+2000-01-27  Thomas de Lellis  <tdel@windriver.com>
+
+        * nm.c (print_symbol_info_bsd): Use bfd_is_undefined_symclass to
+	check to unresolved symbols.
+        (print_symbol_info_sysv):  Ditto.
+        (print_symbol_info_posix):  Ditto.
+
+        * binutils.texi: Document new 'V' symclass flag for nm.
+
+2000-01-27  Nick Clifton  <nickc@redhat.com>
+
+	* binutils.texi (objdump): Document new ARM specific
+	disassembler options.
+
+	* objdump.c (usage): Call disassembler_usage().
+
+2000-01-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* readelf.c (get_dynamic_flags): Return buff.
+	(process_dynamic_segment): Don't pass error strings to printf
+	as format arg.
+	(read_and_display_attr): Use lx and ld to print longs.
+	(process_corefile_note_segment): Cast bfd_vma to unsigned long
+	before printing.
+	Update copyright.
+
+2000-01-17  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_osabi_name): Recognise ELFOSABI_ARM.
+
+2000-01-15  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* debug.c (debug_name_type): Return DEBUG_TYPE_NULL rather than
+	false.
+	(debug_tag_type): Here too.
+	* ieee.c (ieee_builtin_type): And here.
+	* stabs.c (parse_stab_type, parse_stab_array_type): And here.
+
+2000-01-13  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_machine_name): Change EM_S370 to return "IBM
+	System/370".
+
+2000-01-11  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_dynamic_type): Remove DT_ENCODING.
+
+2000-01-10  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_note_type): Display NT_WIN32PSTATUS notes.
+
+2000-01-07  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* windres.c (long_options): Add --use-temp-file and 
+	--no-use-temp-file options.
+	(usage): Document.
+	(main): Handle.
+	
+	* windres.h: Update read_rc_file prototype.
+	
+	* resrc.c (cpp_temp_file): New static variable.
+	(istream_type): New static variable.
+	(close_pipe): Delete function.
+	(run_cmd): New static function.
+	(open_input_stream): New static function.
+	(close_input_stream): New static function.
+	(look_for_default): Handle DOS directory separator. Use 
+	open_input_stream instead of popen.
+	(read_rc_file): Likewise.
+	
+	* binutils.texi: Document --use-temp-file, --no-use-temp-file
+	options. 
+
+2000-01-04  Mumit Khan  <khan@xraylith.wisc.edu>
+ 
+	* dlltool.c (create_compat_implib): New variable.
+	(gen_exp_file): Use.
+	(make_one_lib_file): Use.
+	(long_options): Add --compat-implib option.
+	(usage): Handle.
+	(main): Handle.
+
+	* dllwrap.c (enum target_type): Rename MINGW32_TARGET to MINGW_TARGET.
+	(main): Use. Don't look for "32" in cygwin and mingw target names.
+
+2000-01-03  Nick Clifton  <nickc@cygnus.com>
+
+	* binutils.texi: Document new, ARM specific disassembler
+          command line switch "-M force-thumb".
+
+1999-12-28  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c: Update with new constants added by Oct 4, 1999
+	ELF ABI draft.
+	(guess_is_rela): Add new machine codes, but leave
+	rel type undetermined.
+	(get_machine_name): Add new machine codes.
+	(get_section_type_name): Add new section types.
+	(get_elf_section_flags): New funciton: Decode section flags.
+	(process_section_headers): Call get_elf_section_flags() in
+	order to decode flags in section header.
+	(get_dynamic_flags): New function: Decode dynamic section
+	flags.
+	(process_dynamic_section): Display flags (if present).
+	(get_symbol_type): Add STT_COMMON.
+	(get_symbol_visibility): New function: Decode a symbol's
+	visibility.
+	(process_symbol_table): Call get_symbol_visibility().
+	(get_note_type): Add NT_PRXFPREGS.
+
+1999-12-26  Ian Lance Taylor  <ian@zembu.com>
+
+	* strings.c (main): Correct handling of numeric argument.
+
+1999-12-23  Andrew Haley  <aph@cygnus.com>
+
+	* dlltool.c (mtable): mcore how_jtab_roff is 4 bytes into the
+	jtab; was 8.
+
+1999-12-17  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (mtable): Stop compile time warnings about missing
+	initialisers.
+	(yyerror): Stop compile time warnings about unused paramater.
+	(INIT_SEC_DATA): New macro: initialise an entry in the secdata
+	array.
+	(secdata): Stop ccompile time warnings about uninitialised
+	fields.
+	(dtab): Stop compile time warnings about unused parameter.
+	(long_options): Stop compile time warning about missing
+	initialiser. 
+
+1999-12-10  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (print_vma): Support native 64bit ELF systems.
+
+1999-12-09  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (mtable): Add epoc-arm specific entry.
+	Make default arm entry pass -mpacs-26 to assembler.
+	(flush_page): Do not mangle null entries.
+	
+1999-12-07  H . J . Lu  hjl@valinux.com
+
+	* readelf.c: Fix compile time warnings.  Support more than 999
+	symbols.
+
+1999-12-03  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (enum print_mode): New type.
+	(print_vma): New function.
+	(dump_relocations): Use print_vma to display bfd_vma values.
+	(process_file_header): Use print_vma to display bfd_vma values.
+	(process_program_headers): Use print_vma to display bfd_vma values.
+	(process_section_headers): Use print_vma to display bfd_vma values.
+	(dynamic_segment_parisc_val): Use print_vma to display bfd_vma values.
+	(process_dynamic_segment): Use print_vma to display bfd_vma values.
+	(process_symbol_table): Use print_vma to display bfd_vma values.
+	(process_mips_specific): Use print_vma to display bfd_vma values.
+
+1999-11-25  Fred Fish  <fnf@cygnus.com>
+
+	* readelf.c (process_note): Change arg from Elf_External_Note
+	to Elf32_Internal_Note, which also turns the function body
+	into little more than a call to printf.
+	(process_corefile_note_segment):  Substantially rewritten
+	to properly handle case where target and host are different
+	endianness, handle note sections with padding, and add some
+	cruft to handle notes with unterminated name data.
+
+1999-11-22  Nick Clifton  <nickc@cygnus.com>
+
+	* objcopy.c (copy_usage): Reformat.
+	(strip_usage): Reformat.
+
+1999-11-21  Nick Clifton  <nickc@cygnus.com>
+
+	* objdump.c (usage): Overhaul output:  One line per switch.
+	Textual description of each switch.  Distinguish between
+	optional switches and required switches.
+	(long_options): Add 'g', 'G' and 'z' short options.
+	(main): Distinguish between optional switches and required
+	switches.
+
+	* binutils.texi: Add -g -G and -z short options for
+	--debugging, --stabs and --disassemble-zeroes.
+
+1999-11-03  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (flush_page): Clip short values to prevent warnings
+	from the assembler.
+	Change default mcore machine name to 'mcore-le' and rename
+	big-endian version to 'mcore-be'. 
+
+1999-10-27  Fred Fish  <fnf@cygnus.com>
+
+	* objdump.c (display_bfd): Break into two functions.  The
+	actual dumping code moves to dump_bfd.  If bfd is not
+	unambiguously recognized as a bfd_object, attempt to dump
+	it as a bfd_core.
+	(dump_bfd): New function.
+
+1999-10-26  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (assemble_file): Remove spurious test of exp_name.
+
+1999-10-22  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (struct mac): Add new field 'how_default_as_switches'.
+	(mtable): Initialise new field.  Some machines have a non empty
+	string for this field.
+	(HOW_BFD_TARGET): Undefine and replace with...
+	(HOW_BFD_READ_TARGET): New macro: bfd target to use when opening a
+	file for reading.  This is set to 0 so that any recognisable bfd
+	format can be read.
+	(HOW_BFD_WRITE_TARGET): New macro: bfd target to use when opening
+	a file for writing.  This is set to the target machine type.
+	(ASM_SWITCHES): New macro: default switches to use when assembling
+	a file.
+	(assemble_file): New function: Assemble a source file into a
+	destination object file.
+	(gen_exp_file): Use assemble_file to create the exp file.
+	(make_one_lib_file): Use assemble_file to create the lib file.
+	Open output file use HOW_BFD_WRITE_TARGET and input files using
+	HOW_BFD_READ_TARGET.
+	(make_head): Use assemble_file to create the head file.
+	(make_tail): Use assemble_file to create the tail file.
+	(gen_lib_file): Open output file use HOW_BFD_WRITE_TARGET.
+
+1999-10-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* ar.c (normalize): Fix full_pathname code.
+
+1999-10-08  Ben Elliston  <bje@cygnus.com>
+
+        * binutils.texi: Some rewording and clarifications.
+
+1999-09-15  Ulrich Drepper  <drepper@cygnus.com>
+
+	* readelf.c (dynamic_segment_parisc_val): Print 0 for DLD_FLAGS if
+	the value is zero.
+	(process_symbol_table): Don't print histogram if hash table is empty.
+
+1999-09-15  Ulrich Drepper  <drepper@cygnus.com>
+
+	* readelf.c (get_parisc_dynamic_type): Handle DT_HP_GST_* values.
+
+1999-09-02  Ulrich Drepper  <drepper@cygnus.com>
+
+	* readelf.c (get_symbol_type): Add support for HPUX and PARISC
+	specific symbol types.
+
+	* readelf.c: Add HPUX and PARISC extensions to dynamic and program
+	header table printing.
+
+	* readelf.c (get_machine_flags): Add handling of PARISC.
+
+1999-09-29  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* dlltool.c (scan_drectve_symbols): Handle type tags in exported
+	symbols.
+	(scan_filtered_symbols): Likewise.
+
+1999-09-19  Ian Lance Taylor  <ian@zembu.com>
+
+	* resrc.c (write_rc_rcdata): Fix local variable shadowing
+	problem.  If RCDATA_BUFFER data can be read as strings, modify
+	code to print the strings as comments.
+	* resres.c: Add casts to avoid warnings.
+	(write_res_data, read_res_data): Don't put the program name in the
+	error message; fatal already puts it there.
+
+1999-09-14  Michael Meissner  <meissner@cygnus.com>
+
+	* configure.in (Canonicalization of target names): Remove adding
+	${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+	generates $ac_config_sub with a ${CONFIG_SHELL} already.
+	* configure: Regenerate.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ar.c (main): Clear output_file if we don't change the archive.
+	(delete_members, replace_members): Likewise.
+
+1999-09-12  Donn Terry  <donn@interix.com>
+
+	* objdump.c (dump_headers): If wide_output, print Flags header.
+
+	* objdump.c (dump_section_header): Print any comdat information.
+
+	* objcopy.c (parse_flags): Handle "noload", "debug", and "share".
+	* binutils.texi, objcopy.1: Document new flags.
+
+	* ar.c (counted_name_mode): New static variable.
+	(counted_name_counter): New static variable.
+	(map_over_members): Handle counted mode.
+	(usage): Mention N modifier.
+	(main): Handle N modifier.
+	(delete_members): Handle counted mode.
+	* binutils.texi, ar.1: Document N modifier.
+
+	* ar.c (print_contents): Change printing of member name for
+	POSIX.2 conformance.
+
+	* ar.c (output_filename): Make const.
+	(open_inarch): If creating a new empty archive, set
+	output_filename.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ar.c (full_pathname): New static variable.
+	(map_over_members): Call normalize on command line parameter.
+	(usage): Mention P modifier.
+	(normalize): If full_pathname is true, don't do anything.
+	(main): Accept P modifier.
+	(delete_members): Call normalize on command line parameter.
+	* binutils.texi, ar.1: Document P modifier.
+
+1999-09-09  Andreas Schwab  <schwab@suse.de>
+
+	* binutils.texi: Add info dir entries for all programs described
+	here.  Fix arguments of @var to not contain punctuation.
+
+1999-09-06  Donn Terry  <donn@interix.com>
+
+	* nm.c (print_symbol_info_bsd): Check for 'w' as well as 'U'.
+	(print_symbol_info_sysv): Likewise.
+	(print_symbol_info_posix): Likewise.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* readelf.c: Include "elf/pj.h".
+	(dump_relocations): Handle EM_PJ.
+	(get_machine_name): Likewise.
+	(get_machine_flags): Likewise.
+
+1999-08-31  Scott Bambrough <scottb@netwinder.org>
+
+	* readelf.c (get_note_type): New function:  Decode the e_type
+	value of a note.
+	(process_note): New function: Display the contents of a core note.
+	(process_corefile_note_segment): New function.
+	(process_corefile_note_segments): New function.
+	(process_corefile_contents): New function.
+	(process_file): Add call to process_corefile_contents.
+	(parse_args): Add parsing of -n/--notes command line switch.
+	(usage): Document new command line switch.
+
+	* binutils.texi: Documemnt new command line switch to readelf.
+
+1999-08-31  Ian Lance Taylor  <ian@zembu.com>
+
+	* binutils.texi (Bug Reporting): Clarify that large files should
+	not be sent to bug-gnu-utils.
+
+1999-08-28  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* readelf.c (process_extended_line_op): New parameter pointer_size,
+	read the address according to pointer_size.
+	(debug_line_pointer_size): New global to indicate the
+	size of address in .debug_line section.
+	(debug_displays, prescan_debug_info): Prescan the .debug_info section
+	to record the size of address in `debug_line_pointer_size'.
+	(process_section_contents): Before dumping any section, execute
+	the pre-scan operation defined for some debug sections.
+
+1999-08-27  Jim Wilson  <wilson@cygnus.com>
+
+	* readelf.c (display_debug_lines): Use i-1 not i in standard_opcodes
+	access.
+	(display_debug_aranges): New local excess.  Use for calculating padding
+	and add that into ranges.  Break from loop only if length is also 0.
+
+1999-08-27  Jim Wilson  <wilson@cygnus.com>
+
+	* readelf.c (display_debug_lines, case DW_LNS_const_add_pc): Multiply
+	adv by info.li_min_insn_length.
+
+1999-08-26  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* readelf.c (get_sparc64_dynamic_type): New function.
+	(get_dynamic_type): Use it.
+
+1999-08-26  Jim Wilson  <wilson@cygnus.com>
+
+	* readelf.c (display_debug_lines, case default): Change second line
+	setting	adv to use = not +=.
+
+1999-08-19  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c: Added more examples to the comment at the start.
+
+1999-08-18  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (make_head): Only emit interworking directive if
+	necessary.
+
+Thu Jul 15 22:44:21 1999  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* readelf.c (process_abbrev_section): Handle standard-conforming
+	single zero at the end of the section.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* objdump.c (exit_status): New static variable.
+	(nonfatal): New static function.
+	(disassemble_data): Set exit_status on error.
+	(read_section_stabs): Likewise.
+	(display_bfd): Likewise.  Call nonfatal rather than bfd_nonfatal.
+	(display_file): Call nonfatal rather than bfd_nonfatal.
+	(display_target_list, display_info_table): Likewise.
+	(main): Return exit_status rather than 0.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* objdump.c (dump_section_header): Update for renaming of
+	SEC_SHORT to SEC_SMALL_DATA.  Print SEC_SHARED flag.
+
+	From Eli Zaretskii <eliz@gnu.org>:
+	* binutils.texi: Document cxxfilt as MS-DOS name for c++filt.
+
+	* configure.in: Define and substitute DEMANGLER_NAME.
+	* Makefile.am (DEMANGLER_PROG): Set to cxxfilt.
+	(man_MANS): Use DEMANGLER_NAME rather than DEMANGLER_PROG.
+	(bin_PROGRAMS): Remove $(DEMANGLER_PROG).
+	(noinst_PROGRAMS): Add $(DEMANGLER_PROG).
+	(cxxfilt_SOURCES): Rename from c__filt_SOURCES.
+	(cxxfilt_LDADD): Rename from c__filt_LDADD.
+	($(DEMANGLER_NAME).1): Rename from $(DEMANGLER_PROG).1.  Use
+	DEMANGLER_NAME rather than DEMANGLER_PROG in substitution.
+	(MOSTLYCLEANFILES): Use DEMANGLER_NAME rather than
+	DEMANGLER_PROG.
+	(install-exec-local): When installing noinst_PROGRAMS, change
+	cxxfilt to $(DEMANGLER_NAME).
+	* configure, Makefile.in: Rebuild.
+
+	* Makefile.am: Rename .dep* files to DEP*.  Change DEP variable to
+	MKDEP.
+	* Makefile.in: Rebuild.
+
+1999-08-05  Donn Terry  <donn@interix.com>
+
+	* Makefile.am (YACC): If bison is not in the source tree, use
+	@YACC@ rather than bison -y.
+	(LEX): If flex is not in the source tree, use @LEX@ rather than
+	flex.
+	* configure.in: Build dlltool for i[3-6]86-*-interix.
+	* Makefile.in, configure: Rebuild.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* configure.bat: Remove; obsolete.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* readelf.c (get_machine_flags): Print EF_SPARC_SUN_US3.
+
+1999-07-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Bump version number to 2.9.5.
+	* configure: Rebuild.
+
+1999-07-14  Richard Henderson  <rth@cygnus.com>
+
+	* objdump.c (dump_section_header): Print SEC_SHORT.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+	as appropriate.  Add variable initializations.  Add casts.
+	* objdump.c (disassemble_bytes): Change j to bfd_vma.
+	* readelf.c (process_syminfo): Change i to unsigned int.
+	(display_debug_info): Change abbrev_number to unsigned long.
+	(process_mips_specific): Change fcnt to size_t.
+
+1999-07-09  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c: Only support decoding 64bit ELF files if the compiler
+	supports a 64 bit data type.
+	Add -I equivalent for --histogram.
+	Add -A command-line option to display architecture specific information.
+
+1999-07-08  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* readelf.c (guess_is_rela): Sparcv9 and v8plus use rela.
+	(dump_relocations): Use ELF64_R_TYPE_ID for Sparc, for R_SPARC_OLO10
+	print the secondary addend.
+	(get_machine_flags): Print Sparc machine flags.
+	(get_symbol_type): Print STT_REGISTER.
+
+1999-07-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* stabs.c (parse_stab_type): Fix handling of template names with
+	template parameters containing `::'.
+	(stab_demangle_type): Handle a qualified name in a pointer to
+	member.
+
+1999-06-23  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am (dlltool_SOURCES): Add dyn-string.c.
+	* Makefile.in: Rebuild.
+
+1999-06-23  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* configure.in (HAVE_EXECUTABLE_SUFFIX): Define.
+	* dlltool.c (look_for_prog): Use HAVE_EXECUTABLE_SUFFIX.
+	* dllwrap.c (look_for_prog): Likewise.
+	* resrc.c (look_for_default): Likewise.
+	* configure, config.in: Rebuild.
+
+1999-06-22  Ian Lance Taylor  <ian@zembu.com>
+
+	Based on patches from Mumit Khan <khan@xraylith.wisc.EDU>:
+	* configure.in: Define EXECUTABLE_SUFFIX.
+	* dlltool.c: Include "dyn-string.h".  Include <stdarg.h> based on
+	ANSI_PROTOTYPES, not __STDC__.
+	(outfile): Remove.
+	(gen_exp_file): Change uses of outfile to use alloca.
+	(make_one_lib_file, make_head, make_tail): Likewise.
+	(gen_lib_file): Likewise.
+	(look_for_prog): New static function.
+	(deduce_name): Rewrite to use look_for_prog.
+	(mcore_elf_gen_out_file): Use dyn_string_t rather than outfile.
+	* dllwrap.c: Don't include <stdio.h>, <errno.h>, <string.h>,
+	<stdlib.h>, or <unistd.h>.  Include <sys/stat.h> and either
+	<stdarg.h> or <varargs.h>.
+	(driver_name): Initialize to NULL, not "gcc".
+	(dlltool_name): Initialize to NULL, not "dlltool".
+	(display, inform, look_for_prog, deduce_name): New static
+	functions.
+	(usage): Mention -mno-cygwin.
+	(OPTION_MNO_CYGWIN): Define.
+	(main): Handle -mno-cygwin.  Deduce driver_name and dlltool_name.
+	* resrc.c (look_for_default): Make static.  Remove unused local
+	path.  Check using EXECUTABLE_SUFFIX.
+	(read_rc_file): Allocate enough space to hold EXECUTABLE_SUFFIX.
+	* Makefile.am: Rebuild dependencies.
+	(dllwrap_LDADD): Add $(INTLLIBS).
+	* configure, Makefile.in, config.in: Rebuild.
+
+Mon Jun 21 16:49:11 1999  Jeffrey A Law  (law@cygnus.com)
+
+        * readelf.c (dump_relocations): Use elf_hppa_reloc_type instead of
+        elf32_hppa_reloc_type.
+
+1999-06-17  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (mcore_elf_gen_out_file): Link object files with the
+	.exp file, not the .lib file.
+
+Fri Jun 18 20:17:51 1999  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* deflex.l: Accept single-character symbol names.
+
+1999-06-16  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_symbol_type): Detect ARM symbols typed as Thumb
+	functions.
+
+1999-06-14  Nick Clifton  <nickc@cygnus.com>
+
+	* objdump.c (disassembler_options): New variable.
+	(usage): Document new -M/--disassembler-options option.
+	(long_options): Add --disassembler-options.
+	(disassemble_data): Initialise disassembler_options field of
+	disassembler_info structure.
+	(main): Add parsing of -M option.
+
+	* binutils.texi: Document new command line switch to objdump.
+
+	* NEWS: Describe new command line switch to objdump.
+
+
+Mon Jun 14 10:27:54 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* binutils.texi: Fix typos.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* objdump.c (disassemble_bytes): If the disassembler returns an
+	error, print out anything it may have printed to the buffer.  From
+	H.J. Lu <hjl@gnu.org>.
+
+	* defparse.y (explist): Remove separate expline to eliminate
+	shift/reduce conflict.
+
+	From Kai-Uwe Rommel <rommel@ars.de>:
+	* defparse.y: Add tokens NONSHARED, SINGLE, MULTIPLE,
+	INITINSTANCE, INITGLOBAL, TERMINSTANCE, and TERMGLOBAL.
+	(command): Add option_list after LIBRARY.
+	(attr): Accept and ignore NONSHARED, SINGLE, and MULTIPLE.
+	(option_list, option): New nonterminals.
+	* deflex.l: Recognize NONSHARED, SINGLE, MULTIPLE, INITINSTANCE,
+	INITGLOBAL, TERMINSTANCE, and TERMGLOBAL.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ar.c (O_BINARY): Define as 0 if not defined.
+	(ranlib_touch): Open file with O_BINARY.
+
+	* rename.c (O_BINARY): Define as 0 if not defined.
+	(simple_copy): Open files with O_BINARY.
+
+	Based on patch from H. Peter Anvin <hpa@transmeta.com>:
+	* objcopy.c (struct section_list): Add copy field.
+	(sections_copied): New static variable.
+	(copy_options): Add "only-section".
+	(copy_usage): Mention -j and --only-section.
+	(find_section_list): Initialize copy field.
+	(is_strip_section): Check for copying sections.
+	(copy_object): Check sections_copied when calling filter_symbols.
+	(setup_section): Check for copying sections.
+	(copy_section): Likewise.
+	(copy_main): Handle -j/--only-section.
+	* binutils.texi, objcopy.1: Document -j/--only-section.
+
+	* configure.in: If frexp is not available, check in -lm.
+	* configure: Rebuild.
+
+	* readelf.c (get_elf_class): Use correct printf format for type.
+	(get_data_encoding): Likewise.
+	(get_osabi_name): Likewise.
+	(process_file_header): Don't pass an extra argument to printf.
+	(process_dynamic_segment): Cast dynamic_size to long before
+	printing.
+	(decode_location_expression): Cast byte_get to long before
+	printing.
+
+Wed Jun  9 11:40:16 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* readelf.c (dump_section): Cast values from byte_get to
+ 	[unsigned] long for printing, in case it is wider than long.
+	(display_block): Likewise.
+	(read_and_display_attr): Likewise.
+	(decode_location_expression): Likewise.  Don't depend on
+ 	evaluation order.
+
+Mon Jun  7 12:14:57 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* windres.c (usage): Fix typo.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c: Use 64bit wide fields in internal strcutures even if
+	targetting a 32bit architecture.
+	(dump_relocations): Take a new parameter - the number of symbols
+	in the symbol table.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c: Add support for 64bit ELF files.
+
+1999-06-03  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (mcore_elf_gen_out_file): Use constants for temporary
+	file names.
+
+Wed Jun  2 12:34:36 1999  Richard Henderson  <rth@cygnus.com>
+
+	* dlltool.c (gen_exp_file): Revert 19990411 change.
+
+Mon May 31 09:56:22 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* readelf.c (process_relocs): Determine type of reloc from
+	DT_PLTREL and from section type.
+
+1999-05-29  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (get_elf_class): Display unknown class number.
+	(get_data_encoding): Display unknown encoding number.
+	(get_osabi_name): Display unknown ABI number.
+	(process_file_header): Display unknown version number.
+
+1999-05-29  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (dump_relocations): Fix typo.
+
+1999-05-28  Nick Clifton  <nickc@cygnus.com>
+
+	* readelf.c (dump_relocations): Add extra parameter: is_rela to
+	specify the kind of relocations to be dumped.  Call guess_is_rela
+	if this parameter has a value of UNKNOWN.
+	(guess_is_rela): New function:  Guess the kind of reloc being used
+	baced on the machine number.
+	(process_relocs): Determine type of reloc before calling
+	dump_relocations.
+
+1999-05-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* readelf.c: Include "elf/i960.h".
+	(dump_relocations): Handle EM_960.
+
+Thu May 27 11:58:33 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* objcopy.c (copy_archive): Preserve dates of archive members if
+	requested.
+
+	* readelf.c (dump_relocations): Always print the addend on RELA
+	systems even if there is no symbol.
+	(process_program_headers): Reset dynamic_size before looping
+	through the program headers.
+	(process_version_sections): Cast sh_offset to unsigned long for
+	printing in case bfd_vma is wider.
+	(process_symbol_table): Use get_symbol_index_type when printing
+	st_shndx.
+
+1999-05-17  DJ Delorie  <dj@cygnus.com>
+
+	* windres.c: add verbose option
+	(main): process verbose option
+	* resrc.c (look_for_default): new.  Look for the default
+	preprocessor in a given location.
+	(read_rc_file): for foo/bar-windres, look for foo/bar-gcc,
+	foo/gcc (in case of foo/windres), and then gcc (the old default).
+
+1999-05-16  Nick Clifton  <nickc@cygnus.com>
+
+	* dlltool.c (deduce_name): New function: Deduce name of program to
+	run.
+	(mcore_elf_out_file): New variable: Name of mcore-elf output file.
+	(mcore_elf_linker): New variable: Name of linker to use.
+	(mcore_elf_linker_flags): New variable: Linker flags to pass.
+	(scan_obj_file): Cache filenames if necessary.
+	(usage): Document new command line options.
+	(main): Support new command line options: -M (generate an
+	mcore-elf output file) -L (name of linker to use) -F (flags to
+	pass to linker).
+	(mcore_elf_cache_filename): Store a filename in a cache.
+	(mcore_elf_gen_out_file): New function: Generate an output file
+	per the mcore-elf spec.
+
+1999-05-15  Nick Clifton  <nickc@cygnus.com>
+
+	* configure.in (BUILD_MISC): Build dlltool for mcore
+	* configure: Regenerate.
+	* dlltool.c: Update example in comment.
+	(DLLTOOL_MCORE): Define.
+	(DLLTOOL_MCORE_ELF): Define.
+	(DRECTVE_SECTION_NAME): Define.
+	(mcore_be_jtab, mcore_le_jtab): Binary for performing an mcore
+	jump to address.
+	(mtable): Add entries for mcore variants.
+	(rvaafter, rvabefore, asm_prefix): Add mcore suppport.
+	(scan_drectve_symbols): Use DRECTVE_SECTION_NAME.
+	(make_head, make_tail): Cope if file cannot be created.
+	(usage): Improve layout.
+
+1999-05-13  DJ Delorie  <dj@cygnus.com>
+
+	* rclex.l: add code to suppress certain output from cpp, replace
+	all returns with MAYBE_RETURN
+	(MAYBE_RETURN): new, implement the suppression by returning
+	IGNORED_TOKEN as needed.
+	(cpp_line): remember which file we're in, mark data from included
+	*.h files for suppression.
+	* rcparse.y (input): allow IGNORED_TOKEN outside of known constructs
+
+1999-05-10  DJ Delorie  <dj@cygnus.com>
+
+	* windres.c (quot): Quote shell metacharacters in a string
+	(main): quote parameters to cpp that might have metacharacters in
+	them.  Allow -D as an alias for --define to allow for sharing make
+	macros with gcc.
+
+	* objdump.c (dump_reloc_set): don't core if howto->name is NULL
+
+	* Makefile.am: Give rescoff.c a cpu-specific -D so it can set
+	the correct BFD.
+	* Makefile.in: ditto
+	* rescoff.c (write_coff_file): Set the correct BFD
+
+1999-05-06  Ian Lance Taylor  <ian@zembu.com>
+
+	* rename.c (smart_rename): Fix test of whether file exists.
+
+1999-05-06  Nick Clifton  <nickc@cygnus.com>
+
+	* objdump.c (disassemble_data): Set display_endian based on target
+	endianism.
+
+1999-05-05  Catherine Moore  <clm@cygnus.com>
+
+	* dlltool.c (interwork): Remove.
+	(arm_interwork_jtab): Use bx insn.
+	(thumb_jtab): Likewise.
+	(MARM_INTERWORK): New machine type.
+	(rvaafter): Handle it.
+	(rvabefore) Likewise.
+	(asm_prefix): Likewise.
+	(gen_exp_type): Check machine type instead of
+	interwork flag.
+	(make_one_lib_file): Likewise.
+	(make_head): Likewise.
+	(make_tail): Likewise.
+	(usage): Update machine types.
+	(main): Remove -interwork support.
+
+1999-05-05  Catherine Moore  <clm@cygnus.com>
+
+        * readelf.c (get_machine_flags):  Check for EF_CPU32.
+        (get_data_encoding): Fix typo.
+
 1999-04-26  Tom Tromey  <tromey@cygnus.com>
 
 	* aclocal.m4, configure: Updated for new version of libtool.
@@ -63,7 +954,7 @@
 1999-04-05  Nick Clifton  <nickc@cygnus.com>
 
 	* readelf.c (decode_location_expression): Fix DW_OP_const8{s|u}
-	decodes. 
+	decodes.
 
 1999-04-04  Ian Lance Taylor  <ian@zembu.com>
 
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 4f3014f..f98438e 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -15,9 +15,9 @@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
 
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L$(srcdir)/../bison/ ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
 YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
 
 # these two are almost the same program
 AR_PROG=ar
@@ -38,7 +38,7 @@
 
 # This is the demangler, as a standalone program.
 # Note: This one is used as the installed name too, unlike the above.
-DEMANGLER_PROG=c++filt
+DEMANGLER_PROG=cxxfilt
 
 ADDR2LINE_PROG=addr2line
 
@@ -50,14 +50,15 @@
 SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) 
 
 man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \
-	addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1
+	addr2line.1 nlmconv.1 $(DEMANGLER_NAME).1
 
 PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
 
-bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
+bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
 
-## We need a special rule to install the programs which are built with -new
-noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG)
+## We need a special rule to install the programs which are built with
+## -new, and to rename cxxfilt to c++filt.
+noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
 
 EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG)
 
@@ -68,7 +69,7 @@
 BFDDIR = $(BASEDIR)/bfd
 INCDIR	= $(BASEDIR)/include
 
-DEP = mkdep
+MKDEP = mkdep
 
 INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
 
@@ -178,8 +179,8 @@
 cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h
 	$(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c
 
-c__filt_SOURCES =
-c__filt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
+cxxfilt_SOURCES =
+cxxfilt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
 
 ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c $(BULIBS)
 ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
@@ -234,12 +235,15 @@
 
 srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
 
-dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
+dlltool_SOURCES = dlltool.c defparse.y deflex.l dyn-string.c $(BULIBS)
 dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
 
 dlltool.o:dlltool.c
 	$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
 
+rescoff.o:rescoff.c
+	$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
+
 coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
 
 sysdump_SOURCES = sysdump.c $(BULIBS)
@@ -257,7 +261,7 @@
 windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
 
 dllwrap_SOURCES = dllwrap.c dyn-string.c 
-dllwrap_LDADD = $(LIBIBERTY)
+dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
 
 
 DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
@@ -269,18 +273,18 @@
 	site.exp site.bak
 
 # Targets to rebuild dependencies in this Makefile.
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(GENERATED_CFILES)
-	rm -f .dep2
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	$(DEP) -f .dep2 $(INCLUDES) $?
-	$(SHELL) $(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES) $(GENERATED_CFILES)
+	rm -f DEP2
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	$(MKDEP) -f DEP2 $(INCLUDES) $?
+	$(SHELL) $(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	objdir=`pwd`; \
@@ -290,19 +294,19 @@
 		-e 's!@SRCDIR@!$(srcdir)!'	\
 		-e "s!@OBJDIR@!$${objdir}!"
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -319,24 +323,24 @@
 
 MAINTAINERCLEANFILES = config.texi
 
-$(DEMANGLER_PROG).1: cxxfilt.man Makefile
-	sed -e 's/@PROGRAM@/$(DEMANGLER_PROG)/' < $(srcdir)/cxxfilt.man \
-		> $(DEMANGLER_PROG).1
+$(DEMANGLER_NAME).1: cxxfilt.man Makefile
+	sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' < $(srcdir)/cxxfilt.man \
+		> $(DEMANGLER_NAME).1
 
-MOSTLYCLEANFILES = sysinfo $(DEMANGLER_PROG).1 binutils.log binutils.sum \
+MOSTLYCLEANFILES = sysinfo $(DEMANGLER_NAME).1 binutils.log binutils.sum \
 	abcdefgh*
 mostlyclean-local:
 	-rm -rf tmpdir
 
-CLEANFILES = dep.sed .dep .dep1
+CLEANFILES = dep.sed DEP DEP1
 
 .PHONY: install-exec-local
 
-install-exec-local: $(bin_PROGRAMS) $(noinst_PROGRAMS)
+install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS)
 	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
 	  if test -f $$p; then \
-	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
 	  else :; fi; \
 	done
 	$(mkinstalldirs) $(tooldir)/bin
@@ -378,7 +382,8 @@
   debug.h
 dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \
-  $(INCDIR)/getopt.h $(INCDIR)/demangle.h dlltool.h
+  $(INCDIR)/getopt.h $(INCDIR)/demangle.h dyn-string.h \
+  dlltool.h
 filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   bucomm.h config.h $(INCDIR)/fopen-same.h
 ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \
@@ -459,8 +464,8 @@
   $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
   $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
   $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/arc.h \
-  $(INCDIR)/elf/fr30.h bucomm.h config.h $(INCDIR)/fopen-same.h \
-  $(INCDIR)/getopt.h
+  $(INCDIR)/elf/fr30.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h \
+  bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h
 resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   windres.h winduni.h
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index c32ae4d..b3d4360 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -75,6 +75,7 @@
 CATOBJEXT = @CATOBJEXT@
 CC = @CC@
 DATADIRNAME = @DATADIRNAME@
+DEMANGLER_NAME = @DEMANGLER_NAME@
 DLLTOOL = @DLLTOOL@
 DLLTOOL_DEFS = @DLLTOOL_DEFS@
 EXEEXT = @EXEEXT@
@@ -87,7 +88,6 @@
 INSTOBJEXT = @INSTOBJEXT@
 INTLDEPS = @INTLDEPS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
@@ -95,7 +95,7 @@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
 NLMCONV_DEFS = @NLMCONV_DEFS@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
@@ -103,7 +103,6 @@
 UNDERSCORE = @UNDERSCORE@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 l = @l@
 
@@ -118,9 +117,9 @@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
 
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L$(srcdir)/../bison/ ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
 YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
 
 # these two are almost the same program
 AR_PROG = ar
@@ -141,7 +140,7 @@
 
 # This is the demangler, as a standalone program.
 # Note: This one is used as the installed name too, unlike the above.
-DEMANGLER_PROG = c++filt
+DEMANGLER_PROG = cxxfilt
 
 ADDR2LINE_PROG = addr2line
 
@@ -153,14 +152,14 @@
 SRCONV_PROG = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) 
 
 man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \
-	addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1
+	addr2line.1 nlmconv.1 $(DEMANGLER_NAME).1
 
 
 PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
 
-bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
+bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@
 
-noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG)
+noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
 
 EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG)
 
@@ -171,7 +170,7 @@
 BFDDIR = $(BASEDIR)/bfd
 INCDIR = $(BASEDIR)/include
 
-DEP = mkdep
+MKDEP = mkdep
 
 INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
 
@@ -254,8 +253,8 @@
 objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
 objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
 
-c__filt_SOURCES = 
-c__filt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
+cxxfilt_SOURCES = 
+cxxfilt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
 
 ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c $(BULIBS)
 ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
@@ -267,7 +266,7 @@
 
 srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
 
-dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
+dlltool_SOURCES = dlltool.c defparse.y deflex.l dyn-string.c $(BULIBS)
 dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
 
 coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
@@ -282,7 +281,7 @@
 windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
 
 dllwrap_SOURCES = dllwrap.c dyn-string.c 
-dllwrap_LDADD = $(LIBIBERTY)
+dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
 
 DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
 	syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c
@@ -294,20 +293,20 @@
 
 MAINTAINERCLEANFILES = config.texi
 
-MOSTLYCLEANFILES = sysinfo $(DEMANGLER_PROG).1 binutils.log binutils.sum \
+MOSTLYCLEANFILES = sysinfo $(DEMANGLER_NAME).1 binutils.log binutils.sum \
 	abcdefgh*
 
 
-CLEANFILES = dep.sed .dep .dep1
+CLEANFILES = dep.sed DEP DEP1
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = 
 bin_PROGRAMS =  size$(EXEEXT) objdump$(EXEEXT) ar$(EXEEXT) \
-strings$(EXEEXT) ranlib$(EXEEXT) c++filt$(EXEEXT) objcopy$(EXEEXT) \
-@BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \
-addr2line$(EXEEXT) readelf$(EXEEXT) @BUILD_DLLWRAP@ @BUILD_MISC@
-noinst_PROGRAMS =  nm-new$(EXEEXT) strip-new$(EXEEXT)
+strings$(EXEEXT) ranlib$(EXEEXT) objcopy$(EXEEXT) @BUILD_NLMCONV@ \
+@BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ addr2line$(EXEEXT) \
+readelf$(EXEEXT) @BUILD_DLLWRAP@ @BUILD_MISC@
+noinst_PROGRAMS =  nm-new$(EXEEXT) strip-new$(EXEEXT) cxxfilt$(EXEEXT)
 PROGRAMS =  $(bin_PROGRAMS) $(noinst_PROGRAMS)
 
 
@@ -331,8 +330,8 @@
 coffdump_LDADD = $(LDADD)
 coffdump_DEPENDENCIES =  ../bfd/libbfd.la ../libiberty/libiberty.a
 coffdump_LDFLAGS = 
-dlltool_OBJECTS =  dlltool.o defparse.o deflex.o bucomm.o version.o \
-filemode.o
+dlltool_OBJECTS =  dlltool.o defparse.o deflex.o dyn-string.o bucomm.o \
+version.o filemode.o
 dlltool_DEPENDENCIES =  ../bfd/libbfd.la ../libiberty/libiberty.a
 dlltool_LDFLAGS = 
 windres_OBJECTS =  windres.o resrc.o rescoff.o resbin.o rcparse.o \
@@ -363,10 +362,6 @@
 bucomm.o version.o filemode.o
 ranlib_DEPENDENCIES =  ../bfd/libbfd.la ../libiberty/libiberty.a
 ranlib_LDFLAGS = 
-c__filt_OBJECTS = 
-c__filt_DEPENDENCIES =  cplus-dem.o underscore.o \
-../libiberty/libiberty.a
-c__filt_LDFLAGS = 
 objcopy_OBJECTS =  objcopy.o not-strip.o rename.o rddbg.o debug.o \
 stabs.o ieee.o rdcoff.o wrstabs.o bucomm.o version.o filemode.o
 objcopy_LDADD = $(LDADD)
@@ -388,6 +383,10 @@
 strip_new_LDADD = $(LDADD)
 strip_new_DEPENDENCIES =  ../bfd/libbfd.la ../libiberty/libiberty.a
 strip_new_LDFLAGS = 
+cxxfilt_OBJECTS = 
+cxxfilt_DEPENDENCIES =  cplus-dem.o underscore.o \
+../libiberty/libiberty.a
+cxxfilt_LDFLAGS = 
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
 LEXLIB = @LEXLIB@
 YLWRAP = $(top_srcdir)/../ylwrap
@@ -412,10 +411,10 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
-SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(c__filt_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES)
-OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(c__filt_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS)
+SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES)
+OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
@@ -583,10 +582,6 @@
 	@rm -f ranlib$(EXEEXT)
 	$(LINK) $(ranlib_LDFLAGS) $(ranlib_OBJECTS) $(ranlib_LDADD) $(LIBS)
 
-c++filt$(EXEEXT): $(c__filt_OBJECTS) $(c__filt_DEPENDENCIES)
-	@rm -f c++filt$(EXEEXT)
-	$(LINK) $(c__filt_LDFLAGS) $(c__filt_OBJECTS) $(c__filt_LDADD) $(LIBS)
-
 objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES)
 	@rm -f objcopy$(EXEEXT)
 	$(LINK) $(objcopy_LDFLAGS) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS)
@@ -606,6 +601,10 @@
 strip-new$(EXEEXT): $(strip_new_OBJECTS) $(strip_new_DEPENDENCIES)
 	@rm -f strip-new$(EXEEXT)
 	$(LINK) $(strip_new_LDFLAGS) $(strip_new_OBJECTS) $(strip_new_LDADD) $(LIBS)
+
+cxxfilt$(EXEEXT): $(cxxfilt_OBJECTS) $(cxxfilt_DEPENDENCIES)
+	@rm -f cxxfilt$(EXEEXT)
+	$(LINK) $(cxxfilt_LDFLAGS) $(cxxfilt_OBJECTS) $(cxxfilt_LDADD) $(LIBS)
 .l.c:
 	$(SHELL) $(YLWRAP) "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(AM_LFLAGS) $(LFLAGS)
 .y.c:
@@ -898,7 +897,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -1125,28 +1124,30 @@
 dlltool.o:dlltool.c
 	$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c
 
+rescoff.o:rescoff.c
+	$(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
+
 # coff/sym.h and coff/ecoff.h won't be found by the automatic dependency
 # scripts, since they are only included conditionally.
 nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
 	ldname=`echo ld | sed '$(transform)'`; \
 	$(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
 
-
 diststuff: $(DISTSTUFF) info
 
 # Targets to rebuild dependencies in this Makefile.
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(GENERATED_CFILES)
-	rm -f .dep2
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	$(DEP) -f .dep2 $(INCLUDES) $?
-	$(SHELL) $(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES) $(GENERATED_CFILES)
+	rm -f DEP2
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	$(MKDEP) -f DEP2 $(INCLUDES) $?
+	$(SHELL) $(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	objdir=`pwd`; \
@@ -1156,19 +1157,19 @@
 		-e 's!@SRCDIR@!$(srcdir)!'	\
 		-e "s!@OBJDIR@!$${objdir}!"
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -1183,19 +1184,19 @@
 
 binutils.info: $(srcdir)/binutils.texi config.texi
 
-$(DEMANGLER_PROG).1: cxxfilt.man Makefile
-	sed -e 's/@PROGRAM@/$(DEMANGLER_PROG)/' < $(srcdir)/cxxfilt.man \
-		> $(DEMANGLER_PROG).1
+$(DEMANGLER_NAME).1: cxxfilt.man Makefile
+	sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' < $(srcdir)/cxxfilt.man \
+		> $(DEMANGLER_NAME).1
 mostlyclean-local:
 	-rm -rf tmpdir
 
 .PHONY: install-exec-local
 
-install-exec-local: $(bin_PROGRAMS) $(noinst_PROGRAMS)
+install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS)
 	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
 	  if test -f $$p; then \
-	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//' -e 's/cxxfilt/$(DEMANGLER_NAME)/'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
 	  else :; fi; \
 	done
 	$(mkinstalldirs) $(tooldir)/bin
@@ -1237,7 +1238,8 @@
   debug.h
 dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \
-  $(INCDIR)/getopt.h $(INCDIR)/demangle.h dlltool.h
+  $(INCDIR)/getopt.h $(INCDIR)/demangle.h dyn-string.h \
+  dlltool.h
 filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   bucomm.h config.h $(INCDIR)/fopen-same.h
 ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \
@@ -1318,8 +1320,8 @@
   $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
   $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
   $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/arc.h \
-  $(INCDIR)/elf/fr30.h bucomm.h config.h $(INCDIR)/fopen-same.h \
-  $(INCDIR)/getopt.h
+  $(INCDIR)/elf/fr30.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h \
+  bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h
 resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   windres.h winduni.h
diff --git a/binutils/NEWS b/binutils/NEWS
index 76dcebd..8d24ccd 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -2,8 +2,17 @@
 
 Changes in binutils 2.10:
 
-* objdump support for -mi386:intel which causes disassembly to be displayed with
-  intel syntax.
+* New command line switch to objdump --file-start-context which shows the
+  entire file contents up to the source line first encountered for a given
+  file. 
+
+* New command line switch to objdump -M (or --disassembler-options) which takes
+  a parameter which can then be interpreted on a per-target basis by the
+  disassembler.  Used by ARM targets to select register name sets, ISA, APCS or
+  raw verions.
+  
+* objdump support for -mi386:intel which causes disassembly to be displayed
+  with intel syntax.
 
 * New program: readelf.  This displays the contents of ELF format files,
   regardless of target machine.
@@ -18,6 +27,9 @@
 * dlltool now takes --export-all-symbols, --no-export-all-symbols,
   --exclude-symbols, and --no-default-excludes options.
 
+* objcopy now takes a -j/--only-section option to copy only the specified
+  sections.
+
 Changes in binutils 2.9:
 
 * Added windres program, which can be used to manipulate resources in WIN32
diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
index 88a1565..2d62d71 100644
--- a/binutils/aclocal.m4
+++ b/binutils/aclocal.m4
@@ -105,7 +105,7 @@
 AC_SUBST($1)])
 
 
-# serial 35 AC_PROG_LIBTOOL
+# serial 40 AC_PROG_LIBTOOL
 AC_DEFUN(AC_PROG_LIBTOOL,
 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
 
@@ -114,10 +114,11 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$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
@@ -146,24 +147,33 @@
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_LD])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -195,33 +205,28 @@
   fi
   ;;
 
-*-*-cygwin*)
-  AC_SYS_LIBTOOL_CYGWIN
+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
-
-# enable the --disable-libtool-lock switch
-
-AC_ARG_ENABLE(libtool-lock,
-[  --disable-libtool-lock  force libtool not to do file locking],
-need_locks=$enableval,
-need_locks=yes)
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
 ])
 
-# AC_LIBTOOL_DLOPEN - check for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
+# 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,
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -246,15 +251,15 @@
 ])
 
 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED,
-[AC_ENABLE_SHARED(no)])
+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,
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -279,16 +284,16 @@
 ])
 
 # AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC,
-[AC_ENABLE_STATIC(no)])
+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,
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -313,9 +318,8 @@
 ])
 
 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL,
-[AC_ENABLE_FAST_INSTALL(no)])
-
+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,
@@ -333,7 +337,7 @@
   case "$ac_prog" in
     # Accept absolute paths.
 changequote(,)dnl
-    /* | [A-Za-z]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
 changequote([,])dnl
       # Canonicalize the path of ld
@@ -359,10 +363,10 @@
 fi
 AC_CACHE_VAL(ac_cv_path_LD,
 [if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -385,7 +389,6 @@
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
 AC_PROG_LD_GNU
 ])
 
@@ -407,10 +410,10 @@
   # Let the user override the test.
   ac_cv_path_NM="$NM"
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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; then
+    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
@@ -431,230 +434,24 @@
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
-])
-
-# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
-# by C symbol name from nm.
-AC_DEFUN(AC_SYS_NM_PARSE,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output])
-AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
-[# These are sane defaults that work on at least a few old systems.
-# {They come from Ultrix.  What could be older than Ultrix?!! ;)}
-
-changequote(,)dnl
-# Character class describing NM global symbol codes.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-changequote([,])dnl
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($ac_symcode\)[ 	][ 	]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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;
-}
-changequote(,)dnl
-lt_preloaded_symbols[] =
-changequote([,])dnl
-{
-EOF
-	sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&AC_FD_CC
-	    cat conftest.c >&AC_FD_CC
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-    fi
-  else
-    echo "$progname: failed program was:" >&AC_FD_CC
-    cat conftest.c >&AC_FD_CC
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-AC_MSG_RESULT($ac_result)
-])
-
-# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
-AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-AC_CHECK_TOOL(AS, as, false)
-])
-
-# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
-#                            with an underscore?
-AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
-[AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_MSG_CHECKING([for _ prefix in compiled symbols])
-AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
-[ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if AC_TRY_EVAL(ac_compile); then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-  fi
-else
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.c >&AC_FD_CC
-fi
-rm -rf conftest*
-])
-AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
 ])
 
 # AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM, [
-AC_CHECK_LIB(mw, _mwvalidcheckl)
-AC_CHECK_LIB(m, cos)
+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
@@ -665,13 +462,14 @@
 # '${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_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
@@ -683,16 +481,23 @@
 # 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_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
-    case "$enable_ltdl_install" in
-    no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
-    "") enable_ltdl_install=yes
-        ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
-    esac
+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"no"; then
+  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
 ])
 
@@ -704,9 +509,9 @@
 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
-AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
-AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
-AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])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.
 
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index 3cee867..72707c2 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -123,7 +123,7 @@
 find_address_in_section (abfd, section, data)
      bfd *abfd;
      asection *section;
-     PTR data;
+     PTR data ATTRIBUTE_UNUSED;
 {
   bfd_vma vma;
   bfd_size_type size;
diff --git a/binutils/ar.1 b/binutils/ar.1
index e4e8cff..cd71a40 100644
--- a/binutils/ar.1
+++ b/binutils/ar.1
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1991 Free Software Foundation
+.\" Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation
 .\" See section COPYING for conditions for redistribution
-.TH ar 1 "5 November 1991" "cygnus support" "GNU Development Tools"
+.TH ar 1 "1999" "Cygnus Solutions" "GNU Development Tools"
 .de BP
 .sp
 .ti \-.2i
@@ -14,10 +14,13 @@
 .hy 0
 .na
 .BR ar " [\|" "-" "\|]"\c
-.I {dmpqrtx}[abcilosSuvV] \c
+.I {dmpqrtx}[abcfilNoPsSuvV] \c
 [\|\c
 .I membername\c
 \&\|] \c
+[\|\c
+.I count\c
+\&\|] \c
 .I archive\c
 \& \c
 .I files\c
@@ -406,6 +409,15 @@
 This modifier is accepted but not used.
 
 .TP
+.B N
+Uses the
+.I count
+parameter.  This is used if there are multiple entries in the archive
+with the same name.  Extract or delete instance
+.I count
+of the given name from the archive.
+
+.TP
 .B o
 Preserve the \c
 .I original\c
@@ -414,6 +426,18 @@
 will be stamped with the time of extraction.
 
 .TP
+.B P
+Use the full path name when matching names in the archive.
+.B ar
+can not create an archive with a full path name (such archives are not
+POSIX complaint), but other archive creators can.  This option will
+cause
+.B ar
+to match file names using a complete path name, which can be
+convenient when extracting a single file from an archive created by
+another tool.
+
+.TP
 .B s
 Write an object-file index into the archive, or update an existing one,
 even if no other change is made to the archive.  You may use this modifier
@@ -491,7 +515,7 @@
 \&.
 
 .SH COPYING
-Copyright (c) 1991 Free Software Foundation, Inc.
+Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 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
diff --git a/binutils/ar.c b/binutils/ar.c
index c951ef7..ad9e59d 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -40,6 +40,12 @@
 #define EXT_NAME_LEN 6		/* ditto for *NIX */
 #endif
 
+/* We need to open files in binary modes on system where that makes a
+   difference.  */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 #define BUFSIZE 8192
 
 /* Kludge declaration from BFD!  This is ugly!  FIXME!  XXX */
@@ -141,9 +147,19 @@
 static bfd **
 get_pos_bfd PARAMS ((bfd **, enum pos, const char *));
 
+/* For extract/delete only.  If COUNTED_NAME_MODE is true, we only
+   extract the COUNTED_NAME_COUNTER instance of that name.  */
+static boolean counted_name_mode = 0;
+static int counted_name_counter = 0;
+
 /* Whether to truncate names of files stored in the archive.  */
 static boolean ar_truncate = false;
 
+/* Whether to use a full file name match when searching an archive.
+   This is convenient for archives created by the Microsoft lib
+   program.  */
+static boolean full_pathname = false;
+
 int interactive = 0;
 
 static void
@@ -165,6 +181,7 @@
      int count;
 {
   bfd *head;
+  int match_count;
 
   if (count == 0)
     {
@@ -175,6 +192,7 @@
 	}
       return;
     }
+
   /* This may appear to be a baroque way of accomplishing what we want.
      However we have to iterate over the filenames in order to notice where
      a filename is requested but does not exist in the archive.  Ditto
@@ -185,6 +203,7 @@
     {
       boolean found = false;
 
+      match_count = 0;
       for (head = arch->next; head; head = head->next)
 	{
 	  PROGRESS (1);
@@ -196,8 +215,17 @@
 	      bfd_stat_arch_elt (head, &buf);
 	    }
 	  if ((head->filename != NULL) &&
-	      (!strcmp (*files, head->filename)))
+	      (!strcmp (normalize (*files, arch), head->filename)))
 	    {
+	      ++match_count;
+	      if (counted_name_mode
+		  && match_count != counted_name_counter) 
+		{
+		  /* Counting, and didn't match on count; go on to the
+                     next one.  */
+		  continue;
+		}
+
 	      found = true;
 	      function (head);
 	    }
@@ -221,7 +249,8 @@
   if (! is_ranlib)
     {
       /* xgettext:c-format */
-      fprintf (s, _("Usage: %s [-]{dmpqrstx}[abcilosSuvV] [member-name] archive-file file...\n"), program_name);
+      fprintf (s, _("Usage: %s [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
+	       program_name);
       /* xgettext:c-format */
       fprintf (s, _("       %s -M [<mri-script]\n"), program_name);
       fprintf (s, _(" commands:\n"));
@@ -235,7 +264,9 @@
       fprintf (s, _(" command specific modifiers:\n"));
       fprintf (s, _("  [a]          - put file(s) after [member-name]\n"));
       fprintf (s, _("  [b]          - put file(s) before [member-name] (same as [i])\n"));
+      fprintf (s, _("  [N]          - use instance [count] of name\n"));
       fprintf (s, _("  [f]          - truncate inserted file names\n"));
+      fprintf (s, _("  [P]          - use full path names when matching\n"));
       fprintf (s, _("  [o]          - preserve original dates\n"));
       fprintf (s, _("  [u]          - only replace files that are newer than current archive contents\n"));
       fprintf (s, _(" generic modifiers:\n"));
@@ -267,6 +298,9 @@
 {
   const char *filename;
 
+  if (full_pathname)
+    return file;
+
   filename = strrchr (file, '/');
   if (filename != (char *) NULL)
     filename++;
@@ -291,7 +325,7 @@
 
 /* Remove any output file.  This is only called via xatexit.  */
 
-static char *output_filename = NULL;
+static const char *output_filename = NULL;
 static FILE *output_file = NULL;
 static bfd *output_bfd = NULL;
 
@@ -325,6 +359,7 @@
     } operation = none;
   int arg_index;
   char **files;
+  int file_count;
   char *inarch_filename;
   int show_version;
 
@@ -492,9 +527,15 @@
 	case 'M':
 	  mri_mode = 1;
 	  break;
+	case 'N':
+	  counted_name_mode = true;
+	  break;
 	case 'f':
 	  ar_truncate = true;
 	  break;
+	case 'P':
+	  full_pathname = true;
+	  break;
 	default:
 	  /* xgettext:c-format */
 	  fprintf (stderr, _("%s: illegal option -- %c\n"), program_name, c);
@@ -539,9 +580,19 @@
       if (postype != pos_default)
 	posname = argv[arg_index++];
 
+      if (counted_name_mode) 
+	{
+          if (operation != extract && operation != delete) 
+	     fatal (_("`N' is only meaningful with the `x' and 'd' options."));
+	  counted_name_counter = atoi (argv[arg_index++]);
+          if (counted_name_counter <= 0)
+	    fatal (_("Value for `N' must be positive."));
+	}
+
       inarch_filename = argv[arg_index++];
 
       files = arg_index < argc ? argv + arg_index : NULL;
+      file_count = argc - arg_index;
 
 #if 0
       /* We don't use do_quick_append any more.  Too many systems
@@ -582,31 +633,37 @@
       switch (operation)
 	{
 	case print_table:
-	  map_over_members (arch, print_descr, files, argc - 3);
+	  map_over_members (arch, print_descr, files, file_count);
 	  break;
 
 	case print_files:
-	  map_over_members (arch, print_contents, files, argc - 3);
+	  map_over_members (arch, print_contents, files, file_count);
 	  break;
 
 	case extract:
-	  map_over_members (arch, extract_file, files, argc - 3);
+	  map_over_members (arch, extract_file, files, file_count);
 	  break;
 
 	case delete:
 	  if (files != NULL)
 	    delete_members (arch, files);
+	  else
+	    output_filename = NULL;
 	  break;
 
 	case move:
 	  if (files != NULL)
 	    move_members (arch, files);
+	  else
+	    output_filename = NULL;
 	  break;
 
 	case replace:
 	case quick_append:
 	  if (files != NULL || write_armap > 0)
 	    replace_members (arch, files, operation == quick_append);
+	  else
+	    output_filename = NULL;
 	  break;
 
 	  /* Shouldn't happen! */
@@ -681,6 +738,9 @@
 	  || ! bfd_set_format (arch, bfd_archive)
 	  || ! bfd_close (arch))
 	bfd_fatal (archive_filename);
+
+      /* If we die creating a new archive, don't leave it around.  */
+      output_filename = archive_filename;
     }
 
   arch = bfd_openr (archive_filename, target);
@@ -730,8 +790,7 @@
     fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
 
   if (verbose)
-    /* xgettext:c-format */
-    printf (_("\n<member %s>\n\n"), bfd_get_filename (abfd));
+    printf ("\n<%s>\n\n", bfd_get_filename (abfd));
 
   bfd_seek (abfd, 0, SEEK_SET);
 
@@ -1069,6 +1128,8 @@
   bfd **current_ptr_ptr;
   boolean found;
   boolean something_changed = false;
+  int match_count;
+
   for (; *files_to_delete != NULL; ++files_to_delete)
     {
       /* In a.out systems, the armap is optional.  It's also called
@@ -1085,23 +1146,33 @@
 	}
 
       found = false;
+      match_count = 0;
       current_ptr_ptr = &(arch->next);
       while (*current_ptr_ptr)
 	{
-	  if (strcmp (*files_to_delete, (*current_ptr_ptr)->filename) == 0)
+	  if (strcmp (normalize (*files_to_delete, arch),
+		      (*current_ptr_ptr)->filename) == 0)
 	    {
-	      found = true;
-	      something_changed = true;
-	      if (verbose)
-		printf ("d - %s\n",
-			*files_to_delete);
-	      *current_ptr_ptr = ((*current_ptr_ptr)->next);
-	      goto next_file;
+	      ++match_count;
+	      if (counted_name_mode
+		  && match_count != counted_name_counter) 
+		{
+		  /* Counting, and didn't match on count; go on to the
+                     next one.  */
+		}
+	      else
+		{
+		  found = true;
+		  something_changed = true;
+		  if (verbose)
+		    printf ("d - %s\n",
+			    *files_to_delete);
+		  *current_ptr_ptr = ((*current_ptr_ptr)->next);
+		  goto next_file;
+		}
 	    }
-	  else
-	    {
-	      current_ptr_ptr = &((*current_ptr_ptr)->next);
-	    }
+
+	  current_ptr_ptr = &((*current_ptr_ptr)->next);
 	}
 
       if (verbose && found == false)
@@ -1114,9 +1185,9 @@
     }
 
   if (something_changed == true)
-    {
-      write_archive (arch);
-    }
+    write_archive (arch);
+  else
+    output_filename = NULL;
 }
 
 
@@ -1267,6 +1338,8 @@
 
   if (changed)
     write_archive (arch);
+  else
+    output_filename = NULL;
 }
 
 static void
@@ -1296,7 +1369,7 @@
   bfd *arch;
   char **matching;
 
-  f = open (archname, O_RDWR, 0);
+  f = open (archname, O_RDWR | O_BINARY, 0);
   if (f < 0)
     {
       bfd_set_error (bfd_error_system_call);
diff --git a/binutils/arparse.y b/binutils/arparse.y
index d6c7600..a5e90fa 100644
--- a/binutils/arparse.y
+++ b/binutils/arparse.y
@@ -193,7 +193,7 @@
 
 static int
 yyerror (x)
-     const char *x;
+     const char *x ATTRIBUTE_UNUSED;
 {
   extern int linenumber;
 
diff --git a/binutils/arsup.c b/binutils/arsup.c
index 38fd695..d6809fc 100644
--- a/binutils/arsup.c
+++ b/binutils/arsup.c
@@ -1,5 +1,6 @@
 /* arsup.c - Archive support for MRI compatibility
-   Copyright (C) 1992, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -95,7 +96,7 @@
 static void
 ar_directory_doer (abfd, ignore)
      bfd *abfd;
-     bfd *ignore;
+     bfd *ignore ATTRIBUTE_UNUSED;
 {
     print_arelt_descr(outfile, abfd, verbose);
 }
diff --git a/binutils/binutils.texi b/binutils/binutils.texi
index 5f7c646..99f72fe 100644
--- a/binutils/binutils.texi
+++ b/binutils/binutils.texi
@@ -5,15 +5,28 @@
 @ifinfo
 @format
 START-INFO-DIR-ENTRY
-* Binutils: (binutils).         The GNU binary utilities "ar", "objcopy",
-				"objdump", "nm", "nlmconv", "size", "readelf"
-                                "strings", "strip", "ranlib" and "dlltool".
+* Binutils: (binutils).         The GNU binary utilities.
+* ar: (binutils)ar.               Create, modify, and extract from archives
+* nm: (binutils)nm.               List symbols from object files
+* objcopy: (binutils)objcopy.	  Copy and translate object files
+* objdump: (binutils)objdump.     Display information from object files
+* ranlib: (binutils)ranlib.       Generate index to archive contents
+* readelf: (binutils)readelf.	  Display the contents of ELF format files.
+* size: (binutils)size.           List section sizes and total size
+* strings: (binutils)strings.     List printable strings from files
+* strip: (binutils)strip.         Discard symbols
+* c++filt: (binutils)c++filt.	  Filter to demangle encoded C++ symbols
+* cxxfilt: (binutils)c++filt.     MS-DOS name for c++filt
+* addr2line: (binutils)addr2line. Convert addresses to file and line
+* nlmconv: (binutils)nlmconv.     Converts object code into an NLM
+* windres: (binutils)windres.	  Manipulate Windows resources
+* dlltool: (binutils)dlltool.	  Create files needed to build and use DLLs
 END-INFO-DIR-ENTRY
 @end format
 @end ifinfo
 
 @ifinfo
-Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 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
@@ -41,7 +54,7 @@
 @c This file documents the GNU binary utilities "ar", "ld", "objcopy",
 @c  "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib".
 @c
-@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 @c 
 @c This text may be freely distributed under the terms of the GNU
 @c General Public License.
@@ -118,7 +131,8 @@
 Discard symbols
 
 @item c++filt
-Demangle encoded C++ symbols
+Demangle encoded C++ symbols (on MS-DOS, this program is named
+@code{cxxfilt})
 
 @item addr2line
 Convert addresses into file names and line numbers
@@ -145,6 +159,7 @@
 * strings::                     List printable strings from files
 * strip::                       Discard symbols
 * c++filt::			Filter to demangle encoded C++ symbols
+* cxxfilt: c++filt.             MS-DOS name for c++filt
 * addr2line::			Convert addresses to file and line
 * nlmconv::                     Converts object code into an NLM
 * windres::			Manipulate Windows resources
@@ -161,7 +176,7 @@
 @cindex archives
 @cindex collections of files
 @smallexample
-ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
+ar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
 ar -M [ <mri-script ]
 @end smallexample
 
@@ -219,7 +234,7 @@
 @section Controlling @code{ar} on the command line
 
 @smallexample
-ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
+ar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
 @end smallexample
 
 @cindex Unix compatibility, @code{ar}
@@ -383,12 +398,25 @@
 @c whaffor ar l modifier??? presumably compat; with
 @c what???---doc@@cygnus.com, 25jan91 
 
+@item N
+Uses the @var{count} parameter.  This is used if there are multiple
+entries in the archive with the same name.  Extract or delete instance
+@var{count} of the given name from the archive.
+
 @item o
 @cindex dates in archive
 Preserve the @emph{original} dates of members when extracting them.  If
 you do not specify this modifier, files extracted from the archive
 are stamped with the time of extraction.
 
+@item P
+Use the full path name when matching names in the archive.  @sc{gnu}
+@code{ar} can not create an archive with a full path name (such archives
+are not POSIX complaint), but other archive creators can.  This option
+will cause @sc{gnu} @code{ar} to match file names using a complete path
+name, which can be convenient when extracting a single file from an
+archive created by another tool.
+
 @item s
 @cindex writing archive index
 Write an object-file index into the archive, or update an existing one,
@@ -554,7 +582,7 @@
 @item LIST
 Display full contents of the current archive, in ``verbose'' style
 regardless of the state of @code{VERBOSE}.  The effect is like @samp{ar
-tv @var{archive}}).  (This single command is a @sc{gnu} @code{ld}
+tv @var{archive}}.  (This single command is a @sc{gnu} @code{ar}
 enhancement, rather than present for MRI compatibility.)
 
 Requires prior use of @code{OPEN} or @code{CREATE}.
@@ -613,7 +641,7 @@
 @end smallexample
 
 @sc{gnu} @code{nm} lists the symbols from object files @var{objfile}@dots{}.
-If no object files are listed as arguments, @code{nm} assumes
+If no object files are listed as arguments, @code{nm} assumes the file
 @file{a.out}.
 
 For each symbol, @code{nm} shows:
@@ -672,11 +700,18 @@
 @item U
 The symbol is undefined.
 
+@item V
+The symbol is a weak object.  When a weak defined symbol is linked with
+a normal defined symbol, the normal defined symbol is used with no error.
+When a weak undefined symbol is linked and the symbol is not defined,
+the value of the weak symbol becomes zero with no error.
+
 @item W
-The symbol is weak.  When a weak defined symbol is linked with a normal
-defined symbol, the normal defined symbol is used with no error.  When a
-weak undefined symbol is linked and the symbol is not defined, the value
-of the weak symbol becomes zero with no error.
+The symbol is a weak symbol that has not been specifically tagged as a
+weak object symbol.  When a weak defined symbol is linked with a normal
+defined symbol, the normal defined symbol is used with no error.
+When a weak undefined symbol is linked and the symbol is not defined,
+the value of the weak symbol becomes zero with no error.
 
 @item -
 The symbol is a stabs symbol in an a.out object file.  In this case, the
@@ -703,7 +738,7 @@
 @cindex input file name
 @cindex file name
 @cindex source file name
-Precede each symbol by the name of the input file (or archive element)
+Precede each symbol by the name of the input file (or archive member)
 in which it was found, rather than identifying the input file once only,
 before all of its symbols.
 
@@ -837,6 +872,7 @@
         [ -x | --discard-all ]  [ -X | --discard-locals ]
         [ -b @var{byte} | --byte=@var{byte} ]
         [ -i @var{interleave} | --interleave=@var{interleave} ]
+        [ -j @var{sectionname} | --only-section=@var{sectionname} ]
         [ -R @var{sectionname} | --remove-section=@var{sectionname} ]
         [ -p | --preserve-dates ] [ --debugging ]
         [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ]
@@ -879,12 +915,12 @@
 When generating an S-record or a raw binary file, it may be helpful to
 use @samp{-S} to remove sections containing debugging information.  In
 some cases @samp{-R} will be useful to remove sections which contain
-information which is not needed by the binary file.
+information that is not needed by the binary file.
 
 @table @code
 @item @var{infile}
 @itemx @var{outfile}
-The source and output files, respectively.
+The input and output files, respectively.
 If you do not specify @var{outfile}, @code{objcopy} creates a
 temporary file and destructively renames the result with
 the name of @var{infile}.
@@ -905,6 +941,12 @@
 file; i.e., simply transfer data from source to destination with no
 translation.  @xref{Target Selection}, for more information.
 
+@item -j @var{sectionname}
+@itemx --only-section=@var{sectionname}
+Copy only the named section from the input file to the output file.
+This option may be given more than once.  Note that using this option
+inappropriately may make the output file unusable.
+
 @item -R @var{sectionname}
 @itemx --remove-section=@var{sectionname}
 Remove any section named @var{sectionname} from the output file.  This
@@ -989,7 +1031,7 @@
 filled in with the value specified by @samp{--gap-fill} (default zero).
 
 @item --set-start @var{val}
-Set the address of the new file to @var{val}.  Not all object file
+Set the start address of the new file to @var{val}.  Not all object file
 formats support setting the start address.
 
 @item --change-start @var{incr}
@@ -1060,12 +1102,13 @@
 @item --set-section-flags @var{section}=@var{flags}
 Set the flags for the named section.  The @var{flags} argument is a
 comma separated string of flag names.  The recognized names are
-@samp{alloc}, @samp{contents}, @samp{load}, @samp{readonly},
-@samp{code}, @samp{data}, and @samp{rom}.  You can set the
-@samp{contents} flag for a section which does not have contents, but it
-is not meaningful to clear the @samp{contents} flag of a section which
-does have contents--just remove the section instead.  Not all flags are
-meaningful for all object file formats.
+@samp{alloc}, @samp{contents}, @samp{load}, @samp{noload},
+@samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and
+@samp{debug}.  You can set the @samp{contents} flag for a section which
+does not have contents, but it is not meaningful to clear the
+@samp{contents} flag of a section which does have contents--just remove
+the section instead.  Not all flags are meaningful for all object file
+formats.
 
 @item --add-section @var{sectionname}=@var{filename}
 Add a new section named @var{sectionname} while copying the file.  The
@@ -1121,24 +1164,38 @@
 
 @smallexample
 objdump [ -a | --archive-headers ] 
-        [ -b @var{bfdname} | --target=@var{bfdname} ] [ --debugging ]
-        [ -C | --demangle ] [ -d | --disassemble ]
-        [ -D | --disassemble-all ] [ --disassemble-zeroes ]
+        [ -b @var{bfdname} | --target=@var{bfdname} ] 
+        [ -C | --demangle ]
+        [ -d | --disassemble ]
+        [ -D | --disassemble-all ]
+        [ -z | --disassemble-zeroes ]
         [ -EB | -EL | --endian=@{big | little @} ]
         [ -f | --file-headers ]
-        [ -h | --section-headers | --headers ]  [ -i | --info ]
+        [ --file-start-context ]
+        [ -g | --debugging ]
+        [ -h | --section-headers | --headers ]
+        [ -i | --info ]
         [ -j @var{section} | --section=@var{section} ]
-        [ -l | --line-numbers ] [ -S | --source ]
+        [ -l | --line-numbers ]
+        [ -S | --source ]
         [ -m @var{machine} | --architecture=@var{machine} ]
+        [ -M @var{options} | --disassembler-options=@var{options}]
         [ -p | --private-headers ]
-        [ -r | --reloc ] [ -R | --dynamic-reloc ]
-        [ -s | --full-contents ]  [ --stabs ]
-        [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ]
-        [ -w | --wide ] [ --start-address=@var{address} ]
+        [ -r | --reloc ]
+        [ -R | --dynamic-reloc ]
+        [ -s | --full-contents ]
+        [ -G | --stabs ]
+        [ -t | --syms ]
+        [ -T | --dynamic-syms ]
+        [ -x | --all-headers ]
+        [ -w | --wide ]
+        [ --start-address=@var{address} ]
         [ --stop-address=@var{address} ]
-        [ --prefix-addresses] [ --[no-]show-raw-insn ]
+        [ --prefix-addresses]
+        [ --[no-]show-raw-insn ]
         [ --adjust-vma=@var{offset} ]
-        [ --version ]  [ --help ]
+        [ -V | --version ]
+        [ -H | --help ]
         @var{objfile}@dots{}
 @end smallexample
 
@@ -1153,7 +1210,8 @@
 object files.
 
 The long and short forms of options, shown here as alternatives, are
-equivalent.  At least one option besides @samp{-l} must be given.
+equivalent.  At least one option from the list
+@samp{-a,-d,-D,-f,-g,-G,-h,-H,-p,-r,-R,-S,-t,-T,-V,-x} must be given. 
 
 @table @code
 @item -a
@@ -1199,6 +1257,7 @@
 makes C++ function names readable.  @xref{c++filt}, for more information
 on demangling.
 
+@item -G
 @item --debugging
 Display debugging information.  This attempts to parse debugging
 information stored in the file and print it out using a C like syntax.
@@ -1241,6 +1300,12 @@
 Display summary information from the overall header of
 each of the @var{objfile} files.
 
+@item --file-start-context
+@cindex source code context
+Specify that when displaying interlisted source code/disassembly
+(assumes '-S') from a file that has not yet been displayed, extend the
+context to the start of the file.
+
 @item -h
 @itemx --section-header
 @itemx --header
@@ -1288,6 +1353,31 @@
 architecture information, such as S-records.  You can list the available
 architectures with the @samp{-i} option.
 
+@item -M @var{options}
+@itemx --disassembler-options=@var{options}
+Pass target specific information to the disassembler.  Only supported on
+some targets.
+
+If the target is an ARM architecture then this switch can be used to
+select which register name set is used during disassembler.  Specifying
+@samp{-M reg-name-std} (the default) will select the register names as
+used in ARM's instruction set documentation, but with register 13 called
+'sp', register 14 called 'lr' and register 15 called 'pc'.  Specifying
+@samp{-M reg-names-apcs} will select the name set used by the ARM
+Procedure Call Standard, whilst specifying @samp{-M reg-names-raw} will
+just use @samp{r} followed by the register number.
+
+There are also two variants on the APCS register naming scheme enabled
+by @samp{-M reg-names-atpcs} and @samp{-M reg-names-special-atpcs} which
+use the ARM/Thumb Procedure Call Standard naming conventions.  (Eiuther
+with the normal register name sor the special register names).
+
+This option can also be used for ARM architectures to force the
+disassembler to interpret all instructions as THUMB instructions by
+using the switch @samp{--disassembler-options=force-thumb}.  This can be
+useful when attempting to disassemble thumb code produced by other
+compilers.
+
 @item -p
 @itemx --private-headers
 Print information that is specific to the object file format.  The exact
@@ -1330,6 +1420,7 @@
 When disassembling instructions, do not print the instruction bytes.
 This is the default when @code{--prefix-addresses} is used.
 
+@item -G
 @item --stabs
 @cindex stab
 @cindex .stab
@@ -1413,6 +1504,7 @@
 @table @code
 @item -v
 @itemx -V
+@itemx --version
 Show the version number of @code{ranlib}.
 @end table
 
@@ -1456,7 +1548,7 @@
 Here is an example of the Berkeley (default) format of output from
 @code{size}: 
 @smallexample
-size --format=Berkeley ranlib size
+$ size --format=Berkeley ranlib size
 text    data    bss     dec     hex     filename
 294880  81920   11592   388392  5ed28   ranlib
 294880  81920   11888   388688  5ee50   size
@@ -1466,7 +1558,7 @@
 This is the same data, but displayed closer to System V conventions:
 
 @smallexample
-size --format=SysV ranlib size
+$ size --format=SysV ranlib size
 ranlib  :
 section         size         addr
 .text         294880         8192       
@@ -1684,7 +1776,7 @@
 archives, @samp{strip -v} lists all members of the archive.
 @end table
 
-@node c++filt
+@node c++filt, addr2line, strip, Top
 @chapter c++filt
 
 @kindex c++filt
@@ -1698,13 +1790,17 @@
         [ --help ]  [ --version ]  [ @var{symbol}@dots{} ]
 @end smallexample
 
+@kindex cxxfilt
 The C++ and Java languages provides function overloading, which means
 that you can write many functions with the same name (providing each
 takes parameters of different types).  All C++ and Java function names
 are encoded into a low-level assembly label (this process is known as
-@dfn{mangling}). The @code{c++filt} program does the inverse mapping: it
-decodes (@dfn{demangles}) low-level names into user-level names so that
-the linker can keep these overloaded functions from clashing.
+@dfn{mangling}). The @code{c++filt}
+@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
+MS-DOS this program is named @code{cxxfilt}.}
+program does the inverse mapping: it decodes (@dfn{demangles}) low-level
+names into user-level names so that the linker can keep these overloaded
+functions from clashing.
 
 Every alphanumeric word (consisting of letters, digits, underscores,
 dollars, or periods) seen in the input is a potential label.  If the
@@ -1803,7 +1899,7 @@
 number are associated with a given address.
 
 The executable to use is specified with the @code{-e} option.  The
-default is @file{a.out}.
+default is the file @file{a.out}.
 
 @code{addr2line} has two modes of operation.
 
@@ -2048,15 +2144,31 @@
 option.  @code{windres} will also search this directory when looking for
 files named in the @code{rc} file.
 
-@item --define @var{sym[=val]}
+@item -D @var{target}
+@itemx --define @var{sym}[=@var{val}]
 Specify a @code{-D} option to pass to the preprocessor when reading an
 @code{rc} file.
 
+@item -v
+Enable verbose mode.  This tells you what the preprocessor is if you
+didn't specify one.
+
 @item --language @var{val}
 Specify the default language to use when reading an @code{rc} file.
 @var{val} should be a hexadecimal language code.  The low eight bits are
 the language, and the high eight bits are the sublanguage.
 
+@item --use-temp-file
+Use a temporary file to instead of using popen to read the output of
+the preprocessor. Use this option if the popen implementation is buggy 
+on the host (eg., certain non-English language versions of Windows 95 and 
+Windows 98 are known to have buggy popen where the output will instead
+go the console).
+
+@item --no-use-temp-file
+Use popen, not a temporary file, to read the output of the preprocessor.
+This is the default behaviour.
+
 @item --help
 Prints a usage summary.
 
@@ -2326,6 +2438,7 @@
         [ -S | --section-headers | --sections]
         [ -e | --headers]
         [ -s | --syms | --symbols]
+        [ -n | --notes]
         [ -r | --relocs]
         [ -d | --dynamic]
         [ -V | --version-info]
@@ -2354,7 +2467,8 @@
 @itemx --all
 Equivalent to specifiying @samp{--file-header},
 @samp{--program-headers}, @samp{--sections}, @samp{--symbols},
-@samp{--relocs}, @samp{--dynamic} and @samp{--version-info}.
+@samp{--relocs}, @samp{--dynamic}, @samp{--notes} and
+@samp{--version-info}. 
 
 @item -h
 @itemx --file-header
@@ -2387,6 +2501,11 @@
 @itemx --headers
 Display all the headers in the file.  Equivalent to @samp{-h -l -S}.
 
+@item -n
+@itemx --notes
+@cindex ELF core notes
+Displays the contents of the NOTE segment, if it exists.
+
 @item -r
 @itemx --relocs
 @cindex ELF reloc information
@@ -2483,9 +2602,9 @@
 @samp{a.out-sunos-big}.
 
 You can also specify a target using a configuration triplet.  This is
-the same sort of name that is passed to configure to specify a target.
-When you use a configuration triplet as an argument, it must be fully
-canonicalized.  You can see the canonical version of a triplet by
+the same sort of name that is passed to @file{configure} to specify a
+target.  When you use a configuration triplet as an argument, it must be
+fully canonicalized.  You can see the canonical version of a triplet by
 running the shell script @file{config.sub} which is included with the
 sources.
 
@@ -2807,9 +2926,10 @@
 A complete input file, or set of input files, that will reproduce the
 bug.  If the utility is reading an object file or files, then it is
 generally most helpful to send the actual object files, uuencoded if
-necessary to get them through the mail system.  Making them available
-for anonymous FTP is not as good, but may be the only reasonable choice
-for large object files.
+necessary to get them through the mail system.  Note that
+@samp{bug-gnu-utils@@gnu.org} is a mailing list, so you should avoid
+sending very large files to it.  Making the files available for
+anonymous FTP is OK.
 
 If the source files were produced exclusively using @sc{gnu} programs
 (e.g., @code{gcc}, @code{gas}, and/or the @sc{gnu} @code{ld}), then it
@@ -2828,7 +2948,7 @@
 a chance to make a mistake.
 
 Even if the problem you experience is a fatal signal, you should still
-say so explicitly.  Suppose something strange is going on, such as, your
+say so explicitly.  Suppose something strange is going on, such as your
 copy of the utility is out of synch, or you have encountered a bug in
 the C library on your system.  (This has happened!)  Your copy might
 crash and ours would not.  If you told us to expect a crash, then when
@@ -2840,8 +2960,8 @@
 If you wish to suggest changes to the source, send us context diffs, as
 generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p}
 option.  Always send diffs from the old file to the new file.  If you
-even discuss something in the @code{ld} source, refer to it by context,
-not by line number.
+wish to discuss something in the @code{ld} source, refer to it by
+context, not by line number.
 
 The line numbers in our development sources will not match those in your
 sources.  Your line numbers would convey no useful information to us.
diff --git a/binutils/config.in b/binutils/config.in
index 38272dd..3c26c5c 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -151,6 +151,12 @@
 /* Define as 1 if you have gettext and don't want to use GNU gettext. */
 #undef HAVE_GETTEXT
 
+/* Does the platform use an executable suffix? */
+#undef HAVE_EXECUTABLE_SUFFIX
+
+/* Suffix used for executables, if any. */
+#undef EXECUTABLE_SUFFIX
+
 /* Is the type time_t defined in <time.h>? */
 #undef HAVE_TIME_T_IN_TIME_H
 
diff --git a/binutils/configure b/binutils/configure
index 594e154..65f6612 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -20,7 +20,7 @@
 ac_help="$ac_help
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
 ac_help="$ac_help
-  --disable-libtool-lock  force libtool not to do file locking"
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
   --enable-targets        alternative target configurations"
 ac_help="$ac_help
@@ -49,6 +49,7 @@
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -163,6 +164,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
@@ -333,6 +335,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=*)
@@ -498,12 +505,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
@@ -590,7 +601,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:594: checking host system type" >&5
+echo "configure:605: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -611,7 +622,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:615: checking target system type" >&5
+echo "configure:626: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -629,7 +640,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:633: checking build system type" >&5
+echo "configure:644: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -664,7 +675,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:668: checking for a BSD compatible install" >&5
+echo "configure:679: 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
@@ -717,7 +728,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:721: checking whether build environment is sane" >&5
+echo "configure:732: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -774,7 +785,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:778: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:789: 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
@@ -803,7 +814,7 @@
 
 PACKAGE=binutils
 
-VERSION=2.9.4
+VERSION=2.9.5
 
 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; }
@@ -820,7 +831,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:824: checking for working aclocal" >&5
+echo "configure:835: 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.
@@ -833,7 +844,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:837: checking for working autoconf" >&5
+echo "configure:848: 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.
@@ -846,7 +857,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:850: checking for working automake" >&5
+echo "configure:861: 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.
@@ -859,7 +870,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:863: checking for working autoheader" >&5
+echo "configure:874: 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.
@@ -872,7 +883,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:876: checking for working makeinfo" >&5
+echo "configure:887: 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.
@@ -958,7 +969,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:962: checking for $ac_word" >&5
+echo "configure:973: 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
@@ -988,7 +999,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:992: checking for $ac_word" >&5
+echo "configure:1003: 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
@@ -1018,7 +1029,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:1022: checking for $ac_word" >&5
+echo "configure:1033: 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
@@ -1069,7 +1080,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:1073: checking for $ac_word" >&5
+echo "configure:1084: 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
@@ -1101,7 +1112,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1105: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1116: 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.
@@ -1112,12 +1123,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1116 "configure"
+#line 1127 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1132: \"$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
@@ -1143,12 +1154,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:1147: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1158: 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:1152: checking whether we are using GNU C" >&5
+echo "configure:1163: 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
@@ -1157,7 +1168,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1161: \"$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:1172: \"$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
@@ -1176,7 +1187,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1180: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1191: 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
@@ -1219,11 +1230,11 @@
 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:1223: checking for ld used by GCC" >&5
+echo "configure:1234: 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]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
@@ -1243,19 +1254,19 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1247: checking for GNU ld" >&5
+echo "configure:1258: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1250: checking for non-GNU ld" >&5
+echo "configure:1261: 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
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -1280,9 +1291,8 @@
   echo "$ac_t""no" 1>&6
 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:1286: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1296: 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
@@ -1298,7 +1308,7 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1302: checking for BSD-compatible nm" >&5
+echo "configure:1312: 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
@@ -1306,10 +1316,10 @@
   # Let the user override the test.
   ac_cv_path_NM="$NM"
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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; then
+    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
@@ -1333,213 +1343,8 @@
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
-# 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
-echo "configure:1340: checking command to parse $NM output" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  # 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.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* 	\($ac_symcode\) 	 	*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if { (eval echo configure:1403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if { (eval echo configure:1407: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&5
-	    cat conftest.c >&5
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&5
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.c >&5
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-
-fi
-
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-echo "$ac_t""$ac_result" 1>&6
-
-echo $ac_n "checking for _ prefix in compiled symbols""... $ac_c" 1>&6
-echo "configure:1505: checking for _ prefix in compiled symbols" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_symbol_underscore'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if { (eval echo configure:1514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if { (eval echo configure:1517: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&5
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&5
-  fi
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.c >&5
-fi
-rm -rf conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_sys_symbol_underscore" 1>&6
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1543: checking whether ln -s works" >&5
+echo "configure:1348: 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
@@ -1559,30 +1364,37 @@
   echo "$ac_t""no" 1>&6
 fi
 
-if test $host != $build; then
-  ac_tool_prefix=${host_alias}-
-else
-  ac_tool_prefix=
-fi
 
+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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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"
 
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1585 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1586: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1397 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1603,19 +1415,19 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1607: checking whether the C compiler needs -belf" >&5
+echo "configure:1419: 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 1612 "configure"
+#line 1424 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1431: \"$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
@@ -1634,161 +1446,9 @@
   fi
   ;;
 
-*-*-cygwin*)
-  # 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:1642: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1674: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  DLLTOOL="false"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1709: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1741: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  AS="false"
-fi
-fi
-
-
-  ;;
 
 esac
 
-# enable the --disable-libtool-lock switch
-
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval="$enable_libtool_lock"
-  need_locks=$enableval
-else
-  need_locks=yes
-fi
-
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
-
 
 # Save cache, so that ltconfig can load it
 cat > confcache <<\EOF
@@ -1841,10 +1501,11 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
@@ -1902,7 +1563,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:1906: checking for $ac_word" >&5
+echo "configure:1567: 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
@@ -1932,7 +1593,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:1936: checking for $ac_word" >&5
+echo "configure:1597: 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
@@ -1983,7 +1644,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:1987: checking for $ac_word" >&5
+echo "configure:1648: 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
@@ -2015,7 +1676,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2019: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1680: 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.
@@ -2026,12 +1687,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2030 "configure"
+#line 1691 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1696: \"$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
@@ -2057,12 +1718,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:2061: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1722: 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:2066: checking whether we are using GNU C" >&5
+echo "configure:1727: 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
@@ -2071,7 +1732,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2075: \"$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:1736: \"$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
@@ -2090,7 +1751,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2094: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1755: 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
@@ -2127,7 +1788,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:2131: checking for $ac_word" >&5
+echo "configure:1792: 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
@@ -2158,7 +1819,7 @@
 test -n "$YACC" || YACC="yacc"
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2162: checking how to run the C preprocessor" >&5
+echo "configure:1823: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2173,13 +1834,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2177 "configure"
+#line 1838 "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:2183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1844: \"$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
   :
@@ -2190,13 +1851,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2194 "configure"
+#line 1855 "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:2200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1861: \"$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
   :
@@ -2207,13 +1868,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2211 "configure"
+#line 1872 "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:2217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1878: \"$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
   :
@@ -2243,7 +1904,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:2247: checking for $ac_word" >&5
+echo "configure:1908: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2276,7 +1937,7 @@
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2280: checking for $ac_word" >&5
+echo "configure:1941: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2310,7 +1971,7 @@
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:2314: checking for yywrap in -l$ac_lib" >&5
+echo "configure:1975: checking for yywrap in -l$ac_lib" >&5
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2318,7 +1979,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2322 "configure"
+#line 1983 "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
@@ -2329,7 +1990,7 @@
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1994: \"$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
@@ -2352,7 +2013,7 @@
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:2356: checking lex output file root" >&5
+echo "configure:2017: checking lex output file root" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2373,7 +2034,7 @@
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:2377: checking whether yytext is a pointer" >&5
+echo "configure:2038: checking whether yytext is a pointer" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2385,14 +2046,14 @@
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 2389 "configure"
+#line 2050 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2396: \"$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_prog_lex_yytext_pointer=yes
 else
@@ -2416,7 +2077,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:2420: checking for POSIXized ISC" >&5
+echo "configure:2081: 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
@@ -2437,12 +2098,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2441: checking for ANSI C header files" >&5
+echo "configure:2102: 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 2446 "configure"
+#line 2107 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2450,7 +2111,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2454: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2115: \"$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*
@@ -2467,7 +2128,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 2471 "configure"
+#line 2132 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2485,7 +2146,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 2489 "configure"
+#line 2150 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2506,7 +2167,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2510 "configure"
+#line 2171 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2517,7 +2178,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2541,12 +2202,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2545: checking for working const" >&5
+echo "configure:2206: 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 2550 "configure"
+#line 2211 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2595,7 +2256,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2616,21 +2277,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2620: checking for inline" >&5
+echo "configure:2281: 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 2627 "configure"
+#line 2288 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2634: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2656,12 +2317,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2660: checking for off_t" >&5
+echo "configure:2321: 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 2665 "configure"
+#line 2326 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2689,12 +2350,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2693: checking for size_t" >&5
+echo "configure:2354: 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 2698 "configure"
+#line 2359 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2724,19 +2385,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:2728: checking for working alloca.h" >&5
+echo "configure:2389: 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 2733 "configure"
+#line 2394 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2401: \"$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
@@ -2757,12 +2418,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2761: checking for alloca" >&5
+echo "configure:2422: 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 2766 "configure"
+#line 2427 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2790,7 +2451,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2794: \"$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*
   ac_cv_func_alloca_works=yes
 else
@@ -2822,12 +2483,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2826: checking whether alloca needs Cray hooks" >&5
+echo "configure:2487: 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 2831 "configure"
+#line 2492 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2852,12 +2513,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:2856: checking for $ac_func" >&5
+echo "configure:2517: 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 2861 "configure"
+#line 2522 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2880,7 +2541,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2545: \"$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
@@ -2907,7 +2568,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2911: checking stack direction for C alloca" >&5
+echo "configure:2572: 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
@@ -2915,7 +2576,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2919 "configure"
+#line 2580 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2934,7 +2595,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2599: \"$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
@@ -2959,17 +2620,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2963: checking for $ac_hdr" >&5
+echo "configure:2624: 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 2968 "configure"
+#line 2629 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2973: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2634: \"$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*
@@ -2998,12 +2659,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3002: checking for $ac_func" >&5
+echo "configure:2663: 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 3007 "configure"
+#line 2668 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3026,7 +2687,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2691: \"$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
@@ -3051,7 +2712,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3055: checking for working mmap" >&5
+echo "configure:2716: 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
@@ -3059,7 +2720,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3063 "configure"
+#line 2724 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3199,7 +2860,7 @@
 }
 
 EOF
-if { (eval echo configure:3203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2864: \"$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
@@ -3227,17 +2888,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3231: checking for $ac_hdr" >&5
+echo "configure:2892: 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 3236 "configure"
+#line 2897 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2902: \"$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*
@@ -3267,12 +2928,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3271: checking for $ac_func" >&5
+echo "configure:2932: 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 3276 "configure"
+#line 2937 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3295,7 +2956,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2960: \"$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
@@ -3324,12 +2985,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3328: checking for $ac_func" >&5
+echo "configure:2989: 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 3333 "configure"
+#line 2994 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3352,7 +3013,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3017: \"$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
@@ -3386,19 +3047,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3390: checking for LC_MESSAGES" >&5
+echo "configure:3051: 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 3395 "configure"
+#line 3056 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3063: \"$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
@@ -3419,7 +3080,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3423: checking whether NLS is requested" >&5
+echo "configure:3084: 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"
@@ -3439,7 +3100,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3443: checking whether included gettext is requested" >&5
+echo "configure:3104: 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"
@@ -3458,17 +3119,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3462: checking for libintl.h" >&5
+echo "configure:3123: 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 3467 "configure"
+#line 3128 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3133: \"$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*
@@ -3485,19 +3146,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:3489: checking for gettext in libc" >&5
+echo "configure:3150: 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 3494 "configure"
+#line 3155 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3162: \"$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
@@ -3513,7 +3174,7 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3517: checking for bindtextdomain in -lintl" >&5
+echo "configure:3178: 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
@@ -3521,7 +3182,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3525 "configure"
+#line 3186 "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
@@ -3532,7 +3193,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3197: \"$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
@@ -3548,19 +3209,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:3552: checking for gettext in libintl" >&5
+echo "configure:3213: 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 3557 "configure"
+#line 3218 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3225: \"$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
@@ -3588,7 +3249,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:3592: checking for $ac_word" >&5
+echo "configure:3253: 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
@@ -3622,12 +3283,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3626: checking for $ac_func" >&5
+echo "configure:3287: 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 3631 "configure"
+#line 3292 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3650,7 +3311,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3315: \"$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
@@ -3677,7 +3338,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:3681: checking for $ac_word" >&5
+echo "configure:3342: 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
@@ -3713,7 +3374,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:3717: checking for $ac_word" >&5
+echo "configure:3378: 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
@@ -3745,7 +3406,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3749 "configure"
+#line 3410 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3753,7 +3414,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3785,7 +3446,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:3789: checking for $ac_word" >&5
+echo "configure:3450: 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
@@ -3819,7 +3480,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:3823: checking for $ac_word" >&5
+echo "configure:3484: 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
@@ -3855,7 +3516,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:3859: checking for $ac_word" >&5
+echo "configure:3520: 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
@@ -3945,7 +3606,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3949: checking for catalogs to be installed" >&5
+echo "configure:3610: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3973,17 +3634,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:3977: checking for linux/version.h" >&5
+echo "configure:3638: 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 3982 "configure"
+#line 3643 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3648: \"$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*
@@ -4046,7 +3707,7 @@
   
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4050: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:3711: 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"
@@ -4069,12 +3730,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:4073: checking for Cygwin environment" >&5
+echo "configure:3734: 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 4078 "configure"
+#line 3739 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4085,7 +3746,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:4089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -4102,19 +3763,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:4106: checking for mingw32 environment" >&5
+echo "configure:3767: 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 4111 "configure"
+#line 3772 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:4118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -4133,7 +3794,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4137: checking for executable suffix" >&5
+echo "configure:3798: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4143,7 +3804,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:4147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:3808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -4163,6 +3824,16 @@
 echo "$ac_t""${ac_cv_exeext}" 1>&6
 ac_exeext=$EXEEXT
 
+if test -n "$EXEEXT"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_EXECUTABLE_SUFFIX 1
+EOF
+
+fi
+cat >> confdefs.h <<EOF
+#define EXECUTABLE_SUFFIX "${EXEEXT}"
+EOF
+
 
 # host-specific stuff:
 
@@ -4176,7 +3847,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:4180: checking for $ac_word" >&5
+echo "configure:3851: 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
@@ -4215,7 +3886,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:4219: checking for a BSD compatible install" >&5
+echo "configure:3890: 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
@@ -4282,19 +3953,22 @@
   EXEEXT_FOR_BUILD='$(EXEEXT)'
 else
   echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4286: checking for build system executable suffix" >&5
+echo "configure:3957: 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
-  cat > ac_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-    ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
-    bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
-    rm -f ac_c_test*
-    test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
+  rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     bfd_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
 fi
 
 echo "$ac_t""$bfd_cv_build_exeext" 1>&6
@@ -4303,21 +3977,28 @@
 fi
 
 
+DEMANGLER_NAME=c++filt
+case "${host}" in
+  *-*-go32* | *-*-msdos*)
+    DEMANGLER_NAME=cxxfilt
+esac
+
+
 for ac_hdr in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4311: checking for $ac_hdr" >&5
+echo "configure:3992: 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 4316 "configure"
+#line 3997 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4002: \"$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*
@@ -4344,12 +4025,12 @@
 done
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4348: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4029: 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 4353 "configure"
+#line 4034 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -4365,7 +4046,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:4369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -4388,19 +4069,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:4392: checking for working alloca.h" >&5
+echo "configure:4073: 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 4397 "configure"
+#line 4078 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:4404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4085: \"$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
@@ -4421,12 +4102,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4425: checking for alloca" >&5
+echo "configure:4106: 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 4430 "configure"
+#line 4111 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -4454,7 +4135,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:4458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4139: \"$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
@@ -4486,12 +4167,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4490: checking whether alloca needs Cray hooks" >&5
+echo "configure:4171: 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 4495 "configure"
+#line 4176 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -4516,12 +4197,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:4520: checking for $ac_func" >&5
+echo "configure:4201: 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 4525 "configure"
+#line 4206 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4544,7 +4225,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4229: \"$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
@@ -4571,7 +4252,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:4575: checking stack direction for C alloca" >&5
+echo "configure:4256: 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
@@ -4579,7 +4260,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 4583 "configure"
+#line 4264 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -4598,7 +4279,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:4602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4283: \"$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
@@ -4622,12 +4303,12 @@
 for ac_func in sbrk utimes
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4626: checking for $ac_func" >&5
+echo "configure:4307: 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 4631 "configure"
+#line 4312 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4650,7 +4331,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4335: \"$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
@@ -4675,20 +4356,84 @@
 done
 
 
+# Some systems have frexp only in -lm, not in -lc.
+
+echo $ac_n "checking for library containing frexp""... $ac_c" 1>&6
+echo "configure:4363: checking for library containing frexp" >&5
+if eval "test \"`echo '$''{'ac_cv_search_frexp'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_frexp="no"
+cat > conftest.$ac_ext <<EOF
+#line 4370 "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 frexp();
+
+int main() {
+frexp()
+; return 0; }
+EOF
+if { (eval echo configure:4381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_search_frexp="none required"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+test "$ac_cv_search_frexp" = "no" && for i in m; do
+LIBS="-l$i  $ac_func_search_save_LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4392 "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 frexp();
+
+int main() {
+frexp()
+; return 0; }
+EOF
+if { (eval echo configure:4403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_search_frexp="-l$i"
+break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+LIBS="$ac_func_search_save_LIBS"
+fi
+
+echo "$ac_t""$ac_cv_search_frexp" 1>&6
+if test "$ac_cv_search_frexp" != "no"; then
+  test "$ac_cv_search_frexp" = "none required" || LIBS="$ac_cv_search_frexp $LIBS"
+  
+else :
+  
+fi
+
 echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6
-echo "configure:4680: checking for time_t in time.h" >&5
+echo "configure:4425: checking for time_t in time.h" >&5
 if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4685 "configure"
+#line 4430 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 time_t i;
 ; return 0; }
 EOF
-if { (eval echo configure:4692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bu_cv_decl_time_t_time_h=yes
 else
@@ -4709,19 +4454,19 @@
 fi
 
 echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4713: checking for time_t in sys/types.h" >&5
+echo "configure:4458: checking for time_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4718 "configure"
+#line 4463 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 time_t i;
 ; return 0; }
 EOF
-if { (eval echo configure:4725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bu_cv_decl_time_t_types_h=yes
 else
@@ -4744,12 +4489,12 @@
 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
 # by default.
 echo $ac_n "checking for utime.h""... $ac_c" 1>&6
-echo "configure:4748: checking for utime.h" >&5
+echo "configure:4493: checking for utime.h" >&5
 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4753 "configure"
+#line 4498 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_TIME_H
@@ -4760,7 +4505,7 @@
 struct utimbuf s;
 ; return 0; }
 EOF
-if { (eval echo configure:4764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bu_cv_header_utime_h=yes
 else
@@ -4781,12 +4526,12 @@
 fi
 
 echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6
-echo "configure:4785: checking whether fprintf must be declared" >&5
+echo "configure:4530: checking whether fprintf must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4790 "configure"
+#line 4535 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4807,7 +4552,7 @@
 char *(*pfn) = (char *(*)) fprintf
 ; return 0; }
 EOF
-if { (eval echo configure:4811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4556: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_fprintf=no
 else
@@ -4828,12 +4573,12 @@
 fi
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4832: checking whether strstr must be declared" >&5
+echo "configure:4577: 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 4837 "configure"
+#line 4582 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4854,7 +4599,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:4858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -4875,12 +4620,12 @@
 fi
 
 echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
-echo "configure:4879: checking whether sbrk must be declared" >&5
+echo "configure:4624: checking whether sbrk must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4884 "configure"
+#line 4629 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4901,7 +4646,7 @@
 char *(*pfn) = (char *(*)) sbrk
 ; return 0; }
 EOF
-if { (eval echo configure:4905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_sbrk=no
 else
@@ -4922,12 +4667,12 @@
 fi
 
 echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4926: checking whether getenv must be declared" >&5
+echo "configure:4671: 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 4931 "configure"
+#line 4676 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4948,7 +4693,7 @@
 char *(*pfn) = (char *(*)) getenv
 ; return 0; }
 EOF
-if { (eval echo configure:4952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_getenv=no
 else
@@ -4969,12 +4714,12 @@
 fi
 
 echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6
-echo "configure:4973: checking whether environ must be declared" >&5
+echo "configure:4718: checking whether environ must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4978 "configure"
+#line 4723 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4995,7 +4740,7 @@
 char *(*pfn) = (char *(*)) environ
 ; return 0; }
 EOF
-if { (eval echo configure:4999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_environ=no
 else
@@ -5018,7 +4763,7 @@
 
 
 case "${host}" in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
   cat >> confdefs.h <<\EOF
 #define USE_BINARY_FOPEN 1
 EOF
@@ -5031,7 +4776,7 @@
 if test -n "$enable_targets"; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result"; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -5081,27 +4826,50 @@
 	*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
 	esac
 	case $targ in
-	arm-*pe*)
+	arm-*pe* | arm-*-wince)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
 	thumb-*pe*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
 	i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
 	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
+	i3-686-*-interix)
+	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
+	  ;;
 	powerpc*-*-*pe* | powerpc*-*-cygwin*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
+	sh*-*-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mips*-*-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mcore-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mcore-*elf)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
+	  ;;
 	esac
     fi
 done
@@ -5290,12 +5058,7 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
-s%@USE_SYMBOL_UNDERSCORE@%$USE_SYMBOL_UNDERSCORE%g
 s%@LN_S@%$LN_S%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@AS@%$AS%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@YACC@%$YACC%g
 s%@LEX@%$LEX%g
@@ -5331,6 +5094,7 @@
 s%@AR@%$AR%g
 s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
 s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g
+s%@DEMANGLER_NAME@%$DEMANGLER_NAME%g
 s%@NLMCONV_DEFS@%$NLMCONV_DEFS%g
 s%@BUILD_NLMCONV@%$BUILD_NLMCONV%g
 s%@BUILD_SRCONV@%$BUILD_SRCONV%g
diff --git a/binutils/configure.bat b/binutils/configure.bat
deleted file mode 100755
index f7d70f1..0000000
--- a/binutils/configure.bat
+++ /dev/null
@@ -1,63 +0,0 @@
-@echo off

-if "%1" == "h8/300" goto h8300

-

-echo Configuring binutils for go32

-update ../bfd/hosts/go32.h sysdep.h

-goto common

-

-:h8300

-echo Configuring binutils for H8/300

-update ..\bfd\hosts\h-go32.h sysdep.h

-

-:common

-

-echo # Makefile generated by "configure.bat"> Makefile

-

-if exist config.sed del config.sed

-

-sed -n "/^VERSION=/ p" Makefile.in | sed -e "s/^/s^/" -e "s/=/^\"/" -e "s/$/\"^/" > config.sed

-sed -f config.sed version.c > version2.c

-

-if exist config.sed del config.sed

-

-echo "s/version\./version2\./g				">> config.sed

-echo "s/-DVERSION=[^ ]* //				">> config.sed

-

-echo "s/^	\$(srcdir)\/move-if-change/	update/	">> config.sed

-echo "/^###$/ i\					">> config.sed

-echo "CC = gcc						">> config.sed

-echo "s/:\([^ 	]\)/: \1/g				">> config.sed

-echo "s/^	\ *\.\//	go32 /			">> config.sed

-echo "s/`echo \$(srcdir)\///g				">> config.sed

-echo "s/ | sed 's,\^\\\.\/,,'`//g			">> config.sed

-echo "s/^	cd \$(srcdir)[ 	]*;//			">> config.sed

-

-echo "/^arparse\.c/ i\					">> config.sed

-echo "arparse.o: arparse.c\				">> config.sed

-echo "	$(CC) -c $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) arparse.c ">> config.sed

-echo "/\$(BISON)/ c\					">> config.sed

-echo "	bison $(BISONFLAGS) -o $@ arparse.y		">> config.sed

-echo "/y\.tab\./ d					">> config.sed

-

-echo "/^arlex.c/ {					">> config.sed

-echo " i\						">> config.sed

-echo "arlex.o: arlex.c					">> config.sed

-echo " i\						">> config.sed

-echo "	$(CC) -c $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) arlex.c ">> config.sed

-echo "}							">> config.sed

-echo "/\$(LEX)/ c\					">> config.sed

-echo "	flex $(LEX_OPTIONS) arlex.l			">> config.sed

-echo "s/lex\.yy\./lexyy./g				">> config.sed

-

-echo "s/'"/\\"/g					">> config.sed

-echo "s/"'/\\"/g					">> config.sed

-

-echo "s/c++filt/cxxfilt/g				">> config.sed

-

-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ 	]*$//" config.sed > config2.sed

-sed -f config2.sed Makefile.in >> Makefile

-del config.sed

-del config2.sed

-

-echo int prepends_underscore = 1; > underscore.c

-

diff --git a/binutils/configure.in b/binutils/configure.in
index 298dcd8..aa10ce9 100644
--- a/binutils/configure.in
+++ b/binutils/configure.in
@@ -5,7 +5,7 @@
 
 AC_CANONICAL_SYSTEM
 
-AM_INIT_AUTOMAKE(binutils, 2.9.4)
+AM_INIT_AUTOMAKE(binutils, 2.9.5)
 
 AM_PROG_LIBTOOL
 
@@ -44,6 +44,12 @@
 
 AM_MAINTAINER_MODE
 AC_EXEEXT
+if test -n "$EXEEXT"; then
+  AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
+	    [Does the platform use an executable suffix?])
+fi
+AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
+		   [Suffix used for executables, if any.])
 
 # host-specific stuff:
 
@@ -59,11 +65,21 @@
 
 BFD_CC_FOR_BUILD
 
+DEMANGLER_NAME=c++filt
+case "${host}" in
+  *-*-go32* | *-*-msdos*)
+    DEMANGLER_NAME=cxxfilt
+esac
+AC_SUBST(DEMANGLER_NAME)
+
 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
 AC_HEADER_SYS_WAIT
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(sbrk utimes)
 
+# Some systems have frexp only in -lm, not in -lc.
+AC_SEARCH_LIBS(frexp, m)
+
 AC_MSG_CHECKING(for time_t in time.h)
 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
@@ -114,7 +130,7 @@
 if test -n "$enable_targets"; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result"; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -166,16 +182,16 @@
 	*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
 	esac
 	case $targ in
-	arm-*pe*)
+	arm-*pe* | arm-*-wince)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
 	thumb-*pe*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
 changequote(,)dnl
 	i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
 changequote([,])dnl
@@ -183,12 +199,35 @@
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
 	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
+	i[3-6]86-*-interix)
+	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
+	  ;;
 	powerpc*-*-*pe* | powerpc*-*-cygwin*)
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
-	 ;;
+	  ;;
+	sh*-*-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mips*-*-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mcore-*pe)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  ;;
+	mcore-*elf)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
+	  ;;
 	esac
     fi
 done
diff --git a/binutils/debug.c b/binutils/debug.c
index 173d627..82a9094 100644
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -1,5 +1,5 @@
 /* debug.c -- Handle generic debugging information.
-   Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -603,7 +603,7 @@
 
 static struct debug_name *
 debug_add_to_namespace (info, nsp, name, kind, linkage)
-     struct debug_handle *info;
+     struct debug_handle *info ATTRIBUTE_UNUSED;
      struct debug_namespace **nsp;
      const char *name;
      enum debug_object_kind kind;
@@ -1039,8 +1039,8 @@
 
 boolean
 debug_start_common_block (handle, name)
-     PTR handle;
-     const char *name;
+     PTR handle ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
 {
   /* FIXME */
   debug_error (_("debug_start_common_block: not implemented"));
@@ -1051,8 +1051,8 @@
 
 boolean
 debug_end_common_block (handle, name)
-     PTR handle;
-     const char *name;
+     PTR handle ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
 {
   /* FIXME */
   debug_error (_("debug_end_common_block: not implemented"));
@@ -1143,10 +1143,10 @@
 
 boolean
 debug_record_label (handle, name, type, addr)
-     PTR handle;
-     const char *name;
-     debug_type type;
-     bfd_vma addr;
+     PTR handle ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
+     debug_type type ATTRIBUTE_UNUSED;
+     bfd_vma addr ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   debug_error (_("debug_record_label not implemented"));
@@ -1219,7 +1219,7 @@
 /*ARGSUSED*/
 static struct debug_type *
 debug_make_type (info, kind, size)
-     struct debug_handle *info;
+     struct debug_handle *info ATTRIBUTE_UNUSED;
      enum debug_type_kind kind;
      unsigned int size;
 {
@@ -1781,7 +1781,7 @@
 /*ARGSUSED*/
 debug_baseclass
 debug_make_baseclass (handle, type, bitpos, virtual, visibility)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_type type;
      bfd_vma bitpos;
      boolean virtual;
@@ -1809,7 +1809,7 @@
 /*ARGSUSED*/
 debug_field
 debug_make_field (handle, name, type, bitpos, bitsize, visibility)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      const char *name;
      debug_type type;
      bfd_vma bitpos;
@@ -1840,7 +1840,7 @@
 /*ARGSUSED*/
 debug_field
 debug_make_static_member (handle, name, type, physname, visibility)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      const char *name;
      debug_type type;
      const char *physname;
@@ -1866,7 +1866,7 @@
 /*ARGSUSED*/
 debug_method
 debug_make_method (handle, name, variants)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      const char *name;
      debug_method_variant *variants;
 {
@@ -1894,7 +1894,7 @@
 debug_method_variant
 debug_make_method_variant (handle, physname, type, visibility, constp,
 			   volatilep, voffset, context)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      const char *physname;
      debug_type type;
      enum debug_visibility visibility;
@@ -1926,7 +1926,7 @@
 debug_method_variant
 debug_make_static_method_variant (handle, physname, type, visibility,
 				  constp, volatilep)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      const char *physname;
      debug_type type;
      enum debug_visibility visibility;
@@ -1988,7 +1988,7 @@
   nm = debug_add_to_namespace (info, &info->current_file->globals, name,
 			       DEBUG_OBJECT_TYPE, DEBUG_LINKAGE_NONE);
   if (nm == NULL)
-    return false;
+    return DEBUG_TYPE_NULL;
 
   nm->u.type = t;
 
@@ -2044,7 +2044,7 @@
   nm = debug_add_to_namespace (info, &info->current_file->globals, name,
 			       DEBUG_OBJECT_TAG, DEBUG_LINKAGE_NONE);
   if (nm == NULL)
-    return false;
+    return DEBUG_TYPE_NULL;
 
   nm->u.tag = t;
 
@@ -2058,7 +2058,7 @@
 /*ARGSUSED*/
 boolean
 debug_record_type_size (handle, type, size)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_type type;
      unsigned int size;
 {
@@ -2394,7 +2394,7 @@
 /*ARGSUSED*/
 debug_type
 debug_get_field_type (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL)
@@ -2407,7 +2407,7 @@
 /*ARGSUSED*/
 const char *
 debug_get_field_name (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL)
@@ -2420,7 +2420,7 @@
 /*ARGSUSED*/
 bfd_vma
 debug_get_field_bitpos (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL || field->static_member)
@@ -2433,7 +2433,7 @@
 /*ARGSUSED*/
 bfd_vma
 debug_get_field_bitsize (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL || field->static_member)
@@ -2446,7 +2446,7 @@
 /*ARGSUSED*/
 enum debug_visibility
 debug_get_field_visibility (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL)
@@ -2458,7 +2458,7 @@
 
 const char *
 debug_get_field_physname (handle, field)
-     PTR handle;
+     PTR handle ATTRIBUTE_UNUSED;
      debug_field field;
 {
   if (field == NULL || ! field->static_member)
@@ -2598,7 +2598,7 @@
 {
   unsigned int i;
   int is;
-  const char *tag;
+  const char *tag = NULL;
 
   /* If we have a name for this type, just output it.  We only output
      typedef names after they have been defined.  We output type tags
@@ -2648,7 +2648,6 @@
   if (name != NULL)
     name->mark = info->mark;
 
-  tag = NULL;
   if (name != NULL
       && type->kind != DEBUG_KIND_NAMED
       && type->kind != DEBUG_KIND_TAGGED)
diff --git a/binutils/deflex.l b/binutils/deflex.l
index e7fa362..15a43c0 100644
--- a/binutils/deflex.l
+++ b/binutils/deflex.l
@@ -1,6 +1,6 @@
 %{/* deflex.l - Lexer for .def files */
 
-/*   Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/*   Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -50,11 +50,18 @@
 "WRITE"		{ return WRITE;}
 "EXECUTE"	{ return EXECUTE;}
 "SHARED"	{ return SHARED;}
+"NONSHARED"	{ return NONSHARED;}
+"SINGLE"	{ return SINGLE;}
+"MULTIPLE"	{ return MULTIPLE;}
+"INITINSTANCE"	{ return INITINSTANCE;}
+"INITGLOBAL"	{ return INITGLOBAL;}
+"TERMINSTANCE"	{ return TERMINSTANCE;}
+"TERMGLOBAL"	{ return TERMGLOBAL;}
 
 [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); 
 		return NUMBER; }
 
-[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]+ { 	
+[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]* { 	
 		yylval.id =  xstrdup (yytext);
 		return ID;
 		}
diff --git a/binutils/defparse.y b/binutils/defparse.y
index 1cb6360..5718d46 100644
--- a/binutils/defparse.y
+++ b/binutils/defparse.y
@@ -1,6 +1,6 @@
 %{ /* defparse.y - parser for .def files */
 
-/*   Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/*   Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -30,7 +30,8 @@
 
 %token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
 %token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT
-%token READ WRITE EXECUTE SHARED NONAME
+%token READ WRITE EXECUTE SHARED NONSHARED NONAME
+%token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL
 %token <id> ID
 %token <number> NUMBER
 %type  <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
@@ -45,7 +46,7 @@
 
 command: 
 		NAME opt_name opt_base { def_name ($2, $3); }
-	|	LIBRARY opt_name opt_base { def_library ($2, $3); }
+	|	LIBRARY opt_name opt_base option_list { def_library ($2, $3); }
 	|	EXPORTS explist 
 	|	DESCRIPTION ID { def_description ($2);}
 	|	STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
@@ -61,7 +62,6 @@
 
 explist:
 		/* EMPTY */
-	|	expline
 	|	explist expline
 	;
 
@@ -108,10 +108,13 @@
 	;
 	
 attr:
-		READ { $$ = 1;}
-	|	WRITE { $$ = 2;}	
-	|	EXECUTE { $$=4;}
-	|	SHARED { $$=8;}
+		READ { $$ = 1; }
+	|	WRITE { $$ = 2; }
+	|	EXECUTE { $$ = 4; }
+	|	SHARED { $$ = 8; }
+	|	NONSHARED { $$ = 0; }
+	|	SINGLE { $$ = 0; }
+	|	MULTIPLE { $$ = 0; }
 	;
 
 opt_CONSTANT:
@@ -153,5 +156,14 @@
 	|	{ $$=-1;}
 	;
 
-	
+option_list:
+		/* empty */
+	|	option_list opt_comma option
+	;
 
+option:
+		INITINSTANCE
+	|	INITGLOBAL
+	|	TERMINSTANCE
+	|	TERMGLOBAL
+	;
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index ed5cf5e..4189b5e 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1,5 +1,5 @@
 /* dlltool.c -- tool to generate stuff for PE style DLLs
-   Copyright (C) 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -121,16 +121,16 @@
      printf ("hello from the dll and the other entry point %s\n", s);
    }
 
-   printf()
+   int printf (void)
    {
      return 9;
    }
 
- main.c
-
-   void main()
+ themain.c:
+   int main (void)
    {
-     cdef();
+     cdef ();
+     return 0;
    }
 
  thedll.def
@@ -143,29 +143,54 @@
    SECTIONS donkey READ WRITE
    aardvark EXECUTE
 
- # compile up the parts of the dll
+ # Compile up the parts of the dll and the program
 
-   gcc -c file1.c
-   gcc -c file2.c
+   gcc -c file1.c file2.c themain.c
 
- # put them in a library (you don't have to, you
- # could name all the .os on the dlltool line)
+ # Optional: put the dll objects into a library
+ # (you don't have to, you could name all the object
+ # files on the dlltool line)
 
    ar  qcv thedll.in file1.o file2.o
    ranlib thedll.in
 
- # run this tool over the library and the def file
-   ./dlltool --def thedll.def --output-exp thedll.o --output-lib thedll.a
+ # Run this tool over the DLL's .def file and generate an exports
+ # file (thedll.o) and an imports file (thedll.a).
+ # (You may have to use -S to tell dlltool where to find the assembler).
+ 
+   dlltool --def thedll.def --output-exp thedll.o --output-lib thedll.a
 
- # build the dll with the library with file1.o, file2.o and the export table
+ # Build the dll with the library and the export table
+ 
    ld -o thedll.dll thedll.o thedll.in
 
- # build the mainline
-   gcc -c themain.c
+ # Link the executable with the import library
+ 
+   gcc -o themain.exe themain.o thedll.a
 
- # link the executable with the import library
-   ld -e main -Tthemain.ld -o themain.exe themain.o thedll.a
+ This example can be extended if relocations are needed in the DLL:
 
+ # Compile up the parts of the dll and the program
+
+   gcc -c file1.c file2.c themain.c
+
+ # Run this tool over the DLL's .def file and generate an imports file.
+ 
+   dlltool --def thedll.def --output-lib thedll.lib
+
+ # Link the executable with the import library and generate a base file
+ # at the same time
+ 
+   gcc -o themain.exe themain.o thedll.lib -Wl,--base-file -Wl,themain.base
+
+ # Run this tool over the DLL's .def file and generate an exports file
+ # which includes the relocations from the base file.
+ 
+   dlltool --def thedll.def --base-file themain.base --output-exp thedll.exp
+
+ # Build the dll with file1.o, file2.o and the export table
+ 
+   ld -o thedll.dll thedll.exp file1.o file2.o
  */
 
 /* .idata section description
@@ -221,11 +246,14 @@
 #include "bucomm.h"
 #include "getopt.h"
 #include "demangle.h"
+#include "dyn-string.h"
 #include "dlltool.h"
 
 #include <ctype.h>
 #include <time.h>
-#ifdef __STDC__
+#include <sys/stat.h>
+
+#ifdef ANSI_PROTOTYPES
 #include <stdarg.h>
 #else
 #include <varargs.h>
@@ -236,6 +264,15 @@
 #include "coff/internal.h"
 #endif
 
+/* Forward references.  */
+static char *look_for_prog PARAMS ((const char *, const char *, int));
+static char *deduce_name PARAMS ((const char *));
+
+#ifdef DLLTOOL_MCORE_ELF
+static void mcore_elf_cache_filename (char *);
+static void mcore_elf_gen_out_file (void);
+#endif
+     
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #else /* ! HAVE_SYS_WAIT_H */
@@ -304,7 +341,7 @@
 
 static iheadtype *import_list = NULL;
 
-static char *as_name = "as";
+static char *as_name = NULL;
 static char * as_flags = "";
 
 static int no_idata4;
@@ -319,10 +356,6 @@
 static int add_underscore = 0;
 static int dontdeltemps = 0;
 
-#ifdef DLLTOOL_ARM
-static int interwork = 0;
-#endif 
-
 /* True if we should export all symbols.  Otherwise, we only export
    symbols listed in .drectve sections or in the def file.  */
 static boolean export_all_symbols;
@@ -334,6 +367,10 @@
 /* Default symbols to exclude when exporting all the symbols.  */
 static const char *default_excludes = "DllMain@12,DllEntryPoint@0,impure_ptr";
 
+/* True if we should add __imp_<SYMBOL> to import libraries for backward 
+   compatibility to old Cygwin releases.  */
+static boolean create_compat_implib;
+
 static char *def_file;
 
 extern char * program_name;
@@ -345,10 +382,6 @@
 static FILE *output_def;
 static FILE *base_file;
 
-#ifdef DLLTOOL_BEOS
-static const char *mname = "beos";
-#endif
-
 #ifdef DLLTOOL_ARM
 static const char *mname = "arm";
 #endif
@@ -361,6 +394,31 @@
 static const char *mname = "ppc";
 #endif
 
+#ifdef DLLTOOL_SH
+static const char *mname = "sh";
+#endif
+
+#ifdef DLLTOOL_MIPS
+static const char *mname = "mips";
+#endif
+
+#ifdef DLLTOOL_MCORE
+static const char * mname = "mcore-le";
+#endif
+
+#ifdef DLLTOOL_MCORE_ELF
+static const char * mname = "mcore-elf";
+static char * mcore_elf_out_file = NULL;
+static char * mcore_elf_linker   = NULL;
+static char * mcore_elf_linker_flags = NULL;
+
+#define DRECTVE_SECTION_NAME ((machine == MMCORE_ELF || machine == MMCORE_ELF_LE) ? ".exports" : ".drectve")
+#endif
+
+#ifndef DRECTVE_SECTION_NAME
+#define DRECTVE_SECTION_NAME ".drectve"
+#endif
+
 #define PATHMAX 250		/* What's the right name for this ? */
 
 #define TMP_ASM		"dc.s"
@@ -370,8 +428,7 @@
 #define TMP_TAIL_O	"dt.o"
 #define TMP_STUB	"ds"
 
-/* This bit of assemly does jmp * ....
-s set how_jtab_roff to mark where the 32bit abs branch should go */
+/* This bit of assemly does jmp * .... */
 static const unsigned char i386_jtab[] =
 {
   0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90
@@ -379,22 +436,48 @@
 
 static const unsigned char arm_jtab[] =
 {
-  0x00, 0xc0, 0x9f, 0xe5,
-  0x00, 0xf0, 0x9c, 0xe5,
+  0x00, 0xc0, 0x9f, 0xe5,	/* ldr  ip, [pc] */
+  0x00, 0xf0, 0x9c, 0xe5,	/* ldr  pc, [ip] */
+  0,    0,    0,    0
+};
+
+static const unsigned char arm_interwork_jtab[] =
+{
+  0x04, 0xc0, 0x9f, 0xe5,	/* ldr  ip, [pc] */
+  0x00, 0xc0, 0x9c, 0xe5,	/* ldr  ip, [ip] */
+  0x1c, 0xff, 0x2f, 0xe1,	/* bx   ip       */
   0,    0,    0,    0
 };
 
 static const unsigned char thumb_jtab[] =
 {
-  0xc0, 0xb4,
-  0x02, 0x4e,
-  0x36, 0x68,
-  0x01, 0x96,
-  0x40, 0xbd,
-  0xc0, 0x46,
+  0x40, 0xb4,           /* push {r6}         */
+  0x02, 0x4e,           /* ldr  r6, [pc, #8] */
+  0x36, 0x68,           /* ldr  r6, [r6]     */
+  0xb4, 0x46,           /* mov  ip, r6       */
+  0x40, 0xbc,           /* pop  {r6}         */
+  0x60, 0x47,           /* bx   ip           */
   0,    0,    0,    0
 };
 
+static const unsigned char mcore_be_jtab[] =
+{
+  0x71, 0x02,            /* lrw r1,2       */
+  0x81, 0x01,            /* ld.w r1,(r1,0) */  
+  0x00, 0xC1,            /* jmp r1         */
+  0x12, 0x00,            /* nop            */
+  0x00, 0x00, 0x00, 0x00 /* <address>      */  
+};
+
+static const unsigned char mcore_le_jtab[] =
+{
+  0x02, 0x71,            /* lrw r1,2       */
+  0x01, 0x81,            /* ld.w r1,(r1,0) */  
+  0xC1, 0x00,            /* jmp r1         */
+  0x00, 0x12,            /* nop            */
+  0x00, 0x00, 0x00, 0x00 /* <address>      */  
+};
+
 /* This is the glue sequence for PowerPC PE. There is a  */
 /* tocrel16-tocdefn reloc against the first instruction. */
 /* We also need a IMGLUE reloc against the glue function */
@@ -417,12 +500,6 @@
 static bfd_vma ppc_glue_insn = 0x80410004;
 #endif
 
-/* The outfile array must be big enough to contain a fully
-   qualified path name, plus an arbitary series of command
-   line switches.  We hope that PATH_MAX times two will be
-   enough.  */
-static char outfile [PATHMAX * 2];
-
 struct mac
   {
     const char *type;
@@ -436,6 +513,7 @@
     const char *how_space;
     const char *how_align_short;
     const char *how_align_long;
+    const char *how_default_as_switches;
     const char *how_bfd_target;
     enum bfd_architecture how_bfd_arch;
     const unsigned char *how_jtab;
@@ -450,31 +528,91 @@
 #define MARM 0
     "arm", ".byte", ".short", ".long", ".asciz", "@",
     "ldr\tip,[pc]\n\tldr\tpc,[ip]\n\t.long",
-    ".global", ".space", ".align\t2",".align\t4","pe-arm-little", bfd_arch_arm,
+    ".global", ".space", ".align\t2",".align\t4", "-mapcs-32",
+    "pe-arm-little", bfd_arch_arm,
     arm_jtab, sizeof (arm_jtab), 8
   }
   ,
   {
 #define M386 1
-    "i386", ".byte", ".short", ".long", ".asciz", "#", "jmp *", ".global", ".space", ".align\t2",".align\t4","pe-i386",bfd_arch_i386,
-   i386_jtab, sizeof (i386_jtab), 2
+    "i386", ".byte", ".short", ".long", ".asciz", "#",
+    "jmp *", ".global", ".space", ".align\t2",".align\t4", "",
+    "pe-i386",bfd_arch_i386,
+    i386_jtab, sizeof (i386_jtab), 2
   }
   ,
   {
 #define MPPC 2
-    "ppc", ".byte", ".short", ".long", ".asciz", "#", "jmp *", ".global", ".space", ".align\t2",".align\t4","pe-powerpcle",bfd_arch_powerpc,
-   ppc_jtab, sizeof (ppc_jtab), 0
+    "ppc", ".byte", ".short", ".long", ".asciz", "#",
+    "jmp *", ".global", ".space", ".align\t2",".align\t4", "",
+    "pe-powerpcle",bfd_arch_powerpc,
+    ppc_jtab, sizeof (ppc_jtab), 0
   }
   ,
   {
 #define MTHUMB 3
     "thumb", ".byte", ".short", ".long", ".asciz", "@",
-    "push\t{r6, r7}\n\tldr\tr6, [pc, #8]\n\tldr\tr6, [r6]\n\tstr\tr6, [sp, #4]\n\tpop\t{r6, pc}\n\tnop",
-    ".global", ".space", ".align\t2",".align\t4","pe-arm-little", bfd_arch_arm,
+    "push\t{r6}\n\tldr\tr6, [pc, #8]\n\tldr\tr6, [r6]\n\tmov\tip, r6\n\tpop\t{r6}\n\tbx\tip",
+    ".global", ".space", ".align\t2",".align\t4", "-mthumb-interwork",
+    "pe-arm-little", bfd_arch_arm,
     thumb_jtab, sizeof (thumb_jtab), 12
   }
   ,
-{    0}
+#define MARM_INTERWORK 4
+  {
+    "arm_interwork", ".byte", ".short", ".long", ".asciz", "@",
+    "ldr\tip,[pc]\n\tldr\tip,[ip]\n\tbx\tip\n\t.long",
+    ".global", ".space", ".align\t2",".align\t4", "-mthumb-interwork",
+    "pe-arm-little", bfd_arch_arm,
+    arm_interwork_jtab, sizeof (arm_interwork_jtab), 12
+  }
+  ,
+  {
+#define MMCORE_BE 5
+    "mcore-be", ".byte", ".short", ".long", ".asciz", "//",
+    "lrw r1,[1f]\n\tld.w r1,(r1,0)\n\tjmp r1\n\tnop\n1:.long",
+    ".global", ".space", ".align\t2",".align\t4", "",
+    "pe-mcore-big", bfd_arch_mcore,
+    mcore_be_jtab, sizeof (mcore_be_jtab), 8
+  }
+  ,
+  {
+#define MMCORE_LE 6
+    "mcore-le", ".byte", ".short", ".long", ".asciz", "//",
+    "lrw r1,[1f]\n\tld.w r1,(r1,0)\n\tjmp r1\n\tnop\n1:.long",
+    ".global", ".space", ".align\t2",".align\t4", "-EL",
+    "pe-mcore-little", bfd_arch_mcore,
+    mcore_le_jtab, sizeof (mcore_le_jtab), 8
+  }
+  ,
+  {
+#define MMCORE_ELF 7
+    "mcore-elf-be", ".byte", ".short", ".long", ".asciz", "//",
+    "lrw r1,[1f]\n\tld.w r1,(r1,0)\n\tjmp r1\n\tnop\n1:.long",
+    ".global", ".space", ".align\t2",".align\t4", "",
+    "elf32-mcore-big", bfd_arch_mcore,
+    mcore_be_jtab, sizeof (mcore_be_jtab), 8
+  }
+  ,
+  {
+#define MMCORE_ELF_LE 8
+    "mcore-elf-le", ".byte", ".short", ".long", ".asciz", "//",
+    "lrw r1,[1f]\n\tld.w r1,(r1,0)\n\tjmp r1\n\tnop\n1:.long",
+    ".global", ".space", ".align\t2",".align\t4", "-EL",
+    "elf32-mcore-little", bfd_arch_mcore,
+    mcore_le_jtab, sizeof (mcore_le_jtab), 8
+  }
+  ,
+  {
+#define MARM_EPOC 9
+    "arm", ".byte", ".short", ".long", ".asciz", "@",
+    "ldr\tip,[pc]\n\tldr\tpc,[ip]\n\t.long",
+    ".global", ".space", ".align\t2",".align\t4", "",
+    "epoc-pe-arm-little", bfd_arch_arm,
+    arm_jtab, sizeof (arm_jtab), 8
+  }
+  ,
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 };
 
 typedef struct dlist
@@ -621,6 +759,11 @@
     case M386:
     case MPPC:
     case MTHUMB:
+    case MARM_INTERWORK:
+    case MMCORE_BE:
+    case MMCORE_LE:
+    case MMCORE_ELF:
+    case MMCORE_ELF_LE:
       break;
     default:
       /* xgettext:c-format */
@@ -640,6 +783,11 @@
     case M386:
     case MPPC:
     case MTHUMB:
+    case MARM_INTERWORK:
+    case MMCORE_BE:
+    case MMCORE_LE:
+    case MMCORE_ELF:
+    case MMCORE_ELF_LE:
       return ".rva\t";
     default:
       /* xgettext:c-format */
@@ -658,6 +806,11 @@
     case MARM:
     case MPPC:
     case MTHUMB:
+    case MARM_INTERWORK:
+    case MMCORE_BE:
+    case MMCORE_LE:
+    case MMCORE_ELF:
+    case MMCORE_ELF_LE:
       break;
     case M386:
       return "_";
@@ -681,12 +834,15 @@
 #define ASM_RVA_BEFORE 	rvabefore(machine)
 #define ASM_RVA_AFTER  	rvaafter(machine)
 #define ASM_PREFIX	asm_prefix(machine)
-#define ASM_ALIGN_LONG mtable[machine].how_align_long
-#define HOW_BFD_TARGET  0  /* always default*/
-#define HOW_BFD_ARCH   mtable[machine].how_bfd_arch
-#define HOW_JTAB       mtable[machine].how_jtab
-#define HOW_JTAB_SIZE      mtable[machine].how_jtab_size
-#define HOW_JTAB_ROFF      mtable[machine].how_jtab_roff
+#define ASM_ALIGN_LONG  mtable[machine].how_align_long
+#define HOW_BFD_READ_TARGET  0  /* always default*/
+#define HOW_BFD_WRITE_TARGET mtable[machine].how_bfd_target
+#define HOW_BFD_ARCH    mtable[machine].how_bfd_arch
+#define HOW_JTAB        mtable[machine].how_jtab
+#define HOW_JTAB_SIZE   mtable[machine].how_jtab_size
+#define HOW_JTAB_ROFF   mtable[machine].how_jtab_roff
+#define ASM_SWITCHES    mtable[machine].how_default_as_switches
+
 static char **oav;
 
 void
@@ -728,7 +884,7 @@
 
 int
 yyerror (err)
-     const char *err;
+     const char * err ATTRIBUTE_UNUSED;
 {
   /* xgettext:c-format */
   warn (_("Syntax error in def file %s:%d\n"), def_file, linenumber);
@@ -1071,9 +1227,9 @@
   char *     buf;
   char *     p;
   char *     e;
-  
+
   /* Look for .drectve's */
-  s = bfd_get_section_by_name (abfd, ".drectve");
+  s = bfd_get_section_by_name (abfd, DRECTVE_SECTION_NAME);
   
   if (s == NULL)
     return;
@@ -1084,10 +1240,12 @@
   bfd_get_section_contents (abfd, s, buf, 0, size);
       
   /* xgettext:c-format */
-  inform (_("Sucking in info from .drective section in %s\n"),
-	  bfd_get_filename (abfd));
+  inform (_("Sucking in info from %s section in %s\n"),
+	  DRECTVE_SECTION_NAME, bfd_get_filename (abfd));
 
-  /* Search for -export: strings */
+  /* Search for -export: strings. The exported symbols can optionally
+     have type tags (eg., -export:foo,data), so handle those as well.
+     Currently only data tag is supported.  */
   p = buf;
   e = buf + size;
   while (p < e)
@@ -1097,25 +1255,35 @@
 	{
 	  char * name;
 	  char * c;
+	  flagword flags = BSF_FUNCTION;
 	  
 	  p += 8;
 	  name = p;
-	  while (p < e && *p != ' ' && *p != '-')
+	  while (p < e && *p != ',' && *p != ' ' && *p != '-')
 	    p++;
 	  c = xmalloc (p - name + 1);
 	  memcpy (c, name, p - name);
 	  c[p - name] = 0;
+	  if (p < e && *p == ',')       /* found type tag. */
+	    {
+	      char *tag_start = ++p;
+	      while (p < e && *p != ' ' && *p != '-')
+		p++;
+	      if (strncmp (tag_start, "data", 4) == 0)
+		flags &= ~BSF_FUNCTION;
+	    }
 
 	  /* FIXME: The 5th arg is for the `constant' field.
 	     What should it be?  Not that it matters since it's not
 	     currently useful.  */
-	  def_exports (c, 0, -1, 0, 0, 0);
+	  def_exports (c, 0, -1, 0, 0, ! (flags & BSF_FUNCTION));
 
 	  if (add_stdcall_alias && strchr (c, '@'))
 	    {
 	      char *exported_name = xstrdup (c);
 	      char *atsym = strchr (exported_name, '@');
 	      *atsym = '\0';
+	      /* Note: stdcall alias symbols can never be data.  */
 	      def_exports (exported_name, xstrdup (c), -1, 0, 0, 0);
 	    }
 	}
@@ -1157,13 +1325,15 @@
       if (bfd_get_symbol_leading_char (abfd) == symbol_name[0])
 	++symbol_name;
 
-      def_exports (xstrdup (symbol_name) , 0, -1, 0, 0, 0);
+      def_exports (xstrdup (symbol_name) , 0, -1, 0, 0,
+		   ! (sym->flags & BSF_FUNCTION));
 
       if (add_stdcall_alias && strchr (symbol_name, '@'))
         {
 	  char *exported_name = xstrdup (symbol_name);
 	  char *atsym = strchr (exported_name, '@');
 	  *atsym = '\0';
+	  /* Note: stdcall alias symbols can never be data. */
 	  def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0);
 	}
     }
@@ -1327,7 +1497,7 @@
   /* FIXME: we ought to read in and block out the base relocations */
 
   /* xgettext:c-format */
-  inform (_("%s: Done reading %s\n"), bfd_get_filename (abfd));
+  inform (_("Done reading %s\n"), bfd_get_filename (abfd));
 }
 
 static void
@@ -1353,10 +1523,20 @@
 	  bfd_close (arfile);
 	  arfile = bfd_openr_next_archived_file (f, arfile);
 	}
+      
+#ifdef DLLTOOL_MCORE_ELF
+      if (mcore_elf_out_file)
+	inform (_("Cannot produce mcore-elf dll from archive file: %s"), filename);
+#endif
     }
   else if (bfd_check_format (f, bfd_object))
     {
       scan_open_obj_file (f);
+
+#ifdef DLLTOOL_MCORE_ELF
+      if (mcore_elf_out_file)
+	mcore_elf_cache_filename ((char *) filename);
+#endif
     }
 
   bfd_close (f);
@@ -1416,10 +1596,17 @@
 	   ASM_LONG,
 	   (on_page * 2) + (on_page & 1) * 2 + 8,
 	   ASM_C);
+  
   for (i = 0; i < on_page; i++)
     {
-      fprintf (f, "\t%s\t0x%lx\n", ASM_SHORT, (need[i] - page_addr) | 0x3000);
+      long needed = need[i];
+      
+      if (needed)
+	needed = ((needed - page_addr) | 0x3000) & 0xffff;
+  
+      fprintf (f, "\t%s\t0x%lx\n", ASM_SHORT, needed);
     }
+  
   /* And padding */
   if (on_page & 1)
     fprintf (f, "\t%s\t0x%x\n", ASM_SHORT, 0 | 0x0000);
@@ -1575,6 +1762,22 @@
     }
 }
 
+/* Assemble the specified file. */
+static void
+assemble_file (source, dest)
+     const char * source;
+     const char * dest;
+{
+  char * cmd;
+  
+  cmd = (char *) alloca (strlen (ASM_SWITCHES) + strlen (as_flags)
+			 + strlen (source) + strlen (dest) + 50);
+
+  sprintf (cmd, "%s %s -o %s %s", ASM_SWITCHES, as_flags, dest, source);
+
+  run (as_name, cmd);
+}
+
 static void
 gen_exp_file ()
 {
@@ -1647,8 +1850,8 @@
 		}
 	    }
 	  fprintf (f, "\t%s%s%s%s\t%s %d\n", ASM_RVA_BEFORE,
-		   ASM_PREFIX,
-		   exp->internal_name, ASM_RVA_AFTER, ASM_C, exp->ordinal);
+                   ASM_PREFIX,
+                   exp->internal_name, ASM_RVA_AFTER, ASM_C, exp->ordinal);
 	  i++;
 	}
 
@@ -1678,12 +1881,13 @@
 
       if (a_list)
 	{
-	  fprintf (f, "\t.section .drectve\n");
+	  fprintf (f, "\t.section %s\n", DRECTVE_SECTION_NAME);
 	  for (dl = a_list; dl; dl = dl->next)
 	    {
 	      fprintf (f, "\t%s\t\"%s\"\n", ASM_TEXT, dl->text);
 	    }
 	}
+      
       if (d_list)
 	{
 	  fprintf (f, "\t.section .rdata\n");
@@ -1691,9 +1895,9 @@
 	    {
 	      char *p;
 	      int l;
-	      /* We dont output as ascii 'cause there can
-	         be quote characters in the string */
-
+	      
+	      /* We don't output as ascii because there can
+	         be quote characters in the string.  */
 	      l = 0;
 	      for (p = dl->text; *p; p++)
 		{
@@ -1719,7 +1923,7 @@
 
 
   /* Add to the output file a way of getting to the exported names
-     without using the import library. */
+     without using the import library.  */
   if (add_indirect)
     {
       fprintf (f, "\t.section\t.rdata\n");
@@ -1729,9 +1933,11 @@
 	    /* We use a single underscore for MS compatibility, and a
                double underscore for backward compatibility with old
                cygwin releases.  */
-	    fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
+	    if (create_compat_implib)
+	      fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
 	    fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name);
-	    fprintf (f, "__imp_%s:\n", exp->name);
+	    if (create_compat_implib)
+	      fprintf (f, "__imp_%s:\n", exp->name);
 	    fprintf (f, "_imp__%s:\n", exp->name);
 	    fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name);
 	  }
@@ -1765,8 +1971,6 @@
 	  int src;
 	  int dst = 0;
 	  int last = -1;
-	  int totsize = 0;
-
 	  qsort (copy, num_entries, sizeof (long), sfunc);
 	  /* Delete duplcates */
 	  for (src = 0; src < num_entries; src++)
@@ -1780,31 +1984,18 @@
 	  on_page = 0;
 	  for (j = 0; j < num_entries; j++)
 	    {
-	      totsize += 2;
 	      addr = copy[j];
 	      if ((addr & PAGE_MASK) != page_addr)
 		{
-		  totsize += 8 + (on_page & 1)*2;
 		  flush_page (f, need, page_addr, on_page);
 		  on_page = 0;
 		  page_addr = addr & PAGE_MASK;
 		}
 	      need[on_page++] = addr;
 	    }
-
-	  /* Pad the section to an even 32-byte boundary.  This will make
-	     the BeOS loader much happier, and shouldn't matter for other
-	     OSes. */
-	  while ((totsize + 8 + (on_page & 1)*2) % 32 != 0)
-	    {
-	      /* 0x0000 is an absolute relocation that should be ignored.  */
-	      need[on_page++] = 0x0000;
-	      totsize += 2;
-	    }
-
 	  flush_page (f, need, page_addr, on_page);
 
-	  /* fprintf (f, "\t%s\t0,0\t%s End\n", ASM_LONG, ASM_C);*/
+/*	  fprintf (f, "\t%s\t0,0\t%s End\n", ASM_LONG, ASM_C);*/
 	}
     }
 
@@ -1813,15 +2004,8 @@
   fclose (f);
 
   /* assemble the file */
-  sprintf (outfile, "%s -o %s %s", as_flags, exp_name, TMP_ASM);
+  assemble_file (TMP_ASM, exp_name);
 
-#ifdef DLLTOOL_ARM
-  if (interwork)
-    strcat (outfile, " -mthumb-interwork");
-#endif
-  
-  run (as_name, outfile);
-  
   if (dontdeltemps == 0)
     unlink (TMP_ASM);
   
@@ -1900,15 +2084,16 @@
 
 #define NSECS 7
 
+#define INIT_SEC_DATA(id, name, flags, align) { id, name, flags, align, NULL, NULL, NULL, 0, NULL }
 static sinfo secdata[NSECS] =
 {
-  { TEXT,   ".text",    SEC_CODE | SEC_HAS_CONTENTS, 2},
-  { DATA,   ".data",    SEC_DATA,                    2},
-  { BSS,    ".bss",     0,                           2},
-  { IDATA7, ".idata$7", SEC_HAS_CONTENTS,            2},
-  { IDATA5, ".idata$5", SEC_HAS_CONTENTS,            2},
-  { IDATA4, ".idata$4", SEC_HAS_CONTENTS,            2},
-  { IDATA6, ".idata$6", SEC_HAS_CONTENTS,            1}
+  INIT_SEC_DATA (TEXT,   ".text",    SEC_CODE | SEC_HAS_CONTENTS, 2),
+  INIT_SEC_DATA (DATA,   ".data",    SEC_DATA,                    2),
+  INIT_SEC_DATA (BSS,    ".bss",     0,                           2),
+  INIT_SEC_DATA (IDATA7, ".idata$7", SEC_HAS_CONTENTS,            2),
+  INIT_SEC_DATA (IDATA5, ".idata$5", SEC_HAS_CONTENTS,            2),
+  INIT_SEC_DATA (IDATA4, ".idata$4", SEC_HAS_CONTENTS,            2),
+  INIT_SEC_DATA (IDATA6, ".idata$6", SEC_HAS_CONTENTS,            1)
 };
 
 #else
@@ -2001,16 +2186,22 @@
 {
 #if 0
     {
+      char *name;
       FILE *f;
-      char *prefix="d";
-      sprintf (outfile, "%ss%05d.s", prefix, i);
-      f = fopen (outfile, FOPEN_WT);
+      const char *prefix = "d";
+      char *dest;
+
+      name = (char *) alloca (strlen (prefix) + 10);
+      sprintf (name, "%ss%05d.s", prefix, i);
+      f = fopen (name, FOPEN_WT);
       fprintf (f, "\t.text\n");
       fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX, exp->name);
-      fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
+      if (create_compat_implib)
+	fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
       fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name);
-      fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX,
-	       exp->name, ASM_JUMP, exp->name);
+      if (create_compat_implib)
+	fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX,
+		 exp->name, ASM_JUMP, exp->name);
 
       fprintf (f, "\t.section\t.idata$7\t%s To force loading of head\n", ASM_C);
       fprintf (f, "\t%s\t%s\n", ASM_LONG, head_label);
@@ -2019,7 +2210,8 @@
       fprintf (f,"%s Import Address Table\n", ASM_C);
 
       fprintf (f, "\t.section	.idata$5\n");
-      fprintf (f, "__imp_%s:\n", exp->name);
+      if (create_compat_implib)
+	fprintf (f, "__imp_%s:\n", exp->name);
       fprintf (f, "_imp__%s:\n", exp->name);
 
       dump_iat (f, exp);
@@ -2039,15 +2231,9 @@
 
       fclose (f);
 
-      sprintf (outfile, "%s -o %ss%05d.o %ss%d.s",
-	       as_flags, prefix, i, prefix, i);
-
-#ifdef DLLTOOL_ARM
-      if (interwork)
-	strcat (outfile, " -mthumb-interwork");
-#endif
-  
-      run (as_name, outfile);
+      dest = (char *) alloca (strlen (prefix) + 10);
+      sprintf (dest, "%ss%05d.o", prefix, i);
+      assemble_file (name, dest);
     }
 #else /* if 0 */
     {
@@ -2074,7 +2260,7 @@
       
       sprintf (outname, "%s%05d.o", TMP_STUB, i);
       
-      abfd = bfd_openw (outname, HOW_BFD_TARGET);
+      abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
       
       if (!abfd)
 	/* xgettext:c-format */
@@ -2087,7 +2273,7 @@
       bfd_set_arch_mach (abfd, HOW_BFD_ARCH, 0);
 
 #ifdef DLLTOOL_ARM
-      if (interwork)
+      if (machine == MARM_INTERWORK || machine == MTHUMB)
 	bfd_set_private_flags (abfd, F_INTERWORK);
 #endif
       
@@ -2146,13 +2332,16 @@
       /* Generate imp symbols with one underscore for Microsoft
          compatibility, and with two underscores for backward
          compatibility with old versions of cygwin.  */
-      iname = bfd_make_empty_symbol(abfd);
-      iname->name = make_label ("__imp_", exp->name);
-      iname->section = secdata[IDATA5].sec;
-      iname->flags = BSF_GLOBAL;
-      iname->value = 0;
+      if (create_compat_implib)
+	{
+	  iname = bfd_make_empty_symbol (abfd);
+	  iname->name = make_label ("__imp_", exp->name);
+	  iname->section = secdata[IDATA5].sec;
+	  iname->flags = BSF_GLOBAL;
+	  iname->value = 0;
+	}
 
-      iname2 = bfd_make_empty_symbol(abfd);
+      iname2 = bfd_make_empty_symbol (abfd);
       iname2->name = make_label ("_imp__", exp->name);
       iname2->section = secdata[IDATA5].sec;
       iname2->flags = BSF_GLOBAL;
@@ -2167,7 +2356,8 @@
 
 
       iname_pp = ptrs + oidx;
-      ptrs[oidx++] = iname;
+      if (create_compat_implib)
+	ptrs[oidx++] = iname;
       ptrs[oidx++] = iname2;
 
       iname_lab_pp = ptrs + oidx;
@@ -2451,7 +2641,7 @@
 
       bfd_set_symtab (abfd, ptrs, oidx);
       bfd_close (abfd);
-      abfd = bfd_openr (outname, HOW_BFD_TARGET);
+      abfd = bfd_openr (outname, HOW_BFD_READ_TARGET);
       return abfd;
     }
 #endif
@@ -2460,8 +2650,14 @@
 static bfd *
 make_head ()
 {
-  FILE *  f = fopen (TMP_HEAD_S, FOPEN_WT);
+  FILE *f = fopen (TMP_HEAD_S, FOPEN_WT);
 
+  if (f == NULL)
+    {
+      fatal (_("failed to open temporary head file: %s"), TMP_HEAD_S);
+      return NULL;
+    }
+  
   fprintf (f, "%s IMAGE_IMPORT_DESCRIPTOR\n", ASM_C);
   fprintf (f, "\t.section	.idata$2\n");
 
@@ -2493,6 +2689,7 @@
       fprintf (f, "\t%s\t0\n", ASM_LONG);
       fprintf (f, "fthunk:\n");
     }
+  
   if (!no_idata4)
     {
       fprintf (f, "\t.section\t.idata$4\n");
@@ -2501,30 +2698,31 @@
       fprintf (f, "\t.section	.idata$4\n");
       fprintf (f, "hname:\n");
     }
+  
   fclose (f);
 
-  sprintf (outfile, "%s -o %s %s", as_flags, TMP_HEAD_O, TMP_HEAD_S);
-  
-#ifdef DLLTOOL_ARM
-  if (interwork)
-    strcat (outfile, " -mthumb-interwork");
-#endif
-  
-  run (as_name, outfile);
+  assemble_file (TMP_HEAD_S, TMP_HEAD_O);
 
-  return  bfd_openr (TMP_HEAD_O, HOW_BFD_TARGET);
+  return bfd_openr (TMP_HEAD_O, HOW_BFD_READ_TARGET);
 }
 
 static bfd *
 make_tail ()
 {
-  FILE *  f = fopen (TMP_TAIL_S, FOPEN_WT);
+  FILE *f = fopen (TMP_TAIL_S, FOPEN_WT);
 
+  if (f == NULL)
+    {
+      fatal (_("failed to open temporary tail file: %s"), TMP_TAIL_S);
+      return NULL;
+    }
+  
   if (!no_idata4)
     {
       fprintf (f, "\t.section	.idata$4\n");
       fprintf (f, "\t%s\t0\n", ASM_LONG);
     }
+  
   if (!no_idata5)
     {
       fprintf (f, "\t.section	.idata$5\n");
@@ -2562,16 +2760,9 @@
 
   fclose (f);
 
-  sprintf (outfile, "%s -o %s %s", as_flags, TMP_TAIL_O, TMP_TAIL_S);
+  assemble_file (TMP_TAIL_S, TMP_TAIL_O);
   
-#ifdef DLLTOOL_ARM
-  if (interwork)
-    strcat (outfile, " -mthumb-interwork");
-#endif
-  
-  run (as_name, outfile);
-  
-  return  bfd_openr (TMP_TAIL_O, HOW_BFD_TARGET);
+  return  bfd_openr (TMP_TAIL_O, HOW_BFD_READ_TARGET);
 }
 
 static void
@@ -2586,7 +2777,7 @@
 
   unlink (imp_name);
 
-  outarch = bfd_openw (imp_name, HOW_BFD_TARGET);
+  outarch = bfd_openw (imp_name, HOW_BFD_WRITE_TARGET);
 
   if (!outarch)
     /* xgettext:c-format */
@@ -2644,12 +2835,15 @@
 
   if (dontdeltemps < 2)
     {
+      char *name;
+
+      name = (char *) alloca (sizeof TMP_STUB + 10);
       for (i = 0, exp = d_exports; exp; i++, exp = exp->next)
 	{
-	  sprintf (outfile, "%s%05d.o", TMP_STUB, i);
-	  if (unlink (outfile) < 0)
+	  sprintf (name, "%s%05d.o", TMP_STUB, i);
+	  if (unlink (name) < 0)
 	    /* xgettext:c-format */
-	    warn (_("cannot delete %s: %s\n"), outfile, strerror (errno));
+	    warn (_("cannot delete %s: %s\n"), name, strerror (errno));
 	}
     }
   
@@ -2708,7 +2902,11 @@
 
 static void
 dtab (ptr)
-     export_type **ptr;
+     export_type ** ptr
+#ifndef SACDEBUG
+ATTRIBUTE_UNUSED
+#endif
+     ;
 {
 #ifdef SACDEBUG
   int i;
@@ -2938,17 +3136,18 @@
   /* xgetext:c-format */
   fprintf (file, _("Usage %s <options> <object-files>\n"), program_name);
   /* xgetext:c-format */
-  fprintf (file, _("   -m --machine <machine>    Create {arm, i386, ppc, thumb} DLL. [default: %s]\n"), mname);
+  fprintf (file, _("   -m --machine <machine>    Create as DLL for <machine>.  [default: %s]\n"), mname);
+  fprintf (file, _("        possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n"));
   fprintf (file, _("   -e --output-exp <outname> Generate an export file.\n"));
   fprintf (file, _("   -l --output-lib <outname> Generate an interface library.\n"));
   fprintf (file, _("   -a --add-indirect         Add dll indirects to export file.\n"));
   fprintf (file, _("   -D --dllname <name>       Name of input dll to put into interface lib.\n"));
   fprintf (file, _("   -d --input-def <deffile>  Name of .def file to be read in.\n"));
   fprintf (file, _("   -z --output-def <deffile> Name of .def file to be created.\n"));
-  fprintf (file, _("   --export-all-symbols      Export all symbols to .def\n"));
-  fprintf (file, _("   --no-export-all-symbols   Only export listed symbols\n"));
-  fprintf (file, _("   --exclude-symbols <list>  Don't export <list>\n"));
-  fprintf (file, _("   --no-default-excludes     Clear default exclude symbols\n"));
+  fprintf (file, _("      --export-all-symbols   Export all symbols to .def\n"));
+  fprintf (file, _("      --no-export-all-symbols  Only export listed symbols\n"));
+  fprintf (file, _("      --exclude-symbols <list> Don't export <list>\n"));
+  fprintf (file, _("      --no-default-excludes  Clear default exclude symbols\n"));
   fprintf (file, _("   -b --base-file <basefile> Read linker generated base file.\n"));
   fprintf (file, _("   -x --no-idata4            Don't generate idata$4 section.\n"));
   fprintf (file, _("   -c --no-idata5            Don't generate idata$5 section.\n"));
@@ -2957,14 +3156,16 @@
   fprintf (file, _("   -A --add-stdcall-alias    Add aliases without @<n>.\n"));
   fprintf (file, _("   -S --as <name>            Use <name> for assembler.\n"));
   fprintf (file, _("   -f --as-flags <flags>     Pass <flags> to the assembler.\n"));
-#ifdef DLLTOOL_ARM
-  fprintf (file, _("   -i --interwork            Support ARM/Thumb interworking.\n"));
-#endif
+  fprintf (file, _("   -C --compat-implib        Create backward compatible import library.\n"));
   fprintf (file, _("   -n --no-delete            Keep temp files (repeat for extra preservation).\n"));
   fprintf (file, _("   -v --verbose              Be verbose.\n"));
   fprintf (file, _("   -V --version              Display the program version.\n"));
   fprintf (file, _("   -h --help                 Display this information.\n"));
-  
+#ifdef DLLTOOL_MCORE_ELF
+  fprintf (file, _("   -M --mcore-elf <outname>  Process mcore-elf object files into <outname>.\n"));
+  fprintf (file, _("   -L --linker <name>        Use <name> as the linker.\n"));
+  fprintf (file, _("   -F --linker-flags <flags> Pass <flags> to the linker.\n"));
+#endif
   exit (status);
 }
 
@@ -2972,15 +3173,13 @@
 #define OPTION_NO_EXPORT_ALL_SYMS	(OPTION_EXPORT_ALL_SYMS + 1)
 #define OPTION_EXCLUDE_SYMS		(OPTION_NO_EXPORT_ALL_SYMS + 1)
 #define OPTION_NO_DEFAULT_EXCLUDES	(OPTION_EXCLUDE_SYMS + 1)
-#define OPTION_NO_IDATA4		'x'
-#define OPTION_NO_IDATA5		'c'
 
 static const struct option long_options[] =
 {
   {"no-delete", no_argument, NULL, 'n'},
   {"dllname", required_argument, NULL, 'D'},
-  {"no-idata4", no_argument, NULL, OPTION_NO_IDATA4},
-  {"no-idata5", no_argument, NULL, OPTION_NO_IDATA5},
+  {"no-idata4", no_argument, NULL, 'x'},
+  {"no-idata5", no_argument, NULL, 'c'},
   {"output-exp", required_argument, NULL, 'e'},
   {"output-def", required_argument, NULL, 'z'},
   {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL_SYMS},
@@ -3001,10 +3200,9 @@
   {"base-file", required_argument, NULL, 'b'},
   {"as", required_argument, NULL, 'S'},
   {"as-flags", required_argument, NULL, 'f'},
-#ifdef DLLTOOL_ARM
-  {"interwork", no_argument, NULL, 'i'},
-#endif
-  {0}
+  {"mcore-elf", required_argument, NULL, 'M'},
+  {"compat-implib", no_argument, NULL, 'C'},
+  {NULL,0,NULL,0}
 };
 
 int
@@ -3024,18 +3222,17 @@
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  while ((c = getopt_long (ac, av, "xcz:S:aD:l:e:nkAvVb:Uh?m:d:f:i",
+  while ((c = getopt_long (ac, av,
+#ifdef DLLTOOL_MCORE_ELF			   
+			   "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVhM:L:F:",
+#else
+			   "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVh",
+#endif
 			   long_options, 0))
 	 != EOF)
     {
       switch (c)
 	{
-	case OPTION_NO_IDATA4:
-	  no_idata4 = 1;
-	  break;
-	case OPTION_NO_IDATA5:
-	  no_idata5 = 1;
-	  break;
 	case OPTION_EXPORT_ALL_SYMS:
 	  export_all_symbols = true;
 	  break;
@@ -3048,6 +3245,12 @@
 	case OPTION_NO_DEFAULT_EXCLUDES:
 	  do_default_excludes = false;
 	  break;
+	case 'x':
+	  no_idata4 = 1;
+	  break;
+	case 'c':
+	  no_idata5 = 1;
+	  break;
 	case 'S':
 	  as_name = optarg;
 	  break;
@@ -3085,18 +3288,6 @@
 	case 'V':
 	  print_version (program_name);
 	  break;
-#ifdef DLLTOOL_ARM
-	case 'i':
-	  interwork = 1;
-	  break;
-#endif
-	case 'y':
-#if 0
-	  /* We don't currently define YYDEBUG when building
-             defparse.y.  */
-	  yydebug = 1;
-#endif
-	  break;
 	case 'U':
 	  add_underscore = 1;
 	  break;
@@ -3120,6 +3311,20 @@
 	    fatal (_("Unable to open base-file: %s"), optarg);
 
 	  break;
+#ifdef DLLTOOL_MCORE_ELF
+	case 'M':
+	  mcore_elf_out_file = optarg;
+	  break;
+	case 'L':
+	  mcore_elf_linker = optarg;
+	  break;
+	case 'F':
+	  mcore_elf_linker_flags = optarg;
+	  break;
+#endif
+	case 'C':
+	  create_compat_implib = 1;
+	  break;
 	default:
 	  usage (stderr, 1);
 	  break;
@@ -3127,10 +3332,8 @@
     }
 
   for (i = 0; mtable[i].type; i++)
-    {
-      if (strcmp (mtable[i].type, mname) == 0)
-	break;
-    }
+    if (strcmp (mtable[i].type, mname) == 0)
+      break;
 
   if (!mtable[i].type)
     /* xgettext:c-format */
@@ -3138,12 +3341,6 @@
 
   machine = i;
 
-#ifdef DLLTOOL_ARM
-  /* Always enable interworking for Thumb targets.  */
-  if (machine == MTHUMB && (! interwork))
-    interwork = 1;
-#endif
-  
   if (!dll_name && exp_name)
     {
       int len = strlen (exp_name) + 5;
@@ -3152,6 +3349,9 @@
       strcat (dll_name, ".dll");
     }
 
+  if (as_name == NULL)
+    as_name = deduce_name ("as");
+  
   /* Don't use the default exclude list if we're reading only the
      symbols in the .drectve section.  The default excludes are meant
      to avoid exporting DLL entry point and Cygwin32 impure_ptr.  */
@@ -3194,6 +3394,256 @@
   
   if (output_def)
     gen_def_file ();
-
+  
+#ifdef DLLTOOL_MCORE_ELF
+  if (mcore_elf_out_file)
+    mcore_elf_gen_out_file ();
+#endif
+  
   return 0;
 }
+
+/* Look for the program formed by concatenating PROG_NAME and the
+   string running from PREFIX to END_PREFIX.  If the concatenated
+   string contains a '/', try appending EXECUTABLE_SUFFIX if it is
+   appropriate.  */
+
+static char *
+look_for_prog (prog_name, prefix, end_prefix)
+     const char *prog_name;
+     const char *prefix;
+     int end_prefix;
+{
+  struct stat s;
+  char *cmd;
+
+  cmd = xmalloc (strlen (prefix) 
+                 + strlen (prog_name) 
+#ifdef HAVE_EXECUTABLE_SUFFIX
+                 + strlen (EXECUTABLE_SUFFIX) 
+#endif
+		 + 10);
+  strcpy (cmd, prefix);
+
+  sprintf (cmd + end_prefix, "%s", prog_name);
+
+  if (strchr (cmd, '/') != NULL)
+    {
+      int found;
+
+      found = (stat (cmd, &s) == 0
+#ifdef HAVE_EXECUTABLE_SUFFIX
+               || stat (strcat (cmd, EXECUTABLE_SUFFIX), &s) == 0
+#endif
+	       );
+
+      if (! found)
+        {
+	  /* xgettext:c-format */
+	  inform (_("Tried file: %s"), cmd);
+	  free (cmd);
+	  return NULL;
+	}
+    }
+
+  /* xgettext:c-format */
+  inform (_("Using file: %s"), cmd);
+
+  return cmd;
+}
+
+/* Deduce the name of the program we are want to invoke.
+   PROG_NAME is the basic name of the program we want to run,
+   eg "as" or "ld".  The catch is that we might want actually
+   run "i386-pe-as" or "ppc-pe-ld".  
+
+   If argv[0] contains the full path, then try to find the program
+   in the same place, with and then without a target-like prefix.
+
+   Given, argv[0] = /usr/local/bin/i586-cygwin32-dlltool,
+   deduce_name("as") uses the following search order: 
+
+     /usr/local/bin/i586-cygwin32-as
+     /usr/local/bin/as
+     as
+   
+   If there's an EXECUTABLE_SUFFIX, it'll use that as well; for each
+   name, it'll try without and then with EXECUTABLE_SUFFIX.
+
+   Given, argv[0] = i586-cygwin32-dlltool, it will not even try "as"
+   as the fallback, but rather return i586-cygwin32-as.
+     
+   Oh, and given, argv[0] = dlltool, it'll return "as".
+
+   Returns a dynamically allocated string.  */
+
+static char *
+deduce_name (prog_name)
+     const char *prog_name;
+{
+  char *cmd;
+  char *dash, *slash, *cp;
+
+  dash = NULL;
+  slash = NULL;
+  for (cp = program_name; *cp != '\0'; ++cp)
+    {
+      if (*cp == '-')
+	dash = cp;
+      if (
+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
+	  *cp == ':' || *cp == '\\' ||
+#endif
+	  *cp == '/')
+	{
+	  slash = cp;
+	  dash = NULL;
+	}
+    }
+
+  cmd = NULL;
+
+  if (dash != NULL)
+    {
+      /* First, try looking for a prefixed PROG_NAME in the
+         PROGRAM_NAME directory, with the same prefix as PROGRAM_NAME.  */
+      cmd = look_for_prog (prog_name, program_name, dash - program_name + 1);
+    }
+
+  if (slash != NULL && cmd == NULL)
+    {
+      /* Next, try looking for a PROG_NAME in the same directory as
+         that of this program.  */
+      cmd = look_for_prog (prog_name, program_name, slash - program_name + 1);
+    }
+
+  if (cmd == NULL)
+    {
+      /* Just return PROG_NAME as is.  */
+      cmd = xstrdup (prog_name);
+    }
+
+  return cmd;
+}
+
+#ifdef DLLTOOL_MCORE_ELF
+typedef struct fname_cache
+{
+  char *               filename;
+  struct fname_cache * next;
+}
+fname_cache;
+
+static fname_cache fnames;
+
+static void
+mcore_elf_cache_filename (char * filename)
+{
+  fname_cache * ptr;
+
+  ptr = & fnames;
+
+  while (ptr->next != NULL)
+    ptr = ptr->next;
+
+  ptr->filename = filename;
+  ptr->next     = (fname_cache *) malloc (sizeof (fname_cache));
+  if (ptr->next != NULL)
+    ptr->next->next = NULL;
+}
+
+#define MCORE_ELF_TMP_OBJ "mcoreelf.o"
+#define MCORE_ELF_TMP_EXP "mcoreelf.exp"
+#define MCORE_ELF_TMP_LIB "mcoreelf.lib"
+
+static void
+mcore_elf_gen_out_file (void)
+{
+  fname_cache * ptr;
+  dyn_string_t ds;
+
+  /* Step one.  Run 'ld -r' on the input object files in order to resolve
+     any internal references and to generate a single .exports section.  */
+  ptr = & fnames;
+
+  ds = dyn_string_new (100);
+  dyn_string_append (ds, "-r ");
+
+  if (mcore_elf_linker_flags != NULL)
+    dyn_string_append (ds, mcore_elf_linker_flags);
+  
+  while (ptr->next != NULL)
+    {
+      dyn_string_append (ds, ptr->filename);
+      dyn_string_append (ds, " ");
+
+      ptr = ptr->next;
+    }
+
+  dyn_string_append (ds, "-o ");
+  dyn_string_append (ds, MCORE_ELF_TMP_OBJ);
+
+  if (mcore_elf_linker == NULL)
+    mcore_elf_linker = deduce_name ("ld");
+  
+  run (mcore_elf_linker, ds->s);
+
+  dyn_string_delete (ds);
+
+  /* Step two. Create a .exp file and a .lib file from the temporary file. 
+     Do this by recursively invoking dlltool....*/
+  ds = dyn_string_new (100);
+
+  dyn_string_append (ds, "-S ");
+  dyn_string_append (ds, as_name);
+  
+  dyn_string_append (ds, " -e ");
+  dyn_string_append (ds, MCORE_ELF_TMP_EXP);
+  dyn_string_append (ds, " -l ");
+  dyn_string_append (ds, MCORE_ELF_TMP_LIB);
+  dyn_string_append (ds, " " );
+  dyn_string_append (ds, MCORE_ELF_TMP_OBJ);
+
+  if (verbose)
+    dyn_string_append (ds, " -v");
+  
+  if (dontdeltemps)
+    {
+      dyn_string_append (ds, " -n");
+  
+      if (dontdeltemps > 1)
+	dyn_string_append (ds, " -n");
+    }
+
+  /* XXX - FIME: ought to check/copy other command line options as well.  */
+  
+  run (program_name, ds->s);
+
+  dyn_string_delete (ds);
+
+  /* Step four. Feed the .exp and object files to ld -shared to create the dll.  */
+  ds = dyn_string_new (100);
+
+  dyn_string_append (ds, "-shared ");
+
+  if (mcore_elf_linker_flags)
+    dyn_string_append (ds, mcore_elf_linker_flags);
+
+  dyn_string_append (ds, " ");
+  dyn_string_append (ds, MCORE_ELF_TMP_EXP);
+  dyn_string_append (ds, " ");
+  dyn_string_append (ds, MCORE_ELF_TMP_OBJ);
+  dyn_string_append (ds, " -o ");
+  dyn_string_append (ds, mcore_elf_out_file);
+
+  run (mcore_elf_linker, ds->s);
+
+  dyn_string_delete (ds);
+
+  if (dontdeltemps == 0)
+    unlink (MCORE_ELF_TMP_EXP);
+
+  if (dontdeltemps < 2)
+    unlink (MCORE_ELF_TMP_OBJ);
+}
+#endif /* DLLTOOL_MCORE_ELF */
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 574611b..25bf519 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -1,5 +1,5 @@
 /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Mumit Khan (khan@xraylith.wisc.edu).
 
    This file is part of GNU Binutils.
@@ -26,21 +26,10 @@
 #endif
 #endif
 
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #include "bfd.h"
 #include "libiberty.h"
 #include "bucomm.h"
@@ -49,6 +38,13 @@
 
 #include <ctype.h>
 #include <time.h>
+#include <sys/stat.h>
+
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
@@ -83,7 +79,7 @@
 #endif /* ! HAVE_SYS_WAIT_H */
 
 static char *program_version = "0.2.4";
-static char *driver_name = "gcc";
+static char *driver_name = NULL;
 static char *cygwin_driver_flags = 
   "-Wl,--dll -nostartfiles";
 static char *mingw32_driver_flags = "-mdll";
@@ -91,14 +87,14 @@
 
 static char *entry_point;
 
-static char *dlltool_name = "dlltool";
+static char *dlltool_name = NULL;
 
 static char *target = TARGET;
 
 typedef enum {
   UNKNOWN_TARGET, 
   CYGWIN_TARGET, 
-  MINGW32_TARGET
+  MINGW_TARGET
 } 
 target_type;
 
@@ -122,11 +118,186 @@
 
 static int run PARAMS ((const char *, char *));
 static void usage PARAMS ((FILE *, int));
+static void display PARAMS ((const char *, va_list));
+static void inform PARAMS ((const char *, ...));
+static char *look_for_prog PARAMS ((const char *, const char *, int));
+static char *deduce_name PARAMS ((const char *));
 static void delete_temp_files PARAMS ((void));
 static void cleanup_and_exit PARAMS ((int status));
 
 /**********************************************************************/
 
+/* Please keep the following 4 routines in sync with dlltool.c:
+     display ()
+     inform ()
+     look_for_prog ()
+     deduce_name ()
+   It's not worth the hassle to break these out since dllwrap will
+   (hopefully) soon be retired in favor of `ld --shared.  */
+
+static void
+display (message, args)
+     const char * message;
+     va_list      args;
+{
+  if (program_name != NULL)
+    fprintf (stderr, "%s: ", program_name);
+
+  vfprintf (stderr, message, args);
+
+  if (message [strlen (message) - 1] != '\n')
+    fputc ('\n', stderr);
+}  
+
+
+static void
+#ifdef __STDC__
+inform (const char * message, ...)
+#else
+inform (message, va_alist)
+     const char * message;
+     va_dcl
+#endif
+{
+  va_list args;
+  
+  if (!verbose)
+    return;
+
+#ifdef __STDC__
+  va_start (args, message);
+#else
+  va_start (args);
+#endif
+
+  display (message, args);
+  
+  va_end (args);
+}
+
+/* Look for the program formed by concatenating PROG_NAME and the
+   string running from PREFIX to END_PREFIX.  If the concatenated
+   string contains a '/', try appending EXECUTABLE_SUFFIX if it is
+   appropriate.  */
+
+static char *
+look_for_prog (prog_name, prefix, end_prefix)
+     const char *prog_name;
+     const char *prefix;
+     int end_prefix;
+{
+  struct stat s;
+  char *cmd;
+
+  cmd = xmalloc (strlen (prefix) 
+                 + strlen (prog_name) 
+#ifdef HAVE_EXECUTABLE_SUFFIX
+                 + strlen (EXECUTABLE_SUFFIX) 
+#endif
+		 + 10);
+  strcpy (cmd, prefix);
+
+  sprintf (cmd + end_prefix, "%s", prog_name);
+
+  if (strchr (cmd, '/') != NULL)
+    {
+      int found;
+
+      found = (stat (cmd, &s) == 0
+#ifdef HAVE_EXECUTABLE_SUFFIX
+               || stat (strcat (cmd, EXECUTABLE_SUFFIX), &s) == 0
+#endif
+	       );
+
+      if (! found)
+        {
+	  /* xgettext:c-format */
+	  inform (_("Tried file: %s"), cmd);
+	  free (cmd);
+	  return NULL;
+	}
+    }
+
+  /* xgettext:c-format */
+  inform (_("Using file: %s"), cmd);
+
+  return cmd;
+}
+
+/* Deduce the name of the program we are want to invoke.
+   PROG_NAME is the basic name of the program we want to run,
+   eg "as" or "ld".  The catch is that we might want actually
+   run "i386-pe-as" or "ppc-pe-ld".  
+
+   If argv[0] contains the full path, then try to find the program
+   in the same place, with and then without a target-like prefix.
+
+   Given, argv[0] = /usr/local/bin/i586-cygwin32-dlltool,
+   deduce_name("as") uses the following search order: 
+
+     /usr/local/bin/i586-cygwin32-as
+     /usr/local/bin/as
+     as
+   
+   If there's an EXECUTABLE_SUFFIX, it'll use that as well; for each
+   name, it'll try without and then with EXECUTABLE_SUFFIX.
+
+   Given, argv[0] = i586-cygwin32-dlltool, it will not even try "as"
+   as the fallback, but rather return i586-cygwin32-as.
+     
+   Oh, and given, argv[0] = dlltool, it'll return "as".
+
+   Returns a dynamically allocated string.  */
+
+static char *
+deduce_name (prog_name)
+     const char *prog_name;
+{
+  char *cmd;
+  char *dash, *slash, *cp;
+
+  dash = NULL;
+  slash = NULL;
+  for (cp = program_name; *cp != '\0'; ++cp)
+    {
+      if (*cp == '-')
+	dash = cp;
+      if (
+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
+	  *cp == ':' || *cp == '\\' ||
+#endif
+	  *cp == '/')
+	{
+	  slash = cp;
+	  dash = NULL;
+	}
+    }
+
+  cmd = NULL;
+
+  if (dash != NULL)
+    {
+      /* First, try looking for a prefixed PROG_NAME in the
+         PROGRAM_NAME directory, with the same prefix as PROGRAM_NAME.  */
+      cmd = look_for_prog (prog_name, program_name, dash - program_name + 1);
+    }
+
+  if (slash != NULL && cmd == NULL)
+    {
+      /* Next, try looking for a PROG_NAME in the same directory as
+         that of this program.  */
+      cmd = look_for_prog (prog_name, program_name, slash - program_name + 1);
+    }
+
+  if (cmd == NULL)
+    {
+      /* Just return PROG_NAME as is.  */
+      cmd = xstrdup (prog_name);
+    }
+
+  return cmd;
+}
+
 static void
 delete_temp_files ()
 {
@@ -341,6 +512,7 @@
   fprintf (file, "   --image-base <base>    Specify image base address\n");
   fprintf (file, "   --target <machine>     i386-cygwin32 or i386-mingw32\n");
   fprintf (file, "   --dry-run              Show what needs to be run\n");
+  fprintf (file, "   --mno-cygwin           Create Mingw DLL\n");
   fprintf (file, "  Options passed to DLLTOOL:\n");
   fprintf (file, "   --machine <machine>\n");
   fprintf (file, "   --output-exp <outname> Generate export file.\n");
@@ -381,9 +553,10 @@
 #define OPTION_ENTRY		(OPTION_DLLTOOL_NAME + 1)
 #define OPTION_IMAGE_BASE	(OPTION_ENTRY + 1)
 #define OPTION_TARGET		(OPTION_IMAGE_BASE + 1)
+#define OPTION_MNO_CYGWIN	(OPTION_TARGET + 1)
 
 /* DLLTOOL options. */
-#define OPTION_NODELETE		(OPTION_TARGET + 1)
+#define OPTION_NODELETE		(OPTION_MNO_CYGWIN + 1)
 #define OPTION_DLLNAME		(OPTION_NODELETE + 1)
 #define OPTION_NO_IDATA4 	(OPTION_DLLNAME + 1)
 #define OPTION_NO_IDATA5	(OPTION_NO_IDATA4 + 1)
@@ -568,6 +741,9 @@
 	case OPTION_TARGET:
 	  target = optarg;
 	  break;
+	case OPTION_MNO_CYGWIN:
+	  target = "i386-mingw32";
+	  break;
 	case OPTION_BASE_FILE:
 	  base_file_name = optarg;
 	  delete_base_file = 0;
@@ -614,7 +790,7 @@
 	    } 
 	}
     }
-  
+
   /* sanity checks. */
   if (! dll_name && ! dll_file_name)
     {
@@ -631,7 +807,14 @@
     {
       dll_file_name = xstrdup (dll_name);
     }
-  
+
+  /* Deduce driver-name and dlltool-name from our own. */
+  if (driver_name == NULL)
+    driver_name = deduce_name ("gcc");
+
+  if (dlltool_name == NULL)
+    dlltool_name = deduce_name ("dlltool");
+
   if (! def_file_seen)
     {
       char *fileprefix = choose_temp_base ();
@@ -647,10 +830,10 @@
     }
   
   /* set the target platform. */
-  if (strstr (target, "cygwin32"))
+  if (strstr (target, "cygwin"))
     which_target = CYGWIN_TARGET;
-  else if (strstr (target, "mingw32"))
-    which_target = MINGW32_TARGET;
+  else if (strstr (target, "mingw"))
+    which_target = MINGW_TARGET;
   else 
     which_target = UNKNOWN_TARGET;
 
@@ -686,7 +869,7 @@
           driver_flags = cygwin_driver_flags;
 	  break;
 	
-	case MINGW32_TARGET:
+	case MINGW_TARGET:
           driver_flags = mingw32_driver_flags;
 	  break;
 	
@@ -707,7 +890,7 @@
 	  entry_point = "__cygwin_dll_entry@12";
 	  break;
 	
-	case MINGW32_TARGET:
+	case MINGW_TARGET:
 	  entry_point = "_DllMainCRTStartup@12";
 	  break;
 	
diff --git a/binutils/dyn-string.c b/binutils/dyn-string.c
index a4a3043..a164018 100644
--- a/binutils/dyn-string.c
+++ b/binutils/dyn-string.c
@@ -15,8 +15,8 @@
    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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   along with this program; if not, write to the Free Software
+   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file lives in at least two places: binutils and gcc.
    Don't change one without the other.  */
diff --git a/binutils/dyn-string.h b/binutils/dyn-string.h
index a22bbbf..cbd25c3 100644
--- a/binutils/dyn-string.h
+++ b/binutils/dyn-string.h
@@ -15,8 +15,8 @@
    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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   along with this program; if not, write to the Free Software
+   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file lives in at least two places: binutils and gcc.
    Don't change one without the other.  */
diff --git a/binutils/filemode.c b/binutils/filemode.c
index 58b52ba..f9811bc 100644
--- a/binutils/filemode.c
+++ b/binutils/filemode.c
@@ -1,5 +1,5 @@
 /* filemode.c -- make a string describing file modes
-   Copyright (C) 1985, 90, 91, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1985, 90, 91, 94, 95, 97, 1999 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
@@ -230,8 +230,8 @@
 
 static void
 setst (bits, chars)
-     unsigned long bits;
-     char *chars;
+     unsigned long bits ATTRIBUTE_UNUSED;
+     char *chars ATTRIBUTE_UNUSED;
 {
 #ifdef S_ISUID
   if (bits & S_ISUID)
diff --git a/binutils/ieee.c b/binutils/ieee.c
index 17a5b88..a3bb93b 100644
--- a/binutils/ieee.c
+++ b/binutils/ieee.c
@@ -1,5 +1,5 @@
 /* ieee.c -- Read and write IEEE-695 debugging information.
-   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -779,7 +779,7 @@
 
     case builtin_bcd_float:
       ieee_error (info, p, _("BCD float type not supported"));
-      return false;
+      return DEBUG_TYPE_NULL;
     }
 
   if (name != NULL)
@@ -4104,7 +4104,7 @@
 /*ARGSUSED*/
 static boolean
 ieee_init_buffer (info, buflist)
-     struct ieee_handle *info;
+     struct ieee_handle *info ATTRIBUTE_UNUSED;
      struct ieee_buflist *buflist;
 {
   buflist->head = NULL;
@@ -4145,7 +4145,7 @@
 /*ARGSUSED*/
 static boolean
 ieee_append_buffer (info, mainbuf, newbuf)
-     struct ieee_handle *info;
+     struct ieee_handle *info ATTRIBUTE_UNUSED;
      struct ieee_buflist *mainbuf;
      struct ieee_buflist *newbuf;
 {
@@ -5135,7 +5135,7 @@
 
 static void
 ieee_add_bb11_blocks (abfd, sec, data)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      PTR data;
 {
@@ -5258,8 +5258,8 @@
 /*ARGSUSED*/
 static boolean
 ieee_start_source (p, filename)
-     PTR p;
-     const char *filename;
+     PTR p ATTRIBUTE_UNUSED;
+     const char *filename ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -5725,7 +5725,7 @@
      PTR p;
      bfd_signed_vma low;
      bfd_signed_vma high;
-     boolean stringp;
+     boolean stringp ATTRIBUTE_UNUSED;
 {
   struct ieee_handle *info = (struct ieee_handle *) p;
   unsigned int eleindx;
@@ -5792,7 +5792,7 @@
 static boolean
 ieee_set_type (p, bitstringp)
      PTR p;
-     boolean bitstringp;
+     boolean bitstringp ATTRIBUTE_UNUSED;
 {
   struct ieee_handle *info = (struct ieee_handle *) p;
   boolean localp;
@@ -7012,7 +7012,7 @@
 static boolean
 ieee_tag (p, name)
      PTR p;
-     const char *name;
+     const char *name ATTRIBUTE_UNUSED;
 {
   struct ieee_handle *info = (struct ieee_handle *) p;
 
@@ -7026,9 +7026,9 @@
 
 static boolean
 ieee_int_constant (p, name, val)
-     PTR p;
-     const char *name;
-     bfd_vma val;
+     PTR p ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
+     bfd_vma val ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   return true;
@@ -7038,9 +7038,9 @@
 
 static boolean
 ieee_float_constant (p, name, val)
-     PTR p;
-     const char *name;
-     double val;
+     PTR p ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
+     double val ATTRIBUTE_UNUSED;
 {
   /* FIXME.  */
   return true;
@@ -7051,8 +7051,8 @@
 static boolean
 ieee_typed_constant (p, name, val)
      PTR p;
-     const char *name;
-     bfd_vma val;
+     const char *name ATTRIBUTE_UNUSED;
+     bfd_vma val ATTRIBUTE_UNUSED;
 {
   struct ieee_handle *info = (struct ieee_handle *) p;
 
diff --git a/binutils/nm.c b/binutils/nm.c
index c51b7fb..ade3f7c 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1305,13 +1305,13 @@
 
 static void
 print_archive_filename_sysv (filename)
-     char *filename;
+     char *filename ATTRIBUTE_UNUSED;
 {
 }
 
 static void
 print_archive_filename_posix (filename)
-     char *filename;
+     char *filename ATTRIBUTE_UNUSED;
 {
 }
 
@@ -1319,7 +1319,7 @@
 
 static void
 print_archive_member_bsd (archive, filename)
-     char *archive;
+     char *archive ATTRIBUTE_UNUSED;
      CONST char *filename;
 {
   if (!filename_per_symbol)
@@ -1427,7 +1427,7 @@
      symbol_info *info;
      bfd *abfd;
 {
-  if (info->type == 'U')
+  if (bfd_is_undefined_symclass (info->type))
     {
       printf ("%*s",
 #ifdef BFD64
@@ -1458,7 +1458,7 @@
      bfd *abfd;
 {
   print_symname ("%-20s|", info->name, abfd);	/* Name */
-  if (info->type == 'U')
+  if (bfd_is_undefined_symclass (info->type))
     printf ("        ");	/* Value */
   else
     print_value (info->value);
@@ -1481,7 +1481,7 @@
 {
   print_symname ("%s ", info->name, abfd);
   printf ("%c ", info->type);
-  if (info->type == 'U')
+  if (bfd_is_undefined_symclass (info->type))
     printf ("        ");
   else
     print_value (info->value);
diff --git a/binutils/objcopy.1 b/binutils/objcopy.1
index aee7760..b3fa296 100644
--- a/binutils/objcopy.1
+++ b/binutils/objcopy.1
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1991, 93, 94, 95, 96, 97, 1998 Free Software Foundation
+.\" Copyright (c) 1991, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation
 .\" See section COPYING for conditions for redistribution
-.TH objcopy 1 "October 1994" "cygnus support" "GNU Development Tools"
+.TH objcopy 1 "1999" "Cygnus Solutions" "GNU Development Tools"
 .de BP
 .sp
 .ti \-.2i
@@ -18,6 +18,7 @@
 .RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fR "\|]" 
 .RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fR "\|]" 
 .RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fR "\|]" 
+.RB "[\|" \-j\ \fIsectionname\fR\ |\ \fB\-\-only\-section=\fIsectionname\fR "\|]"
 .RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fR "\|]"
 .RB "[\|" \-S\fR\ |\ \fB\-\-strip\-all\fR "\|]" 
 .RB "[\|" \-g\fR\ |\ \fB\-\-strip\-debug\fR "\|]" 
@@ -123,6 +124,12 @@
 as the object format for both the input and the output file; i.e.
 simply transfer data from source to destination with no translation.
 .TP
+.B \-j \fIsectionname\fR, \fB\-\-only\-section=\fIsectionname
+Copy only the named section from the input file to the output file,
+discarding all other sections.  This option may be given more than
+once.  Note that using this option inappropriately may make the output
+file unusable.
+.TP
 .B \-R \fIsectionname\fR, \fB\-\-remove-section=\fIsectionname
 Remove the named section from the file.  This option may be given more
 than once.  Note that using this option inappropriately may make the
@@ -242,9 +249,9 @@
 .B \fB\-\-set\-section\-flags=\fIsection=flags
 Set the flags for the named section.  The \fIflags\fP argument is a
 comma separated string of flag names.  The recognized names are
-\fIalloc\fP, \fIload\fP, \fIreadonly\fP, \fIcode\fP, \fIdata\fP, and
-\fIrom\fP.  Not all flags are meaningful for all object file
-formats.
+\fIalloc\fP, \fIcontents\fP, \fIload\fP, \fInoload\fP, \fIreadonly\fP,
+\fIcode\fP, \fIdata\fP, \fIrom\fP, \fIshare\fP, and \fIdebug\fP.  Not
+all flags are meaningful for all object file formats.
 .TP
 .B \fB\-\-add\-section=\fIsectionname=filename
 Add a new section named \fIsectionname\fR while copying the file.  The
@@ -301,7 +308,7 @@
 \&, Roland H. Pesch (June 1993).
 
 .SH COPYING
-Copyright (c) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+Copyright (c) 1993, 94, 95, 96, 97, 98, 1999 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
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 5fd7777..37b12e7 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -111,6 +111,7 @@
   const char *          name;      /* Section name.  */
   boolean               used;      /* Whether this entry was used.  */
   boolean               remove;    /* Whether to remove this section.  */
+  boolean		copy;      /* Whether to copy this section.  */
   enum change_action    change_vma;/* Whether to change or set VMA.  */
   bfd_vma 		vma_val;   /* Amount to change by or set to.  */
   enum change_action    change_lma;/* Whether to change or set LMA.  */
@@ -121,6 +122,7 @@
 
 static struct section_list *change_sections;
 static boolean sections_removed;
+static boolean sections_copied;
 
 /* Changes to the start address.  */
 static bfd_vma change_start = 0;
@@ -246,6 +248,7 @@
   {"debugging", no_argument, 0, OPTION_DEBUGGING},
   {"discard-all", no_argument, 0, 'x'},
   {"discard-locals", no_argument, 0, 'X'},
+  {"only-section", required_argument, 0, 'j'},
   {"format", required_argument, 0, 'F'}, /* Obsolete */
   {"gap-fill", required_argument, 0, OPTION_GAP_FILL},
   {"help", no_argument, 0, 'h'},
@@ -290,29 +293,52 @@
      FILE *stream;
      int exit_status;
 {
+  fprintf (stream, _("Usage: %s <switches> in-file [out-file]\n"), program_name);
+  fprintf (stream, _(" The switches are:\n"));
   fprintf (stream, _("\
-Usage: %s [-vVSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-b byte]\n\
-       [-R section] [-i interleave] [--interleave=interleave] [--byte=byte]\n\
-       [--input-target=bfdname] [--output-target=bfdname] [--target=bfdname]\n\
-       [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n\
-       [--discard-locals] [--debugging] [--remove-section=section]\n"),
-	   program_name);
-  fprintf (stream, _("\
-       [--gap-fill=val] [--pad-to=address] [--preserve-dates]\n\
-       [--set-start=val] \n\
-       [--change-start=incr] [--change-addresses=incr] \n\
-       (--adjust-start   and  --adjust-vma are aliases for these two) \n\
-       [--change-section-address=section{=,+,-}val]\n\
-       (--adjust-section-vma is an alias for --change-section-address)\n\
-       [--change-section-lma=section{=,+,-}val]\n\
-       [--change-section-vma=section{=,+,-}val]\n\
-       [--adjust-warnings] [--no-adjust-warnings]\n\
-       [--change-warnings] [--no-change-warnings]\n\
-       [--set-section-flags=section=flags] [--add-section=sectionname=filename]\n\
-       [--keep-symbol symbol] [-K symbol] [--strip-symbol symbol] [-N symbol]\n\
-       [--localize-symbol symbol] [-L symbol] [--weaken-symbol symbol]\n\
-       [-W symbol] [--change-leading-char] [--remove-leading-char] [--weaken]\n\
-       [--verbose] [--version] [--help] in-file [out-file]\n"));
+  -I --input-target <bfdname>      Assume input file is in format <bfdname>\n\
+  -O --output-target <bfdname>     Create an output file in format <bfdname>\n\
+  -F --target <bfdname>            Set both input and output format to <bfdname>\n\
+     --debugging                   Convert debugging information, if possible\n\
+  -p --preserve-dates              Copy modified/access timestamps to the output\n\
+  -j --only-section <name>         Only copy section <name> into the output\n\
+  -R --remove-section <name>       Remove section <name> from the output\n\
+  -S --strip-all                   Remove all symbol and relocation information\n\
+  -g --strip-debug                 Remove all debugging symbols\n\
+     --strip-unneeded              Remove all symbols not needed by relocations\n\
+  -N --strip-symbol <name>         Do not copy symbol <name>\n\
+  -K --keep-symbol <name>          Only copy symbol <name>\n\
+  -L --localize-symbol <name>      Force symbol <name> to be marked as a local\n\
+  -W --weaken-symbol <name>        Force symbol <name> to be marked as a weak\n\
+     --weaken                      Force all global symbols to be marked as weak\n\
+  -x --discard-all                 Remove all non-global symbols\n\
+  -X --discard-locals              Remove any compiler-generated symbols\n\
+  -i --interleave <number>         Only copy one out of every <number> bytes\n\
+  -b --byte <num>                  Select byte <num> in every interleaved block\n\
+     --gap-fill <val>              Fill gaps between sections with <val>\n\
+     --pad-to <addr>               Pad the last section up to address <addr>\n\
+     --set-start <addr>            Set the start address to <addr>\n\
+    {--change-start|--adjust-start} <incr>\n\
+                                   Add <incr> to the start address\n\
+    {--change-addresses|--adjust-vma} <incr>\n\
+                                   Add <incr> to LMA, VMA and start addresses\n\
+    {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>\n\
+                                   Change LMA and VMA of section <name> by <val>\n\
+     --change-section-lma <name>{=|+|-}<val>\n\
+                                   Change the LMA of section <name> by <val>\n\
+     --change-section-vma <name>{=|+|-}<val>\n\
+                                   Change the VMA of section <name> by <val>\n\
+    {--[no-]change-warnings|--[no-]adjust-warnings}\n\
+                                   Warn if a named section does not exist\n\
+     --set-section-flags <name>=<flags>\n\
+                                   Set section <name>'s properties to <flags>\n\
+     --add-section <name>=<file>   Add section <name> found in <file> to output\n\
+     --change-leading-char         Force output format's leading character style\n\
+     --remove-leading-char         Remove leading character from global symbols\n\
+  -v --verbose                     List all object files modified\n\
+  -V --version                     Display this program's version number\n\
+  -h --help                        Display this output\n\
+"));
   list_supported_targets (program_name, stream);
   if (exit_status == 0)
     fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
@@ -324,14 +350,27 @@
      FILE *stream;
      int exit_status;
 {
+  fprintf (stream, _("Usage: %s <switches> in-file(s)\n"), program_name);
+  fprintf (stream, _(" The switches are:\n"));
   fprintf (stream, _("\
-Usage: %s [-vVsSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-R section]\n\
-       [--input-target=bfdname] [--output-target=bfdname] [--target=bfdname]\n\
-       [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n\
-       [--discard-locals] [--keep-symbol symbol] [-K symbol]\n\
-       [--strip-symbol symbol] [-N symbol] [--remove-section=section]\n\
-       [-o file] [--preserve-dates] [--verbose] [--version] [--help] file...\n"),
-	   program_name);
+  -I --input-target <bfdname>      Assume input file is in format <bfdname>\n\
+  -O --output-target <bfdname>     Create an output file in format <bfdname>\n\
+  -F --target <bfdname>            Set both input and output format to <bfdname>\n\
+  -p --preserve-dates              Copy modified/access timestamps to the output\n\
+  -R --remove-section <name>       Remove section <name> from the output\n\
+  -s --strip-all                   Remove all symbol and relocation information\n\
+  -g -S --strip-debug              Remove all debugging symbols\n\
+     --strip-unneeded              Remove all symbols not needed by relocations\n\
+  -N --strip-symbol <name>         Do not copy symbol <name>\n\
+  -K --keep-symbol <name>          Only copy symbol <name>\n\
+  -x --discard-all                 Remove all non-global symbols\n\
+  -X --discard-locals              Remove any compiler-generated symbols\n\
+  -v --verbose                     List all object files modified\n\
+  -V --version                     Display this program's version number\n\
+  -h --help                        Display this output\n\
+  -o <file>                        Place stripped output into <file>\n\
+"));
+
   list_supported_targets (program_name, stream);
   if (exit_status == 0)
     fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
@@ -367,10 +406,13 @@
   else if (strncasecmp (fname, s, len) == 0) ret |= fval
       PARSE_FLAG ("alloc", SEC_ALLOC);
       PARSE_FLAG ("load", SEC_LOAD);
+      PARSE_FLAG ("noload", SEC_NEVER_LOAD);
       PARSE_FLAG ("readonly", SEC_READONLY);
+      PARSE_FLAG ("debug", SEC_DEBUGGING);
       PARSE_FLAG ("code", SEC_CODE);
       PARSE_FLAG ("data", SEC_DATA);
       PARSE_FLAG ("rom", SEC_ROM);
+      PARSE_FLAG ("share", SEC_SHARED);
       PARSE_FLAG ("contents", SEC_HAS_CONTENTS);
 #undef PARSE_FLAG
       else
@@ -381,7 +423,7 @@
 	  strncpy (copy, s, len);
 	  copy[len] = '\0';
 	  non_fatal (_("unrecognized section flag `%s'"), copy);
-	  fatal (_("supported flags: alloc, load, readonly, code, data, rom, contents"));
+	  fatal (_("supported flags: alloc, load, noload, readonly, debug, code, data, rom, share, contents"));
 	}
 
       s = snext;
@@ -411,6 +453,7 @@
   p->name = name;
   p->used = false;
   p->remove = false;
+  p->copy = false;
   p->change_vma = CHANGE_IGNORE;
   p->change_lma = CHANGE_IGNORE;
   p->vma_val = 0;
@@ -461,7 +504,7 @@
 
 static boolean
 is_strip_section (abfd, sec)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
 {
   struct section_list *p;
@@ -474,10 +517,15 @@
 	  || convert_debugging))
     return true;
 
-  if (! sections_removed)
+  if (! sections_removed && ! sections_copied)
     return false;
+
   p = find_section_list (bfd_get_section_name (abfd, sec), false);
-  return p != NULL && p->remove ? true : false;
+  if (sections_removed && p != NULL && p->remove)
+    return true;
+  if (sections_copied && (p == NULL || ! p->copy))
+    return true;
+  return false;
 }
 
 /* Choose which symbol entries to copy; put the result in OSYMS.
@@ -594,7 +642,7 @@
 
   for (; from < end; from += interleave)
     *to++ = *from;
-  if (*size % interleave > copy_byte)
+  if (*size % interleave > (bfd_size_type) copy_byte)
     *size = (*size / interleave) + 1;
   else
     *size /= interleave;
@@ -816,6 +864,7 @@
       || localize_specific_list != NULL
       || weaken_specific_list != NULL
       || sections_removed
+      || sections_copied
       || convert_debugging
       || change_leading_char
       || remove_leading_char
@@ -962,6 +1011,16 @@
 				  (char *) NULL);
       bfd *output_bfd = bfd_openw (output_name, output_target);
       bfd *last_element;
+      struct stat buf;
+      int stat_status = 0;
+
+      if (preserve_dates)
+	{
+	  stat_status = bfd_stat_arch_elt (this_element, &buf);
+	  if (stat_status != 0)
+	    non_fatal (_("internal stat error on %s"),
+		       bfd_get_filename (this_element));
+	}
 
       l = (struct name_list *) xmalloc (sizeof (struct name_list));
       l->name = output_name;
@@ -984,6 +1043,9 @@
 	  status = 1;
 	}
 
+      if (preserve_dates && stat_status == 0)
+	set_times (output_name, &buf);
+
       /* Open the newly output file and attach to our list.  */
       output_bfd = bfd_openr (output_name, output_target);
 
@@ -1114,7 +1176,9 @@
   if (p != NULL)
     p->used = true;
 
-  if (p != NULL && p->remove)
+  if (sections_removed && p != NULL && p->remove)
+    return;
+  if (sections_copied && (p == NULL || ! p->copy))
     return;
 
   osection = bfd_make_section_anyway (obfd, bfd_section_name (ibfd, isection));
@@ -1243,7 +1307,9 @@
 
   p = find_section_list (bfd_section_name (ibfd, isection), false);
 
-  if (p != NULL && p->remove)
+  if (sections_removed && p != NULL && p->remove)
+    return;
+  if (sections_copied && (p == NULL || ! p->copy))
     return;
 
   osection = isection->output_section;
@@ -1331,7 +1397,7 @@
 
 static void
 get_sections (obfd, osection, secppparg)
-     bfd *obfd;
+     bfd *obfd ATTRIBUTE_UNUSED;
      asection *osection;
      PTR secppparg;
 {
@@ -1438,8 +1504,8 @@
 write_debugging_info (obfd, dhandle, symcountp, symppp)
      bfd *obfd;
      PTR dhandle;
-     long *symcountp;
-     asymbol ***symppp;
+     long *symcountp ATTRIBUTE_UNUSED;
+     asymbol ***symppp ATTRIBUTE_UNUSED;
 {
   if (bfd_get_flavour (obfd) == bfd_target_ieee_flavour)
     return write_ieee_debugging_info (obfd, dhandle);
@@ -1644,7 +1710,7 @@
   struct section_list *p;
   struct stat statbuf;
 
-  while ((c = getopt_long (argc, argv, "b:i:I:K:N:s:O:d:F:L:R:SpgxXVvW:",
+  while ((c = getopt_long (argc, argv, "b:i:I:j:K:N:s:O:d:F:L:R:SpgxXVvW:",
 			   copy_options, (int *) 0)) != EOF)
     {
       switch (c)
@@ -1670,8 +1736,17 @@
 	case 'F':
 	  input_target = output_target = optarg;
 	  break;
+	case 'j':
+	  p = find_section_list (optarg, true);
+	  if (p->remove)
+	    fatal (_("%s both copied and removed"), optarg);
+	  p->copy = true;
+	  sections_copied = true;
+	  break;
 	case 'R':
 	  p = find_section_list (optarg, true);
+	  if (p->copy)
+	    fatal (_("%s both copied and removed"), optarg);
 	  p->remove = true;
 	  sections_removed = true;
 	  break;
@@ -1769,15 +1844,21 @@
 	    const char *s;
 	    int len;
 	    char *name;
-	    char *option;
+	    char *option = NULL;
 	    bfd_vma val;
-	    enum change_action what;
+	    enum change_action what = CHANGE_IGNORE;
 	    
 	    switch (c)
 	      {
-	      case OPTION_CHANGE_SECTION_ADDRESS: option = "--change-section-address"; break;
-	      case OPTION_CHANGE_SECTION_LMA: option = "--change-section-lma"; break;
-	      case OPTION_CHANGE_SECTION_VMA: option = "--change-section-vma"; break;
+	      case OPTION_CHANGE_SECTION_ADDRESS:
+		option = "--change-section-address";
+		break;
+	      case OPTION_CHANGE_SECTION_LMA:
+		option = "--change-section-lma";
+		break;
+	      case OPTION_CHANGE_SECTION_VMA:
+		option = "--change-section-vma";
+		break;
 	      }
 	    
 	    s = strchr (optarg, '=');
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 3f9e8c4..488d4f3 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -44,6 +44,9 @@
 extern int fprintf PARAMS ((FILE *, const char *, ...));
 #endif
 
+/* Exit status.  */
+static int exit_status = 0;
+
 static char *default_target = NULL;	/* default at runtime */
 
 static int show_version = 0;		/* show the version number */
@@ -72,6 +75,7 @@
 static bfd_vma stop_address = (bfd_vma) -1;  /* --stop-address */
 static int dump_debugging;		/* --debugging */
 static bfd_vma adjust_section_vma = 0;	/* --adjust-vma */
+static int file_start_context = 0;      /* --file-start-context */
 
 /* Extra info to pass to the disassembler address printing function.  */
 struct objdump_disasm_info {
@@ -83,6 +87,9 @@
 /* Architecture to disassemble for, or default if NULL.  */
 static char *machine = (char *) NULL;
 
+/* Target specific options to the disassembler.  */
+static char *disassembler_options = (char *) NULL;
+
 /* Endianness to disassemble for, or default if BFD_ENDIAN_UNKNOWN.  */
 static enum bfd_endian endian = BFD_ENDIAN_UNKNOWN;
 
@@ -110,6 +117,9 @@
 usage PARAMS ((FILE *, int));
 
 static void
+nonfatal PARAMS ((const char *));
+
+static void
 display_file PARAMS ((char *filename, char *target));
 
 static void
@@ -216,22 +226,53 @@
      FILE *stream;
      int status;
 {
+  fprintf (stream, _("Usage: %s <switches> file(s)\n"), program_name);
+  fprintf (stream, _(" At least one of the following switches must be given:\n"));
   fprintf (stream, _("\
-Usage: %s [-ahifCdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\
-       [--archive-headers] [--target=bfdname] [--debugging] [--disassemble]\n\
-       [--disassemble-all] [--disassemble-zeroes] [--file-headers]\n\
-       [--section-headers] [--headers]\n\
-       [--info] [--section=section-name] [--line-numbers] [--source]\n"),
-	   program_name);
-  fprintf (stream, _("\
-       [--architecture=machine] [--reloc] [--full-contents] [--stabs]\n\
-       [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\
-       [--wide] [--version] [--help] [--private-headers]\n\
-       [--start-address=addr] [--stop-address=addr]\n\
-       [--prefix-addresses] [--[no-]show-raw-insn] [--demangle]\n\
-       [--adjust-vma=offset] [-EB|-EL] [--endian={big|little}] objfile...\n\
-at least one option besides -l (--line-numbers) must be given\n"));
-  list_supported_targets (program_name, stream);
+  -a  --archive-headers    Display archive header information\n\
+  -f  --file-headers       Display the contents of the overall file header\n\
+  -p  --private-headers    Display object format specific file header contents\n\
+  -h  --[section-]headers  Display the contents of the section headers\n\
+  -x  --all-headers        Display the contents of all headers\n\
+  -d  --disassemble        Display assembler contents of executable sections\n\
+  -D  --disassemble-all    Display assembler contents of all sections\n\
+  -S  --source             Intermix source code with disassembly\n\
+  -s  --full-contents      Display the full contents of all sections requested\n\
+  -g  --debugging          Display debug information in object file\n\
+  -G  --stabs              Display the STABS contents of an ELF format file\n\
+  -t  --syms               Display the contents of the symbol table(s)\n\
+  -T  --dynamic-syms       Display the contents of the dynamic symbol table\n\
+  -r  --reloc              Display the relocation entries in the file\n\
+  -R  --dynamic-reloc      Display the dynamic relocation entries in the file\n\
+  -V  --version            Display this program's version number\n\
+  -i  --info               List object formats and architectures supported\n\
+  -H  --help               Display this information\n\
+"));
+  if (status != 2)
+    {
+      fprintf (stream, _("\n The following switches are optional:\n"));
+      fprintf (stream, _("\
+  -b  --target <bfdname>         Specify the target object format as <bfdname>\n\
+  -m  --architecture <machine>   Specify the target architecture as <machine>\n\
+  -j  --section <name>           Only display information for section <name>\n\
+  -M  --disassembler-options <o> Pass text <o> on to the disassembler\n\
+  -EB --endian=big               Assume big endian format when disassembling\n\
+  -EL --endian=little            Assume little endian format when disassembling\n\
+      --file-start-context       Include context from start of file (with -S)\n\
+  -l  --line-numbers             Include line numbers and filenames in output\n\
+  -C  --demangle                 Decode mangled/processed symbol names\n\
+  -w  --wide                     Format output for more than 80 columns\n\
+  -z  --disassemble-zeroes       Do not skip blocks of zeroes when disassembling\n\
+      --start-address <addr>     Only process data whoes address is >= <addr>\n\
+      --stop-address <addr>      Only process data whoes address is <= <addr>\n\
+      --prefix-addresses         Print complete address alongside disassembly\n\
+      --[no-]show-raw-insn       Display hex alongside symbolic disassembly\n\
+      --adjust-vma <offset>      Add <offset> to all displayed section addresses\n\
+\n"));
+      list_supported_targets (program_name, stream);
+      
+      disassembler_usage (stream);
+    }
   if (status == 0)
     fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
   exit (status);
@@ -251,15 +292,17 @@
   {"private-headers", no_argument, NULL, 'p'},
   {"architecture", required_argument, NULL, 'm'},
   {"archive-headers", no_argument, NULL, 'a'},
-  {"debugging", no_argument, &dump_debugging, 1},
-  {"demangle", no_argument, &do_demangle, 1},
+  {"debugging", no_argument, NULL, 'g'},
+  {"demangle", no_argument, NULL, 'C'},
   {"disassemble", no_argument, NULL, 'd'},
   {"disassemble-all", no_argument, NULL, 'D'},
-  {"disassemble-zeroes", no_argument, &disassemble_zeroes, 1},
+  {"disassembler-options", required_argument, NULL, 'M'},
+  {"disassemble-zeroes", no_argument, NULL, 'z'},
   {"dynamic-reloc", no_argument, NULL, 'R'},
   {"dynamic-syms", no_argument, NULL, 'T'},
   {"endian", required_argument, NULL, OPTION_ENDIAN},
   {"file-headers", no_argument, NULL, 'f'},
+  {"file-start-context", no_argument, &file_start_context, 1},
   {"full-contents", no_argument, NULL, 's'},
   {"headers", no_argument, NULL, 'h'},
   {"help", no_argument, NULL, 'H'},
@@ -272,27 +315,36 @@
   {"section-headers", no_argument, NULL, 'h'},
   {"show-raw-insn", no_argument, &show_raw_insn, 1},
   {"source", no_argument, NULL, 'S'},
-  {"stabs", no_argument, &dump_stab_section_info, 1},
+  {"stabs", no_argument, NULL, 'G'},
   {"start-address", required_argument, NULL, OPTION_START_ADDRESS},
   {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
   {"syms", no_argument, NULL, 't'},
   {"target", required_argument, NULL, 'b'},
-  {"version", no_argument, &show_version, 1},
-  {"wide", no_argument, &wide_output, 'w'},
+  {"version", no_argument, NULL, 'V'},
+  {"wide", no_argument, NULL, 'w'},
   {0, no_argument, 0, 0}
 };
 
 static void
+nonfatal (msg)
+     const char *msg;
+{
+  bfd_nonfatal (msg);
+  exit_status = 1;
+}
+
+static void
 dump_section_header (abfd, section, ignored)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *section;
-     PTR ignored;
+     PTR ignored ATTRIBUTE_UNUSED;
 {
   char *comma = "";
+  unsigned int opb = bfd_octets_per_byte (abfd);
 
   printf ("%3d %-13s %08lx  ", section->index,
 	  bfd_get_section_name (abfd, section),
-	  (unsigned long) bfd_section_size (abfd, section));
+	  (unsigned long) bfd_section_size (abfd, section) / opb);
   printf_vma (bfd_get_section_vma (abfd, section));
   printf ("  ");
   printf_vma (section->lma);
@@ -324,6 +376,8 @@
   PF (SEC_NEVER_LOAD, "NEVER_LOAD");
   PF (SEC_EXCLUDE, "EXCLUDE");
   PF (SEC_SORT_ENTRIES, "SORT_ENTRIES");
+  PF (SEC_SMALL_DATA, "SMALL_DATA");
+  PF (SEC_SHARED, "SHARED");
 
   if ((section->flags & SEC_LINK_ONCE) != 0)
     {
@@ -347,6 +401,11 @@
 	  break;
 	}
       printf ("%s%s", comma, ls);
+
+      if (section->comdat != NULL)
+	printf (" (COMDAT %s %ld)", section->comdat->name,
+		section->comdat->symbol);
+
       comma = ", ";
     }
 
@@ -359,11 +418,17 @@
      bfd *abfd;
 {
   printf (_("Sections:\n"));
+
 #ifndef BFD64
-  printf (_("Idx Name          Size      VMA       LMA       File off  Algn\n"));
+  printf (_("Idx Name          Size      VMA       LMA       File off  Algn"));
 #else
-  printf (_("Idx Name          Size      VMA               LMA               File off  Algn\n"));
+  printf (_("Idx Name          Size      VMA               LMA               File off  Algn"));
 #endif
+
+  if (wide_output)
+    printf (_("  Flags"));
+  printf ("\n");
+
   bfd_map_over_sections (abfd, dump_section_header, (PTR) NULL);
 }
 
@@ -678,6 +743,7 @@
   long min = 0;
   long max = sorted_symcount;
   long thisplace;
+  unsigned int opb = bfd_octets_per_byte (abfd); 
 
   if (sorted_symcount < 1)
     return NULL;
@@ -725,7 +791,7 @@
 	  || ((abfd->flags & HAS_RELOC) != 0
 	      && vma >= bfd_get_section_vma (abfd, sec)
 	      && vma < (bfd_get_section_vma (abfd, sec)
-			+ bfd_section_size (abfd, sec)))))
+			+ bfd_section_size (abfd, sec) / opb))))
     {
       long i;
 
@@ -949,10 +1015,10 @@
    listing.  */
 
 static void
-show_line (abfd, section, off)
+show_line (abfd, section, addr_offset)
      bfd *abfd;
      asection *section;
-     bfd_vma off;
+     bfd_vma addr_offset;
 {
   CONST char *filename;
   CONST char *functionname;
@@ -961,7 +1027,7 @@
   if (! with_line_numbers && ! with_source_code)
     return;
 
-  if (! bfd_find_nearest_line (abfd, section, syms, off, &filename,
+  if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename,
 			       &functionname, &line))
     return;
 
@@ -1013,8 +1079,8 @@
 	      else
 		{
 		  l = line - SHOW_PRECEDING_CONTEXT_LINES;
-		  if (l <= 0)
-		    l = 1;
+		  if (l < 0)
+		    l = 0;
 		}
 
 	      if (p->f == NULL)
@@ -1064,9 +1130,12 @@
 	      p->next = print_files;
 	      print_files = p;
 
-	      l = line - SHOW_PRECEDING_CONTEXT_LINES;
-	      if (l <= 0)
-		l = 1;
+              if (file_start_context)
+                l = 0;
+              else
+                l = line - SHOW_PRECEDING_CONTEXT_LINES;
+	      if (l < 0)
+		l = 0;
 	      skip_to_line (p, l, false);
 	      if (p->f != NULL)
 		skip_to_line (p, line, true);
@@ -1134,7 +1203,7 @@
 
   n = strlen (buf);
 
-  while ((f->buffer + f->size) - f->current < n + 1)
+  while ((size_t) ((f->buffer + f->size) - f->current) < n + 1)
     {
       size_t curroff;
 
@@ -1170,31 +1239,33 @@
 /* Disassemble some data in memory between given values.  */
 
 static void
-disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
+disassemble_bytes (info, disassemble_fn, insns, data, 
+                   start_offset, stop_offset, relppp,
 		   relppend)
      struct disassemble_info *info;
      disassembler_ftype disassemble_fn;
      boolean insns;
      bfd_byte *data;
-     bfd_vma start;
-     bfd_vma stop;
+     bfd_vma start_offset;
+     bfd_vma stop_offset;
      arelent ***relppp;
      arelent **relppend;
 {
   struct objdump_disasm_info *aux;
   asection *section;
-  int bytes_per_line;
+  int octets_per_line;
   boolean done_dot;
   int skip_addr_chars;
-  bfd_vma i;
+  bfd_vma addr_offset;
+  int opb = info->octets_per_byte;
 
   aux = (struct objdump_disasm_info *) info->application_data;
   section = aux->sec;
 
   if (insns)
-    bytes_per_line = 4;
+    octets_per_line = 4;
   else
-    bytes_per_line = 16;
+    octets_per_line = 16;
 
   /* Figure out how many characters to skip at the start of an
      address, to make the disassembly look nicer.  We discard leading
@@ -1206,8 +1277,8 @@
       char buf[30];
       char *s;
 
-      sprintf_vma (buf,
-		   section->vma + bfd_section_size (section->owner, section));
+      sprintf_vma (buf, section->vma + 
+                   bfd_section_size (section->owner, section) / opb);
       s = buf;
       while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
 	     && s[4] == '0')
@@ -1220,34 +1291,35 @@
   info->insn_info_valid = 0;
 
   done_dot = false;
-  i = start;
-  while (i < stop)
+  addr_offset = start_offset;
+  while (addr_offset < stop_offset)
     {
       bfd_vma z;
-      int bytes = 0;
+      int octets = 0;
       boolean need_nl = false;
 
-      /* If we see more than SKIP_ZEROES bytes of zeroes, we just
+      /* If we see more than SKIP_ZEROES octets of zeroes, we just
          print `...'.  */
-      for (z = i; z < stop; z++)
+      for (z = addr_offset * opb; z < stop_offset * opb; z++)
 	if (data[z] != 0)
 	  break;
       if (! disassemble_zeroes
 	  && (info->insn_info_valid == 0
 	      || info->branch_delay_insns == 0)
-	  && (z - i >= SKIP_ZEROES
-	      || (z == stop && z - i < SKIP_ZEROES_AT_END)))
+	  && (z - addr_offset * opb >= SKIP_ZEROES
+	      || (z == stop_offset * opb && 
+                  z - addr_offset * opb < SKIP_ZEROES_AT_END)))
 	{
 	  printf ("\t...\n");
 
-	  /* If there are more nonzero bytes to follow, we only skip
+	  /* If there are more nonzero octets to follow, we only skip
              zeroes in multiples of 4, to try to avoid running over
              the start of an instruction which happens to start with
              zero.  */
-	  if (z != stop)
-	    z = i + ((z - i) &~ 3);
+	  if (z != stop_offset * opb)
+	    z = addr_offset * opb + ((z - addr_offset * opb) &~ 3);
 
-	  bytes = z - i;
+	  octets = z - addr_offset * opb;
 	}
       else
 	{
@@ -1259,13 +1331,13 @@
 	  done_dot = false;
 
 	  if (with_line_numbers || with_source_code)
-	    show_line (aux->abfd, section, i);
+	    show_line (aux->abfd, section, addr_offset);
 
 	  if (! prefix_addresses)
 	    {
 	      char *s;
 
-	      sprintf_vma (buf, section->vma + i);
+	      sprintf_vma (buf, section->vma + addr_offset);
 	      for (s = buf + skip_addr_chars; *s == '0'; s++)
 		*s = ' ';
 	      if (*s == '\0')
@@ -1275,7 +1347,7 @@
 	  else
 	    {
 	      aux->require_sec = true;
-	      objdump_print_address (section->vma + i, info);
+	      objdump_print_address (section->vma + addr_offset, info);
 	      aux->require_sec = false;
 	      putchar (' ');
 	    }
@@ -1290,59 +1362,64 @@
 	      info->bytes_per_line = 0;
 	      info->bytes_per_chunk = 0;
 
-	      /* FIXME: This is wrong.  It tests the number of bytes
+	      /* FIXME: This is wrong.  It tests the number of octets
                  in the last instruction, not the current one.  */
 	      if (*relppp < relppend
-		  && (**relppp)->address >= i
-		  && (**relppp)->address < i + bytes)
+		  && (**relppp)->address >= addr_offset
+		  && (**relppp)->address < addr_offset + octets / opb)
 		info->flags = INSN_HAS_RELOC;
 	      else
 		info->flags = 0;
 
-	      bytes = (*disassemble_fn) (section->vma + i, info);
+	      octets = (*disassemble_fn) (section->vma + addr_offset, info);
 	      info->fprintf_func = (fprintf_ftype) fprintf;
 	      info->stream = stdout;
 	      if (info->bytes_per_line != 0)
-		bytes_per_line = info->bytes_per_line;
-	      if (bytes < 0)
-		break;
+		octets_per_line = info->bytes_per_line;
+	      if (octets < 0)
+		{
+		  if (sfile.current != sfile.buffer)
+		    printf ("%s\n", sfile.buffer);
+		  free (sfile.buffer);
+		  break;
+		}
 	    }
 	  else
 	    {
-	      long j;
+	      bfd_vma j;
 
-	      bytes = bytes_per_line;
-	      if (i + bytes > stop)
-		bytes = stop - i;
+	      octets = octets_per_line;
+	      if (addr_offset + octets / opb > stop_offset)
+		octets = (stop_offset - addr_offset) * opb;
 
-	      for (j = i; j < i + bytes; ++j)
+	      for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
 		{
 		  if (isprint (data[j]))
-		    buf[j - i] = data[j];
+		    buf[j - addr_offset * opb] = data[j];
 		  else
-		    buf[j - i] = '.';
+		    buf[j - addr_offset * opb] = '.';
 		}
-	      buf[j - i] = '\0';
+	      buf[j - addr_offset * opb] = '\0';
 	    }
 
 	  if (prefix_addresses
 	      ? show_raw_insn > 0
 	      : show_raw_insn >= 0)
 	    {
-	      long j;
+	      bfd_vma j;
 
 	      /* If ! prefix_addresses and ! wide_output, we print
-                 bytes_per_line bytes per line.  */
-	      pb = bytes;
-	      if (pb > bytes_per_line && ! prefix_addresses && ! wide_output)
-		pb = bytes_per_line;
+                 octets_per_line octets per line.  */
+	      pb = octets;
+	      if (pb > octets_per_line && ! prefix_addresses && ! wide_output)
+		pb = octets_per_line;
 
 	      if (info->bytes_per_chunk)
 		bpc = info->bytes_per_chunk;
 	      else
 		bpc = 1;
 
-	      for (j = i; j < i + pb; j += bpc)
+	      for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
 		{
 		  int k;
 		  if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
@@ -1359,7 +1436,7 @@
 		    }
 		}
 
-	      for (; pb < bytes_per_line; pb += bpc)
+	      for (; pb < octets_per_line; pb += bpc)
 		{
 		  int k;
 
@@ -1387,25 +1464,25 @@
 	      ? show_raw_insn > 0
 	      : show_raw_insn >= 0)
 	    {
-	      while (pb < bytes)
+	      while (pb < octets)
 		{
-		  long j;
+		  bfd_vma j;
 		  char *s;
 
 		  putchar ('\n');
-		  j = i + pb;
+		  j = addr_offset * opb + pb;
 
-		  sprintf_vma (buf, section->vma + j);
+		  sprintf_vma (buf, section->vma + j / opb);
 		  for (s = buf + skip_addr_chars; *s == '0'; s++)
 		    *s = ' ';
 		  if (*s == '\0')
 		    *--s = '0';
 		  printf ("%s:\t", buf + skip_addr_chars);
 
-		  pb += bytes_per_line;
-		  if (pb > bytes)
-		    pb = bytes;
-		  for (; j < i + pb; j += bpc)
+		  pb += octets_per_line;
+		  if (pb > octets)
+		    pb = octets;
+		  for (; j < addr_offset * opb + pb; j += bpc)
 		    {
 		      int k;
 
@@ -1435,8 +1512,8 @@
 	  && (section->flags & SEC_RELOC) != 0)
 	{
 	  while ((*relppp) < relppend
-		 && ((**relppp)->address >= (bfd_vma) i
-		     && (**relppp)->address < (bfd_vma) i + bytes))
+		 && ((**relppp)->address >= (bfd_vma) addr_offset
+		     && (**relppp)->address < (bfd_vma) addr_offset + octets / opb))
 	    {
 	      arelent *q;
 
@@ -1487,7 +1564,7 @@
       if (need_nl)
 	printf ("\n");
 
-      i += bytes;
+      addr_offset += octets / opb;
     }
 }
 
@@ -1497,11 +1574,12 @@
 disassemble_data (abfd)
      bfd *abfd;
 {
-  long i;
+  unsigned long addr_offset;
   disassembler_ftype disassemble_fn;
   struct disassemble_info disasm_info;
   struct objdump_disasm_info aux;
   asection *section;
+  unsigned int opb = bfd_octets_per_byte (abfd);
 
   print_files = NULL;
   prev_functionname = NULL;
@@ -1523,6 +1601,7 @@
   aux.require_sec = false;
   disasm_info.print_address_func = objdump_print_address;
   disasm_info.symbol_at_address_func = objdump_symbol_at_address;
+  disasm_info.octets_per_byte = opb;
 
   if (machine != (char *) NULL)
     {
@@ -1553,16 +1632,19 @@
       fprintf (stderr, _("%s: Can't disassemble for architecture %s\n"),
 	       program_name,
 	       bfd_printable_arch_mach (bfd_get_arch (abfd), 0));
+      exit_status = 1;
       return;
     }
 
   disasm_info.flavour = bfd_get_flavour (abfd);
   disasm_info.arch = bfd_get_arch (abfd);
   disasm_info.mach = bfd_get_mach (abfd);
+  disasm_info.disassembler_options = disassembler_options;
+  
   if (bfd_big_endian (abfd))
-    disasm_info.endian = BFD_ENDIAN_BIG;
+    disasm_info.display_endian = disasm_info.endian = BFD_ENDIAN_BIG;
   else if (bfd_little_endian (abfd))
-    disasm_info.endian = BFD_ENDIAN_LITTLE;
+    disasm_info.display_endian = disasm_info.endian = BFD_ENDIAN_LITTLE;
   else
     /* ??? Aborting here seems too drastic.  We could default to big or little
        instead.  */
@@ -1577,7 +1659,7 @@
       arelent **relbuf = NULL;
       arelent **relpp = NULL;
       arelent **relppend = NULL;
-      long stop;
+      unsigned long stop_offset;
       asymbol *sym = NULL;
       long place = 0;
 
@@ -1640,37 +1722,37 @@
       disasm_info.buffer_length = datasize;
       if (start_address == (bfd_vma) -1
 	  || start_address < disasm_info.buffer_vma)
-	i = 0;
+	addr_offset = 0;
       else
-	i = start_address - disasm_info.buffer_vma;
+	addr_offset = start_address - disasm_info.buffer_vma;
       if (stop_address == (bfd_vma) -1)
-	stop = datasize;
+	stop_offset = datasize / opb;
       else
 	{
 	  if (stop_address < disasm_info.buffer_vma)
-	    stop = 0;
+	    stop_offset = 0;
 	  else
-	    stop = stop_address - disasm_info.buffer_vma;
-	  if (stop > disasm_info.buffer_length)
-	    stop = disasm_info.buffer_length;
+	    stop_offset = stop_address - disasm_info.buffer_vma;
+	  if (stop_offset > disasm_info.buffer_length / opb)
+	    stop_offset = disasm_info.buffer_length / opb;
 	}
 
-      sym = find_symbol_for_address (abfd, section, section->vma + i,
+      sym = find_symbol_for_address (abfd, section, section->vma + addr_offset,
 				     true, &place);
 
-      while (i < stop)
+      while (addr_offset < stop_offset)
 	{
 	  asymbol *nextsym;
-	  long nextstop;
+	  unsigned long nextstop_offset;
 	  boolean insns;
 	  
-	  if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + i)
+	  if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + addr_offset)
 	    {
 	      int x;
 
 	      for (x = place;
 		   (x < sorted_symcount
-		    && bfd_asymbol_value (sorted_syms[x]) <= section->vma + i);
+		    && bfd_asymbol_value (sorted_syms[x]) <= section->vma + addr_offset);
 		   ++x)
 		continue;
 	      disasm_info.symbols = & sorted_syms[place];
@@ -1683,20 +1765,23 @@
 	    {
 	      printf ("\n");
 	      objdump_print_addr_with_sym (abfd, section, sym,
-					   section->vma + i,
+					   section->vma + addr_offset,
 					   &disasm_info,
 					   false);
 	      printf (":\n");
 	    }
 	  
-	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
+	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + addr_offset)
 	    nextsym = sym;
 	  else if (sym == NULL)
 	    nextsym = NULL;
 	  else
 	    {
+	      /* Search forward for the next appropriate symbol in
+                 SECTION.  Note that all the symbols are sorted
+                 together into one big array, and that some sections
+                 may have overlapping addresses.  */
 	      while (place < sorted_symcount
-		     /* ??? Why the test for != section?  */
 		     && (sorted_syms[place]->section != section
 			 || (bfd_asymbol_value (sorted_syms[place])
 			     <= bfd_asymbol_value (sym))))
@@ -1707,19 +1792,19 @@
 		nextsym = sorted_syms[place];
 	    }
 	  
-	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
+	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + addr_offset)
 	    {
-	      nextstop = bfd_asymbol_value (sym) - section->vma;
-	      if (nextstop > stop)
-		nextstop = stop;
+	      nextstop_offset = bfd_asymbol_value (sym) - section->vma;
+	      if (nextstop_offset > stop_offset)
+		nextstop_offset = stop_offset;
 	    }
 	  else if (nextsym == NULL)
-	    nextstop = stop;
+	    nextstop_offset = stop_offset;
 	  else
 	    {
-	      nextstop = bfd_asymbol_value (nextsym) - section->vma;
-	      if (nextstop > stop)
-		nextstop = stop;
+	      nextstop_offset = bfd_asymbol_value (nextsym) - section->vma;
+	      if (nextstop_offset > stop_offset)
+		nextstop_offset = stop_offset;
 	    }
 	  
 	  /* If a symbol is explicitly marked as being an object
@@ -1727,7 +1812,7 @@
 	     disassembling them.  */
 	  if (disassemble_all
 	      || sym == NULL
-	      || bfd_asymbol_value (sym) > section->vma + i
+	      || bfd_asymbol_value (sym) > section->vma + addr_offset
 	      || ((sym->flags & BSF_OBJECT) == 0
 		  && (strstr (bfd_asymbol_name (sym), "gnu_compiled")
 		      == NULL)
@@ -1738,10 +1823,10 @@
 	  else
 	    insns = false;
 	  
-	  disassemble_bytes (&disasm_info, disassemble_fn, insns, data, i,
-			     nextstop, &relpp, relppend);
+	  disassemble_bytes (&disasm_info, disassemble_fn, insns, data, 
+                             addr_offset, nextstop_offset, &relpp, relppend);
 	  
-	  i = nextstop;
+	  addr_offset = nextstop_offset;
 	  sym = nextsym;
 	}
       
@@ -1804,6 +1889,7 @@
     {
       fprintf (stderr, _("%s: %s has no %s section\n"), program_name,
 	       bfd_get_filename (abfd), strsect_name);
+      exit_status = 1;
       return false;
     }
  
@@ -1820,6 +1906,7 @@
 	       bfd_errmsg (bfd_get_error ()));
       free (stabs);
       free (strtab);
+      exit_status = 1;
       return false;
     }
 
@@ -1831,6 +1918,7 @@
 	       bfd_errmsg (bfd_get_error ()));
       free (stabs);
       free (strtab);
+      exit_status = 1;
       return false;
     }
 
@@ -1859,7 +1947,7 @@
 print_section_stabs (abfd, stabsect_name, strsect_name)
      bfd *abfd;
      const char *stabsect_name;
-     const char *strsect_name;
+     const char *strsect_name ATTRIBUTE_UNUSED;
 {
   int i;
   unsigned file_string_table_offset = 0, next_file_string_table_offset = 0;
@@ -1996,23 +2084,12 @@
   bfd_print_private_bfd_data (abfd, stdout);
 }
 
+/* Dump selected contents of ABFD */
+
 static void
-display_bfd (abfd)
+dump_bfd (abfd)
      bfd *abfd;
 {
-  char **matching;
-
-  if (!bfd_check_format_matches (abfd, bfd_object, &matching))
-    {
-      bfd_nonfatal (bfd_get_filename (abfd));
-      if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
-	{
-	  list_matching_formats (matching);
-	  free (matching);
-	}
-      return;
-    }
-
   /* If we are adjusting section VMA's, change them all now.  Changing
      the BFD information is a hack.  However, we must do it, or
      bfd_find_nearest_line will not do the right thing.  */
@@ -2068,8 +2145,12 @@
       if (dhandle != NULL)
 	{
 	  if (! print_debugging_info (stdout, dhandle))
-	    fprintf (stderr, _("%s: printing debugging information failed\n"),
-		     bfd_get_filename (abfd));
+	    {
+	      fprintf (stderr,
+		       _("%s: printing debugging information failed\n"),
+		       bfd_get_filename (abfd));
+	      exit_status = 1;
+	    }
 	}
     }
   if (syms)
@@ -2085,6 +2166,47 @@
 }
 
 static void
+display_bfd (abfd)
+     bfd *abfd;
+{
+  char **matching;
+
+  if (bfd_check_format_matches (abfd, bfd_object, &matching))
+    {
+      dump_bfd (abfd);
+      return;
+    }
+
+  if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
+    {
+      nonfatal (bfd_get_filename (abfd));
+      list_matching_formats (matching);
+      free (matching);
+      return;
+    }
+
+  if (bfd_get_error () != bfd_error_file_not_recognized)
+    {
+      nonfatal (bfd_get_filename (abfd));
+      return;
+    }
+
+  if (bfd_check_format_matches (abfd, bfd_core, &matching))
+    {
+      dump_bfd (abfd);
+      return;
+    }
+
+  nonfatal (bfd_get_filename (abfd));
+
+  if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
+    {
+      list_matching_formats (matching);
+      free (matching);
+    }
+}
+
+static void
 display_file (filename, target)
      char *filename;
      char *target;
@@ -2094,7 +2216,7 @@
   file = bfd_openr (filename, target);
   if (file == NULL)
     {
-      bfd_nonfatal (filename);
+      nonfatal (filename);
       return;
     }
 
@@ -2111,9 +2233,7 @@
 	  if (arfile == NULL)
 	    {
 	      if (bfd_get_error () != bfd_error_no_more_archived_files)
-		{
-		  bfd_nonfatal (bfd_get_filename (file));
-		}
+		nonfatal (bfd_get_filename (file));
 	      break;
 	    }
 
@@ -2142,8 +2262,9 @@
   asection *section;
   bfd_byte *data = 0;
   bfd_size_type datasize = 0;
-  bfd_size_type i;
-  bfd_size_type start, stop;
+  bfd_size_type addr_offset;
+  bfd_size_type start_offset, stop_offset;
+  unsigned int opb = bfd_octets_per_byte (abfd);
 
   for (section = abfd->sections; section != NULL; section =
        section->next)
@@ -2167,28 +2288,31 @@
 
 	      if (start_address == (bfd_vma) -1
 		  || start_address < section->vma)
-		start = 0;
+		start_offset = 0;
 	      else
-		start = start_address - section->vma;
+		start_offset = start_address - section->vma;
 	      if (stop_address == (bfd_vma) -1)
-		stop = bfd_section_size (abfd, section);
+		stop_offset = bfd_section_size (abfd, section) / opb;
 	      else
 		{
 		  if (stop_address < section->vma)
-		    stop = 0;
+		    stop_offset = 0;
 		  else
-		    stop = stop_address - section->vma;
-		  if (stop > bfd_section_size (abfd, section))
-		    stop = bfd_section_size (abfd, section);
+		    stop_offset = stop_address - section->vma;
+		  if (stop_offset > bfd_section_size (abfd, section) / opb)
+		    stop_offset = bfd_section_size (abfd, section) / opb;
 		}
-	      for (i = start; i < stop; i += onaline)
+	      for (addr_offset = start_offset; 
+                   addr_offset < stop_offset; addr_offset += onaline)
 		{
 		  bfd_size_type j;
 
-		  printf (" %04lx ", (unsigned long int) (i + section->vma));
-		  for (j = i; j < i + onaline; j++)
+		  printf (" %04lx ", (unsigned long int) 
+                          (addr_offset + section->vma));
+		  for (j = addr_offset * opb; 
+                       j < addr_offset * opb + onaline; j++)
 		    {
-		      if (j < stop)
+		      if (j < stop_offset * opb)
 			printf ("%02x", (unsigned) (data[j]));
 		      else
 			printf ("  ");
@@ -2197,9 +2321,9 @@
 		    }
 
 		  printf (" ");
-		  for (j = i; j < i + onaline; j++)
+		  for (j = addr_offset; j < addr_offset * opb + onaline; j++)
 		    {
-		      if (j >= stop)
+		      if (j >= stop_offset * opb)
 			printf (" ");
 		      else
 			printf ("%c", isprint (data[j]) ? data[j] : '.');
@@ -2215,7 +2339,7 @@
 /* Should perhaps share code and display with nm? */
 static void
 dump_symbols (abfd, dynamic)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      boolean dynamic;
 {
   asymbol **current;
@@ -2468,7 +2592,10 @@
       if (sym_name)
 	{
 	  printf_vma (q->address);
-	  printf (" %-16s  ", q->howto->name);
+	  if (q->howto->name)
+	    printf (" %-16s  ", q->howto->name);
+	  else
+	    printf (" %-16d  ", q->howto->type);
 	  objdump_print_symname (abfd, (struct disassemble_info *) NULL,
 				 *q->sym_ptr_ptr);
 	}
@@ -2528,14 +2655,14 @@
 
       if (abfd == NULL)
 	{
-	  bfd_nonfatal (dummy_name);
+	  nonfatal (dummy_name);
 	  continue;
 	}
 
       if (! bfd_set_format (abfd, bfd_object))
 	{
 	  if (bfd_get_error () != bfd_error_invalid_operation)
-	    bfd_nonfatal (p->name);
+	    nonfatal (p->name);
 	  continue;
 	}
 
@@ -2581,7 +2708,7 @@
 
 	    if (abfd == NULL)
 	      {
-		bfd_nonfatal (p->name);
+		nonfatal (p->name);
 		ok = false;
 	      }
 
@@ -2590,7 +2717,7 @@
 		if (! bfd_set_format (abfd, bfd_object))
 		  {
 		    if (bfd_get_error () != bfd_error_invalid_operation)
-		      bfd_nonfatal (p->name);
+		      nonfatal (p->name);
 		    ok = false;
 		  }
 	      }
@@ -2686,12 +2813,10 @@
   bfd_init ();
   set_default_bfd_target ();
 
-  while ((c = getopt_long (argc, argv, "pib:m:VCdDlfahrRtTxsSj:wE:",
+  while ((c = getopt_long (argc, argv, "pib:m:M:VCdDlfahHrRtTxsSj:wE:zgG",
 			   long_options, (int *) 0))
 	 != EOF)
     {
-      if (c != 'l' && c != OPTION_START_ADDRESS && c != OPTION_STOP_ADDRESS)
-	seenflag = true;
       switch (c)
 	{
 	case 0:
@@ -2699,73 +2824,23 @@
 	case 'm':
 	  machine = optarg;
 	  break;
+	case 'M':
+	  disassembler_options = optarg;
+	  break;
 	case 'j':
 	  only = optarg;
 	  break;
 	case 'l':
-	  with_line_numbers = 1;
+	  with_line_numbers = true;
 	  break;
 	case 'b':
 	  target = optarg;
 	  break;
-	case 'f':
-	  dump_file_header = true;
-	  break;
-	case 'i':
-	  formats_info = true;
-	  break;
-	case 'p':
-	  dump_private_headers = 1;
-	  break;
-	case 'x':
-	  dump_private_headers = 1;
-	  dump_symtab = 1;
-	  dump_reloc_info = 1;
-	  dump_file_header = true;
-	  dump_ar_hdrs = 1;
-	  dump_section_headers = 1;
-	  break;
-	case 't':
-	  dump_symtab = 1;
-	  break;
-	case 'T':
-	  dump_dynamic_symtab = 1;
-	  break;
 	case 'C':
-	  do_demangle = 1;
-	  break;
-	case 'd':
-	  disassemble = true;
-	  break;
-	case 'D':
-	  disassemble = disassemble_all = true;
-	  break;
-	case 'S':
-	  disassemble = true;
-	  with_source_code = true;
-	  break;
-	case 's':
-	  dump_section_contents = 1;
-	  break;
-	case 'r':
-	  dump_reloc_info = 1;
-	  break;
-	case 'R':
-	  dump_dynamic_reloc_info = 1;
-	  break;
-	case 'a':
-	  dump_ar_hdrs = 1;
-	  break;
-	case 'h':
-	  dump_section_headers = 1;
-	  break;
-	case 'H':
-	  usage (stdout, 0);
-	case 'V':
-	  show_version = 1;
+	  do_demangle = true;
 	  break;
 	case 'w':
-	  wide_output = 1;
+	  wide_output = true;
 	  break;
 	case OPTION_ADJUST_VMA:
 	  adjust_section_vma = parse_vma (optarg, "--adjust-vma");
@@ -2783,7 +2858,8 @@
 	    endian = BFD_ENDIAN_LITTLE;
 	  else
 	    {
-	      fprintf (stderr, _("%s: unrecognized -E option\n"), program_name);
+	      fprintf (stderr, _("%s: unrecognized -E option\n"),
+		       program_name);
 	      usage (stderr, 1);
 	    }
 	  break;
@@ -2799,6 +2875,89 @@
 	      usage (stderr, 1);
 	    }
 	  break;
+	  
+	case 'f':
+	  dump_file_header = true;
+	  seenflag = true;
+	  break;
+	case 'i':
+	  formats_info = true;
+	  seenflag = true;
+	  break;
+	case 'p':
+	  dump_private_headers = true;
+	  seenflag = true;
+	  break;
+	case 'x':
+	  dump_private_headers = true;
+	  dump_symtab = true;
+	  dump_reloc_info = true;
+	  dump_file_header = true;
+	  dump_ar_hdrs = true;
+	  dump_section_headers = true;
+	  seenflag = true;
+	  break;
+	case 't':
+	  dump_symtab = true;
+	  seenflag = true;
+	  break;
+	case 'T':
+	  dump_dynamic_symtab = true;
+	  seenflag = true;
+	  break;
+	case 'd':
+	  disassemble = true;
+	  seenflag = true;
+	  break;
+	case 'z':
+	  disassemble_zeroes = true;
+	  break;
+	case 'D':
+	  disassemble = true;
+	  disassemble_all = true;
+	  seenflag = true;
+	  break;
+	case 'S':
+	  disassemble = true;
+	  with_source_code = true;
+	  seenflag = true;
+	  break;
+	case 'g':
+	  dump_debugging = 1;
+	  seenflag = true;
+	  break;
+	case 'G':
+	  dump_stab_section_info = true;
+	  seenflag = true;
+	  break;
+	case 's':
+	  dump_section_contents = true;
+	  seenflag = true;
+	  break;
+	case 'r':
+	  dump_reloc_info = true;
+	  seenflag = true;
+	  break;
+	case 'R':
+	  dump_dynamic_reloc_info = true;
+	  seenflag = true;
+	  break;
+	case 'a':
+	  dump_ar_hdrs = true;
+	  seenflag = true;
+	  break;
+	case 'h':
+	  dump_section_headers = true;
+	  seenflag = true;
+	  break;
+	case 'H':
+	  usage (stdout, 0);
+	  seenflag = true;
+	case 'V':
+	  show_version = true;
+	  seenflag = true;
+	  break;
+	  
 	default:
 	  usage (stderr, 1);
 	}
@@ -2808,12 +2967,10 @@
     print_version ("objdump");
 
   if (seenflag == false)
-    usage (stderr, 1);
+    usage (stderr, 2);
 
   if (formats_info)
-    {
-      display_info ();
-    }
+    display_info ();
   else
     {
       if (optind == argc)
@@ -2825,5 +2982,5 @@
 
   END_PROGRESS (program_name);
 
-  return 0;
+  return exit_status;
 }
diff --git a/binutils/po/POTFILES.in b/binutils/po/POTFILES.in
index 47f3860..a3a0586 100644
--- a/binutils/po/POTFILES.in
+++ b/binutils/po/POTFILES.in
@@ -1,4 +1,3 @@
-readelf.c
 addr2line.c
 ar.c
 arsup.c
@@ -10,6 +9,7 @@
 coffgrok.c
 coffgrok.h
 debug.c
+debug.c
 debug.h
 dlltool.c
 dlltool.h
@@ -18,6 +18,7 @@
 dyn-string.h
 filemode.c
 ieee.c
+ieee.c
 is-ranlib.c
 is-strip.c
 maybe-ranlib.c
@@ -31,7 +32,10 @@
 objdump.c
 prdbg.c
 rdcoff.c
+rdcoff.c
 rddbg.c
+rddbg.c
+readelf.c
 rename.c
 resbin.c
 rescoff.c
@@ -40,6 +44,7 @@
 size.c
 srconv.c
 stabs.c
+stabs.c
 strings.c
 sysdump.c
 version.c
@@ -48,5 +53,3 @@
 winduni.c
 winduni.h
 wrstabs.c
-testsuite/binutils-all/readelf.h
-testsuite/binutils-all/testprog.c
diff --git a/binutils/po/binutils.pot b/binutils/po/binutils.pot
index beeb383..42b808e 100644
--- a/binutils/po/binutils.pot
+++ b/binutils/po/binutils.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-04-26 10:11-0600\n"
+"POT-Creation-Date: 2000-02-25 22:16-0500\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,8 +22,8 @@
 "       [--basenames] [--functions] [addr addr ...]\n"
 msgstr ""
 
-#: addr2line.c:83 ar.c:255 nlmconv.c:1141 nm.c:304 objcopy.c:318 objcopy.c:337
-#: objdump.c:236 readelf.c:1133 size.c:89 strings.c:512 windres.c:723
+#: addr2line.c:83 ar.c:286 nlmconv.c:1141 nm.c:304 objcopy.c:344 objcopy.c:376
+#: objdump.c:277 readelf.c:1697 size.c:89 strings.c:512 windres.c:737
 msgid "Report bugs to bug-gnu-utils@gnu.org\n"
 msgstr ""
 
@@ -32,231 +32,240 @@
 msgid "%s: can not get addresses from archive"
 msgstr ""
 
-#: ar.c:207
+#: ar.c:235
 #, c-format
 msgid "no entry %s in archive\n"
 msgstr ""
 
-#: ar.c:224
+#: ar.c:252
 #, c-format
 msgid ""
-"Usage: %s [-]{dmpqrstx}[abcilosSuvV] [member-name] archive-file file...\n"
+"Usage: %s [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file "
+"file...\n"
 msgstr ""
 
-#: ar.c:226
+#: ar.c:255
 #, c-format
 msgid "       %s -M [<mri-script]\n"
 msgstr ""
 
-#: ar.c:227
+#: ar.c:256
 msgid " commands:\n"
 msgstr ""
 
-#: ar.c:228
+#: ar.c:257
 msgid "  d            - delete file(s) from the archive\n"
 msgstr ""
 
-#: ar.c:229
+#: ar.c:258
 msgid "  m[ab]        - move file(s) in the archive\n"
 msgstr ""
 
-#: ar.c:230
+#: ar.c:259
 msgid "  p            - print file(s) found in the archive\n"
 msgstr ""
 
-#: ar.c:231
+#: ar.c:260
 msgid "  q[f]         - quick append file(s) to the archive\n"
 msgstr ""
 
-#: ar.c:232
+#: ar.c:261
 msgid ""
 "  r[ab][f][u]  - replace existing or insert new file(s) into the archive\n"
 msgstr ""
 
-#: ar.c:233
+#: ar.c:262
 msgid "  t            - display contents of archive\n"
 msgstr ""
 
-#: ar.c:234
+#: ar.c:263
 msgid "  x[o]         - extract file(s) from the archive\n"
 msgstr ""
 
-#: ar.c:235
+#: ar.c:264
 msgid " command specific modifiers:\n"
 msgstr ""
 
-#: ar.c:236
+#: ar.c:265
 msgid "  [a]          - put file(s) after [member-name]\n"
 msgstr ""
 
-#: ar.c:237
+#: ar.c:266
 msgid "  [b]          - put file(s) before [member-name] (same as [i])\n"
 msgstr ""
 
-#: ar.c:238
+#: ar.c:267
+msgid "  [N]          - use instance [count] of name\n"
+msgstr ""
+
+#: ar.c:268
 msgid "  [f]          - truncate inserted file names\n"
 msgstr ""
 
-#: ar.c:239
+#: ar.c:269
+msgid "  [P]          - use full path names when matching\n"
+msgstr ""
+
+#: ar.c:270
 msgid "  [o]          - preserve original dates\n"
 msgstr ""
 
-#: ar.c:240
+#: ar.c:271
 msgid ""
 "  [u]          - only replace files that are newer than current archive "
 "contents\n"
 msgstr ""
 
-#: ar.c:241
+#: ar.c:272
 msgid " generic modifiers:\n"
 msgstr ""
 
-#: ar.c:242
+#: ar.c:273
 msgid "  [c]          - do not warn if the library had to be created\n"
 msgstr ""
 
-#: ar.c:243
+#: ar.c:274
 msgid "  [s]          - create an archive index (cf. ranlib)\n"
 msgstr ""
 
-#: ar.c:244
+#: ar.c:275
 msgid "  [S]          - do not build a symbol table\n"
 msgstr ""
 
-#: ar.c:245
+#: ar.c:276
 msgid "  [v]          - be verbose\n"
 msgstr ""
 
-#: ar.c:246
+#: ar.c:277
 msgid "  [V]          - display the version number\n"
 msgstr ""
 
-#: ar.c:250
+#: ar.c:281
 #, c-format
 msgid "Usage: %s [-vV] archive\n"
 msgstr ""
 
-#: ar.c:431
+#: ar.c:466
 msgid "two different operation options specified"
 msgstr ""
 
-#: ar.c:500
+#: ar.c:541
 #, c-format
 msgid "%s: illegal option -- %c\n"
 msgstr ""
 
-#: ar.c:532
+#: ar.c:573
 msgid "no operation specified"
 msgstr ""
 
-#: ar.c:535
+#: ar.c:576
 msgid "`u' is only meaningful with the `r' option."
 msgstr ""
 
-#: ar.c:615
+#: ar.c:586
+msgid "`N' is only meaningful with the `x' and 'd' options."
+msgstr ""
+
+#: ar.c:589
+msgid "Value for `N' must be positive."
+msgstr ""
+
+#: ar.c:672
 #, c-format
 msgid "%s: internal error -- this option not implemented\n"
 msgstr ""
 
-#: ar.c:730 ar.c:782 ar.c:1212
+#: ar.c:790 ar.c:841 ar.c:1283 objcopy.c:1021
 #, c-format
 msgid "internal stat error on %s"
 msgstr ""
 
-#: ar.c:734
-#, c-format
-msgid ""
-"\n"
-"<member %s>\n"
-"\n"
-msgstr ""
-
-#: ar.c:751 ar.c:819
+#: ar.c:810 ar.c:878
 #, c-format
 msgid "%s is not a valid archive"
 msgstr ""
 
-#: ar.c:787
+#: ar.c:846
 #, c-format
 msgid "stat returns negative size for %s"
 msgstr ""
 
-#: ar.c:908
+#: ar.c:967
 #, c-format
 msgid "%s is not an archive"
 msgstr ""
 
-#: ar.c:915
+#: ar.c:974
 #, c-format
 msgid "%s: creating %s\n"
 msgstr ""
 
-#: ar.c:1110
+#: ar.c:1181
 #, c-format
 msgid "No member named `%s'\n"
 msgstr ""
 
-#: ar.c:1162
+#: ar.c:1233
 #, c-format
 msgid "%s: no entry %s in archive %s!\n"
 msgstr ""
 
-#: ar.c:1322
+#: ar.c:1395
 #, c-format
 msgid "%s: no archive map to update"
 msgstr ""
 
-#: arsup.c:86
+#: arsup.c:87
 #, c-format
 msgid "No entry %s in archive.\n"
 msgstr ""
 
-#: arsup.c:118
+#: arsup.c:119
 #, c-format
 msgid "Can't open file %s\n"
 msgstr ""
 
-#: arsup.c:166
+#: arsup.c:167
 #, c-format
 msgid "%s: Can't open output archive %s\n"
 msgstr ""
 
-#: arsup.c:178
+#: arsup.c:179
 #, c-format
 msgid "%s: Can't open input archive %s\n"
 msgstr ""
 
-#: arsup.c:184
+#: arsup.c:185
 #, c-format
 msgid "%s: file %s is not an archive\n"
 msgstr ""
 
-#: arsup.c:225
+#: arsup.c:226
 #, c-format
 msgid "%s: no output archive specified yet\n"
 msgstr ""
 
-#: arsup.c:245 arsup.c:280 arsup.c:316 arsup.c:336 arsup.c:394
+#: arsup.c:246 arsup.c:281 arsup.c:317 arsup.c:337 arsup.c:395
 #, c-format
 msgid "%s: no open output archive\n"
 msgstr ""
 
-#: arsup.c:253 arsup.c:354 arsup.c:374
+#: arsup.c:254 arsup.c:355 arsup.c:375
 #, c-format
 msgid "%s: can't open file %s\n"
 msgstr ""
 
-#: arsup.c:301 arsup.c:370 arsup.c:449
+#: arsup.c:302 arsup.c:371 arsup.c:450
 #, c-format
 msgid "%s: can't find module file %s\n"
 msgstr ""
 
-#: arsup.c:401
+#: arsup.c:402
 #, c-format
 msgid "Current open archive is %s\n"
 msgstr ""
 
-#: arsup.c:428
+#: arsup.c:429
 #, c-format
 msgid "%s: no open  archive\n"
 msgstr ""
@@ -398,294 +407,338 @@
 msgid "debug_get_real_type: circular debug information for %s\n"
 msgstr ""
 
-#: debug.c:2663
+#: debug.c:2662
 msgid "debug_write_type: illegal type encountered"
 msgstr ""
 
-#: dlltool.c:627 dlltool.c:646 dlltool.c:666
+#: dlltool.c:770 dlltool.c:794 dlltool.c:819
 #, c-format
 msgid "Internal error: Unknown machine type: %d\n"
 msgstr ""
 
-#: dlltool.c:700
+#: dlltool.c:856
 #, c-format
 msgid "Can't open def file: %s"
 msgstr ""
 
-#: dlltool.c:705
+#: dlltool.c:861
 #, c-format
 msgid "Processing def file: %s"
 msgstr ""
 
-#: dlltool.c:709
+#: dlltool.c:865
 msgid "Processed def file"
 msgstr ""
 
-#: dlltool.c:734
+#: dlltool.c:890
 #, c-format
 msgid "Syntax error in def file %s:%d\n"
 msgstr ""
 
-#: dlltool.c:767
+#: dlltool.c:923
 #, c-format
 msgid "NAME: %s base: %x"
 msgstr ""
 
-#: dlltool.c:770
+#: dlltool.c:926
 msgid "Can't have LIBRARY and NAME\n"
 msgstr ""
 
-#: dlltool.c:786
+#: dlltool.c:942
 #, c-format
 msgid "LIBRARY: %s base: %x"
 msgstr ""
 
-#: dlltool.c:789
+#: dlltool.c:945
 #, c-format
 msgid "%s: Can't have LIBRARY and NAME\n"
 msgstr ""
 
-#: dlltool.c:1044
+#: dlltool.c:1200 resrc.c:271
 #, c-format
 msgid "wait: %s"
 msgstr ""
 
-#: dlltool.c:1049
+#: dlltool.c:1205 resrc.c:276
 #, c-format
 msgid "subprocess got fatal signal %d"
 msgstr ""
 
-#: dlltool.c:1055
+#: dlltool.c:1211
 #, c-format
 msgid "%s exited with status %d\n"
 msgstr ""
 
-#: dlltool.c:1087
+#: dlltool.c:1243
 #, c-format
-msgid "Sucking in info from .drective section in %s\n"
+msgid "Sucking in info from %s section in %s\n"
 msgstr ""
 
-#: dlltool.c:1197
+#: dlltool.c:1367
 #, c-format
 msgid "Excluding symbol: %s\n"
 msgstr ""
 
-#: dlltool.c:1292 dlltool.c:1303 nm.c:902 nm.c:913 objdump.c:379 objdump.c:396
+#: dlltool.c:1462 dlltool.c:1473 nm.c:902 nm.c:913 objdump.c:444 objdump.c:461
 #, c-format
 msgid "%s: no symbols\n"
 msgstr ""
 
 #. FIXME: we ought to read in and block out the base relocations
-#: dlltool.c:1330
+#: dlltool.c:1500
 #, c-format
-msgid "%s: Done reading %s\n"
+msgid "Done reading %s\n"
 msgstr ""
 
-#: dlltool.c:1341
+#: dlltool.c:1511
 #, c-format
 msgid "Unable to open object file: %s"
 msgstr ""
 
-#: dlltool.c:1344
+#: dlltool.c:1514
 #, c-format
 msgid "Scanning object file %s"
 msgstr ""
 
-#: dlltool.c:1434
+#: dlltool.c:1529
+#, c-format
+msgid "Cannot produce mcore-elf dll from archive file: %s"
+msgstr ""
+
+#: dlltool.c:1621
 msgid "Adding exports to output file"
 msgstr ""
 
-#: dlltool.c:1479
+#: dlltool.c:1666
 msgid "Added exports to output file"
 msgstr ""
 
-#: dlltool.c:1587
+#: dlltool.c:1790
 #, c-format
 msgid "Generating export file: %s\n"
 msgstr ""
 
-#: dlltool.c:1592
+#: dlltool.c:1795
 #, c-format
 msgid "Unable to open temporary assembler file: %s"
 msgstr ""
 
-#: dlltool.c:1595
+#: dlltool.c:1798
 #, c-format
 msgid "Opened temporary file: %s"
 msgstr ""
 
-#: dlltool.c:1828
+#: dlltool.c:2012
 msgid "Generated exports file"
 msgstr ""
 
-#: dlltool.c:2081
+#: dlltool.c:2267
 #, c-format
 msgid "bfd_open failed open stub file: %s"
 msgstr ""
 
-#: dlltool.c:2084
+#: dlltool.c:2270
 #, c-format
 msgid "Creating stub file: %s"
 msgstr ""
 
-#: dlltool.c:2593
+#: dlltool.c:2657
+#, c-format
+msgid "failed to open temporary head file: %s"
+msgstr ""
+
+#: dlltool.c:2716
+#, c-format
+msgid "failed to open temporary tail file: %s"
+msgstr ""
+
+#: dlltool.c:2784
 #, c-format
 msgid "Can't open .lib file: %s"
 msgstr ""
 
-#: dlltool.c:2596
+#: dlltool.c:2787
 #, c-format
 msgid "Creating library file: %s\n"
 msgstr ""
 
-#: dlltool.c:2652
+#: dlltool.c:2846
 #, c-format
 msgid "cannot delete %s: %s\n"
 msgstr ""
 
-#: dlltool.c:2656
+#: dlltool.c:2850
 msgid "Created lib file"
 msgstr ""
 
-#: dlltool.c:2757
+#: dlltool.c:2955
 #, c-format
 msgid "Warning, ignoring duplicate EXPORT %s %d,%d\n"
 msgstr ""
 
-#: dlltool.c:2763
+#: dlltool.c:2961
 #, c-format
 msgid "Error, duplicate EXPORT with oridinals: %s"
 msgstr ""
 
-#: dlltool.c:2890
+#: dlltool.c:3088
 msgid "Processing definitions"
 msgstr ""
 
-#: dlltool.c:2928
+#: dlltool.c:3126
 msgid "Processed definitions"
 msgstr ""
 
 #. xgetext:c-format
-#: dlltool.c:2939
+#: dlltool.c:3137
 #, c-format
 msgid "Usage %s <options> <object-files>\n"
 msgstr ""
 
 #. xgetext:c-format
-#: dlltool.c:2941
+#: dlltool.c:3139
 #, c-format
 msgid ""
-"   -m --machine <machine>    Create {arm, i386, ppc, thumb} DLL. [default: "
-"%s]\n"
+"   -m --machine <machine>    Create as DLL for <machine>.  [default: %s]\n"
 msgstr ""
 
-#: dlltool.c:2942
+#: dlltool.c:3140
+msgid ""
+"        possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, "
+"ppc, thumb\n"
+msgstr ""
+
+#: dlltool.c:3141
 msgid "   -e --output-exp <outname> Generate an export file.\n"
 msgstr ""
 
-#: dlltool.c:2943
+#: dlltool.c:3142
 msgid "   -l --output-lib <outname> Generate an interface library.\n"
 msgstr ""
 
-#: dlltool.c:2944
+#: dlltool.c:3143
 msgid "   -a --add-indirect         Add dll indirects to export file.\n"
 msgstr ""
 
-#: dlltool.c:2945
+#: dlltool.c:3144
 msgid ""
 "   -D --dllname <name>       Name of input dll to put into interface lib.\n"
 msgstr ""
 
-#: dlltool.c:2946
+#: dlltool.c:3145
 msgid "   -d --input-def <deffile>  Name of .def file to be read in.\n"
 msgstr ""
 
-#: dlltool.c:2947
+#: dlltool.c:3146
 msgid "   -z --output-def <deffile> Name of .def file to be created.\n"
 msgstr ""
 
-#: dlltool.c:2948
-msgid "   --export-all-symbols      Export all symbols to .def\n"
+#: dlltool.c:3147
+msgid "      --export-all-symbols   Export all symbols to .def\n"
 msgstr ""
 
-#: dlltool.c:2949
-msgid "   --no-export-all-symbols   Only export listed symbols\n"
+#: dlltool.c:3148
+msgid "      --no-export-all-symbols  Only export listed symbols\n"
 msgstr ""
 
-#: dlltool.c:2950
-msgid "   --exclude-symbols <list>  Don't export <list>\n"
+#: dlltool.c:3149
+msgid "      --exclude-symbols <list> Don't export <list>\n"
 msgstr ""
 
-#: dlltool.c:2951
-msgid "   --no-default-excludes     Clear default exclude symbols\n"
+#: dlltool.c:3150
+msgid "      --no-default-excludes  Clear default exclude symbols\n"
 msgstr ""
 
-#: dlltool.c:2952
+#: dlltool.c:3151
 msgid "   -b --base-file <basefile> Read linker generated base file.\n"
 msgstr ""
 
-#: dlltool.c:2953
+#: dlltool.c:3152
 msgid "   -x --no-idata4            Don't generate idata$4 section.\n"
 msgstr ""
 
-#: dlltool.c:2954
+#: dlltool.c:3153
 msgid "   -c --no-idata5            Don't generate idata$5 section.\n"
 msgstr ""
 
-#: dlltool.c:2955
+#: dlltool.c:3154
 msgid ""
 "   -U --add-underscore       Add underscores to symbols in interface "
 "library.\n"
 msgstr ""
 
-#: dlltool.c:2956
+#: dlltool.c:3155
 msgid "   -k --kill-at              Kill @<n> from exported names.\n"
 msgstr ""
 
-#: dlltool.c:2957
+#: dlltool.c:3156
 msgid "   -A --add-stdcall-alias    Add aliases without @<n>.\n"
 msgstr ""
 
-#: dlltool.c:2958
+#: dlltool.c:3157
 msgid "   -S --as <name>            Use <name> for assembler.\n"
 msgstr ""
 
-#: dlltool.c:2959
+#: dlltool.c:3158
 msgid "   -f --as-flags <flags>     Pass <flags> to the assembler.\n"
 msgstr ""
 
-#: dlltool.c:2961
-msgid "   -i --interwork            Support ARM/Thumb interworking.\n"
+#: dlltool.c:3159
+msgid ""
+"   -C --compat-implib        Create backward compatible import library.\n"
 msgstr ""
 
-#: dlltool.c:2963
+#: dlltool.c:3160
 msgid ""
 "   -n --no-delete            Keep temp files (repeat for extra "
 "preservation).\n"
 msgstr ""
 
-#: dlltool.c:2964
+#: dlltool.c:3161
 msgid "   -v --verbose              Be verbose.\n"
 msgstr ""
 
-#: dlltool.c:2965
+#: dlltool.c:3162
 msgid "   -V --version              Display the program version.\n"
 msgstr ""
 
-#: dlltool.c:2966
+#: dlltool.c:3163
 msgid "   -h --help                 Display this information.\n"
 msgstr ""
 
-#: dlltool.c:3120
+#: dlltool.c:3165
+msgid ""
+"   -M --mcore-elf <outname>  Process mcore-elf object files into <outname>.\n"
+msgstr ""
+
+#: dlltool.c:3166
+msgid "   -L --linker <name>        Use <name> as the linker.\n"
+msgstr ""
+
+#: dlltool.c:3167
+msgid "   -F --linker-flags <flags> Pass <flags> to the linker.\n"
+msgstr ""
+
+#: dlltool.c:3311
 #, c-format
 msgid "Unable to open base-file: %s"
 msgstr ""
 
-#: dlltool.c:3137
+#: dlltool.c:3340
 #, c-format
 msgid "Machine '%s' not supported"
 msgstr ""
 
+#: dlltool.c:3443 dllwrap.c:215
+#, c-format
+msgid "Tried file: %s"
+msgstr ""
+
+#: dlltool.c:3450 dllwrap.c:222
+#, c-format
+msgid "Using file: %s"
+msgstr ""
+
 #: ieee.c:316
 msgid "unexpected end of debugging information"
 msgstr ""
@@ -1183,318 +1236,441 @@
 "Archive index:\n"
 msgstr ""
 
-#: objcopy.c:293
+#: objcopy.c:296
 #, c-format
-msgid ""
-"Usage: %s [-vVSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-b byte]\n"
-"       [-R section] [-i interleave] [--interleave=interleave] [--byte=byte]\n"
-"       [--input-target=bfdname] [--output-target=bfdname] "
-"[--target=bfdname]\n"
-"       [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n"
-"       [--discard-locals] [--debugging] [--remove-section=section]\n"
+msgid "Usage: %s <switches> in-file [out-file]\n"
 msgstr ""
 
-#: objcopy.c:300
-msgid ""
-"       [--gap-fill=val] [--pad-to=address] [--preserve-dates]\n"
-"       [--set-start=val] \n"
-"       [--change-start=incr] [--change-addresses=incr] \n"
-"       (--adjust-start   and  --adjust-vma are aliases for these two) \n"
-"       [--change-section-address=section{=,+,-}val]\n"
-"       (--adjust-section-vma is an alias for --change-section-address)\n"
-"       [--change-section-lma=section{=,+,-}val]\n"
-"       [--change-section-vma=section{=,+,-}val]\n"
-"       [--adjust-warnings] [--no-adjust-warnings]\n"
-"       [--change-warnings] [--no-change-warnings]\n"
-"       [--set-section-flags=section=flags] "
-"[--add-section=sectionname=filename]\n"
-"       [--keep-symbol symbol] [-K symbol] [--strip-symbol symbol] [-N "
-"symbol]\n"
-"       [--localize-symbol symbol] [-L symbol] [--weaken-symbol symbol]\n"
-"       [-W symbol] [--change-leading-char] [--remove-leading-char] "
-"[--weaken]\n"
-"       [--verbose] [--version] [--help] in-file [out-file]\n"
+#: objcopy.c:297 objcopy.c:354
+msgid " The switches are:\n"
 msgstr ""
 
-#: objcopy.c:327
+#: objcopy.c:298
+msgid ""
+"  -I --input-target <bfdname>      Assume input file is in format <bfdname>\n"
+"  -O --output-target <bfdname>     Create an output file in format "
+"<bfdname>\n"
+"  -F --target <bfdname>            Set both input and output format to "
+"<bfdname>\n"
+"     --debugging                   Convert debugging information, if "
+"possible\n"
+"  -p --preserve-dates              Copy modified/access timestamps to the "
+"output\n"
+"  -j --only-section <name>         Only copy section <name> into the output\n"
+"  -R --remove-section <name>       Remove section <name> from the output\n"
+"  -S --strip-all                   Remove all symbol and relocation "
+"information\n"
+"  -g --strip-debug                 Remove all debugging symbols\n"
+"     --strip-unneeded              Remove all symbols not needed by "
+"relocations\n"
+"  -N --strip-symbol <name>         Do not copy symbol <name>\n"
+"  -K --keep-symbol <name>          Only copy symbol <name>\n"
+"  -L --localize-symbol <name>      Force symbol <name> to be marked as a "
+"local\n"
+"  -W --weaken-symbol <name>        Force symbol <name> to be marked as a "
+"weak\n"
+"     --weaken                      Force all global symbols to be marked as "
+"weak\n"
+"  -x --discard-all                 Remove all non-global symbols\n"
+"  -X --discard-locals              Remove any compiler-generated symbols\n"
+"  -i --interleave <number>         Only copy one out of every <number> "
+"bytes\n"
+"  -b --byte <num>                  Select byte <num> in every interleaved "
+"block\n"
+"     --gap-fill <val>              Fill gaps between sections with <val>\n"
+"     --pad-to <addr>               Pad the last section up to address "
+"<addr>\n"
+"     --set-start <addr>            Set the start address to <addr>\n"
+"    {--change-start|--adjust-start} <incr>\n"
+"                                   Add <incr> to the start address\n"
+"    {--change-addresses|--adjust-vma} <incr>\n"
+"                                   Add <incr> to LMA, VMA and start "
+"addresses\n"
+"    {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>\n"
+"                                   Change LMA and VMA of section <name> by "
+"<val>\n"
+"     --change-section-lma <name>{=|+|-}<val>\n"
+"                                   Change the LMA of section <name> by "
+"<val>\n"
+"     --change-section-vma <name>{=|+|-}<val>\n"
+"                                   Change the VMA of section <name> by "
+"<val>\n"
+"    {--[no-]change-warnings|--[no-]adjust-warnings}\n"
+"                                   Warn if a named section does not exist\n"
+"     --set-section-flags <name>=<flags>\n"
+"                                   Set section <name>'s properties to "
+"<flags>\n"
+"     --add-section <name>=<file>   Add section <name> found in <file> to "
+"output\n"
+"     --change-leading-char         Force output format's leading character "
+"style\n"
+"     --remove-leading-char         Remove leading character from global "
+"symbols\n"
+"  -v --verbose                     List all object files modified\n"
+"  -V --version                     Display this program's version number\n"
+"  -h --help                        Display this output\n"
+msgstr ""
+
+#: objcopy.c:353
 #, c-format
-msgid ""
-"Usage: %s [-vVsSpgxX] [-I bfdname] [-O bfdname] [-F bfdname] [-R section]\n"
-"       [--input-target=bfdname] [--output-target=bfdname] "
-"[--target=bfdname]\n"
-"       [--strip-all] [--strip-debug] [--strip-unneeded] [--discard-all]\n"
-"       [--discard-locals] [--keep-symbol symbol] [-K symbol]\n"
-"       [--strip-symbol symbol] [-N symbol] [--remove-section=section]\n"
-"       [-o file] [--preserve-dates] [--verbose] [--version] [--help] "
-"file...\n"
+msgid "Usage: %s <switches> in-file(s)\n"
 msgstr ""
 
-#: objcopy.c:383
+#: objcopy.c:355
+msgid ""
+"  -I --input-target <bfdname>      Assume input file is in format <bfdname>\n"
+"  -O --output-target <bfdname>     Create an output file in format "
+"<bfdname>\n"
+"  -F --target <bfdname>            Set both input and output format to "
+"<bfdname>\n"
+"  -p --preserve-dates              Copy modified/access timestamps to the "
+"output\n"
+"  -R --remove-section <name>       Remove section <name> from the output\n"
+"  -s --strip-all                   Remove all symbol and relocation "
+"information\n"
+"  -g -S --strip-debug              Remove all debugging symbols\n"
+"     --strip-unneeded              Remove all symbols not needed by "
+"relocations\n"
+"  -N --strip-symbol <name>         Do not copy symbol <name>\n"
+"  -K --keep-symbol <name>          Only copy symbol <name>\n"
+"  -x --discard-all                 Remove all non-global symbols\n"
+"  -X --discard-locals              Remove any compiler-generated symbols\n"
+"  -v --verbose                     List all object files modified\n"
+"  -V --version                     Display this program's version number\n"
+"  -h --help                        Display this output\n"
+"  -o <file>                        Place stripped output into <file>\n"
+msgstr ""
+
+#: objcopy.c:425
 #, c-format
 msgid "unrecognized section flag `%s'"
 msgstr ""
 
-#: objcopy.c:384
-msgid "supported flags: alloc, load, readonly, code, data, rom, contents"
+#: objcopy.c:426
+msgid ""
+"supported flags: alloc, load, noload, readonly, debug, code, data, rom, "
+"share, contents"
 msgstr ""
 
-#: objcopy.c:623
+#: objcopy.c:671
 #, c-format
 msgid "copy from %s(%s) to %s(%s)\n"
 msgstr ""
 
-#: objcopy.c:642
+#: objcopy.c:690
 #, c-format
 msgid "Warning: Output file cannot represent architecture %s"
 msgstr ""
 
-#: objcopy.c:669
+#: objcopy.c:717
 #, c-format
 msgid "can't create section `%s': %s"
 msgstr ""
 
-#: objcopy.c:755
+#: objcopy.c:803
 #, c-format
 msgid "Can't fill gap after %s: %s"
 msgstr ""
 
-#: objcopy.c:780
+#: objcopy.c:828
 #, c-format
 msgid "Can't add padding to %s: %s"
 msgstr ""
 
-#: objcopy.c:916
+#: objcopy.c:965
 #, c-format
 msgid "%s: error copying private BFD data: %s"
 msgstr ""
 
-#: objcopy.c:950
+#: objcopy.c:999
 #, c-format
 msgid "cannot mkdir %s for archive copying (error: %s)"
 msgstr ""
 
-#: objcopy.c:1204
+#: objcopy.c:1268
 #, c-format
 msgid "%s: section `%s': error in %s: %s"
 msgstr ""
 
-#: objcopy.c:1476
+#: objcopy.c:1542
 #, c-format
 msgid "%s: can't create debugging section: %s"
 msgstr ""
 
-#: objcopy.c:1491
+#: objcopy.c:1557
 #, c-format
 msgid "%s: can't set debugging section contents: %s"
 msgstr ""
 
-#: objcopy.c:1500
+#: objcopy.c:1566
 #, c-format
 msgid "%s: don't know how to write debugging information for %s"
 msgstr ""
 
-#: objcopy.c:1605
+#: objcopy.c:1671
 #, c-format
 msgid "%s: cannot stat: %s"
 msgstr ""
 
-#: objcopy.c:1655
+#: objcopy.c:1721
 msgid "byte number must be non-negative"
 msgstr ""
 
-#: objcopy.c:1660
+#: objcopy.c:1726
 msgid "interleave must be positive"
 msgstr ""
 
-#: objcopy.c:1729
+#: objcopy.c:1742 objcopy.c:1749
+#, c-format
+msgid "%s both copied and removed"
+msgstr ""
+
+#: objcopy.c:1804
 msgid "bad format for --add-section NAME=FILENAME"
 msgstr ""
 
-#: objcopy.c:1732
+#: objcopy.c:1807
 #, c-format
 msgid "cannot stat: %s: %s"
 msgstr ""
 
-#: objcopy.c:1750
+#: objcopy.c:1825
 #, c-format
 msgid "cannot open: %s: %s"
 msgstr ""
 
-#: objcopy.c:1754
+#: objcopy.c:1829
 #, c-format
 msgid "%s: fread failed"
 msgstr ""
 
-#: objcopy.c:1791
+#: objcopy.c:1872
 #, c-format
 msgid "bad format for %s"
 msgstr ""
 
-#: objcopy.c:1855
+#: objcopy.c:1936
 #, c-format
 msgid "Warning: truncating gap-fill from 0x%s to 0x%x"
 msgstr ""
 
-#: objcopy.c:1879
+#: objcopy.c:1960
 msgid "bad format for --set-section-flags"
 msgstr ""
 
-#: objcopy.c:1909
+#: objcopy.c:1990
 msgid "byte number must be less than interleave"
 msgstr ""
 
-#: objcopy.c:1928
+#: objcopy.c:2009
 #, c-format
 msgid "Cannot stat: %s: %s"
 msgstr ""
 
-#: objcopy.c:1968
+#: objcopy.c:2049
 #, c-format
 msgid "Warning: --change-section-vma %s%c0x%s never used"
 msgstr ""
 
-#: objcopy.c:1981
+#: objcopy.c:2062
 #, c-format
 msgid "Warning: --change-section-lma %s%c0x%s never used"
 msgstr ""
 
-#: objdump.c:219
+#: objdump.c:229
 #, c-format
-msgid ""
-"Usage: %s [-ahifCdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n"
-"       [--archive-headers] [--target=bfdname] [--debugging] [--disassemble]\n"
-"       [--disassemble-all] [--disassemble-zeroes] [--file-headers]\n"
-"       [--section-headers] [--headers]\n"
-"       [--info] [--section=section-name] [--line-numbers] [--source]\n"
+msgid "Usage: %s <switches> file(s)\n"
 msgstr ""
 
-#: objdump.c:226
-msgid ""
-"       [--architecture=machine] [--reloc] [--full-contents] [--stabs]\n"
-"       [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n"
-"       [--wide] [--version] [--help] [--private-headers]\n"
-"       [--start-address=addr] [--stop-address=addr]\n"
-"       [--prefix-addresses] [--[no-]show-raw-insn] [--demangle]\n"
-"       [--adjust-vma=offset] [-EB|-EL] [--endian={big|little}] objfile...\n"
-"at least one option besides -l (--line-numbers) must be given\n"
+#: objdump.c:230
+msgid " At least one of the following switches must be given:\n"
 msgstr ""
 
-#: objdump.c:361
+#: objdump.c:231
+msgid ""
+"  -a  --archive-headers    Display archive header information\n"
+"  -f  --file-headers       Display the contents of the overall file header\n"
+"  -p  --private-headers    Display object format specific file header "
+"contents\n"
+"  -h  --[section-]headers  Display the contents of the section headers\n"
+"  -x  --all-headers        Display the contents of all headers\n"
+"  -d  --disassemble        Display assembler contents of executable "
+"sections\n"
+"  -D  --disassemble-all    Display assembler contents of all sections\n"
+"  -S  --source             Intermix source code with disassembly\n"
+"  -s  --full-contents      Display the full contents of all sections "
+"requested\n"
+"  -g  --debugging          Display debug information in object file\n"
+"  -G  --stabs              Display the STABS contents of an ELF format file\n"
+"  -t  --syms               Display the contents of the symbol table(s)\n"
+"  -T  --dynamic-syms       Display the contents of the dynamic symbol table\n"
+"  -r  --reloc              Display the relocation entries in the file\n"
+"  -R  --dynamic-reloc      Display the dynamic relocation entries in the "
+"file\n"
+"  -V  --version            Display this program's version number\n"
+"  -i  --info               List object formats and architectures supported\n"
+"  -H  --help               Display this information\n"
+msgstr ""
+
+#: objdump.c:253
+msgid ""
+"\n"
+" The following switches are optional:\n"
+msgstr ""
+
+#: objdump.c:254
+msgid ""
+"  -b  --target <bfdname>         Specify the target object format as "
+"<bfdname>\n"
+"  -m  --architecture <machine>   Specify the target architecture as "
+"<machine>\n"
+"  -j  --section <name>           Only display information for section "
+"<name>\n"
+"  -M  --disassembler-options <o> Pass text <o> on to the disassembler\n"
+"  -EB --endian=big               Assume big endian format when "
+"disassembling\n"
+"  -EL --endian=little            Assume little endian format when "
+"disassembling\n"
+"      --file-start-context       Include context from start of file (with "
+"-S)\n"
+"  -l  --line-numbers             Include line numbers and filenames in "
+"output\n"
+"  -C  --demangle                 Decode mangled/processed symbol names\n"
+"  -w  --wide                     Format output for more than 80 columns\n"
+"  -z  --disassemble-zeroes       Do not skip blocks of zeroes when "
+"disassembling\n"
+"      --start-address <addr>     Only process data whoes address is >= "
+"<addr>\n"
+"      --stop-address <addr>      Only process data whoes address is <= "
+"<addr>\n"
+"      --prefix-addresses         Print complete address alongside "
+"disassembly\n"
+"      --[no-]show-raw-insn       Display hex alongside symbolic disassembly\n"
+"      --adjust-vma <offset>      Add <offset> to all displayed section "
+"addresses\n"
+"\n"
+msgstr ""
+
+#: objdump.c:420
 msgid "Sections:\n"
 msgstr ""
 
-#: objdump.c:363
-msgid "Idx Name          Size      VMA       LMA       File off  Algn\n"
+#: objdump.c:423
+msgid "Idx Name          Size      VMA       LMA       File off  Algn"
 msgstr ""
 
-#: objdump.c:365
+#: objdump.c:425
 msgid ""
 "Idx Name          Size      VMA               LMA               File off  "
-"Algn\n"
+"Algn"
 msgstr ""
 
-#: objdump.c:414
+#: objdump.c:429
+msgid "  Flags"
+msgstr ""
+
+#: objdump.c:479
 #, c-format
 msgid "%s: %s: not a dynamic object\n"
 msgstr ""
 
-#: objdump.c:431
+#: objdump.c:496
 #, c-format
 msgid "%s: %s: No dynamic symbols\n"
 msgstr ""
 
-#: objdump.c:1131
+#: objdump.c:1200
 msgid "Out of virtual memory\n"
 msgstr ""
 
-#: objdump.c:1532
+#: objdump.c:1611
 #, c-format
 msgid "%s: Can't use supplied machine %s\n"
 msgstr ""
 
-#: objdump.c:1553
+#: objdump.c:1632
 #, c-format
 msgid "%s: Can't disassemble for architecture %s\n"
 msgstr ""
 
-#: objdump.c:1627
+#: objdump.c:1709
 #, c-format
 msgid "Disassembly of section %s:\n"
 msgstr ""
 
-#: objdump.c:1798
+#: objdump.c:1883
 #, c-format
 msgid ""
 "No %s section present\n"
 "\n"
 msgstr ""
 
-#: objdump.c:1805
+#: objdump.c:1890
 #, c-format
 msgid "%s: %s has no %s section\n"
 msgstr ""
 
-#: objdump.c:1818 objdump.c:1829
+#: objdump.c:1904 objdump.c:1916
 #, c-format
 msgid "%s: Reading %s section of %s failed: %s\n"
 msgstr ""
 
-#: objdump.c:1871
+#: objdump.c:1959
 #, c-format
 msgid ""
 "Contents of %s section:\n"
 "\n"
 msgstr ""
 
-#: objdump.c:1971
+#: objdump.c:2059
 #, c-format
 msgid "architecture: %s, "
 msgstr ""
 
-#: objdump.c:1974
+#: objdump.c:2062
 #, c-format
 msgid "flags 0x%08x:\n"
 msgstr ""
 
-#: objdump.c:1987
+#: objdump.c:2075
 msgid ""
 "\n"
 "start address 0x"
 msgstr ""
 
-#: objdump.c:2030
+#: objdump.c:2107
 #, c-format
 msgid ""
 "\n"
 "%s:     file format %s\n"
 msgstr ""
 
-#: objdump.c:2071
+#: objdump.c:2150
 #, c-format
 msgid "%s: printing debugging information failed\n"
 msgstr ""
 
-#: objdump.c:2105
+#: objdump.c:2227
 #, c-format
 msgid "In archive %s:\n"
 msgstr ""
 
-#: objdump.c:2158
+#: objdump.c:2279
 #, c-format
 msgid "Contents of section %s:\n"
 msgstr ""
 
-#: objdump.c:2661
+#: objdump.c:2788
 #, c-format
 msgid "BFD header file version %s\n"
 msgstr ""
 
-#: objdump.c:2786
+#: objdump.c:2861
 #, c-format
 msgid "%s: unrecognized -E option\n"
 msgstr ""
 
-#: objdump.c:2797
+#: objdump.c:2873
 #, c-format
 msgid "%s: unrecognized --endian type `%s'\n"
 msgstr ""
@@ -1533,884 +1709,902 @@
 msgid "Last stabs entries before error:\n"
 msgstr ""
 
-#: readelf.c:229 readelf.c:255
+#: readelf.c:301 readelf.c:327
 #, c-format
 msgid "%s: Error: "
 msgstr ""
 
-#: readelf.c:241 readelf.c:270
+#: readelf.c:313 readelf.c:342
 #, c-format
 msgid "%s: Warning: "
 msgstr ""
 
-#: readelf.c:300 readelf.c:325
+#: readelf.c:392 readelf.c:530
 #, c-format
 msgid "Unhandled data length: %d\n"
 msgstr ""
 
-#: readelf.c:420
+#: readelf.c:589
 msgid "Don't know about relocations on this machine architecture\n"
 msgstr ""
 
-#: readelf.c:426
+#: readelf.c:629 readelf.c:658 readelf.c:690 readelf.c:718
+msgid "out of memory parsing relocs"
+msgstr ""
+
+#: readelf.c:736
 msgid ""
 "  Offset    Info  Type            Symbol's Value  Symbol's Name          "
 "Addend\n"
 msgstr ""
 
-#: readelf.c:429
+#: readelf.c:739
 msgid "  Offset    Info  Type            Symbol's Value  Symbol's Name\n"
 msgstr ""
 
-#: readelf.c:533
+#: readelf.c:879 readelf.c:881
 #, c-format
 msgid "unrecognised: %-7lx"
 msgstr ""
 
-#: readelf.c:551
+#: readelf.c:906
 #, c-format
 msgid "<string table index %3ld>"
 msgstr ""
 
-#: readelf.c:703
+#: readelf.c:1113
 #, c-format
 msgid "Processor Specific: %lx"
 msgstr ""
 
-#: readelf.c:706
+#: readelf.c:1132
 #, c-format
 msgid "Operating System specific: %lx"
 msgstr ""
 
-#: readelf.c:708 readelf.c:961
+#: readelf.c:1135 readelf.c:1500
 #, c-format
 msgid "<unknown>: %lx"
 msgstr ""
 
-#: readelf.c:722
+#: readelf.c:1149
 msgid "NONE (None)"
 msgstr ""
 
-#: readelf.c:723
+#: readelf.c:1150
 msgid "REL (Relocatable file)"
 msgstr ""
 
-#: readelf.c:724
+#: readelf.c:1151
 msgid "EXEC (Executable file)"
 msgstr ""
 
-#: readelf.c:725
+#: readelf.c:1152
 msgid "DYN (Shared object file)"
 msgstr ""
 
-#: readelf.c:726
+#: readelf.c:1153
 msgid "CORE (Core file)"
 msgstr ""
 
-#: readelf.c:730
+#: readelf.c:1157
 #, c-format
 msgid "Processor Specific: (%x)"
 msgstr ""
 
-#: readelf.c:732
+#: readelf.c:1159
 #, c-format
 msgid "OS Specific: (%x)"
 msgstr ""
 
-#: readelf.c:734 readelf.c:793 readelf.c:897 readelf.c:1072
+#: readelf.c:1161 readelf.c:1238 readelf.c:1632
 #, c-format
 msgid "<unknown>: %x"
 msgstr ""
 
-#: readelf.c:747
+#: readelf.c:1174
 msgid "None"
 msgstr ""
 
-#: readelf.c:894
-msgid "ELFDATA2LSB (little endian)"
-msgstr ""
-
-#: readelf.c:895
-msgid "ELFDATA2MSB (big endian)"
-msgstr ""
-
-#: readelf.c:1108
+#: readelf.c:1670
 msgid "Usage: readelf {options} elf-file(s)\n"
 msgstr ""
 
-#: readelf.c:1109
+#: readelf.c:1671
 msgid "  Options are:\n"
 msgstr ""
 
-#: readelf.c:1110
-msgid ""
-"  -a or --all               Equivalent to: -h -l -S -s -r -d -V --histogram\n"
+#: readelf.c:1672
+msgid "  -a or --all               Equivalent to: -h -l -S -s -r -d -V -A -I\n"
 msgstr ""
 
-#: readelf.c:1111
+#: readelf.c:1673
 msgid "  -h or --file-header       Display the ELF file header\n"
 msgstr ""
 
-#: readelf.c:1112
+#: readelf.c:1674
 msgid "  -l or --program-headers or --segments\n"
 msgstr ""
 
-#: readelf.c:1113
+#: readelf.c:1675
 msgid "                            Display the program headers\n"
 msgstr ""
 
-#: readelf.c:1114
+#: readelf.c:1676
 msgid "  -S or --section-headers or --sections\n"
 msgstr ""
 
-#: readelf.c:1115
+#: readelf.c:1677
 msgid "                            Display the sections' header\n"
 msgstr ""
 
-#: readelf.c:1116
+#: readelf.c:1678
 msgid "  -e or --headers           Equivalent to: -h -l -S\n"
 msgstr ""
 
-#: readelf.c:1117
+#: readelf.c:1679
 msgid "  -s or --syms or --symbols Display the symbol table\n"
 msgstr ""
 
-#: readelf.c:1118
+#: readelf.c:1680
+msgid "  -n or --notes             Display the core notes (if present)\n"
+msgstr ""
+
+#: readelf.c:1681
 msgid "  -r or --relocs            Display the relocations (if present)\n"
 msgstr ""
 
-#: readelf.c:1119
+#: readelf.c:1682
 msgid "  -d or --dynamic           Display the dynamic segment (if present)\n"
 msgstr ""
 
-#: readelf.c:1120
+#: readelf.c:1683
 msgid "  -V or --version-info      Display the version sections (if present)\n"
 msgstr ""
 
-#: readelf.c:1121
+#: readelf.c:1684
+msgid ""
+"  -A or --arch-specific     Display architecture specific information (if "
+"any).\n"
+msgstr ""
+
+#: readelf.c:1685
 msgid ""
 "  -D or --use-dynamic       Use the dynamic section info when displaying "
 "symbols\n"
 msgstr ""
 
-#: readelf.c:1122
+#: readelf.c:1686
 msgid "  -x <number> or --hex-dump=<number>\n"
 msgstr ""
 
-#: readelf.c:1123
+#: readelf.c:1687
 msgid "                            Dump the contents of section <number>\n"
 msgstr ""
 
-#: readelf.c:1124
+#: readelf.c:1688
 msgid "  -w[liapr] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges]\n"
 msgstr ""
 
-#: readelf.c:1125
+#: readelf.c:1689
 msgid ""
 "                            Display the contents of DWARF2 debug sections\n"
 msgstr ""
 
-#: readelf.c:1127
+#: readelf.c:1691
 msgid "  -i <number> or --instruction-dump=<number>\n"
 msgstr ""
 
-#: readelf.c:1128
+#: readelf.c:1692
 msgid ""
 "                            Disassemble the contents of section <number>\n"
 msgstr ""
 
-#: readelf.c:1130
-msgid "        --histogram         Display histogram of bucket list lengths\n"
+#: readelf.c:1694
+msgid "  -I or --histogram         Display histogram of bucket list lengths\n"
 msgstr ""
 
-#: readelf.c:1131
+#: readelf.c:1695
 msgid "  -v or --version           Display the version number of readelf\n"
 msgstr ""
 
-#: readelf.c:1132
+#: readelf.c:1696
 msgid "  -H or --help              Display this information\n"
 msgstr ""
 
-#: readelf.c:1150
+#: readelf.c:1714
 msgid "Out of memory allocating dump request table."
 msgstr ""
 
-#: readelf.c:1274
+#: readelf.c:1849
 #, c-format
 msgid "Unrecognised debug option '%s'\n"
 msgstr ""
 
-#: readelf.c:1299
+#: readelf.c:1874
 #, c-format
 msgid "Invalid option '-%c'\n"
 msgstr ""
 
-#: readelf.c:1312
+#: readelf.c:1887
 msgid "Nothing to do.\n"
 msgstr ""
 
-#: readelf.c:1323 readelf.c:1336 readelf.c:2459
+#: readelf.c:1900 readelf.c:1917 readelf.c:3484
 msgid "none"
 msgstr ""
 
-#: readelf.c:1324
+#: readelf.c:1901
 msgid "ELF32"
 msgstr ""
 
-#: readelf.c:1325
+#: readelf.c:1902
 msgid "ELF64"
 msgstr ""
 
-#: readelf.c:1326 readelf.c:1339 readelf.c:1352
-msgid "<unknown>"
+#: readelf.c:1904 readelf.c:1921 readelf.c:1940
+#, c-format
+msgid "<unknown: %x>"
 msgstr ""
 
-#: readelf.c:1337
-msgid "2's compilment, little endian"
+#: readelf.c:1918
+msgid "2's complement, little endian"
 msgstr ""
 
-#: readelf.c:1338
-msgid "2's compilment, big endian"
+#: readelf.c:1919
+msgid "2's complement, big endian"
 msgstr ""
 
-#: readelf.c:1349
+#: readelf.c:1934
 msgid "UNIX - System V"
 msgstr ""
 
-#: readelf.c:1350
+#: readelf.c:1935
 msgid "UNIX - HP-UX"
 msgstr ""
 
-#: readelf.c:1351
+#: readelf.c:1936
+msgid "UNIX - Linux"
+msgstr ""
+
+#: readelf.c:1937
 msgid "Standalone App"
 msgstr ""
 
-#: readelf.c:1366
+#: readelf.c:1938
+msgid "ARM"
+msgstr ""
+
+#: readelf.c:1955
 msgid "Not an ELF file - it has the wrong magic bytes at the start\n"
 msgstr ""
 
-#: readelf.c:1374
+#: readelf.c:1963
 msgid "ELF Header:\n"
 msgstr ""
 
-#: readelf.c:1375
+#: readelf.c:1964
 msgid "  Magic:   "
 msgstr ""
 
-#: readelf.c:1379
+#: readelf.c:1968
 #, c-format
 msgid "  Class:                             %s\n"
 msgstr ""
 
-#: readelf.c:1381 readelf.c:1397
+#: readelf.c:1970
 #, c-format
 msgid "  Data:                              %s\n"
 msgstr ""
 
-#: readelf.c:1383
+#: readelf.c:1972
 #, c-format
 msgid "  Version:                           %d %s\n"
 msgstr ""
 
-#: readelf.c:1387
+#: readelf.c:1979
 #, c-format
 msgid "  OS/ABI:                            %s\n"
 msgstr ""
 
-#: readelf.c:1389
+#: readelf.c:1981
 #, c-format
 msgid "  ABI Version:                       %d\n"
 msgstr ""
 
-#: readelf.c:1391
+#: readelf.c:1983
 #, c-format
 msgid "  Type:                              %s\n"
 msgstr ""
 
-#: readelf.c:1393
+#: readelf.c:1985
 #, c-format
 msgid "  Machine:                           %s\n"
 msgstr ""
 
-#: readelf.c:1395
+#: readelf.c:1987
 #, c-format
 msgid "  Version:                           0x%lx\n"
 msgstr ""
 
-#: readelf.c:1399
-#, c-format
-msgid "  Entry point address:               0x%lx\n"
+#: readelf.c:1990
+msgid "  Entry point address:               "
 msgstr ""
 
-#: readelf.c:1401
-#, c-format
-msgid "  Start of program headers:          %ld (bytes into file)\n"
+#: readelf.c:1992
+msgid ""
+"\n"
+"  Start of program headers:          "
 msgstr ""
 
-#: readelf.c:1403
-#, c-format
-msgid "  Start of section headers:          %ld (bytes into file)\n"
+#: readelf.c:1994
+msgid ""
+" (bytes into file)\n"
+"  Start of section headers:          "
 msgstr ""
 
-#: readelf.c:1405
+#: readelf.c:1996
+msgid " (bytes into file)\n"
+msgstr ""
+
+#: readelf.c:1998
 #, c-format
 msgid "  Flags:                             0x%lx%s\n"
 msgstr ""
 
-#: readelf.c:1408
+#: readelf.c:2001
 #, c-format
 msgid "  Size of this header:               %ld (bytes)\n"
 msgstr ""
 
-#: readelf.c:1410
+#: readelf.c:2003
 #, c-format
 msgid "  Size of program headers:           %ld (bytes)\n"
 msgstr ""
 
-#: readelf.c:1412
+#: readelf.c:2005
 #, c-format
 msgid "  Number of program headers:         %ld\n"
 msgstr ""
 
-#: readelf.c:1414
+#: readelf.c:2007
 #, c-format
 msgid "  Size of section headers:           %ld (bytes)\n"
 msgstr ""
 
-#: readelf.c:1416
+#: readelf.c:2009
 #, c-format
 msgid "  Number of section headers:         %ld\n"
 msgstr ""
 
-#: readelf.c:1418
+#: readelf.c:2011
 #, c-format
 msgid "  Section header string table index: %ld\n"
 msgstr ""
 
-#: readelf.c:1428
-msgid "Not a 32 bit ELF file\n"
-msgstr ""
-
-#: readelf.c:1448
+#: readelf.c:2096
 msgid ""
 "\n"
 "There are no program headers in this file.\n"
 msgstr ""
 
-#: readelf.c:1454
+#: readelf.c:2102
 #, c-format
 msgid ""
 "\n"
-"Elf file is %s\n"
+"Elf file type is %s\n"
 msgstr ""
 
-#: readelf.c:1455
+#: readelf.c:2103
+msgid "Entry point "
+msgstr ""
+
+#: readelf.c:2105
 #, c-format
-msgid "Entry point 0x%lx\n"
+msgid ""
+"\n"
+"There are %d program headers, starting at offset "
 msgstr ""
 
-#: readelf.c:1456
-#, c-format
-msgid "There are %d program headers, starting at offset %lx:\n"
-msgstr ""
-
-#: readelf.c:1469 readelf.c:1619 readelf.c:1662 readelf.c:2018 readelf.c:2142
-#: readelf.c:3043 readelf.c:3057
+#: readelf.c:2116 readelf.c:2292 readelf.c:2334 readelf.c:2377 readelf.c:2418
+#: readelf.c:2926 readelf.c:2967 readelf.c:3143 readelf.c:4102 readelf.c:4116
+#: readelf.c:7014 readelf.c:7054
 msgid "Out of memory\n"
 msgstr ""
 
-#: readelf.c:1492
+#: readelf.c:2134
 #, c-format
 msgid ""
 "\n"
 "Program Header%s:\n"
 msgstr ""
 
-#: readelf.c:1494
+#: readelf.c:2138
 msgid ""
-"  Type        Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"
+"  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"
 msgstr ""
 
-#: readelf.c:1529
+#: readelf.c:2142
+msgid "  Type           Offset             VirtAddr           PhysAddr\n"
+msgstr ""
+
+#: readelf.c:2144
+msgid "                 FileSiz            MemSiz              Flags  Align\n"
+msgstr ""
+
+#: readelf.c:2202
 msgid "more than one dynamic segment\n"
 msgstr ""
 
-#: readelf.c:1537
+#: readelf.c:2210
 msgid "Unable to find program interpreter name\n"
 msgstr ""
 
-#: readelf.c:1544
+#: readelf.c:2217
 #, c-format
 msgid ""
 "\n"
 "      [Requesting program interpreter: %s]"
 msgstr ""
 
-#: readelf.c:1562
+#: readelf.c:2235
 msgid ""
 "\n"
 " Section to Segment mapping:\n"
 msgstr ""
 
-#: readelf.c:1563
+#: readelf.c:2236
 msgid "  Segment Sections...\n"
 msgstr ""
 
-#: readelf.c:1697
+#: readelf.c:2499
 msgid ""
 "\n"
 "There are no sections in this file.\n"
 msgstr ""
 
-#: readelf.c:1703
+#: readelf.c:2505
 #, c-format
-msgid "There are %d section headers, starting at offset %lx:\n"
+msgid "There are %d section headers, starting at offset 0x%lx:\n"
 msgstr ""
 
-#: readelf.c:1737
+#: readelf.c:2545
 msgid "File contains multiple dynamic symbol tables\n"
 msgstr ""
 
-#: readelf.c:1750
+#: readelf.c:2558
 msgid "File contains multiple dynamic string tables\n"
 msgstr ""
 
-#: readelf.c:1777
+#: readelf.c:2585
 #, c-format
 msgid ""
 "\n"
 "Section Header%s:\n"
 msgstr ""
 
-#: readelf.c:1779
+#: readelf.c:2589
 msgid ""
 "  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk "
 "Inf Al\n"
 msgstr ""
 
-#: readelf.c:1844
+#: readelf.c:2592
+msgid "  [Nr] Name              Type             Address           Offset\n"
+msgstr ""
+
+#: readelf.c:2593
+msgid "       Size              EntSize          Flags  Link  Info  Align\n"
+msgstr ""
+
+#: readelf.c:2640
+msgid ""
+"Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n"
+msgstr ""
+
+#: readelf.c:2641
+msgid ""
+"              I (info), L (link order), O (extra OS processing required)\n"
+msgstr ""
+
+#: readelf.c:2642
+msgid "              o (os specific), p (processor specific) x (unknown)\n"
+msgstr ""
+
+#: readelf.c:2700
 #, c-format
 msgid ""
 "\n"
 "Relocation section at offset 0x%lx contains %ld bytes:\n"
 msgstr ""
 
-#: readelf.c:1851
+#: readelf.c:2707
 msgid ""
 "\n"
 "There are no dynamic relocations in this file.\n"
 msgstr ""
 
-#: readelf.c:1877
+#: readelf.c:2735
 msgid ""
 "\n"
 "Relocation section "
 msgstr ""
 
-#: readelf.c:1884
+#: readelf.c:2742
 #, c-format
 msgid " at offset 0x%lx contains %lu entries:\n"
 msgstr ""
 
-#: readelf.c:1910
+#: readelf.c:2770
 msgid ""
 "\n"
 "There are no relocations in this file.\n"
 msgstr ""
 
-#: readelf.c:1998
+#: readelf.c:3020
 msgid ""
 "\n"
 "There is no dynamic segment in this file.\n"
 msgstr ""
 
-#: readelf.c:2056
+#: readelf.c:3054
 msgid "Unable to seek to end of file!"
 msgstr ""
 
-#: readelf.c:2062
+#: readelf.c:3063
 msgid "Unable to determine the number of symbols to load\n"
 msgstr ""
 
-#: readelf.c:2092
+#: readelf.c:3093
 msgid "Unable to seek to end of file\n"
 msgstr ""
 
-#: readelf.c:2098
+#: readelf.c:3099
 msgid "Unable to determine the length of the dynamic string table\n"
 msgstr ""
 
-#: readelf.c:2159
+#: readelf.c:3160
 #, c-format
 msgid ""
 "\n"
-"Dynamic segment at offset 0x%x contains %d entries:\n"
+"Dynamic segment at offset 0x%x contains %ld entries:\n"
 msgstr ""
 
-#: readelf.c:2162
+#: readelf.c:3163
 msgid "  Tag        Type                         Name/Value\n"
 msgstr ""
 
-#: readelf.c:2169
-#, c-format
-msgid "  0x%-8.8lx (%s)%*s"
-msgstr ""
-
-#: readelf.c:2182
+#: readelf.c:3191
 msgid "Auxiliary library"
 msgstr ""
 
-#: readelf.c:2184
+#: readelf.c:3193
 msgid "Filter library"
 msgstr ""
 
-#: readelf.c:2196 readelf.c:2217 readelf.c:2243
+#: readelf.c:3209 readelf.c:3230 readelf.c:3256
 msgid "Flags:"
 msgstr ""
 
-#: readelf.c:2198 readelf.c:2219 readelf.c:2245
+#: readelf.c:3211 readelf.c:3232 readelf.c:3258
 msgid " None\n"
 msgstr ""
 
-#: readelf.c:2348
+#: readelf.c:3361
 #, c-format
 msgid "Shared library: [%s]"
 msgstr ""
 
-#: readelf.c:2353
-msgid " program interpreter\n"
+#: readelf.c:3364
+msgid " program interpreter"
 msgstr ""
 
-#: readelf.c:2357
+#: readelf.c:3368
 #, c-format
-msgid "Library soname: [%s]\n"
+msgid "Library soname: [%s]"
 msgstr ""
 
-#: readelf.c:2361
+#: readelf.c:3372
 #, c-format
-msgid "Library rpath: [%s]\n"
+msgid "Library rpath: [%s]"
 msgstr ""
 
-#: readelf.c:2413
+#: readelf.c:3433
 #, c-format
 msgid "Not needed object: [%s]\n"
 msgstr ""
 
-#: readelf.c:2505
+#: readelf.c:3530
 #, c-format
 msgid ""
 "\n"
 "Version definition section '%s' contains %ld entries:\n"
 msgstr ""
 
-#: readelf.c:2508
+#: readelf.c:3533
 msgid "  Addr: 0x"
 msgstr ""
 
-#: readelf.c:2510 readelf.c:2699
+#: readelf.c:3535 readelf.c:3723
 #, c-format
 msgid "  Offset: %#08lx  Link: %lx (%s)\n"
 msgstr ""
 
-#: readelf.c:2540
+#: readelf.c:3565
 #, c-format
 msgid "  %#06x: Rev: %d  Flags: %s"
 msgstr ""
 
-#: readelf.c:2543
+#: readelf.c:3568
 #, c-format
 msgid "  Index: %d  Cnt: %d  "
 msgstr ""
 
-#: readelf.c:2554
+#: readelf.c:3579
 #, c-format
 msgid "Name: %s\n"
 msgstr ""
 
-#: readelf.c:2556
+#: readelf.c:3581
 #, c-format
 msgid "Name index: %ld\n"
 msgstr ""
 
-#: readelf.c:2571
+#: readelf.c:3596
 #, c-format
 msgid "  %#06x: Parent %d: %s\n"
 msgstr ""
 
-#: readelf.c:2574
+#: readelf.c:3599
 #, c-format
 msgid "  %#06x: Parent %d, name index: %ld\n"
 msgstr ""
 
-#: readelf.c:2593
+#: readelf.c:3618
 #, c-format
 msgid ""
 "\n"
 "Version needs section '%s' contains %ld entries:\n"
 msgstr ""
 
-#: readelf.c:2596
+#: readelf.c:3621
 msgid " Addr: 0x"
 msgstr ""
 
-#: readelf.c:2598
+#: readelf.c:3623
 #, c-format
 msgid "  Offset: %#08lx  Link to section: %ld (%s)\n"
 msgstr ""
 
-#: readelf.c:2624
+#: readelf.c:3649
 #, c-format
 msgid "  %#06x: Version: %d"
 msgstr ""
 
-#: readelf.c:2627
+#: readelf.c:3652
 #, c-format
 msgid "  File: %s"
 msgstr ""
 
-#: readelf.c:2629
+#: readelf.c:3654
 #, c-format
 msgid "  File: %lx"
 msgstr ""
 
-#: readelf.c:2631
+#: readelf.c:3656
 #, c-format
 msgid "  Cnt: %d\n"
 msgstr ""
 
-#: readelf.c:2649
+#: readelf.c:3674
 #, c-format
 msgid "  %#06x: Name: %s"
 msgstr ""
 
-#: readelf.c:2652
+#: readelf.c:3677
 #, c-format
 msgid "  %#06x: Name index: %lx"
 msgstr ""
 
-#: readelf.c:2655
+#: readelf.c:3680
 #, c-format
 msgid "  Flags: %s  Version: %d\n"
 msgstr ""
 
-#: readelf.c:2694
+#: readelf.c:3718
 #, c-format
 msgid ""
 "\n"
 "Version symbols section '%s' contains %d entries:\n"
 msgstr ""
 
-#: readelf.c:2697
+#: readelf.c:3721
 msgid " Addr: "
 msgstr ""
 
-#: readelf.c:2726
+#: readelf.c:3751
 msgid "   0 (*local*)    "
 msgstr ""
 
-#: readelf.c:2730
+#: readelf.c:3755
 msgid "   1 (*global*)   "
 msgstr ""
 
-#: readelf.c:2953
+#: readelf.c:3977
 msgid ""
 "\n"
 "No version information found in this file.\n"
 msgstr ""
 
-#: readelf.c:2966
-msgid "LOCAL"
-msgstr ""
-
-#: readelf.c:2967
-msgid "GLOBAL"
-msgstr ""
-
-#: readelf.c:2968
-msgid "WEAK"
-msgstr ""
-
-#: readelf.c:2971 readelf.c:2995
+#: readelf.c:3995 readelf.c:4030
 #, c-format
 msgid "<processor specific>: %d"
 msgstr ""
 
-#: readelf.c:2973 readelf.c:2997
+#: readelf.c:3997 readelf.c:4042
 #, c-format
 msgid "<OS specific>: %d"
 msgstr ""
 
-#: readelf.c:2975 readelf.c:2999
+#: readelf.c:3999 readelf.c:4045
 #, c-format
 msgid "<unknown>: %d"
 msgstr ""
 
-#: readelf.c:2988
-msgid "NOTYPE"
-msgstr ""
-
-#: readelf.c:2989
-msgid "OBJECT"
-msgstr ""
-
-#: readelf.c:2990
-msgid "FUNC"
-msgstr ""
-
-#: readelf.c:2991
-msgid "SECTION"
-msgstr ""
-
-#: readelf.c:2992
-msgid "FILE"
-msgstr ""
-
-#: readelf.c:3049
+#: readelf.c:4108
 msgid "Unable to read in dynamic data\n"
 msgstr ""
 
-#: readelf.c:3091
+#: readelf.c:4150
 msgid "Unable to seek to start of dynamic information"
 msgstr ""
 
-#: readelf.c:3097
+#: readelf.c:4156
 msgid "Failed to read in number of buckets\n"
 msgstr ""
 
-#: readelf.c:3103
+#: readelf.c:4162
 msgid "Failed to read in number of chains\n"
 msgstr ""
 
-#: readelf.c:3123
+#: readelf.c:4182
 msgid ""
 "\n"
 "Symbol table for image:\n"
 msgstr ""
 
-#: readelf.c:3124
-msgid "  Num Buc:    Value  Size   Type   Bind Ot Ndx Name\n"
+#: readelf.c:4184
+msgid "  Num Buc:    Value  Size   Type   Bind Vis      Ndx Name\n"
 msgstr ""
 
-#: readelf.c:3169
+#: readelf.c:4186
+msgid "  Num Buc:    Value          Size   Type   Bind Vis      Ndx Name\n"
+msgstr ""
+
+#: readelf.c:4230
 #, c-format
 msgid ""
 "\n"
 "Symbol table '%s' contains %lu entries:\n"
 msgstr ""
 
-#: readelf.c:3172
-msgid "  Num:    Value  Size Type    Bind   Ot  Ndx Name\n"
+#: readelf.c:4234
+msgid "   Num:    Value  Size Type    Bind   Vis      Ndx Name\n"
 msgstr ""
 
-#: readelf.c:3291
+#: readelf.c:4236
+msgid "   Num:    Value          Size Type    Bind   Vis      Ndx Name\n"
+msgstr ""
+
+#: readelf.c:4345
 msgid "bad dynamic symbol"
 msgstr ""
 
-#: readelf.c:3350
+#: readelf.c:4404
 msgid ""
 "\n"
 "Dynamic symbol information is not available for displaying symbols.\n"
 msgstr ""
 
-#: readelf.c:3362
+#: readelf.c:4416
 #, c-format
 msgid ""
 "\n"
 "Histogram for bucket list length (total of %d buckets):\n"
 msgstr ""
 
-#: readelf.c:3364
+#: readelf.c:4418
 msgid " Length  Number     %% of total  Coverage\n"
 msgstr ""
 
-#: readelf.c:3369 readelf.c:3388 readelf.c:5271 readelf.c:5461
+#: readelf.c:4423 readelf.c:4442 readelf.c:6695 readelf.c:6888
 msgid "Out of memory"
 msgstr ""
 
-#: readelf.c:3434
+#: readelf.c:4491
 #, c-format
 msgid ""
 "\n"
 "Dynamic info segment at offset 0x%lx contains %d entries:\n"
 msgstr ""
 
-#: readelf.c:3437
+#: readelf.c:4494
 msgid " Num: Name                           BoundTo     Flags\n"
 msgstr ""
 
-#: readelf.c:3485
+#: readelf.c:4542
 #, c-format
 msgid ""
 "\n"
 "Assembly dump of section %s\n"
 msgstr ""
 
-#: readelf.c:3508
+#: readelf.c:4565
 #, c-format
 msgid ""
 "\n"
 "Section '%s' has no data to dump.\n"
 msgstr ""
 
-#: readelf.c:3513
+#: readelf.c:4570
 #, c-format
 msgid ""
 "\n"
 "Hex dump of section '%s':\n"
 msgstr ""
 
-#: readelf.c:3663
+#: readelf.c:4722
 msgid "badly formed extended line op encountered!"
 msgstr ""
 
-#: readelf.c:3670
+#: readelf.c:4729
 #, c-format
 msgid "  Extended opcode %d: "
 msgstr ""
 
-#: readelf.c:3675
+#: readelf.c:4734
 msgid ""
 "End of Sequence\n"
 "\n"
 msgstr ""
 
-#: readelf.c:3682
+#: readelf.c:4740
 #, c-format
 msgid "set Address to 0x%lx\n"
 msgstr ""
 
-#: readelf.c:3687
+#: readelf.c:4745
 msgid "  define new File Table entry\n"
 msgstr ""
 
-#: readelf.c:3688 readelf.c:3806
+#: readelf.c:4746 readelf.c:4868
 msgid "  Entry\tDir\tTime\tSize\tName\n"
 msgstr ""
 
-#: readelf.c:3690
+#: readelf.c:4748
 #, c-format
 msgid "   %d\t"
 msgstr ""
 
-#: readelf.c:3693 readelf.c:3695 readelf.c:3697 readelf.c:3818 readelf.c:3820
-#: readelf.c:3822
+#: readelf.c:4751 readelf.c:4753 readelf.c:4755 readelf.c:4880 readelf.c:4882
+#: readelf.c:4884
 #, c-format
 msgid "%lu\t"
 msgstr ""
 
-#: readelf.c:3698
+#: readelf.c:4756
 #, c-format
 msgid ""
 "%s\n"
 "\n"
 msgstr ""
 
-#: readelf.c:3702
+#: readelf.c:4760
 #, c-format
 msgid "UNKNOWN: length %d\n"
 msgstr ""
 
-#: readelf.c:3724
+#: readelf.c:4786
 #, c-format
 msgid ""
 "\n"
@@ -2418,439 +2612,511 @@
 "\n"
 msgstr ""
 
-#: readelf.c:3736
+#: readelf.c:4798
 msgid "The line info appears to be corrupt - the section is too small\n"
 msgstr ""
 
-#: readelf.c:3744
+#: readelf.c:4806
 msgid "Only DWARF version 2 line info is currently supported.\n"
 msgstr ""
 
-#: readelf.c:3759
+#: readelf.c:4821
 #, c-format
 msgid "  Length:                      %ld\n"
 msgstr ""
 
-#: readelf.c:3760
+#: readelf.c:4822
 #, c-format
 msgid "  DWARF Version:               %d\n"
 msgstr ""
 
-#: readelf.c:3761
+#: readelf.c:4823
 #, c-format
 msgid "  Prolgue Length:              %d\n"
 msgstr ""
 
-#: readelf.c:3762
+#: readelf.c:4824
 #, c-format
 msgid "  Minimum Instruction Length:  %d\n"
 msgstr ""
 
-#: readelf.c:3763
+#: readelf.c:4825
 #, c-format
 msgid "  Initial value of 'is_stmt':  %d\n"
 msgstr ""
 
-#: readelf.c:3764
+#: readelf.c:4826
 #, c-format
 msgid "  Line Base:                   %d\n"
 msgstr ""
 
-#: readelf.c:3765
+#: readelf.c:4827
 #, c-format
 msgid "  Line Range:                  %d\n"
 msgstr ""
 
-#: readelf.c:3766
+#: readelf.c:4828
 #, c-format
 msgid "  Opcode Base:                 %d\n"
 msgstr ""
 
-#: readelf.c:3775
+#: readelf.c:4837
 msgid ""
 "\n"
 " Opcodes:\n"
 msgstr ""
 
-#: readelf.c:3778
+#: readelf.c:4840
 #, c-format
 msgid "  Opcode %d has %d args\n"
 msgstr ""
 
-#: readelf.c:3784
+#: readelf.c:4846
 msgid ""
 "\n"
 " The Directory Table is empty.\n"
 msgstr ""
 
-#: readelf.c:3787
+#: readelf.c:4849
 msgid ""
 "\n"
 " The Directory Table:\n"
 msgstr ""
 
-#: readelf.c:3791
+#: readelf.c:4853
 #, c-format
 msgid "  %s\n"
 msgstr ""
 
-#: readelf.c:3802
+#: readelf.c:4864
 msgid ""
 "\n"
 " The File Name Table is empty.\n"
 msgstr ""
 
-#: readelf.c:3805
+#: readelf.c:4867
 msgid ""
 "\n"
 " The File Name Table:\n"
 msgstr ""
 
-#: readelf.c:3813
+#: readelf.c:4875
 #, c-format
 msgid "  %d\t"
 msgstr ""
 
-#: readelf.c:3824
+#: readelf.c:4886
 #, c-format
 msgid "%s\n"
 msgstr ""
 
 #. Now display the statements.
-#: readelf.c:3832
+#: readelf.c:4894
 msgid ""
 "\n"
 " Line Number Statements:\n"
 msgstr ""
 
-#: readelf.c:3850
+#: readelf.c:4913
 msgid "  Copy\n"
 msgstr ""
 
-#: readelf.c:3857
+#: readelf.c:4920
 #, c-format
 msgid "  Advance PC by %d to %lx\n"
 msgstr ""
 
-#: readelf.c:3865
+#: readelf.c:4928
 #, c-format
 msgid "  Advance Line by %d to %d\n"
 msgstr ""
 
-#: readelf.c:3872
+#: readelf.c:4935
 #, c-format
 msgid "  Set File Name to entry %d in the File Name Table\n"
 msgstr ""
 
-#: readelf.c:3880
+#: readelf.c:4943
 #, c-format
 msgid "  Set column to %d\n"
 msgstr ""
 
-#: readelf.c:3887
+#: readelf.c:4950
 #, c-format
 msgid "  Set is_stmt to %d\n"
 msgstr ""
 
-#: readelf.c:3892
+#: readelf.c:4955
 msgid "  Set basic block\n"
 msgstr ""
 
-#: readelf.c:3899
+#: readelf.c:4963
 #, c-format
 msgid "  Advance PC by constant %d to 0x%lx\n"
 msgstr ""
 
-#: readelf.c:3907
+#: readelf.c:4971
 #, c-format
 msgid "  Advance PC by fixed size amount %d to 0x%lx\n"
 msgstr ""
 
-#: readelf.c:3915
+#: readelf.c:4979
 #, c-format
 msgid "  Special opcode %d: advance Address by %d to 0x%lx"
 msgstr ""
 
-#: readelf.c:3919
+#: readelf.c:4983
 #, c-format
 msgid " and Line by %d to %d\n"
 msgstr ""
 
-#: readelf.c:3942 readelf.c:4361
+#: readelf.c:5006 readelf.c:5428
 #, c-format
 msgid ""
 "Contents of the %s section:\n"
 "\n"
 msgstr ""
 
-#: readelf.c:3961
+#: readelf.c:5025
 msgid "Only DWARF 2 pubnames are currently supported"
 msgstr ""
 
-#: readelf.c:3965
+#: readelf.c:5029
 #, c-format
 msgid "  Length:                              %ld\n"
 msgstr ""
 
-#: readelf.c:3967
+#: readelf.c:5031
 #, c-format
 msgid "  Version:                             %d\n"
 msgstr ""
 
-#: readelf.c:3969
+#: readelf.c:5033
 #, c-format
 msgid "  Offset into .debug_info section:     %ld\n"
 msgstr ""
 
-#: readelf.c:3971
+#: readelf.c:5035
 #, c-format
 msgid "  Size of area in .debug_info section: %ld\n"
 msgstr ""
 
-#: readelf.c:3974
+#: readelf.c:5038
 msgid ""
 "\n"
 "    Offset\tName\n"
 msgstr ""
 
-#: readelf.c:4056
+#: readelf.c:5120
 #, c-format
 msgid "Unknown TAG value: %lx"
 msgstr ""
 
-#: readelf.c:4151
+#: readelf.c:5215
 #, c-format
 msgid "Unknown AT value: %lx"
 msgstr ""
 
-#: readelf.c:4188
+#: readelf.c:5252
 #, c-format
 msgid "Unknown FORM value: %lx"
 msgstr ""
 
-#: readelf.c:4367
+#: readelf.c:5434
 msgid "  Number TAG\n"
 msgstr ""
 
-#: readelf.c:4373
+#: readelf.c:5440
 #, c-format
 msgid "   %ld      %s    [%s]\n"
 msgstr ""
 
-#: readelf.c:4376
+#: readelf.c:5443
 msgid "has children"
 msgstr ""
 
-#: readelf.c:4376
+#: readelf.c:5443
 msgid "no children"
 msgstr ""
 
-#: readelf.c:4380
+#: readelf.c:5447
 #, c-format
 msgid "    %-18s %s\n"
 msgstr ""
 
-#: readelf.c:4399
+#: readelf.c:5466
 #, c-format
 msgid " %lu byte block: "
 msgstr ""
 
-#: readelf.c:4568
+#: readelf.c:5930
 msgid "(User defined location op)"
 msgstr ""
 
-#: readelf.c:4570
+#: readelf.c:5932
 msgid "(Unknown location op)"
 msgstr ""
 
-#: readelf.c:4687
+#: readelf.c:6049
 #, c-format
 msgid "Unable to handle FORM: %d"
 msgstr ""
 
-#: readelf.c:4691
+#: readelf.c:6053
 #, c-format
 msgid "Unrecognised form: %d"
 msgstr ""
 
-#: readelf.c:4704
+#: readelf.c:6066
 msgid "(not inlined)"
 msgstr ""
 
-#: readelf.c:4705
+#: readelf.c:6067
 msgid "(inlined)"
 msgstr ""
 
-#: readelf.c:4706
+#: readelf.c:6068
 msgid "(declared as inline but ignored)"
 msgstr ""
 
-#: readelf.c:4707
+#: readelf.c:6069
 msgid "(declared as inline and inlined)"
 msgstr ""
 
-#: readelf.c:4708
+#: readelf.c:6070
 #, c-format
 msgid "  (Unknown inline attribute value: %lx)"
 msgstr ""
 
-#: readelf.c:4838 readelf.c:4962
+#: readelf.c:6200 readelf.c:6324
 #, c-format
 msgid ""
 "The section %s contains:\n"
 "\n"
 msgstr ""
 
-#: readelf.c:4860
+#: readelf.c:6222
 msgid "Only version 2 DWARF debug information is currently supported.\n"
 msgstr ""
 
-#: readelf.c:4864
+#: readelf.c:6226
 msgid "  Compilation Unit:\n"
 msgstr ""
 
-#: readelf.c:4865
+#: readelf.c:6227
 #, c-format
 msgid "   Length:        %ld\n"
 msgstr ""
 
-#: readelf.c:4866
+#: readelf.c:6228
 #, c-format
 msgid "   Version:       %d\n"
 msgstr ""
 
-#: readelf.c:4867
+#: readelf.c:6229
 #, c-format
 msgid "   Abbrev Offset: %ld\n"
 msgstr ""
 
-#: readelf.c:4868
+#: readelf.c:6230
 #, c-format
 msgid "   Pointer Size:  %d\n"
 msgstr ""
 
-#: readelf.c:4888
+#: readelf.c:6250
 msgid "Unable to locate .debug_abbrev section!\n"
 msgstr ""
 
-#: readelf.c:4928
+#: readelf.c:6290
 #, c-format
-msgid "Unable to locate entry %d in the abbreviation table\n"
+msgid "Unable to locate entry %lu in the abbreviation table\n"
 msgstr ""
 
-#: readelf.c:4933
+#: readelf.c:6295
 #, c-format
-msgid " <%d><%x>: Abbrev Number: %d (%s)\n"
+msgid " <%d><%x>: Abbrev Number: %lu (%s)\n"
 msgstr ""
 
-#: readelf.c:4980
+#: readelf.c:6343
 #, c-format
 msgid "  Length:                   %ld\n"
 msgstr ""
 
-#: readelf.c:4981
+#: readelf.c:6344
 #, c-format
 msgid "  Version:                  %d\n"
 msgstr ""
 
-#: readelf.c:4982
+#: readelf.c:6345
 #, c-format
 msgid "  Offset into .debug_info:  %lx\n"
 msgstr ""
 
-#: readelf.c:4983
+#: readelf.c:6346
 #, c-format
 msgid "  Pointer Size:             %d\n"
 msgstr ""
 
-#: readelf.c:4984
+#: readelf.c:6347
 #, c-format
 msgid "  Segment Size:             %d\n"
 msgstr ""
 
-#: readelf.c:4986
+#: readelf.c:6349
 msgid ""
 "\n"
 "    Address  Length\n"
 msgstr ""
 
-#: readelf.c:5021
+#: readelf.c:6390
 #, c-format
 msgid "Displaying the debug contents of section %s is not yet supported.\n"
 msgstr ""
 
-#: readelf.c:5063
+#: readelf.c:6452
 #, c-format
 msgid ""
 "\n"
 "Section '%s' has no debugging data.\n"
 msgstr ""
 
-#: readelf.c:5079
+#: readelf.c:6468
 #, c-format
 msgid "Unrecognised debug section: %s\n"
 msgstr ""
 
-#: readelf.c:5118
+#: readelf.c:6540
 msgid "Some sections were not dumped because they do not exist!\n"
 msgstr ""
 
-#: readelf.c:5293
+#: readelf.c:6719
 #, c-format
 msgid ""
 "\n"
 "Section '%s' contains %d entries:\n"
 msgstr ""
 
-#: readelf.c:5454
+#: readelf.c:6881
 msgid "conflict list with without table"
 msgstr ""
 
-#: readelf.c:5482
+#: readelf.c:6909
 #, c-format
 msgid ""
 "\n"
 "Section '.conflict' contains %d entries:\n"
 msgstr ""
 
-#: readelf.c:5483
+#: readelf.c:6910
 msgid "  Num:    Index       Value  Name"
 msgstr ""
 
-#: readelf.c:5560
+#: readelf.c:6935
+msgid "NT_PRSTATUS (prstatus structure)"
+msgstr ""
+
+#: readelf.c:6936
+msgid "NT_FPREGSET (floating point registers)"
+msgstr ""
+
+#: readelf.c:6937
+msgid "NT_PRPSINFO (prpsinfo structure)"
+msgstr ""
+
+#: readelf.c:6938
+msgid "NT_TASKSTRUCT (task structure)"
+msgstr ""
+
+#: readelf.c:6939
+msgid "NT_PRXFPREG (user_xfpregs structure)"
+msgstr ""
+
+#: readelf.c:6940
+msgid "NT_PSTATUS (pstatus structure)"
+msgstr ""
+
+#: readelf.c:6941
+msgid "NT_FPREGS (floating point registers)"
+msgstr ""
+
+#: readelf.c:6942
+msgid "NT_PSINFO (psinfo structure)"
+msgstr ""
+
+#: readelf.c:6943
+msgid "NT_LWPSTATUS (lwpstatus_t structure)"
+msgstr ""
+
+#: readelf.c:6944
+msgid "NT_LWPSINFO (lwpsinfo_t structure)"
+msgstr ""
+
+#: readelf.c:6945
+msgid "NT_WIN32PSTATUS (win32_pstatus strcuture)"
+msgstr ""
+
+#: readelf.c:6947
+#, c-format
+msgid "Unknown note type: (0x%08x)"
+msgstr ""
+
+#: readelf.c:6985
+#, c-format
+msgid ""
+"\n"
+"Notes at offset 0x%08lx with length 0x%08lx:\n"
+msgstr ""
+
+#: readelf.c:6988
+msgid "  Owner\t\tData size\tDescription\n"
+msgstr ""
+
+#: readelf.c:7099
+msgid "No note segments present in the core file.\n"
+msgstr ""
+
+#: readelf.c:7177
+msgid "This instance of readelf has been built without support for a\n"
+msgstr ""
+
+#: readelf.c:7178
+msgid "64 bit data type and so it cannot read 64 bit ELF files.\n"
+msgstr ""
+
+#: readelf.c:7213
 #, c-format
 msgid "Cannot stat input file %s.\n"
 msgstr ""
 
-#: readelf.c:5567
+#: readelf.c:7220
 #, c-format
 msgid "Input file %s not found.\n"
 msgstr ""
 
-#: readelf.c:5573
+#: readelf.c:7226
 #, c-format
 msgid "%s: Failed to read file header\n"
 msgstr ""
 
-#: readelf.c:5587
+#: readelf.c:7240
 #, c-format
 msgid ""
 "\n"
 "File: %s\n"
 msgstr ""
 
-#: rename.c:121
+#: rename.c:131
 #, c-format
 msgid "%s: cannot set time: %s"
 msgstr ""
 
 #. We have to clean up here.
-#: rename.c:160 rename.c:193
+#: rename.c:170 rename.c:203
 #, c-format
 msgid "%s: rename: %s"
 msgstr ""
 
-#: rename.c:201
+#: rename.c:211
 #, c-format
 msgid "%s: simple_copy: %s"
 msgstr ""
@@ -3125,51 +3391,95 @@
 msgid "filename required for COFF output"
 msgstr ""
 
-#: rescoff.c:729
+#: rescoff.c:740
 msgid "can't get BFD_RELOC_RVA relocation type"
 msgstr ""
 
-#: resrc.c:150
+#: resrc.c:240 resrc.c:312
+#, c-format
+msgid "can't open temporary file `%s': %s"
+msgstr ""
+
+#: resrc.c:246
+#, c-format
+msgid "can't redirect stdout: `%s': %s"
+msgstr ""
+
+#: resrc.c:262
+#, c-format
+msgid "%s %s: %s"
+msgstr ""
+
+#: resrc.c:283
+#, c-format
+msgid "%s exited with status %d"
+msgstr ""
+
+#: resrc.c:308
+#, c-format
+msgid "can't execute `%s': %s"
+msgstr ""
+
+#: resrc.c:317
+#, c-format
+msgid "Using temporary file `%s' to read preprocessor output\n"
+msgstr ""
+
+#: resrc.c:324
 #, c-format
 msgid "can't popen `%s': %s"
 msgstr ""
 
-#: resrc.c:163
-#, c-format
-msgid "%s: warning: preprocessor failed\n"
+#: resrc.c:326
+msgid "Using popen to read preprocessor output\n"
 msgstr ""
 
-#: resrc.c:208
+#: resrc.c:369
+#, c-format
+msgid "Tried `%s'\n"
+msgstr ""
+
+#: resrc.c:380
+#, c-format
+msgid "Using `%s'\n"
+msgstr ""
+
+#: resrc.c:544
+#, c-format
+msgid "%s:%d: %s\n"
+msgstr ""
+
+#: resrc.c:553
 #, c-format
 msgid "%s: unexpected EOF"
 msgstr ""
 
-#: resrc.c:265
+#: resrc.c:610
 #, c-format
 msgid "%s: read of %lu returned %lu"
 msgstr ""
 
-#: resrc.c:307 resrc.c:538 resrc.c:811 resrc.c:965
+#: resrc.c:652 resrc.c:883 resrc.c:1156 resrc.c:1310
 #, c-format
 msgid "stat failed on bitmap file `%s': %s"
 msgstr ""
 
-#: resrc.c:360
+#: resrc.c:705
 #, c-format
 msgid "cursor file `%s' does not contain cursor data"
 msgstr ""
 
-#: resrc.c:392 resrc.c:682
+#: resrc.c:737 resrc.c:1027
 #, c-format
 msgid "%s: fseek to %lu failed: %s"
 msgstr ""
 
-#: resrc.c:651
+#: resrc.c:996
 #, c-format
 msgid "icon file `%s' does not contain icon data"
 msgstr ""
 
-#: resrc.c:1170
+#: resrc.c:1515
 #, c-format
 msgid "can't open `%s' for output: %s"
 msgstr ""
@@ -3214,7 +3524,7 @@
 msgid "%s: unable to open output file %s\n"
 msgstr ""
 
-#: stabs.c:349 stabs.c:1762
+#: stabs.c:349 stabs.c:1769
 msgid "numeric overflow"
 msgstr ""
 
@@ -3248,64 +3558,64 @@
 
 #. Does this actually ever happen?  Is that why we are worrying
 #. about dealing with it rather than just calling error_type?
-#: stabs.c:1854
+#: stabs.c:1861
 msgid "missing index type"
 msgstr ""
 
-#: stabs.c:2181
+#: stabs.c:2188
 msgid "unknown virtual character for baseclass"
 msgstr ""
 
-#: stabs.c:2199
+#: stabs.c:2206
 msgid "unknown visibility character for baseclass"
 msgstr ""
 
-#: stabs.c:2391
+#: stabs.c:2398
 msgid "unnamed $vb type"
 msgstr ""
 
-#: stabs.c:2397
+#: stabs.c:2404
 msgid "unrecognized C++ abbreviation"
 msgstr ""
 
-#: stabs.c:2477
+#: stabs.c:2484
 msgid "unknown visibility character for field"
 msgstr ""
 
-#: stabs.c:2733
+#: stabs.c:2740
 msgid "const/volatile indicator missing"
 msgstr ""
 
-#: stabs.c:2973
+#: stabs.c:2980
 #, c-format
 msgid "No mangling for \"%s\"\n"
 msgstr ""
 
-#: stabs.c:3286
+#: stabs.c:3293
 msgid "Undefined N_EXCL"
 msgstr ""
 
-#: stabs.c:3374
+#: stabs.c:3381
 #, c-format
 msgid "Type file number %d out of range\n"
 msgstr ""
 
-#: stabs.c:3379
+#: stabs.c:3386
 #, c-format
 msgid "Type index number %d out of range\n"
 msgstr ""
 
-#: stabs.c:3466
+#: stabs.c:3473
 #, c-format
 msgid "Unrecognized XCOFF type %d\n"
 msgstr ""
 
-#: stabs.c:3765
+#: stabs.c:3772
 #, c-format
 msgid "bad mangled name `%s'\n"
 msgstr ""
 
-#: stabs.c:3861
+#: stabs.c:3868
 msgid "no argument types in mangled string\n"
 msgstr ""
 
@@ -3347,50 +3657,50 @@
 "the GNU General Public License.  This program has absolutely no warranty.\n"
 msgstr ""
 
-#: windres.c:228
+#: windres.c:237
 #, c-format
 msgid "can't open %s `%s': %s"
 msgstr ""
 
-#: windres.c:407
+#: windres.c:416
 msgid ": expected to be a directory\n"
 msgstr ""
 
-#: windres.c:419
+#: windres.c:428
 msgid ": expected to be a leaf\n"
 msgstr ""
 
-#: windres.c:428
+#: windres.c:437
 #, c-format
 msgid "%s: warning: "
 msgstr ""
 
-#: windres.c:430
+#: windres.c:439
 msgid ": duplicate value\n"
 msgstr ""
 
-#: windres.c:593
+#: windres.c:602
 #, c-format
 msgid "%s: unknown format type `%s'\n"
 msgstr ""
 
-#: windres.c:594
+#: windres.c:603
 #, c-format
 msgid "%s: supported formats:"
 msgstr ""
 
 #. Otherwise, we give up.
-#: windres.c:681
+#: windres.c:690
 #, c-format
 msgid "can not determine type of file `%s'; use the -I option"
 msgstr ""
 
-#: windres.c:695
+#: windres.c:704
 #, c-format
 msgid "Usage: %s [options] [input-file] [output-file]\n"
 msgstr ""
 
-#: windres.c:697
+#: windres.c:706
 msgid ""
 "Options:\n"
 "  -i FILE, --input FILE       Name input file\n"
@@ -3402,28 +3712,33 @@
 "  -F TARGET, --target TARGET  Specify COFF target\n"
 "  --preprocessor PROGRAM      Program to use to preprocess rc file\n"
 "  --include-dir DIR           Include directory when preprocessing rc file\n"
-"  --define SYM[=VAL]          Define SYM when preprocessing rc file\n"
+"  -DSYM[=VAL], --define SYM[=VAL]\n"
+"                              Define SYM when preprocessing rc file\n"
+"  -v                          Verbose - tells you what it's doing\n"
 "  --language VAL              Set language when reading rc file\n"
+"  --use-temp-file             Use a temporary file instead of popen to read\n"
+"                              the preprocessor output\n"
+"  --no-use-temp-file          Use popen (default)\n"
 msgstr ""
 
-#: windres.c:711
+#: windres.c:725
 msgid "  --yydebug                   Turn on parser debugging\n"
 msgstr ""
 
-#: windres.c:714
+#: windres.c:728
 msgid ""
 "  --help                      Print this help message\n"
 "  --version                   Print version information\n"
 msgstr ""
 
-#: windres.c:717
+#: windres.c:731
 msgid ""
 "FORMAT is one of rc, res, or coff, and is deduced from the file name\n"
 "extension if not specified.  A single file name is an input file.\n"
 "No input-file is stdin, default rc.  No output-file is stdout, default rc.\n"
 msgstr ""
 
-#: windres.c:918
+#: windres.c:980
 msgid "no resources"
 msgstr ""
 
diff --git a/binutils/prdbg.c b/binutils/prdbg.c
index 958cbd2..abd684d 100644
--- a/binutils/prdbg.c
+++ b/binutils/prdbg.c
@@ -1,5 +1,5 @@
 /* prdbg.c -- Print out generic debugging information.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -985,7 +985,7 @@
      struct pr_handle *info;
      enum debug_visibility visibility;
 {
-  const char *s;
+  const char *s = NULL;
   char *t;
   unsigned int len;
 
@@ -1602,7 +1602,7 @@
 static boolean
 pr_tag (p, name)
      PTR p;
-     const char *name;
+     const char *name ATTRIBUTE_UNUSED;
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
@@ -1856,7 +1856,7 @@
 /*ARGSUSED*/
 static boolean
 pr_end_function (p)
-     PTR p;
+     PTR p ATTRIBUTE_UNUSED;
 {
   return true;
 }
diff --git a/binutils/rclex.l b/binutils/rclex.l
index 06a6607..47b479b 100644
--- a/binutils/rclex.l
+++ b/binutils/rclex.l
@@ -37,6 +37,23 @@
 
 static int rcdata_mode;
 
+/* Whether we are supressing lines from cpp (including windows.h or
+   headers from your C sources may bring in externs and typedefs).
+   When active, we return IGNORED_TOKEN, which lets us ignore these
+   outside of resource constructs.  Thus, it isn't required to protect
+   all the non-preprocessor lines in your header files with #ifdef
+   RC_INVOKED.  It also means your RC file can't include other RC
+   files if they're named "*.h".  Sorry.  Name them *.rch or whatever.  */
+
+static int suppress_cpp_data;
+
+#define MAYBE_RETURN(x) return suppress_cpp_data ? IGNORED_TOKEN : (x)
+
+/* The first filename we detect in the cpp output.  We use this to
+   tell included files from the original file.  */
+
+static char *initial_fn;
+
 /* List of allocated strings.  */
 
 struct alloc_string
@@ -57,82 +74,82 @@
 
 %%
 
-"BEGIN"			{ return BEG; }
-"{"			{ return BEG; }
-"END"			{ return END; }
-"}"			{ return END; }
-"ACCELERATORS"		{ return ACCELERATORS; }
-"VIRTKEY"		{ return VIRTKEY; }
-"ASCII"			{ return ASCII; }
-"NOINVERT"		{ return NOINVERT; }
-"SHIFT"			{ return SHIFT; }
-"CONTROL"		{ return CONTROL; }
-"ALT"			{ return ALT; }
-"BITMAP"		{ return BITMAP; }
-"CURSOR"		{ return CURSOR; }
-"DIALOG"		{ return DIALOG; }
-"DIALOGEX"		{ return DIALOGEX; }
-"EXSTYLE"		{ return EXSTYLE; }
-"CAPTION"		{ return CAPTION; }
-"CLASS"			{ return CLASS; }
-"STYLE"			{ return STYLE; }
-"AUTO3STATE"		{ return AUTO3STATE; }
-"AUTOCHECKBOX"		{ return AUTOCHECKBOX; }
-"AUTORADIOBUTTON"	{ return AUTORADIOBUTTON; }
-"CHECKBOX"		{ return CHECKBOX; }
-"COMBOBOX"		{ return COMBOBOX; }
-"CTEXT"			{ return CTEXT; }
-"DEFPUSHBUTTON"		{ return DEFPUSHBUTTON; }
-"EDITTEXT"		{ return EDITTEXT; }
-"GROUPBOX"		{ return GROUPBOX; }
-"LISTBOX"		{ return LISTBOX; }
-"LTEXT"			{ return LTEXT; }
-"PUSHBOX"		{ return PUSHBOX; }
-"PUSHBUTTON"		{ return PUSHBUTTON; }
-"RADIOBUTTON"		{ return RADIOBUTTON; }
-"RTEXT"			{ return RTEXT; }
-"SCROLLBAR"		{ return SCROLLBAR; }
-"STATE3"		{ return STATE3; }
-"USERBUTTON"		{ return USERBUTTON; }
-"BEDIT"			{ return BEDIT; }
-"HEDIT"			{ return HEDIT; }
-"IEDIT"			{ return IEDIT; }
-"FONT"			{ return FONT; }
-"ICON"			{ return ICON; }
-"LANGUAGE"		{ return LANGUAGE; }
-"CHARACTERISTICS"	{ return CHARACTERISTICS; }
-"VERSION"		{ return VERSIONK; }
-"MENU"			{ return MENU; }
-"MENUEX"		{ return MENUEX; }
-"MENUITEM"		{ return MENUITEM; }
-"SEPARATOR"		{ return SEPARATOR; }
-"POPUP"			{ return POPUP; }
-"CHECKED"		{ return CHECKED; }
-"GRAYED"		{ return GRAYED; }
-"HELP"			{ return HELP; }
-"INACTIVE"		{ return INACTIVE; }
-"MENUBARBREAK"		{ return MENUBARBREAK; }
-"MENUBREAK"		{ return MENUBREAK; }
-"MESSAGETABLE"		{ return MESSAGETABLE; }
-"RCDATA"		{ return RCDATA; }
-"STRINGTABLE"		{ return STRINGTABLE; }
-"VERSIONINFO"		{ return VERSIONINFO; }
-"FILEVERSION"		{ return FILEVERSION; }
-"PRODUCTVERSION"	{ return PRODUCTVERSION; }
-"FILEFLAGSMASK"		{ return FILEFLAGSMASK; }
-"FILEFLAGS"		{ return FILEFLAGS; }
-"FILEOS"		{ return FILEOS; }
-"FILETYPE"		{ return FILETYPE; }
-"FILESUBTYPE"		{ return FILESUBTYPE; }
-"VALUE"			{ return VALUE; }
-"MOVEABLE"		{ return MOVEABLE; }
-"FIXED"			{ return FIXED; }
-"PURE"			{ return PURE; }
-"IMPURE"		{ return IMPURE; }
-"PRELOAD"		{ return PRELOAD; }
-"LOADONCALL"		{ return LOADONCALL; }
-"DISCARDABLE"		{ return DISCARDABLE; }
-"NOT"			{ return NOT; }
+"BEGIN"			{ MAYBE_RETURN (BEG); }
+"{"			{ MAYBE_RETURN (BEG); }
+"END"			{ MAYBE_RETURN (END); }
+"}"			{ MAYBE_RETURN (END); }
+"ACCELERATORS"		{ MAYBE_RETURN (ACCELERATORS); }
+"VIRTKEY"		{ MAYBE_RETURN (VIRTKEY); }
+"ASCII"			{ MAYBE_RETURN (ASCII); }
+"NOINVERT"		{ MAYBE_RETURN (NOINVERT); }
+"SHIFT"			{ MAYBE_RETURN (SHIFT); }
+"CONTROL"		{ MAYBE_RETURN (CONTROL); }
+"ALT"			{ MAYBE_RETURN (ALT); }
+"BITMAP"		{ MAYBE_RETURN (BITMAP); }
+"CURSOR"		{ MAYBE_RETURN (CURSOR); }
+"DIALOG"		{ MAYBE_RETURN (DIALOG); }
+"DIALOGEX"		{ MAYBE_RETURN (DIALOGEX); }
+"EXSTYLE"		{ MAYBE_RETURN (EXSTYLE); }
+"CAPTION"		{ MAYBE_RETURN (CAPTION); }
+"CLASS"			{ MAYBE_RETURN (CLASS); }
+"STYLE"			{ MAYBE_RETURN (STYLE); }
+"AUTO3STATE"		{ MAYBE_RETURN (AUTO3STATE); }
+"AUTOCHECKBOX"		{ MAYBE_RETURN (AUTOCHECKBOX); }
+"AUTORADIOBUTTON"	{ MAYBE_RETURN (AUTORADIOBUTTON); }
+"CHECKBOX"		{ MAYBE_RETURN (CHECKBOX); }
+"COMBOBOX"		{ MAYBE_RETURN (COMBOBOX); }
+"CTEXT"			{ MAYBE_RETURN (CTEXT); }
+"DEFPUSHBUTTON"		{ MAYBE_RETURN (DEFPUSHBUTTON); }
+"EDITTEXT"		{ MAYBE_RETURN (EDITTEXT); }
+"GROUPBOX"		{ MAYBE_RETURN (GROUPBOX); }
+"LISTBOX"		{ MAYBE_RETURN (LISTBOX); }
+"LTEXT"			{ MAYBE_RETURN (LTEXT); }
+"PUSHBOX"		{ MAYBE_RETURN (PUSHBOX); }
+"PUSHBUTTON"		{ MAYBE_RETURN (PUSHBUTTON); }
+"RADIOBUTTON"		{ MAYBE_RETURN (RADIOBUTTON); }
+"RTEXT"			{ MAYBE_RETURN (RTEXT); }
+"SCROLLBAR"		{ MAYBE_RETURN (SCROLLBAR); }
+"STATE3"		{ MAYBE_RETURN (STATE3); }
+"USERBUTTON"		{ MAYBE_RETURN (USERBUTTON); }
+"BEDIT"			{ MAYBE_RETURN (BEDIT); }
+"HEDIT"			{ MAYBE_RETURN (HEDIT); }
+"IEDIT"			{ MAYBE_RETURN (IEDIT); }
+"FONT"			{ MAYBE_RETURN (FONT); }
+"ICON"			{ MAYBE_RETURN (ICON); }
+"LANGUAGE"		{ MAYBE_RETURN (LANGUAGE); }
+"CHARACTERISTICS"	{ MAYBE_RETURN (CHARACTERISTICS); }
+"VERSION"		{ MAYBE_RETURN (VERSIONK); }
+"MENU"			{ MAYBE_RETURN (MENU); }
+"MENUEX"		{ MAYBE_RETURN (MENUEX); }
+"MENUITEM"		{ MAYBE_RETURN (MENUITEM); }
+"SEPARATOR"		{ MAYBE_RETURN (SEPARATOR); }
+"POPUP"			{ MAYBE_RETURN (POPUP); }
+"CHECKED"		{ MAYBE_RETURN (CHECKED); }
+"GRAYED"		{ MAYBE_RETURN (GRAYED); }
+"HELP"			{ MAYBE_RETURN (HELP); }
+"INACTIVE"		{ MAYBE_RETURN (INACTIVE); }
+"MENUBARBREAK"		{ MAYBE_RETURN (MENUBARBREAK); }
+"MENUBREAK"		{ MAYBE_RETURN (MENUBREAK); }
+"MESSAGETABLE"		{ MAYBE_RETURN (MESSAGETABLE); }
+"RCDATA"		{ MAYBE_RETURN (RCDATA); }
+"STRINGTABLE"		{ MAYBE_RETURN (STRINGTABLE); }
+"VERSIONINFO"		{ MAYBE_RETURN (VERSIONINFO); }
+"FILEVERSION"		{ MAYBE_RETURN (FILEVERSION); }
+"PRODUCTVERSION"	{ MAYBE_RETURN (PRODUCTVERSION); }
+"FILEFLAGSMASK"		{ MAYBE_RETURN (FILEFLAGSMASK); }
+"FILEFLAGS"		{ MAYBE_RETURN (FILEFLAGS); }
+"FILEOS"		{ MAYBE_RETURN (FILEOS); }
+"FILETYPE"		{ MAYBE_RETURN (FILETYPE); }
+"FILESUBTYPE"		{ MAYBE_RETURN (FILESUBTYPE); }
+"VALUE"			{ MAYBE_RETURN (VALUE); }
+"MOVEABLE"		{ MAYBE_RETURN (MOVEABLE); }
+"FIXED"			{ MAYBE_RETURN (FIXED); }
+"PURE"			{ MAYBE_RETURN (PURE); }
+"IMPURE"		{ MAYBE_RETURN (IMPURE); }
+"PRELOAD"		{ MAYBE_RETURN (PRELOAD); }
+"LOADONCALL"		{ MAYBE_RETURN (LOADONCALL); }
+"DISCARDABLE"		{ MAYBE_RETURN (DISCARDABLE); }
+"NOT"			{ MAYBE_RETURN (NOT); }
 
 "BLOCK"[ \t\n]*"\""[^\#\n]*"\"" {
 			  char *s, *send;
@@ -146,11 +163,11 @@
 			  if (strncmp (s, "StringFileInfo",
 				       sizeof "StringFileInfo" - 1) == 0
 			      && s + sizeof "StringFileInfo" - 1 == send)
-			    return BLOCKSTRINGFILEINFO;
+			    MAYBE_RETURN (BLOCKSTRINGFILEINFO);
 			  else if (strncmp (s, "VarFileInfo",
 					    sizeof "VarFileInfo" - 1) == 0
 				   && s + sizeof "VarFileInfo" - 1 == send)
-			    return BLOCKVARFILEINFO;
+			    MAYBE_RETURN (BLOCKVARFILEINFO);
 			  else
 			    {
 			      char *r;
@@ -159,7 +176,7 @@
 			      strncpy (r, s, send - s);
 			      r[send - s] = '\0';
 			      yylval.s = r;
-			      return BLOCK;
+			      MAYBE_RETURN (BLOCK);
 			    }
 			}
 
@@ -170,13 +187,13 @@
 [0-9][x0-9A-Fa-f]*L	{
 			  yylval.i.val = strtoul (yytext, 0, 0);
 			  yylval.i.dword = 1;
-			  return NUMBER;
+			  MAYBE_RETURN (NUMBER);
 			}
 
 [0-9][x0-9A-Fa-f]*	{
 			  yylval.i.val = strtoul (yytext, 0, 0);
 			  yylval.i.dword = 0;
-			  return NUMBER;
+			  MAYBE_RETURN (NUMBER);
 			}
 
 ("\""[^\"\n]*"\""[ \t]*)+ {
@@ -187,13 +204,13 @@
 			  if (! rcdata_mode)
 			    {
 			      yylval.s = s;
-			      return QUOTEDSTRING;
+			      MAYBE_RETURN (QUOTEDSTRING);
 			    }
 			  else
 			    {
 			      yylval.ss.length = length;
 			      yylval.ss.s = s;
-			      return SIZEDSTRING;
+			      MAYBE_RETURN (SIZEDSTRING);
 			    }
 			}
 
@@ -209,12 +226,12 @@
 			  s = get_string (strlen (yytext) + 1);
 			  strcpy (s, yytext);
 			  yylval.s = s;
-			  return STRING;
+			  MAYBE_RETURN (STRING);
 			}
 
 [\n]			{ ++rc_lineno; }
 [ \t\r]+		{ /* ignore whitespace */ }
-.			{ return *yytext; }
+.			{ MAYBE_RETURN (*yytext); }
 
 %%
 #ifndef yywrap
@@ -263,6 +280,20 @@
 
   free (rc_filename);
   rc_filename = fn;
+
+  if (!initial_fn)
+    {
+      initial_fn = xmalloc (strlen (fn) + 1);
+      strcpy(initial_fn, fn);
+    }
+
+  /* Allow the initial file, regardless of name.  Suppress all other
+     files if they end in ".h" (this allows included "*.rc") */
+  if (strcmp (initial_fn, fn) == 0
+      || strcmp (fn + strlen (fn) - 2, ".h") != 0)
+    suppress_cpp_data = 0;
+  else
+    suppress_cpp_data = 1;
 }
 
 /* Handle a quoted string.  The quotes are stripped.  A pair of quotes
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index 67079a5..03cbbdc 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -122,6 +122,7 @@
 %token <s> QUOTEDSTRING STRING
 %token <i> NUMBER
 %token <ss> SIZEDSTRING
+%token IGNORED_TOKEN
 
 %type <pacc> acc_entries
 %type <acc> acc_entry acc_event
@@ -167,6 +168,7 @@
 	| input newcmd stringtable
 	| input newcmd user
 	| input newcmd versioninfo
+	| input newcmd IGNORED_TOKEN
 	;
 
 newcmd:
diff --git a/binutils/rdcoff.c b/binutils/rdcoff.c
index ee68bc6..d1ee6e6 100644
--- a/binutils/rdcoff.c
+++ b/binutils/rdcoff.c
@@ -1,5 +1,5 @@
 /* stabs.c -- Parse COFF debugging information
-   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -498,7 +498,7 @@
 parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle)
      bfd *abfd;
      struct coff_symbols *symbols;
-     struct coff_types *types;
+     struct coff_types *types ATTRIBUTE_UNUSED;
      union internal_auxent *pauxent;
      PTR dhandle;
 {
@@ -569,7 +569,7 @@
 static boolean
 parse_coff_symbol (abfd, types, sym, coff_symno, psyment, dhandle, type,
 		   within_function)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct coff_types *types;
      asymbol *sym;
      long coff_symno;
diff --git a/binutils/rddbg.c b/binutils/rddbg.c
index 9428c37..e26056e 100644
--- a/binutils/rddbg.c
+++ b/binutils/rddbg.c
@@ -185,7 +185,17 @@
 		  char *f, *s;
 
 		  f = NULL;
+		  
+		  if (stroff + strx > strsize)
+		    {
+		      fprintf (stderr, "%s: %s: stab entry %d is corrupt, strx = 0x%x, type = %d\n",
+			       bfd_get_filename (abfd), names[i].secname,
+			       (stab - stabs) / 12, strx, type);
+		      continue;
+		    }
+		  
 		  s = (char *) strings + stroff + strx;
+		  
 		  while (s[strlen (s) - 1] == '\\'
 			 && stab + 12 < stabs + stabsize)
 		    {
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 549bf1a..cd1e127 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1,5 +1,5 @@
 /* readelf.c -- display contents of an ELF format file
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
    Originally developed by Eric Youngdale <eric@andante.jic.com>
    Modifications by Nick Clifton <nickc@cygnus.com>
@@ -23,10 +23,19 @@
 
 
 #include <assert.h>
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include <time.h>
 
+#if __GNUC__ >= 2
+/* Define BFD64 here, even if our default architecture is 32 bit ELF
+   as this will allow us to read in and parse 64bit and 32bit ELF files.
+   Only do this if we belive that the compiler can support a 64 bit
+   data type.  For now we only rely on GCC being able to do this.  */
+#define BFD64
+#endif
+
 #include "bfd.h"
 
 #include "elf/common.h"
@@ -58,6 +67,9 @@
 #include "elf/arc.h"
 #include "elf/fr30.h"
 #include "elf/mcore.h"
+#include "elf/i960.h"
+#include "elf/pj.h"
+#include "elf/avr.h"
 
 #include "bucomm.h"
 #include "getopt.h"
@@ -70,11 +82,12 @@
 
 char *          	program_name = "readelf";
 unsigned int    	dynamic_addr;
-unsigned int    	dynamic_size;
+bfd_size_type  		dynamic_size;
 unsigned int    	rela_addr;
 unsigned int    	rela_size;
 char *          	dynamic_strings;
 char *			string_table;
+unsigned long           num_dynamic_syms;
 Elf_Internal_Sym * 	dynamic_symbols;
 Elf_Internal_Syminfo *	dynamic_syminfo;
 unsigned long   	dynamic_syminfo_offset;
@@ -103,7 +116,9 @@
 int                     do_debug_lines;
 int                     do_debug_pubnames;
 int                     do_debug_aranges;
-int			binary_class;
+int                     do_arch;
+int                     do_notes;
+int			is_32bit_elf;
 
 /* A dynamic array of flags indicating which sections require dumping.  */
 char *			dump_sects = NULL;
@@ -113,39 +128,67 @@
 #define DISASS_DUMP	(1 << 1)
 #define DEBUG_DUMP	(1 << 2)
 
+/* How to rpint a vma value.  */
+typedef enum print_mode
+{
+  HEX,
+  DEC,
+  DEC_5,
+  UNSIGNED,
+  PREFIX_HEX,
+  FULL_HEX,
+  LONG_HEX
+}
+print_mode;
+
 /* Forward declarations for dumb compilers.  */
-static unsigned long (*   byte_get)                   PARAMS ((unsigned char *, int));
-static const char *       get_mips_dynamic_type       PARAMS ((unsigned long type));
-static const char *       get_dynamic_type            PARAMS ((unsigned long type));
-static int                dump_relocations            PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Sym *, char *));
-static char *             get_file_type               PARAMS ((unsigned e_type));
-static char *             get_machine_name            PARAMS ((unsigned e_machine));
-static char *             get_machine_data            PARAMS ((unsigned e_data));
-static char *             get_machine_flags           PARAMS ((unsigned, unsigned e_machine));
-static const char *       get_mips_segment_type       PARAMS ((unsigned long type));
-static const char *       get_segment_type            PARAMS ((unsigned long p_type));
-static const char *       get_mips_section_type_name  PARAMS ((unsigned int sh_type));
-static const char *       get_section_type_name       PARAMS ((unsigned int sh_type));
-static char *             get_symbol_binding          PARAMS ((unsigned int binding));
-static char *             get_symbol_type             PARAMS ((unsigned int type));
+static void		  print_vma		      PARAMS ((bfd_vma, print_mode));
+static bfd_vma (*         byte_get)                   PARAMS ((unsigned char *, int));
+static bfd_vma            byte_get_little_endian      PARAMS ((unsigned char *, int));
+static bfd_vma            byte_get_big_endian         PARAMS ((unsigned char *, int));
+static const char *       get_mips_dynamic_type       PARAMS ((unsigned long));
+static const char *       get_sparc64_dynamic_type    PARAMS ((unsigned long));
+static const char *       get_parisc_dynamic_type     PARAMS ((unsigned long));
+static const char *       get_dynamic_type            PARAMS ((unsigned long));
+static int                dump_relocations            PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Sym *, unsigned long, char *, int));
+static char *             get_file_type               PARAMS ((unsigned));
+static char *             get_machine_name            PARAMS ((unsigned));
+static char *             get_machine_flags           PARAMS ((unsigned, unsigned));
+static const char *       get_mips_segment_type       PARAMS ((unsigned long));
+static const char *       get_parisc_segment_type     PARAMS ((unsigned long));
+static const char *       get_segment_type            PARAMS ((unsigned long));
+static const char *       get_mips_section_type_name  PARAMS ((unsigned int));
+static const char *       get_parisc_section_type_name PARAMS ((unsigned int));
+static const char *       get_section_type_name       PARAMS ((unsigned int));
+static const char *       get_symbol_binding          PARAMS ((unsigned int));
+static const char *       get_symbol_type             PARAMS ((unsigned int));
+static const char *       get_symbol_visibility       PARAMS ((unsigned int));
+static const char *       get_symbol_index_type       PARAMS ((unsigned int));
+static const char *       get_dynamic_flags 	      PARAMS ((bfd_vma));
 static void               usage                       PARAMS ((void));
-static void               parse_args                  PARAMS ((int argc, char ** argv));
+static void               parse_args                  PARAMS ((int, char **));
 static int                process_file_header         PARAMS ((void));
 static int                process_program_headers     PARAMS ((FILE *));
 static int                process_section_headers     PARAMS ((FILE *));
-static void               dynamic_segment_mips_val    PARAMS ((Elf_Internal_Dyn *entry));
+static void               dynamic_segment_mips_val    PARAMS ((Elf_Internal_Dyn *));
+static void               dynamic_segment_parisc_val  PARAMS ((Elf_Internal_Dyn *));
 static int                process_dynamic_segment     PARAMS ((FILE *));
 static int                process_symbol_table        PARAMS ((FILE *));
 static int                process_section_contents    PARAMS ((FILE *));
-static void               process_file                PARAMS ((char * file_name));
+static void               process_file                PARAMS ((char *));
 static int                process_relocs              PARAMS ((FILE *));
 static int                process_version_sections    PARAMS ((FILE *));
-static char *             get_ver_flags               PARAMS ((unsigned int flags));
-static char *             get_symbol_index_type       PARAMS ((unsigned int type));
-static int                get_section_headers         PARAMS ((FILE * file));
-static int                get_file_header             PARAMS ((FILE * file));
-static Elf_Internal_Sym * get_elf_symbols             PARAMS ((FILE * file, unsigned long offset, unsigned long number));
-static int *              get_dynamic_data            PARAMS ((FILE * file, unsigned int number));
+static char *             get_ver_flags               PARAMS ((unsigned int));
+static int                get_32bit_section_headers   PARAMS ((FILE *));
+static int                get_64bit_section_headers   PARAMS ((FILE *));
+static int		  get_32bit_program_headers   PARAMS ((FILE *, Elf_Internal_Phdr *));
+static int		  get_64bit_program_headers   PARAMS ((FILE *, Elf_Internal_Phdr *));
+static int                get_file_header             PARAMS ((FILE *));
+static Elf_Internal_Sym * get_32bit_elf_symbols       PARAMS ((FILE *, unsigned long, unsigned long));
+static Elf_Internal_Sym * get_64bit_elf_symbols       PARAMS ((FILE *, unsigned long, unsigned long));
+static int *              get_dynamic_data            PARAMS ((FILE *, unsigned int));
+static int                get_32bit_dynamic_segment   PARAMS ((FILE *));
+static int                get_64bit_dynamic_segment   PARAMS ((FILE *));
 #ifdef SUPPORT_DISASSEMBLY
 static int 	          disassemble_section         PARAMS ((Elf32_Internal_Shdr *, FILE *));
 #endif
@@ -158,7 +201,7 @@
 static int                display_debug_aranges       PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static unsigned char *    process_abbrev_section      PARAMS ((unsigned char *, unsigned char *));
 static unsigned long      read_leb128                 PARAMS ((unsigned char *, int *, int));
-static int                process_extended_line_op    PARAMS ((unsigned char *, int));
+static int                process_extended_line_op    PARAMS ((unsigned char *, int, int));
 static void               reset_state_machine         PARAMS ((int));
 static char *             get_TAG_name                PARAMS ((unsigned long));
 static char *             get_AT_name                 PARAMS ((unsigned long));
@@ -173,15 +216,41 @@
 static const char *       get_elf_class               PARAMS ((unsigned char));
 static const char *       get_data_encoding           PARAMS ((unsigned char));
 static const char *       get_osabi_name              PARAMS ((unsigned char));
+static int		  guess_is_rela               PARAMS ((unsigned long));
+static char * 		  get_note_type		         PARAMS ((unsigned int));
+static int		  process_note		         PARAMS ((Elf32_Internal_Note *));
+static int		  process_corefile_note_segment  PARAMS ((FILE *, bfd_vma, bfd_vma));
+static int		  process_corefile_note_segments PARAMS ((FILE *));
+static int 		  process_corefile_contents	 PARAMS ((FILE *));
 
 typedef int Elf32_Word;
 
+#ifndef TRUE
+#define TRUE     1
+#define FALSE    0
+#endif
+#define UNKNOWN -1
+
 #define SECTION_NAME(X) 	(string_table + (X)->sh_name)
 
 #define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
 
 #define BYTE_GET(field) 	byte_get (field, sizeof (field))
 
+/* If we can support a 64 bit data type then BFD64 should be defined
+   and sizeof (bfd_vma) == 8.  In this case when translating from an
+   external 8 byte field to an internal field, we can assume that the
+   internal field is also 8 bytes wide and so we can extact all the data.
+   If, however, BFD64 is not defined, then we must assume that the
+   internal data structure only has 4 byte wide fields that are the
+   equivalent of the 8 byte wide external counterparts, and so we must
+   truncate the data.  */
+#ifdef  BFD64
+#define BYTE_GET8(field) 	byte_get (field, -8)
+#else
+#define BYTE_GET8(field) 	byte_get (field, 8)
+#endif
+
 #define NUM_ELEM(array) 	(sizeof (array) / sizeof ((array)[0]))
 
 #define GET_DATA_ALLOC(offset, size, var, type, reason)			\
@@ -220,6 +289,11 @@
       return 0;								\
     }
 
+#define GET_ELF_SYMBOLS(file, offset, size)			\
+  (is_32bit_elf ? get_32bit_elf_symbols (file, offset, size)	\
+   : get_64bit_elf_symbols (file, offset, size))
+
+
 #ifdef ANSI_PROTOTYPES
 static void
 error (const char * message, ...)
@@ -276,7 +350,7 @@
 }
 #endif
 
-static unsigned long int
+static bfd_vma
 byte_get_little_endian (field, size)
      unsigned char * field;
      int             size;
@@ -290,19 +364,128 @@
       return  ((unsigned int) (field [0]))
 	|    (((unsigned int) (field [1])) << 8);
 
+    case 8:
+      /* We want to extract data from an 8 byte wide field and
+	 place it into a 4 byte wide field.  Since this is a little
+	 endian source we can juts use the 4 byte extraction code.  */
+      /* Fall through.  */
     case 4:
       return  ((unsigned long) (field [0]))
 	|    (((unsigned long) (field [1])) << 8)
 	|    (((unsigned long) (field [2])) << 16)
 	|    (((unsigned long) (field [3])) << 24);
 
+#ifdef BFD64
+    case -8:
+      /* This is a special case, generated by the BYTE_GET8 macro.
+	 It means that we are loading an 8 byte value from a field
+	 in an external structure into an 8 byte value in a field
+	 in an internal strcuture.  */
+      return  ((bfd_vma) (field [0]))
+	|    (((bfd_vma) (field [1])) << 8)
+	|    (((bfd_vma) (field [2])) << 16)
+	|    (((bfd_vma) (field [3])) << 24)
+	|    (((bfd_vma) (field [4])) << 32)
+	|    (((bfd_vma) (field [5])) << 40)
+	|    (((bfd_vma) (field [6])) << 48)
+	|    (((bfd_vma) (field [7])) << 56);
+#endif
     default:
       error (_("Unhandled data length: %d\n"), size);
-      abort();
+      abort ();
     }
 }
 
-static unsigned long int
+/* Print a VMA value.  */
+static void
+print_vma (vma, mode)
+     bfd_vma vma;
+     print_mode mode;
+{
+#ifdef BFD64
+  if (is_32bit_elf)
+#endif
+    {
+      switch (mode)
+	{
+	case FULL_HEX: printf ("0x"); /* drop through */
+	case LONG_HEX: printf ("%8.8lx", (unsigned long) vma); break;
+	case PREFIX_HEX: printf ("0x"); /* drop through */
+	case HEX: printf ("%lx", (unsigned long) vma); break;
+	case DEC: printf ("%ld", (unsigned long) vma); break;
+	case DEC_5: printf ("%5ld", (long) vma); break;
+	case UNSIGNED: printf ("%lu", (unsigned long) vma); break;
+	}
+    }
+#ifdef BFD64
+  else
+    {
+      switch (mode)
+	{
+	case FULL_HEX:
+	  printf ("0x");
+	  /* drop through */
+	  
+	case LONG_HEX:
+	  printf_vma (vma);
+	  break;
+	  
+	case PREFIX_HEX:
+	  printf ("0x");
+	  /* drop through */
+	  
+	case HEX:
+#if BFD_HOST_64BIT_LONG
+	  printf ("%lx", vma);
+#else
+	  if (_bfd_int64_high (vma))
+	    printf ("%lx%lx", _bfd_int64_high (vma), _bfd_int64_low (vma));
+	  else
+	    printf ("%lx", _bfd_int64_low (vma));
+#endif
+	  break;
+
+	case DEC:
+#if BFD_HOST_64BIT_LONG
+	  printf ("%ld", vma);
+#else
+	  if (_bfd_int64_high (vma))
+	    /* ugg */
+	    printf ("++%ld", _bfd_int64_low (vma));
+	  else
+	    printf ("%ld", _bfd_int64_low (vma));
+#endif	  
+	  break;
+
+	case DEC_5:
+#if BFD_HOST_64BIT_LONG
+	  printf ("%5ld", vma);
+#else
+	  if (_bfd_int64_high (vma))
+	    /* ugg */
+	    printf ("++%ld", _bfd_int64_low (vma));
+	  else
+	    printf ("%5ld", _bfd_int64_low (vma));
+#endif	  
+	  break;
+	  
+	case UNSIGNED:
+#if BFD_HOST_64BIT_LONG
+	  printf ("%lu", vma);
+#else	  
+	  if (_bfd_int64_high (vma))
+	    /* ugg */
+	    printf ("++%lu", _bfd_int64_low (vma));
+	  else
+	    printf ("%lu", _bfd_int64_low (vma));
+#endif
+	  break;
+	}
+    }
+#endif
+}
+
+static bfd_vma
 byte_get_big_endian (field, size)
      unsigned char * field;
      int             size;
@@ -321,66 +504,59 @@
 	|   (((unsigned long) (field [1])) << 16)
 	|   (((unsigned long) (field [0])) << 24);
 
+    case 8:
+      /* Although we are extracing data from an 8 byte wide field, we
+	 are returning only 4 bytes of data.  */
+      return ((unsigned long) (field [7]))
+	|   (((unsigned long) (field [6])) << 8)
+	|   (((unsigned long) (field [5])) << 16)
+	|   (((unsigned long) (field [4])) << 24);
+
+#ifdef BFD64
+    case -8:
+      /* This is a special case, generated by the BYTE_GET8 macro.
+	 It means that we are loading an 8 byte value from a field
+	 in an external structure into an 8 byte value in a field
+	 in an internal strcuture.  */
+      return ((bfd_vma) (field [7]))
+	|   (((bfd_vma) (field [6])) << 8)
+	|   (((bfd_vma) (field [5])) << 16)
+	|   (((bfd_vma) (field [4])) << 24)
+	|   (((bfd_vma) (field [3])) << 32)
+	|   (((bfd_vma) (field [2])) << 40)
+	|   (((bfd_vma) (field [1])) << 48)
+	|   (((bfd_vma) (field [0])) << 56);
+#endif
+
     default:
       error (_("Unhandled data length: %d\n"), size);
-      abort();
+      abort ();
     }
 }
 
 
-/* Display the contents of the relocation data
-   found at the specified offset.  */
+/* Guess the relocation sized based on the sized commonly used by the specific machine.  */
 static int
-dump_relocations (file, rel_offset, rel_size, symtab, strtab)
-     FILE *                 file;
-     unsigned long          rel_offset;
-     unsigned long          rel_size;
-     Elf_Internal_Sym *     symtab;
-     char *                 strtab;
+guess_is_rela (e_machine)
+     unsigned long e_machine;
 {
-  unsigned int        i;
-  int                 is_rela;
-  Elf_Internal_Rel *  rels;
-  Elf_Internal_Rela * relas;
-
-
-  /* Compute number of relocations and read them in.  */
-  switch (elf_header.e_machine)
+  switch (e_machine)
     {
       /* Targets that use REL relocations.  */
     case EM_ARM:
     case EM_386:
     case EM_486:
+    case EM_960:
     case EM_CYGNUS_M32R:
     case EM_CYGNUS_D10V:
     case EM_MIPS:
     case EM_MIPS_RS4_BE:
-      {
-	Elf32_External_Rel * erels;
-
-	GET_DATA_ALLOC (rel_offset, rel_size, erels,
-			Elf32_External_Rel *, "relocs");
-
-	rel_size = rel_size / sizeof (Elf32_External_Rel);
-
-	rels = (Elf_Internal_Rel *) malloc (rel_size *
-					    sizeof (Elf_Internal_Rel));
-
-	for (i = 0; i < rel_size; i++)
-	  {
-	    rels[i].r_offset = BYTE_GET (erels[i].r_offset);
-	    rels[i].r_info   = BYTE_GET (erels[i].r_info);
-	  }
-
-	free (erels);
-
-	is_rela = 0;
-	relas   = (Elf_Internal_Rela *) rels;
-      }
-    break;
+      return FALSE;
 
       /* Targets that use RELA relocations.  */
     case EM_68K:
+    case EM_SPARC32PLUS:
+    case EM_SPARCV9:
     case EM_SPARC:
     case EM_PPC:
     case EM_CYGNUS_V850:
@@ -391,34 +567,170 @@
     case EM_SH:
     case EM_ALPHA:
     case EM_MCORE:
-      {
-	Elf32_External_Rela * erelas;
+      return TRUE;
 
-	GET_DATA_ALLOC (rel_offset, rel_size, erelas,
-			Elf32_External_Rela *, "relocs");
-
-	rel_size = rel_size / sizeof (Elf32_External_Rela);
-
-	relas = (Elf_Internal_Rela *) malloc (rel_size *
-					      sizeof (Elf_Internal_Rela));
-
-	for (i = 0; i < rel_size; i++)
-	  {
-	    relas[i].r_offset = BYTE_GET (erelas[i].r_offset);
-	    relas[i].r_info   = BYTE_GET (erelas[i].r_info);
-	    relas[i].r_addend = BYTE_GET (erelas[i].r_addend);
-	  }
-
-	free (erelas);
-
-	is_rela = 1;
-	rels    = (Elf_Internal_Rel *) relas;
-      }
-    break;
-
+    case EM_MMA:
+    case EM_PCP:
+    case EM_NCPU:
+    case EM_NDR1:
+    case EM_STARCORE:
+    case EM_ME16:
+    case EM_ST100:
+    case EM_TINYJ:
+    case EM_FX66:
+    case EM_ST9PLUS:
+    case EM_ST7:
+    case EM_68HC16:
+    case EM_68HC11:
+    case EM_68HC08:
+    case EM_68HC05:
+    case EM_SVX:
+    case EM_ST19:
+    case EM_VAX:
     default:
       warn (_("Don't know about relocations on this machine architecture\n"));
-      return 0;
+      return FALSE;
+    }
+}
+
+/* Display the contents of the relocation data found at the specified offset.  */
+static int
+dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
+     FILE *             file;
+     unsigned long      rel_offset;
+     unsigned long      rel_size;
+     Elf_Internal_Sym * symtab;
+     unsigned long      nsyms;
+     char *             strtab;
+     int                is_rela;
+{
+  unsigned int        i;
+  Elf_Internal_Rel *  rels;
+  Elf_Internal_Rela * relas;
+
+
+  if (is_rela == UNKNOWN)
+    is_rela = guess_is_rela (elf_header.e_machine);
+
+  if (is_rela)
+    {
+      if (is_32bit_elf)
+	{
+	  Elf32_External_Rela * erelas;
+
+	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,
+			  Elf32_External_Rela *, "relocs");
+
+	  rel_size = rel_size / sizeof (Elf32_External_Rela);
+
+	  relas = (Elf_Internal_Rela *)
+	    malloc (rel_size * sizeof (Elf_Internal_Rela));
+
+	  if (relas == NULL)
+	    {
+	      error(_("out of memory parsing relocs"));
+	      return 0;
+	    }
+
+	  for (i = 0; i < rel_size; i++)
+	    {
+	      relas[i].r_offset = BYTE_GET (erelas[i].r_offset);
+	      relas[i].r_info   = BYTE_GET (erelas[i].r_info);
+	      relas[i].r_addend = BYTE_GET (erelas[i].r_addend);
+	    }
+
+	  free (erelas);
+
+	  rels = (Elf_Internal_Rel *) relas;
+	}
+      else
+	{
+	  Elf64_External_Rela * erelas;
+
+	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,
+			  Elf64_External_Rela *, "relocs");
+
+	  rel_size = rel_size / sizeof (Elf64_External_Rela);
+
+	  relas = (Elf_Internal_Rela *)
+	    malloc (rel_size * sizeof (Elf_Internal_Rela));
+
+	  if (relas == NULL)
+	    {
+	      error(_("out of memory parsing relocs"));
+	      return 0;
+	    }
+
+	  for (i = 0; i < rel_size; i++)
+	    {
+	      relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset);
+	      relas[i].r_info   = BYTE_GET8 (erelas[i].r_info);
+	      relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend);
+	    }
+
+	  free (erelas);
+
+	  rels = (Elf_Internal_Rel *) relas;
+	}
+    }
+  else
+    {
+      if (is_32bit_elf)
+	{
+	  Elf32_External_Rel * erels;
+
+	  GET_DATA_ALLOC (rel_offset, rel_size, erels,
+			  Elf32_External_Rel *, "relocs");
+
+	  rel_size = rel_size / sizeof (Elf32_External_Rel);
+
+	  rels = (Elf_Internal_Rel *)
+	    malloc (rel_size * sizeof (Elf_Internal_Rel));
+
+	  if (rels == NULL)
+	    {
+	      error(_("out of memory parsing relocs"));
+	      return 0;
+	    }
+
+	  for (i = 0; i < rel_size; i++)
+	    {
+	      rels[i].r_offset = BYTE_GET (erels[i].r_offset);
+	      rels[i].r_info   = BYTE_GET (erels[i].r_info);
+	    }
+
+	  free (erels);
+
+	  relas = (Elf_Internal_Rela *) rels;
+	}
+      else
+	{
+	  Elf64_External_Rel * erels;
+
+	  GET_DATA_ALLOC (rel_offset, rel_size, erels,
+			  Elf64_External_Rel *, "relocs");
+
+	  rel_size = rel_size / sizeof (Elf64_External_Rel);
+
+	  rels = (Elf_Internal_Rel *)
+	    malloc (rel_size * sizeof (Elf_Internal_Rel));
+
+	  if (rels == NULL)
+	    {
+	      error(_("out of memory parsing relocs"));
+	      return 0;
+	    }
+
+	  for (i = 0; i < rel_size; i++)
+	    {
+	      rels[i].r_offset = BYTE_GET8 (erels[i].r_offset);
+	      rels[i].r_info   = BYTE_GET8 (erels[i].r_info);
+	    }
+
+	  free (erels);
+
+	  relas = (Elf_Internal_Rela *) rels;
+	}
     }
 
   if (is_rela)
@@ -430,10 +742,11 @@
 
   for (i = 0; i < rel_size; i++)
     {
-      const char *  rtype;
-      unsigned long offset;
-      unsigned long info;
-      int           symtab_index;
+      const char * rtype;
+      bfd_vma      offset;
+      bfd_vma      info;
+      bfd_vma      symtab_index;
+      bfd_vma      type;
 
       if (is_rela)
 	{
@@ -446,7 +759,30 @@
 	  info   = rels [i].r_info;
 	}
 
+      if (is_32bit_elf)
+	{
+	  type         = ELF32_R_TYPE (info);
+	  symtab_index = ELF32_R_SYM  (info);
+	}
+      else
+	{
+	  if (elf_header.e_machine == EM_SPARCV9)
+	    type       = ELF64_R_TYPE_ID (info);
+	  else
+	    type       = ELF64_R_TYPE (info);
+	  /* The #ifdef BFD64 below is to prevent a compile time warning.
+	     We know that if we do not have a 64 bit data type that we
+	     will never execute this code anyway.  */
+#ifdef BFD64
+	  symtab_index = ELF64_R_SYM  (info);
+#endif
+	}
+
+#ifdef _bfd_int64_low
+      printf ("  %8.8lx  %5.5lx ", _bfd_int64_low (offset), _bfd_int64_low (info));
+#else
       printf ("  %8.8lx  %5.5lx ", offset, info);
+#endif
 
       switch (elf_header.e_machine)
 	{
@@ -455,106 +791,142 @@
 	  break;
 
 	case EM_CYGNUS_M32R:
-	  rtype = elf_m32r_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_m32r_reloc_type (type);
 	  break;
 
 	case EM_386:
 	case EM_486:
-	  rtype = elf_i386_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_i386_reloc_type (type);
 	  break;
 
 	case EM_68K:
-	  rtype = elf_m68k_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_m68k_reloc_type (type);
 	  break;
 
+	case EM_960:
+	  rtype = elf_i960_reloc_type (type);
+	  break;
+
+	case EM_AVR:
+	  rtype = elf_avr_reloc_type (type);
+	  break;
+
+	case EM_OLD_SPARCV9:
+	case EM_SPARC32PLUS:
+	case EM_SPARCV9:
 	case EM_SPARC:
-	  rtype = elf_sparc_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_sparc_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_V850:
-	  rtype = v850_reloc_type (ELF32_R_TYPE (info));
+	  rtype = v850_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_D10V:
-	  rtype = elf_d10v_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_d10v_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_D30V:
-	  rtype = elf_d30v_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_d30v_reloc_type (type);
 	  break;
 
 	case EM_SH:
-	  rtype = elf_sh_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_sh_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_MN10300:
-	  rtype = elf_mn10300_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_mn10300_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_MN10200:
-	  rtype = elf_mn10200_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_mn10200_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_FR30:
-	  rtype = elf_fr30_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_fr30_reloc_type (type);
 	  break;
 
 	case EM_MCORE:
-	  rtype = elf_mcore_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_mcore_reloc_type (type);
 	  break;
 
 	case EM_PPC:
-	  rtype = elf_ppc_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_ppc_reloc_type (type);
 	  break;
 
 	case EM_MIPS:
 	case EM_MIPS_RS4_BE:
-	  rtype = elf_mips_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_mips_reloc_type (type);
 	  break;
 
 	case EM_ALPHA:
-	  rtype = elf_alpha_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_alpha_reloc_type (type);
 	  break;
 
 	case EM_ARM:
-	  rtype = elf_arm_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_arm_reloc_type (type);
 	  break;
 
 	case EM_CYGNUS_ARC:
-	  rtype = elf_arc_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_arc_reloc_type (type);
 	  break;
 
 	case EM_PARISC:
-	  rtype = elf32_hppa_reloc_type (ELF32_R_TYPE (info));
+	  rtype = elf_hppa_reloc_type (type);
+	  break;
+
+	case EM_PJ:
+	  rtype = elf_pj_reloc_type (type);
 	  break;
 	}
 
       if (rtype == NULL)
-	printf (_("unrecognised: %-7lx"), ELF32_R_TYPE (info));
+#ifdef _bfd_int64_low
+	printf (_("unrecognised: %-7lx"), _bfd_int64_low (type));
+#else
+	printf (_("unrecognised: %-7lx"), type);
+#endif
       else
 	printf ("%-21.21s", rtype);
 
-      symtab_index = ELF32_R_SYM (info);
-
-      if (symtab_index && symtab != NULL)
+      if (symtab_index)
 	{
-	  Elf_Internal_Sym * psym;
+	  if (symtab != NULL)
+	    {
+	      if (symtab_index >= nsyms)
+		printf (" bad symbol index: %08lx", (unsigned long) symtab_index);
+	      else
+		{
+		  Elf_Internal_Sym * psym;
 
-	  psym = symtab + symtab_index;
+		  psym = symtab + symtab_index;
 
-	  printf (" %08lx  ", (unsigned long) psym->st_value);
+		  printf (" ");
+		  print_vma (psym->st_value, LONG_HEX);
+		  printf ("  ");
 
-	  if (psym->st_name == 0)
-	    printf ("%-25.25s",
-		    SECTION_NAME (section_headers + psym->st_shndx));
-	  else if (strtab == NULL)
-	    printf (_("<string table index %3ld>"), psym->st_name);
-	  else
-	    printf ("%-25.25s", strtab + psym->st_name);
+		  if (psym->st_name == 0)
+		    printf ("%-25.25s",
+			    SECTION_NAME (section_headers + psym->st_shndx));
+		  else if (strtab == NULL)
+		    printf (_("<string table index %3ld>"), psym->st_name);
+		  else
+		    printf ("%-25.25s", strtab + psym->st_name);
 
-	  if (is_rela)
-	    printf (" + %lx", (unsigned long) relas [i].r_addend);
+		  if (is_rela)
+		    printf (" + %lx", (unsigned long) relas [i].r_addend);
+		}
+	    }
 	}
+      else if (is_rela)
+	{
+	  printf ("%*c", is_32bit_elf ? 34 : 26, ' ');
+	  print_vma (relas[i].r_addend, LONG_HEX);
+	}
+
+      if (elf_header.e_machine == EM_SPARCV9
+	  && !strcmp (rtype, "R_SPARC_OLO10"))
+	printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info));
 
       putchar ('\n');
     }
@@ -619,6 +991,42 @@
 }
 
 static const char *
+get_sparc64_dynamic_type (type)
+     unsigned long type;
+{
+  switch (type)
+    {
+    case DT_SPARC_REGISTER: return "SPARC_REGISTER";
+    default:
+      return NULL;
+    }
+}
+
+static const char *
+get_parisc_dynamic_type (type)
+     unsigned long type;
+{
+  switch (type)
+    {
+    case DT_HP_LOAD_MAP:	return "HP_LOAD_MAP";
+    case DT_HP_DLD_FLAGS:	return "HP_DLD_FLAGS";
+    case DT_HP_DLD_HOOK:	return "HP_DLD_HOOK";
+    case DT_HP_UX10_INIT:	return "HP_UX10_INIT";
+    case DT_HP_UX10_INITSZ:	return "HP_UX10_INITSZ";
+    case DT_HP_PREINIT:		return "HP_PREINIT";
+    case DT_HP_PREINITSZ:	return "HP_PREINITSZ";
+    case DT_HP_NEEDED:		return "HP_NEEDED";
+    case DT_HP_TIME_STAMP:	return "HP_TIME_STAMP";
+    case DT_HP_CHECKSUM:	return "HP_CHECKSUM";
+    case DT_HP_GST_SIZE:	return "HP_GST_SIZE";
+    case DT_HP_GST_VERSION:	return "HP_GST_VERSION";
+    case DT_HP_GST_HASHVAL:	return "HP_GST_HASHVAL";
+    default:
+      return NULL;
+    }
+}
+
+static const char *
 get_dynamic_type (type)
      unsigned long type;
 {
@@ -655,7 +1063,12 @@
     case DT_FINI_ARRAY: return "FINI_ARRAY";
     case DT_INIT_ARRAYSZ: return "INIT_ARRAYSZ";
     case DT_FINI_ARRAYSZ: return "FINI_ARRAYSZ";
-      
+    case DT_RUNPATH:    return "RUNPATH";
+    case DT_FLAGS:      return "FLAGS";
+
+    case DT_PREINIT_ARRAY: return "PREINIT_ARRAY";
+    case DT_PREINIT_ARRAYSZ: return "PREINIT_ARRAYSZ";
+
     case DT_PLTPADSZ:	return "PLTPADSZ";
     case DT_MOVEENT:	return "MOVEENT";
     case DT_MOVESZ:	return "MOVESZ";
@@ -663,12 +1076,12 @@
     case DT_POSFLAG_1:	return "POSFLAG_1";
     case DT_SYMINSZ:	return "SYMINSZ";
     case DT_SYMINENT:	return "SYMINENT"; /* aka VALRNGHI */
-      
+
     case DT_ADDRRNGLO:  return "ADDRRNGLO";
     case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */
-      
+
     case DT_VERSYM:	return "VERSYM";
-      
+
     case DT_RELACOUNT:	return "RELACOUNT";
     case DT_RELCOUNT:	return "RELCOUNT";
     case DT_FLAGS_1:	return "FLAGS_1";
@@ -676,22 +1089,25 @@
     case DT_VERDEFNUM:	return "VERDEFNUM";
     case DT_VERNEED:	return "VERNEED";
     case DT_VERNEEDNUM:	return "VERNEEDNUM";
-      
+
     case DT_AUXILIARY:	return "AUXILARY";
     case DT_USED:	return "USED";
     case DT_FILTER:	return "FILTER";
-      
+
     default:
       if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
 	{
 	  const char * result;
-	  
+
 	  switch (elf_header.e_machine)
 	    {
 	    case EM_MIPS:
 	    case EM_MIPS_RS4_BE:
 	      result = get_mips_dynamic_type (type);
 	      break;
+	    case EM_SPARCV9:
+	      result = get_sparc64_dynamic_type (type);
+	      break;
 	    default:
 	      result = NULL;
 	      break;
@@ -703,10 +1119,27 @@
 	  sprintf (buff, _("Processor Specific: %lx"), type);
 	}
       else if ((type >= DT_LOOS) && (type <= DT_HIOS))
-	sprintf (buff, _("Operating System specific: %lx"), type);
+	{
+	  const char * result;
+
+	  switch (elf_header.e_machine)
+	    {
+	    case EM_PARISC:
+	      result = get_parisc_dynamic_type (type);
+	      break;
+	    default:
+	      result = NULL;
+	      break;
+	    }
+
+	  if (result != NULL)
+	    return result;
+
+	  sprintf (buff, _("Operating System specific: %lx"), type);
+	}
       else
 	sprintf (buff, _("<unknown>: %lx"), type);
-      
+
       return buff;
     }
 }
@@ -740,7 +1173,7 @@
 get_machine_name (e_machine)
      unsigned e_machine;
 {
-  static char buff [32];
+  static char buff [64]; /* XXX */
 
   switch (e_machine)
     {
@@ -752,8 +1185,8 @@
     case EM_88K:         	return "MC88000";
     case EM_486:         	return "Intel 80486";
     case EM_860:         	return "Intel 80860";
-    case EM_MIPS:        	return "MIPS R3000 big-endian";
-    case EM_S370:        	return "Amdahl";
+    case EM_MIPS:        	return "MIPS R3000";
+    case EM_S370:        	return "IBM System/370";
     case EM_MIPS_RS4_BE: 	return "MIPS R4000 big-endian";
     case EM_OLD_SPARCV9:	return "Sparc v9 (old)";
     case EM_PARISC:      	return "HPPA";
@@ -775,7 +1208,7 @@
     case EM_H8_300H:		return "Hitachi H8/300H";
     case EM_H8S:		return "Hitachi H8S";
     case EM_H8_500:		return "Hitachi H8/500";
-    case EM_IA_64:		return "Intel Merced";
+    case EM_IA_64:		return "Intel IA-64";
     case EM_MIPS_X:		return "Stanford MIPS-X";
     case EM_COLDFIRE:		return "Motorola Coldfire";
     case EM_68HC12:		return "Motorola M68HC12";
@@ -788,7 +1221,25 @@
     case EM_CYGNUS_MN10300:	return "mn10300";
     case EM_CYGNUS_MN10200:	return "mn10200";
     case EM_CYGNUS_FR30:	return "Fujitsu FR30";
-
+    case EM_PJ:                 return "picoJava";
+    case EM_MMA:      		return "Fujitsu Multimedia Accelerator";
+    case EM_PCP:      		return "Siemens PCP";
+    case EM_NCPU:     		return "Sony nCPU embedded RISC processor";
+    case EM_NDR1:     		return "Denso NDR1 microprocesspr";
+    case EM_STARCORE: 		return "Motorola Star*Core processor";
+    case EM_ME16:     		return "Toyota ME16 processor";
+    case EM_ST100:    		return "STMicroelectronics ST100 processor";
+    case EM_TINYJ:    		return "Advanced Logic Corp. TinyJ embedded processor";
+    case EM_FX66:     		return "Siemens FX66 microcontroller";
+    case EM_ST9PLUS:  		return "STMicroelectronics ST9+ 8/16 bit microcontroller";
+    case EM_ST7:      		return "STMicroelectronics ST7 8-bit microcontroller";
+    case EM_68HC16:   		return "Motorola MC68HC16 Microcontroller";
+    case EM_68HC11:   		return "Motorola MC68HC11 Microcontroller";
+    case EM_68HC08:   		return "Motorola MC68HC08 Microcontroller";
+    case EM_68HC05:   		return "Motorola MC68HC05 Microcontroller";
+    case EM_SVX:      		return "Silicon Graphics SVx";
+    case EM_ST19:     		return "STMicroelectronics ST19 8-bit microcontroller";
+    case EM_VAX:      		return "Digital VAX";
     default:
       sprintf (buff, _("<unknown>: %x"), e_machine);
       return buff;
@@ -803,6 +1254,7 @@
   static char buf [1024];
 
   buf[0] = '\0';
+  
   if (e_flags)
     {
       switch (e_machine)
@@ -810,6 +1262,11 @@
 	default:
 	  break;
 
+        case EM_68K:
+          if (e_flags & EF_CPU32)
+            strcat (buf, ", cpu32");
+          break;
+
 	case EM_PPC:
 	  if (e_flags & EF_PPC_EMB)
 	    strcat (buf, ", emb");
@@ -871,28 +1328,75 @@
 	  if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
 	    strcat (buf, ", mips4");
 	  break;
+
+	case EM_SPARCV9:
+	  if (e_flags & EF_SPARC_32PLUS)
+	    strcat (buf, ", v8+");
+
+	  if (e_flags & EF_SPARC_SUN_US1)
+	    strcat (buf, ", ultrasparcI");
+
+	  if (e_flags & EF_SPARC_SUN_US3)
+	    strcat (buf, ", ultrasparcIII");
+
+	  if (e_flags & EF_SPARC_HAL_R1)
+	    strcat (buf, ", halr1");
+
+	  if (e_flags & EF_SPARC_LEDATA)
+	    strcat (buf, ", ledata");
+
+	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_TSO)
+	    strcat (buf, ", tso");
+
+	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_PSO)
+	    strcat (buf, ", pso");
+
+	  if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_RMO)
+	    strcat (buf, ", rmo");
+	  break;
+
+	case EM_PARISC:
+	  switch (e_flags & EF_PARISC_ARCH)
+	    {
+	    case EFA_PARISC_1_0:
+	      strcpy (buf, ", PA-RISC 1.0");
+	      break;
+	    case EFA_PARISC_1_1:
+	      strcpy (buf, ", PA-RISC 1.1");
+	      break;
+	    case EFA_PARISC_2_0:
+	      strcpy (buf, ", PA-RISC 2.0");
+	      break;
+	    default:
+	      break;
+	    }
+	  if (e_flags & EF_PARISC_TRAPNIL)
+	    strcat (buf, ", trapnil");
+	  if (e_flags & EF_PARISC_EXT)
+	    strcat (buf, ", ext");
+	  if (e_flags & EF_PARISC_LSB)
+	    strcat (buf, ", lsb");
+	  if (e_flags & EF_PARISC_WIDE)
+	    strcat (buf, ", wide");
+	  if (e_flags & EF_PARISC_NO_KABP)
+	    strcat (buf, ", no kabp");
+	  if (e_flags & EF_PARISC_LAZYSWAP)
+	    strcat (buf, ", lazyswap");
+	  break;
+	  
+	case EM_PJ:
+	  if ((e_flags & EF_PICOJAVA_NEWCALLS) == EF_PICOJAVA_NEWCALLS)
+	    strcat (buf, ", new calling convention");
+
+	  if ((e_flags & EF_PICOJAVA_GNUCALLS) == EF_PICOJAVA_GNUCALLS)
+	    strcat (buf, ", gnu calling convention");
+	  break;
 	}
     }
 
   return buf;
 }
 
-static char *
-get_machine_data (e_data)
-     unsigned e_data;
-{
-  static char buff [32];
-
-  switch (e_data)
-    {
-    case ELFDATA2LSB: return _("ELFDATA2LSB (little endian)");
-    case ELFDATA2MSB: return _("ELFDATA2MSB (big endian)");
-    default:
-      sprintf (buff, _("<unknown>: %x"), e_data);
-      return buff;
-    }
-}
-
 static const char *
 get_mips_segment_type (type)
      unsigned long type;
@@ -913,6 +1417,33 @@
 }
 
 static const char *
+get_parisc_segment_type (type)
+     unsigned long type;
+{
+  switch (type)
+    {
+    case PT_HP_TLS:		return "HP_TLS";
+    case PT_HP_CORE_NONE:	return "HP_CORE_NONE";
+    case PT_HP_CORE_VERSION:	return "HP_CORE_VERSION";
+    case PT_HP_CORE_KERNEL:	return "HP_CORE_KERNEL";
+    case PT_HP_CORE_COMM:	return "HP_CORE_COMM";
+    case PT_HP_CORE_PROC:	return "HP_CORE_PROC";
+    case PT_HP_CORE_LOADABLE:	return "HP_CORE_LOADABLE";
+    case PT_HP_CORE_STACK:	return "HP_CORE_STACK";
+    case PT_HP_CORE_SHM:	return "HP_CORE_SHM";
+    case PT_HP_CORE_MMF:	return "HP_CORE_MMF";
+    case PT_HP_PARALLEL:	return "HP_PARALLEL";
+    case PT_HP_FASTBIND:	return "HP_FASTBIND";
+    case PT_PARISC_ARCHEXT:	return "PARISC_ARCHEXT";
+    case PT_PARISC_UNWIND:	return "PARISC_UNWIND";
+    default:
+      break;
+    }
+
+  return NULL;
+}
+
+static const char *
 get_segment_type (p_type)
      unsigned long p_type;
 {
@@ -932,25 +1463,45 @@
       if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
 	{
 	  const char * result;
-	  
+
 	  switch (elf_header.e_machine)
 	    {
 	    case EM_MIPS:
 	    case EM_MIPS_RS4_BE:
 	      result = get_mips_segment_type (p_type);
 	      break;
+	    case EM_PARISC:
+	      result = get_parisc_segment_type (p_type);
+	      break;
 	    default:
 	      result = NULL;
 	      break;
 	    }
-	  
+
 	  if (result != NULL)
 	    return result;
-	  
+
 	  sprintf (buff, "LOPROC+%lx", p_type - PT_LOPROC);
 	}
       else if ((p_type >= PT_LOOS) && (p_type <= PT_HIOS))
-	sprintf (buff, "LOOS+%lx", p_type - PT_LOOS);
+	{
+	  const char * result;
+
+	  switch (elf_header.e_machine)
+	    {
+	    case EM_PARISC:
+	      result = get_parisc_segment_type (p_type);
+	      break;
+	    default:
+	      result = NULL;
+	      break;
+	    }
+
+	  if (result != NULL)
+	    return result;
+
+	  sprintf (buff, "LOOS+%lx", p_type - PT_LOOS);
+	}
       else
 	sprintf (buff, _("<unknown>: %lx"), p_type);
 
@@ -1010,6 +1561,21 @@
 }
 
 static const char *
+get_parisc_section_type_name (sh_type)
+     unsigned int sh_type;
+{
+  switch (sh_type)
+    {
+    case SHT_PARISC_EXT:	return "PARISC_EXT";
+    case SHT_PARISC_UNWIND:	return "PARISC_UNWIND";
+    case SHT_PARISC_DOC:	return "PARISC_DOC";
+    default:
+      break;
+    }
+  return NULL;
+}
+
+static const char *
 get_section_type_name (sh_type)
      unsigned int sh_type;
 {
@@ -1029,6 +1595,9 @@
     case SHT_REL:		return "REL";
     case SHT_SHLIB:		return "SHLIB";
     case SHT_DYNSYM:		return "DYNSYM";
+    case SHT_INIT_ARRAY:	return "INIT_ARRAY";
+    case SHT_FINI_ARRAY:	return "FINI_ARRAY";
+    case SHT_PREINIT_ARRAY:	return "PREINIT_ARRAY";
     case SHT_GNU_verdef:	return "VERDEF";
     case SHT_GNU_verneed:	return "VERNEED";
     case SHT_GNU_versym:	return "VERSYM";
@@ -1048,6 +1617,9 @@
 	    case EM_MIPS_RS4_BE:
 	      result = get_mips_section_type_name (sh_type);
 	      break;
+	    case EM_PARISC:
+	      result = get_parisc_section_type_name (sh_type);
+	      break;
 	    default:
 	      result = NULL;
 	      break;
@@ -1064,7 +1636,7 @@
 	sprintf (buff, "SHT_LOUSER+%x", sh_type - SHT_LOUSER);
       else
 	sprintf (buff, _("<unknown>: %x"), sh_type);
-      
+
       return buff;
     }
 }
@@ -1075,14 +1647,16 @@
   {"file-header",      no_argument, 0, 'h'},
   {"program-headers",  no_argument, 0, 'l'},
   {"headers",          no_argument, 0, 'e'},
-  {"histogram",        no_argument, & do_histogram, 1},
+  {"histogram",        no_argument, 0, 'I'},
   {"segments",         no_argument, 0, 'l'},
   {"sections",         no_argument, 0, 'S'},
   {"section-headers",  no_argument, 0, 'S'},
   {"symbols",          no_argument, 0, 's'},
   {"syms",             no_argument, 0, 's'},
   {"relocs",           no_argument, 0, 'r'},
+  {"notes",            no_argument, 0, 'n'},
   {"dynamic",          no_argument, 0, 'd'},
+  {"arch-specific",    no_argument, 0, 'A'},
   {"version-info",     no_argument, 0, 'V'},
   {"use-dynamic",      no_argument, 0, 'D'},
   {"hex-dump",         required_argument, 0, 'x'},
@@ -1101,7 +1675,7 @@
 {
   fprintf (stdout, _("Usage: readelf {options} elf-file(s)\n"));
   fprintf (stdout, _("  Options are:\n"));
-  fprintf (stdout, _("  -a or --all               Equivalent to: -h -l -S -s -r -d -V --histogram\n"));
+  fprintf (stdout, _("  -a or --all               Equivalent to: -h -l -S -s -r -d -V -A -I\n"));
   fprintf (stdout, _("  -h or --file-header       Display the ELF file header\n"));
   fprintf (stdout, _("  -l or --program-headers or --segments\n"));
   fprintf (stdout, _("                            Display the program headers\n"));
@@ -1109,9 +1683,11 @@
   fprintf (stdout, _("                            Display the sections' header\n"));
   fprintf (stdout, _("  -e or --headers           Equivalent to: -h -l -S\n"));
   fprintf (stdout, _("  -s or --syms or --symbols Display the symbol table\n"));
+  fprintf (stdout, _("  -n or --notes             Display the core notes (if present)\n"));
   fprintf (stdout, _("  -r or --relocs            Display the relocations (if present)\n"));
   fprintf (stdout, _("  -d or --dynamic           Display the dynamic segment (if present)\n"));
   fprintf (stdout, _("  -V or --version-info      Display the version sections (if present)\n"));
+  fprintf (stdout, _("  -A or --arch-specific     Display architecture specific information (if any).\n"));
   fprintf (stdout, _("  -D or --use-dynamic       Use the dynamic section info when displaying symbols\n"));
   fprintf (stdout, _("  -x <number> or --hex-dump=<number>\n"));
   fprintf (stdout, _("                            Dump the contents of section <number>\n"));
@@ -1121,7 +1697,7 @@
   fprintf (stdout, _("  -i <number> or --instruction-dump=<number>\n"));
   fprintf (stdout, _("                            Disassemble the contents of section <number>\n"));
 #endif
-  fprintf (stdout, _("        --histogram         Display histogram of bucket list lengths\n"));
+  fprintf (stdout, _("  -I or --histogram         Display histogram of bucket list lengths\n"));
   fprintf (stdout, _("  -v or --version           Display the version number of readelf\n"));
   fprintf (stdout, _("  -H or --help              Display this information\n"));
   fprintf (stdout, _("Report bugs to bug-gnu-utils@gnu.org\n"));
@@ -1171,7 +1747,7 @@
     usage ();
 
   while ((c = getopt_long
-	  (argc, argv, "ersahldSDw::x:i:vV", options, NULL)) != EOF)
+	  (argc, argv, "ersahnldSDAIw::x:i:vV", options, NULL)) != EOF)
     {
       char *    cp;
       int	section;
@@ -1194,12 +1770,17 @@
 	  do_segments ++;
 	  do_version ++;
 	  do_histogram ++;
+	  do_arch ++;
+	  do_notes ++;
 	  break;
 	case 'e':
 	  do_header ++;
 	  do_sections ++;
 	  do_segments ++;
 	  break;
+	case 'A':
+	  do_arch ++;
+	  break;
 	case 'D':
 	  do_using_dynamic ++;
 	  break;
@@ -1221,6 +1802,12 @@
 	case 'd':
 	  do_dynamic ++;
 	  break;
+	case 'I':
+	  do_histogram ++;
+	  break;
+	case 'n':
+	  do_notes ++;
+	  break;
 	case 'x':
 	  do_dump ++;
 	  section = strtoul (optarg, & cp, 0);
@@ -1299,7 +1886,7 @@
 
   if (!do_dynamic && !do_syms && !do_reloc && !do_sections
       && !do_segments && !do_header && !do_dump && !do_version
-      && !do_histogram && !do_debugging)
+      && !do_histogram && !do_debugging && !do_arch && !do_notes)
     usage ();
   else if (argc < 3)
     {
@@ -1312,12 +1899,16 @@
 get_elf_class (elf_class)
      unsigned char elf_class;
 {
+  static char buff [32];
+
   switch (elf_class)
     {
     case ELFCLASSNONE: return _("none");
     case ELFCLASS32:   return _("ELF32");
     case ELFCLASS64:   return _("ELF64");
-    default:           return _("<unknown>");
+    default:
+      sprintf (buff, _("<unknown: %x>"), elf_class);
+      return buff;
     }
 }
 
@@ -1325,12 +1916,16 @@
 get_data_encoding (encoding)
      unsigned char encoding;
 {
+  static char buff [32];
+
   switch (encoding)
     {
     case ELFDATANONE: return _("none");
-    case ELFDATA2LSB: return _("2's compilment, little endian");
-    case ELFDATA2MSB: return _("2's compilment, big endian");
-    default:          return _("<unknown>");
+    case ELFDATA2LSB: return _("2's complement, little endian");
+    case ELFDATA2MSB: return _("2's complement, big endian");
+    default:
+      sprintf (buff, _("<unknown: %x>"), encoding);
+      return buff;
     }
 }
 
@@ -1338,12 +1933,18 @@
 get_osabi_name (osabi)
      unsigned char osabi;
 {
+  static char buff [32];
+
   switch (osabi)
     {
     case ELFOSABI_SYSV:       return _("UNIX - System V");
     case ELFOSABI_HPUX:       return _("UNIX - HP-UX");
+    case ELFOSABI_LINUX:      return _("UNIX - Linux");
     case ELFOSABI_STANDALONE: return _("Standalone App");
-    default:                  return _("<unknown>");
+    case ELFOSABI_ARM:        return _("ARM");
+    default:
+      sprintf (buff, _("<unknown: %x>"), osabi);
+      return buff;
     }
 }
 
@@ -1376,8 +1977,11 @@
 	      get_data_encoding (elf_header.e_ident [EI_DATA]));
       printf (_("  Version:                           %d %s\n"),
 	      elf_header.e_ident [EI_VERSION],
-	      elf_header.e_ident [EI_VERSION] == EV_CURRENT ? "(current)" :
-	      elf_header.e_ident [EI_VERSION] != EV_NONE ? "<unknown>" : "");
+	      (elf_header.e_ident [EI_VERSION] == EV_CURRENT
+	       ? "(current)"
+	       : (elf_header.e_ident [EI_VERSION] != EV_NONE
+		  ? "<unknown: %lx>"
+		  : "")));
       printf (_("  OS/ABI:                            %s\n"),
 	      get_osabi_name (elf_header.e_ident [EI_OSABI]));
       printf (_("  ABI Version:                       %d\n"),
@@ -1388,14 +1992,15 @@
 	      get_machine_name (elf_header.e_machine));
       printf (_("  Version:                           0x%lx\n"),
 	      (unsigned long) elf_header.e_version);
-      printf (_("  Data:                              %s\n"),
-	      get_machine_data (elf_header.e_ident [EI_DATA]));
-      printf (_("  Entry point address:               0x%lx\n"),
-	      (unsigned long) elf_header.e_entry);
-      printf (_("  Start of program headers:          %ld (bytes into file)\n"),
-	      (long) elf_header.e_phoff);
-      printf (_("  Start of section headers:          %ld (bytes into file)\n"),
-	      (long) elf_header.e_shoff);
+      
+      printf (_("  Entry point address:               "));
+      print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);
+      printf (_("\n  Start of program headers:          "));
+      print_vma ((bfd_vma) elf_header.e_phoff, DEC);
+      printf (_(" (bytes into file)\n  Start of section headers:          "));
+      print_vma ((bfd_vma) elf_header.e_shoff, DEC);
+      printf (_(" (bytes into file)\n"));
+	
       printf (_("  Flags:                             0x%lx%s\n"),
 	      (unsigned long) elf_header.e_flags,
 	      get_machine_flags (elf_header.e_flags, elf_header.e_machine));
@@ -1413,28 +2018,83 @@
 	      (long) elf_header.e_shstrndx);
     }
 
-  /* Test class after dumping header so that at least the header can be
-     display on 64 bit binaries.  */
-  
-  binary_class = elf_header.e_ident [EI_CLASS];
-  if (binary_class != ELFCLASS32)
-    {
-      error (_("Not a 32 bit ELF file\n"));
-      return 0;
-    }
-
   return 1;
 }
 
 
 static int
+get_32bit_program_headers (file, program_headers)
+     FILE * file;
+     Elf_Internal_Phdr * program_headers;
+{
+  Elf32_External_Phdr * phdrs;
+  Elf32_External_Phdr * external;
+  Elf32_Internal_Phdr * internal;
+  unsigned int          i;
+
+  GET_DATA_ALLOC (elf_header.e_phoff,
+		  elf_header.e_phentsize * elf_header.e_phnum,
+		  phdrs, Elf32_External_Phdr *, "program headers");
+
+  for (i = 0, internal = program_headers, external = phdrs;
+       i < elf_header.e_phnum;
+       i ++, internal ++, external ++)
+    {
+      internal->p_type   = BYTE_GET (external->p_type);
+      internal->p_offset = BYTE_GET (external->p_offset);
+      internal->p_vaddr  = BYTE_GET (external->p_vaddr);
+      internal->p_paddr  = BYTE_GET (external->p_paddr);
+      internal->p_filesz = BYTE_GET (external->p_filesz);
+      internal->p_memsz  = BYTE_GET (external->p_memsz);
+      internal->p_flags  = BYTE_GET (external->p_flags);
+      internal->p_align  = BYTE_GET (external->p_align);
+    }
+
+  free (phdrs);
+
+  return 1;
+}
+
+static int
+get_64bit_program_headers (file, program_headers)
+     FILE * file;
+     Elf_Internal_Phdr * program_headers;
+{
+  Elf64_External_Phdr * phdrs;
+  Elf64_External_Phdr * external;
+  Elf64_Internal_Phdr * internal;
+  unsigned int          i;
+
+  GET_DATA_ALLOC (elf_header.e_phoff,
+		  elf_header.e_phentsize * elf_header.e_phnum,
+		  phdrs, Elf64_External_Phdr *, "program headers");
+
+  for (i = 0, internal = program_headers, external = phdrs;
+       i < elf_header.e_phnum;
+       i ++, internal ++, external ++)
+    {
+      internal->p_type   = BYTE_GET (external->p_type);
+      internal->p_flags  = BYTE_GET (external->p_flags);
+      internal->p_offset = BYTE_GET8 (external->p_offset);
+      internal->p_vaddr  = BYTE_GET8 (external->p_vaddr);
+      internal->p_paddr  = BYTE_GET8 (external->p_paddr);
+      internal->p_filesz = BYTE_GET8 (external->p_filesz);
+      internal->p_memsz  = BYTE_GET8 (external->p_memsz);
+      internal->p_align  = BYTE_GET8 (external->p_align);
+    }
+
+  free (phdrs);
+
+  return 1;
+}
+
+static int
 process_program_headers (file)
      FILE * file;
 {
-  Elf32_External_Phdr * phdrs;
-  Elf32_Internal_Phdr * program_headers;
-  Elf32_Internal_Phdr * segment;
-  unsigned int	        i;
+  Elf_Internal_Phdr * program_headers;
+  Elf_Internal_Phdr * segment;
+  unsigned int	      i;
 
   if (elf_header.e_phnum == 0)
     {
@@ -1445,18 +2105,17 @@
 
   if (do_segments && !do_header)
     {
-      printf (_("\nElf file is %s\n"), get_file_type (elf_header.e_type));
-      printf (_("Entry point 0x%lx\n"), (unsigned long) elf_header.e_entry);
-      printf (_("There are %d program headers, starting at offset %lx:\n"),
-	      elf_header.e_phnum, (unsigned long) elf_header.e_phoff);
+      printf (_("\nElf file type is %s\n"), get_file_type (elf_header.e_type));
+      printf (_("Entry point "));
+      print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);
+      printf (_("\nThere are %d program headers, starting at offset "),
+	      elf_header.e_phnum);
+      print_vma ((bfd_vma) elf_header.e_phoff, DEC);
+      printf ("\n");
     }
 
-  GET_DATA_ALLOC (elf_header.e_phoff,
-		  elf_header.e_phentsize * elf_header.e_phnum,
-		  phdrs, Elf32_External_Phdr *, "program headers");
-
-  program_headers = (Elf32_Internal_Phdr *) malloc
-    (elf_header.e_phnum * sizeof (Elf32_Internal_Phdr));
+  program_headers = (Elf_Internal_Phdr *) malloc
+    (elf_header.e_phnum * sizeof (Elf_Internal_Phdr));
 
   if (program_headers == NULL)
     {
@@ -1464,32 +2123,37 @@
       return 0;
     }
 
-  for (i = 0, segment = program_headers;
-       i < elf_header.e_phnum;
-       i ++, segment ++)
-    {
-      segment->p_type   = BYTE_GET (phdrs[i].p_type);
-      segment->p_offset = BYTE_GET (phdrs[i].p_offset);
-      segment->p_vaddr  = BYTE_GET (phdrs[i].p_vaddr);
-      segment->p_paddr  = BYTE_GET (phdrs[i].p_paddr);
-      segment->p_filesz = BYTE_GET (phdrs[i].p_filesz);
-      segment->p_memsz  = BYTE_GET (phdrs[i].p_memsz);
-      segment->p_flags  = BYTE_GET (phdrs[i].p_flags);
-      segment->p_align  = BYTE_GET (phdrs[i].p_align);
-    }
+  if (is_32bit_elf)
+    i = get_32bit_program_headers (file, program_headers);
+  else
+    i = get_64bit_program_headers (file, program_headers);
 
-  free (phdrs);
+  if (i == 0)
+    {
+      free (program_headers);
+      return 0;
+    }
 
   if (do_segments)
     {
       printf
 	(_("\nProgram Header%s:\n"), elf_header.e_phnum > 1 ? "s" : "");
-      printf
-	(_("  Type        Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"));
+      
+      if (is_32bit_elf)
+	printf
+	  (_("  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"));
+      else
+	{
+	  printf
+	    (_("  Type           Offset             VirtAddr           PhysAddr\n"));
+	  printf
+	    (_("                 FileSiz            MemSiz              Flags  Align\n"));
+	}
     }
 
   loadaddr = -1;
   dynamic_addr = 0;
+  dynamic_size = 0;
 
   for (i = 0, segment = program_headers;
        i < elf_header.e_phnum;
@@ -1497,17 +2161,38 @@
     {
       if (do_segments)
 	{
-	  printf ("  %-11.11s ", get_segment_type (segment->p_type));
-	  printf ("0x%6.6lx ", (unsigned long) segment->p_offset);
-	  printf ("0x%8.8lx ", (unsigned long) segment->p_vaddr);
-	  printf ("0x%8.8lx ", (unsigned long) segment->p_paddr);
-	  printf ("0x%5.5lx ", (unsigned long) segment->p_filesz);
-	  printf ("0x%5.5lx ", (unsigned long) segment->p_memsz);
-	  printf ("%c%c%c ",
-		  (segment->p_flags & PF_R ? 'R' : ' '),
-		  (segment->p_flags & PF_W ? 'W' : ' '),
-		  (segment->p_flags & PF_X ? 'E' : ' '));
-	  printf ("%#lx", (unsigned long) segment->p_align);
+	  printf ("  %-14.14s ", get_segment_type (segment->p_type));
+
+	  if (is_32bit_elf)
+	    {
+	      printf ("0x%6.6lx ", (unsigned long) segment->p_offset);
+	      printf ("0x%8.8lx ", (unsigned long) segment->p_vaddr);
+	      printf ("0x%8.8lx ", (unsigned long) segment->p_paddr);
+	      printf ("0x%5.5lx ", (unsigned long) segment->p_filesz);
+	      printf ("0x%5.5lx ", (unsigned long) segment->p_memsz);
+	      printf ("%c%c%c ",
+		      (segment->p_flags & PF_R ? 'R' : ' '),
+		      (segment->p_flags & PF_W ? 'W' : ' '),
+		      (segment->p_flags & PF_X ? 'E' : ' '));
+	      printf ("%#lx", (unsigned long) segment->p_align);
+	    }
+	  else
+	    {
+	      print_vma (segment->p_offset, FULL_HEX);
+	      putchar (' ');
+	      print_vma (segment->p_vaddr, FULL_HEX);
+	      putchar (' ');
+	      print_vma (segment->p_paddr, FULL_HEX);
+	      printf ("\n                 ");
+	      print_vma (segment->p_filesz, FULL_HEX);
+	      putchar (' ');
+	      print_vma (segment->p_memsz, FULL_HEX);
+	      printf ("  %c%c%c    ",
+		      (segment->p_flags & PF_R ? 'R' : ' '),
+		      (segment->p_flags & PF_W ? 'W' : ' '),
+		      (segment->p_flags & PF_X ? 'E' : ' '));
+	      print_vma (segment->p_align, HEX);
+	    }
 	}
 
       switch (segment->p_type)
@@ -1527,7 +2212,7 @@
 	  break;
 
 	case PT_INTERP:
-	  if (fseek (file, segment->p_offset, SEEK_SET))
+	  if (fseek (file, (long) segment->p_offset, SEEK_SET))
 	    error (_("Unable to find program interpreter name\n"));
 	  else
 	    {
@@ -1560,8 +2245,8 @@
 
       for (i = 0; i < elf_header.e_phnum; i++)
 	{
-	  int        j;
-	  Elf32_Internal_Shdr * section;
+	  int                 j;
+	  Elf_Internal_Shdr * section;
 
 	  segment = program_headers + i;
 	  section = section_headers;
@@ -1577,7 +2262,7 @@
 		      ? (section->sh_addr >= segment->p_vaddr
 			 && section->sh_addr + section->sh_size
 			 <= segment->p_vaddr + segment->p_memsz)
-		      : (section->sh_offset >= segment->p_offset
+		      : ((bfd_vma) section->sh_offset >= segment->p_offset
 			 && (section->sh_offset + section->sh_size
 			     <= segment->p_offset + segment->p_filesz))))
 		printf ("%s ", SECTION_NAME (section));
@@ -1594,7 +2279,7 @@
 
 
 static int
-get_section_headers (file)
+get_32bit_section_headers (file)
      FILE * file;
 {
   Elf32_External_Shdr * shdrs;
@@ -1605,8 +2290,8 @@
 		  elf_header.e_shentsize * elf_header.e_shnum,
 		  shdrs, Elf32_External_Shdr *, "section headers");
 
-  section_headers = (Elf32_Internal_Shdr *) malloc
-    (elf_header.e_shnum * sizeof (Elf32_Internal_Shdr));
+  section_headers = (Elf_Internal_Shdr *) malloc
+    (elf_header.e_shnum * sizeof (Elf_Internal_Shdr));
 
   if (section_headers == NULL)
     {
@@ -1635,8 +2320,50 @@
   return 1;
 }
 
+static int
+get_64bit_section_headers (file)
+     FILE * file;
+{
+  Elf64_External_Shdr * shdrs;
+  Elf64_Internal_Shdr * internal;
+  unsigned int          i;
+
+  GET_DATA_ALLOC (elf_header.e_shoff,
+		  elf_header.e_shentsize * elf_header.e_shnum,
+		  shdrs, Elf64_External_Shdr *, "section headers");
+
+  section_headers = (Elf_Internal_Shdr *) malloc
+    (elf_header.e_shnum * sizeof (Elf_Internal_Shdr));
+
+  if (section_headers == NULL)
+    {
+      error (_("Out of memory\n"));
+      return 0;
+    }
+
+  for (i = 0, internal = section_headers;
+       i < elf_header.e_shnum;
+       i ++, internal ++)
+    {
+      internal->sh_name      = BYTE_GET (shdrs[i].sh_name);
+      internal->sh_type      = BYTE_GET (shdrs[i].sh_type);
+      internal->sh_flags     = BYTE_GET8 (shdrs[i].sh_flags);
+      internal->sh_addr      = BYTE_GET8 (shdrs[i].sh_addr);
+      internal->sh_size      = BYTE_GET8 (shdrs[i].sh_size);
+      internal->sh_entsize   = BYTE_GET8 (shdrs[i].sh_entsize);
+      internal->sh_link      = BYTE_GET (shdrs[i].sh_link);
+      internal->sh_info      = BYTE_GET (shdrs[i].sh_info);
+      internal->sh_offset    = BYTE_GET (shdrs[i].sh_offset);
+      internal->sh_addralign = BYTE_GET (shdrs[i].sh_addralign);
+    }
+
+  free (shdrs);
+
+  return 1;
+}
+
 static Elf_Internal_Sym *
-get_elf_symbols (file, offset, number)
+get_32bit_elf_symbols (file, offset, number)
      FILE * file;
      unsigned long offset;
      unsigned long number;
@@ -1676,12 +2403,99 @@
   return isyms;
 }
 
+static Elf_Internal_Sym *
+get_64bit_elf_symbols (file, offset, number)
+     FILE * file;
+     unsigned long offset;
+     unsigned long number;
+{
+  Elf64_External_Sym * esyms;
+  Elf_Internal_Sym *   isyms;
+  Elf_Internal_Sym *   psym;
+  unsigned int         j;
+
+  GET_DATA_ALLOC (offset, number * sizeof (Elf64_External_Sym),
+		  esyms, Elf64_External_Sym *, "symbols");
+
+  isyms = (Elf_Internal_Sym *) malloc (number * sizeof (Elf_Internal_Sym));
+
+  if (isyms == NULL)
+    {
+      error (_("Out of memory\n"));
+      free (esyms);
+
+      return NULL;
+    }
+
+  for (j = 0, psym = isyms;
+       j < number;
+       j ++, psym ++)
+    {
+      psym->st_name  = BYTE_GET (esyms[j].st_name);
+      psym->st_info  = BYTE_GET (esyms[j].st_info);
+      psym->st_other = BYTE_GET (esyms[j].st_other);
+      psym->st_shndx = BYTE_GET (esyms[j].st_shndx);
+      psym->st_value = BYTE_GET8 (esyms[j].st_value);
+      psym->st_size  = BYTE_GET8 (esyms[j].st_size);
+    }
+
+  free (esyms);
+
+  return isyms;
+}
+
+static const char *
+get_elf_section_flags (sh_flags)
+     bfd_vma sh_flags;
+{
+  static char buff [32];
+
+  * buff = 0;
+  
+  while (sh_flags)
+    {
+      bfd_vma flag;
+
+      flag = sh_flags & - sh_flags;
+      sh_flags &= ~ flag;
+      
+      switch (flag)
+	{
+	case SHF_WRITE:            strcat (buff, "W"); break;
+	case SHF_ALLOC:            strcat (buff, "A"); break;
+	case SHF_EXECINSTR:        strcat (buff, "X"); break;
+	case SHF_MERGE:            strcat (buff, "M"); break;
+	case SHF_STRINGS:          strcat (buff, "S"); break;
+	case SHF_INFO_LINK:        strcat (buff, "I"); break;
+	case SHF_LINK_ORDER:       strcat (buff, "L"); break;
+	case SHF_OS_NONCONFORMING: strcat (buff, "O"); break;
+	  
+	default:
+	  if (flag & SHF_MASKOS)
+	    {
+	      strcat (buff, "o");
+	      sh_flags &= ~ SHF_MASKOS;
+	    }
+	  else if (flag & SHF_MASKPROC)
+	    {
+	      strcat (buff, "p");
+	      sh_flags &= ~ SHF_MASKPROC;
+	    }
+	  else
+	    strcat (buff, "x");
+	  break;
+	}
+    }
+  
+  return buff;
+}
+
 static int
 process_section_headers (file)
      FILE * file;
 {
-  Elf32_Internal_Shdr * section;
-  int        i;
+  Elf_Internal_Shdr * section;
+  int                 i;
 
   section_headers = NULL;
 
@@ -1694,10 +2508,15 @@
     }
 
   if (do_sections && !do_header)
-    printf (_("There are %d section headers, starting at offset %lx:\n"),
+    printf (_("There are %d section headers, starting at offset 0x%lx:\n"),
 	    elf_header.e_shnum, (unsigned long) elf_header.e_shoff);
 
-  if (! get_section_headers (file))
+  if (is_32bit_elf)
+    {
+      if (! get_32bit_section_headers (file))
+	return 0;
+    }
+  else if (! get_64bit_section_headers (file))
     return 0;
 
   /* Read in the string table, so that we have names to display.  */
@@ -1718,6 +2537,7 @@
   dynamic_symbols = NULL;
   dynamic_strings = NULL;
   dynamic_syminfo = NULL;
+
   for (i = 0, section = section_headers;
        i < elf_header.e_shnum;
        i ++, section ++)
@@ -1732,9 +2552,9 @@
 	      continue;
 	    }
 
-	  dynamic_symbols = get_elf_symbols
-	    (file, section->sh_offset,
-	     section->sh_size / section->sh_entsize);
+	  num_dynamic_syms = section->sh_size / section->sh_entsize;
+	  dynamic_symbols =
+	    GET_ELF_SYMBOLS (file, section->sh_offset, num_dynamic_syms);
 	}
       else if (section->sh_type == SHT_STRTAB
 	       && strcmp (name, ".dynstr") == 0)
@@ -1769,8 +2589,15 @@
     return 1;
 
   printf (_("\nSection Header%s:\n"), elf_header.e_shnum > 1 ? "s" : "");
-  printf
-    (_("  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n"));
+  
+  if (is_32bit_elf)
+    printf
+      (_("  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n"));
+  else
+    {
+      printf (_("  [Nr] Name              Type             Address           Offset\n"));
+      printf (_("       Size              EntSize          Flags  Link  Info  Align\n"));
+    }
 
   for (i = 0, section = section_headers;
        i < elf_header.e_shnum;
@@ -1781,21 +2608,45 @@
 	      SECTION_NAME (section),
 	      get_section_type_name (section->sh_type));
 
-      printf ( "%8.8lx %6.6lx %6.6lx %2.2lx",
-	       (unsigned long) section->sh_addr,
-	       (unsigned long) section->sh_offset,
-	       (unsigned long) section->sh_size,
-	       (unsigned long) section->sh_entsize);
+      if (is_32bit_elf)
+	{
+	  print_vma (section->sh_addr, LONG_HEX);
+      
+	  printf ( " %6.6lx %6.6lx %2.2lx",
+		   (unsigned long) section->sh_offset,
+		   (unsigned long) section->sh_size,
+		   (unsigned long) section->sh_entsize);
 
-      printf (" %c%c%c %2ld %3lx %ld\n",
-	      (section->sh_flags & SHF_WRITE ? 'W' : ' '),
-	      (section->sh_flags & SHF_ALLOC ? 'A' : ' '),
-	      (section->sh_flags & SHF_EXECINSTR ? 'X' : ' '),
-	      (unsigned long) section->sh_link,
-	      (unsigned long) section->sh_info,
-	      (unsigned long) section->sh_addralign);
+	  printf (" %3s ", get_elf_section_flags (section->sh_flags));
+		  
+	  printf (" %2ld %3lx %ld\n",
+		  (unsigned long) section->sh_link,
+		  (unsigned long) section->sh_info,
+		  (unsigned long) section->sh_addralign);
+	}
+      else
+	{
+	  putchar (' ');
+	  print_vma (section->sh_addr, LONG_HEX);
+	  printf ("  %8.8lx", section->sh_offset);
+	  printf ("\n       ");
+	  print_vma (section->sh_size, LONG_HEX);
+	  printf ("  ");
+	  print_vma (section->sh_entsize, LONG_HEX);
+	  
+	  printf (" %3s ", get_elf_section_flags (section->sh_flags));
+		  
+	  printf ("     %2ld   %3lx     %ld\n",
+		  (unsigned long) section->sh_link,
+		  (unsigned long) section->sh_info,
+		  (unsigned long) section->sh_addralign);
+	}
     }
 
+  printf (_("Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n"));
+  printf (_("              I (info), L (link order), O (extra OS processing required)\n"));
+  printf (_("              o (os specific), p (processor specific) x (unknown)\n"));
+
   return 1;
 }
 
@@ -1813,6 +2664,8 @@
 
   if (do_using_dynamic)
     {
+      int is_rela = FALSE;
+
       rel_size   = 0;
       rel_offset = 0;
 
@@ -1820,16 +2673,31 @@
 	{
 	  rel_offset = dynamic_info[DT_REL];
 	  rel_size   = dynamic_info[DT_RELSZ];
+	  is_rela    = FALSE;
 	}
       else if (dynamic_info [DT_RELA])
 	{
 	  rel_offset = dynamic_info[DT_RELA];
 	  rel_size   = dynamic_info[DT_RELASZ];
+	  is_rela    = TRUE;
 	}
       else if (dynamic_info[DT_JMPREL])
 	{
 	  rel_offset = dynamic_info[DT_JMPREL];
 	  rel_size   = dynamic_info[DT_PLTRELSZ];
+
+	  switch (dynamic_info[DT_PLTREL])
+	    {
+	    case DT_REL:
+	      is_rela = FALSE;
+	      break;
+	    case DT_RELA:
+	      is_rela = TRUE;
+	      break;
+	    default:
+	      is_rela = UNKNOWN;
+	      break;
+	    }
 	}
 
       if (rel_size)
@@ -1839,7 +2707,7 @@
 	     rel_offset, rel_size);
 
 	  dump_relocations (file, rel_offset - loadaddr, rel_size,
-			    dynamic_symbols, dynamic_strings);
+			    dynamic_symbols, num_dynamic_syms, dynamic_strings, is_rela);
 	}
       else
 	printf (_("\nThere are no dynamic relocations in this file.\n"));
@@ -1867,6 +2735,8 @@
 	      Elf32_Internal_Shdr * symsec;
 	      Elf_Internal_Sym *    symtab;
 	      char *                strtab;
+	      int                   is_rela;
+	      unsigned long         nsyms;
 
 	      printf (_("\nRelocation section "));
 
@@ -1880,8 +2750,8 @@
 
 	      symsec = section_headers + section->sh_link;
 
-	      symtab = get_elf_symbols (file, symsec->sh_offset,
-					symsec->sh_size / symsec->sh_entsize);
+	      nsyms = symsec->sh_size / symsec->sh_entsize;
+	      symtab = GET_ELF_SYMBOLS (file, symsec->sh_offset, nsyms);
 
 	      if (symtab == NULL)
 		continue;
@@ -1891,7 +2761,9 @@
 	      GET_DATA_ALLOC (strsec->sh_offset, strsec->sh_size, strtab,
 			      char *, "string table");
 
-	      dump_relocations (file, rel_offset, rel_size, symtab, strtab);
+	      is_rela = section->sh_type == SHT_RELA;
+
+	      dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela);
 
 	      free (strtab);
 	      free (symtab);
@@ -1938,7 +2810,7 @@
 	  puts ("");
 	}
       break;
-      
+
     case DT_MIPS_IVERSION:
       if (dynamic_strings != NULL)
 	printf ("Interface Version: %s\n",
@@ -1946,7 +2818,7 @@
       else
 	printf ("%ld\n", (long) entry->d_un.d_ptr);
       break;
-      
+
     case DT_MIPS_TIME_STAMP:
       {
 	char timebuf[20];
@@ -1955,7 +2827,7 @@
 	printf ("Time Stamp: %s\n", timebuf);
       }
       break;
-      
+
     case DT_MIPS_RLD_VERSION:
     case DT_MIPS_LOCAL_GOTNO:
     case DT_MIPS_CONFLICTNO:
@@ -1971,37 +2843,85 @@
     case DT_MIPS_COMPACT_SIZE:
       printf ("%ld\n", (long) entry->d_un.d_ptr);
       break;
-      
+
     default:
       printf ("%#lx\n", (long) entry->d_un.d_ptr);
     }
 }
 
-/* Parse the dynamic segment */
+
+static void
+dynamic_segment_parisc_val (entry)
+     Elf_Internal_Dyn * entry;
+{
+  switch (entry->d_tag)
+    {
+    case DT_HP_DLD_FLAGS:
+      {
+	static struct
+	{
+	  long int bit;
+	  const char * str;
+	}
+	flags[] =
+	{
+	  { DT_HP_DEBUG_PRIVATE, "HP_DEBUG_PRIVATE" },
+	  { DT_HP_DEBUG_CALLBACK, "HP_DEBUG_CALLBACK" },
+	  { DT_HP_DEBUG_CALLBACK_BOR, "HP_DEBUG_CALLBACK_BOR" },
+	  { DT_HP_NO_ENVVAR, "HP_NO_ENVVAR" },
+	  { DT_HP_BIND_NOW, "HP_BIND_NOW" },
+	  { DT_HP_BIND_NONFATAL, "HP_BIND_NONFATAL" },
+	  { DT_HP_BIND_VERBOSE, "HP_BIND_VERBOSE" },
+	  { DT_HP_BIND_RESTRICTED, "HP_BIND_RESTRICTED" },
+	  { DT_HP_BIND_SYMBOLIC, "HP_BIND_SYMBOLIC" },
+	  { DT_HP_RPATH_FIRST, "HP_RPATH_FIRST" },
+	  { DT_HP_BIND_DEPTH_FIRST, "HP_BIND_DEPTH_FIRST" }
+	};
+	int first = 1;
+	size_t cnt;
+	bfd_vma val = entry->d_un.d_val;
+
+	for (cnt = 0; cnt < sizeof (flags) / sizeof (flags[0]); ++cnt)
+	  if (val & flags[cnt].bit)
+	    {
+	      if (! first)
+		putchar (' ');
+	      fputs (flags[cnt].str, stdout);
+	      first = 0;
+	      val ^= flags[cnt].bit;
+	    }
+	
+	if (val != 0 || first)
+	  {
+	    if (! first)
+	      putchar (' ');
+	    print_vma (val, HEX);
+	  }
+      }
+      break;
+      
+    default:
+      print_vma (entry->d_un.d_ptr, PREFIX_HEX);
+      break;
+    }
+}
+
 static int
-process_dynamic_segment (file)
+get_32bit_dynamic_segment (file)
      FILE * file;
 {
-  Elf_Internal_Dyn *    entry;
-  Elf32_External_Dyn *  edyn;
-  unsigned int i;
-
-  if (dynamic_size == 0)
-    {
-      if (do_dynamic)
-	printf (_("\nThere is no dynamic segment in this file.\n"));
-
-      return 1;
-    }
+  Elf32_External_Dyn * edyn;
+  Elf_Internal_Dyn *   entry;
+  bfd_size_type        i;
 
   GET_DATA_ALLOC (dynamic_addr, dynamic_size,
 		  edyn, Elf32_External_Dyn *, "dynamic segment");
-  
+
   /* SGI's ELF has more than one section in the DYNAMIC segment.  Determine
-     how large .dynamic is now.  We can do this even before the byte
+     how large this .dynamic is now.  We can do this even before the byte
      swapping since the DT_NULL tag is recognizable.  */
   dynamic_size = 0;
-  while (*(Elf32_Word *) edyn[dynamic_size++].d_tag != DT_NULL)
+  while (*(Elf32_Word *) edyn [dynamic_size++].d_tag != DT_NULL)
     ;
 
   dynamic_segment = (Elf_Internal_Dyn *)
@@ -2024,6 +2944,98 @@
 
   free (edyn);
 
+  return 1;
+}
+
+static int
+get_64bit_dynamic_segment (file)
+     FILE * file;
+{
+  Elf64_External_Dyn * edyn;
+  Elf_Internal_Dyn *   entry;
+  bfd_size_type        i;
+
+  GET_DATA_ALLOC (dynamic_addr, dynamic_size,
+		  edyn, Elf64_External_Dyn *, "dynamic segment");
+
+  /* SGI's ELF has more than one section in the DYNAMIC segment.  Determine
+     how large this .dynamic is now.  We can do this even before the byte
+     swapping since the DT_NULL tag is recognizable.  */
+  dynamic_size = 0;
+  while (*(bfd_vma *) edyn [dynamic_size ++].d_tag != DT_NULL)
+    ;
+
+  dynamic_segment = (Elf_Internal_Dyn *)
+    malloc (dynamic_size * sizeof (Elf_Internal_Dyn));
+
+  if (dynamic_segment == NULL)
+    {
+      error (_("Out of memory\n"));
+      free (edyn);
+      return 0;
+    }
+
+  for (i = 0, entry = dynamic_segment;
+       i < dynamic_size;
+       i ++, entry ++)
+    {
+      entry->d_tag      = BYTE_GET8 (edyn [i].d_tag);
+      entry->d_un.d_val = BYTE_GET8 (edyn [i].d_un.d_val);
+    }
+
+  free (edyn);
+
+  return 1;
+}
+
+static const char *
+get_dynamic_flags (flags)
+     bfd_vma flags;
+{
+  static char buff [64];
+  while (flags)
+    {
+      bfd_vma flag;
+
+      flag = flags & - flags;
+      flags &= ~ flag;
+
+      switch (flag)
+	{
+	case DF_ORIGIN:   strcat (buff, "ORIGIN "); break;
+	case DF_SYMBOLIC: strcat (buff, "SYMBOLIC "); break;
+	case DF_TEXTREL:  strcat (buff, "TEXTREL "); break;
+	case DF_BIND_NOW: strcat (buff, "BIND_NOW "); break;
+	default:          strcat (buff, "unknown "); break;
+	}
+    }
+  return buff;
+}
+
+/* Parse and display the contents of the dynamic segment.  */
+static int
+process_dynamic_segment (file)
+     FILE * file;
+{
+  Elf_Internal_Dyn * entry;
+  bfd_size_type      i;
+
+  if (dynamic_size == 0)
+    {
+      if (do_dynamic)
+	printf (_("\nThere is no dynamic segment in this file.\n"));
+
+      return 1;
+    }
+
+  if (is_32bit_elf)
+    {
+      if (! get_32bit_dynamic_segment (file))
+	return 0;
+    }
+  else if (! get_64bit_dynamic_segment (file))
+    return 0;
+
   /* Find the appropriate symbol table.  */
   if (dynamic_symbols == NULL)
     {
@@ -2032,7 +3044,6 @@
 	   ++i, ++ entry)
 	{
 	  unsigned long        offset;
-	  long                 num_syms;
 
 	  if (entry->d_tag != DT_SYMTAB)
 	    continue;
@@ -2043,21 +3054,23 @@
 	     we default to reading in the entire file (!) and
 	     processing that.  This is overkill, I know, but it
 	     should work. */
-
 	  offset = entry->d_un.d_val - loadaddr;
 
 	  if (fseek (file, 0, SEEK_END))
 	    error (_("Unable to seek to end of file!"));
 
-	  num_syms = (ftell (file) - offset) / sizeof (Elf32_External_Sym);
+	  if (is_32bit_elf)
+	    num_dynamic_syms = (ftell (file) - offset) / sizeof (Elf32_External_Sym);
+	  else
+	    num_dynamic_syms = (ftell (file) - offset) / sizeof (Elf64_External_Sym);
 
-	  if (num_syms < 1)
+	  if (num_dynamic_syms < 1)
 	    {
 	      error (_("Unable to determine the number of symbols to load\n"));
 	      continue;
 	    }
 
-	  dynamic_symbols = get_elf_symbols (file, offset, num_syms);
+	  dynamic_symbols = GET_ELF_SYMBOLS (file, offset, num_dynamic_syms);
 	}
     }
 
@@ -2123,8 +3136,8 @@
 
       if (dynamic_syminfo_offset != 0 && syminsz != 0)
 	{
-	  Elf_External_Syminfo *extsyminfo;
-	  Elf_Internal_Syminfo *syminfo;
+	  Elf_External_Syminfo * extsyminfo;
+	  Elf_Internal_Syminfo * syminfo;
 
 	  /* There is a syminfo section.  Read the data.  */
 	  GET_DATA_ALLOC (dynamic_syminfo_offset, syminsz, extsyminfo,
@@ -2150,8 +3163,8 @@
     }
 
   if (do_dynamic && dynamic_addr)
-    printf (_("\nDynamic segment at offset 0x%x contains %d entries:\n"),
-	    dynamic_addr, dynamic_size);
+    printf (_("\nDynamic segment at offset 0x%x contains %ld entries:\n"),
+	    dynamic_addr, (long) dynamic_size);
   if (do_dynamic)
     printf (_("  Tag        Type                         Name/Value\n"));
 
@@ -2160,14 +3173,25 @@
        i++, entry ++)
     {
       if (do_dynamic)
-	printf (_("  0x%-8.8lx (%s)%*s"),
-		(unsigned long) entry->d_tag,
-		get_dynamic_type (entry->d_tag),
-		27 - strlen (get_dynamic_type (entry->d_tag)),
-		" ");
+	{
+	  const char *dtype;
+
+	  putchar (' ');
+	  print_vma (entry->d_tag, FULL_HEX);
+	  dtype = get_dynamic_type (entry->d_tag);
+	  printf (" (%s)%*s", dtype,
+		  ((is_32bit_elf ? 27 : 19)
+		   - (int) strlen (dtype)),
+		  " ");
+	}
 
       switch (entry->d_tag)
 	{
+	case DT_FLAGS:
+	  if (do_dynamic)
+	    printf ("%s", get_dynamic_flags (entry->d_un.d_val));
+	  break;
+	  
 	case DT_AUXILIARY:
 	case DT_FILTER:
 	  if (do_dynamic)
@@ -2180,7 +3204,11 @@
 	      if (dynamic_strings)
 		printf (": [%s]\n", dynamic_strings + entry->d_un.d_val);
 	      else
-		printf (": %#lx\n", (long) entry->d_un.d_val);
+		{
+		  printf (": ");
+		  print_vma (entry->d_un.d_val, PREFIX_HEX);
+		  putchar ('\n');
+		}
 	    }
 	  break;
 
@@ -2341,26 +3369,27 @@
 		    case DT_NEEDED:
 		      printf (_("Shared library: [%s]"), name);
 
-		      if (strcmp (name, program_interpreter))
-			printf ("\n");
-		      else
-			printf (_(" program interpreter\n"));
+		      if (strcmp (name, program_interpreter) == 0)
+			printf (_(" program interpreter"));
 		      break;
 
 		    case DT_SONAME:
-		      printf (_("Library soname: [%s]\n"), name);
+		      printf (_("Library soname: [%s]"), name);
 		      break;
 
 		    case DT_RPATH:
-		      printf (_("Library rpath: [%s]\n"), name);
+		      printf (_("Library rpath: [%s]"), name);
 		      break;
 
 		    default:
-		      printf ("%#lx\n", (long) entry->d_un.d_val);
+		      print_vma (entry->d_un.d_val, PREFIX_HEX);
+		      break;
 		    }
 		}
 	      else
-		printf ("%#lx\n", (long) entry->d_un.d_val);
+		print_vma (entry->d_un.d_val, PREFIX_HEX);
+
+	      putchar ('\n');
 	    }
 	  break;
 
@@ -2377,7 +3406,10 @@
 	case DT_INIT_ARRAYSZ:
 	case DT_FINI_ARRAYSZ:
 	  if (do_dynamic)
-	    printf ("%lu (bytes)\n", (unsigned long) entry->d_un.d_val);
+	    {
+	      print_vma (entry->d_un.d_val, UNSIGNED);
+	      printf (" (bytes)\n");
+	    }
 	  break;
 
 	case DT_VERDEFNUM:
@@ -2385,7 +3417,10 @@
 	case DT_RELACOUNT:
 	case DT_RELCOUNT:
 	  if (do_dynamic)
-	    printf ("%lu\n", (unsigned long) entry->d_un.d_val);
+	    {
+	      print_vma (entry->d_un.d_val, UNSIGNED);
+	      putchar ('\n');
+	    }
 	  break;
 
 	case DT_SYMINSZ:
@@ -2408,15 +3443,16 @@
 		      break;
 		    }
 		}
-	      
-	      printf ("%#lx\n", (long) entry->d_un.d_val);
+
+	      print_vma (entry->d_un.d_val, PREFIX_HEX);
+	      putchar ('\n');
 	    }
 	  break;
 
 	case DT_BIND_NOW:
 	  /* The value of this entry is ignored.  */
 	  break;
-	  
+
 	default:
 	  if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
 	    version_info [DT_VERSIONTAGIDX (entry->d_tag)] =
@@ -2430,8 +3466,12 @@
 		case EM_MIPS_RS4_BE:
 		  dynamic_segment_mips_val (entry);
 		  break;
+		case EM_PARISC:
+		  dynamic_segment_parisc_val (entry);
+		  break;
 		default:
-		  printf ("%#lx\n", (long) entry->d_un.d_ptr);
+		  print_vma (entry->d_un.d_val, PREFIX_HEX);
+		  putchar ('\n');
 		}
 	    }
 	  break;
@@ -2502,7 +3542,7 @@
 	    printf (_("  Addr: 0x"));
 	    printf_vma (section->sh_addr);
 	    printf (_("  Offset: %#08lx  Link: %lx (%s)\n"),
-		    section->sh_offset, section->sh_link,
+		    (unsigned long) section->sh_offset, section->sh_link,
 		    SECTION_NAME (section_headers + section->sh_link));
 
 	    GET_DATA_ALLOC (section->sh_offset, section->sh_size,
@@ -2518,7 +3558,7 @@
 		Elf_Internal_Verdaux   aux;
 		int                    j;
 		int                    isum;
-		
+
 		vstart = ((char *) edefs) + idx;
 
 		edef = (Elf_External_Verdef *) vstart;
@@ -2575,7 +3615,7 @@
 	    free (edefs);
 	  }
 	  break;
-	  
+
 	case SHT_GNU_verneed:
 	  {
 	    Elf_External_Verneed *  eneed;
@@ -2590,7 +3630,7 @@
 	    printf (_(" Addr: 0x"));
 	    printf_vma (section->sh_addr);
 	    printf (_("  Offset: %#08lx  Link to section: %ld (%s)\n"),
-		    section->sh_offset, section->sh_link,
+		    (unsigned long) section->sh_offset, section->sh_link,
 		    SECTION_NAME (section_headers + section->sh_link));
 
 	    GET_DATA_ALLOC (section->sh_offset, section->sh_size,
@@ -2655,7 +3695,7 @@
 
 		idx += ent.vn_next;
 	      }
-	    
+
 	    free (eneed);
 	  }
 	  break;
@@ -2676,9 +3716,8 @@
 
 	    found = 1;
 
-	    symbols = get_elf_symbols
-	      (file, link_section->sh_offset,
-	       link_section->sh_size / link_section->sh_entsize);
+	    symbols = GET_ELF_SYMBOLS (file, link_section->sh_offset,
+				       link_section->sh_size / link_section->sh_entsize);
 
 	    string_sec = section_headers + link_section->sh_link;
 
@@ -2691,7 +3730,7 @@
 	    printf (_(" Addr: "));
 	    printf_vma (section->sh_addr);
 	    printf (_("  Offset: %#08lx  Link: %lx (%s)\n"),
-		    section->sh_offset, section->sh_link,
+		    (unsigned long) section->sh_offset, section->sh_link,
 		    SECTION_NAME (link_section));
 
 	    GET_DATA_ALLOC (version_info [DT_VERSIONTAGIDX (DT_VERSYM)]
@@ -2710,6 +3749,7 @@
 	    for (cnt = 0; cnt < total; cnt += 4)
 	      {
 		int j, nn;
+		char *name;
 
 		printf ("  %03x:", cnt);
 
@@ -2770,10 +3810,10 @@
 				{
 				  ivna.vna_name = BYTE_GET (evna.vna_name);
 
+				  name = strtab + ivna.vna_name;
 				  nn += printf ("(%s%-*s",
-						strtab + ivna.vna_name,
-						12 - strlen (strtab
-							     + ivna.vna_name),
+						name,
+						12 - (int) strlen (name),
 						")");
 				  break;
 				}
@@ -2816,12 +3856,11 @@
 					  ivda.vda_name =
 					    BYTE_GET (evda.vda_name);
 
+					  name = strtab + ivda.vda_name;
 					  nn +=
 					    printf ("(%s%-*s",
-						    strtab + ivda.vda_name,
-						    12
-						    - strlen (strtab
-							      + ivda.vda_name),
+						    name,
+						    12 - (int) strlen (name),
 						    ")");
 					}
 				    }
@@ -2872,10 +3911,10 @@
 				{
 				  ivna.vna_name = BYTE_GET (evna.vna_name);
 
+				  name = strtab + ivna.vna_name;
 				  nn += printf ("(%s%-*s",
-						strtab + ivna.vna_name,
-						12 - strlen (strtab
-							     + ivna.vna_name),
+						name,
+						12 - (int) strlen (name),
 						")");
 				  break;
 				}
@@ -2917,10 +3956,10 @@
 
 			      ivda.vda_name = BYTE_GET (evda.vda_name);
 
+			      name = strtab + ivda.vda_name;
 			      nn += printf ("(%s%-*s",
-					    strtab + ivda.vda_name,
-					    12 - strlen (strtab
-							 + ivda.vda_name),
+					    name,
+					    12 - (int) strlen (name),
 					    ")");
 			    }
 			}
@@ -2937,7 +3976,7 @@
 	    free (symbols);
 	  }
 	  break;
-	
+
 	default:
 	  break;
 	}
@@ -2949,7 +3988,7 @@
   return 1;
 }
 
-static char *
+static const char *
 get_symbol_binding (binding)
      unsigned int binding;
 {
@@ -2957,9 +3996,9 @@
 
   switch (binding)
     {
-    case STB_LOCAL:  return _("LOCAL");
-    case STB_GLOBAL: return _("GLOBAL");
-    case STB_WEAK:   return _("WEAK");
+    case STB_LOCAL:  return "LOCAL";
+    case STB_GLOBAL: return "GLOBAL";
+    case STB_WEAK:   return "WEAK";
     default:
       if (binding >= STB_LOPROC && binding <= STB_HIPROC)
 	sprintf (buff, _("<processor specific>: %d"), binding);
@@ -2971,7 +4010,7 @@
     }
 }
 
-static char *
+static const char *
 get_symbol_type (type)
      unsigned int type;
 {
@@ -2979,23 +4018,59 @@
 
   switch (type)
     {
-    case STT_NOTYPE:   return _("NOTYPE");
-    case STT_OBJECT:   return _("OBJECT");
-    case STT_FUNC:     return _("FUNC");
-    case STT_SECTION:  return _("SECTION");
-    case STT_FILE:     return _("FILE");
+    case STT_NOTYPE:   return "NOTYPE";
+    case STT_OBJECT:   return "OBJECT";
+    case STT_FUNC:     return "FUNC";
+    case STT_SECTION:  return "SECTION";
+    case STT_FILE:     return "FILE";
+    case STT_COMMON:   return "COMMON";
     default:
       if (type >= STT_LOPROC && type <= STT_HIPROC)
-	sprintf (buff, _("<processor specific>: %d"), type);
+	{
+	  if (elf_header.e_machine == EM_ARM && type == STT_ARM_TFUNC)
+	    return "THUMB_FUNC";
+
+	  if (elf_header.e_machine == EM_SPARCV9 && type == STT_REGISTER)
+	    return "REGISTER";
+
+	  if (elf_header.e_machine == EM_PARISC && type == STT_PARISC_MILLI)
+	    return "PARISC_MILLI";
+
+	  sprintf (buff, _("<processor specific>: %d"), type);
+	}
       else if (type >= STT_LOOS && type <= STT_HIOS)
-	sprintf (buff, _("<OS specific>: %d"), type);
+	{
+	  if (elf_header.e_machine == EM_PARISC)
+	    {
+	      if (type == STT_HP_OPAQUE)
+		return "HP_OPAQUE";
+	      if (type == STT_HP_STUB)
+		return "HP_STUB";
+	    }
+
+	  sprintf (buff, _("<OS specific>: %d"), type);
+	}
       else
 	sprintf (buff, _("<unknown>: %d"), type);
       return buff;
     }
 }
 
-static char *
+static const char *
+get_symbol_visibility (visibility)
+     unsigned int visibility;
+{
+  switch (visibility)
+    {
+    case STV_DEFAULT:   return "DEFAULT";
+    case STV_INTERNAL:  return "INTERNAL";
+    case STV_HIDDEN:    return "HIDDEN";
+    case STV_PROTECTED: return "PROTECTED";
+    default: abort ();
+    }
+}
+
+static const char *
 get_symbol_index_type (type)
      unsigned int type;
 {
@@ -3021,7 +4096,6 @@
     }
 }
 
-
 static int *
 get_dynamic_data (file, number)
      FILE *       file;
@@ -3069,8 +4143,8 @@
   Elf32_Internal_Shdr *   section;
   char   nb [4];
   char   nc [4];
-  int    nbuckets;
-  int    nchains;
+  int    nbuckets = 0;
+  int    nchains = 0;
   int *  buckets = NULL;
   int *  chains = NULL;
 
@@ -3115,29 +4189,31 @@
       int    si;
 
       printf (_("\nSymbol table for image:\n"));
-      printf (_("  Num Buc:    Value  Size   Type   Bind Ot Ndx Name\n"));
+      if (is_32bit_elf)
+	printf (_("  Num Buc:    Value  Size   Type   Bind Vis      Ndx Name\n"));
+      else
+	printf (_("  Num Buc:    Value          Size   Type   Bind Vis      Ndx Name\n"));
 
       for (hn = 0; hn < nbuckets; hn++)
 	{
 	  if (! buckets [hn])
 	    continue;
 
-	  for (si = buckets [hn]; si; si = chains [si])
+	  for (si = buckets [hn]; si < nchains && si > 0; si = chains [si])
 	    {
 	      Elf_Internal_Sym * psym;
 
 	      psym = dynamic_symbols + si;
 
-	      printf ("  %3d %3d: %8lx %5ld %6s %6s %2d ",
-		      si, hn,
-		      (unsigned long) psym->st_value,
-		      (unsigned long) psym->st_size,
-		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
-		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
-		      psym->st_other);
-
-	      printf ("%3.3s", get_symbol_index_type (psym->st_shndx));
-
+	      printf ("  %3d %3d: ", si, hn);
+	      print_vma (psym->st_value, LONG_HEX);
+	      putchar (' ' );
+	      print_vma (psym->st_size, DEC_5);
+		      
+	      printf ("  %6s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
+	      printf (" %6s",  get_symbol_binding (ELF_ST_BIND (psym->st_info)));
+	      printf (" %3s",  get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
+	      printf (" %3.3s", get_symbol_index_type (psym->st_shndx));
 	      printf (" %s\n", dynamic_strings + psym->st_name);
 	    }
 	}
@@ -3163,10 +4239,12 @@
 	  printf (_("\nSymbol table '%s' contains %lu entries:\n"),
 		  SECTION_NAME (section),
 		  (unsigned long) (section->sh_size / section->sh_entsize));
-	  fputs (_("  Num:    Value  Size Type    Bind   Ot  Ndx Name\n"),
-		 stdout);
+	  if (is_32bit_elf)
+	    printf (_("   Num:    Value  Size Type    Bind   Vis      Ndx Name\n"));
+	  else
+	    printf (_("   Num:    Value          Size Type    Bind   Vis      Ndx Name\n"));
 
-	  symtab = get_elf_symbols (file, section->sh_offset,
+	  symtab = GET_ELF_SYMBOLS (file, section->sh_offset,
 				    section->sh_size / section->sh_entsize);
 	  if (symtab == NULL)
 	    continue;
@@ -3187,23 +4265,14 @@
 	       si < section->sh_size / section->sh_entsize;
 	       si ++, psym ++)
 	    {
-	      printf ("  %3d: %8lx %5ld %-7s %-6s %2d ",
-		      si,
-		      (unsigned long) psym->st_value,
-		      (unsigned long) psym->st_size,
-		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
-		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
-		      psym->st_other);
-
-	      if (psym->st_shndx == 0)
-		fputs (" UND", stdout);
-	      else if ((psym->st_shndx & 0xffff) == 0xfff1)
-		fputs (" ABS", stdout);
-	      else if ((psym->st_shndx & 0xffff) == 0xfff2)
-		fputs (" COM", stdout);
-	      else
-		printf ("%4x", psym->st_shndx);
-
+	      printf ("%6d: ", si);
+	      print_vma (psym->st_value, LONG_HEX);
+	      putchar (' ');
+	      print_vma (psym->st_size, DEC_5);
+	      printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
+	      printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
+	      printf (" %-3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
+	      printf (" %4s", get_symbol_index_type (psym->st_shndx));
 	      printf (" %s", strtab + psym->st_name);
 
 	      if (section->sh_type == SHT_DYNSYM &&
@@ -3368,11 +4437,11 @@
 	  if (! buckets [hn])
 	    continue;
 
-	  for (si = buckets[hn]; si; si = chains[si])
+	  for (si = buckets[hn]; si > 0 && si < nchains; si = chains[si])
 	    {
-	      ++nsyms;
+	      ++ nsyms;
 	      if (maxlength < ++lengths[hn])
-		++maxlength;
+		++ maxlength;
 	    }
 	}
 
@@ -3386,14 +4455,17 @@
       for (hn = 0; hn < nbuckets; ++hn)
 	++ counts [lengths [hn]];
 
-      printf ("      0  %-10d (%5.1f%%)\n",
-	      counts[0], (counts[0] * 100.0) / nbuckets);
-      for (si = 1; si <= maxlength; ++si)
+      if (nbuckets > 0)
 	{
-	  nzero_counts += counts[si] * si;
-	  printf ("%7d  %-10d (%5.1f%%)    %5.1f%%\n",
-		  si, counts[si], (counts[si] * 100.0) / nbuckets,
-		  (nzero_counts * 100.0) / nsyms);
+	  printf ("      0  %-10d (%5.1f%%)\n",
+		  counts[0], (counts[0] * 100.0) / nbuckets);
+	  for (si = 1; si <= maxlength; ++si)
+	    {
+	      nzero_counts += counts[si] * si;
+	      printf ("%7d  %-10d (%5.1f%%)    %5.1f%%\n",
+		      si, counts[si], (counts[si] * 100.0) / nbuckets,
+		      (nzero_counts * 100.0) / nsyms);
+	    }
 	}
 
       free (counts);
@@ -3411,9 +4483,9 @@
 
 static int
 process_syminfo (file)
-     FILE * file;
+     FILE * file ATTRIBUTE_UNUSED;
 {
-  int i;
+  unsigned int i;
 
   if (dynamic_syminfo == NULL
       || !do_dynamic)
@@ -3490,8 +4562,8 @@
      Elf32_Internal_Shdr * section;
      FILE * file;
 {
-  int             bytes;
-  int             addr;
+  bfd_size_type   bytes;
+  bfd_vma         addr;
   unsigned char * data;
   unsigned char * start;
 
@@ -3521,10 +4593,11 @@
 
       lbytes = (bytes > 16 ? 16 : bytes);
 
-      printf ("  0x%8.8x ", addr);
+      printf ("  0x%8.8lx ", (unsigned long) addr);
 
       switch (elf_header.e_ident [EI_DATA])
 	{
+	default:
 	case ELFDATA2LSB:
 	  for (j = 15; j >= 0; j --)
 	    {
@@ -3639,16 +4712,17 @@
 /* Handled an extend line op.  Returns true if this is the end
    of sequence.  */
 static int
-process_extended_line_op (data, is_stmt)
+process_extended_line_op (data, is_stmt, pointer_size)
      unsigned char * data;
      int is_stmt;
+     int pointer_size;
 {
   unsigned char   op_code;
   int             bytes_read;
   unsigned int    len;
   unsigned char * name;
   unsigned long   adr;
-  
+
   len = read_leb128 (data, & bytes_read, 0);
   data += bytes_read;
 
@@ -3662,7 +4736,7 @@
   op_code = * data ++;
 
   printf (_("  Extended opcode %d: "), op_code);
-  
+
   switch (op_code)
     {
     case DW_LNE_end_sequence:
@@ -3671,8 +4745,7 @@
       break;
 
     case DW_LNE_set_address:
-      /* XXX - assumption here that address size is 4! */
-      adr = byte_get (data, 4);
+      adr = byte_get (data, pointer_size);
       printf (_("set Address to 0x%lx\n"), adr);
       state_machine_regs.address = adr;
       break;
@@ -3680,7 +4753,7 @@
     case DW_LNE_define_file:
       printf (_("  define new File Table entry\n"));
       printf (_("  Entry\tDir\tTime\tSize\tName\n"));
-	 
+
       printf (_("   %d\t"), ++ state_machine_regs.last_file_entry);
       name = data;
       data += strlen (data) + 1;
@@ -3700,12 +4773,16 @@
   return len;
 }
 
+/* Size of pointers in the .debug_line section.  This information is not
+   really present in that section.  It's obtained before dumping the debug
+   sections by doing some pre-scan of the .debug_info section.  */
+static int debug_line_pointer_size = 4;
 
 static int
 display_debug_lines (section, start, file)
      Elf32_Internal_Shdr * section;
      unsigned char *       start;
-     FILE *                file;
+     FILE *                file ATTRIBUTE_UNUSED;
 {
   DWARF2_External_LineInfo * external;
   DWARF2_Internal_LineInfo   info;
@@ -3730,7 +4807,7 @@
 	    (_("The line info appears to be corrupt - the section is too small\n"));
 	  return 0;
 	}
-      
+
       /* Check its version number.  */
       info.li_version = BYTE_GET (external->li_version);
       if (info.li_version != 2)
@@ -3738,18 +4815,18 @@
 	  warn (_("Only DWARF version 2 line info is currently supported.\n"));
 	  return 0;
 	}
-      
+
       info.li_prologue_length = BYTE_GET (external->li_prologue_length);
       info.li_min_insn_length = BYTE_GET (external->li_min_insn_length);
       info.li_default_is_stmt = BYTE_GET (external->li_default_is_stmt);
       info.li_line_base       = BYTE_GET (external->li_line_base);
       info.li_line_range      = BYTE_GET (external->li_line_range);
       info.li_opcode_base     = BYTE_GET (external->li_opcode_base);
-      
+
       /* Sign extend the line base field.  */
       info.li_line_base <<= 24;
       info.li_line_base >>= 24;
-      
+
       printf (_("  Length:                      %ld\n"), info.li_length);
       printf (_("  DWARF Version:               %d\n"), info.li_version);
       printf (_("  Prolgue Length:              %d\n"), info.li_prologue_length);
@@ -3762,35 +4839,35 @@
       end_of_sequence = data + info.li_length + sizeof (info.li_length);
 
       reset_state_machine (info.li_default_is_stmt);
-      
+
       /* Display the contents of the Opcodes table.  */
       standard_opcodes = data + sizeof (* external);
-      
+
       printf (_("\n Opcodes:\n"));
-      
+
       for (i = 1; i < info.li_opcode_base; i++)
-	printf (_("  Opcode %d has %d args\n"), i, standard_opcodes[i]);
-      
+	printf (_("  Opcode %d has %d args\n"), i, standard_opcodes[i - 1]);
+
       /* Display the contents of the Directory table.  */
       data = standard_opcodes + info.li_opcode_base - 1;
-      
+
       if (* data == 0)
 	printf (_("\n The Directory Table is empty.\n"));
       else
 	{
 	  printf (_("\n The Directory Table:\n"));
-	  
+
 	  while (* data != 0)
 	    {
 	      printf (_("  %s\n"), data);
-	      
+
 	      data += strlen (data) + 1;
 	    }
 	}
-      
+
       /* Skip the NUL at the end of the table.  */
       data ++;
-      
+
       /* Display the contents of the File Name table.  */
       if (* data == 0)
 	printf (_("\n The File Name Table is empty.\n"));
@@ -3798,17 +4875,17 @@
 	{
 	  printf (_("\n The File Name Table:\n"));
 	  printf (_("  Entry\tDir\tTime\tSize\tName\n"));
-	  
+
 	  while (* data != 0)
 	    {
 	      char * name;
 	      int bytes_read;
-	      
+
 	      printf (_("  %d\t"), ++ state_machine_regs.last_file_entry);
 	      name = data;
-	      
+
 	      data += strlen (data) + 1;
-	      
+
 	      printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0));
 	      data += bytes_read;
 	      printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0));
@@ -3818,32 +4895,33 @@
 	      printf (_("%s\n"), name);
 	    }
 	}
-      
+
       /* Skip the NUL at the end of the table.  */
       data ++;
-      
+
       /* Now display the statements.  */
       printf (_("\n Line Number Statements:\n"));
-      
-      
+
+
       while (data < end_of_sequence)
 	{
 	  unsigned char op_code;
 	  int           adv;
 	  int           bytes_read;
-	  
+
 	  op_code = * data ++;
-	  
+
 	  switch (op_code)
 	    {
 	    case DW_LNS_extended_op:
-	      data += process_extended_line_op (data, info.li_default_is_stmt);
+	      data += process_extended_line_op (data, info.li_default_is_stmt,
+                                                debug_line_pointer_size);
 	      break;
-	      
+
 	    case DW_LNS_copy:
 	      printf (_("  Copy\n"));
 	      break;
-	      
+
 	    case DW_LNS_advance_pc:
 	      adv = info.li_min_insn_length * read_leb128 (data, & bytes_read, 0);
 	      data += bytes_read;
@@ -3851,7 +4929,7 @@
 	      printf (_("  Advance PC by %d to %lx\n"), adv,
 		      state_machine_regs.address);
 	      break;
-	      
+
 	    case DW_LNS_advance_line:
 	      adv = read_leb128 (data, & bytes_read, 1);
 	      data += bytes_read;
@@ -3859,7 +4937,7 @@
 	      printf (_("  Advance Line by %d to %d\n"), adv,
 		      state_machine_regs.line);
 	      break;
-	      
+
 	    case DW_LNS_set_file:
 	      adv = read_leb128 (data, & bytes_read, 0);
 	      data += bytes_read;
@@ -3867,33 +4945,34 @@
 		      adv);
 	      state_machine_regs.file = adv;
 	      break;
-	      
+
 	    case DW_LNS_set_column:
 	      adv = read_leb128 (data, & bytes_read, 0);
 	      data += bytes_read;
 	      printf (_("  Set column to %d\n"), adv);
 	      state_machine_regs.column = adv;
 	      break;
-	      
+
 	    case DW_LNS_negate_stmt:
 	      adv = state_machine_regs.is_stmt;
 	      adv = ! adv;
 	      printf (_("  Set is_stmt to %d\n"), adv);
 	      state_machine_regs.is_stmt = adv;
 	      break;
-	      
+
 	    case DW_LNS_set_basic_block:
 	      printf (_("  Set basic block\n"));
 	      state_machine_regs.basic_block = 1;
 	      break;
-	      
+
 	    case DW_LNS_const_add_pc:
-	      adv = (255 - info.li_opcode_base) / info.li_line_range;
+	      adv = (((255 - info.li_opcode_base) / info.li_line_range)
+		     * info.li_min_insn_length);
 	      state_machine_regs.address += adv;
 	      printf (_("  Advance PC by constant %d to 0x%lx\n"), adv,
 		      state_machine_regs.address);
 	      break;
-	      
+
 	    case DW_LNS_fixed_advance_pc:
 	      adv = byte_get (data, 2);
 	      data += 2;
@@ -3901,14 +4980,14 @@
 	      printf (_("  Advance PC by fixed size amount %d to 0x%lx\n"),
 		      adv, state_machine_regs.address);
 	      break;
-	      
+
 	    default:
 	      op_code -= info.li_opcode_base;
 	      adv      = (op_code / info.li_line_range) * info.li_min_insn_length;
 	      state_machine_regs.address += adv;
 	      printf (_("  Special opcode %d: advance Address by %d to 0x%lx"),
 		      op_code, adv, state_machine_regs.address);
-	      adv    += (op_code % info.li_line_range) + info.li_line_base;
+	      adv = (op_code % info.li_line_range) + info.li_line_base;
 	      state_machine_regs.line += adv;
 	      printf (_(" and Line by %d to %d\n"),
 		      adv, state_machine_regs.line);
@@ -3917,7 +4996,7 @@
 	}
       printf ("\n");
     }
-  
+
   return 1;
 }
 
@@ -3925,7 +5004,7 @@
 display_debug_pubnames (section, start, file)
      Elf32_Internal_Shdr * section;
      unsigned char *       start;
-     FILE *                file;
+     FILE *                file ATTRIBUTE_UNUSED;
 {
   DWARF2_External_PubNames * external;
   DWARF2_Internal_PubNames   pubnames;
@@ -4313,8 +5392,11 @@
       entry = read_leb128 (start, & bytes_read, 0);
       start += bytes_read;
 
+      /* A single zero is supposed to end the section according
+	 to the standard.  If there's more, then signal that to
+	 the caller.  */
       if (entry == 0)
-	return start;
+	return start == end ? NULL : start;
 
       tag = read_leb128 (start, & bytes_read, 0);
       start += bytes_read;
@@ -4347,7 +5429,7 @@
 display_debug_abbrev (section, start, file)
      Elf32_Internal_Shdr * section;
      unsigned char *       start;
-     FILE *                file;
+     FILE *                file ATTRIBUTE_UNUSED;
 {
   abbrev_entry * entry;
   unsigned char * end = start + section->sh_size;
@@ -4393,7 +5475,7 @@
   printf (_(" %lu byte block: "), length);
 
   while (length --)
-    printf ("%lx ", byte_get (data ++, 1));
+    printf ("%lx ", (unsigned long) byte_get (data ++, 1));
 
   return data;
 }
@@ -4405,156 +5487,451 @@
 {
   unsigned char op;
   int           bytes_read;
+  unsigned long uvalue;
 
   op = * data ++;
 
   switch (op)
     {
-    case DW_OP_addr:	printf ("DW_OP_addr: %lx", byte_get (data, pointer_size)); break;
-    case DW_OP_deref:	printf ("DW_OP_deref"); break;
-    case DW_OP_const1u:	printf ("DW_OP_const1u: %lu", byte_get (data, 1)); break;
-    case DW_OP_const1s:	printf ("DW_OP_const1s: %ld", (long) byte_get (data, 1)); break;
-    case DW_OP_const2u:	printf ("DW_OP_const2u: %lu", byte_get (data, 2)); break;
-    case DW_OP_const2s:	printf ("DW_OP_const2s: %ld", (long) byte_get (data, 2)); break;
-    case DW_OP_const4u:	printf ("DW_OP_const4u: %lu", byte_get (data, 4)); break;
-    case DW_OP_const4s:	printf ("DW_OP_const4s: %ld", (long) byte_get (data, 4)); break;
-    case DW_OP_const8u:	printf ("DW_OP_const8u: %lu %lu", byte_get (data, 4), byte_get (data + 4, 4)); break;
-    case DW_OP_const8s:	printf ("DW_OP_const8s: %ld %ld", byte_get (data, 4), byte_get (data + 4, 4)); break;
-    case DW_OP_constu:	printf ("DW_OP_constu: %lu", read_leb128 (data, NULL, 0)); break;
-    case DW_OP_consts:	printf ("DW_OP_consts: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_dup:	printf ("DW_OP_dup"); break;
-    case DW_OP_drop:	printf ("DW_OP_drop"); break;
-    case DW_OP_over:	printf ("DW_OP_over"); break;
-    case DW_OP_pick:	printf ("DW_OP_pick: %ld", byte_get (data, 1)); break;
-    case DW_OP_swap:	printf ("DW_OP_swap"); break;
-    case DW_OP_rot:	printf ("DW_OP_rot"); break;
-    case DW_OP_xderef:	printf ("DW_OP_xderef"); break;
-    case DW_OP_abs:	printf ("DW_OP_abs"); break;
-    case DW_OP_and:	printf ("DW_OP_and"); break;
-    case DW_OP_div:	printf ("DW_OP_div"); break;
-    case DW_OP_minus:	printf ("DW_OP_minus"); break;
-    case DW_OP_mod:	printf ("DW_OP_mod"); break;
-    case DW_OP_mul:	printf ("DW_OP_mul"); break;
-    case DW_OP_neg:	printf ("DW_OP_neg"); break;
-    case DW_OP_not:	printf ("DW_OP_not"); break;
-    case DW_OP_or:	printf ("DW_OP_or"); break;
-    case DW_OP_plus:	printf ("DW_OP_plus"); break;
-    case DW_OP_plus_uconst:	printf ("DW_OP_plus_uconst: %lu", read_leb128 (data, NULL, 0)); break;
-    case DW_OP_shl:	printf ("DW_OP_shl"); break;
-    case DW_OP_shr:	printf ("DW_OP_shr"); break;
-    case DW_OP_shra:	printf ("DW_OP_shra"); break;
-    case DW_OP_xor:	printf ("DW_OP_xor"); break;
-    case DW_OP_bra:	printf ("DW_OP_bra: %ld", byte_get (data, 2)); break;
-    case DW_OP_eq:	printf ("DW_OP_eq"); break;
-    case DW_OP_ge:	printf ("DW_OP_ge"); break;
-    case DW_OP_gt:	printf ("DW_OP_gt"); break;
-    case DW_OP_le:	printf ("DW_OP_le"); break;
-    case DW_OP_lt:	printf ("DW_OP_lt"); break;
-    case DW_OP_ne:	printf ("DW_OP_ne"); break;
-    case DW_OP_skip:	printf ("DW_OP_skip: %ld", byte_get (data, 2)); break;
-    case DW_OP_lit0:	printf ("DW_OP_lit0"); break;
-    case DW_OP_lit1:	printf ("DW_OP_lit1"); break;
-    case DW_OP_lit2:	printf ("DW_OP_lit2"); break;
-    case DW_OP_lit3:	printf ("DW_OP_lit3"); break;
-    case DW_OP_lit4:	printf ("DW_OP_lit4"); break;
-    case DW_OP_lit5:	printf ("DW_OP_lit5"); break;
-    case DW_OP_lit6:	printf ("DW_OP_lit6"); break;
-    case DW_OP_lit7:	printf ("DW_OP_lit7"); break;
-    case DW_OP_lit8:	printf ("DW_OP_lit8"); break;
-    case DW_OP_lit9:	printf ("DW_OP_lit9"); break;
-    case DW_OP_lit10:	printf ("DW_OP_lit10"); break;
-    case DW_OP_lit11:	printf ("DW_OP_lit11"); break;
-    case DW_OP_lit12:	printf ("DW_OP_lit12"); break;
-    case DW_OP_lit13:	printf ("DW_OP_lit13"); break;
-    case DW_OP_lit14:	printf ("DW_OP_lit14"); break;
-    case DW_OP_lit15:	printf ("DW_OP_lit15"); break;
-    case DW_OP_lit16:	printf ("DW_OP_lit16"); break;
-    case DW_OP_lit17:	printf ("DW_OP_lit17"); break;
-    case DW_OP_lit18:	printf ("DW_OP_lit18"); break;
-    case DW_OP_lit19:	printf ("DW_OP_lit19"); break;
-    case DW_OP_lit20:	printf ("DW_OP_lit20"); break;
-    case DW_OP_lit21:	printf ("DW_OP_lit21"); break;
-    case DW_OP_lit22:	printf ("DW_OP_lit22"); break;
-    case DW_OP_lit23:	printf ("DW_OP_lit23"); break;
-    case DW_OP_lit24:	printf ("DW_OP_lit24"); break;
-    case DW_OP_lit25:	printf ("DW_OP_lit25"); break;
-    case DW_OP_lit26:	printf ("DW_OP_lit26"); break;
-    case DW_OP_lit27:	printf ("DW_OP_lit27"); break;
-    case DW_OP_lit28:	printf ("DW_OP_lit28"); break;
-    case DW_OP_lit29:	printf ("DW_OP_lit29"); break;
-    case DW_OP_lit30:	printf ("DW_OP_lit30"); break;
-    case DW_OP_lit31:	printf ("DW_OP_lit31"); break;
-    case DW_OP_reg0:	printf ("DW_OP_reg0"); break;
-    case DW_OP_reg1:	printf ("DW_OP_reg1"); break;
-    case DW_OP_reg2:	printf ("DW_OP_reg2"); break;
-    case DW_OP_reg3:	printf ("DW_OP_reg3"); break;
-    case DW_OP_reg4:	printf ("DW_OP_reg4"); break;
-    case DW_OP_reg5:	printf ("DW_OP_reg5"); break;
-    case DW_OP_reg6:	printf ("DW_OP_reg6"); break;
-    case DW_OP_reg7:	printf ("DW_OP_reg7"); break;
-    case DW_OP_reg8:	printf ("DW_OP_reg8"); break;
-    case DW_OP_reg9:	printf ("DW_OP_reg9"); break;
-    case DW_OP_reg10:	printf ("DW_OP_reg10"); break;
-    case DW_OP_reg11:	printf ("DW_OP_reg11"); break;
-    case DW_OP_reg12:	printf ("DW_OP_reg12"); break;
-    case DW_OP_reg13:	printf ("DW_OP_reg13"); break;
-    case DW_OP_reg14:	printf ("DW_OP_reg14"); break;
-    case DW_OP_reg15:	printf ("DW_OP_reg15"); break;
-    case DW_OP_reg16:	printf ("DW_OP_reg16"); break;
-    case DW_OP_reg17:	printf ("DW_OP_reg17"); break;
-    case DW_OP_reg18:	printf ("DW_OP_reg18"); break;
-    case DW_OP_reg19:	printf ("DW_OP_reg19"); break;
-    case DW_OP_reg20:	printf ("DW_OP_reg20"); break;
-    case DW_OP_reg21:	printf ("DW_OP_reg21"); break;
-    case DW_OP_reg22:	printf ("DW_OP_reg22"); break;
-    case DW_OP_reg23:	printf ("DW_OP_reg23"); break;
-    case DW_OP_reg24:	printf ("DW_OP_reg24"); break;
-    case DW_OP_reg25:	printf ("DW_OP_reg25"); break;
-    case DW_OP_reg26:	printf ("DW_OP_reg26"); break;
-    case DW_OP_reg27:	printf ("DW_OP_reg27"); break;
-    case DW_OP_reg28:	printf ("DW_OP_reg28"); break;
-    case DW_OP_reg29:	printf ("DW_OP_reg29"); break;
-    case DW_OP_reg30:	printf ("DW_OP_reg30"); break;
-    case DW_OP_reg31:	printf ("DW_OP_reg31"); break;
-    case DW_OP_breg0:	printf ("DW_OP_breg0: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg1:	printf ("DW_OP_breg1: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg2:	printf ("DW_OP_breg2: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg3:	printf ("DW_OP_breg3: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg4:	printf ("DW_OP_breg4: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg5:	printf ("DW_OP_breg5: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg6:	printf ("DW_OP_breg6: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg7:	printf ("DW_OP_breg7: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg8:	printf ("DW_OP_breg8: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg9:	printf ("DW_OP_breg9: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg10:	printf ("DW_OP_breg10: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg11:	printf ("DW_OP_breg11: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg12:	printf ("DW_OP_breg12: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg13:	printf ("DW_OP_breg13: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg14:	printf ("DW_OP_breg14: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg15:	printf ("DW_OP_breg15: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg16:	printf ("DW_OP_breg16: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg17:	printf ("DW_OP_breg17: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg18:	printf ("DW_OP_breg18: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg19:	printf ("DW_OP_breg19: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg20:	printf ("DW_OP_breg20: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg21:	printf ("DW_OP_breg21: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg22:	printf ("DW_OP_breg22: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg23:	printf ("DW_OP_breg23: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg24:	printf ("DW_OP_breg24: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg25:	printf ("DW_OP_breg25: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg26:	printf ("DW_OP_breg26: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg27:	printf ("DW_OP_breg27: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg28:	printf ("DW_OP_breg28: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg29:	printf ("DW_OP_breg29: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg30:	printf ("DW_OP_breg30: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_breg31:	printf ("DW_OP_breg31: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_regx:	printf ("DW_OP_regx: %lu", read_leb128 (data, NULL, 0)); break;
-    case DW_OP_fbreg:	printf ("DW_OP_fbreg: %ld", read_leb128 (data, NULL, 1)); break;
-    case DW_OP_bregx:	printf ("DW_OP_bregx: %lu %ld", read_leb128 (data, & bytes_read, 0), read_leb128 (data + bytes_read, NULL, 1)); break;
-    case DW_OP_piece:	printf ("DW_OP_piece: %lu", read_leb128 (data, NULL, 0)); break;
-    case DW_OP_deref_size:	printf ("DW_OP_deref_size: %ld", byte_get (data, 1)); break;
-    case DW_OP_xderef_size:	printf ("DW_OP_xderef_size: %ld", byte_get (data, 1)); break;
-    case DW_OP_nop:	printf ("DW_OP_nop"); break;
+    case DW_OP_addr:
+      printf ("DW_OP_addr: %lx", (unsigned long) byte_get (data, pointer_size));
+      break;
+    case DW_OP_deref:
+      printf ("DW_OP_deref");
+      break;
+    case DW_OP_const1u:
+      printf ("DW_OP_const1u: %lu", (unsigned long) byte_get (data, 1));
+      break;
+    case DW_OP_const1s:
+      printf ("DW_OP_const1s: %ld", (long) byte_get (data, 1));
+      break;
+    case DW_OP_const2u:
+      printf ("DW_OP_const2u: %lu", (unsigned long) byte_get (data, 2));
+      break;
+    case DW_OP_const2s:
+      printf ("DW_OP_const2s: %ld", (long) byte_get (data, 2));
+      break;
+    case DW_OP_const4u:
+      printf ("DW_OP_const4u: %lu", (unsigned long) byte_get (data, 4));
+      break;
+    case DW_OP_const4s:
+      printf ("DW_OP_const4s: %ld", (long) byte_get (data, 4));
+      break;
+    case DW_OP_const8u:
+      printf ("DW_OP_const8u: %lu %lu", (unsigned long) byte_get (data, 4),
+	      (unsigned long) byte_get (data + 4, 4));
+      break;
+    case DW_OP_const8s:
+      printf ("DW_OP_const8s: %ld %ld", (long) byte_get (data, 4),
+	      (long) byte_get (data + 4, 4));
+      break;
+    case DW_OP_constu:
+      printf ("DW_OP_constu: %lu", read_leb128 (data, NULL, 0));
+      break;
+    case DW_OP_consts:
+      printf ("DW_OP_consts: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_dup:
+      printf ("DW_OP_dup");
+      break;
+    case DW_OP_drop:
+      printf ("DW_OP_drop");
+      break;
+    case DW_OP_over:
+      printf ("DW_OP_over");
+      break;
+    case DW_OP_pick:
+      printf ("DW_OP_pick: %ld", (unsigned long) byte_get (data, 1));
+      break;
+    case DW_OP_swap:
+      printf ("DW_OP_swap");
+      break;
+    case DW_OP_rot:
+      printf ("DW_OP_rot");
+      break;
+    case DW_OP_xderef:
+      printf ("DW_OP_xderef");
+      break;
+    case DW_OP_abs:
+      printf ("DW_OP_abs");
+      break;
+    case DW_OP_and:
+      printf ("DW_OP_and");
+      break;
+    case DW_OP_div:
+      printf ("DW_OP_div");
+      break;
+    case DW_OP_minus:
+      printf ("DW_OP_minus");
+      break;
+    case DW_OP_mod:
+      printf ("DW_OP_mod");
+      break;
+    case DW_OP_mul:
+      printf ("DW_OP_mul");
+      break;
+    case DW_OP_neg:
+      printf ("DW_OP_neg");
+      break;
+    case DW_OP_not:
+      printf ("DW_OP_not");
+      break;
+    case DW_OP_or:
+      printf ("DW_OP_or");
+      break;
+    case DW_OP_plus:
+      printf ("DW_OP_plus");
+      break;
+    case DW_OP_plus_uconst:
+      printf ("DW_OP_plus_uconst: %lu", read_leb128 (data, NULL, 0));
+      break;
+    case DW_OP_shl:
+      printf ("DW_OP_shl");
+      break;
+    case DW_OP_shr:
+      printf ("DW_OP_shr");
+      break;
+    case DW_OP_shra:
+      printf ("DW_OP_shra");
+      break;
+    case DW_OP_xor:
+      printf ("DW_OP_xor");
+      break;
+    case DW_OP_bra:
+      printf ("DW_OP_bra: %ld", (long) byte_get (data, 2));
+      break;
+    case DW_OP_eq:
+      printf ("DW_OP_eq");
+      break;
+    case DW_OP_ge:
+      printf ("DW_OP_ge");
+      break;
+    case DW_OP_gt:
+      printf ("DW_OP_gt");
+      break;
+    case DW_OP_le:
+      printf ("DW_OP_le");
+      break;
+    case DW_OP_lt:
+      printf ("DW_OP_lt");
+      break;
+    case DW_OP_ne:
+      printf ("DW_OP_ne");
+      break;
+    case DW_OP_skip:
+      printf ("DW_OP_skip: %ld", (long) byte_get (data, 2));
+      break;
+    case DW_OP_lit0:
+      printf ("DW_OP_lit0");
+      break;
+    case DW_OP_lit1:
+      printf ("DW_OP_lit1");
+      break;
+    case DW_OP_lit2:
+      printf ("DW_OP_lit2");
+      break;
+    case DW_OP_lit3:
+      printf ("DW_OP_lit3");
+      break;
+    case DW_OP_lit4:
+      printf ("DW_OP_lit4");
+      break;
+    case DW_OP_lit5:
+      printf ("DW_OP_lit5");
+      break;
+    case DW_OP_lit6:
+      printf ("DW_OP_lit6");
+      break;
+    case DW_OP_lit7:
+      printf ("DW_OP_lit7");
+      break;
+    case DW_OP_lit8:
+      printf ("DW_OP_lit8");
+      break;
+    case DW_OP_lit9:
+      printf ("DW_OP_lit9");
+      break;
+    case DW_OP_lit10:
+      printf ("DW_OP_lit10");
+      break;
+    case DW_OP_lit11:
+      printf ("DW_OP_lit11");
+      break;
+    case DW_OP_lit12:
+      printf ("DW_OP_lit12");
+      break;
+    case DW_OP_lit13:
+      printf ("DW_OP_lit13");
+      break;
+    case DW_OP_lit14:
+      printf ("DW_OP_lit14");
+      break;
+    case DW_OP_lit15:
+      printf ("DW_OP_lit15");
+      break;
+    case DW_OP_lit16:
+      printf ("DW_OP_lit16");
+      break;
+    case DW_OP_lit17:
+      printf ("DW_OP_lit17");
+      break;
+    case DW_OP_lit18:
+      printf ("DW_OP_lit18");
+      break;
+    case DW_OP_lit19:
+      printf ("DW_OP_lit19");
+      break;
+    case DW_OP_lit20:
+      printf ("DW_OP_lit20");
+      break;
+    case DW_OP_lit21:
+      printf ("DW_OP_lit21");
+      break;
+    case DW_OP_lit22:
+      printf ("DW_OP_lit22");
+      break;
+    case DW_OP_lit23:
+      printf ("DW_OP_lit23");
+      break;
+    case DW_OP_lit24:
+      printf ("DW_OP_lit24");
+      break;
+    case DW_OP_lit25:
+      printf ("DW_OP_lit25");
+      break;
+    case DW_OP_lit26:
+      printf ("DW_OP_lit26");
+      break;
+    case DW_OP_lit27:
+      printf ("DW_OP_lit27");
+      break;
+    case DW_OP_lit28:
+      printf ("DW_OP_lit28");
+      break;
+    case DW_OP_lit29:
+      printf ("DW_OP_lit29");
+      break;
+    case DW_OP_lit30:
+      printf ("DW_OP_lit30");
+      break;
+    case DW_OP_lit31:
+      printf ("DW_OP_lit31");
+      break;
+    case DW_OP_reg0:
+      printf ("DW_OP_reg0");
+      break;
+    case DW_OP_reg1:
+      printf ("DW_OP_reg1");
+      break;
+    case DW_OP_reg2:
+      printf ("DW_OP_reg2");
+      break;
+    case DW_OP_reg3:
+      printf ("DW_OP_reg3");
+      break;
+    case DW_OP_reg4:
+      printf ("DW_OP_reg4");
+      break;
+    case DW_OP_reg5:
+      printf ("DW_OP_reg5");
+      break;
+    case DW_OP_reg6:
+      printf ("DW_OP_reg6");
+      break;
+    case DW_OP_reg7:
+      printf ("DW_OP_reg7");
+      break;
+    case DW_OP_reg8:
+      printf ("DW_OP_reg8");
+      break;
+    case DW_OP_reg9:
+      printf ("DW_OP_reg9");
+      break;
+    case DW_OP_reg10:
+      printf ("DW_OP_reg10");
+      break;
+    case DW_OP_reg11:
+      printf ("DW_OP_reg11");
+      break;
+    case DW_OP_reg12:
+      printf ("DW_OP_reg12");
+      break;
+    case DW_OP_reg13:
+      printf ("DW_OP_reg13");
+      break;
+    case DW_OP_reg14:
+      printf ("DW_OP_reg14");
+      break;
+    case DW_OP_reg15:
+      printf ("DW_OP_reg15");
+      break;
+    case DW_OP_reg16:
+      printf ("DW_OP_reg16");
+      break;
+    case DW_OP_reg17:
+      printf ("DW_OP_reg17");
+      break;
+    case DW_OP_reg18:
+      printf ("DW_OP_reg18");
+      break;
+    case DW_OP_reg19:
+      printf ("DW_OP_reg19");
+      break;
+    case DW_OP_reg20:
+      printf ("DW_OP_reg20");
+      break;
+    case DW_OP_reg21:
+      printf ("DW_OP_reg21");
+      break;
+    case DW_OP_reg22:
+      printf ("DW_OP_reg22");
+      break;
+    case DW_OP_reg23:
+      printf ("DW_OP_reg23");
+      break;
+    case DW_OP_reg24:
+      printf ("DW_OP_reg24");
+      break;
+    case DW_OP_reg25:
+      printf ("DW_OP_reg25");
+      break;
+    case DW_OP_reg26:
+      printf ("DW_OP_reg26");
+      break;
+    case DW_OP_reg27:
+      printf ("DW_OP_reg27");
+      break;
+    case DW_OP_reg28:
+      printf ("DW_OP_reg28");
+      break;
+    case DW_OP_reg29:
+      printf ("DW_OP_reg29");
+      break;
+    case DW_OP_reg30:
+      printf ("DW_OP_reg30");
+      break;
+    case DW_OP_reg31:
+      printf ("DW_OP_reg31");
+      break;
+    case DW_OP_breg0:
+      printf ("DW_OP_breg0: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg1:
+      printf ("DW_OP_breg1: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg2:
+      printf ("DW_OP_breg2: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg3:
+      printf ("DW_OP_breg3: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg4:
+      printf ("DW_OP_breg4: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg5:
+      printf ("DW_OP_breg5: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg6:
+      printf ("DW_OP_breg6: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg7:
+      printf ("DW_OP_breg7: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg8:
+      printf ("DW_OP_breg8: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg9:
+      printf ("DW_OP_breg9: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg10:
+      printf ("DW_OP_breg10: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg11:
+      printf ("DW_OP_breg11: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg12:
+      printf ("DW_OP_breg12: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg13:
+      printf ("DW_OP_breg13: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg14:
+      printf ("DW_OP_breg14: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg15:
+      printf ("DW_OP_breg15: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg16:
+      printf ("DW_OP_breg16: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg17:
+      printf ("DW_OP_breg17: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg18:
+      printf ("DW_OP_breg18: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg19:
+      printf ("DW_OP_breg19: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg20:
+      printf ("DW_OP_breg20: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg21:
+      printf ("DW_OP_breg21: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg22:
+      printf ("DW_OP_breg22: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg23:
+      printf ("DW_OP_breg23: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg24:
+      printf ("DW_OP_breg24: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg25:
+      printf ("DW_OP_breg25: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg26:
+      printf ("DW_OP_breg26: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg27:
+      printf ("DW_OP_breg27: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg28:
+      printf ("DW_OP_breg28: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg29:
+      printf ("DW_OP_breg29: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg30:
+      printf ("DW_OP_breg30: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_breg31:
+      printf ("DW_OP_breg31: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_regx:
+      printf ("DW_OP_regx: %lu", read_leb128 (data, NULL, 0));
+      break;
+    case DW_OP_fbreg:
+      printf ("DW_OP_fbreg: %ld", read_leb128 (data, NULL, 1));
+      break;
+    case DW_OP_bregx:
+      uvalue = read_leb128 (data, &bytes_read, 0);
+      printf ("DW_OP_bregx: %lu %ld", uvalue,
+	      read_leb128 (data + bytes_read, NULL, 1));
+      break;
+    case DW_OP_piece:
+      printf ("DW_OP_piece: %lu", read_leb128 (data, NULL, 0));
+      break;
+    case DW_OP_deref_size:
+      printf ("DW_OP_deref_size: %ld", (long) byte_get (data, 1));
+      break;
+    case DW_OP_xderef_size:
+      printf ("DW_OP_xderef_size: %ld", (long) byte_get (data, 1));
+      break;
+    case DW_OP_nop:
+      printf ("DW_OP_nop");
+      break;
 
     default:
       if (op >= DW_OP_lo_user
@@ -4574,8 +5951,8 @@
      unsigned char * data;
      unsigned long   pointer_size;
 {
-  unsigned long   uvalue;
-  unsigned char * block_start;
+  unsigned long   uvalue = 0;
+  unsigned char * block_start = NULL;
   int             bytes_read;
   int		  is_ref = 0;
 
@@ -4597,7 +5974,7 @@
     case DW_FORM_ref_addr:
     case DW_FORM_addr:
       uvalue = byte_get (data, pointer_size);
-      printf (is_ref ? " <%x>" : " %#x", uvalue);
+      printf (is_ref ? " <%lx>" : " %#lx", uvalue);
       data += pointer_size;
       break;
 
@@ -4605,28 +5982,28 @@
     case DW_FORM_flag:
     case DW_FORM_data1:
       uvalue = byte_get (data ++, 1);
-      printf (is_ref ? " <%x>" : " %d", uvalue);
+      printf (is_ref ? " <%lx>" : " %ld", uvalue);
       break;
 
     case DW_FORM_ref2:
     case DW_FORM_data2:
       uvalue = byte_get (data, 2);
       data += 2;
-      printf (is_ref ? " <%x>" : " %d", uvalue);
+      printf (is_ref ? " <%lx>" : " %ld", uvalue);
       break;
 
     case DW_FORM_ref4:
     case DW_FORM_data4:
       uvalue = byte_get (data, 4);
       data += 4;
-      printf (is_ref ? " <%x>" : " %d", uvalue);
+      printf (is_ref ? " <%lx>" : " %ld", uvalue);
       break;
 
     case DW_FORM_ref8:
     case DW_FORM_data8:
       uvalue = byte_get (data, 4);
       printf (" %lx", uvalue);
-      printf (" %lx", byte_get (data + 4, 4));
+      printf (" %lx", (unsigned long) byte_get (data + 4, 4));
       data += 8;
       break;
 
@@ -4896,7 +6273,7 @@
       while (tags < start)
 	{
 	  int            bytes_read;
-	  int            abbrev_number;
+	  unsigned long  abbrev_number;
 	  abbrev_entry * entry;
 	  abbrev_attr  * attr;
 
@@ -4919,12 +6296,12 @@
 
 	  if (entry == NULL)
 	    {
-	      warn (_("Unable to locate entry %d in the abbreviation table\n"),
+	      warn (_("Unable to locate entry %lu in the abbreviation table\n"),
 		    abbrev_number);
 	      return 0;
 	    }
 
-	  printf (_(" <%d><%x>: Abbrev Number: %d (%s)\n"),
+	  printf (_(" <%d><%x>: Abbrev Number: %lu (%s)\n"),
 		  level, tags - section_begin - bytes_read,
 		  abbrev_number,
 		  get_TAG_name (entry->tag));
@@ -4949,7 +6326,7 @@
 display_debug_aranges (section, start, file)
      Elf32_Internal_Shdr * section;
      unsigned char *       start;
-     FILE *                file;
+     FILE *                file ATTRIBUTE_UNUSED;
 {
   unsigned char * end = start + section->sh_size;
 
@@ -4962,6 +6339,7 @@
       unsigned char *          ranges;
       unsigned long            length;
       unsigned long            address;
+      int		       excess;
 
       external = (DWARF2_External_ARange *) start;
 
@@ -4981,19 +6359,25 @@
 
       ranges = start + sizeof (* external);
 
+      /* Must pad to an alignment boundary that is twice the pointer size.  */
+      excess = sizeof (*external) % (2 * arange.ar_pointer_size);
+      if (excess)
+	ranges += (2 * arange.ar_pointer_size) - excess;
+
       for (;;)
 	{
 	  address = byte_get (ranges, arange.ar_pointer_size);
 
-	  if (address == 0)
-	    break;
-
 	  ranges += arange.ar_pointer_size;
 
 	  length  = byte_get (ranges, arange.ar_pointer_size);
 
 	  ranges += arange.ar_pointer_size;
 
+	  /* A pair of zeros marks the end of the list.  */
+	  if (address == 0 && length == 0)
+	    break;
+
 	  printf ("    %8.8lx %lu\n", address, length);
 	}
 
@@ -5009,8 +6393,8 @@
 static int
 display_debug_not_supported (section, start, file)
      Elf32_Internal_Shdr * section;
-     unsigned char *       start;
-     FILE *                file;
+     unsigned char *       start ATTRIBUTE_UNUSED;
+     FILE *                file ATTRIBUTE_UNUSED;
 {
   printf (_("Displaying the debug contents of section %s is not yet supported.\n"),
 	    SECTION_NAME (section));
@@ -5018,27 +6402,47 @@
   return 1;
 }
 
+/* Pre-scan the .debug_info section to record the size of address.
+   When dumping the .debug_line, we use that size information, assuming
+   that all compilation units have the same address size.  */
+static int
+prescan_debug_info (section, start, file)
+     Elf32_Internal_Shdr * section ATTRIBUTE_UNUSED;
+     unsigned char *       start;
+     FILE *                file ATTRIBUTE_UNUSED;
+{
+  DWARF2_External_CompUnit * external;
+
+  external = (DWARF2_External_CompUnit *) start;
+
+  debug_line_pointer_size = BYTE_GET (external->cu_pointer_size);
+  return 0;
+}
+
   /* A structure containing the name of a debug section and a pointer
-     to a function that can decode it.  */
+     to a function that can decode it.  The third field is a prescan
+     function to be run over the section before displaying any of the
+     sections.  */
 struct
 {
   char * name;
-  int (* display) PARAMS((Elf32_Internal_Shdr *, unsigned char *, FILE *));
+  int (* display) PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
+  int (* prescan) PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 }
 debug_displays[] =
 {
-  { ".debug_info",        display_debug_info },
-  { ".debug_abbrev",      display_debug_abbrev },
-  { ".debug_line",        display_debug_lines },
-  { ".debug_aranges",     display_debug_aranges },
-  { ".debug_pubnames",    display_debug_pubnames },
-  { ".debug_macinfo",     display_debug_not_supported },
-  { ".debug_frame",       display_debug_not_supported },
-  { ".debug_str",         display_debug_not_supported },
-  { ".debug_static_func", display_debug_not_supported },
-  { ".debug_static_vars", display_debug_not_supported },
-  { ".debug_types",       display_debug_not_supported },
-  { ".debug_weaknames",   display_debug_not_supported }
+  { ".debug_info",        display_debug_info, prescan_debug_info },
+  { ".debug_abbrev",      display_debug_abbrev, NULL },
+  { ".debug_line",        display_debug_lines, NULL },
+  { ".debug_aranges",     display_debug_aranges, NULL },
+  { ".debug_pubnames",    display_debug_pubnames, NULL },
+  { ".debug_macinfo",     display_debug_not_supported, NULL },
+  { ".debug_frame",       display_debug_not_supported, NULL },
+  { ".debug_str",         display_debug_not_supported, NULL },
+  { ".debug_static_func", display_debug_not_supported, NULL },
+  { ".debug_static_vars", display_debug_not_supported, NULL },
+  { ".debug_types",       display_debug_not_supported, NULL },
+  { ".debug_weaknames",   display_debug_not_supported, NULL }
 };
 
 static int
@@ -5086,15 +6490,48 @@
 process_section_contents (file)
      FILE * file;
 {
-  Elf32_Internal_Shdr *    section;
-  unsigned int  i;
+  Elf32_Internal_Shdr * section;
+  unsigned int  	i;
 
   if (! do_dump)
     return 1;
 
+  /* Pre-scan the debug sections to find some debug information not
+     present in some of them.  For the .debug_line, we must find out the
+     size of address (specified in .debug_info and .debug_aranges).  */
   for (i = 0, section = section_headers;
-       i < elf_header.e_shnum
-       && i < num_dump_sects;
+       i < elf_header.e_shnum && i < num_dump_sects;
+       i ++, section ++)
+    {
+      char *	name = SECTION_NAME (section);
+      int       j;
+
+      if (section->sh_size == 0)
+        continue;
+
+      /* See if there is some pre-scan operation for this section.  */
+      for (j = NUM_ELEM (debug_displays); j--;)
+        if (strcmp (debug_displays[j].name, name) == 0)
+	  {
+	    if (debug_displays[j].prescan != NULL)
+	      {
+		bfd_size_type   length;
+		unsigned char * start;
+
+		length = section->sh_size;
+		GET_DATA_ALLOC (section->sh_offset, length, start, unsigned char *,
+				"debug section data");
+
+		debug_displays[j].prescan (section, start, file);
+		free (start);
+	      }
+
+            break;
+          }
+    }
+
+  for (i = 0, section = section_headers;
+       i < elf_header.e_shnum && i < num_dump_sects;
        i ++, section ++)
     {
 #ifdef SUPPORT_DISASSEMBLY
@@ -5138,9 +6575,9 @@
 
 static int
 process_mips_specific (file)
-     FILE *file;
+     FILE * file;
 {
-  Elf_Internal_Dyn *entry;
+  Elf_Internal_Dyn * entry;
   size_t liblist_offset = 0;
   size_t liblistno = 0;
   size_t conflictsno = 0;
@@ -5176,13 +6613,14 @@
 
   if (liblist_offset != 0 && liblistno != 0 && do_dynamic)
     {
-      Elf32_External_Lib *elib;
+      Elf32_External_Lib * elib;
       size_t cnt;
 
       GET_DATA_ALLOC (liblist_offset, liblistno * sizeof (Elf32_External_Lib),
 		      elib, Elf32_External_Lib *, "liblist");
 
-      printf ("\nSection '.liblist' contains %d entries:\n", liblistno);
+      printf ("\nSection '.liblist' contains %lu entries:\n",
+	      (unsigned long) liblistno);
       fputs ("     Library              Time Stamp          Checksum   Version Flags\n",
 	     stdout);
 
@@ -5200,7 +6638,7 @@
 
 	  strftime (timebuf, 20, "%Y-%m-%dT%H:%M:%S", gmtime (&time));
 
-	  printf ("%3d: %-20s %s %#10lx %-7ld", cnt,
+	  printf ("%3lu: %-20s %s %#10lx %-7ld", (unsigned long) cnt,
 		  dynamic_strings + liblist.l_name, timebuf,
 		  liblist.l_checksum, liblist.l_version);
 
@@ -5210,19 +6648,20 @@
 	    {
 	      static const struct
 	      {
-		const char *name;
+		const char * name;
 		int bit;
-	      } l_flags_vals[] =
-		{
-		  { " EXACT_MATCH", LL_EXACT_MATCH },
-		  { " IGNORE_INT_VER", LL_IGNORE_INT_VER },
-		  { " REQUIRE_MINOR", LL_REQUIRE_MINOR },
-		  { " EXPORTS", LL_EXPORTS },
-		  { " DELAY_LOAD", LL_DELAY_LOAD },
-		  { " DELTA", LL_DELTA }
-		};
+	      }
+	      l_flags_vals[] =
+	      {
+		{ " EXACT_MATCH", LL_EXACT_MATCH },
+		{ " IGNORE_INT_VER", LL_IGNORE_INT_VER },
+		{ " REQUIRE_MINOR", LL_REQUIRE_MINOR },
+		{ " EXPORTS", LL_EXPORTS },
+		{ " DELAY_LOAD", LL_DELAY_LOAD },
+		{ " DELTA", LL_DELTA }
+	      };
 	      int flags = liblist.l_flags;
-	      int fcnt;
+	      size_t fcnt;
 
 	      for (fcnt = 0;
 		   fcnt < sizeof (l_flags_vals) / sizeof (l_flags_vals[0]);
@@ -5244,16 +6683,16 @@
 
   if (options_offset != 0)
     {
-      Elf_External_Options *eopt;
-      Elf_Internal_Shdr *sect = section_headers;
-      Elf_Internal_Options *iopt;
-      Elf_Internal_Options *option;
+      Elf_External_Options * eopt;
+      Elf_Internal_Shdr *    sect = section_headers;
+      Elf_Internal_Options * iopt;
+      Elf_Internal_Options * option;
       size_t offset;
       int cnt;
 
       /* Find the section header so that we get the size.  */
       while (sect->sh_type != SHT_MIPS_OPTIONS)
-	++sect;
+	++ sect;
 
       GET_DATA_ALLOC (options_offset, sect->sh_size, eopt,
 		      Elf_External_Options *, "options");
@@ -5268,9 +6707,10 @@
 
       offset = cnt = 0;
       option = iopt;
+      
       while (offset < sect->sh_size)
 	{
-	  Elf_External_Options *eoption;
+	  Elf_External_Options * eoption;
 
 	  eoption = (Elf_External_Options *) ((char *) eopt + offset);
 
@@ -5280,6 +6720,7 @@
 	  option->info = BYTE_GET (eoption->info);
 
 	  offset += option->size;
+	  
 	  ++option;
 	  ++cnt;
 	}
@@ -5288,6 +6729,7 @@
 	      string_table + sect->sh_name, cnt);
 
       option = iopt;
+      
       while (cnt-- > 0)
 	{
 	  size_t len;
@@ -5324,16 +6766,16 @@
 	      else
 		{
 		  /* 64 bit form.  */
-		  Elf64_External_RegInfo *ereg;
+		  Elf64_External_RegInfo * ereg;
 		  Elf64_Internal_RegInfo reginfo;
 
 		  ereg = (Elf64_External_RegInfo *) (option + 1);
-		  reginfo.ri_gprmask = BYTE_GET (ereg->ri_gprmask);
+		  reginfo.ri_gprmask    = BYTE_GET (ereg->ri_gprmask);
 		  reginfo.ri_cprmask[0] = BYTE_GET (ereg->ri_cprmask[0]);
 		  reginfo.ri_cprmask[1] = BYTE_GET (ereg->ri_cprmask[1]);
 		  reginfo.ri_cprmask[2] = BYTE_GET (ereg->ri_cprmask[2]);
 		  reginfo.ri_cprmask[3] = BYTE_GET (ereg->ri_cprmask[3]);
-		  reginfo.ri_gp_value = BYTE_GET (ereg->ri_gp_value);
+		  reginfo.ri_gp_value   = BYTE_GET8 (ereg->ri_gp_value);
 
 		  printf ("GPR %08lx  GP 0x",
 			  reginfo.ri_gprmask);
@@ -5438,9 +6880,9 @@
 
   if (conflicts_offset != 0 && conflictsno != 0)
     {
-      Elf32_External_Conflict *econf32;
-      Elf64_External_Conflict *econf64;
-      Elf32_Conflict *iconf;
+      Elf32_External_Conflict * econf32;
+      Elf64_External_Conflict * econf64;
+      Elf32_Conflict * iconf;
       size_t cnt;
 
       if (dynamic_symbols == NULL)
@@ -5456,7 +6898,7 @@
 	  return 0;
 	}
 
-      if (binary_class == ELFCLASS32)
+      if (is_32bit_elf)
 	{
 	  GET_DATA_ALLOC (conflicts_offset, conflictsno * sizeof (*econf32),
 			  econf32, Elf32_External_Conflict *, "conflict");
@@ -5478,24 +6920,205 @@
 
       for (cnt = 0; cnt < conflictsno; ++cnt)
 	{
-	  Elf_Internal_Sym *psym = &dynamic_symbols[iconf[cnt]];
+	  Elf_Internal_Sym * psym = &dynamic_symbols[iconf[cnt]];
 
-	  printf ("%5u: %8lu  %#10lx  %s\n",
-		  cnt, iconf[cnt], (unsigned long) psym->st_value,
-		  dynamic_strings + psym->st_name);
+	  printf ("%5lu: %8lu  ", (unsigned long) cnt, iconf[cnt]);
+	  print_vma (psym->st_value, FULL_HEX);
+	  printf ("  %s\n", dynamic_strings + psym->st_name);
 	}
 
-
       free (iconf);
     }
 
   return 1;
 }
 
+static char *
+get_note_type (e_type)
+     unsigned e_type;
+{
+  static char buff[64];
+
+  switch (e_type)
+    {
+    case NT_PRSTATUS:	return _("NT_PRSTATUS (prstatus structure)");
+    case NT_FPREGSET:	return _("NT_FPREGSET (floating point registers)");
+    case NT_PRPSINFO:   return _("NT_PRPSINFO (prpsinfo structure)");
+    case NT_TASKSTRUCT: return _("NT_TASKSTRUCT (task structure)");
+    case NT_PRXFPREG:   return _("NT_PRXFPREG (user_xfpregs structure)");
+    case NT_PSTATUS:	return _("NT_PSTATUS (pstatus structure)");
+    case NT_FPREGS:	return _("NT_FPREGS (floating point registers)");
+    case NT_PSINFO:	return _("NT_PSINFO (psinfo structure)");
+    case NT_LWPSTATUS:	return _("NT_LWPSTATUS (lwpstatus_t structure)");
+    case NT_LWPSINFO:	return _("NT_LWPSINFO (lwpsinfo_t structure)");
+    case NT_WIN32PSTATUS: return _("NT_WIN32PSTATUS (win32_pstatus strcuture)");
+    default:
+      sprintf (buff, _("Unknown note type: (0x%08x)"), e_type);
+      return buff;
+    }
+}
+
+/* Note that by the ELF standard, the name field is already null byte
+   terminated, and namesz includes the terminating null byte.
+   I.E. the value of namesz for the name "FSF" is 4.
+
+   If the value of namesz is zero, there is no name present. */
+static int
+process_note (pnote)
+  Elf32_Internal_Note * pnote;
+{
+  printf ("  %s\t\t0x%08lx\t%s\n",
+	  pnote->namesz ? pnote->namedata : "(NONE)",
+  	  pnote->descsz, get_note_type (pnote->type));
+  return 1;
+}
+
+
+static int
+process_corefile_note_segment (file, offset, length)
+     FILE * file;
+     bfd_vma offset;
+     bfd_vma length;
+{
+  Elf_External_Note *  pnotes;
+  Elf_External_Note *  external;
+  int                  res = 1;
+
+  if (length <= 0)
+    return 0;
+
+  GET_DATA_ALLOC (offset, length, pnotes, Elf_External_Note *, "notes");
+
+  external = pnotes;
+
+  printf (_("\nNotes at offset 0x%08lx with length 0x%08lx:\n"),
+	  (unsigned long) offset,
+	  (unsigned long) length);
+  printf (_("  Owner\t\tData size\tDescription\n"));
+
+  while (external < (Elf_External_Note *)((char *) pnotes + length))
+    {
+      Elf32_Internal_Note inote;
+      char * temp = NULL;
+
+      inote.type     = BYTE_GET (external->type);
+      inote.namesz   = BYTE_GET (external->namesz);
+      inote.namedata = external->name;
+      inote.descsz   = BYTE_GET (external->descsz);
+      inote.descdata = inote.namedata + align_power (inote.namesz, 2);
+      inote.descpos  = offset + (inote.descdata - (char *) pnotes);
+      
+      external = (Elf_External_Note *)(inote.descdata + align_power (inote.descsz, 2));
+
+      /* Verify that name is null terminated.  It appears that at least
+	 one version of Linux (RedHat 6.0) generates corefiles that don't
+	 comply with the ELF spec by failing to include the null byte in
+	 namesz.  */
+      if (inote.namedata[inote.namesz] != '\0')
+	{
+	  temp = malloc (inote.namesz + 1);
+	  
+	  if (temp == NULL)
+	    {
+	      error (_("Out of memory\n"));
+	      res = 0;
+	      break;
+	    }
+	  
+	  strncpy (temp, inote.namedata, inote.namesz);
+	  temp[inote.namesz] = 0;
+	  
+	  /* warn (_("'%s' NOTE name not properly null terminated\n"), temp);  */
+	  inote.namedata = temp;
+	}
+
+      res &= process_note (& inote);
+
+      if (temp != NULL)
+	{
+	  free (temp);
+	  temp = NULL;
+	}
+    }
+
+  free (pnotes);
+
+  return res;
+}
+
+static int
+process_corefile_note_segments (file)
+     FILE * file;
+{
+  Elf_Internal_Phdr * program_headers;
+  Elf_Internal_Phdr * segment;
+  unsigned int	      i;
+  int                 res = 1;
+
+  program_headers = (Elf_Internal_Phdr *) malloc
+    (elf_header.e_phnum * sizeof (Elf_Internal_Phdr));
+
+  if (program_headers == NULL)
+    {
+      error (_("Out of memory\n"));
+      return 0;
+    }
+
+  if (is_32bit_elf)
+    i = get_32bit_program_headers (file, program_headers);
+  else
+    i = get_64bit_program_headers (file, program_headers);
+
+  if (i == 0)
+    {
+      free (program_headers);
+      return 0;
+    }
+
+  for (i = 0, segment = program_headers;
+       i < elf_header.e_phnum;
+       i ++, segment ++)
+    {
+      if (segment->p_type == PT_NOTE)
+	res &= process_corefile_note_segment (file,
+					      (bfd_vma) segment->p_offset,
+					      (bfd_vma) segment->p_filesz);
+    }
+
+  free (program_headers);
+
+  return res;
+}
+
+static int
+process_corefile_contents (file)
+     FILE * file;
+{
+  /* If we have not been asked to display the notes then do nothing.  */
+  if (! do_notes)
+    return 1;
+
+  /* If file is not a core file then exit.  */
+  if (elf_header.e_type != ET_CORE)
+    return 1;
+
+  /* No program headers means no NOTE segment.  */
+  if (elf_header.e_phnum == 0)
+    {
+      printf (_("No note segments present in the core file.\n"));
+      return 1;
+   }
+
+  return process_corefile_note_segments (file);
+}
+
 static int
 process_arch_specific (file)
-     FILE *file;
+     FILE * file;
 {
+  if (! do_arch)
+    return 1;
+
   switch (elf_header.e_machine)
     {
     case EM_MIPS:
@@ -5512,31 +7135,76 @@
 get_file_header (file)
      FILE * file;
 {
-  Elf32_External_Ehdr ehdr;
-
-  if (fread (& ehdr, sizeof (ehdr), 1, file) != 1)
+  /* Read in the identity array.  */
+  if (fread (elf_header.e_ident, EI_NIDENT, 1, file) != 1)
     return 0;
 
-  memcpy (elf_header.e_ident, ehdr.e_ident, EI_NIDENT);
+  /* Determine how to read the rest of the header.  */
+  switch (elf_header.e_ident [EI_DATA])
+    {
+    default: /* fall through */
+    case ELFDATANONE: /* fall through */
+    case ELFDATA2LSB: byte_get = byte_get_little_endian; break;
+    case ELFDATA2MSB: byte_get = byte_get_big_endian; break;
+    }
 
-  if (elf_header.e_ident [EI_DATA] == ELFDATA2LSB)
-    byte_get = byte_get_little_endian;
+  /* For now we only support 32 bit and 64 bit ELF files.  */
+  is_32bit_elf = (elf_header.e_ident [EI_CLASS] != ELFCLASS64);
+
+  /* Read in the rest of the header.  */
+  if (is_32bit_elf)
+    {
+      Elf32_External_Ehdr ehdr32;
+
+      if (fread (ehdr32.e_type, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
+	return 0;
+
+      elf_header.e_type      = BYTE_GET (ehdr32.e_type);
+      elf_header.e_machine   = BYTE_GET (ehdr32.e_machine);
+      elf_header.e_version   = BYTE_GET (ehdr32.e_version);
+      elf_header.e_entry     = BYTE_GET (ehdr32.e_entry);
+      elf_header.e_phoff     = BYTE_GET (ehdr32.e_phoff);
+      elf_header.e_shoff     = BYTE_GET (ehdr32.e_shoff);
+      elf_header.e_flags     = BYTE_GET (ehdr32.e_flags);
+      elf_header.e_ehsize    = BYTE_GET (ehdr32.e_ehsize);
+      elf_header.e_phentsize = BYTE_GET (ehdr32.e_phentsize);
+      elf_header.e_phnum     = BYTE_GET (ehdr32.e_phnum);
+      elf_header.e_shentsize = BYTE_GET (ehdr32.e_shentsize);
+      elf_header.e_shnum     = BYTE_GET (ehdr32.e_shnum);
+      elf_header.e_shstrndx  = BYTE_GET (ehdr32.e_shstrndx);
+    }
   else
-    byte_get = byte_get_big_endian;
+    {
+      Elf64_External_Ehdr ehdr64;
 
-  elf_header.e_entry     = BYTE_GET (ehdr.e_entry);
-  elf_header.e_phoff     = BYTE_GET (ehdr.e_phoff);
-  elf_header.e_shoff     = BYTE_GET (ehdr.e_shoff);
-  elf_header.e_version   = BYTE_GET (ehdr.e_version);
-  elf_header.e_flags     = BYTE_GET (ehdr.e_flags);
-  elf_header.e_type      = BYTE_GET (ehdr.e_type);
-  elf_header.e_machine   = BYTE_GET (ehdr.e_machine);
-  elf_header.e_ehsize    = BYTE_GET (ehdr.e_ehsize);
-  elf_header.e_phentsize = BYTE_GET (ehdr.e_phentsize);
-  elf_header.e_phnum     = BYTE_GET (ehdr.e_phnum);
-  elf_header.e_shentsize = BYTE_GET (ehdr.e_shentsize);
-  elf_header.e_shnum     = BYTE_GET (ehdr.e_shnum);
-  elf_header.e_shstrndx  = BYTE_GET (ehdr.e_shstrndx);
+      /* If we have been compiled with sizeof (bfd_vma) == 4, then
+	 we will not be able to cope with the 64bit data found in
+	 64 ELF files.  Detect this now and abort before we start
+	 overwritting things.  */
+      if (sizeof (bfd_vma) < 8)
+	{
+	  error (_("This instance of readelf has been built without support for a\n"));
+	  error (_("64 bit data type and so it cannot read 64 bit ELF files.\n"));
+	  return 0;
+	}
+
+      if (fread (ehdr64.e_type, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
+	return 0;
+
+      elf_header.e_type      = BYTE_GET (ehdr64.e_type);
+      elf_header.e_machine   = BYTE_GET (ehdr64.e_machine);
+      elf_header.e_version   = BYTE_GET (ehdr64.e_version);
+      elf_header.e_entry     = BYTE_GET8 (ehdr64.e_entry);
+      elf_header.e_phoff     = BYTE_GET8 (ehdr64.e_phoff);
+      elf_header.e_shoff     = BYTE_GET8 (ehdr64.e_shoff);
+      elf_header.e_flags     = BYTE_GET (ehdr64.e_flags);
+      elf_header.e_ehsize    = BYTE_GET (ehdr64.e_ehsize);
+      elf_header.e_phentsize = BYTE_GET (ehdr64.e_phentsize);
+      elf_header.e_phnum     = BYTE_GET (ehdr64.e_phnum);
+      elf_header.e_shentsize = BYTE_GET (ehdr64.e_shentsize);
+      elf_header.e_shnum     = BYTE_GET (ehdr64.e_shnum);
+      elf_header.e_shstrndx  = BYTE_GET (ehdr64.e_shstrndx);
+    }
 
   return 1;
 }
@@ -5602,6 +7270,8 @@
 
   process_section_contents (file);
 
+  process_corefile_contents (file);
+
   process_arch_specific (file);
 
   fclose (file);
@@ -5628,6 +7298,7 @@
     {
       free (dynamic_symbols);
       dynamic_symbols = NULL;
+      num_dynamic_syms = 0;
     }
 
   if (dynamic_syminfo)
@@ -5639,8 +7310,8 @@
 
 #ifdef SUPPORT_DISASSEMBLY
 /* Needed by the i386 disassembler.  For extra credit, someone could
-fix this so that we insert symbolic addresses here, esp for GOT/PLT
-symbols */
+   fix this so that we insert symbolic addresses here, esp for GOT/PLT
+   symbols */
 
 void
 print_address (unsigned int addr, FILE * outfile)
diff --git a/binutils/rename.c b/binutils/rename.c
index fdc7263..78ea9fd 100644
--- a/binutils/rename.c
+++ b/binutils/rename.c
@@ -31,6 +31,12 @@
 #endif /* HAVE_UTIMES */
 #endif /* ! HAVE_GOOD_UTIME_H */
 
+/* We need to open the file in binary modes on system where that makes
+   a difference.  */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 static int simple_copy PARAMS ((const char *, const char *));
 
 /* The number of bytes to copy at once.  */
@@ -48,10 +54,14 @@
   int saved;
   char buf[COPY_BUF];
 
-  fromfd = open (from, O_RDONLY);
+  fromfd = open (from, O_RDONLY | O_BINARY);
   if (fromfd < 0)
     return -1;
+#ifdef O_CREAT
+  tofd = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0777);
+#else
   tofd = creat (to, 0777);
+#endif
   if (tofd < 0)
     {
       saved = errno;
@@ -139,17 +149,17 @@
      const char *to;
      int preserve_dates;
 {
-  int exists;
+  boolean exists;
   struct stat s;
   int ret = 0;
 
-  exists = lstat (to, &s);
+  exists = lstat (to, &s) == 0;
 
 #if defined (_WIN32) && !defined (__CYGWIN32__)
   /* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
      fail instead.  Also, chown is not present.  */
 
-  if (exists == 0)
+  if (exists)
     remove (to);
 
   ret = rename (from, to);
@@ -163,7 +173,7 @@
 #else
   /* Use rename only if TO is not a symbolic link and has
      only one hard link.  */
-  if (exists < 0 || (!S_ISLNK (s.st_mode) && s.st_nlink == 1))
+  if (! exists || (!S_ISLNK (s.st_mode) && s.st_nlink == 1))
     {
       ret = rename (from, to);
       if (ret == 0)
diff --git a/binutils/rescoff.c b/binutils/rescoff.c
index 9a028c7..64cf572 100644
--- a/binutils/rescoff.c
+++ b/binutils/rescoff.c
@@ -1,5 +1,5 @@
 /* rescoff.c -- read and write resources in Windows COFF files.
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
@@ -447,9 +447,20 @@
   if (! bfd_set_format (abfd, bfd_object))
     bfd_fatal ("bfd_set_format");
 
+#if defined DLLTOOL_SH
+  if (! bfd_set_arch_mach (abfd, bfd_arch_sh, 0))
+    bfd_fatal ("bfd_set_arch_mach(sh)");
+#elif defined DLLTOOL_MIPS
+  if (! bfd_set_arch_mach (abfd, bfd_arch_mips, 0))
+    bfd_fatal ("bfd_set_arch_mach(mips)");
+#elif defined DLLTOOL_ARM
+  if (! bfd_set_arch_mach (abfd, bfd_arch_arm, 0))
+    bfd_fatal ("bfd_set_arch_mach(arm)");
+#else
   /* FIXME: This is obviously i386 specific.  */
   if (! bfd_set_arch_mach (abfd, bfd_arch_i386, 0))
-    bfd_fatal ("bfd_set_arch_mach");
+    bfd_fatal ("bfd_set_arch_mach(i386)");
+#endif
 
   if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC))
     bfd_fatal ("bfd_set_file_flags");
diff --git a/binutils/resrc.c b/binutils/resrc.c
index 9ba3c11..8c3c9a7 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -1,5 +1,5 @@
 /* resrc.c -- read and write Windows rc files.
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
@@ -29,9 +29,49 @@
 
 #include <assert.h>
 #include <ctype.h>
+#include <errno.h>
 #include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
-#if defined (_WIN32) && ! defined (__CYGWIN32__)
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#else /* ! HAVE_SYS_WAIT_H */
+#if ! defined (_WIN32) || defined (__CYGWIN__)
+#ifndef WIFEXITED
+#define WIFEXITED(w)	(((w)&0377) == 0)
+#endif
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(w)	(((w)&0377) != 0177 && ((w)&~0377) == 0)
+#endif
+#ifndef WTERMSIG
+#define WTERMSIG(w)	((w) & 0177)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(w)	(((w) >> 8) & 0377)
+#endif
+#else /* defined (_WIN32) && ! defined (__CYGWIN__) */
+#ifndef WIFEXITED
+#define WIFEXITED(w)	(((w) & 0xff) == 0)
+#endif
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(w)	(((w) & 0xff) != 0 && ((w) & 0xff) != 0x7f)
+#endif
+#ifndef WTERMSIG
+#define WTERMSIG(w)	((w) & 0x7f)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(w)	(((w) & 0xff00) >> 8)
+#endif
+#endif /* defined (_WIN32) && ! defined (__CYGWIN__) */
+#endif /* ! HAVE_SYS_WAIT_H */
+
+#ifndef STDOUT_FILENO
+#define STDOUT_FILENO 1
+#endif
+ 
+#if defined (_WIN32) && ! defined (__CYGWIN__)
 #define popen _popen
 #define pclose _pclose
 #endif
@@ -86,6 +126,15 @@
 
 static FILE *cpp_pipe;
 
+/* The temporary file used if we're not using popen, so we can delete it
+   if we exit.  */
+
+static char *cpp_temp_file;
+
+/* Input stream is either a file or a pipe. */
+
+static enum {ISTREAM_PIPE, ISTREAM_FILE} istream_type;
+
 /* As we read the rc file, we attach information to this structure.  */
 
 static struct res_directory *resources;
@@ -112,7 +161,11 @@
 
 /* Local functions.  */
 
-static void close_pipe PARAMS ((void));
+static int run_cmd PARAMS ((char *, const char *));
+static FILE *open_input_stream PARAMS ((char *));
+static FILE *look_for_default PARAMS ((char *, const char *, int,
+				       const char *, const char *));
+static void close_input_stream PARAMS ((void));
 static void unexpected_eof PARAMS ((const char *));
 static int get_word PARAMS ((FILE *, const char *));
 static unsigned long get_long PARAMS ((FILE *, const char *));
@@ -120,38 +173,308 @@
   PARAMS ((FILE *, unsigned char *, unsigned long, const char *));
 static void define_fontdirs PARAMS ((void));
 
+/* Run `cmd' and redirect the output to `redir'. */
+
+static int
+run_cmd (cmd, redir)
+     char *cmd;
+     const char *redir;
+{
+  char *s;
+  int pid, wait_status, retcode;
+  int i;
+  const char **argv;
+  char *errmsg_fmt, *errmsg_arg;
+  char *temp_base = choose_temp_base ();
+  int in_quote;
+  char sep;
+  int redir_handle = -1;
+  int stdout_save = -1;
+
+  /* Count the args.  */
+  i = 0;
+  
+  for (s = cmd; *s; s++)
+    if (*s == ' ')
+      i++;
+  
+  i++;
+  argv = alloca (sizeof (char *) * (i + 3));
+  i = 0;
+  s = cmd;
+  
+  while (1)
+    {
+      while (*s == ' ' && *s != 0)
+	s++;
+      
+      if (*s == 0)
+	break;
+      
+      in_quote = (*s == '\'' || *s == '"');
+      sep = (in_quote) ? *s++ : ' ';
+      argv[i++] = s;
+      
+      while (*s != sep && *s != 0)
+	s++;
+      
+      if (*s == 0)
+	break;
+      
+      *s++ = 0;
+      
+      if (in_quote)
+        s++;
+    }
+  argv[i++] = NULL;
+
+  /* Setup the redirection.  We can't use the usual fork/exec and redirect
+     since we may be running on non-POSIX Windows host.  */
+
+  fflush (stdout);
+  fflush (stderr);
+
+  /* Open temporary output file.  */
+  redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0666);
+  if (redir_handle == -1)
+    fatal (_("can't open temporary file `%s': %s"), redir, 
+           strerror (errno));
+
+  /* Duplicate the stdout file handle so it can be restored later.  */
+  stdout_save = dup (STDOUT_FILENO);
+  if (stdout_save == -1)
+    fatal (_("can't redirect stdout: `%s': %s"), redir, strerror (errno));
+
+  /* Redirect stdout to our output file.  */
+  dup2 (redir_handle, STDOUT_FILENO);
+
+  pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base,
+		  &errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH);
+
+  /* Restore stdout to its previous setting.  */
+  dup2 (stdout_save, STDOUT_FILENO);
+
+  /* Close reponse file.  */
+  close (redir_handle);
+
+  if (pid == -1)
+    {
+      fatal (_("%s %s: %s"), errmsg_fmt, errmsg_arg, strerror (errno));
+      return 1;
+    }
+
+  retcode = 0;
+  pid = pwait (pid, &wait_status, 0);
+  
+  if (pid == -1)
+    {
+      fatal (_("wait: %s"), strerror (errno));
+      retcode = 1;
+    }
+  else if (WIFSIGNALED (wait_status))
+    {
+      fatal (_("subprocess got fatal signal %d"), WTERMSIG (wait_status));
+      retcode = 1;
+    }
+  else if (WIFEXITED (wait_status))
+    {
+      if (WEXITSTATUS (wait_status) != 0)
+	{
+	  fatal (_("%s exited with status %d"), cmd, 
+	         WEXITSTATUS (wait_status));
+	  retcode = 1;
+	}
+    }
+  else
+    retcode = 1;
+  
+  return retcode;
+}
+
+static FILE *
+open_input_stream (cmd)
+     char *cmd;
+{
+  if (istream_type == ISTREAM_FILE)
+    {
+      char *fileprefix;
+
+      fileprefix = choose_temp_base ();
+      cpp_temp_file = (char *) xmalloc (strlen (fileprefix) + 5);
+      sprintf (cpp_temp_file, "%s.irc", fileprefix);
+      free (fileprefix);
+
+      if (run_cmd (cmd, cpp_temp_file))
+	fatal (_("can't execute `%s': %s"), cmd, strerror (errno));
+
+      cpp_pipe = fopen (cpp_temp_file, FOPEN_RT);;
+      if (cpp_pipe == NULL)
+        fatal (_("can't open temporary file `%s': %s"), 
+	       cpp_temp_file, strerror (errno));
+      
+      if (verbose)
+	fprintf (stderr, 
+	         _("Using temporary file `%s' to read preprocessor output\n"),
+		 cpp_temp_file);
+    }
+  else
+    {
+      cpp_pipe = popen (cmd, FOPEN_RT);
+      if (cpp_pipe == NULL)
+        fatal (_("can't popen `%s': %s"), cmd, strerror (errno));
+      if (verbose)
+	fprintf (stderr, _("Using popen to read preprocessor output\n"));
+    }
+
+  xatexit (close_input_stream);
+  return cpp_pipe;
+}
+
+/* look for the preprocessor program */
+
+static FILE *
+look_for_default (cmd, prefix, end_prefix, preprocargs, filename)
+     char *cmd;
+     const char *prefix;
+     int end_prefix;
+     const char *preprocargs;
+     const char *filename;
+{
+  char *space;
+  int found;
+  struct stat s;
+
+  strcpy (cmd, prefix);
+
+  sprintf (cmd + end_prefix, "%s", DEFAULT_PREPROCESSOR);
+  space = strchr (cmd + end_prefix, ' ');
+  if (space)
+    *space = 0;
+
+  if (
+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32)
+      strchr (cmd, '\\') ||
+#endif
+      strchr (cmd, '/'))
+    {
+      found = (stat (cmd, &s) == 0
+#ifdef HAVE_EXECUTABLE_SUFFIX
+	       || stat (strcat (cmd, EXECUTABLE_SUFFIX), &s) == 0
+#endif
+	       );
+
+      if (! found)
+	{
+	  if (verbose)
+	    fprintf (stderr, _("Tried `%s'\n"), cmd);
+	  return NULL;
+	}
+    }
+
+  strcpy (cmd, prefix);
+
+  sprintf (cmd + end_prefix, "%s %s %s",
+	   DEFAULT_PREPROCESSOR, preprocargs, filename);
+
+  if (verbose)
+    fprintf (stderr, _("Using `%s'\n"), cmd);
+
+  cpp_pipe = open_input_stream (cmd);
+  return cpp_pipe;
+}
+
 /* Read an rc file.  */
 
 struct res_directory *
-read_rc_file (filename, preprocessor, preprocargs, language)
+read_rc_file (filename, preprocessor, preprocargs, language, use_temp_file)
      const char *filename;
      const char *preprocessor;
      const char *preprocargs;
      int language;
+     int use_temp_file;
 {
   char *cmd;
 
-  if (preprocessor == NULL)
-    preprocessor = DEFAULT_PREPROCESSOR;
+  istream_type = (use_temp_file) ? ISTREAM_FILE : ISTREAM_PIPE;
 
   if (preprocargs == NULL)
     preprocargs = "";
   if (filename == NULL)
     filename = "-";
 
-  cmd = xmalloc (strlen (preprocessor)
-		 + strlen (preprocargs)
-		 + strlen (filename)
-		 + 10);
-  sprintf (cmd, "%s %s %s", preprocessor, preprocargs, filename);
+  if (preprocessor)
+    {
+      cmd = xmalloc (strlen (preprocessor)
+		     + strlen (preprocargs)
+		     + strlen (filename)
+		     + 10);
+      sprintf (cmd, "%s %s %s", preprocessor, preprocargs, filename);
 
-  cpp_pipe = popen (cmd, FOPEN_RT);
-  if (cpp_pipe == NULL)
-    fatal (_("can't popen `%s': %s"), cmd, strerror (errno));
+      cpp_pipe = open_input_stream (cmd);
+    }
+  else
+    {
+      char *dash, *slash, *cp;
+
+      preprocessor = DEFAULT_PREPROCESSOR;
+
+      cmd = xmalloc (strlen (program_name)
+		     + strlen (preprocessor)
+		     + strlen (preprocargs)
+		     + strlen (filename)
+#ifdef HAVE_EXECUTABLE_SUFFIX
+		     + strlen (EXECUTABLE_SUFFIX)
+#endif
+		     + 10);
+
+
+      dash = slash = 0;
+      for (cp = program_name; *cp; cp++)
+	{
+	  if (*cp == '-')
+	    dash = cp;
+	  if (
+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32)
+	      *cp == ':' || *cp == '\\' ||
+#endif
+	      *cp == '/')
+	    {
+	      slash = cp;
+	      dash = 0;
+	    }
+	}
+
+      cpp_pipe = 0;
+
+      if (dash)
+	{
+	  /* First, try looking for a prefixed gcc in the windres
+	     directory, with the same prefix as windres */
+
+	  cpp_pipe = look_for_default (cmd, program_name, dash-program_name+1,
+				       preprocargs, filename);
+	}
+
+      if (slash && !cpp_pipe)
+	{
+	  /* Next, try looking for a gcc in the same directory as
+             that windres */
+
+	  cpp_pipe = look_for_default (cmd, program_name, slash-program_name+1,
+				       preprocargs, filename);
+	}
+
+      if (!cpp_pipe)
+	{
+	  /* Sigh, try the default */
+
+	  cpp_pipe = look_for_default (cmd, "", 0, preprocargs, filename);
+	}
+
+    }
+  
   free (cmd);
 
-  xatexit (close_pipe);
-
   rc_filename = xstrdup (filename);
   rc_lineno = 1;
   if (language != -1)
@@ -159,10 +482,8 @@
   yyin = cpp_pipe;
   yyparse ();
 
-  if (pclose (cpp_pipe) != 0)
-    fprintf (stderr, _("%s: warning: preprocessor failed\n"), program_name);
-  cpp_pipe = NULL;
-
+  close_input_stream ();
+  
   if (fontdirs != NULL)
     define_fontdirs ();
 
@@ -172,13 +493,37 @@
   return resources;
 }
 
-/* Close the pipe if it is open.  This is called via xatexit.  */
+/* Close the input stream if it is open.  */
 
-void
-close_pipe ()
+static void
+close_input_stream ()
 {
   if (cpp_pipe != NULL)
     pclose (cpp_pipe);
+  
+  if (istream_type == ISTREAM_FILE)
+    {
+      if (cpp_pipe != NULL)
+	fclose (cpp_pipe);
+
+      if (cpp_temp_file != NULL)
+	{
+	  int errno_save = errno;
+	  
+	  unlink (cpp_temp_file);
+	  errno = errno_save;
+	  free (cpp_temp_file);
+	}
+    }
+  else
+    {
+      if (cpp_pipe != NULL)
+	pclose (cpp_pipe);
+    }
+
+  /* Since this is also run via xatexit, safeguard. */
+  cpp_pipe = NULL;
+  cpp_temp_file = NULL;
 }
 
 /* Report an error while reading an rc file.  */
@@ -196,7 +541,7 @@
 rcparse_warning (msg)
      const char *msg;
 {
-  fprintf (stderr, "%s:%d: %s\n", rc_filename, rc_lineno, msg);
+  fprintf (stderr, _("%s:%d: %s\n"), rc_filename, rc_lineno, msg);
 }
 
 /* Die if we get an unexpected end of file.  */
@@ -2044,60 +2389,100 @@
 	    for (i = 0; i + 3 < ri->u.buffer.length; i += 4)
 	      {
 		unsigned long l;
+		int j;
 
+		if (! first)
+		  indent (e, ind + 2);
 		l = ((((((ri->u.buffer.data[i + 3] << 8)
 			 | ri->u.buffer.data[i + 2]) << 8)
 		       | ri->u.buffer.data[i + 1]) << 8)
 		     | ri->u.buffer.data[i]);
-		if (first)
-		  first = 0;
-		else
-		  {
-		    fprintf (e, ",\n");
-		    indent (e, ind + 2);
-		  }
 		fprintf (e, "%luL", l);
+		if (i + 4 < ri->u.buffer.length || ri->next != NULL)
+		  fprintf (e, ",");
+		for (j = 0; j < 4; ++j)
+		  if (! isprint (ri->u.buffer.data[i + j])
+		      && ri->u.buffer.data[i + j] != 0)
+		    break;
+		if (j >= 4)
+		  {
+		    fprintf (e, "\t// ");
+		    for (j = 0; j < 4; ++j)
+		      {
+			if (! isprint (ri->u.buffer.data[i + j]))
+			  fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
+			else
+			  {
+			    if (ri->u.buffer.data[i + j] == '\\')
+			      fprintf (e, "\\");
+			    fprintf (e, "%c", ri->u.buffer.data[i + j]);
+			  }
+		      }
+		  }
+		fprintf (e, "\n");
+		first = 0;
 	      }
 
 	    if (i + 1 < ri->u.buffer.length)
 	      {
-		int i;
+		int s;
+		int j;
 
-		i = (ri->u.buffer.data[i + 1] << 8) | ri->u.buffer.data[i];
-		if (first)
-		  first = 0;
-		else
+		if (! first)
+		  indent (e, ind + 2);
+		s = (ri->u.buffer.data[i + 1] << 8) | ri->u.buffer.data[i];
+		fprintf (e, "%d", s);
+		if (i + 2 < ri->u.buffer.length || ri->next != NULL)
+		  fprintf (e, ",");
+		for (j = 0; j < 2; ++j)
+		  if (! isprint (ri->u.buffer.data[i + j])
+		      && ri->u.buffer.data[i + j] != 0)
+		    break;
+		if (j >= 2)
 		  {
-		    fprintf (e, ",\n");
-		    indent (e, ind + 2);
+		    fprintf (e, "\t// ");
+		    for (j = 0; j < 2; ++j)
+		      {
+			if (! isprint (ri->u.buffer.data[i + j]))
+			  fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
+			else
+			  {
+			    if (ri->u.buffer.data[i + j] == '\\')
+			      fprintf (e, "\\");
+			    fprintf (e, "%c", ri->u.buffer.data[i + j]);
+			  }
+		      }
 		  }
-		fprintf (e, "%d", i);
+		fprintf (e, "\n");
 		i += 2;
+		first = 0;
 	      }
 
 	    if (i < ri->u.buffer.length)
 	      {
-		if (first)
-		  first = 0;
-		else
-		  {
-		    fprintf (e, ",\n");
-		    indent (e, ind + 2);
-		  }
+		if (! first)
+		  indent (e, ind + 2);
 		if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i]
 		    && isprint (ri->u.buffer.data[i]))
 		  fprintf (e, "\"%c\"", ri->u.buffer.data[i]);
 		else
-		  fprintf (e, "\"\%03o\"", ri->u.buffer.data[i]);
+		  fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]);
+		if (ri->next != NULL)
+		  fprintf (e, ",");
+		fprintf (e, "\n");
+		first = 0;
 	      }
 
 	    break;
 	  }
 	}
 
-      if (ri->next != NULL)
-	fprintf (e, ",");
-      fprintf (e, "\n");
+      if (ri->type != RCDATA_BUFFER)
+	{
+	  if (ri->next != NULL)
+	    fprintf (e, ",");
+	  fprintf (e, "\n");
+	}
     }
 
   indent (e, ind);
diff --git a/binutils/resres.c b/binutils/resres.c
index 39264f4..6a860eb 100644
--- a/binutils/resres.c
+++ b/binutils/resres.c
@@ -1,5 +1,4 @@
 /* resres.c: read_res_file and write_res_file implementation for windres.
-
    Copyright 1998, 1999 Free Software Foundation, Inc.
    Written by Anders Norlander <anorland@hem2.passagen.se>.
 
@@ -20,6 +19,10 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+/* FIXME: This file does not work correctly in a cross configuration.
+   It assumes that it can use fread and fwrite to read and write
+   integers.  It does no swapping.  */
+
 #include "bfd.h"
 #include "bucomm.h"
 #include "libiberty.h"
@@ -216,7 +219,7 @@
 	  /* If we're at level 3, then this key represents a language.
 	     Use it to update the current language.  */
 	  if (!re->id.named
-	      && re->id.u.id != *language
+	      && re->id.u.id != (unsigned long) *language
 	      && (re->id.u.id & 0xffff) == re->id.u.id)
 	    {
 	      *language = re->id.u.id;
@@ -256,7 +259,7 @@
      const struct res_id *type;
      const struct res_id *name;
      const struct res_resource *res;
-     int *language;
+     int *language ATTRIBUTE_UNUSED;
 {
   int rt;
 
@@ -328,7 +331,7 @@
 
   if (rt != 0
       && type != NULL
-      && (type->named || type->u.id != rt))
+      && (type->named || type->u.id != (unsigned long) rt))
     {
       fprintf (stderr, "// Unexpected resource type mismatch: ");
       res_id_print (stderr, *type, 1);
@@ -403,8 +406,8 @@
      size_t size;
      int count;
 {
-  if (fwrite (data, size, count, fres) != count)
-    fatal ("%s: %s: could not write to file", program_name, filename);
+  if (fwrite (data, size, count, fres) != (size_t) count)
+    fatal ("%s: could not write to file", filename);
 }
 
 /* Read data from file, abort on failure */
@@ -414,8 +417,8 @@
      size_t size;
      int count;
 {
-  if (fread (data, size, count, fres) != count)
-    fatal ("%s: %s: unexpected end of file", program_name, filename);
+  if (fread (data, size, count, fres) != (size_t) count)
+    fatal ("%s: unexpected end of file", filename);
 }
 
 /* Write a resource id */
diff --git a/binutils/size.c b/binutils/size.c
index f57c7ed..c93850c 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -366,9 +366,9 @@
 
 static void
 berkeley_sum (abfd, sec, ignore)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   flagword flags;
   bfd_size_type size;
@@ -433,9 +433,9 @@
 
 static void
 sysv_internal_sizer (file, sec, ignore)
-     bfd *file;
+     bfd *file ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   bfd_size_type size = bfd_section_size (file, sec);
   if (!bfd_is_abs_section (sec)
@@ -454,9 +454,9 @@
 
 static void
 sysv_internal_printer (file, sec, ignore)
-     bfd *file;
+     bfd *file ATTRIBUTE_UNUSED;
      sec_ptr sec;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   bfd_size_type size = bfd_section_size (file, sec);
   if (!bfd_is_abs_section (sec)
diff --git a/binutils/stabs.c b/binutils/stabs.c
index a47b3bd..8c20ed3 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -1,5 +1,5 @@
 /* stabs.c -- Parse stabs debugging information
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -375,7 +375,7 @@
 /*ARGSUSED*/
 PTR
 start_stab (dhandle, abfd, sections, syms, symcount)
-     PTR dhandle;
+     PTR dhandle ATTRIBUTE_UNUSED;
      bfd *abfd;
      boolean sections;
      asymbol **syms;
@@ -1316,14 +1316,21 @@
 	    bad_stab (orig);
 	    return DEBUG_TYPE_NULL;
 	  }
-	while (q1 != NULL && p > q1 && p[1] == ':')
+	if (q1 != NULL && p > q1 && p[1] == ':')
 	  {
-	    q2 = strchr (q1, '>');
-	    if (q2 == NULL || q2 < p)
-	      break;
-	    p += 2;
-	    p = strchr (p, ':');
-	    if (p == NULL)
+	    int nest = 0;
+
+	    for (q2 = q1; *q2 != '\0'; ++q2)
+	      {
+		if (*q2 == '<')
+		  ++nest;
+		else if (*q2 == '>')
+		  --nest;
+		else if (*q2 == ':' && nest == 0)
+		  break;
+	      }
+	    p = q2;
+	    if (*p != ':')
 	      {
 		bad_stab (orig);
 		return DEBUG_TYPE_NULL;
@@ -1632,7 +1639,7 @@
   if (size != -1)
     {
       if (! debug_record_type_size (dhandle, dtype, (unsigned int) size))
-	return false;
+	return DEBUG_TYPE_NULL;
     }
 
   return dtype;
@@ -1811,7 +1818,7 @@
 	    return debug_make_int_type (dhandle, 1, true);
 	  else if (n3 == 0xffff)
 	    return debug_make_int_type (dhandle, 2, true);
-	  else if (n3 == 0xffffffff)
+	  else if (n3 == (bfd_signed_vma) 0xffffffff)
 	    return debug_make_int_type (dhandle, 4, true);
 #ifdef BFD64
 	  else if (n3 == ((((bfd_vma) 0xffffffff) << 32) | 0xffffffff))
@@ -3124,7 +3131,7 @@
   /* If the index type is type 0, we take it as int.  */
   p = *pp;
   if (! parse_stab_type_number (&p, typenums))
-    return false;
+    return DEBUG_TYPE_NULL;
   if (typenums[0] == 0 && typenums[1] == 0 && **pp != '=')
     {
       index_type = debug_find_named_type (dhandle, "int");
@@ -3132,7 +3139,7 @@
 	{
 	  index_type = debug_make_int_type (dhandle, 4, false);
 	  if (index_type == DEBUG_TYPE_NULL)
-	    return false;
+	    return DEBUG_TYPE_NULL;
 	}
       *pp = p;
     }
@@ -3161,7 +3168,7 @@
   if (**pp != ';')
     {
       bad_stab (orig);
-      return false;
+      return DEBUG_TYPE_NULL;
     }
   ++*pp;
 
@@ -3175,14 +3182,14 @@
   if (**pp != ';')
     {
       bad_stab (orig);
-      return false;
+      return DEBUG_TYPE_NULL;
     }
   ++*pp;
 
   element_type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
 				  (debug_type **) NULL);
   if (element_type == DEBUG_TYPE_NULL)
-    return false;
+    return DEBUG_TYPE_NULL;
 
   if (adjustable)
     {
@@ -3432,7 +3439,7 @@
 
 static boolean
 stab_record_type (dhandle, info, typenums, type)
-     PTR dhandle;
+     PTR dhandle ATTRIBUTE_UNUSED;
      struct stab_handle *info;
      const int *typenums;
      debug_type type;
@@ -4506,7 +4513,7 @@
 
 static boolean
 stab_demangle_class (minfo, pp, pstart)
-     struct stab_demangle_info *minfo;
+     struct stab_demangle_info *minfo ATTRIBUTE_UNUSED;
      const char **pp;
      const char **pstart;
 {
@@ -4785,6 +4792,7 @@
     case 'O':
       {
 	boolean memberp, constp, volatilep;
+	debug_type class_type = DEBUG_TYPE_NULL;
 	debug_type *args;
 	boolean varargs;
 	unsigned int n;
@@ -4797,19 +4805,40 @@
 	varargs = false;
 
 	++*pp;
-	if (! isdigit ((unsigned char) **pp))
+	if (isdigit ((unsigned char) **pp))
+	  {
+	    n = stab_demangle_count (pp);
+	    if (strlen (*pp) < n)
+	      {
+		stab_bad_demangle (orig);
+		return false;
+	      }
+	    name = *pp;
+	    *pp += n;
+
+	    if (ptype != NULL)
+	      {
+		class_type = stab_find_tagged_type (minfo->dhandle,
+						    minfo->info,
+						    name, (int) n,
+						    DEBUG_KIND_CLASS);
+		if (class_type == DEBUG_TYPE_NULL)
+		  return false;
+	      }
+	  }
+	else if (**pp == 'Q')
+	  {
+	    if (! stab_demangle_qualified (minfo, pp,
+					   (ptype == NULL
+					    ? (debug_type *) NULL
+					    : &class_type)))
+	      return false;
+	  }
+	else
 	  {
 	    stab_bad_demangle (orig);
 	    return false;
 	  }
-	n = stab_demangle_count (pp);
-	if (strlen (*pp) < n)
-	  {
-	    stab_bad_demangle (orig);
-	    return false;
-	  }
-	name = *pp;
-	*pp += n;
 
 	if (memberp)
 	  {
@@ -4851,14 +4880,6 @@
 
 	if (ptype != NULL)
 	  {
-	    debug_type class_type;
-
-	    class_type = stab_find_tagged_type (minfo->dhandle, minfo->info,
-						name, (int) n,
-						DEBUG_KIND_CLASS);
-	    if (class_type == DEBUG_TYPE_NULL)
-	      return false;
-
 	    if (! memberp)
 	      *ptype = debug_make_offset_type (minfo->dhandle, class_type,
 					       *ptype);
diff --git a/binutils/strings.1 b/binutils/strings.1
index 408de29..f0e46e5 100644
--- a/binutils/strings.1
+++ b/binutils/strings.1
@@ -90,7 +90,7 @@
 .TP
 .B "\-\fImin\-len\fP"
 .TP
-.B "\-bytes=\fImin\-len\fP"
+.B "\-\-bytes=\fImin\-len\fP"
 Print sequences of characters that are at least
 .I min\-len
 characters long, instead of the default 4.
diff --git a/binutils/strings.c b/binutils/strings.c
index 8ffe6a1..fb139fa 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -203,7 +203,7 @@
 
 	default:
 	  if (string_min < 0)
-	    string_min = optc;
+	    string_min = optc - '0';
 	  else
 	    string_min = string_min * 10 + optc - '0';
 	  break;
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 15a0577..078f8d5 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,59 @@
+2000-03-13  Nick Clifton  <nickc@cygnus.com>
+
+	* binutils-all/readelf.s: Adjust to match noew format of readelf
+	output. 
+	* binutils-all/readelf.ss: Adjust to match noew format of readelf 
+	output. 
+
+1999-11-01  Nick Clifton  <nickc@cygnus.com>
+
+	* binutils-all/objcopy.exp: Expect simple objcopy test for fail
+	for COFF based ARM and Thumb ports.
+
+Tue Sep 14 00:28:17 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* binutils-all/hppa/objdump.exp: Do not run for PA64.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* binutils-all/objdump.exp: Add pj to cpus_expected.
+
+Sat Aug 28 00:24:27 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* binutils-all/hppa/freg.s:  New file.
+	* binutils-all/hppa/objdump.exp:  Add freg.s test.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* binutils-all/objcopy.exp: Add setup_xfail for simple copy test
+	for i*86-*-msdos*.
+
+1999-07-21  H.J. Lu  <hjl@gnu.org>
+
+	* binutils-all/testprog.c: Include <stdio.h>.
+
+1999-06-29  Nick Clifton  <nickc@cygnus.com>
+
+	* binutils-all/objdump.exp: Add fr30 and MCore to expected cpus
+	list. 
+
+	* binutils-all/readelf.r: Do not assume a fixed number of spaces
+	in the output.
+
+1999-06-10  Nick Clifton  <nickc@cygnus.com>
+
+	* binutils-all/readelf.wi: Update to match latest output.
+	* binutils-all/readelf.h: Update to match latest output.
+
+Wed Jun  9 11:59:22 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* binutils-all/objdump.exp: Tighten regexp to match `objdump -i'
+	output to avoid massive exponential behaviour.
+
+1999-05-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* binutils-all/readelf.h: Update for changes of 1999-04-08.
+
 1999-03-12  Nick Clifton  <nickc@cygnus.com>
 
 	* binutils-all/readelf.wi: Remove FR30 specific componnts.
diff --git a/binutils/testsuite/binutils-all/hppa/freg.s b/binutils/testsuite/binutils-all/hppa/freg.s
new file mode 100644
index 0000000..501e10f
--- /dev/null
+++ b/binutils/testsuite/binutils-all/hppa/freg.s
@@ -0,0 +1,23 @@
+	.LEVEL 2.0
+	.SPACE $PRIVATE$
+	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
+	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
+	.SPACE $TEXT$
+	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
+	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+	.IMPORT $global$,DATA
+	.IMPORT $$dyncall,MILLICODE
+; gcc_compiled.:
+	.SPACE $TEXT$
+	.SUBSPA $CODE$
+
+	.align 4
+	.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+	.EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR
+main
+	.PROC
+	.CALLINFO FRAME=64,CALLS,SAVE_RP
+	.ENTRY
+	fmpyfadd,sgl %fr4L,%fr4R,%fr5R,%fr5L
+	.EXIT
+	.PROCEND
diff --git a/binutils/testsuite/binutils-all/hppa/objdump.exp b/binutils/testsuite/binutils-all/hppa/objdump.exp
index a46b289..2e2155e 100644
--- a/binutils/testsuite/binutils-all/hppa/objdump.exp
+++ b/binutils/testsuite/binutils-all/hppa/objdump.exp
@@ -24,6 +24,11 @@
   return
 }
 
+# These tests are not suitable for wide mode.
+if [istarget hppa*w-*-*] then {
+  return
+}
+
 if {[which $OBJDUMP] == 0} then {
     perror "$OBJDUMP does not exist"
     return
@@ -57,3 +62,29 @@
 } else {
     fail "addendbug test"
 }
+
+###########################
+# Set up the test of freg.s
+###########################
+
+if {![binutils_assemble $srcdir/$subdir/freg.s tmpdir/freg.o]} then {
+    return
+}
+
+if [is_remote host] {
+    set objfile [remote_download host tmpdir/freg.o]
+} else {
+    set objfile tmpdir/freg.o
+}
+
+# Make sure that we get R float regs like we're supposed to
+
+set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"]
+
+set want "fmpyfadd,sgl fr4,fr4R,fr5R,fr5"
+
+if [regexp $want $got] then {
+    pass "freg test"
+} else {
+    fail "freg test"
+}
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 78972f1..1c40e0a 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -74,7 +74,7 @@
     setup_xfail "m68*-ericsson-ose" "m68k*-motorola-sysv*"
     setup_xfail "i*86-*-linuxaout*" "i*86-*-aout*"
     setup_xfail "i*86-*-sysv3" "i*86-*-isc*" "i*86-*-sco*" "i*86-*-coff"
-    setup_xfail "i*86-*-aix*" "i*86-*-go32*"
+    setup_xfail "i*86-*-aix*" "i*86-*-go32*" "i*86-*-msdos*"
     setup_xfail "a29k-*-udi" "a29k-*-coff" "a29k-*-vxworks*"
     setup_xfail "i960-*-coff"
     setup_xfail "h8300-*-hms" "h8300-*-coff"
@@ -473,6 +473,11 @@
 	# mips_elf_sym_is_global.
 	setup_xfail "mips*-*-elf"
 
+	setup_xfail "arm*-*-coff"
+	setup_xfail "arm*-*-pe"
+	setup_xfail "thumb*-*-coff"
+	setup_xfail "thumb*-*-pe"
+    
 	fail $test1
     }
 
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index 7c50f02..89040fc 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -33,14 +33,14 @@
 
 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
 
-set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|d30v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|v850|vax|we32k|z8k|z8001|z8002)"
+set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|d30v|fr30|h8|hppa|i386|i860|i960|m32r|m68k|m88k|MCore|mips|mn10200|mn10300|ns32k|pj|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|v850|vax|we32k|z8k|z8001|z8002)"
 
 # Make sure the target CPU shows up in the list.
 if ![regexp $cpus_expected $target_cpu] {
     regsub "^\[(\]" "$cpus_expected" "(${target_cpu}|" cpus_expected;
 }
 
-set want "BFD header file version.*srec.*header .* endian.*, data .* endian.*$cpus_expected"
+set want "BFD header file version.*srec\[^\n\]*\n\[^\n\]*header \[^\n\]*endian\[^\n\]*, data \[^\n\]*endian.*$cpus_expected"
 
 if [regexp $want $got] then {
     pass "objdump -i"
diff --git a/binutils/testsuite/binutils-all/readelf.h b/binutils/testsuite/binutils-all/readelf.h
index 555afe9..810eab5 100644
--- a/binutils/testsuite/binutils-all/readelf.h
+++ b/binutils/testsuite/binutils-all/readelf.h
@@ -1,9 +1,13 @@
 ELF Header:
-  Magic:   7f 45 4c 46 0[12] 0[12] 01 00 00 00 00 00 00 00 00 00 
+  Magic:   7f 45 4c 46 0[12] 0[12] 01 .. 00 00 00 00 00 00 00 00 
+  Class:                             ELF[36][24]
+  Data:                              2's complement,.* endian
+  Version:                           1 \(current\)
+  OS/ABI:                            .*
+  ABI Version:                       .*
   Type:                              REL \(Relocatable file\)
   Machine:                           .*
   Version:                           0x1
-  Data:                              ELFDATA.* endian\)
   Entry point address:               0x0
   Start of program headers:          0 \(bytes into file\)
   Start of section headers:          .* \(bytes into file\)
diff --git a/binutils/testsuite/binutils-all/readelf.r b/binutils/testsuite/binutils-all/readelf.r
index 4bea721..1349659 100644
--- a/binutils/testsuite/binutils-all/readelf.r
+++ b/binutils/testsuite/binutils-all/readelf.r
@@ -1,4 +1,4 @@
 
 Relocation section '.rel.*text' at offset 0x.* contains 1 entries:
   Offset    Info  Type            Symbol's Value  Symbol's Name.*
-  00000004  00.* R_.*           00000000  external_symbol.*
+  00000004  00.* R_.*00000000  external_symbol.*
diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s
index 58b1245..89ae0fc 100644
--- a/binutils/testsuite/binutils-all/readelf.s
+++ b/binutils/testsuite/binutils-all/readelf.s
@@ -2,12 +2,15 @@
 
 Section Headers:
   \[Nr\] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
-  \[ 0\]                   NULL            00000000 000000 000000 00      0   0 0
-  \[ 1\] .text             PROGBITS        00000000 000034 000008 00  AX  0   0 .
-  \[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0.      .   1 4
-  \[ 3\] .data             PROGBITS        00000000 00003c 000004 00 WA   0   0 .
-  \[ 4\] .bss              NOBITS          00000000 000040 000000 00 WA   0   0 .
-  \[ 5\] .shstrtab         STRTAB          00000000 000040 0000.* 00      0   0 .
-  \[ 6\] .symtab           SYMTAB          00000000 0+.* 0+.* 10      7   6 4
-  \[ 7\] .strtab           STRTAB          00000000 0+.* 0+.* 00      0   0 1
+  \[ 0\]                   NULL            00000000 000000 000000 00       0   0 0
+  \[ 1\] .text             PROGBITS        00000000 000034 000008 00  AX   0   0 .
+  \[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0.       .   1 4
+  \[ 3\] .data             PROGBITS        00000000 00003c 000004 00  WA   0   0 .
+  \[ 4\] .bss              NOBITS          00000000 000040 000000 00  WA   0   0 .
+  \[ .\] .shstrtab         STRTAB          00000000 000040 0000.* 00       0   0 .
+  \[ .\] .symtab           SYMTAB          00000000 0+.* 0+.* 10       7   6 4
+  \[ .\] .strtab           STRTAB          00000000 0+.* 0+.* 00       0   0 1
+Key to Flags: W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+              I \(info\), L \(link order\), O \(extra OS processing required\)
+              o \(os specific\), p \(processor specific\) x \(unknown\)
 
diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss
index 3760b38..926612d 100644
--- a/binutils/testsuite/binutils-all/readelf.ss
+++ b/binutils/testsuite/binutils-all/readelf.ss
@@ -1,13 +1,13 @@
 
 Symbol table '.symtab' contains .* entries:
-  Num:    Value  Size Type    Bind   Ot  Ndx Name
-    0:        0     0 NOTYPE  LOCAL   0  UND 
-    1:        0     0 SECTION LOCAL   0    1 
-    2:        0     0 SECTION LOCAL   0    3 
-    3:        0     0 SECTION LOCAL   0    4 
-    4:        0     0 NOTYPE  LOCAL   0    1 static_text_symbol
-    5:        0     0 NOTYPE  LOCAL   0    3 static_data_symbol
-    .:        0     0 NOTYPE  GLOBAL  0    1 text_symbol
-    .:        0     0 NOTYPE  GLOBAL  0  UND external_symbol
-   .*:        0     0 NOTYPE  GLOBAL  0    3 data_symbol
-   .*:        4     4 OBJECT  GLOBAL  0  COM common_symbol
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION LOCAL  DEFAULT    1 
+     2: 00000000     0 SECTION LOCAL  DEFAULT    3 
+     3: 00000000     0 SECTION LOCAL  DEFAULT    4 
+     4: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 static_text_symbol
+     5: 00000000     0 NOTYPE  LOCAL  DEFAULT    3 static_data_symbol
+.*   .: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 text_symbol
+     .: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND external_symbol
+     .: 00000000     0 NOTYPE  GLOBAL DEFAULT    3 data_symbol
+     .: 00000004     4 OBJECT  GLOBAL DEFAULT  COM common_symbol
diff --git a/binutils/testsuite/binutils-all/readelf.wi b/binutils/testsuite/binutils-all/readelf.wi
index 3cb2ecc..e022fff 100644
--- a/binutils/testsuite/binutils-all/readelf.wi
+++ b/binutils/testsuite/binutils-all/readelf.wi
@@ -5,7 +5,7 @@
    Version:       2
    Abbrev Offset: 0
    Pointer Size:  4
-    Abbrev Number: 1 \(DW_TAG_compile_unit\)
+ <.><.*>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
      DW_AT_name        : .*/testprog.c	
      DW_AT_comp_dir    : .*/binutils	
      DW_AT_producer    : GNU C .*	
@@ -13,66 +13,64 @@
      DW_AT_low_pc      : 0	
      DW_AT_high_pc     : .*	
      DW_AT_stmt_list   : 0	
-    Abbrev Number: 2 \(DW_TAG_subprogram\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_subprogram\)
      DW_AT_external    : 1	
      DW_AT_name        : fn	
      DW_AT_decl_file   : 1	
-     DW_AT_decl_line   : a	
+     DW_AT_decl_line   : 10	
      DW_AT_type        : .*	
      DW_AT_low_pc      : 0	
      DW_AT_high_pc     : .*	
      DW_AT_frame_base  : 1 byte block: .*
-    Abbrev Number: 3 \(DW_TAG_base_type\)
+ <.><.*>: Abbrev Number: 3 \(DW_TAG_base_type\)
      DW_AT_name        : int	
      DW_AT_byte_size   : 4	
      DW_AT_encoding    : 5	\(signed\)
-    Abbrev Number: 4 \(DW_TAG_subprogram\)
+ <.><.*>: Abbrev Number: 4 \(DW_TAG_subprogram\)
      DW_AT_sibling     : .*	
      DW_AT_external    : 1	
      DW_AT_name        : main	
      DW_AT_decl_file   : 1	
-     DW_AT_decl_line   : 10	
+     DW_AT_decl_line   : 16	
      DW_AT_type        : .*	
      DW_AT_low_pc      : .*	
      DW_AT_high_pc     : .*	
      DW_AT_frame_base  : 1 byte block: .*
-    Abbrev Number: 5 \(DW_TAG_lexical_block\)
+ <.><.*>: Abbrev Number: 5 \(DW_TAG_lexical_block\)
      DW_AT_low_pc      : .*	
      DW_AT_high_pc     : .*	
-
-   Extra data at end of comp unit:
- .*: Abbrev Number: 6 \(DW_TAG_variable\)
+ <.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
      DW_AT_name        : common	
      DW_AT_decl_file   : 1	
      DW_AT_decl_line   : 3	
-     DW_AT_type        : .*
+     DW_AT_type        : <.*>	
      DW_AT_external    : 1	
-     DW_AT_location    : 5 byte block: 3 . 0 0 0 	\(DW_OP_addr: 0\)
- .*: Abbrev Number: 6 \(DW_TAG_variable\)
+     DW_AT_location    : 5 byte block: 3 0 0 0 0 	\(DW_OP_addr: 0\)
+ <.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
      DW_AT_name        : global	
      DW_AT_decl_file   : 1	
      DW_AT_decl_line   : 4	
-     DW_AT_type        : .*	
+     DW_AT_type        : <.*>	
      DW_AT_external    : 1	
-     DW_AT_location    : 5 byte block: 3 . 0 0 0 	\(DW_OP_addr: 0\)
- .*: Abbrev Number: 7 \(DW_TAG_variable\)
+     DW_AT_location    : 5 byte block: 3 0 0 0 0 	\(DW_OP_addr: 0\)
+ <.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
      DW_AT_name        : local	
      DW_AT_decl_file   : 1	
      DW_AT_decl_line   : 5	
-     DW_AT_type        : .*	
+     DW_AT_type        : <.*>	
      DW_AT_location    : 5 byte block: 3 . 0 0 . 	\(DW_OP_addr: .\)
- .*: Abbrev Number: 8 \(DW_TAG_array_type\)
-     DW_AT_sibling     : .*	
-     DW_AT_type        : .*	
- .*: Abbrev Number: 9 \(DW_TAG_subrange_type\)
+ <.><.*>: Abbrev Number: 8 \(DW_TAG_array_type\)
+     DW_AT_sibling     : <.*>	
+     DW_AT_type        : <.*>	
+ <.><.*>: Abbrev Number: 9 \(DW_TAG_subrange_type\)
      DW_AT_upper_bound : 6	
- .*: Abbrev Number: 3 \(DW_TAG_base_type\)
+ <.><.*>: Abbrev Number: 3 \(DW_TAG_base_type\)
      DW_AT_name        : char	
      DW_AT_byte_size   : 1	
-     DW_AT_encoding    : .	\(.* char\)
- .*: Abbrev Number: 7 \(DW_TAG_variable\)
+     DW_AT_encoding    : 8	\(unsigned char\)
+ <.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
      DW_AT_name        : string	
      DW_AT_decl_file   : 1	
      DW_AT_decl_line   : 6	
-     DW_AT_type        : .*	
+     DW_AT_type        : <.*>	
      DW_AT_location    : 5 byte block: 3 . 0 0 . 	\(DW_OP_addr: .\)
diff --git a/binutils/testsuite/binutils-all/testprog.c b/binutils/testsuite/binutils-all/testprog.c
index 210656b..c2b1856 100644
--- a/binutils/testsuite/binutils-all/testprog.c
+++ b/binutils/testsuite/binutils-all/testprog.c
@@ -1,5 +1,7 @@
 /* This program is used to test objcopy and strip.  */
 
+#include <stdio.h>
+
 int common;
 int global = 1;
 static int local = 2;
diff --git a/binutils/windres.c b/binutils/windres.c
index 7de28c2..3b24b47 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -46,6 +46,10 @@
 #include <ctype.h>
 #include <time.h>
 
+/* used by resrc.c at least */
+
+int verbose = 0;
+
 /* An enumeration of format types.  */
 
 enum res_format
@@ -109,7 +113,9 @@
 #define OPTION_INCLUDE_DIR (OPTION_HELP + 1)
 #define OPTION_LANGUAGE (OPTION_INCLUDE_DIR + 1)
 #define OPTION_PREPROCESSOR (OPTION_LANGUAGE + 1)
-#define OPTION_VERSION (OPTION_PREPROCESSOR + 1)
+#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1)
+#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1)
+#define OPTION_VERSION (OPTION_NO_USE_TEMP_FILE + 1)
 #define OPTION_YYDEBUG (OPTION_VERSION + 1)
 
 static const struct option long_options[] =
@@ -122,6 +128,9 @@
   {"output-format", required_argument, 0, 'O'},
   {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR},
   {"target", required_argument, 0, 'F'},
+  {"use-temp-file", no_argument, 0, OPTION_USE_TEMP_FILE},
+  {"no-use-temp-file", no_argument, 0, OPTION_NO_USE_TEMP_FILE},
+  {"verbose", no_argument, 0, 'v'},
   {"version", no_argument, 0, OPTION_VERSION},
   {"yydebug", no_argument, 0, OPTION_YYDEBUG},
   {0, no_argument, 0, 0}
@@ -705,8 +714,13 @@
   -F TARGET, --target TARGET  Specify COFF target\n\
   --preprocessor PROGRAM      Program to use to preprocess rc file\n\
   --include-dir DIR           Include directory when preprocessing rc file\n\
-  --define SYM[=VAL]          Define SYM when preprocessing rc file\n\
-  --language VAL              Set language when reading rc file\n"));
+  -DSYM[=VAL], --define SYM[=VAL]\n\
+                              Define SYM when preprocessing rc file\n\
+  -v                          Verbose - tells you what it's doing\n\
+  --language VAL              Set language when reading rc file\n\
+  --use-temp-file             Use a temporary file instead of popen to read\n\
+                              the preprocessor output\n\
+  --no-use-temp-file          Use popen (default)\n"));
 #ifdef YYDEBUG
   fprintf (stream, _("\
   --yydebug                   Turn on parser debugging\n"));
@@ -724,6 +738,34 @@
   exit (status);
 }
 
+/* Quote characters that will confuse the shell when we run the preprocessor */
+static const char *quot (string)
+     const char *string;
+{
+  static char *buf = 0;
+  static int buflen = 0;
+  int slen = strlen (string);
+  const char *src;
+  char *dest;
+
+  if ((buflen < slen * 2 + 2) || !buf)
+    {
+      buflen = slen * 2 + 2;
+      if (buf)
+	free (buf);
+      buf = (char *) xmalloc (buflen);
+    }
+
+  for (src=string, dest=buf; *src; src++, dest++)
+    {
+      if (*src == '(' || *src == ')' || *src == ' ')
+	*dest++ = '\\';
+      *dest = *src;
+    }
+  *dest = 0;
+  return buf;
+}
+
 /* The main function.  */
 
 int
@@ -739,8 +781,10 @@
   char *target;
   char *preprocessor;
   char *preprocargs;
+  const char *quotedarg;
   int language;
   struct res_directory *resources;
+  int use_temp_file;
 
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
@@ -764,8 +808,9 @@
   preprocessor = NULL;
   preprocargs = NULL;
   language = -1;
+  use_temp_file = 0;
 
-  while ((c = getopt_long (argc, argv, "i:o:I:O:F:", long_options,
+  while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:v", long_options,
 			   (int *) 0)) != EOF)
     {
       switch (c)
@@ -794,35 +839,44 @@
 	  preprocessor = optarg;
 	  break;
 
+	case 'D':
 	case OPTION_DEFINE:
 	  if (preprocargs == NULL)
 	    {
-	      preprocargs = xmalloc (strlen (optarg) + 3);
-	      sprintf (preprocargs, "-D%s", optarg);
+	      quotedarg = quot (optarg);
+	      preprocargs = xmalloc (strlen (quotedarg) + 3);
+	      sprintf (preprocargs, "-D%s", quotedarg);
 	    }
 	  else
 	    {
 	      char *n;
 
-	      n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4);
-	      sprintf (n, "%s -D%s", preprocargs, optarg);
+	      quotedarg = quot (optarg);
+	      n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4);
+	      sprintf (n, "%s -D%s", preprocargs, quotedarg);
 	      free (preprocargs);
 	      preprocargs = n;
 	    }
 	  break;
 
+	case 'v':
+	  verbose ++;
+	  break;
+
 	case OPTION_INCLUDE_DIR:
 	  if (preprocargs == NULL)
 	    {
-	      preprocargs = xmalloc (strlen (optarg) + 3);
-	      sprintf (preprocargs, "-I%s", optarg);
+	      quotedarg = quot (optarg);
+	      preprocargs = xmalloc (strlen (quotedarg) + 3);
+	      sprintf (preprocargs, "-I%s", quotedarg);
 	    }
 	  else
 	    {
 	      char *n;
 
-	      n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4);
-	      sprintf (n, "%s -I%s", preprocargs, optarg);
+	      quotedarg = quot (optarg);
+	      n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4);
+	      sprintf (n, "%s -I%s", preprocargs, quotedarg);
 	      free (preprocargs);
 	      preprocargs = n;
 	    }
@@ -845,6 +899,14 @@
 	  language = strtol (optarg, (char **) NULL, 16);
 	  break;
 
+	case OPTION_USE_TEMP_FILE:
+	  use_temp_file = 1;
+	  break;
+
+	case OPTION_NO_USE_TEMP_FILE:
+	  use_temp_file = 0;
+	  break;
+
 #ifdef YYDEBUG
 	case OPTION_YYDEBUG:
 	  yydebug = 1;
@@ -904,7 +966,7 @@
       abort ();
     case RES_FORMAT_RC:
       resources = read_rc_file (input_filename, preprocessor, preprocargs,
-				language);
+				language, use_temp_file);
       break;
     case RES_FORMAT_RES:
       resources = read_res_file (input_filename);
diff --git a/binutils/windres.h b/binutils/windres.h
index a3c789a..ba73612 100644
--- a/binutils/windres.h
+++ b/binutils/windres.h
@@ -742,10 +742,12 @@
   unsigned char *data;
 };
 
+extern int verbose;
+
 /* Function declarations.  */
 
 extern struct res_directory *read_rc_file
-  PARAMS ((const char *, const char *, const char *, int));
+  PARAMS ((const char *, const char *, const char *, int, int));
 extern struct res_directory *read_res_file PARAMS ((const char *));
 extern struct res_directory *read_coff_rsrc
   PARAMS ((const char *, const char *));
diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c
index e428174..8b51587 100644
--- a/binutils/wrstabs.c
+++ b/binutils/wrstabs.c
@@ -1,5 +1,5 @@
 /* wrstabs.c -- Output stabs debugging information
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -984,7 +984,7 @@
 stab_function_type (p, argcount, varargs)
      PTR p;
      int argcount;
-     boolean varargs;
+     boolean varargs ATTRIBUTE_UNUSED;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   int i;
@@ -2383,7 +2383,7 @@
 /*ARGSUSED*/
 static boolean
 stab_end_function (p)
-     PTR p;
+     PTR p ATTRIBUTE_UNUSED;
 {
   return true;
 }
diff --git a/config.guess b/config.guess
index 3c75a80..20c971a 100755
--- a/config.guess
+++ b/config.guess
@@ -1,6 +1,7 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 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
@@ -22,7 +23,7 @@
 # the same distribution terms that you use for the rest of that program.
 
 # Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to <config-patches@gnu.org>.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
@@ -35,6 +36,20 @@
 # (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
@@ -46,11 +61,49 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-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
 
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# Netbsd (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	# Determine the machine/vendor (is the vendor relevant).
+	case "${UNAME_MACHINE}" in
+	    amiga) machine=m68k-cbm ;;
+	    arm32) machine=arm-unknown ;;
+	    atari*) machine=m68k-atari ;;
+	    sun3*) machine=m68k-sun ;;
+	    mac68k) machine=m68k-apple ;;
+	    macppc) machine=powerpc-apple ;;
+	    hp3[0-9][05]) machine=m68k-hp ;;
+	    ibmrt|romp-ibm) machine=romp-ibm ;;
+	    *) machine=${UNAME_MACHINE}-unknown ;;
+	esac
+	# The Operating System including object format.
+	if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep __ELF__ >/dev/null
+	then
+	    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+	    # Return netbsd for either.  FIX?
+	    os=netbsd
+	else
+	    os=netbsdelf
+	fi
+	# The OS release
+	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
     alpha:OSF1:*:*)
 	if test $UNAME_RELEASE = "V4.0"; then
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -59,56 +112,69 @@
 	# 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
+	.data
+\$Lformat:
+	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+	.text
 	.globl main
+	.align 4
 	.ent main
 main:
-	.frame \$30,0,\$26,0
-	.prologue 0
-	.long 0x47e03d80 # implver $0
-	lda \$2,259
-	.long 0x47e20c21 # amask $2,$1
-	srl \$1,8,\$2
-	sll \$2,2,\$2
-	sll \$0,3,\$0
-	addl \$1,\$0,\$0
-	addl \$2,\$0,\$0
-	ret \$31,(\$26),1
+	.frame \$30,16,\$26,0
+	ldgp \$29,0(\$27)
+	.prologue 1
+	.long 0x47e03d80 # implver \$0
+	lda \$2,-1
+	.long 0x47e20c21 # amask \$2,\$1
+	lda \$16,\$Lformat
+	mov \$0,\$17
+	not \$1,\$18
+	jsr \$26,printf
+	ldgp \$29,0(\$26)
+	mov 0,\$16
+	jsr \$26,exit
 	.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
-		case "$?" in
-			7)
+		case `./$dummy` in
+			0-0)
 				UNAME_MACHINE="alpha"
 				;;
-			15)
+			1-0)
 				UNAME_MACHINE="alphaev5"
 				;;
-			14)
+			1-1)
 				UNAME_MACHINE="alphaev56"
 				;;
-			10)
+			1-101)
 				UNAME_MACHINE="alphapca56"
 				;;
-			16)
+			2-303)
 				UNAME_MACHINE="alphaev6"
 				;;
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
 		esac
 	fi
-	rm -f dummy.s dummy
+	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 ;;
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-cbm-sysv4
 	exit 0;;
-    amiga:NetBSD:*:*)
-      echo m68k-cbm-netbsd${UNAME_RELEASE}
-      exit 0 ;;
     amiga:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -133,16 +199,16 @@
     wgrisc:OpenBSD:*:*)
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit 0;;
-    arm32:NetBSD:*:*)
-	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
     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
@@ -150,7 +216,7 @@
 		echo pyramid-pyramid-bsd
 	fi
 	exit 0 ;;
-    NILE:*:*:dcosx)
+    NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
     sun4H:SunOS:5.*:*)
@@ -195,21 +261,38 @@
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
 	exit 0 ;;
-    atari*:NetBSD:*:*)
-	echo m68k-atari-netbsd${UNAME_RELEASE}
-	exit 0 ;;
     atari*:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    sun3*:NetBSD:*:*)
-	echo m68k-sun-netbsd${UNAME_RELEASE}
+    # 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*:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    mac68k:NetBSD:*:*)
-	echo m68k-apple-netbsd${UNAME_RELEASE}
-	exit 0 ;;
     mac68k:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -231,12 +314,17 @@
     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
+#include <stdio.h>  /* for printf() prototype */
+	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);
@@ -251,10 +339,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:*:*)
@@ -272,15 +360,18 @@
     AViiON:dgux:*:*)
         # 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 \
-	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${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)
 	echo m88k-dolphin-sysv3
@@ -306,7 +397,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()
@@ -317,8 +408,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
@@ -327,7 +418,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
@@ -345,7 +437,7 @@
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
 	exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
 	exit 0 ;;                           # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
@@ -360,33 +452,29 @@
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
 	echo m68k-hp-bsd4.4
 	exit 0 ;;
-    *9??*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit 0 ;;
     9000/[34678]??:HP-UX:*:*)
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/[678][0-9][0-9] )
-
-              sed 's/^              //' << EOF >dummy.c
+	    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 
+              #endif
                   long cpu  = sysconf (_SC_CPU_VERSION);
-              
-                  switch (cpu) 
+
+                  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: 
+              	case CPU_PA_RISC2_0:
               #if defined(_SC_KERNEL_BITS)
-              	    switch (bits) 
+              	    switch (bits)
               		{
               		case 64: puts ("hppa2.0w"); break;
               		case 32: puts ("hppa2.0n"); break;
@@ -394,20 +482,20 @@
               		} break;
               #else  /* !defined(_SC_KERNEL_BITS) */
               	    puts ("hppa2.0"); break;
-              #endif 
+              #endif
               	default: puts ("hppa1.0"); break;
               	}
                   exit (0);
               }
 EOF
-	(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
-	rm -f dummy.c dummy
+	(CCOPTS= $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 ()
@@ -432,8 +520,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:*:* )
@@ -442,6 +530,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 ;;
@@ -491,7 +582,13 @@
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
 	exit 0 ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE}
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'    
 	exit 0 ;;
     CRAY-2:*:*:*)
 	echo cray2-cray-unicos
@@ -504,15 +601,18 @@
     F301:UNIX_System_V:*:*)
        echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
        exit 0 ;;
-    hp3[0-9][05]:NetBSD:*:*)
-	echo m68k-hp-netbsd${UNAME_RELEASE}
-	exit 0 ;;
     hp300:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    i?86:BSD/386:*:* | *:BSD/OS:*:*)
+    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:*:*)
 	if test -x /usr/bin/objformat; then
 	    if test "elf" = "`/usr/bin/objformat`"; then
@@ -520,32 +620,28 @@
 		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/[-_].*/\./'`
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit 0 ;;
     *:OpenBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
-    i*:[Cc][Yy][Gg][Ww][Ii][Nn]*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin32
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
 	exit 0 ;;
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-        # How do we know it's Interix rather than generic posix subsystem?
+	# 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
-	# change UNAME_MACHINE based on the output of uname instead of
-	# i386?
+	# 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
+	echo powerpcle-unknown-cygwin
 	exit 0 ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -554,16 +650,11 @@
 	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
@@ -571,14 +662,41 @@
 				    s/ .*//
 				    p'`
         case "$ld_supported_emulations" in
-	  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)
+	  *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
+		;;
+	  elf32arm*)
+		echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
+		exit 0
+		;;
+	  armelf_linux*)
+		echo "${UNAME_MACHINE}-unknown-linux-gnu"
+		exit 0
+		;;
+	  m68klinux)
+		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+		exit 0
+		;;
+	  elf32ppc | elf32ppclinux)
 		# Determine Lib Version
-		cat >dummy.c <<EOF
+		cat >$dummy.c <<EOF
 #include <features.h>
 #if defined(__GLIBC__)
 extern char __libc_version[];
@@ -597,71 +715,85 @@
 }
 EOF
 		LIBC=""
-		${CC-cc} dummy.c -o dummy 2>/dev/null
+		$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
 		if test "$?" = 0 ; then
-			./dummy | grep 1\.99 > /dev/null
+			./$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 ;;
+		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
-		.globl main
-		.ent main
-	main:
-		.frame \$30,0,\$26,0
-		.prologue 0
-		.long 0x47e03d80 # implver $0
-		lda \$2,259
-		.long 0x47e20c21 # amask $2,$1
-		srl \$1,8,\$2
-		sll \$2,2,\$2
-		sll \$0,3,\$0
-		addl \$1,\$0,\$0
-		addl \$2,\$0,\$0
-		ret \$31,(\$26),1
-		.end main
+		cat <<EOF >$dummy.s
+			.data
+		\$Lformat:
+			.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+			.text
+			.globl main
+			.align 4
+			.ent main
+		main:
+			.frame \$30,16,\$26,0
+			ldgp \$29,0(\$27)
+			.prologue 1
+			.long 0x47e03d80 # implver \$0
+			lda \$2,-1
+			.long 0x47e20c21 # amask \$2,\$1
+			lda \$16,\$Lformat
+			mov \$0,\$17
+			not \$1,\$18
+			jsr \$26,printf
+			ldgp \$29,0(\$26)
+			mov 0,\$16
+			jsr \$26,exit
+			.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
-			case "$?" in
-			7)
+			case `./$dummy` in
+			0-0)
 				UNAME_MACHINE="alpha"
 				;;
-			15)
+			1-0)
 				UNAME_MACHINE="alphaev5"
 				;;
-			14)
+			1-1)
 				UNAME_MACHINE="alphaev56"
 				;;
-			10)
+			1-101)
 				UNAME_MACHINE="alphapca56"
 				;;
-			16)
+			2-303)
 				UNAME_MACHINE="alphaev6"
 				;;
-			esac	
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
+			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
+		fi
+		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
+#include <stdio.h>  /* for printf() prototype */
+	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
@@ -671,8 +803,10 @@
   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
+	elif test "${UNAME_MACHINE}" = "s390"; then
+	  echo s390-ibm-linux && exit 0
 	else
 	  # Either a pre-BFD a.out linker (linux-gnuoldld)
 	  # or one that does not give us useful --help.
@@ -691,12 +825,14 @@
 	    ;;
 	  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
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 #ifdef __ELF__
 # ifdef __GLIBC__
 #  if __GLIBC__ >= 2
@@ -713,8 +849,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
 	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.
@@ -730,24 +866,22 @@
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit 0 ;;
     i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	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
-# 5.0.4c returns "Pent II".  5.0.5 returns PentII
-       (/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}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
-       exit 0 ;;
+    i?86:*:5:7*)
+        # Fixed at (any) Pentium or better
+        UNAME_MACHINE=i586
+        if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+	    echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
+	else
+	    echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+	fi
+	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`
@@ -757,18 +891,20 @@
 		(/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.*PentII' >/dev/null) \
+		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		(/bin/uname -X|egrep '^Machine.*Pent II' >/dev/null) \
+		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/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
 	fi
 	exit 0 ;;
+    i?86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
     pc:*:*:*)
+	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
@@ -809,7 +945,7 @@
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit 0 ;;
-    i?86:LynxOS:2.*:*)
+    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
@@ -821,6 +957,9 @@
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
 	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
 	exit 0 ;;
@@ -851,7 +990,7 @@
     news*:NEWS-OS:*:6*)
 	echo mips-sony-newsos6
 	exit 0 ;;
-    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
@@ -867,12 +1006,33 @@
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	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 ;;
+    Power*:Mac*OS:*:*)
+	echo powerpc-apple-macos${UNAME_RELEASE}
+	exit 0 ;;
+    *:Mac*OS:*:*)
+	echo ${UNAME_MACHINE}-apple-macos${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-qnx-qnx${UNAME_VERSION}
+	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>
@@ -910,7 +1070,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
 
@@ -970,8 +1133,8 @@
 }
 EOF
 
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD $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/config.sub b/config.sub
index 3d4f5fd..5d75624 100755
--- a/config.sub
+++ b/config.sub
@@ -1,6 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+#   Free Software Foundation, Inc.
+#
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # can handle that machine.  It does not imply ALL GNU software can.
@@ -25,6 +27,9 @@
 # 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.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
@@ -64,18 +69,6 @@
 	;;
 esac
 
-# CYGNUS LOCAL marketing-names
-# Here we handle any "marketing" names - translating them to
-#  standard triplets
-case $1 in 
-	mips-tx39-elf)
-		set mipstx39-unknown-elf
-                ;;
-	*)
-		;;
-esac
-# END CYGNUS LOCAL marketing-names
-
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
@@ -110,14 +103,14 @@
 		os=
 		basic_machine=$1
 		;;
-	-sim | -cisco | -oki | -wec | -winbond )	# EGCS LOCAL
+	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
 		;;
-	-scout)						# EGCS LOCAL
+	-scout)
 		;;
-	-wrs)						# EGCS LOCAL
-		os=vxworks
+	-wrs)
+		os=-vxworks
 		basic_machine=$1
 		;;
 	-hiux*)
@@ -168,74 +161,34 @@
 	-psos*)
 		os=-psos
 		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 esac
 
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
-		| arme[lb] | pyramid | mn10200 | mn10300 \
-		| tron | a29k | 580 | i960 | h8300 \
+	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[45678] | alphaev56 | alphapca5[67] \
+		| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
+		| alphaev6[78] \
 		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
-		| 1750a | dsp16xx | pdp11 \
-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
-		| mipstx39 | mipstx39el \
-		| sparc | sparclet | sparclite | sparc64 | sparc86x | v850 \
-		| c4x)
+		| 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)
 		basic_machine=$basic_machine-unknown
 		;;
-	m88110 | m680[012346]0 | m683?2 | m68360 | m5200 | z8k | v70 \
-		| h8500 | w65 | fr30 | mcore) # CYGNUS / EGCS LOCAL
-		basic_machine=$basic_machine-unknown
-		;;
-	strongarm) # CYGNUS LOCAL nickc/strongarm
-		basic_machine=$basic_machine-unknown
-		;;
-	thumb)
-		basic_machine=$basic_machine-unknown
-		;;
-        # CYGNUS LOCAL vr4111/gavin
-	mips64vr4111 | mips64vr4111el)
-		basic_machine=$basic_machine-unknown
-		;;
-        # END CYGNUS LOCAL vr4111/gavin
-	mips64vr4300 | mips64vr4300el) # EGCS LOCAL jsmith/vr4300
-		basic_machine=$basic_machine-unknown
-		;;
-	mips64vr4100 | mips64vr4100el) # EGCS LOCAL jsmith/vr4100
-		basic_machine=$basic_machine-unknown
-		;;
-	mips64vr5000 | mips64vr5000el) # EGCS LOCAL ian/vr5000
-		basic_machine=$basic_machine-unknown
-		;;
-	mips16)
-		basic_machine=$basic_machine-unknown
-		;;
-	tic30) # CYGNUS LOCAL ian/tic30
-		basic_machine=$basic_machine-unknown
-		;;
-	c30) # CYGNUS LOCAL ian/tic30
-		basic_machine=tic30-unknown
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
 		;;
 
-	tic80)				# CYGNUS LOCAL fnf/TIc80
-		basic_machine=$basic_machine-unknown
-		;;
-	v850e)				# CYGNUS LOCAL jtc/v850
-		basic_machine=$basic_machine-unknown
-		;;
-	v850ea)				# CYGNUS LOCAL jtc/v850
-		basic_machine=$basic_machine-unknown
-		;;
-	d10v)
-		basic_machine=$basic_machine-unknown
-		;;
-	d30v)				# CYGNUS LOCAL hunt/d30v
-		basic_machine=$basic_machine-unknown
-		;;
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -248,57 +201,29 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+	# 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-* | i960-* \
+	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
 	      | xmp-* | ymp-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* \
-	      | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
-	      | alpha-* | alphaev[45678]-* | alphaev56-* | alphapca5[67]-* \
-	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
-	      | xps100-* | clipper-* | orion-* \
+	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
+	      | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
+	      | alphaev6[78]-* \
+	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+	      | clipper-* | orion-* \
 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
-	      | sparc64-* | sparcv9-* | sparc86x-* | mips64-* | mipsel-* \
-	      | mips64el-* | mips64orion-* | mips64orionel-*  \
-	      | mipstx39-* | mipstx39el-* \
-	      | f301-* | arm*-* \
-	      | fr30-* | mcore-*) # CYGNUS LOCAL
-		;;
-	m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # EGCS LOCAL
-		;;
-	strongarm-*) # CYGNUS LOCAL nickc/strongarm
-		;;
-	thumb-*) # EGCS LOCAL angela/thumb
-		;;
-	v850-*) # EGCS LOCAL
-	        ;;
-	v850e-*) # CYGNUS LOCAL
-	        ;;
-	v850ea-*) # CYGNUS LOCAL
-	        ;;
-	d30v-*) # EGCS LOCAL
-	        ;;
-        # CYGNUS LOCAL vr4111/gavin
-	mips64vr4111-* | mips64vr4111el-*)
-		;;
-        # END CYGNUS LOCAL vr4111/gavin
-	mips64vr4300-* | mips64vr4300el-*) # EGCS LOCAL jsmith/vr4300
-		;;
-	mips64vr4100-* | mips64vr4100el-*) # EGCS LOCAL jsmith/vr4100
-		;;
-	mips16-*) # EGCS LOCAL krk/mips16
-		;;
-	tic30-*) # EGCS LOCAL ian/tic30
-		;;
-	c30-*) # EGCS LOCAL ian/tic30
-		basic_machine=tic30-unknown
-		;;
-	tic80-*)						# CYGNUS LOCAL fnf/TIc80
+	      | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-* \
+	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+	      | mipstx39-* | mipstx39el-* | mcore-* \
+	      | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
+	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
-	386bsd)						# EGCS LOCAL
+	386bsd)
 		basic_machine=i386-unknown
 		os=-bsd
 		;;
@@ -308,11 +233,11 @@
 	3b*)
 		basic_machine=we32k-att
 		;;
-	a29khif)					# EGCS LOCAL
+	a29khif)
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-	adobe68k)					# EGCS LOCAL
+	adobe68k)
 		basic_machine=m68010-adobe
 		os=-scout
 		;;
@@ -345,7 +270,7 @@
 		basic_machine=m68k-apollo
 		os=-sysv
 		;;
-	apollo68bsd)					# EGCS LOCAL
+	apollo68bsd)
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
@@ -425,7 +350,7 @@
 	encore | umax | mmax)
 		basic_machine=ns32k-encore
 		;;
-	es1800 | OSE68k | ose68k | ose | OSE)		# EGCS LOCAL
+	es1800 | OSE68k | ose68k | ose | OSE)
 		basic_machine=m68k-ericsson
 		os=-ose
 		;;
@@ -447,11 +372,11 @@
 		basic_machine=h8300-hitachi
 		os=-hms
 		;;
-	h8300xray)					# EGCS LOCAL
+	h8300xray)
 		basic_machine=h8300-hitachi
 		os=-xray
 		;;
-	h8500hms)					# EGCS LOCAL
+	h8500hms)
 		basic_machine=h8500-hitachi
 		os=-hms
 		;;
@@ -470,22 +395,6 @@
 		basic_machine=m68k-hp
 		os=-hpux
 		;;
-        w89k-*)						# EGCS LOCAL
-                basic_machine=hppa1.1-winbond
-                os=-proelf
-                ;;
-        op50n-*)					# EGCS LOCAL
-                basic_machine=hppa1.1-oki
-                os=-proelf
-                ;;
-        op60c-*)					# EGCS LOCAL
-                basic_machine=hppa1.1-oki
-                os=-proelf
-                ;;
-        hppro)						# EGCS LOCAL
-                basic_machine=hppa1.1-hp
-                os=-proelf
-                ;;
 	hp3k9[0-9][0-9] | hp9[0-9][0-9])
 		basic_machine=hppa1.0-hp
 		;;
@@ -495,22 +404,21 @@
 	hp9k3[2-9][0-9])
 		basic_machine=m68k-hp
 		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9] )
+	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] )
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
 		basic_machine=hppa1.1-hp
 		;;
-	hp9k78[0-9] | hp78[0-9] )
+	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 )
+	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] )
+	hp9k8[0-9][13679] | hp8[0-9][13679])
 		basic_machine=hppa1.1-hp
 		;;
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -519,13 +427,16 @@
 	hppa-next)
 		os=-nextstep3
 		;;
-	hppaosf)					# EGCS LOCAL
+	hppaosf)
 		basic_machine=hppa1.1-hp
 		os=-osf
 		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
-		os=-mvs
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i[34567]86v32)
@@ -544,15 +455,15 @@
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
-	i386mach)					# EGCS LOCAL
+	i386mach)
 		basic_machine=i386-mach
 		os=-mach
 		;;
-	i386-vsta | vsta)				# EGCS LOCAL
+	i386-vsta | vsta)
 		basic_machine=i386-unknown
 		os=-vsta
 		;;
-	i386-go32 | go32)				# EGCS LOCAL
+	i386-go32 | go32)
 		basic_machine=i386-unknown
 		os=-go32
 		;;
@@ -560,6 +471,9 @@
 		basic_machine=i386-unknown
 		os=-mingw32
 		;;
+	i386-qnx | qnx)
+		basic_machine=i386-qnx
+		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
@@ -588,6 +502,10 @@
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 	mipsel*-linux*)
 		basic_machine=mipsel-unknown
 		os=-linux-gnu
@@ -602,24 +520,32 @@
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
-	monitor)					# EGCS LOCAL
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
-	msdos)						# EGCS LOCAL
-		basic_machine=i386-unknown	
+	msdos)
+		basic_machine=i386-unknown
 		os=-msdos
 		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
 		;;
 	netbsd386)
-		basic_machine=i386-unknown		# EGCS LOCAL
+		basic_machine=i386-unknown
 		os=-netbsd
 		;;
 	netwinder)
-		basic_machine=armv4l-corel
+		basic_machine=armv4l-rebel
 		os=-linux
 		;;
 	news | news700 | news800 | news900)
@@ -634,7 +560,7 @@
 		basic_machine=mips-sony
 		os=-newsos
 		;;
-	necv70)						# EGCS LOCAL
+	necv70)
 		basic_machine=v70-nec
 		os=-sysv
 		;;
@@ -663,18 +589,22 @@
 		basic_machine=i960-intel
 		os=-nindy
 		;;
-	mon960)						# EGCS LOCAL
+	mon960)
 		basic_machine=i960-intel
 		os=-mon960
 		;;
 	np1)
 		basic_machine=np1-gould
 		;;
-	OSE68000 | ose68000)				# EGCS LOCAL
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
 		;;
-	os68k)						# EGCS LOCAL
+	os68k)
 		basic_machine=m68k-none
 		os=-os68k
 		;;
@@ -695,19 +625,19 @@
         pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | nexen)
+	pentium | p5 | k5 | k6 | nexen)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | k6 | 6x86)
+	pentiumpro | p6 | 6x86)
 		basic_machine=i686-pc
 		;;
 	pentiumii | pentium2)
 		basic_machine=i786-pc
 		;;
-	pentium-* | p5-* | k5-* | nexen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexen-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-* | k6-* | 6x86-*)
+	pentiumpro-* | p6-* | 6x86-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-*)
@@ -731,7 +661,7 @@
 	ps2)
 		basic_machine=i386-ibm
 		;;
-	rom68k)						# EGCS LOCAL
+	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
@@ -741,7 +671,7 @@
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
-	sa29200)					# EGCS LOCAL
+	sa29200)
 		basic_machine=a29k-amd
 		os=-udi
 		;;
@@ -752,7 +682,7 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sparclite-wrs)					# EGCS LOCAL
+	sparclite-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -763,10 +693,10 @@
 	spur)
 		basic_machine=spur-unknown
 		;;
-	st2000)						# EGCS LOCAL
+	st2000)
 		basic_machine=m68k-tandem
 		;;
-	stratus)					# EGCS LOCAL
+	stratus)
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
@@ -810,10 +740,18 @@
 	sun386 | sun386i | roadrunner)
 		basic_machine=i386-sun
 		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
 	symmetry)
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+	t3e)
+		basic_machine=t3e-cray
+		os=-unicos
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -831,7 +769,7 @@
 		basic_machine=a29k-nyu
 		os=-sym1
 		;;
-	v810 | necv810)					# EGCS LOCAL
+	v810 | necv810)
 		basic_machine=v810-nec
 		os=-none
 		;;
@@ -858,9 +796,13 @@
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
-	w65*)						# EGCS LOCAL
- 		basic_machine=w65-wdc
- 		os=-none
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
 		;;
 	xmp)
 		basic_machine=xmp-cray
@@ -869,7 +811,7 @@
         xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
-	z8k-*-coff)					# EGCS LOCAL
+	z8k-*-coff)
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
@@ -880,13 +822,13 @@
 
 # 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)						# EGCS LOCAL
+	w89k)
 		basic_machine=hppa1.1-winbond
 		;;
-	op50n)						# EGCS LOCAL
+	op50n)
 		basic_machine=hppa1.1-oki
 		;;
-	op60c)						# EGCS LOCAL
+	op60c)
 		basic_machine=hppa1.1-oki
 		;;
 	mips)
@@ -923,16 +865,16 @@
 	orion105)
 		basic_machine=clipper-highlevel
 		;;
-	mac | mpw | mac-mpw)				# EGCS LOCAL
+	mac | mpw | mac-mpw)
 		basic_machine=m68k-apple
 		;;
-	pmac | pmac-mpw)				# EGCS LOCAL
+	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
- 	c4x*)
- 		basic_machine=c4x-none
- 		os=-coff
-  		;;
+	c4x*)
+		basic_machine=c4x-none
+		os=-coff
+		;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
@@ -991,18 +933,16 @@
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* )
+	      | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
-	# EGCS LOCAL
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug |  -netware* | -os9* | -beos* \
-	      | -macos* | -mpw* | -magic* | -mon960* | -lnews* )
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
-	# END EGCS LOCAL
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -1012,6 +952,12 @@
 	-sunos6*)
 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
 		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
 	-osfrose*)
 		os=-osfrose
 		;;
@@ -1027,7 +973,7 @@
 	-acis*)
 		os=-aos
 		;;
-	-386bsd)					# EGCS LOCAL
+	-386bsd)
 		os=-bsd
 		;;
 	-ctix* | -uts*)
@@ -1049,6 +995,9 @@
 	-oss*)
 		os=-sysv3
 		;;
+        -qnx)
+		os=-qnx4
+		;;
 	-svr4)
 		os=-sysv4
 		;;
@@ -1061,15 +1010,18 @@
 	# This must come after -sysvr4.
 	-sysv*)
 		;;
-	-ose*)						# EGCS LOCAL
+	-ose*)
 		os=-ose
 		;;
-	-es1800*)					# EGCS LOCAL
+	-es1800*)
 		os=-ose
 		;;
 	-xenix)
 		os=-xenix
 		;;
+        -*mint | -*MiNT)
+	        os=-mint
+		;;
 	-none)
 		;;
 	*)
@@ -1095,7 +1047,7 @@
 	*-acorn)
 		os=-riscix1.2
 		;;
-	arm*-corel)
+	arm*-rebel)
 		os=-linux
 		;;
 	arm*-semi)
@@ -1119,15 +1071,15 @@
 		# default.
 		# os=-sunos4
 		;;
-	m68*-cisco)					# EGCS LOCAL
+	m68*-cisco)
 		os=-aout
 		;;
-	mips*-cisco)					# EGCS LOCAL
+	mips*-cisco)
 		os=-elf
 		;;
-        mips*-*)                                        # EGCS LOCAL
-                os=-elf
-                ;;
+	mips*-*)
+		os=-elf
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -1140,13 +1092,13 @@
 	*-ibm)
 		os=-aix
 		;;
-	*-wec)						# EGCS LOCAL
+	*-wec)
 		os=-proelf
 		;;
-	*-winbond)					# EGCS LOCAL
+	*-winbond)
 		os=-proelf
 		;;
-	*-oki)						# EGCS LOCAL
+	*-oki)
 		os=-proelf
 		;;
 	*-hp)
@@ -1212,15 +1164,18 @@
 	f301-fujitsu)
 		os=-uxpv
 		;;
-	*-rom68k)					# EGCS LOCAL
+	*-rom68k)
 		os=-coff
 		;;
-	*-*bug)						# EGCS LOCAL
+	*-*bug)
 		os=-coff
 		;;
-	*-apple)					# EGCS LOCAL
+	*-apple)
 		os=-macos
 		;;
+	*-atari*)
+		os=-mint
+		;;
 	*)
 		os=-none
 		;;
@@ -1266,7 +1221,7 @@
 			-genix*)
 				vendor=ns
 				;;
-			-mvs*)
+			-mvs* | -opened*)
 				vendor=ibm
 				;;
 			-ptx*)
@@ -1278,12 +1233,15 @@
 			-aux*)
 				vendor=apple
 				;;
-			-hms*)				# EGCS LOCAL
+			-hms*)
 				vendor=hitachi
 				;;
-			-mpw* | -macos*)		# EGCS LOCAL
+			-mpw* | -macos*)
 				vendor=apple
 				;;
+			-*mint | -*MiNT)
+				vendor=atari
+				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
diff --git a/config/ChangeLog b/config/ChangeLog
index 7d6fc60..b5746b1 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,17 @@
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* mh-i370pic: New file.
+	* mt-i370pic: New file.
+
+2000-02-22  Nick Clifton  <nickc@cygnus.com>
+
+	* config/mt-wince: new file: Makefile fragment for WinCE targets.
+
+2000-01-06  Geoff Keating  <geoffk@cygnus.com>
+
+	* mh-aix43: Delete, move to mt-aix43.
+	* mt-aix43: 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/mh-i370pic b/config/mh-i370pic
new file mode 100644
index 0000000..35cf2c8
--- /dev/null
+++ b/config/mh-i370pic
@@ -0,0 +1 @@
+PICFLAG=-fPIC
diff --git a/config/mh-aix43 b/config/mt-aix43
similarity index 100%
rename from config/mh-aix43
rename to config/mt-aix43
diff --git a/config/mt-i370pic b/config/mt-i370pic
new file mode 100644
index 0000000..35b8c9e
--- /dev/null
+++ b/config/mt-i370pic
@@ -0,0 +1 @@
+PICFLAG_FOR_TARGET=-fPIC
diff --git a/config/mt-wince b/config/mt-wince
new file mode 100644
index 0000000..cc7d67b
--- /dev/null
+++ b/config/mt-wince
@@ -0,0 +1,10 @@
+# For Windows CE, we need to build the program that converts, copies,
+# and renames the platform SDK files into gcc directories.
+
+EXTRA_TARGET_HOST_ALL_MODULES:=$(EXTRA_TARGET_HOST_ALL_MODULES) all-utils
+EXTRA_TARGET_HOST_INSTALL_MODULES:=$(EXTRA_TARGET_HOST_INSTALL_MODULES) install-utils
+
+all-utils : all-libiberty
+
+install-utils : all-libiberty
+
diff --git a/configure b/configure
index cad60b7..c5f0291 100755
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
 
 # Configuration script
-# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
+# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -587,12 +587,12 @@
 # the gcc version number changes.
 if [ "${with_gcc_version_trigger+set}" = set ]; then
     gcc_version_trigger="$with_gcc_version_trigger"
-    gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}`
+    gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
 else
     # If gcc's sources are available, define the trigger file.
     if [ -f ${topsrcdir}/gcc/version.c ] ; then
 	gcc_version_trigger=${topsrcdir}/gcc/version.c
-	gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}`
+	gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
 	case "$arguments" in
 	  *--with-gcc-version-trigger=$gcc_version_trigger* )
 	    ;;
@@ -655,8 +655,8 @@
 *) ;;
 esac
 
-# keep this filename short for &%*%$*# 14 char file names
-tmpfile=${TMPDIR}/cONf$$
+# keep this filename short for &%*%$*# 14 char file names and 8+3 file names
+tmpfile=${TMPDIR}/cNf$$
 # Note that under many versions of sh a trap handler for 0 will *override* any
 # exit status you explicitly specify!  At this point, the only non-error exit
 # is at the end of the script; these actions are duplicated there, minus
@@ -902,6 +902,9 @@
   test -n "$DEFAULT_LEX" && break
 done
 
+# BINUTILS LOCAL: This is included in the default CFLAGS when using gcc.
+warn_cflags="-W -Wall"
+
 if [ "${build}" != "${host}" ]; then
   # If we are doing a Canadian Cross, in which the host and build systems
   # are not the same, we set reasonable default values for the tools.
@@ -935,7 +938,7 @@
   AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
   BISON=${BISON-bison}
   CC=${CC-${host_alias}-gcc}
-  CFLAGS=${CFLAGS-"-g -O2"}
+  CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
   CXX=${CXX-${host_alias}-c++}
   CXXFLAGS=${CXXFLAGS-"-g -O2"}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
@@ -1015,10 +1018,10 @@
 	CC="gcc"
 	echo 'void f(){}' > conftest.c
 	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
-	  CFLAGS=${CFLAGS-"-g -O2"}
+	  CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
 	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
 	else
-	  CFLAGS=${CFLAGS-"-O2"}
+	  CFLAGS=${CFLAGS-"-O2 ${warn_cflags}"}
 	  CXXFLAGS=${CXXFLAGS-"-O2"}
 	fi
 	rm -f conftest*
@@ -1035,10 +1038,10 @@
       *gcc)
 	echo 'void f(){}' > conftest.c
 	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
-	  CFLAGS=${CFLAGS-"-g -O2"}
+	  CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
 	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
 	else
-	  CFLAGS=${CFLAGS-"-O2"}
+	  CFLAGS=${CFLAGS-"-O2 ${warn_cflags}"}
 	  CXXFLAGS=${CXXFLAGS-"-O2"}
 	fi
 	rm -f conftest*
@@ -1057,6 +1060,21 @@
 export CFLAGS
 export CXXFLAGS
 
+# FIXME: This should be in configure.in, not configure
+case "$host" in
+	*go32*)
+	    enable_gdbtk=no ;;
+	*msdosdjgpp*)
+	    enable_gdbtk=no ;;
+esac
+
+# FIXME: This should be in configure.in, not configure
+# Determine whether gdb needs tk/tcl or not.
+if [ "$enable_gdbtk" != "no" ]; then
+	GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
+else
+	GDB_TK=""
+fi
 
 for subdir in . ${subdirs} ; do
 
@@ -1398,6 +1416,8 @@
 		    -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
   
+	    sed -e "s:^GDB_TK[	 ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
+	    mv -f ${Makefile}.tem ${Makefile}
 
 	    # If this is a Canadian Cross, preset the values of many more
 	    # tools.
diff --git a/configure.bat b/configure.bat
deleted file mode 100644
index d76a37e..0000000
--- a/configure.bat
+++ /dev/null
@@ -1,17 +0,0 @@
-@echo off

-

-chdir libiberty

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\bfd

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\opcodes

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\gprof

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\binutils

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\gas

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\ld

-call configure %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..

diff --git a/configure.in b/configure.in
index e4e5c43..ca1b04f 100644
--- a/configure.in
+++ b/configure.in
@@ -14,7 +14,7 @@
 ## For more information on these two systems, check out the documentation
 ## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).  
 
-#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc.
+#   Copyright (C) 1992-99, 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
@@ -223,9 +223,6 @@
   *-*-lynxos*)
     host_makefile_frag="${host_makefile_frag} config/mh-lynxos"
     ;;
-  *-*-aix4.[3456789]* | *-*-aix[56789].*)
-    host_makefile_frag="${host_makefile_frag} config/mh-aix43"
-    ;;
   *-*-sysv4*)
     host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
     ;;
@@ -291,6 +288,9 @@
     i[3456]86-*-*)
       host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
       ;;
+    i370-*-*)
+      host_makefile_frag="${host_makefile_frag} config/mh-i370pic"
+      ;;
     sparc64-*-*)
       host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
       ;;
@@ -329,9 +329,15 @@
   powerpc-*-netware*)
     target_makefile_frag="${target_makefile_frag} config/mt-netware"
     ;;
-  *-*-linux-gnu)
+  *-*-linux-gnu*)
     target_makefile_frag="${target_makefile_frag} config/mt-linux"
     ;;
+  *-*-aix4.[3456789]* | *-*-aix[56789].*)
+    target_makefile_frag="${target_makefile_frag} config/mt-aix43"
+    ;;
+  mips*-*-pe | sh*-*-pe | *arm-wince-pe)
+    target_makefile_frag="${target_makefile_frag} config/mt-wince"
+    ;;
 esac
 
 # If --enable-target-optspace always use -Os instead of -O2 to build
@@ -341,7 +347,6 @@
   yes:*)
     target_makefile_frag="${target_makefile_frag} config/mt-ospace"
     ;;
-  # CYGNUS LOCAL d10v, d30v, fr30
   :d30v-*)
     target_makefile_frag="${target_makefile_frag} config/mt-d30v"
     ;;
@@ -523,13 +528,13 @@
 	;;
   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"
-     noconfigdirs="expect dejagnu cvs autoconf automake send-pr gprof rcs guile perl texinfo apache inet libtool"
+     noconfigdirs="expect dejagnu cvs autoconf automake send-pr rcs guile perl texinfo apache inet libtool"
 	;;
   i[3456]86-*-beos*)
      noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
      ;;
   *-*-cygwin*)
-     noconfigdirs="autoconf automake send-pr gprof rcs guile perl texinfo apache inet"
+     noconfigdirs="autoconf automake send-pr rcs guile perl texinfo apache inet"
     ;;
   *-*-netbsd*)
     noconfigdirs="rcs"
@@ -569,6 +574,21 @@
     # newlib is not 64 bit ready
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  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 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"
+    skipdirs="$skipdirs target-newlib"
+    case "${host}" in
+      *-*-cygwin*) ;; # keep gdb and readline
+      *) noconfigdirs="$noconfigdirs gdb readline target-libio target-libstdc++ target-libg++"
+	 ;;
+    esac
+    ;;
   arc-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
@@ -596,15 +616,12 @@
   thumb-*-coff)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
-# CYGNUS LOCAL clm/arm-elf
   thumb-*-elf)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
   thumb-*-oabi)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
-# END CYGNUS LOCAL
-# CYGNUS LOCAL nickc/strongarm
   strongarm-*-elf)
     noconfigdirs="$noconfigdirs target-libgloss"
     if [ x${is_cross_compiler} != xno ] ; then
@@ -617,8 +634,7 @@
 	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
     fi
     ;;
-# END CYGNUS LOCAL
-  thumb-*-pe) # CYGNUS LOCAL nickc/thumb
+  thumb-*-pe)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
   arm-*-riscix*)
@@ -627,24 +643,21 @@
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio"
     ;;
-# CYGNUS LOCAL d30v
   d30v-*-*)
     ;;
-# END CYGNUS LOCAL
-# CYGNUS LOCAL fr30
   fr30-*-elf*)
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
     fi
     ;;
-# END CYGNUS LOCAL
   h8300*-*-* | \
   h8500-*-*)
     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
     ;;
   hppa*-*-*elf* | \
+  hppa*-*-linux-gnu* | \
   hppa*-*-lites*)
-    # Do configure ld/binutils/gas for this case.
+    # Do configure ld/binutils/gas for the above cases.
     ;;
   hppa*-*-*)
     # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
@@ -665,10 +678,6 @@
     # but don't build gdb
     noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
     ;;
-  *-*-linux*)
-    # linux has rx in libc
-    skipdirs="$skipdirs target-librx"
-    ;;
   i[3456]86-*-mingw32*)
     target_configdirs="$target_configdirs target-mingw"
     noconfigdirs="$noconfigdirs expect target-libgloss"
@@ -743,8 +752,11 @@
     ;;
   powerpc-*-aix*)
     # copied from rs6000-*-* entry
-    noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss"
-    # This is needed until gcc and ld are fixed to work together.
+    # 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 cvssrc target-libgloss ld"
     use_gnu_ld=no
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
@@ -768,8 +780,11 @@
     noconfigdirs="$noconfigdirs target-newlib gprof cvssrc"
     ;;
   rs6000-*-aix*)
-    noconfigdirs="$noconfigdirs gprof"
-    # This is needed until gcc and ld are fixed to work together.
+    # 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"
     use_gnu_ld=no
     ;;
   rs6000-*-*)
@@ -784,9 +799,14 @@
     noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss"
     ;;
   mips*-*-irix6*)
-    # The GNU assembler and linker do not support IRIX 6.
+    # The GNU assembler does not support IRIX 6.
     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
-    noconfigdirs="$noconfigdirs ld gas gprof emacs target-libgloss"
+    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"
@@ -841,18 +861,22 @@
   v850-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
-  v850e-*-*) # CYGNUS LOCAL v850e
+  v850e-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
   v850ea-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
-    ;;       # END CYGNUS LOCAL
+    ;;
   vax-*-vms)
     noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss"
     ;;
   vax-*-*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  *-*-linux*)
+    # linux has rx in libc
+    skipdirs="$skipdirs target-librx"
+    ;;
   *-*-lynxos*)
     # Newlib makes problems for libg++ in crosses.
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 852b6c7..b69efd3 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,2439 @@
+2000-04-02  Richard Henderson  <rth@cygnus.com>
+
+	* config/tc-d30v.c (check_range): Allow signed or unsigned 32-bit
+	quantities.  Correct right shift sign extension.
+	(build_insn): Make `number' unsigned long.  Mask top 6 bits of
+	32-bit value when shifting into place.
+
+2000-04-01  Ian Lance Taylor  <ian@zembu.com>
+
+	* app.c: Add ATTRIBUTE_UNUSED as needed.
+	* config/tc-ppc.c: Likewise.
+	(ppc_size): Make unsigned long.
+	(ppc_insert_operand): Add casts to avoid warnings.
+
+2000-03-31  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-d10v.h (md_flush_pending_output): Define.
+
+2000-03-29  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-sh.h (SEG_NAME): New macro: return the name of a
+	segment.  Works for both BFD_ASSEMBLER and others.
+	(SUB_SEGMENT_ALIGN): Use SEG_NAME.
+
+2000-03-29  Nick Clifton <nickc@cygnus.com
+
+	* config/tc-arm.c (tinsns): Add "bal" instruction pattern.
+
+2000-03-28  Alan Modra  <alan@linuxcare.com.au>
+
+	* listing.c (LISTING_LHS_WIDTH): Default depends on
+	LISTING_WORD_SIZE.
+	(LISTING_LHS_WIDTH_SECOND): Default to LISTING_LHS_WIDTH.
+
+2000-03-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-sh.c (md_show_usage): Use backslash before newline in
+	string literal.
+
+2000-03-27  Alan Modra  <alan@linuxcare.com.au>
+
+	* config/tc-avr.h (TC_HANDLES_FX_DONE): Define.
+
+	* config/tc-avr.c (mcu_types): Add missing initialiser.
+	(md_pcrel_from_section): Add prototype.
+	(avr_operand): Remove redundant test of unsigned < 0.
+	(avr_cons_fix_new): Ensure exp_mod_pm zero on function exit.
+
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
+
+	* config/tc-avr.c: New file for AVR support.
+	* config/tc-avr.h: Likewise.
+	* configure.in: Add AVR support.
+	* configure: Regenerate.
+
+2000-03-26  Timothy Wall <twall@cygnus.com>
+
+	* gasp.c (macro_op): Add new argument to check_macro call.
+	Macro structure definitions moved to macro.h
+	* sb.h:  Add argument to prototype for input_scrub_include_sb.
+	* input-scrub.c (input_scrub_include_sb): Allow disabling of sb
+	nesting checks with an additional flag.
+	(struct input_save): Add flag to indicate whether current sb
+	should be checked for proper macro/conditional nesting.
+	(input_scrub_push/pop): Save/restore nest check flag.
+	(input_scrub_next_buffer): Ditto.  Also call end of macro hook if
+	defined. 
+	* macro.c (check_macro):  Allow caller to retrieve parsed macro
+	information if a pointer is provided.  This information may be
+	used by the new macro hooks.
+	* macro.h: Update prototype for check_macro.  Macro struct
+	definitions moved here from macro.c/gasp.c.
+	* read.c (read_a_source_file): Add parameter to check_macro call,
+	and pass macro info to the macro hook, if defined.
+	(input_scrub_insert_line): New.  Allow insertion of a line of
+	characters into the input stream.
+	(input_scrub_insert_file): New.  Allow insertion of an arbitrary
+	file into the input stream.
+	(s_include): Use input_scrub_insert_file.
+	* internals.texi: Document new macro hooks.
+	* as.h: New prototypes added.
+	
+2000-03-26  Alan Modra  <alan@linuxcare.com.au>
+
+	* config/tc-i386.c: Don't start any as_bad or as_warn message with
+	an initial capital letter.
+	(i386_index_check): Reindent.
+
+2000-03-19  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_apply_fix3): Fix bug detectng overflow of pc
+	relative branches.
+
+2000-03-17 Thomas de Lellis <tdel@windriver.com>
+
+        * config/tc-arm.c (do_t_adr): Flag "adr Rd,label"
+        instruction operand bad if Rd > 7 when generating
+        thumb instructions. Prevents for example,
+        "adr r12,label" from silently failing and generating
+        the wrong instruction.
+        
+2000-03-17  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_apply_fix3): Handle same-section relocations
+	that have a destingation >= 0x400000.
+	Fix compile time warning messages. 
+
+Thu Mar 16 23:45:16 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* config/tc-sh.c (md_begin): When encountering insn that are
+	not supported by the current arch, only change the name if
+	its contents are the same as prev_name.
+	(get_specific): If the the architecture doesn't match, fail.
+
+Thu Mar 16 21:18:13 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* config/tc-sh.c (IDENT_CHAR): Define.
+	(parse_reg): Use it instead of isalnum.  Put r[0..7]_bank operand
+	matching back where it came from.
+
+Thu Mar 16 20:58:10 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* config/tc-sh.c (md_show_usage): Add description of -dsp.
+
+2000-03-15  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+	* config/tc-sh.c (parse_reg): Match r[0..7]_bank operands before
+	normal operands.
+
+2000-03-15  Kazu Hirata  <kazu@hxi.com>
+
+	* config/tc-h8300.c: Add ATTRIBUTE_UNUSED as appropriate.
+
+Mon Mar 13 22:02:59 2000  Hans-Peter Nilsson  <hp@axis.se>
+
+	* expr.c (operand) [case 'f']: When testing if '0f' can start a
+	floating-point-number, make sure 'f' is in FLT_CHARS.
+
+Sat Mar 11 00:01:39 2000  Hans-Peter Nilsson  <hp@axis.se>
+
+	* read.c (TC_IMPLICIT_LCOMM_ALIGNMENT): New default-definition.
+	(s_lcomm_internal): Use it.
+	* doc/internals.texi (CPU backend): Document it.
+	* config/obj-evax.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Set to 2**3
+	bytes.
+
+2000-03-10  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* config/tc-mips.c (mips_ip): Don't put stuff in .rodata
+	when embedded-pic.
+
+	* config/tc-mips.c (SWITCH_TABLE): The ELF embedded-pic
+ 	implementation doesn't have special handling for switch
+ 	statements.
+	(macro_build): Allow for code in sections other than .text.
+	(macro): Likewise.
+	(mips_ip): Likewise.
+	(md_apply_fix): Do pc-relative relocation madness for MIPS ELF.
+  	Don't perform relocs if we will be outputting them.
+	(tc_gen_reloc): For ELF, just use fx_addnumber for pc-relative
+ 	relocations.  Allow BFD_RELOC_16_PCREL_S2 relocs when
+ 	embedded-pic.
+
+2000-03-09  Catherine Moore  <clm@cygnus.com>
+ 
+        * config/tc-m32r.c (m32r_fix_adjustable):  Look up the
+        relocation type based on the entry in the fixup structure.
+
+2000-03-08  H.J. Lu  (hjl@gnu.org)
+
+	* Makefile.am (install-exec-tooldir): Depend on
+	install-exec-bindir for parallel make.
+	* Makefile.in: Regenerated.
+
+2000-03-06  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-m32r.c (struct md_longopts): Add -m32r command line
+	switch.
+	(md_parse_option): Parse -m32r command line switch - disable m32rx
+	compatability.
+	(md_show_usage): Document new option.
+
+	* doc/Makefile.am (CPU_DOCS): Add c-m32r.texi.
+	* doc/Makefile.in: Regenerate.
+	* doc/c-m32r.texi (M32R-Opts): Document new command line switch.
+
+2000-03-02  Michael Meissner  <meissner@redhat.com>
+
+	* config/tc-d30v.c (check_range): Remove code that incorrectly
+	sign extended values where bits < 32.
+
+2000-03-02  H.J. Lu  (hjl@gnu.org)
+
+	* configure.in: Support --enable-targets=all on ia32.
+	* configure: Regenerated.
+
+2000-03-01  Nick Clifton  <nickc@cygnus.com>
+
+	* gasp.c (do_align): Remove bogus check of alignment value.
+
+2000-02-27  Thomas de Lellis  <tdel@windriver.com>
+
+	* config/obj-elf.c (elf_frob_symbol): Remove code which when
+	TC_PPC was defined forced the type of a symbol with no other type
+	to be BSF_OBJECT.
+
+2000-02-27  Hans-Peter Nilsson  <hp@axis.com>
+
+	* doc/internals.texi (CPU backend): Mention that
+	line_separator_chars do not break up comments.  Fix typos for
+	LEX_AT and LEX_NAME descriptions.  Document operands for
+	TC_EQUAL_IN_INSN, md_operand and md_section_align.  Correct
+	description of md_create_short_jump usage.  Document argument for
+	md_undefined_symbol.
+
+2000-02-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* config/tc-sparc.c (OPTION_UNDECLARED_REGS): New option.
+	(md_parse_option): Handle it.
+	(md_show_usage): Document it.
+
+2000-02-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-alpha.c (md_assemble): Accept `1' and `9' in an
+	opcode, for the instruction `pal19'.  From Andrea Arcangeli
+	<andrea@suse.de>.
+
+2000-02-26  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_immediate): Move constant operand sizing
+	from here..
+	(md_assemble): To here, before template operands are matched.
+	Also ensure a constant immediate is sign extended when we know the
+	size is at most 16 bits.  This is to catch cases like "add
+	$0xffc0,%ax" where we don't know the size, and thus that the
+	immediate can be represented as Imm8S until after parsing the
+	register operand.
+	(i386_displacement): Similarly sign extend 16 bit constant
+	displacements.
+	(md_assemble): Relax 16-bit jump constant range check to suit sign
+	extended displacements.
+
+2000-02-26  Andreas Jaeger  <aj@suse.de>
+
+	* doc/c-mips.texi (MIPS Opts): Fix typo in last patch.
+
+2000-02-25  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (md_assemble): Don't swap intersegment jmp and
+	call operands when intel_syntax.
+	(intel_float_operand): Return 2 for "fi...".
+	(i386_operand_modifier): Change "DWORD PTR" test to suit above.
+	Return SHORT_MNEM_SUFFIX for "WORD PTR" when "fi...".  Revert
+	earlier "SHORT" change.
+	(md_assemble): When determining suffix from Regs, exclude
+	InOutPortReg.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* configure: Add arm-wince, mips-pe and sh-pe targets.
+	* configure: Regenerate.
+
+	* config/obj-coff.h (COFF_WITH_PE): Define for mips-pe and
+	sh-pe targets.
+	(TARGET_FORMAT): Set to "pe-shl" for the sh-pe target and to
+	"pe-mips" for the mips-pe target.
+
+	* config/tc-arm.c (insns): Change displacement encoded in BL
+	and B instructions if the target port is arm-wince.
+	(do_ldst): Do not bias the relocation offset if the target
+	port is arm-wince.
+	(md_pcrel_from): Add in missing relocation offset bias if the
+	target os arm-wince.
+
+	* config/tc-mips.c (mips_target_format): Support COFF flavour.
+	(md_begin): Disable -G support for mips-pe target.
+	(md_apply_fix): Treat BFD_RELOC_RVA reloc as BFD_RELOC_32.
+	* config/tc-mips.h (USE_GLOBAL_POINTER_OPT): Add support for
+	COFF flavour.
+
+	* config/tc-sh.c (md_begin): sh-pe target is little endian.
+	* config/tc-sh.h (SUB_SEGMENT_ALIGN): If using a BFD
+	assembler, just set the alignment to 4.
+
+	* config/te-wince-pe.h: New file for WinCE targets.  Define
+	TE_WINCE.
+
+2000-02-25  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (md_assemble): Swap segments too for intel mode
+	string instructions.
+	(i386_operand_modifier): Set i.suffix = WORD_MNEM_SUFFIX for SHORT.
+	(i386_intel_memory_operand): After finding a segment override,
+	check again for no `[' before looking for a displacement.  Bomb if
+	more than one displacement rather than silently discarding the
+	second and subsequent ones.  Free strings malloc'd by
+	build_displacement_string.
+
+2000-02-24  Catherine Moore  <clm@cygnus.com>
+
+	* config/obj-som.c (obj_pseudo_table): Add "weak".
+	(obj_som_weak): New routine.
+
+2000-02-24  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (union i386_op): New.
+	(struct _i386_insn): Delete disps[], imms[], regs[].  Add op[].
+	Throughout file replace occurences of disps[n], imms[n], regs[n]
+	with equivalent op[n].disps, op[n].imms, op[n].regs.  Simplify
+	intel mode operand swapping.  Add assert in regKludge and
+	fake_zero_displacement code.  Test i.types[n] when outputting
+	displacements and immediates.  Combine output of Disp16 with
+	Disp32.
+	(md_assemble): Don't try to fix broken UNIXWARE_COMPAT opcodes
+	when in intel mode by (not) reversing fsub and fdiv operands
+	before the template search.  This fails for single operand
+	shorthand forms of the instruction, and if UNIXWARE_COMPAT is
+	undefined.  Instead fix the base_opcode after we've found the
+	template.  Move base_opcode xor with found_reverse_match from
+	opcode output code to before this fix so we test for the correct
+	opcodes.
+	(md_assemble): Don't use strcmp when deciding to ignore the suffix
+	check in intel mode.  Instead compare opcodes.
+
+	* config/tc-i386.h (TC_RELOC): Delete.
+	* config/tc-i386.c (TC_RELOC): Delete.  Replace usage of TC_RELOC
+	with equivalent call to reloc.
+
+	* as.h (flag_m68k_mri): Move declaration after target include, and
+	only declare when TC_M68K defined.  Define as zero otherwise.
+	(LABELS_WITHOUT_COLONS, NO_PSEUDO_DOT): If undefined, define as 0.
+	* app.c (scrub_m68k_mri): Declare only when TC_M68K defined.
+	Define as zero otherwise.
+	(do_scrub_begin): Use m68k_mri parameter only when TC_M68K defined.
+	(struct app_save): Declare scrub_m68k_mri only when TC_M68K.
+	(app_push, app_pop): Save scrub_m68k_mri only when TC_M68K.
+	(do_scrub_chars): Use LABELS_WITHOUT_COLONS directly rather than
+	testing whether defined.
+	* cond.c (ignore_input): Use NO_PSEUDO_DOT directly.
+	* expr.c (operand): #ifdef unused case labels when TC_M68K undefined.
+	* read.c: Use LABELS_WITHOUT_COLONS and NO_PSEUDO_DOT directly
+	rather than testing whether defined.
+	(s_mri): Set flag_m68k_mri only when TC_M68K defined.
+	(parse_mri_cons): Declare and use only when TC_M68K.
+	* config/tc-hppa.h (LABELS_WITHOUT_COLONS): Define as 1.
+	* config/tc-m68k.h (NO_PSEUDO_DOT): Define as 1.
+	* config/tc-m88k.h (NO_PSEUDO_DOT): Define as 1.
+
+	* NEWS: Mention IBM 370 support.
+
+2000-02-23  Richard Henderson  <rth@cygnus.com>
+
+	* config/tc-i386.c (md_assemble): When swapping operands for
+	intel_syntax, assume everything that's not Imm or Disp is a
+	register.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* config/tc-i370.c, config/tc-i370.h: New files.
+	* Makefile.am: Add support for Linux/IBM 370.
+	* configure.in: Likewise.
+	* app.c (do_scrub_begin): Don't lex single quote when TC_I370.
+	* config/obj-elf.c: Include elf/i370.h
+	(obj_elf_section): Don't do anything special for flag_mri if TC_I370.
+
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+
+	* doc/c-i370.texi: New file.
+	* doc/all.texi: Include it.
+	* doc/as.texinfo: And here.
+	* doc/Makefile.am(CPU_DOCS): Add c-i370.texi. 
+	* doc/Makefile.in: Regenerate.
+
+2000-02-19  Michael Meissner  <meissner@redhat.com>
+
+	* config/tc-d30v.c (parallel_ok): Use FLAG_NOT_WITH_ADDSUBppp to
+	determine if an instruction can be used in parallel with an ADDppp
+	or SUBppp instruction.
+
+2000-02-22  Andrew Haley  <aph@cygnus.com>
+
+	* doc/c-mips.texi (MIPS Opts): Document -mgp32 and -mgp64.
+
+1999-12-30  Andrew Haley  <aph@cygnus.com>
+
+	* config/tc-mips.c (mips_gp32): New variable.
+	(macro_build) Use mips_gp32.
+	(mips_ip): Ditto.
+	(md_longopts): Add "-mgp32" and "-mgp64".
+	(md_parse_option): Add OPTION_GP32 and OPTION_GP64.
+	
+2000-02-22  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+	* config/obj-coff.c (add_lineno): Accept non-positive lineno with
+	warning, and bump it to 1.
+
+2000-02-22  Ian Lance Taylor  <ian@zembu.com>
+
+	From Brad Lucier <lucier@math.purdue.edu>:
+	* dwarf2dbg.c (print_stats): Add cast to force printf argument to
+	match format.
+
+2000-02-21  Catherine Moore  <clm@cygnus.com>
+
+	* config/tc-mips.c (MF_HILO_INSN): Define.
+	(mips_7000_hilo_fix): Declare.
+	(append_insn): Conditionally insert nops after an mfhi/mflo insn.
+	(md_parse_option): Check for 7000_HILO_FIX options.
+	(OPTION_M7000_HILO_FIX): Define.
+	(OPTION_NO_M7000_HILO_FIX): Define.
+	* doc/c-mips.texi (-mfix7000): Describe.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* listing.c (print_lines): Remove unused variable `end'.
+
+	* config/tc-i386.c (md_assemble): Use `reloc()' to select reloc
+	type for JumpInterSegment output. Use enum bfd_reloc_code_real for
+	reloc_type when BFD_ASSEMBLER. 
+	(md_estimate_size_before_relax): Use enum bfd_reloc_code_real for
+	reloc_type when BFD_ASSEMBLER. Move common code out of switch
+	statement and quell signed vs. unsigned comparison warning. 
+
+2000-02-18  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-d10v.c (find_opcode): Add a symbol's value to
+	the computed frag offset, rather than overwriting it.
+
+Thu Feb 17 00:11:08 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* config/tc-sh.c ("elf/sh.h"): Include.
+	(sh_dsp, valid_arch, reg_x, reg_y, reg_efg): New static variables.
+	(md.begin): Initialize target_arch.
+	Only include opcodes in has table that match selected architecture.
+	(parse_reg): Recognize register names for sh-dsp.
+	(parse_at): Recognize post-modify addressing.
+	(get_operands): The leading space is now optional.
+	(get_specific): Remove FDREG_N support.  Add support for sh-dsp
+	arguments.  Update valid_arch.
+	(build_Mytes): Add support for SDT_REG_N.
+	(find_cooked_opcode): New function, broken out of md_assemble.
+	(assemble_ppi, sh_elf_final_processing): New functions.
+	(md_assemble): Use find_cooked_opcode and assemble_ppi.
+	(md_longopts, md_parse_option): New option: -dsp.
+	* config/tc-sh.h (elf_tc_final_processing): Define.
+	(sh_elf_final_processing): Declare.
+
+Fri Feb 11 14:21:51 2000  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_build_unwind_subspace): Use subseg_new to create
+	the unwinder subspace.  Save the current seg/subseg before creating
+	the new seg/subseg.
+
+2000-02-10  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.c (INST_BYTE0): Redefine to handle big and
+        little endian targets.
+	(INST_BYTE1): Redefine to handle big and little endian
+        targets.
+	(cpu_type): New type: Select between M340 and M210.
+	(parse_psrmod): New function: Parse the PSRCLR and PSRSET
+        instructions of the M340.
+	(md_assemble): Add support for the MULSH and OPSR classes of
+        instructions.
+	(md_atof): Add support for little endian targets.
+	(md_parse_option): Add support for -EL, -EB and -mcpu command
+        line switches.
+	(md_convert_frag): Add support for little endian targets.
+	(md_apply_fix3): Add support for little endian targets.
+	(md_number_to_chars): Add support for little endian targets.
+
+2000-02-10  Timothy Wall  <twall@redhat.com>
+
+	* read.c (read_a_source_file): If TC_START_LABEL_WITHOUT_COLON is
+	defined, use it to verify the symbol just read should be a label.
+
+2000-02-10  Timothy Wall  <twall@redhat.com>
+
+	* app.c (do_scrub_chars): Handle "||" for parallel instructions
+	when DOUBLEBAR_PARALLEL is defined.  Avoid stripping whitespace
+	around colons when KEEP_WHITE_AROUND_COLON is defined.
+	* doc/internals.texi (CPU backend): Document DOUBLEBAR_PARALLEL
+	and KEEP_WHITE_AROUND_COLON.
+
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+	* read.c (s_rept): Call do_repeat, which abstracts the repeat
+	logic. 
+	(do_repeat): New.  Abstract repeat logic so that a "break" can be
+	implemented. 
+	(end_repeat): New.  Provide support for a "break" out of the
+	repeat loop.
+	* read.h: Add prototypes for new functions.
+	
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+	* doc/internals.texi: Document NUMBERS_WITH_SUFFIX macro.
+	* as.h: Provide a default NUMBERS_WITH_SUFFIX definition (zero).
+	* expr.c: Handle numbers with suffixes if NUMBERS_WITH_SUFFIX is
+	non-zero. 
+	
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+	* read.c: Added elseif to directives table.
+	* read.h: Added prototype for s_elseif.
+	* doc/as.texinfo: Added description for elseif.
+	* cond.c (s_elseif): New function
+	
+2000-02-04  Timothy Wall  <twall@redhat.com>
+
+	* listing.c (print_lines): Remove conditionals causing bug in
+	listings. 
+
+2000-02-03  Timothy Wall  <twall@cygnus.com>
+	
+	* as.h: Define OCTETS_PER_BYTE and OCTETS_PER_BYTE_POWER
+	default	values.
+	* frags.c (frag_new): Calculate fr_fix in octets
+	(frag_now_fix) Return offset as target address offset (bytes).
+	(frag_now_fix_octets) New - Return offset in octets (8-bit
+	quantities). 
+	* frags.h: Added prototype for frag_now_fix_octets().
+	Distinguish between octets and bytes in field descriptions.
+	* listing.c (calc_hex): Account for octets vs bytes when
+	printing addresses/offsets.
+	(print_lines) Ditto.  Also, if LISTING_WORD_SIZE is not 1, and
+	target is little-endian, print the octets in a word in big-endian
+	order so that the display looks like a proper hexadecimal number,
+	instead of having the octets reversed.
+	* read.c (do_align): When recording alignment, alignment power
+	should be in terms of target bytes (minimum addressible unit)
+	instead of octets.
+	(do_org) Convert ORG target address (byte) argument into an
+	octet offset when generating a variable fragment.
+	* symbols.c (resolve_symbol_value): Symbol final value
+	converted to a target address offset (bytes) from its octet offset.
+	* config/obj-coff.c (coff_frob_symbol): Symbol target address
+	offset (bytes) is adjusted by the frag offset (octets) converted
+	to bytes.
+	(coff_frob_section) Section alignment power is in terms of bytes;
+	convert it to an octet alignment power when calculating size (and
+	size mask) in octets.  Don't modify the section size in order to
+	"align" it for TI COFF, since that format has a different method
+	for storing alignment information.
+	
+2000-02-01  Timothy Wall  <twall@cygnus.com>
+
+	* stabs.c (generate_asm_file): Escape backslashes in stabs file
+	entries, matching the way GCC generates them.  If not escaped, the
+	filename is encoded incorrectly.
+
+2000-01-31  Nick Clifton  <nickc@cygnus.com>
+	* config/tc-arm.c (reg_table): Add support for ATPCS register
+	naming conventions.
+
+2000-01-31  Geoff Keating  <geoffk@cygnus.com>
+	
+	* config/obj-coff.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Don't define if
+	already defined.
+	* config/tc-ppc.h [OBJ_XCOFF] (OBJ_COPY_SYMBOL_ATTRIBUTES): 
+	New macro.
+	* config/tc-ppc.c (ppc_fix_adjustable): Don't look at the frag
+	of a symbol when we really care about its value.
+
+2000-01-19  Chandra Chavva   <cchavva@cygnus.com>
+
+	* config/tc-mcore.c (md_assemble): Give warning message if
+	operands passes to instruction are more than the spec.
+
+2000-01-27  Thomas de Lellis <tdel@windriver.com>
+
+        * config/tc-arm.c (armadjust_symtab): If the assembler is in
+	Thumb mode but the label seen was not declared as '.thumb_func'
+	then set the ST_INFO type to STT_ARM_16BIT mode.   This allows
+	correct disassembly of Thumb code bounded by non function labels. 
+
+2000-01-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* Makefile.am (MULTI_CFILES): Add config/e-i386aout.c
+	Add dependencies for e-i386aout.o.  Fix 2 comment lines.
+
+	* Makefile.in: Same here.
+	Update copyright.
+
+	* configure.in: Set bfd_gas for i386-aout when primary target
+	is bfd.  Handle i386aout emulation.  Don't use te_file=multi, as
+	we may need the primary te_file.  Remove incorrect comment.
+
+	* configure: Regenerate.
+
+	* config/e-i386aout.c: New file.
+
+	* as.c (USE_EMULATIONS): Move to before print_version_id.
+	(struct emulation): Add i386aout.
+	(show_usage): Split text strings.  Reformat -a text.  Add --em
+	help.
+	Update copyright.
+
+	* obj.h (struct format_ops): Add s_get_other and s_get_desc.
+	(aout_format_ops): New.
+	Update copyright.
+
+	* read.c (s_lcomm_internal): Rewrite OBJ_AOUT,OBJ_BOUT
+	preprocessor conditional and add aout USE_EMULATIONS tests.
+	(read_a_source_file): Don't pass error strings to printf as
+	format arg.
+	Update copyright.
+
+	* gasp.c (exp_get_abs): Don't pass error strings to printf as
+	format arg.
+	(do_data): Same here.
+	(process_file): And here.
+	Update copyright.
+
+	* symbols.c (colon): Rewrite "already defined" fatal message
+	code for aout with USE_EMULATIONS.
+	Update copyright.
+
+	* config/obj-aout.c (OBJ_HEADER): Define.
+	(obj_pseudo_table): Rename to aout_pseudo_table.  Init all
+	fields of sentinel. 
+	(obj_aout_frob_symbol): Expand S_GET_DESC, S_GET_TYPE,
+	S_GET_OTHER, S_SET_TYPE macros since we don't need obj-multi
+	forms here.
+	(obj_aout_type): Expand S_SET_OTHER here too.
+	(obj_read_begin_hook): Remove.
+	(aout_pop_insert): New.
+	(obj_aout_s_get_other): New.
+	(obj_aout_s_get_desc): New.
+	(aout_format_ops): New.
+	Update copyright.
+
+	* config/obj-aout.h (obj_pop_insert): Define so non-multi usage
+	gets aout_pseudo_table.
+	(aout_pseudo_table): Declare.
+	(obj_read_begin_hook): Define.
+	Update copyright.
+
+	* config/obj-coff.c (obj_pseudo_table): Rename to
+	coff_pseudo_table.
+	(coff_pop_insert): Use coff_pseudo_table.
+	(coff_sec_sym_ok_for_reloc): Remove.
+	(coff_format_ops): Add 0 entries for s_get_size, s_set_size,
+	and comment all zero entries and remove #if 0 code.
+	Update copyright.
+
+	* config/obj-coff.h (obj_pop_insert): Define.
+	(coff_pseudo_table): Declare.
+	Update copyright.
+
+	* config/obj-ecoff.c (ecoff_format_ops): Add 0 entries for
+	s_get_size, s_set_size.  Comment all zero entries.
+	Update copyright.
+
+	* config/obj-elf.c (elf_s_get_other): New function.
+	(obj_read_begin_hook): Rename to elf_obj_read_begin_hook.
+	(obj_symbol_new_hook): Rename to elf_obj_symbol_new_hook.
+	(elf_format_ops): Add elf_s_get_other, 0 s_get_size entry, and
+	comment.
+	(obj_elf_parse_section_letters): Don't pass error strings to
+	printf as format arg.
+	Update copyright.
+
+	* config/obj-elf.h (ECOFF_DEBUGGING): Define when
+	OBJ_MAYBE_ECOFF.
+	(elf_s_get_other): Declare.
+	(S_GET_OTHER) Define as elf_s_get_other if not already
+	defined.
+	(S_SET_OTHER): Only define when not already defined.
+	(elf_obj_read_begin_hook): Declare.
+	(obj_read_begin_hook): Define.
+	(elf_obj_symbol_new_hook): Declare.
+	(obj_symbol_new_hook): Define.
+	Update copyright.
+
+	* config/obj-multi.h: Add copyright header and protect against
+	multiple inclusion.  Add * to all function pointers.
+	(OBJ_HEADER): If defined, include it rather than other defines
+	in this file.
+	(obj_frob_file_after_relocs): Test for NULL.
+	(obj_symbol_new_hook): Here too.
+	(obj_sec_sym_ok_for_reloc): And here.
+	(S_GET_OTHER): Define.
+	(S_GET_DESC): Define.
+	(ECOFF_DEBUGGING): Remove as it's done in obj-elf.h
+	(OBJ_MAYBE_ELF): Update comment.
+
+	* config/tc-i386.c (i386_immediate): Add OBJ_MAYBE_AOUT to
+	OBJ_AOUT preprocessor conditional and handle emulation by
+	testing OUTPUT_FLAVOR.
+	(i386_displacement): Here too.
+	(md_section_align): Similarly here.
+	(i386_target_format): Conditionally compile when more than one
+	of OBJ_MAYBE_{ELF,COFF,AOUT} defined.  Add aout case.
+	(i386_immediate): Fix error message for aout BFD_ASSMBLER.
+	(i386_displacement): Here too.
+	Update copyright.
+
+	* config/tc-i386.h (AOUT_TARGET_FORMAT): Define for each TE_*.
+	Define TARGET_FORMAT for aout only when not multi.
+	Update copyright.
+
+	* config/te-multi.h: Delete file as it's identical to te-generic.h
+
+2000-01-15  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.h (DWORD_MNEM_SUFFIX): Delete.
+	* config/tc-i386.c (DWORD_MNEM_SUFFIX): Rename all occurrences to
+	LONG_MNEM_SUFFIX.
+
+	* config/tc-i386.h (INTEL_DWORD_MNEM_SUFFIX): Rename to
+	DWORD_MNEM_SUFFIX.
+	* config/tc-i386.c (INTEL_DWORD_MNEM_SUFFIX): Here too.  Fix some
+	comments.
+
+2000-01-13  Clinton Popetz  <cpopetz@cygnus.com>
+
+        * config/tc-mips.c (mips_do_align): New function.
+        * config/tc-mips.h (md_do_align): Define.
+
+2000-01-10  Philip Blundell  <philb@gnu.org>
+
+	* doc/c-arm.texi (ARM Options): Fix typo.
+ 	(ARM-Chars): Correct description of `#'.  Mention  that `;' is a 
+	line separator for Linux.
+	* doc/as.texinfo (Comments): Mention the ARM.
+
+2000-01-10  Philip Blundell  <pb@futuretv.com>
+
+	* configure.in (arm*-*-conix*): New target.
+	(arm*-*-linux-gnu*): Match instead of arm-*-linux* and
+	armv*-*-linux-gnu.
+	* configure: Regenerate.
+
+2000-01-03  Martin v. Loewis  <loewis@informatik.hu-berlin.de>
+
+	* config/obj-elf.c (elf_pseudo_table): Define visibility pseudos.
+	(obj_elf_visibility): New function.
+	
+	* doc/as.texinfo (Visibility): New node: document visibility
+	pseudo ops.
+
+1999-12-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (MATCH): Relax JumpAbsolute check.  Emit a
+	warning for absolute jump/call without `*' in non-intel mode.  No
+	need to set i.types[0] JumpAbsolute in intel mode.
+
+1999-12-22  Philip Blundell  <pb@futuretv.com>
+
+	* config/tc-arm.c (arm_s_text): If OBJ_ELF, call the appropriate
+	hook function when changing sections.
+	(arm_s_data): Likewise.
+
+1999-12-14  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_parse_option): Add support for -marm720
+	command line switch.
+
+Tue Nov 30 22:59:00 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-mn10300.c (md_pseudo_table): Add ".am33" pseudo-op.
+	(r_registers, xr_registers): Define.
+	(r_register_name, xr_register_name): New functions.
+	(md_assemble): Handle new am33 operand types and instruction
+	formats.
+	(mn10300_insert_operand, check_operand): Likewise.
+
+1999-11-29  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (thumb_mode): Turn into a tristate variable.
+	(s_force_thumb): Set thumb_mode to 2.
+	(md_assemble): Do not complain about thumb instructions on a
+	non-thumb target if thumb_mode is set to 2.
+
+1999-11-28  Michael Meissner  <meissner@cygnus.com>
+
+	* config/tc-alpha.c (toplevel): Include struc-symbol.h.
+	(alpha_macro_arg): Add MACRO_{LITERAL,BASE,BYTOFF,JSR} cases.
+	(O_...): Add new machine dependent expressions if we are handling
+	explicit relocations.
+	(alpha_reloc_op): New static table holding the explicit relocation
+	information.
+	(alpha_literal_hash): New static to hold the hash table for
+	explicit relocations.
+	(alpha_macros): Add support for explicit relocations.
+	(md_begin): If explicit relocations, initialize hash table.
+	(md_assemble): Don't print a second error if tokenize_arguments
+	already printed an error message.
+	(md_apply_fix): Add support for explicit relocations.
+	(alpha_force_relocation): Ditto.
+	(alpha_fix_adjustable): Ditto.
+	(alpha_adjust_symtab): New function to support explicit
+	relocations.
+	(alpha_adjust_symtab_relocs): Ditto.
+	(debug_exp): Debug stub compiled if DEBUG_ALPHA is defined.
+	(tokenize_arguments): Add debug code if DEBUG_ALPHA is defined.
+	Add support for explicit relocations.  Return -2 if an error
+	message was already printed.
+	(find_macro_match): Add support for explicit relocations.  Comment
+	each of the cases.
+	(emit_insn): Add support for explicit relocations.
+	(assemble_tokens): Ditto.
+	(emit_ldgp): Ditto.
+	(load_expression): Ditto.
+	(emit_lda): Ditto.
+	(emit_ldah): Ditto.
+	(emit_ir_load): Ditto.
+	(emit_loadstore): Ditto.
+	(emit_ldXu): Ditto.
+	(emit_ldil): Ditto.
+	(emit_sextX): Ditto.
+	(emit_division): Ditto.
+	(emit_jsrjmp): Ditto.
+	(emit_retjcr): Ditto.
+
+	* config/tc-alpha.h (RELOC_OP_P): Enable explicit relocations if
+	ELF object format.
+	(tc_adjust_symtab): If explicit relocations, call the function
+	alpha_adjust_symtab.
+	(TC_FIX_TYPE): Add fields to be able to move explicit lituse
+	relocations next to the literal relocation they reference.
+	(TC_INIT_FIX_DATA): Initialize the new fields.
+	(TC_FIX_DATA_PRINT): Print the new fields if DEBUG5 is defined.
+
+Wed Nov 24 20:27:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Handle PA2.0 unit completers.  Handle
+	'B' operand for PA2.0 bb instruction.
+	
+1999-11-18  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.h (TC_FORCE_RELOCATION): Define for Mcore-pe
+	target.
+	
+	* config/tc-mcore.c (tc_gen_reloc): Support generation of RVA
+	relocs.
+	(mcore_force_relocation): Force relocations to be generated for
+	RVA relocs.
+
+1999-11-16  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_immediate): Disallow O_big immediates.
+	(i386_displacement): Disallow O_big displacements.
+
+Mon Nov 15 20:12:43 1999  Donald Lindsay  <dlindsay@cygnus.com>
+
+	* config/tc-arm.c (do_mia,do_mar,do_mra,do_pld,do_ldrl,do_co_reg): Small
+	improvements in error checking.
+	(md_assemble): Support for unconditional ARM instructions.
+	(md_parse_option): Support for -m[arm]v5e flag.
+
+1999-11-12  Nick Clifton  <nickc@cygnus.com>
+
+	* macro.c (buffer_and_nest): Do not check beyond the end of the
+	buffer. 
+
+1999-11-11  Nick Clifton  <nickc@cygnus.com>
+
+	* macro.c (buffer_and_nest): Look for seperator after TO and
+	FROM tokens.
+
+1999-11-08  Andrew Haley  <aph@cygnus.com>
+
+	* app.c (do_scrub_chars): When in State 10, treat backslash
+	characters in the same way as as symbol characters.
+
+1999-11-07  Richard Henderson  <rth@cygnus.com>
+
+	* config/tc-alpha.c (alpha_align): Check, don't assert, that
+	the previous label was in the current section before playing
+	with auto-alignment.
+
+1999-11-06  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-v850.c (v850_force_relocation): Force relocation
+        for weak symbols.
+	(v850_pcrel_from_selection): Do not compute a pcrel offset if
+        the symbol is weak.
+
+1999-11-05  Michael Meissner  <meissner@cygnus.com>
+
+	* expr.h (operatorT): Increase machine dependent operators to 16.
+	* expr.c (op_rank): Ditto.
+
+1999-11-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* read.c (pseudo_set): Reject attempts to set the value of a
+	section symbol.
+
+	* config/obj-elf.c (obj_elf_ident): Call md_flush_pending_output
+	if it is defined.
+
+	* config/obj-elf.c (elf_set_index): Add ATTRIBUTE_UNUSED.
+
+	* config/obj-elf.c (elf_frob_file_after_relocs): Don't pass NULL
+	to bfd_set_section_contents.
+
+1999-11-03  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.h (TARGET_BYTES_BIG_ENDIAN): Change to false.
+
+1999-11-01  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* config/tc-mips.c (macro_build): Use OPCODE_IS_MEMBER.
+	(mips_ip): Use OPCODE_IS_MEMBER.
+
+Wed Oct 27 16:50:44 1999  Don Lindsay  <dlindsay@cygnus.com>
+
+	* config/tc-arm.c (reg_required_here): Improve comments.
+
+        * config/tc-arm.c (thumb_opcode): Add "variants" field.
+        (tinsns): Initialize variants field.
+
+	* config/tc-arm.c (bad_args, bad_pc): Renamed to BAD_ARGS and
+	BAD_PC respectively.
+
+1999-10-27  Scott Bambrough  <scottb@netwinder.org>
+
+	* config/tc-arm.c (reloc_map[]): Fix compiler warning.
+	* config/tc-arm.h: Fix compile time warnings.
+
+Mon Oct 18 18:11:10 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* tc_d10v.c (find_opcode): Allow ATSIGN to match expressions of the
+	form @abs16, @(abs16) and @(abs16 + imm).
+
+1999-10-21  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* config/tc-mips.c (ISA_HAS_COPROC_DELAYS) : New.
+	(ISA_HAS_64_BIT_REGS) New.
+	(gpr_interlocks,md_begin,reg_needs_delay,append_insn,
+	mips_emit_delays,macro_build,load_register,load_addresss,
+	macro,macro2,mips_ip,s_cprestore,s_cpadd): Simplify
+	and/or use new ISA_xxx macros in expressions involving
+	ISA, particularly mips_opts.isa.
+
+1999-10-18  Michael Meissner  <meissner@cygnus.com>
+
+	* expr.h (operatorT): Add machine dependent operators md1..md8.
+	(expressionS): Make X_op 8 bits instead of 7.  Add a X_md field
+	for the machine dependent operators to use.
+
+	* expr.c (op_rank): Add machine dependent operators.
+
+	* config/tc-alpha.c (O_pregister): Define as a machine dependent
+	operator.
+	(O_cpregister): Ditto.
+	(md_begin): Change X_op test that field is wide enough to use
+	O_max instead of O_alpha_max.
+	(cpu_types): Fill in missing initializer.
+	(alpha_num_macros): Make unsigned.
+	(md_assemble): Make opnamelen be size_t.
+	(md_apply_fix): Cast alpha_num_operands to int before testing.
+	(alpha_force_relocation): Ditto.
+	(alpha_fix_adjustable): Ditto.
+	(alpha_fix_adjustable): Mark unused arguments ATTRIBUTE_UNUSED.
+	(tc_gen_reloc): Ditto.
+	(tc_get_register): Ditto.
+	(emit_ldgp): Ditto.
+	(emit_lda): Ditto.
+	(emit_ldah): Ditto.
+	(emit_ldil): Ditto.
+	(s_alpha_ent): Ditto.
+	(s_alpha_end): Ditto.
+	(s_alpha_frame): Ditto.
+	(s_alpha_prologue): Ditto.
+	(s_alpha_file): Ditto.
+	(s_alpha_gprel32): Ditto.
+	(s_alpha_proc): Ditto.
+	(s_alpha_set): Ditto.
+	(s_alpha_base): Ditto.
+	(s_alpha_align): Ditto.
+	(s_alpha_arch): Ditto.
+	(alpha_align): Ditto.
+	(assemble_insn): Suppress unused variable warning.
+	(emit_insn): Ditto.
+	(assemble_insn): Don't assume X_op and X_unsigned are in a given
+	order in the structure.
+	(s_alpha_coff_wrapper): Avoid int/unsigned comparison.
+
+Sun Oct 17 17:15:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (md_apply_fix): Make "fmt" an int.
+
+1999-10-12  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_index_check): Correct #endif location.
+
+Mon Oct 11 14:02:40 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* as.c (show_usage): Document new options.
+	(parse_args): Add --no-warn, --warn, --fatal-warnings,
+	which become 'W', OPTION_WARN, and OPTION_WARN_FATAL.
+	(parse_args): Parse the new options.
+	(main): If there were warnings, and --fatal-warnings
+	was specified, print an error.
+	* as.h: New variable, flag_fatal_warnings, for new option.
+
+Sun Oct 10 01:47:23 1999  Jerry Quinn <jerry.quinn.adv91@alum.dartmouth.org>
+
+	* config/tc-hppa.c (pa_ip):  Add new codes 'cc', 'cd', 'cC', 'co',
+	'@'.  Change autoincrement completers to fall through to cache control
+	completers.
+
+	* config/tc-hppa.c (pa_ip):  Remove unused args.  Add code to '?W'
+	arg. 
+	(pa_parse_addb_64_cmpltr):  New function.
+
+	* config/tc-hppa.c (pa_ip):  Change error message.
+	(pa_ip,pa_parse_cmpb_64_cmpltr,pa_parse_cmpib_64_cmpltr)  Fix '?N' and
+	'?Q' args to allow falling through.
+
+	* configtc-hppa.c (pa_ip):  Implement conditional codes "?N", "?Q".
+	Remove unused conditional codes.
+	(pa_parse_cmpb_64_cmpltr,pa_parse_cmpib_64_cmpltr):  New.
+
+Thu Oct  7 00:23:53 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* config/tc-d30v.c (CHAR_BIT): Define.
+	(check_range): Fix bit operations to support integers bigger than
+	32 bits.
+
+Thu Oct  7 00:11:50 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* config/tc-d10v.c (check_range): Check range for RESTRICTED_NUM3
+	operands.
+
+Mon Oct  4 17:24:23 1999  Nick Clifton  <nickc@cygnus.com>
+			  Doug Evans  <devans@cygnus.com>
+
+	Add support for m32rx.
+	* config/tc-m32r.c (enable_m32rx): New static global.
+	(enable_special,warn_explicit_parallel_conflicts,optimize): Ditto.
+	(allow_m32rx): New function.
+	(M32R_SHORTOPTS): Add `O'.
+	(md_longopts): Add --m32rx plus several warning options.
+	(md_parse_option): Handle new options.
+	(md_show_usage): Print them.
+	(md_begin): Enable m32rx.
+	(OPERAND_IS_COND_BIT): New macro.
+	(first_writes_to_seconds_operands): New function.
+	(writes_to_pc,can_make_parallel,make_parallel): New functions.
+	(target_make_parallel,assemble_two_insns): New functions.
+	(md_assemble): Recognize "insn1 -> insn2" and "insn1 || insn2".
+	If optimizing and m32rx, try to make consecutive insns parallel.
+
+Tue Sep 28 14:06:44 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* config/tc-mips.c (nopic_need_relax): Allow for the
+	.sdata.foo sections generated by -fdata-sections,
+	and for the .gnu.linkonce.s sections generated by C++.
+
+Thu Sep 23 07:13:45 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* config/tc-hppa.c (pa_ip): Replace 'B', 'M', 'l' and 'g' handling
+	with cleaner code using completer prefixes.   Add 'Y'.
+
+	* config/tc-hppa.c (pa_ip):  Add parens to silence compiler.
+
+Wed Sep 22 09:37:19 1999  Jeffrey A Law  (law@cygnus.com)
+
+        * config/tc-hppa.c (pa_ip): Avoid ANSI specific initialization.
+	(pa_ip, case 'm'): Failure to get a CBIT specifier just means the
+	insn does not match and we should try the next insn in the table.
+
+1999-09-22  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (MULTI_SET_PSR): Rename to LDM_TYPE_2_OR_3.
+
+Mon Sep 20 04:01:41 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Fix thinkos in recent cleanup
+	of PA2.0 support.
+
+1999-09-19  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+	* config/tc-i386.c (md_shortopts): Check OBJ_MAYBE_ELF as well as
+	OBJ_ELF.  If ELF, add "sq".
+	(md_parse_option): If ELF, ignore -s and -q.
+	(md_show_usage): Mention ELF options.
+
+Sun Sep 19 10:43:31 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Handle 'J', 'K' and 'cc' 
+	operands.
+
+	* config/tc-hppa.c (pa_ip); Handle "fe", and 'cJ'.
+
+	* config/tc-hppa.c (pa_ip): Handle 'd', '#' and 'cq'.
+
+	* config/tc-hppa.c (struct pa_it): New field "trunc".
+	(pa_ip): Hadnle 'h', 'm', '=', '{', and '_' operands.
+	(pa_parse_ftest_gfx_completer): New function
+	(pa_parse_fp_cnv_format): New function.
+
+	* config/tc-hppa.c (pa_ip): Handle 'X' operand.
+	(md_apply_fix): Handle 22bit pc-rel branches.
+
+	* config/tc-hppa.c (pa_ip): Handle 'B' operand.
+
+	* config/tc-hppa.c (pa_ip): Handle 'L' and 'M' operands.
+
+	* config/tc-hppa.c (pa_ip): Handle 'l' operand.
+
+	* config/tc-hppa.c (pa_ip): Handle 'g' operand.
+
+at Sep 18 12:13:28 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (md_assemble): Fix dwarf2 line handling.
+	(pa_ip): Handle 'fX'.
+
+Sat Sep 18 12:13:28 1999  Jeffrey A Law  (law@cygnus.com)
+
+        * config/tc-hppa.c (md_assemble): Fix dwarf2 line handling.
+        (pa_ip): Handle 'fX'.
+
+Fri Sep 17 11:57:34 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_build_unwind_subspace): Do not build
+	unwinds unless the function is in the text space.
+	(pa_type_args): Set BSF_FUNCTION for an exproted data symbol.
+
+Wed Sep 15 05:14:32 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Move dwarf2 stuff from here.
+	(md_assemble): To here.  Tweak address generation.
+
+	* config/tc-hppa.c: Include dwarf2dbg.h if OBJ_ELF.  Declare
+	debug_line.
+	(md_pseudo_table): Add .file and .line pseudo-ops for OBJ_ELF.
+	(md_assemble): Call dwarf2_where for OBJ_ELF.
+	(pa_ip): Call dwarf2_gen_line_info for OBJ_ELF.
+	(pa_end_of_source): New function.
+	* tc-hppa.h (md_end): Define for OBJ_ELF.
+
+1999-09-14  Michael Meissner  <meissner@cygnus.com>
+
+	* configure.in (Canonicalization of target names): Remove adding
+	${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+	generates $ac_config_sub with a ${CONFIG_SHELL} already.
+	* configure: Regenerate.
+
+1999-09-14  Donn Terry  <donn@interix.com>
+
+	* config/te-interix.h (GLOBAL_OFFSET_TABLE_NAME): Define.
+
+1999-09-13  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (md_assemble): Handle "jmp/call constant" as a
+	pc-relative jmp/call to an absolute symbol.
+	(md_apply_fix3): When OBJ_ELF, don't add the values in twice for
+	absolute section symbols.
+
+	* config/tc-i386.c (md_assemble): Correct frag_var size.  Tidy
+	jump handling code and comments.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-i386.c (md_apply_fix3): Add horrible adjustments to
+	the value if TE_PE and a global defined symbol.
+
+1999-09-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* write.c (dump_section_relocs): Call print_symbol_value_1 to
+	print the symbol, rather than printing it here.
+
+1999-09-11  Donn Terry  <donn@interix.com>
+
+	* config/tc-i386.c (tc_i386_fix_adjustable): Don't adjust
+	BFD_RELOC_RVA relocations.
+
+	* config/tc-i386.c (md_undefined_symbol): Compare the name against
+	the macro GLOBAL_OFFSET_TABLE_NAME, rather than assuming that it
+	starts with "_G".
+
+	* write.c (write_relocs): Call SET_SECTION_RELOCS if it is
+	defined.
+	* config/obj-coff.h (SET_SECTION_RELOCS): Define.
+	* doc/internals.texi (Object format backend): Document
+	SET_SECTION_RELOCS.
+
+	* config/tc-i386.c (tc_i386_fix_adjustable): Don't adjust
+	relocations against global symbols if TE_PE.
+
+	* config/obj-coff.c (obj_coff_ident): Add BFD_ASSEMBLER version.
+	(obj_pseudo_table): Always handle ".ident" with obj-coff_ident.
+
+	* config/obj-coff.c (coff_frob_symbol): Prohibit weak common
+	symbols.
+
+	* config/obj-coff.c (obj_coff_endef): Don't merge labels, or
+	symbols which do not have a constant value, or tags with
+	non-tags.  Remove the symbol from the list before adding it at the
+	end.
+
+	* config/obj-coff.c (obj_coff_endef) [BFD_ASSEMBLER]: Handle .ef
+	C_FCN symbol differently if TE_PE.
+	(obj_coff_line) [BFD_ASSEMBLER]: Always use the line number which
+	appears in the pseudo-op, rather coff_line_base which is only set
+	for a .bf symbol.
+
+	* config/obj-coff.c (obj_coff_loc): New static function.
+	(obj_pseudo_table): Add "loc".
+
+	* config/obj-coff.c (add_lineno): Check that the line number is
+	positive.
+
+	* config/atof-ieee.c (atof_ieee): Change what_kind to int.
+	* config/atof-vax.c (flonum_gen2vax): Change format_letter to
+	int.
+	(md_atof): Return NULL rather than 0.
+	* config/tc-i386.c (md_atof): Change type to int.
+	* expr.c (expr): Change first parameter to int.
+	* config/obj-coff.c: Add declarations for static functions.
+	(coff_frob_symbol): Use SYM_AUXENT.
+	* config/tc-i386.h (flag_16bit_code): Don't declare.
+
+	* config/obj-coff.c (obj_coff_section): Default to setting
+	SEC_LOAD.  Don't set SEC_DATA for 'w' modifier.
+
+	* write.c (adjust_reloc_syms): Print adjusted fixup.
+
+	* expr.c (integer_constant): Correct too_many_digits calculation
+	in base 10 case.
+
+1999-09-09  Andreas Schwab  <schwab@suse.de>
+
+	* doc/c-arm.texi: Fix arguments of @var to not contain
+	punctuation.
+
+1999-09-08  Philip Blundell  <pb@nexus.co.uk>
+
+	* config/tc-arm.c (s_thumb_set): Only support interworking for ELF 
+	and COFF targets.
+	(md_parse_option): Only support -k flag for ELF and COFF targets.
+
+Tue Sep  7 13:28:59 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Put strict register checks before
+	call to pa_parse_number.
+
+	* config/tc-hppa.c (pa_ip): Support 'Z' argument.
+
+1999-09-06  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/obj-coff.c: Add ATTRIBUTE_UNUSED as needed for
+	BFD_ASSEMBLER code.
+
+1999-09-06  Donn Terry  <donn@interix.com>
+
+	* as.c (perform_an_assembly_pass): Set SEC_DATA for data_section.
+
+Mon Sep  6 04:26:56 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Get strict/non-strict mode from the
+	candidate instruction.  Require registers for register arguments
+	when in strict mode.  Require assemble-time constants for
+	constants when in strict mode.
+	(pa_get_absolute_expression): Require a constant when in strict
+	mode.
+	
+1999-09-06  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-m32r.c (md_longopts): Fix value for -Wnuh.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* config/tc-pj.c: New file, supports picoJava in ELF.
+	* config/tc-pj.h: Ditto.
+	* configure.in (pjl*, pj*): New targets.
+	* Makefile.am: Rebuild dependencies.
+	(CPU_TYPES): Add pj.
+	(TARGET_CPU_CFILES): Add config/tc-pj.c.
+	(TARGET_CPU_HFILES): Add config/tc-pj.h.
+	* doc/c-pj.texi: New file.
+	* doc/as.texinfo: Add some PJ specifics.
+	* doc/all.texi: Add PJ to the list of all architectures, sort them
+	all alphabetically.
+	* doc/Makefile.in (CPU_DOCS): Add c-pj.texi.
+	* configure, Makefile.in, doc/Makefile.in: Rebuild.
+
+1999-09-02  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/obj-multi.h: Include obj-elf.h if OBJ_MAYBE_ELF. Reformat.
+	(obj_frob_file): Test for null pointer.
+	(OBJ_COPY_SYMBOL_ATTRIBUTES): Here too.
+	(OBJ_PROCESS_STAB): And here.
+	(elf_obj_sy): Remove
+
+	* config/obj-elf.h: #ifndef everything defined in obj-multi.h,
+	except OBJ_PROCESS_STAB, which we #undef for ecoff.
+	(elf_obj_sy): Remove #ifndef OBJ_SYMFIELD_TYPE.
+
+	* config/obj-coff.c (no_func): Remove.
+	(coff_format_ops): Change occurrences of no_func to 0, as we test
+	for 0 in obj-multi.h.
+
+	* configure.in:  Enable bfd for i386-coff when primary target is
+	bfd.  Enable i386 elf,coff emulation support.  Don't set
+	USE_EMULATIONS=1 or te_file=multi unless there is more than one
+	emulation to support.
+	*configure: Regenerate.
+
+1999-09-02  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.c (mcore_s_section): Do not dump literals if a
+	.section .line directive is encountered.
+
+1999-09-01  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_section_align): Do not align sections in ELF
+	format. 
+
+	* as.c (show_usage): Add --gdwarf2 to list of options displayed.
+	* as.texinfo: Document --gdwarf2 command line option.
+	Add additional documentation of ARM command line switches.
+
+1999-08-30  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_intel_memory_operand): Combine
+	i386_is_reg and parse_register calls.  Remove END_STRING_AND_SAVE
+	and RESTORE_END_STRING around parse_register calls.
+	(i386_operand): Here too.
+	(i386_is_reg): Remove.
+	(parse_register): Move as_bad calls from within this function to
+	callers.
+
+1999-08-29  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	Based on a patch from H.J. Lu  <hjl@gnu.org>
+	* config/tc-i386.c (parse_register): Handle FP regs specially.
+	(md_begin): Remove '(' and ')' from register_chars.
+
+1999-08-29  Doug Evans  <devans@casey.cygnus.com>
+
+	* config/tc-m32r.c (md_parse_option): Delete unrecognized option
+	error message (done elsewhere).
+
+Sat Aug 28 01:23:11 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Do not allow '*' in 32bit completers.
+
+Sat Aug 28 00:26:26 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+        * config/tc-hppa.c (pa_ip): Replace 'f' by 'v'.  Prefix float register
+	args by 'f'.
+
+	* config/tc-hppa.c (pa_ip): Add args q, %, and |.
+
+	* config/tc-hppa.c (pa_ip):  Absorb white space in instructions
+	between args.
+	Add new completers.  Fix bug in 64 bit condition handling.
+
+	* config/tc-hppa.c (pa_ip):  Add completer codes 'a', 'ch', 'cH',
+	'cS', and 'c*'.
+
+	* config/tc-hppa.c (pa_ip): Place completers behind prefix 'c'.
+
+	* config/tc-hppa.c (pa_ip):  Add cases for '.', '~'. '$'. and '!'
+
+	* config/tc-hppa.c (pa_ip):  Add case for 'I'.  
+
+1999-08-27  Jim Wilson  <wilson@cygnus.com>
+
+	* dwarf2dbg.c (MAX_SPECIAL_ADDR_DELTA): Correct typo in comment.
+	(struct ls): Add frag field.  Initialize it to zero.
+	(out_end_sequence): New local text_frag.  Set it while in text section.
+	Replace address check with frag check.  Set ls.frag to text_frag if
+	out_set_addr called.
+	(dwarf2_gen_line_info): Add explanatory comment.  New local saved_frag.
+	Set it before switching sections.  Replace address check with frag
+	check.  Set ls.frag to saved_frag if out_set_addr called.
+
+1999-08-26  David Mosberger  <davidm@hpl.hp.com>
+
+        * dwarf2dbg.c (out_end_sequence): If address changed, directly
+	output "advance_pc" opcode instead of calling gen_addr_line().
+	The latter has the undesired side-effect of creating a new row
+	in the debug line info matrix. 
+
+1999-08-26  Jim Wilson  <wilson@cygnus.com>
+
+	* dwarf2dbg.c (out_end_sequence): Correct comments.  Set last to
+	ls.last_filename if last is less than zero.  Set ls.last_filename
+	when allocating new entry.
+	(dwarf2_gen_line_info): Save seg and subseg info before subseg_new
+	call.
+
+1999-08-20  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_index_check): Fix the displacement size
+	when INFER_ADDR_PREFIX.
+
+1999-08-18  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_apply_fix3): If an offset is invalid,
+	display its value.
+
+1999-08-17  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-ppc.c (md_assemble): Trim @ha constant to 16 bits, to
+	handle 0xffffNNNN constants correctly.
+
+1999-08-16  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (do_ldst): Look for register conflicts on stores
+	as well as loads.
+
+1999-08-13  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (validate_offset_imm): Work on unsigned values.
+	(md_apply_fix3): Always pass positive values to
+	validate_offset_imm.
+
+1999-08-12  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (skip_whitespace): New macro.
+	Formatting tidy ups.
+	
+	(md_apply_fix3): Store relocation offset in addend for ELF based
+	relocs.
+	(arm_force_relocation): Always generate relocs for Thumb function
+	calls. 
+	
+1999-08-11  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (md_assemble): Remove dead code.  intel_syntax
+	LONG_DOUBLE_MNEM_SUFFIX floating point is done in opcode/i386.h
+
+Tue Aug 10 12:58:31 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_build_unwind_subspace): Use sane section
+	flags for the unwind subspace.
+
+	* config/tc-hppa.c (UNWIND_SECTION_NAME): Define for ELF.
+	(pa_build_unwind_subspace): Remove #if 0 wrapper.  Select a
+	suitable relocation based on the size of the target's pointer.
+	Always Use subsegment zero for the unwinders.
+	(pa_level): Handle "2.0w".
+
+Mon Aug  9 20:02:22 1998  J"orn Rennecke  <amylaar@cygnus.co.uk>
+
+	* config/tc-d30v.c (write_2_short): Don't group repeat instructions
+	with the following instruction unless this was specified.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-i386.h (SUB_SEGMENT_ALIGN): If TE_GO32, return 4 for
+	certain sections, to match BFD changes.
+
+1999-08-08  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* Makefile.am (noinst_SCRIPTS): Change .gdbinit to $(GDBINIT).
+	(EXTRA_SCRIPTS): Define to keep automake happy.
+	* Makefile.in: Rebuild.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Rename .dep* files to DEP*.
+	(MKDEP): Rename from DEP.  Change all uses.  Use $${srcdir} rather
+	than $(srcdir).  Rename TCDEP targets to DEPTC.  Rename OBJDEP
+	targets to DEPOBJ.
+	* Makefile.in: Rebuild.
+
+1999-08-08  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.c (sparc_ip): Allow assembly of %lo()+%reg.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Change all uses of itbl-test-ops to itbl-tops to
+	avoid problems on DOS filesystems.
+	* Makefile.in: Rebuild.
+
+	* doc/as.texinfo (Section): Document 's' flag for COFF version.
+
+1999-08-08  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* config/obj-coff.c (obj_coff_section): Handle 's' (shared)
+	section flag.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Define and substitute GDBINIT.  Change AC_OUTPUT
+	line to create ${GDBINIT} rather than .gdbinit.
+	* configure, Makefile.in, doc/Makefile.in: Rebuild.
+
+Fri Aug  6 12:12:44 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip, case '?'): Add missing break.
+
+Fri Aug  6 09:46:35 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* config/tc-hppa.c (pa_ip):  Add 64 bit condition completers.
+
+1999-08-06  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.h (tc_fix_adjustable): Fix check for PIC local
+	non-adjustable symbols.
+
+Thu Aug  5 16:52:51 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* config/tc-hppa.c (pa_ip): Change condition args to have '?' prefix.
+
+Thu Aug  5 23:05:56 1999  J"orn Rennecke  <amylaar@cygnus.co.uk>
+
+	* config/tc-sh.c (md_assemble):  Call as_bad when there are excess
+	operands.
+
+1999-08-05  Donn Terry  <donn@interix.com>
+
+	* config/te-interix.h: New file.
+	* configure.in (i386-*-interix*): New target.
+	* configure: Rebuild.
+
+Wed Aug  4 13:12:17 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_chk_field_selector): Allow 3 byte
+	selectors for ELF too.
+	(selector_table): Add "ltp" and "rtp" selectors.
+
+1999-08-04  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (i386_operand): No need to change
+	operand_string pointer in segment reg case before goto
+	do_memory_reference.  Initialise displacement_string_start and
+	displacement_string_end after do_memory_reference label.
+	(i386_index_check): Add operand_string param, and print error
+	message on failure here.
+	(i386_intel_memory_operand): Instead of here.
+	(i386_operand): And here.
+	(INFER_ADDR_PREFIX): Enable.
+
+	* doc/c-i386.texi (i386-16bit): Document .code16gcc.
+
+	* config/tc-i386.h (DefaultSize): Define.  Renumber following
+	opcode_modifier defines.
+
+	From Etienne Lorrain  <etienne.lorrain@ibm.net>
+	* config/tc-i386.c (stackop_size): New variable.
+	(set_16bit_code_flag): Clear it here.
+	(set_16bit_gcc_code_flag): New function.
+	(md_pseudo_table): Add "code16gcc" entry.
+	(md_assemble): Set i.suffix for insns with DefaultSize modifier.
+
+1999-08-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/obj-coff.c (coff_frob_symbol): Always update set_end with
+	next_set_end even if the end symbol is being discarded.
+
+	* gasp.c: Add ATTRIBUTE_UNUSED as needed for non-BFD_ASSEMBLER.
+	* output-file.c, symbols.c, config/tc-i386.c: Likewise.
+	* config/obj-coff.c: Likewise.
+	(seg_info_type): Remove.
+	(seg_info_off_by_4): Change to array of segT.
+	(s_get_segment): Adjust accordingly.
+	(obj_pseudo_table): Fully initialize sentinel entry.
+
+	* config/tc-mips.c (append_insn): Correct INSN_SYNC test.  From
+	Ralf Baechle <ralf@uni-koblenz.de>.
+
+1999-08-03  Etienne Lorrain  <etienne.lorrain@ibm.net>
+
+	* config/tc-i386.c (f16_3): New. Fixes 16 bit 3 byte nop.
+
+1999-08-03  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c: Indentation and white space changes.
+	(i386_index_check): New function.  Add INFER_ADDR_PREFIX code, but
+	don't enable it by default.
+	(i386_intel_operand): Remove redundant prototype.
+	Move check on number of memory operands, and i.mem_operands++
+	(i386_intel_memory_operand): To here.
+	Remove i386_immediate code from here.  Remove special case code
+	for input and output using (%dx).  Remove base/index checks and
+	call i386_index_check instead.  Save initial operand_string
+	argument for error message.
+	(i386_operand): Remove redundant prototype.  Move base/index
+	checks to i386_index_check.
+	(i386_displacement): Move intel mode check for non-zero
+	i.disp_operand
+	(i386_intel_memory_operand): To here.
+
+1999-07-30  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.c (md_longopts): Add --no-undeclared-regs option.
+	(sparc_ip): Warn if %g2 or %g3 register is used and not covered
+	by .register pseudo-op if -64 and --no-undeclared-regs.
+	(s_register, sparc_adjust_symtab): New functions.
+	* config/tc-sparc.h (tc_adjust_symtab, sparc_adjust_symtab):
+	Declare sparc_adjust_symtab as tc_adjust_symtab.
+	* doc/c-sparc.texi: Add description of #ignore special literal
+	for .register pseudo-op.
+
+1999-07-30  Catherine Moore  <clm@cygnus.com>
+
+	* config/tc-arm.c (tc_gen_reloc):  Record the vtable entry in
+	the relocation's section offset.
+
+1999-07-29  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* write.c (fixup_segment): Fix generic error check overflow test.
+
+	* config/tc-i386.c (pe): Change %d to %ld, %x to %lx, and cast
+	X_add_number to long.
+
+Wed Jul 28 02:04:24 1999  "Jerry Quinn" <jquinn@nortelnetworks.com>
+
+	* config/tc-hppa.c (pa_ip):  Add 'J' and 'K' code
+	processing. 
+
+1999-07-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-sparc.h (tc_fix_adjustable): Don't adjust GOT, PLT, or
+	VTABLE relocations.
+
+1999-07-21  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* config/te-go32.h (COFF_LONG_SECTION_NAMES): Define.
+
+	* configure.bat: Remove; obsolete.
+	* config/go32.cfg: Likewise.
+
+1999-07-21  Brad M. Garcia  <bgarcia@fore.com>
+
+	* configure.in (i386-*-vxworks*): New target.
+	* configure: Rebuild.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* doc/c-sparc.texi: Document .register and .nword pseudo-ops.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.c (sparc_ip): Allow OLO10 relocations
+	on -64 and not pic.
+	(output_insn): Put OLO10's secondary addend into tc_fix_data.
+	(md_apply_fix3): Handle BFD_RELOC_SPARC_OLO10.
+	(tc_gen_reloc): Return two relocs for OLO10, LO10 and SPARC13.
+	* config/tc-sparc.h (RELOC_EXPANSION_POSSIBLE,
+	MAX_RELOC_EXPANSION): Define.
+	(TC_FIX_TYPE, TC_INIT_FIX_DATA, TC_FIX_DATA_PRINT): Likewise.
+
+1999-07-16  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (intel_float_operand): Add prototype, make static.
+	(md_assemble): Localize *exp variable to if (fake_zero_displacement)
+	block.  Print a warning if an 8-bit or 16-bit constant
+	displacement or immediate is truncated on output.
+	(i386_immediate): Ensure Imm16 is always legal for a 16-bit mode
+	immediate.
+	(i386_operand): Disallow immediate jump absolute operand.
+
+1999-07-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Bump version number to 2.9.5.
+	* configure: Rebuild.
+
+	* dwarf2dbg.c (dwarf2_gen_line_info): Don't assume that long long
+	or %llx work.
+
+Thu Jul 15 02:45:30 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (md_pseudo_table): Add ".dword" pseudo-op.
+	(cons_fix_new_hppa): Derive size of fixup from size of the object.
+
+1999-07-14  Philip Blundell  <pb@nexus.co.uk>
+
+	* symbols.c (dollar_label_name): Prepend LOCAL_LABEL_PREFIX if it
+	is defined.
+	* config/tc-arm.h (LOCAL_LABEL_PREFIX): Define to '.' for ELF.
+
+	* config/tc-arm.c (md_begin): Set F_SOFTFLOAT in the output file
+	if -mno-fpu was given.
+	(tc_gen_reloc): Fix typo.  Delete bogus code related to GOTPC
+	relocs.
+	(cons_fix_new_arm): Remove misleading comments.
+
+1999-07-14  Ian Lance Taylor  <ian@zembu.com>
+
+	* write.c (cvt_frag_to_fill): Use frag file and line in rs_org
+	error message.
+	(relax_segment): Likewise.  After giving a rs_org error, convert
+	the frag to rs_align to avoid cascading errors.
+
+1999-07-12  Andreas Schwab  <schwab@suse.de>
+
+	* config/tc-m68k.c: Add some ATTRIBUTE_UNUSED.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+	as appropriate.  Fill in structure initializations.  Add variable
+	initializations.  Add casts.
+	* dwarf2dbg.c (print_stats): Change i to size_t.
+	* listing.c (listing_listing): Change list_line to unsigned int.
+
+1999-07-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-ppc.h (tc_fix_adjustable) [OBJ_ELF]: Call S_IS_LOCAL
+	rather than checking for \001 and \002 in symbol name.
+	* config/tc-sparc.h (tc_fix_adjustable) [OBJ_ELF]: Likewise.
+
+Thu Jul  8 12:32:23 1999  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* configure.in (hppa*-linux-gnu*): New target.
+	* configure: Rebuilt.
+
+1999-07-08  Nick Clifton  <nickc@cygnus.com>
+
+	* doc/c-arm.texi (ARM Directives): Document .thumb_set directive. 
+
+1999-07-07  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-v850.c (v850_comm): Use symbol_get_obj() rather than
+	accessing symbolP directly.
+
+Tue Jul  6 10:41:42 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.h (tc_frob_symbol): Always punt "$global$" symbol
+	for ELF.
+
+1999-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (ARM_EXT_V5): Define.
+	(ARM_ARCH_V5, ARM_ARCH_V5T): Define.
+	(md_begin): Detect ARM v5 architectures.
+	(md_parse_option): Accept arm v5 specification.
+	(md_show_usage): Documment -marmv5 switch.
+
+	* doc/c-arm.texi: Document -marmv5 command line option.
+	
+	* config/tc-arm.c (do_adrl): New function.  Implement ADRL pseudo
+	op.
+	(validate_immediate_twopart): New function.  Determine if a
+	constant can be computed by two ADD instructions.
+	(output_inst): Remove its command line parameter - it was never
+	used.
+	(md_apply_fix3): Support BFD_RELOC_ARM_ADRL_IMMEDIATE, used to
+	implememt the ADRL pseudo op.
+	(tc_gen_reloc): Generate a suitable error message if an ADRL
+	instruction tries to generate a real reloc.
+
+	* doc/c-arm.texi: Document NOP, ADR and ADRL pseudo ops.
+
+Thu Jul  1 15:33:10 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (pa_ip): Convert the opcode and all completers
+	into lower case.
+
+1999-06-27  H.J. Lu  <hjl@gnu.org>
+
+	* subsegs.c (subseg_text_p): Use 1/0 instead of true/false for
+	non BFD_ASSEMBLER case.
+
+1999-06-26  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* config/obj-coff.c (obj_coff_section): Mark writable sections as
+	data.
+
+1999-06-26  David Mosberger  <davidm@hpl.hp.com>
+
+	* dwarf2dbg.c (dwarf2_gen_line_info): Don't call
+	out_end_sequence() when the address decreases due to a new frag.
+	(gen_dir_list): Set ls.file[i].dir to j + 1 (not j) because file
+	numbering starts with 1.
+
+1999-06-23  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.c (md_pseudo_table): Add .comm for ELF and allow
+	.section for COFF.
+	(mcore_s_text): Call obj_elf_text for ELF target.
+	(mcore_s_data): Call obj_elf_data for ELF target.
+	(mcore_s_section): No longer ELF specific.  Call obj_coff_section
+	for COFF target.
+	(mcore_s_bss): New function:  Dump literal table before changing
+	sections.
+	(mcore_s_comm): New function:  Dump literal table before changing
+	sections.
+	
+	* config/obj-elf.c (obj_elf_common, obj_elf_data, obj_elf_text):
+	No longer static functions.
+	* config/obj-elf.h (obj_elf_common, obj_elf_data, obj_elf_text):
+	Provide prototypes for these functions.
+
+1999-06-22  Ian Lance Taylor  <ian@zembu.com>
+
+	* subsegs.c (subseg_text_p): Rewrite non BFD_ASSEMBLER case to use
+	a list of names, to try obj_segment_name, and to try abbreviated
+	names when using COFF without long section names.
+
+	* config/tc-alpha.c: More use of symbol accessor functions.
+	* config/tc-arc.c: Likewise.
+	* config/tc-d30v.c: Likewise.
+	* config/tc-fr30.c: Likewise.
+	* config/tc-i860.c: Likewise.
+	* config/tc-m88k.c: Likewise.
+	* config/tc-mcore.c: Likewise.
+	* config/tc-ns32k.c: Likewise.
+	* config/tc-sparc.c: Likewise.
+	* config/tc-v850.c: Likewise.
+
+	* config/tc-arc.c (get_arc_exp_reloc_type): Change uses of
+	sy_value with appropriate accessor functions.
+	* config/tc-arm.c (md_apply_fix3): Likewise.
+	* config/tc-d10v.c (AT_WORD_P): Likewise.
+	* config/tc-v850.c (reg_name_search): Likewise.
+
+	* config/obj-ecoff.c (obj_ecoff_set_ext): Change uses of bsym to
+	use symbol_get_bfdsym instead.
+	* config/tc-ppc.c (md_assemble): Likewise.
+	* config/tc-v850.c (v850_comm): Likewise.
+
+1999-06-22  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+
+	* config/tc-arc.c (tc_gen_reloc): Use symbol_get_bfdsym to get at
+	the symbol, rather than accessing the bsym member.
+	* config/tc-d10v.c (tc_gen_reloc): Likewise.
+	* config/tc-d30v.c (tc_gen_reloc): Likewise.
+	* config/tc-mcore.c (tc_gen_reloc): Likewise.
+	* config/tc-mn10200.c (tc_gen_reloc): Likewise.
+	* config/tc-mn10300.c (tc_gen_reloc): Likewise.
+	* config/tc-ns32k.c (tc_gen_reloc): Likewise.
+	* config/tc-tic30.c (tc_gen_reloc): Likewise.
+	* config/tc-v850.c (tc_gen_reloc): Likewise.
+
+Mon Jun 21 16:45:19 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* tc-hppa.c (elf_hppa_reloc_type): Renamed from elf32_hppa_reloc_type.
+	(hppa_gen_reloc_type): Conditionalize on BFD64.
+	(tc_gen_reloc): Re-enable ELF relocations.
+	* tc-hppa.h (TARGET_FORMAT): Handle elf64-hppa format.
+
+1999-06-21  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-arm.c (ldst_extend): Add parentheses to avoid
+	warning.
+	(do_ldst): Move assignment out of if condition.
+	(md_apply_fix3): Add casts to avoid printf format warnings.  Add
+	parentheses to avoid warning.
+
+1999-06-21  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (arm_adjust_symtab): Use symbol_get_bfdsym()
+	macro to get at the BFD symbol associated with a GAS symbol.
+
+1999-06-19  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-ppc.c: Update for symbol handling changes.
+	* config/obj-coff.c: Likewise.
+
+Fri Jun 18 14:34:18 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* tc-hppa.c: General cleanups of ELF support.  No more spaces
+	and subspaces for ELF.
+	(GDB_DEBUG_SPACE_NAME): Delete definition for ELF.
+	(GDB_STRINGS_SUBSPACE_NAME): Likewise.
+	(GDB_SYMBOLS_SUBSPACE_NAME): Likewise
+	(UNWIND_SECTION_NAME): Likewise.
+	(space/subspace related structures): Conditionalize definitions
+	on OBJ_SOM.
+	(space/subspace directives and support routines): Conditionalize
+	definitions and references/uses on OBJ_SOM.
+	(label_symbol_struct): For ELF, track the symbol's segment.  For
+	SOM track its space.
+	(pa_define_label, pa_undefine_label, pa_get_label): Corresponding
+	changes.
+	(USE_ALIASES): Kill for both SOM & ELF.
+	(pa_def_subspaces, pa_def_spaces): Corresponding changes.
+	(pa_space, pa_subspace): Corresponding changes.
+	(pa_spaces_begin): Corresponding chagnes.
+	(md_begin): Do not muck around with space/subspace stuff for
+	OBJ_ELF.
+	(md_apply_fix): Temporarily disable argument relocation stuff
+	for OBJ_ELF.
+	(tc_gen_reloc): Temporarily disable relocation generation for
+	OBJ_ELF
+	(pa_build_unwind_subspace): Similarly.
+
+1999-06-16  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (thumb_set): New pseudo op.
+	(text, data, section): Override these pseudo ops with ARM
+	specific versions.
+	(s_thumb_set): New function: Perform the same as a .set pseudo
+	op, but also mark the alias'ed symbol as being a Thumb
+	function.
+	(arm_s_text): New function: Perform the same as the .text
+	pseudo op, but dump the literal pool before changing
+	sections. 
+	(arm_s_data): New function: Perform the same as the .data
+	pseudo op, but dump the literal pool before changing
+	sections. 
+	(arm_s_section): New function: Perform the same as the
+	.section pseudo op, but dump the literal pool before changing 
+	sections. 
+	(arm_cleanup): Do not reset the current section before dumping
+	the literal pool.
+
+1999-06-17  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-m32r.c (md_longopts): Fix OPTION_WARN_UNMATCHED and
+	OPTION_NO_WARN_UNMATCHED entries.
+	(md_parse_option): Generate a warning message if an unrecognised
+	option is encountered.
+
+	* config/tc-d10v.c (do_not_ignore_hash): New variable.
+	(get_operands): When parsing an expression after an '@' symbol
+	has been detected, do not ignore '#' symbols.
+	(md_operand): Only ignore '#' symbols if do_not_ignore_hash is
+	false. 
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	From K. Richard Pixley <rich@noir.com>:
+	* configure.in (ppc-*-vxworks*): New target.
+	* configure: Rebuild.
+
+1999-06-12  Philip Blundell  <philb@gnu.org>
+
+	* config/tc-arm.c (tc_gen_reloc): Fix handling of GOTPC relocs.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* write.c (adjust_reloc_syms): Rather than never reducing reloc
+	which refer to symbols in linkonce sections, permit reducing the
+	relocs if the symbol is local.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* subsegs.c (subseg_text_p): New function.
+	* as.h (subseg_text_p): Declare.
+	* read.c (do_align): Use subseg_text_p to set the default fill.
+	* write.c (subsegs_finish): Likewise.
+	* config/obj-coff.c (write_object_file): Likewise.
+	* config/tc-i386.h (md_maybe_text): Don't define.
+	(md_do_align): Use subseg_text_p to set the default fill.
+	* config/tc-m32r.c (m32r_do_align): Likewise.
+	* config/tc-sh.c (sh_do_align): Likewise.
+	* config/tc-sparc.h (md_do_align): Likewise.
+
+1999-06-12  David O'Brien  <obrien@freebsd.org>
+
+	* configure.in: (i[3456]86-*-freebsd*): Now defaults to ELF.
+	* configure: Rebuild.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* dwarf2dbg.c: Include elf/dwarf2.h with "", not <>.
+	* Makefile.am: Rebuild dependencies.
+	* Makefile.in: Rebuild.
+
+	* config/tc-i386.c (i386_immediate): Remove unused label
+	seg_unimplemented.
+
+	* struc-symbol.h: Put local_symbol code in ifdef BFD_ASSEMBLER.
+	* symbols.c: Likewise.
+	* config/obj-aout.c (obj_crawl_symbol_chain): Refer directly to
+	sy_next field when taking address, rather than symbol_next.
+
+	* dwarf2dbg.c: Change bfd_vma to addressT and bfd_signed_vma to
+	offsetT.
+	(out_set_addr): Don't use BYTES_PER_ADDRESS.  Instead, get the
+	value from the output file architecture.
+	(dwarf2_gen_line_info): Ifdef BFD_ASSEMBLER specific code.
+	* dwarf2dbg.h: Change bfd_vma to addressT.
+
+1999-06-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* dwarf2dbg.h: Use PARAMS in function declarations.
+
+1999-06-11  Martin Dorey  <mdorey@madge.com>
+
+	* write.c (fixup_segment): Don't add symbol value for i960 ELF.
+	* config/tc-i960.c (s_leafproc): Don't call tc_set_bal_of_cal if
+	OBJ_ELF.
+	(md_apply_fix): Simplify BFD_ASSEMBLER handling.
+
+1999-06-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* config/tc-i386.c (md_apply_fix3): Add default case to switch.
+
+	* config/tc-sparc.c (md_pseudo_table): Remove pushsection and
+	popsection.
+
+	* config/tc-sparc.c (sparc_ip): Add default case to reloc switch.
+
+	* read.c (read_a_source_file): Only declare inescape if
+	QUOTES_IN_INSN.
+
+	* itbl-ops.c (itbl_disassemble): Change sprintf format strings to
+	match parameters.
+	(find_entry_byval): Add parens to avoid warning.
+
+	* as.c: If HAVE_ITBL_CPU, include "itbl-ops.h".
+
+	* symbols.c (resolve_symbol_value): Don't permit subtraction of
+	undefined symbols.
+
+1999-06-10  Jakub Jelinek  <jj@ultra.linux.cz>
+
+        * config/tc-sparc.c (sparc_ip): Don't use side-effect expression
+	with isoctal.
+
+	* config/tc-sparc.c (synthetize_setuw, synthetize_setsw,
+	synthetize_setx): New functions.
+	(md_assemble): Broken the special cases into the above
+	functions. Make compiler happy if sizeof(bfd_vma)==4.
+	Fix sethi generated from set/setuw. If instructions have a relloc,
+	always clear the fields to be relocated in the opcode.
+	(sparc_ip): Remove special_case global variable.
+
+1999-06-10  Ian Lance Taylor  <ian@zembu.com>
+
+	Based on patches from John W. Woznack <jwoznack@concentric.net>:
+	* itbl-ops.c (itbl_get_reg_val): Add pval parameter.  Return
+	indication of success rather than a value.
+	(itbl_get_val): Likewise.
+	(itbl_get_field): Use strcspn.  Change delimiters to include
+	parens.
+	* itbl-ops.h (itbl_get_reg_val): Update declaration.
+	(itbl_get_val): Likewise.
+	* config/tc-mips.c (mips_ip): Update call to itbl_get_reg_val.
+
+	* symbols.c (copy_symbol_attributes): Convert local symbols to
+	regular symbols.
+
+1999-06-10  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_parse_option): Add support for ARM920 and
+	ARM920t. 
+
+1999-06-07  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.c (md_assemble): Fix up setx, support setsw.
+	Optimize set if sizeof(bfd_vma) == 64.
+	(sparc_ip): Fix sethi - without %hi() it should generate
+	R_SPARC_22 reloc, not R_SPARC_HI22.
+	(tc_gen_reloc): Handle BFD_RELOC_SPARC22.
+
+1999-06-07  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* config/tc-sparc.c (md_begin): Handle native wordsize aliases.
+	(s_ncons): New function.
+	(native_op_table): New table.
+	(sparc_ip): Be more strict on %hi() etc.; prepare assembler for
+	R_SPARC_OLO10 handling.
+
+Mon Jun  7 10:22:16 1999  Richard Henderson  <rth@cygnus.com>
+
+	* expr.h (struct expressionS): Revert last change; widen X_op.
+	* config/tc-alpha.c (md_begin): Check the field is wide enough.
+
+Mon Jun  7 11:25:16 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* Makefile.am (TARGET_CPU_CFILES): Add config/tc-fr30.c.
+	(TARGET_CPU_HFILES): Add config/tc-fr30.h.
+	(TARG_ENV_HFILES): Add config/te-epoc-pe.h.
+	* Makefile.in: Regenerated.
+
+	* config/obj-elf.c (obj_elf_common): In MRI mode if called as
+	`common' pass on to s_mri_common.
+	(elf_pseudo_table): Pass 1 to obj_elf_common for `common'. 
+
+1999-06-06  Richard Henderson  <rth@cygnus.com>
+
+	* config/obj-elf.c (obj_elf_section): Don't free the return
+	value of demand_copy_C_string.
+
+1999-06-05  Richard Henderson  <rth@cygnus.com>
+
+	* dwarf2dbg.c (dwarf2_gen_line_info): Mirror the section symbol
+	creation logic from obj_elf_create_section.
+
+	* config/obj-elf.c (elf_pseudo_tab): Add pushsection/popsection.
+	(section_stack): New.
+	(special_sections): Make const.
+	(obj_elf_section): Gut and rewrite parsing.
+	(obj_elf_change_section): New function broken out of obj_elf_section.
+	(obj_elf_parse_section_letters): Likewise.
+	(obj_elf_section_word): Likewise.
+	(obj_elf_section_type): Likewise.
+	(obj_elf_previous): Treat as a toggle.
+	(obj_elf_popsection): New.
+	* config/tc-ppc.c (ppc_section_word): Take str+len not ptr_str.
+	(ppc_section_type): Likewise.
+	* config/tc-ppc.h: Likewise.
+
+	* expr.h (struct expressionS): Don't make X_op a bitfield.
+	* config/tc-alpha.c: Update for symbol handling changes.
+	(md_apply_fix) [case GPREL]: Use now_seg instead of absolute_section.
+	(load_expression, emit_ir_load, emit_loadstore, emit_jsrjmp): Likewise.
+
+1999-06-05  Richard Henderson  <rth@cygnus.com>
+
+	* dwarf2dbg.c (*): Convert to K&R + prototypes.
+	(dwarf2_gen_line_info): Kill unused variables.
+	(dwarf2_finish): Likewise.
+	(dwarf2_where): Likewise.
+	(dwarf2_directive_file): If we've only got a string,
+	hand off to s_app_file.
+	* ecoff.c: Move the include of ecoff.h.
+	* symbols.h (S_IS_FUNCTION): Prototype.
+
+	* read.c (LEX_HASH): Supply a default.
+	(lex_type): Use it.
+	(s_globl): Update `c' after skipping whitespace.
+	* read.h (LEX_END_NAME, is_name_ender): New.
+	* expr.c (get_symbol_end): Respect it.
+
+1999-06-04  Mark Klein <mklein@dis.com>
+
+	* config/tc-hppa.c (md_begin): Convert local symbol dummy_symbol
+	to real if OBJ_SOM
+	(tc_gen_reloc): Still need bfd_abs_symbol in some relocs.
+
+	* config/tc-hppa.c: Update for symbol handling changes.
+
+1999-06-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* cgen.c: Update for symbol handling changes.
+	* config/tc-m32r.c: Likewise.
+
+	* config/tc-hppa.h: Update for symbol handling changes.
+	* config/tc-hppa.c: Likewise.
+
+	* config/tc-arm.h: Update for symbol handling changes.
+	* config/tc-arm.c: Likewise.
+	(symbol_make_empty): Remove.  Just use symbol_create.
+
+	* symbols.c (symbol_set_tc): Correct name.
+
+	* Makefile.am: Rebuild dependencies.
+	($(OBJS)): Don't depend upon struc-symbol.h.
+	(.dep1, .tcdep, .objdep): Create itbl-parse.h.
+	* dep-in.sed: Don't remove struc-symbol.h.
+	* Makefile.in: Rebuild.
+
+	* doc/internals.texi (Symbols): Describe changes in symbol
+	handling.
+
+1999-06-03  Richard Henderson  <rth@cygnus.com>
+
+	* dwarf2dbg.c (dwarf2_gen_line_info): Use section_symbol
+	instead of doing the work by hand.
+
+1999-06-03  David Mosberger  <davidm@hpl.hp.com>
+
+	* dwarf2dbg.c (INITIAL_STATE): New macro encapsulating initial
+	state of line state-machine.
+	(struct ls): Collect DWARF2 line state-machine state in new member
+	SM.  Add member EMPTY_SEQUENCE to keep track if a code sequence
+	resulted in any DWARF2 directives.
+	(reset_state_machine): New function.
+	(out_end_sequence): Ditto.
+	(dwarf2_gen_line_info): When switching sections or switching to a
+	lower text address, call out_end_sequence() first to terminate the
+	previous code sequence as code sequences MUST have monotonically
+	increasing addresses.
+	(dwarf2_finish): Call out_end_sequence() instead of open coding it.
+
+1999-06-03  David Mosberger  <davidm@hpl.hp.com>
+
+	* as.c (parse_args): Add option -gdwarf2 to allow requesting
+	DWARF2 debug info (line information only, at this point).
+	* as.h: Update comment about supported debug formats.
+	* dwarf2dbg.c, dwarf2dbg.h: New files.
+	* Makefile.am (GAS_CFILES, HFILES, GENERIC_OBJS): Add them.
+
+	* expr.c (operand): Don't use [ for parens if we want an index op.
+	(op_encoding): Switch [ into O_index, if desired.
+	(op_rank): Renumber with O_index on bottom.
+	(expr): If O_index, match closing bracket.
+	* expr.h (O_index): New.
+
+	* read.c (read_a_source_file): Conditionally allow matched "
+	in lines passed to md_assemble.
+
+	* config/obj-elf.c (elf_pseudo_table): Add `common'.
+
+1999-06-03  Ian Lance Taylor  <ian@zembu.com>
+
+	Add support for storing local symbols in a small structure to save
+	memory when assembling large files.
+	* as.h: Don't include struc-symbol.h.
+	(symbolS): Add typedef.
+	* symbols.c: Include struc-symbol.h.
+	(local_hash): New static variable.
+	(save_symbol_name): New static function, from symbol_create.
+	(symbol_create): Call save_symbol_name.
+	(local_symbol_count): New static variable.
+	(local_symbol_conversion_count): Likewise.
+	(LOCAL_SYMBOL_CHECK): Define.
+	(local_symbol_make): New static function.
+	(local_symbol_convert): New static function.
+	(colon): Handle local symbols.  Create local symbol for local
+	label name.
+	(symbol_table_insert): Handle local symbols.
+	(symbol_find_or_make): Create local symbol for local label name.
+	(symbol_find_base): Check for local symbol.
+	(symbol_append, symbol_insert): Check for local symbols.
+	(symbol_clear_list_pointers, symbol_remove): Likewise.
+	(verify_symbol_chain): Likewise.
+	(copy_symbol_attributes): Likewise.
+	(resolve_symbol_value): Handle local symbols.
+	(resolve_local_symbol): New static function.
+	(resolve_local_symbol_values): New function.
+	(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
+	(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
+	(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
+	(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
+	(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
+	(symbol_previous, symbol_next): New functions.
+	(symbol_get_value_expression): Likewise.
+	(symbol_set_value_expression): Likewise.
+	(symbol_set_frag, symbol_get_frag): Likewise.
+	(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
+	(symbol_mark_used_in_reloc): Likewise.
+	(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
+	(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
+	(symbol_mri_common_p): Likewise.
+	(symbol_mark_written, symbol_clear_written): Likewise.
+	(symbol_written_p): Likewise.
+	(symbol_mark_resolved, symbol_resolved_p): Likewise.
+	(symbol_section_p, symbol_equated_p): Likewise.
+	(symbol_constant_p): Likewise.
+	(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
+	(symbol_get_obj, symbol_set_obj): Likewise.
+	(symbol_get_tc, symbol_set_tc): Likewise.
+	(symbol_begin): Initialize local_hash.
+	(print_symbol_value_1): Handle local symbols.
+	(symbol_print_statistics): Print local symbol statistics.
+	* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
+	Declare new symbols.c functions.  Move many declarations here from
+	struc-symbol.h.
+	(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
+	* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
+	(struct symbol): Move bsym to make it clearly the first field.
+	Remove TARGET_SYMBOL_FIELDS.
+	(symbolS): Don't typedef.
+	(struct broken_word): Remove.
+	(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
+	(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
+	(symbol_clear_list_pointers): Likewise.
+	(symbol_insert, symbol_remove): Likewise.
+	(symbol_previous, symbol_append): Likewise.
+	(verify_symbol_chain, verify_symbol_chain_2): Likewise.
+	(struct local_symbol): Define.
+	(local_symbol_converted_p, local_symbol_mark_converted): Define.
+	(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
+	(local_symbol_get_frag, local_symbol_set_frag): Define.
+	(local_symbol_get_real_symbol): Define.
+	(local_symbol_set_real_symbol): Define.
+	Define.
+	* write.c (write_object_file): Call resolve_local_symbol_values.
+	* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
+	(TARGET_SYMBOL_FIELDS): Don't define.
+	* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field.  If
+	ECOFF_DEBUGGING, add ECOFF fields.
+	(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
+	* config/obj-multi.h (struct elf_obj_sy): Add local field.  If
+	ECOFF_DEBUGGING, add ECOFF fields.
+	(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
+	(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
+	* config/tc-mcore.h: Don't include struc-symbol.h.
+	(TARGET_SYMBOL_FIELDS): Don't define.
+	(struct mcore_tc_sy): Define.
+	(TC_SYMFIELD_TYPE): Define.
+	* Many files: Use symbolS instead of struct symbol.  Use new
+	accessor functions rather than referring to symbolS fields
+	directly.
+
+	* read.c (s_mri_common): Don't add in value of line_label.
+
+	* config/tc-mips.c (md_apply_fix): Correct parenthesization when
+	checking for SEC_LINK_ONCE.
+
+	* config/tc-sh.h (sh_fix_adjustable): Declare.
+
+	* app.c (input_buffer): New static variable.
+	(app_push): Save saved_input in allocated buffer.
+	(app_pop): Restored saved_input.
+	(do_scrub_chars): Change get parameter to take char * and int as
+	arguments.  Change GET macro to pass input_buffer to get
+	function.  Don't save input into allocated buffer.
+	* as.h (do_scrub_chars): Update declaration.
+	* input-file.c (input_file_get): Change to take char * and int.
+	Read data into passed in buffer.  Remove static buffer.
+	* read.c (scrub_from_string): Change to take char * and int.  Copy
+	data into passed in buffer.
+
+	* hash.h: Neaten.  Declare hash_traverse.
+	* hash.c: Complete rewrite based on BFD hashing code.
+	* gasp.c (chunksize): New variable.
+	* macro.c (macro_expand_body): Call hash_jam with NULL rather than
+	hash_delete.
+
+1999-05-28  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-arm.c (md_apply_fix3): Add pipeline offset into reloc
+	addend unless the target uses an old ABI.
+
+Mon May 24 13:36:55 1999  Doug Evans  <devans@canuck.cygnus.com>
+
+	-Wchar-subscripts cleanup
+	* listing.c (listing_newline): Use unsigned char variable, so
+ 	calls to isascii,iscntrl are correct.
+	* atof-generic.c (atof_generic): Cast arg to isdigit, et. al. with
+	(unsigned char).
+	* ecoff.c (ecoff_directive_ent,ecoff_stab): Ditto.
+	* config/obj-elf.c (obj_elf_vtable_inherit): Ditto.
+	* config/tc-mips.c (mips_ip,mips16_ip): Ditto.
+	(my_getSmallExpression,get_number,s_mips_ent): Ditto.
+
+1999-05-28  Torbjorn Granlund  <tege@matematik.su.se>
+
+	* config/tc-m68k.c (m68k_ip): Check for disallowed index register
+	width for Coldfire.
+	(arch_coldfire_p): New #define.
+	(m68k_ip, m68k_init_after_args): Use arch_coldfire_p.
+
+1999-05-28  Linus Nordberg  <linus.nordberg@canit.se>
+
+	* config/tc-m68k.c (install_operand): Add places `n', `o'.
+
+	* config/tc-m68k.c (m68k_ip): Add formats `E', `G', `H'.
+	(install_operand): Add place `N'.
+	(init_table): Add registers ACC, MACSR, MASK.
+
+	* config/m68k-parse.h (m68k_register): Add ACC, MACSR, MASK.
+
+	* config/tc-m68k.c: Change mcf5200 --> mcf.
+	(archs): Add mcf5206e, mcf5307.
+	(m68k_ip): Add format `u'.
+	(install_operand): Add place `m', `M', `h'.
+	(init_table): Add upper/lower registers.
+
+	* config/m68k-parse.h (m68k_register): Add upper/lower registers.
+
+1999-05-28  Martin Dorey  <mdorey@madge.com>
+
+	* config/tc-i960.c: Several minor changes to add ELF and
+	BFD_ASSEMBLER support.
+	* config/tc-i960.h: Likewise.
+	* configure.in (i960-*-elf*): New target.
+	* aclocal.m4, configure: Rebuild.
+
+1999-05-25  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (md_apply_fix3): Only do 1999-05-17 fx_pcrel
+	reloc changes when defined(BFD_ASSEMBLER).
+
+1999-05-17  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.c (tc_gen_reloc): Remove F and MAP macros.
+
+	* write.c (write_print_statistics): Output to file, not stderr.
+
+	* expr.c (generic_bignum_to_int32,64): Prototype.
+
+	* read.c (s_lcomm_internal, sizeof_sleb128, sizeof_uleb128,
+	output_sleb128, output_uleb128, output_big_sleb128,
+	output_big_uleb128, output_big_leb128): Prototype.
+	(output_big_sleb128, output_big_uleb128): Make inline.
+	(output_big_leb128): Remove inline
+
+	From Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+	* config/tc-i386.c (md_apply_fix3): Convert BFD_RELOC_16 with
+	fx_pcrel set to BFD_RELOC_16_PCREL.  Similarly for BFD_RELOC_8.
+	Handle BFD_RELOC_16_PCREL and BFD_RELOC_8_PCREL.  Return changed
+	value for correct overflow check in write.c:fixup_segment.
+	* write.c (fixup_segment): Move bitfield overflow checks to after
+	the md_apply_fix call.
+	* config/obj-coff.c (fixup_segment): Likewise.
+	* doc/internals.texi (CPU backend): Mention md_apply_fix modifying
+	valueT *val argument.
+
+Fri May 14 10:52:13 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* config/atof-ieee.c (gen_to_words): Correctly round a
+	denormalized number.  Fix off-by-one in range checking for
+	exponent in a denormal. 
+
+1999-05-10  Nick Clifton  <nickc@cygnus.com>
+
+	* config/tc-mcore.c (parse_reg): Accept 'sp' as a valid register
+	name. 
+
+Thu May 13 09:46:59 1999  Joel Sherrill (joel@OARcorp.com)
+
+	* configure.in (i386-*-rtemself*, sh-*-rtemself*): New targets.
+
+1999-05-12  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* config/tc-i386.h (InvMem): New flag.  Add to AnyMem.
+	(ReverseRegRegmem): Remove.
+	(ImmExt): New flag.  Renumber some of the opcode_modifier bits.
+	* config/tc-i386.c (md_assemble): Test for PIII SIMD and AMD
+	3DNow! via ImmExt opcode_modifier.  Remove ReverseRegRegmem
+	kludge.
+
+	From  Doug Ledford <dledford@redhat.com>
+	* config/tc-i386.h (RegXMM): New for P/III.
+	* config/tc-i386.c: Add support for P/III.
+
+Sat May  8 23:28:50 1999  Richard Henderson  <rth@cygnus.com>
+
+	* config/tc-ppc.c (md_parse_option): Recognize -mppc64bridge.
+	(md_begin): Allow ppc32 insns in ppc64bridge mode.
+	(ppc_insert_operand): Accept SIGNOPT in ppc64 mode.
+
+Thu May  6 23:13:39 1999  Richard Henderson  <rth@cygnus.com>
+
+	* config/tc-i386.c (i386_immediate): Skip whitespace before
+	complaining about junk after expression.
+	(i386_displacement): Likewise.
+
+Thu May  6 19:50:14 1999  Richard Henderson  <rth@cygnus.com>
+
+	* symbols.c (symbol_find_base): Use memcpy instead of strcpy.
+	Don't copy before downcaseing.
+
+1999-05-05  Catherine Moore  <clm@cygnus.com>
+ 
+        * tc-m68k.c: Include elf/m68k.h.
+        (m68k_elf_final_processing): New routine.
+        * tc-m68k.h (elf_tc_final_processing m68k_elf_final_processing):
+        Define.
+ 
+Mon May  3 10:26:03 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config/tc-hppa.c (md_apply_fix): Handle 22 bit fmt insn like a
+	17 bit fmt insn.
+
 1999-04-30  Nick Clifton  <nickc@cygnus.com>
 
 	* config/tc-mcore.c (mcore_s_section): Dump literals before
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 688f21c..a7ccf21 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -12,7 +12,7 @@
 YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
 
-DEP = $(srcdir)/../mkdep
+MKDEP = $${srcdir}/../mkdep
 
 TARG_CPU = @target_cpu_type@
 TARG_CPU_C = $(srcdir)/config/tc-@target_cpu_type@.c
@@ -44,6 +44,7 @@
 	h8300 \
 	h8500 \
 	hppa \
+	i370 \
 	i386 \
 	i860 \
 	i960 \
@@ -55,6 +56,7 @@
 	mn10200 \
 	mn10300 \
 	ns32k \
+	pj \
 	ppc \
 	sh \
 	sparc \
@@ -134,6 +136,7 @@
 	bignum-copy.c \
 	cond.c \
 	depend.c \
+	dwarf2dbg.c \
 	ecoff.c \
 	ehopt.c \
 	expr.c \
@@ -164,6 +167,7 @@
 	bignum.h \
 	bit_fix.h \
 	cgen.h \
+	dwarf2dbg.h \
 	ecoff.h \
 	emul-target.h \
 	emul.h \
@@ -194,9 +198,11 @@
 	config/tc-arm.c \
 	config/tc-d10v.c \
 	config/tc-d30v.c \
+	config/tc-fr30.c \
 	config/tc-h8300.c \
 	config/tc-h8500.c \
 	config/tc-hppa.c \
+	config/tc-i370.c \
 	config/tc-i386.c \
 	config/tc-i860.c \
 	config/tc-i960.c \
@@ -208,6 +214,7 @@
 	config/tc-mn10200.c \
 	config/tc-mn10300.c \
 	config/tc-ns32k.c \
+	config/tc-pj.c \
 	config/tc-ppc.c \
 	config/tc-sh.c \
 	config/tc-sparc.c \
@@ -226,9 +233,11 @@
 	config/tc-arm.h \
 	config/tc-d10v.h \
 	config/tc-d30v.h \
+	config/tc-fr30.h \
 	config/tc-h8300.h \
 	config/tc-h8500.h \
 	config/tc-hppa.h \
+	config/tc-i370.h \
 	config/tc-i386.h \
 	config/tc-i860.h \
 	config/tc-i960.h \
@@ -240,6 +249,7 @@
 	config/tc-mn10200.h \
 	config/tc-mn10300.h \
 	config/tc-ns32k.h \
+	config/tc-pj.h \
 	config/tc-ppc.h \
 	config/tc-sh.h \
 	config/tc-sparc.h \
@@ -286,6 +296,7 @@
 	config/te-delt88.h \
 	config/te-dpx2.h \
 	config/te-dynix.h \
+	config/te-epoc-pe.h \
 	config/te-generic.h \
 	config/te-go32.h \
 	config/te-hp300.h \
@@ -313,6 +324,7 @@
 # Multi files in config
 
 MULTI_CFILES = \
+	config/e-i386aout.c \
 	config/e-i386coff.c \
 	config/e-i386elf.c \
 	config/e-mipsecoff.c \
@@ -331,6 +343,7 @@
 	bignum-copy.o \
 	cond.o \
 	depend.o \
+	dwarf2dbg.o \
 	ehopt.o \
 	expr.o \
 	flonum-konst.o \
@@ -363,7 +376,8 @@
 	  && mv tmp $(srcdir)/po/POTFILES.in
 
 noinst_PROGRAMS = as-new gasp-new
-noinst_SCRIPTS = .gdbinit
+noinst_SCRIPTS = $(GDBINIT)
+EXTRA_SCRIPTS = .gdbinit
 
 $(srcdir)/make-gas.com: stamp-mk.com
 stamp-mk.com: vmsconf.sh Makefile
@@ -416,7 +430,7 @@
 # Stuff that every object file depends upon.  If anything is removed
 # from this list, remove it from dep-in.sed as well.
 $(OBJS): config.h as.h $(TARG_ENV_H) $(OBJ_FORMAT_H) $(TARG_CPU_H) flonum.h \
-	expr.h struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h \
+	expr.h write.h frags.h hash.h read.h symbols.h tc.h \
 	obj.h listing.h bignum.h bit_fix.h $(INCDIR)/libiberty.h asintl.h
 
 gasp_new_SOURCES = gasp.c macro.c sb.c hash.c
@@ -498,6 +512,8 @@
 	$(COMPILE) -c $(srcdir)/config/e-mipself.c
 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
 	$(COMPILE) -c $(srcdir)/config/e-mipsecoff.c
+e-i386aout.o: $(srcdir)/config/e-i386aout.c
+	$(COMPILE) -c $(srcdir)/config/e-i386aout.c
 e-i386coff.o: $(srcdir)/config/e-i386coff.c
 	$(COMPILE) -c $(srcdir)/config/e-i386coff.c
 e-i386elf.o: $(srcdir)/config/e-i386elf.c
@@ -551,10 +567,10 @@
 
 EXTRA_PROGRAMS = itbl-test
 itbl_test_SOURCES = itbl-parse.y itbl-lex.l
-itbl_test_LDADD = itbl-test-ops.o itbl-test.o $(GASLIBS) @LEXLIB@
+itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@
 
-itbl-test-ops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h
-	$(COMPILE) -o itbl-test-ops.o -DSTAND_ALONE -c $(srcdir)/itbl-ops.c
+itbl-tops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h
+	$(COMPILE) -o itbl-tops.o -DSTAND_ALONE -c $(srcdir)/itbl-ops.c
 
 itbl-test.o: $(srcdir)/testsuite/gas/all/itbl-test.c $(srcdir)/itbl-ops.h
 	$(COMPILE) -c -DSTAND_ALONE $(srcdir)/testsuite/gas/all/itbl-test.c
@@ -574,7 +590,7 @@
 	testsuite/*.o testsuite/*.out testsuite/gas.log testsuite/gas.sum \
 	testsuite/site.exp site.bak site.exp stage stage1 stage2
 
-CLEANFILES = dep.sed .tcdep .objdep .dep2 .dep1 .depa .dep .depdir
+CLEANFILES = dep.sed DEPTC DEPOBJ DEP2 DEP1 DEPA DEP DEPDIR
 
 .PHONY: install-exec-local install-data-local
 .PHONY: install-exec-bindir install-exec-tooldir
@@ -590,7 +606,7 @@
 	  else :; fi; \
 	done
 
-install-exec-tooldir: $(noinst_PROGRAMS)
+install-exec-tooldir: install-exec-bindir $(noinst_PROGRAMS)
 	$(mkinstalldirs) $(tooldir)/bin
 	n=`echo as | sed '$(transform)'`; \
 	if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/as$(EXEEXT)" ]; then \
@@ -685,41 +701,42 @@
 DEP_FILE_DEPS =  $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
 	$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES)
 
-.dep: dep.sed $(DEP_FILE_DEPS) .tcdep .objdep .dep2
-	rm -f .dep1
+DEP: dep.sed $(DEP_FILE_DEPS) DEPTC DEPOBJ DEP2
+	rm -f DEP1
 	srcdir=`cd $(srcdir); pwd`; \
-	$(MAKE) DEP=$(DEP) srcdir=$${srcdir} VPATH=$${srcdir} .dep1
-	rm -rf .depdir
-	sed -f dep.sed < .dep1 > .depa
-	sed -f dep.sed < .tcdep >> .depa
-	sed -f dep.sed < .objdep >> .depa
-	sed -f dep.sed < .dep2 >> .depa
-	echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '$$(TARG_CPU_O): $$(TCDEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '$$(OBJ_FORMAT_O): $$(OBJDEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> .depa
-	$(SHELL) $(srcdir)/../move-if-change .depa .dep
+	$(MAKE) MKDEP=$(MKDEP) srcdir=$${srcdir} VPATH=$${srcdir} DEP1
+	rm -rf DEPDIR
+	sed -f dep.sed < DEP1 > DEPA
+	sed -f dep.sed < DEPTC >> DEPA
+	sed -f dep.sed < DEPOBJ >> DEPA
+	sed -f dep.sed < DEP2 >> DEPA
+	echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '$$(TARG_CPU_O): $$(DEPTC_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '$$(OBJ_FORMAT_O): $$(DEPOBJ_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	$(SHELL) $(srcdir)/../move-if-change DEPA DEP
 
 # This rule needs a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(MULTI_CFILES)
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEP1: $(CFILES) $(MULTI_CFILES)
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	echo '' > targ-cpu.h; \
 	echo '' > obj-format.h; \
 	echo '' > targ-env.h; \
 	echo '' > itbl-cpu.h; \
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	$(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) $?
-	sed -e '/IF YOU PUT ANYTHING/,$$d' < .depdir/.dep > .dep1
-	rm -f .depdir/.dep
+	echo '' > itbl-parse.h; \
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	$(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) $?
+	sed -e '/IF YOU PUT ANYTHING/,$$d' < DEPDIR/DEP > DEP1
+	rm -f DEPDIR/DEP
 
 # Work out the special dependencies for the tc-*.c files.
-.tcdep: $(TARGET_CPU_CFILES)
-	rm -f .tcdepa
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEPTC: $(TARGET_CPU_CFILES)
+	rm -f DEPTCA
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
@@ -728,44 +745,45 @@
 	      echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \
 	      echo '#include "te-generic.h"' > targ-env.h; \
 	      echo '' > itbl-cpu.h; \
+	      echo '' > itbl-parse.h; \
 	      echo '#include "opcodes/'"$${c}"'-desc.h"' > cgen-desc.h; \
 	      rm -f dummy.c; \
 	      cp $${srcdir}/config/tc-$${c}.c dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
-	      sed -e "s/dummy.o: dummy.c/TCDEP_$${c}_$${o} =/" \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      sed -e "s/dummy.o: dummy.c/DEPTC_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.tcdepa; \
+		  -e '/^$$/d' < DEP >> ../DEPTCA; \
 	      rm -f dummy.c; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'TCDEP_hppa_som = $$(srcdir)/config/tc-hppa.h subsegs.h \' >> .tcdepa
-	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> .tcdepa
-	echo '  $$(INCDIR)/opcode/hppa.h $$(BFDDIR)/som.h' >> .tcdepa
-	# We don't try to handle all multi cases.
+	echo 'DEPTC_hppa_som = $$(srcdir)/config/tc-hppa.h subsegs.h \' >> DEPTCA
+	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> DEPTCA
+	echo '  $$(INCDIR)/opcode/hppa.h $$(BFDDIR)/som.h' >> DEPTCA
+# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'TCDEP_'"$${c}"'_multi = \' >> .tcdepa; \
-	    echo '$$(TCDEP_'"$${c}"'_coff) \' >> .tcdepa; \
+	    echo 'DEPTC_'"$${c}"'_multi = \' >> DEPTCA; \
+	    echo '$$(DEPTC_'"$${c}"'_coff) \' >> DEPTCA; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(TCDEP_'"$${c}"'_ecoff) \' >> .tcdepa; \
+	      echo '$$(DEPTC_'"$${c}"'_ecoff) \' >> DEPTCA; \
 	    else true; fi; \
-	    echo '$$(TCDEP_'"$${c}"'_elf)' >> .tcdepa; \
+	    echo '$$(DEPTC_'"$${c}"'_elf)' >> DEPTCA; \
 	  else true; fi; \
 	done
-	mv -f .tcdepa .tcdep
+	mv -f DEPTCA DEPTC
 
 # Work out the special dependencies for the obj-*.c files.
-.objdep: $(OBJ_FORMAT_CFILES)
-	rm -f .objdepa
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEPOBJ: $(OBJ_FORMAT_CFILES)
+	rm -f DEPOBJA
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
@@ -774,76 +792,77 @@
 	      echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \
 	      echo '#include "te-generic.h"' > targ-env.h; \
 	      echo '' > itbl-cpu.h; \
+	      echo '' > itbl-parse.h; \
 	      rm -f dummy.c; \
 	      cp $${srcdir}/config/obj-$${o}.c dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
-	      sed -e "s/dummy.o: dummy.c/OBJDEP_$${c}_$${o} =/" \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      sed -e "s/dummy.o: dummy.c/DEPOBJ_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.objdepa; \
+		  -e '/^$$/d' < DEP >> ../DEPOBJA; \
 	      rm -f dummy.c; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'OBJDEP_hppa_som = $$(srcdir)/config/obj-som.h subsegs.h \' >> .objdepa
-	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> .objdepa
-	echo '  $$(BFDDIR)/som.h  $$(INCDIR)/aout/stab_gnu.h \' >> .objdepa
-	echo '  $$(INCDIR)/aout/stab.def' >> .objdepa
-	# We don't try to handle all multi cases.
+	echo 'DEPOBJ_hppa_som = $$(srcdir)/config/obj-som.h subsegs.h \' >> DEPOBJA
+	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> DEPOBJA
+	echo '  $$(BFDDIR)/som.h  $$(INCDIR)/aout/stab_gnu.h \' >> DEPOBJA
+	echo '  $$(INCDIR)/aout/stab.def' >> DEPOBJA
+# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'OBJDEP_'"$${c}"'_multi = \' >> .objdepa; \
-	    echo '$$(OBJDEP_'"$${c}"'_coff) \' >> .objdepa; \
+	    echo 'DEPOBJ_'"$${c}"'_multi = \' >> DEPOBJA; \
+	    echo '$$(DEPOBJ_'"$${c}"'_coff) \' >> DEPOBJA; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(OBJDEP_'"$${c}"'_ecoff) \' >> .objdepa; \
+	      echo '$$(DEPOBJ_'"$${c}"'_ecoff) \' >> DEPOBJA; \
 	    else true; fi; \
-	    echo '$$(OBJDEP_'"$${c}"'_elf)' >> .objdepa; \
+	    echo '$$(DEPOBJ_'"$${c}"'_elf)' >> DEPOBJA; \
 	  else true; fi; \
 	done
-	mv -f .objdepa .objdep
+	mv -f DEPOBJA DEPOBJ
 
 # Work out the dependencies for each CPU/OBJ combination.
 # Note that SOM is a special case, because it only works native.
-.dep2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_HFILES)
-	rm -f .dep2a
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEP2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_HFILES)
+	rm -f DEP2a
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
 	    if [ x$${valid} = xyes ]; then \
 	      echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \
 	      echo '#include "obj-'"$${o}"'.h"' > dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
 	      sed -e "s/dummy.o: dummy.c/DEP_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.dep2a; \
+		  -e '/^$$/d' < DEP >> ../DEP2a; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'DEP_hppa_som = $$(BFDDIR)/som.h' >> .dep2a
+	echo 'DEP_hppa_som = $$(BFDDIR)/som.h' >> DEP2a
 	# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'DEP_'"$${c}"'_multi = \' >> .dep2a; \
-	    echo '$$(DEP_'"$${c}"'_coff) \' >> .dep2a; \
+	    echo 'DEP_'"$${c}"'_multi = \' >> DEP2a; \
+	    echo '$$(DEP_'"$${c}"'_coff) \' >> DEP2a; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(DEP_'"$${c}"'_ecoff) \' >> .dep2a; \
+	      echo '$$(DEP_'"$${c}"'_ecoff) \' >> DEP2a; \
 	    else true; fi; \
-	    echo '$$(DEP_'"$${c}"'_elf)' >> .dep2a; \
+	    echo '$$(DEP_'"$${c}"'_elf)' >> DEP2a; \
 	  else true; fi; \
 	done
-	mv -f .dep2a .dep2
+	mv -f DEP2a DEP2
 
 dep.sed: dep-in.sed config.status
 	srcdir=`cd $(srcdir); pwd`; \
@@ -852,19 +871,19 @@
 		-e "s!@BFDDIR@!$${srcdir}/../bfd!" \
 		-e "s!@SRCDIR@!$${srcdir}!"
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -879,14 +898,16 @@
 bignum-copy.o: bignum-copy.c
 cond.o: cond.c macro.h sb.h $(INCDIR)/obstack.h
 depend.o: depend.c
-ecoff.o: ecoff.c
+dwarf2dbg.o: dwarf2dbg.c dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h \
+  $(INCDIR)/elf/dwarf2.h
+ecoff.o: ecoff.c ecoff.h
 ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h
 expr.o: expr.c $(INCDIR)/obstack.h
 flonum-copy.o: flonum-copy.c
 flonum-konst.o: flonum-konst.c
 flonum-mult.o: flonum-mult.c
 frags.o: frags.c subsegs.h $(INCDIR)/obstack.h
-hash.o: hash.c
+hash.o: hash.c $(INCDIR)/obstack.h
 input-file.o: input-file.c input-file.h
 input-scrub.o: input-scrub.c input-file.h sb.h
 listing.o: listing.c input-file.h subsegs.h
@@ -900,9 +921,13 @@
 stabs.o: stabs.c $(INCDIR)/obstack.h subsegs.h ecoff.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
 subsegs.o: subsegs.c subsegs.h $(INCDIR)/obstack.h
-symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h
+symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h \
+  struc-symbol.h
 write.o: write.c subsegs.h $(INCDIR)/obstack.h output-file.h
 gasp.o: gasp.c sb.h macro.h
+itbl-ops.o: itbl-ops.c itbl-ops.h itbl-parse.h
+e-i386aout.o: $(srcdir)/config/e-i386aout.c emul.h \
+  emul-target.h
 e-i386coff.o: $(srcdir)/config/e-i386coff.c emul.h \
   emul-target.h
 e-i386elf.o: $(srcdir)/config/e-i386elf.c emul.h emul-target.h
@@ -910,577 +935,591 @@
   emul-target.h
 e-mipself.o: $(srcdir)/config/e-mipself.c emul.h emul-target.h
 
-TCDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
+DEPTC_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h
-TCDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
+DEPTC_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h
-TCDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h $(INCDIR)/opcode/a29k.h
-TCDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h ecoff.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
-TCDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
-TCDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/opcode/alpha.h $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
   $(srcdir)/config/atof-vax.c
-TCDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \
   subsegs.h $(INCDIR)/obstack.h ecoff.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
-TCDEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
+DEPTC_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \
   $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h
-TCDEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h $(INCDIR)/elf/arc.h \
   $(INCDIR)/elf/reloc-macros.h
-TCDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
+DEPTC_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h
-TCDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
+DEPTC_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h
-TCDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h
-TCDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
+DEPTC_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h \
   $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h
-TCDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h \
   $(INCDIR)/elf/reloc-macros.h
-TCDEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
+DEPTC_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h
-TCDEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h
-TCDEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
+DEPTC_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \
   cgen.h
-TCDEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \
   cgen.h
-TCDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
+DEPTC_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h
-TCDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h
-TCDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
+DEPTC_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h
-TCDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h
-TCDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
+DEPTC_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/libbfd.h \
   $(INCDIR)/opcode/hppa.h
-TCDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \
   $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
   subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libbfd.h $(INCDIR)/opcode/hppa.h
-TCDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
+DEPTC_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/i386.h
-TCDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
+DEPTC_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h
-TCDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h
-TCDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
+DEPTC_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i860.h
-TCDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
+DEPTC_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/opcode/i860.h
-TCDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h $(INCDIR)/opcode/i860.h
-TCDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
+DEPTC_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h
-TCDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
+DEPTC_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h
-TCDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/i960.h
-TCDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
+DEPTC_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \
   cgen.h
-TCDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \
   cgen.h
-TCDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
+DEPTC_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
   subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
-TCDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
+DEPTC_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
   $(srcdir)/config/m68k-parse.h
-TCDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h $(INCDIR)/obstack.h \
-  subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
-TCDEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \
+  subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \
+  $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h
+DEPTC_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \
   $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
   $(srcdir)/config/m68k-parse.h
-TCDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
+DEPTC_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h
-TCDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h
-TCDEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
+DEPTC_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h
-TCDEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \
   $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h
-TCDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/mips.h itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h \
   $(INCDIR)/coff/ecoff.h
-TCDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \
   itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
-TCDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \
   itbl-ops.h
-TCDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h itbl-ops.h \
   $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
-TCDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
+DEPTC_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h
-TCDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h
-TCDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
+DEPTC_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h
-TCDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h
-TCDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
+DEPTC_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \
   $(INCDIR)/obstack.h
-TCDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
+DEPTC_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h
-TCDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \
   $(INCDIR)/obstack.h
-TCDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
+DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+  $(INCDIR)/opcode/pj.h
+DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h
+DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h
-TCDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h \
   $(INCDIR)/elf/reloc-macros.h
-TCDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
+DEPTC_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h
-TCDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h
-TCDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
+DEPTC_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/sparc.h
-TCDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
+DEPTC_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h
-TCDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h \
   $(INCDIR)/elf/reloc-macros.h
-TCDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
+DEPTC_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/tahoe.h
-TCDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
+DEPTC_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h
-TCDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/tahoe.h
-TCDEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
+DEPTC_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h
-TCDEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
+DEPTC_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h
-TCDEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h
-TCDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
+DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h
-TCDEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h $(INCDIR)/opcode/tic80.h
-TCDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
-TCDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
-TCDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
-TCDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
-TCDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
+DEPTC_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
-TCDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
-TCDEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
+DEPTC_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
-TCDEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
-TCDEP_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \
+DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \
   $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \
   $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
-TCDEP_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \
+DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \
   $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h
-TCDEP_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \
+DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \
   $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \
   $(BFDDIR)/som.h
-TCDEP_i386_multi = $(TCDEP_i386_coff) $(TCDEP_i386_elf)
-TCDEP_mips_multi = $(TCDEP_mips_coff) $(TCDEP_mips_ecoff) \
-  $(TCDEP_mips_elf)
-OBJDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
+DEPTC_i386_multi = $(DEPTC_i386_coff) $(DEPTC_i386_elf)
+DEPTC_mips_multi = $(DEPTC_mips_coff) $(DEPTC_mips_ecoff) \
+  $(DEPTC_mips_elf)
+DEPOBJ_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
+DEPOBJ_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
+DEPOBJ_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
+DEPOBJ_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(BFDDIR)/libecoff.h
-OBJDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/aout/aout64.h
-OBJDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h
-OBJDEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
+DEPOBJ_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h
+DEPOBJ_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
+DEPOBJ_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
+DEPOBJ_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
+DEPOBJ_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
+DEPOBJ_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
+DEPOBJ_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
+DEPOBJ_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
+DEPOBJ_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
+DEPOBJ_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \
   $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
+DEPOBJ_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
+DEPOBJ_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
+DEPOBJ_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
+DEPOBJ_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
+DEPOBJ_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/obstack.h
-OBJDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
+DEPOBJ_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
+DEPOBJ_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
+DEPOBJ_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
+DEPOBJ_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-hp300.h \
+DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-hp300.h \
   $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
+DEPOBJ_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
+DEPOBJ_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(BFDDIR)/libecoff.h
-OBJDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h
-OBJDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
+DEPOBJ_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
+DEPOBJ_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
+DEPOBJ_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
+DEPOBJ_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
+DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+  $(INCDIR)/obstack.h subsegs.h
+DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \
+  $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
+DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/aout/aout64.h
-OBJDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
+DEPOBJ_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
+DEPOBJ_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
+DEPOBJ_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
+DEPOBJ_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
+DEPOBJ_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
+DEPOBJ_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
+DEPOBJ_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
+DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
-OBJDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.h \
   $(INCDIR)/obstack.h
-OBJDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
+DEPOBJ_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
+DEPOBJ_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
-OBJDEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
+DEPOBJ_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
-OBJDEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-OBJDEP_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
+DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
   $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
-OBJDEP_i386_multi = $(OBJDEP_i386_coff) $(OBJDEP_i386_elf)
-OBJDEP_mips_multi = $(OBJDEP_mips_coff) $(OBJDEP_mips_ecoff) \
-  $(OBJDEP_mips_elf)
+DEPOBJ_i386_multi = $(DEPOBJ_i386_coff) $(DEPOBJ_i386_elf)
+DEPOBJ_mips_multi = $(DEPOBJ_mips_coff) $(DEPOBJ_mips_ecoff) \
+  $(DEPOBJ_mips_elf)
 DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
 DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
@@ -1618,6 +1657,11 @@
 DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h
+DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
+DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h
 DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h
@@ -1690,6 +1734,6 @@
 DEP_mips_multi = $(DEP_mips_coff) $(DEP_mips_ecoff) \
   $(DEP_mips_elf)
 $(OBJS): $(DEP_@target_cpu_type@_@obj_format@)
-$(TARG_CPU_O): $(TCDEP_@target_cpu_type@_@obj_format@)
-$(OBJ_FORMAT_O): $(OBJDEP_@target_cpu_type@_@obj_format@)
+$(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@)
+$(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@)
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 244fff2..3bcb551 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -72,6 +72,7 @@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
 EXEEXT = @EXEEXT@
+GDBINIT = @GDBINIT@
 GMOFILES = @GMOFILES@
 GMSGFMT = @GMSGFMT@
 GT_NO = @GT_NO@
@@ -80,14 +81,13 @@
 INSTOBJEXT = @INSTOBJEXT@
 INTLDEPS = @INTLDEPS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 OPCODES_LIB = @OPCODES_LIB@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
@@ -116,7 +116,7 @@
 YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
 
-DEP = $(srcdir)/../mkdep
+MKDEP = $${srcdir}/../mkdep
 
 TARG_CPU = @target_cpu_type@
 TARG_CPU_C = $(srcdir)/config/tc-@target_cpu_type@.c
@@ -148,6 +148,7 @@
 	h8300 \
 	h8500 \
 	hppa \
+	i370 \
 	i386 \
 	i860 \
 	i960 \
@@ -159,6 +160,7 @@
 	mn10200 \
 	mn10300 \
 	ns32k \
+	pj \
 	ppc \
 	sh \
 	sparc \
@@ -242,6 +244,7 @@
 	bignum-copy.c \
 	cond.c \
 	depend.c \
+	dwarf2dbg.c \
 	ecoff.c \
 	ehopt.c \
 	expr.c \
@@ -273,6 +276,7 @@
 	bignum.h \
 	bit_fix.h \
 	cgen.h \
+	dwarf2dbg.h \
 	ecoff.h \
 	emul-target.h \
 	emul.h \
@@ -304,9 +308,11 @@
 	config/tc-arm.c \
 	config/tc-d10v.c \
 	config/tc-d30v.c \
+	config/tc-fr30.c \
 	config/tc-h8300.c \
 	config/tc-h8500.c \
 	config/tc-hppa.c \
+	config/tc-i370.c \
 	config/tc-i386.c \
 	config/tc-i860.c \
 	config/tc-i960.c \
@@ -318,6 +324,7 @@
 	config/tc-mn10200.c \
 	config/tc-mn10300.c \
 	config/tc-ns32k.c \
+	config/tc-pj.c \
 	config/tc-ppc.c \
 	config/tc-sh.c \
 	config/tc-sparc.c \
@@ -337,9 +344,11 @@
 	config/tc-arm.h \
 	config/tc-d10v.h \
 	config/tc-d30v.h \
+	config/tc-fr30.h \
 	config/tc-h8300.h \
 	config/tc-h8500.h \
 	config/tc-hppa.h \
+	config/tc-i370.h \
 	config/tc-i386.h \
 	config/tc-i860.h \
 	config/tc-i960.h \
@@ -351,6 +360,7 @@
 	config/tc-mn10200.h \
 	config/tc-mn10300.h \
 	config/tc-ns32k.h \
+	config/tc-pj.h \
 	config/tc-ppc.h \
 	config/tc-sh.h \
 	config/tc-sparc.h \
@@ -400,6 +410,7 @@
 	config/te-delt88.h \
 	config/te-dpx2.h \
 	config/te-dynix.h \
+	config/te-epoc-pe.h \
 	config/te-generic.h \
 	config/te-go32.h \
 	config/te-hp300.h \
@@ -428,6 +439,7 @@
 # Multi files in config
 
 MULTI_CFILES = \
+	config/e-i386aout.c \
 	config/e-i386coff.c \
 	config/e-i386elf.c \
 	config/e-mipsecoff.c \
@@ -448,6 +460,7 @@
 	bignum-copy.o \
 	cond.o \
 	depend.o \
+	dwarf2dbg.o \
 	ehopt.o \
 	expr.o \
 	flonum-konst.o \
@@ -479,7 +492,8 @@
 
 
 noinst_PROGRAMS = as-new gasp-new
-noinst_SCRIPTS = .gdbinit
+noinst_SCRIPTS = $(GDBINIT)
+EXTRA_SCRIPTS = .gdbinit
 
 EXTRA_DIST = make-gas.com
 
@@ -545,7 +559,7 @@
 
 EXTRA_PROGRAMS = itbl-test
 itbl_test_SOURCES = itbl-parse.y itbl-lex.l
-itbl_test_LDADD = itbl-test-ops.o itbl-test.o $(GASLIBS) @LEXLIB@
+itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@
 
 # CGEN interface.
 
@@ -558,7 +572,7 @@
 	testsuite/site.exp site.bak site.exp stage stage1 stage2
 
 
-CLEANFILES = dep.sed .tcdep .objdep .dep2 .dep1 .depa .dep .depdir
+CLEANFILES = dep.sed DEPTC DEPOBJ DEP2 DEP1 DEPA DEP DEPDIR
 
 against = stage2
 
@@ -570,737 +584,755 @@
 	$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES)
 
 
-TCDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
+DEPTC_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h
 
-TCDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
+DEPTC_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h
 
-TCDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h $(INCDIR)/opcode/a29k.h
 
-TCDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h ecoff.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
 
-TCDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
 
-TCDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/opcode/alpha.h $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
   $(srcdir)/config/atof-vax.c
 
-TCDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \
+DEPTC_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \
   subsegs.h $(INCDIR)/obstack.h ecoff.h $(INCDIR)/opcode/alpha.h \
   $(srcdir)/config/atof-vax.c
 
-TCDEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
+DEPTC_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \
   $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h $(INCDIR)/elf/arc.h \
   $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
+DEPTC_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h
 
-TCDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
+DEPTC_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h
 
-TCDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
+DEPTC_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h \
   $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h \
   $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
+DEPTC_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h
 
-TCDEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h
 
-TCDEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
+DEPTC_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \
   cgen.h
 
-TCDEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \
   cgen.h
 
-TCDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
+DEPTC_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h
 
-TCDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h
 
-TCDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
+DEPTC_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h
 
-TCDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h
 
-TCDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
+DEPTC_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/libbfd.h \
   $(INCDIR)/opcode/hppa.h
 
-TCDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \
   $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
   subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libbfd.h $(INCDIR)/opcode/hppa.h
 
-TCDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
+DEPTC_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/i386.h
 
-TCDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
+DEPTC_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h
 
-TCDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/i386.h
 
-TCDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
+DEPTC_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i860.h
 
-TCDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
+DEPTC_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/opcode/i860.h
 
-TCDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h $(INCDIR)/opcode/i860.h
 
-TCDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
+DEPTC_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h
 
-TCDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
+DEPTC_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h
 
-TCDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/i960.h
 
-TCDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
+DEPTC_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \
   cgen.h
 
-TCDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \
   $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \
   cgen.h
 
-TCDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
+DEPTC_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
   subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
 
-TCDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
+DEPTC_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
   $(srcdir)/config/m68k-parse.h
 
-TCDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h $(INCDIR)/obstack.h \
-  subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
+  subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \
+  $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \
+DEPTC_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \
   $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h \
   $(srcdir)/config/m68k-parse.h
 
-TCDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
+DEPTC_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h
 
-TCDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h
 
-TCDEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
+DEPTC_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h
 
-TCDEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \
   $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/mips.h itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h \
   $(INCDIR)/coff/ecoff.h
 
-TCDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \
   itbl-ops.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
 
-TCDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
+DEPTC_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \
   itbl-ops.h
 
-TCDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h itbl-ops.h \
   $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
 
-TCDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
+DEPTC_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h
 
-TCDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h
 
-TCDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
+DEPTC_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h
 
-TCDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h
 
-TCDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
+DEPTC_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \
   $(INCDIR)/obstack.h
 
-TCDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
+DEPTC_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h
 
-TCDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \
   $(INCDIR)/obstack.h
 
-TCDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
+DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+  $(INCDIR)/opcode/pj.h
+
+DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h
+
+DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h
 
-TCDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h \
   $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
+DEPTC_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h
 
-TCDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h
 
-TCDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
+DEPTC_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/sparc.h
 
-TCDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
+DEPTC_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h
 
-TCDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h \
   $(INCDIR)/elf/reloc-macros.h
 
-TCDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
+DEPTC_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/tahoe.h
 
-TCDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
+DEPTC_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h
 
-TCDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h $(INCDIR)/obstack.h \
   $(INCDIR)/opcode/tahoe.h
 
-TCDEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
+DEPTC_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h
 
-TCDEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
+DEPTC_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h
 
-TCDEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h
 
-TCDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
+DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h
 
-TCDEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h $(INCDIR)/opcode/tic80.h
 
-TCDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
 
-TCDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
 
-TCDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
 
-TCDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
+DEPTC_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h
 
-TCDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
+DEPTC_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
 
-TCDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \
   $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
 
-TCDEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
+DEPTC_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
 
-TCDEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPTC_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
 
-TCDEP_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \
+DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \
   $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \
   $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
 
-TCDEP_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \
+DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \
   $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h
 
-TCDEP_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \
+DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \
   $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \
   $(BFDDIR)/som.h
 
-TCDEP_i386_multi = $(TCDEP_i386_coff) $(TCDEP_i386_elf)
-TCDEP_mips_multi = $(TCDEP_mips_coff) $(TCDEP_mips_ecoff) \
-  $(TCDEP_mips_elf)
+DEPTC_i386_multi = $(DEPTC_i386_coff) $(DEPTC_i386_elf)
+DEPTC_mips_multi = $(DEPTC_mips_coff) $(DEPTC_mips_ecoff) \
+  $(DEPTC_mips_elf)
 
-OBJDEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
+DEPOBJ_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
+DEPOBJ_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
+DEPOBJ_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
+DEPOBJ_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(BFDDIR)/libecoff.h
 
-OBJDEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/aout/aout64.h
 
-OBJDEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h
-OBJDEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
+DEPOBJ_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h
+DEPOBJ_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
+DEPOBJ_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
+DEPOBJ_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
+DEPOBJ_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
+DEPOBJ_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
+DEPOBJ_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
+DEPOBJ_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
+DEPOBJ_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
+DEPOBJ_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \
   $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
+DEPOBJ_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
+DEPOBJ_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
+DEPOBJ_i860_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i860.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
+DEPOBJ_i860_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i860.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
+DEPOBJ_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
+DEPOBJ_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
+DEPOBJ_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
+DEPOBJ_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
+DEPOBJ_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-hp300.h \
+DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-hp300.h \
   $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
+DEPOBJ_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
+DEPOBJ_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
+DEPOBJ_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \
   ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(BFDDIR)/libecoff.h
 
-OBJDEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \
   $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
+DEPOBJ_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
+DEPOBJ_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
+DEPOBJ_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
+DEPOBJ_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
+DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+  $(INCDIR)/obstack.h subsegs.h
+
+DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \
+  $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
+
+DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/aout/aout64.h
 
-OBJDEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
+DEPOBJ_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
+DEPOBJ_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
+DEPOBJ_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
+DEPOBJ_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
+DEPOBJ_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
+DEPOBJ_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
+DEPOBJ_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
+DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
+DEPOBJ_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.h \
   $(INCDIR)/obstack.h
 
-OBJDEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
+DEPOBJ_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
+DEPOBJ_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
   $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
+DEPOBJ_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
 
-OBJDEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+DEPOBJ_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h subsegs.h \
   $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
 
-OBJDEP_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
+DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
   $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
 
-OBJDEP_i386_multi = $(OBJDEP_i386_coff) $(OBJDEP_i386_elf)
-OBJDEP_mips_multi = $(OBJDEP_mips_coff) $(OBJDEP_mips_ecoff) \
-  $(OBJDEP_mips_elf)
+DEPOBJ_i386_multi = $(DEPOBJ_i386_coff) $(DEPOBJ_i386_elf)
+DEPOBJ_mips_multi = $(DEPOBJ_mips_coff) $(DEPOBJ_mips_ecoff) \
+  $(DEPOBJ_mips_elf)
 
 DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \
   $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
@@ -1491,6 +1523,13 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h
 
+DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \
+  $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
+
+DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h
+
 DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \
   $(INCDIR)/bfdlink.h
@@ -1591,7 +1630,7 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =  .gdbinit
+CONFIG_CLEAN_FILES =  ${GDBINIT}
 noinst_PROGRAMS =  as-new$(EXEEXT) gasp-new$(EXEEXT)
 PROGRAMS =  $(noinst_PROGRAMS)
 
@@ -1601,14 +1640,14 @@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 itbl_test_OBJECTS =  itbl-parse.o itbl-lex.o
-itbl_test_DEPENDENCIES =  itbl-test-ops.o itbl-test.o \
+itbl_test_DEPENDENCIES =  itbl-tops.o itbl-test.o \
 ../libiberty/libiberty.a
 itbl_test_LDFLAGS = 
 as_new_OBJECTS =  app.o as.o atof-generic.o bignum-copy.o cond.o \
-depend.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o \
-flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o \
-literal.o macro.o messages.o output-file.o read.o sb.o stabs.o \
-subsegs.o symbols.o write.o
+depend.o dwarf2dbg.o ecoff.o ehopt.o expr.o flonum-copy.o \
+flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o \
+listing.o literal.o macro.o messages.o output-file.o read.o sb.o \
+stabs.o subsegs.o symbols.o write.o
 as_new_LDFLAGS = 
 gasp_new_OBJECTS =  gasp.o macro.o sb.o hash.o
 gasp_new_LDFLAGS = 
@@ -1629,7 +1668,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(itbl_test_SOURCES) $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) $(gasp_new_SOURCES)
 OBJECTS = $(itbl_test_OBJECTS) $(as_new_OBJECTS) $(gasp_new_OBJECTS)
@@ -1679,7 +1718,7 @@
 	-rm -f config.h
 
 maintainer-clean-hdr:
-.gdbinit: $(top_builddir)/config.status gdbinit.in
+${GDBINIT}: $(top_builddir)/config.status gdbinit.in
 	cd $(top_builddir) && CONFIG_FILES=$@:gdbinit.in CONFIG_HEADERS= $(SHELL) ./config.status
 
 mostlyclean-noinstPROGRAMS:
@@ -1878,7 +1917,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -2029,7 +2068,7 @@
 # Stuff that every object file depends upon.  If anything is removed
 # from this list, remove it from dep-in.sed as well.
 $(OBJS): config.h as.h $(TARG_ENV_H) $(OBJ_FORMAT_H) $(TARG_CPU_H) flonum.h \
-	expr.h struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h \
+	expr.h write.h frags.h hash.h read.h symbols.h tc.h \
 	obj.h listing.h bignum.h bit_fix.h $(INCDIR)/libiberty.h asintl.h
 
 check-DEJAGNU: site.exp
@@ -2098,6 +2137,8 @@
 	$(COMPILE) -c $(srcdir)/config/e-mipself.c
 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
 	$(COMPILE) -c $(srcdir)/config/e-mipsecoff.c
+e-i386aout.o: $(srcdir)/config/e-i386aout.c
+	$(COMPILE) -c $(srcdir)/config/e-i386aout.c
 e-i386coff.o: $(srcdir)/config/e-i386coff.c
 	$(COMPILE) -c $(srcdir)/config/e-i386coff.c
 e-i386elf.o: $(srcdir)/config/e-i386elf.c
@@ -2143,8 +2184,8 @@
 itbl-parse.c itbl-parse.h: $(srcdir)/itbl-parse.y
 	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/itbl-parse.y y.tab.c itbl-parse.c y.tab.h itbl-parse.h -- -d
 
-itbl-test-ops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h
-	$(COMPILE) -o itbl-test-ops.o -DSTAND_ALONE -c $(srcdir)/itbl-ops.c
+itbl-tops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h
+	$(COMPILE) -o itbl-tops.o -DSTAND_ALONE -c $(srcdir)/itbl-ops.c
 
 itbl-test.o: $(srcdir)/testsuite/gas/all/itbl-test.c $(srcdir)/itbl-ops.h
 	$(COMPILE) -c -DSTAND_ALONE $(srcdir)/testsuite/gas/all/itbl-test.c
@@ -2168,7 +2209,7 @@
 	  else :; fi; \
 	done
 
-install-exec-tooldir: $(noinst_PROGRAMS)
+install-exec-tooldir: install-exec-bindir $(noinst_PROGRAMS)
 	$(mkinstalldirs) $(tooldir)/bin
 	n=`echo as | sed '$(transform)'`; \
 	if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/as$(EXEEXT)" ]; then \
@@ -2254,41 +2295,42 @@
 	- (cd stage3 ; rm -f as$(EXEEXT) ; mv -f * ..)
 	- rmdir stage3
 
-.dep: dep.sed $(DEP_FILE_DEPS) .tcdep .objdep .dep2
-	rm -f .dep1
+DEP: dep.sed $(DEP_FILE_DEPS) DEPTC DEPOBJ DEP2
+	rm -f DEP1
 	srcdir=`cd $(srcdir); pwd`; \
-	$(MAKE) DEP=$(DEP) srcdir=$${srcdir} VPATH=$${srcdir} .dep1
-	rm -rf .depdir
-	sed -f dep.sed < .dep1 > .depa
-	sed -f dep.sed < .tcdep >> .depa
-	sed -f dep.sed < .objdep >> .depa
-	sed -f dep.sed < .dep2 >> .depa
-	echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '$$(TARG_CPU_O): $$(TCDEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '$$(OBJ_FORMAT_O): $$(OBJDEP_@target''_cpu_type@_@obj''_format@)' >> .depa
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> .depa
-	$(SHELL) $(srcdir)/../move-if-change .depa .dep
+	$(MAKE) MKDEP=$(MKDEP) srcdir=$${srcdir} VPATH=$${srcdir} DEP1
+	rm -rf DEPDIR
+	sed -f dep.sed < DEP1 > DEPA
+	sed -f dep.sed < DEPTC >> DEPA
+	sed -f dep.sed < DEPOBJ >> DEPA
+	sed -f dep.sed < DEP2 >> DEPA
+	echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '$$(TARG_CPU_O): $$(DEPTC_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '$$(OBJ_FORMAT_O): $$(DEPOBJ_@target''_cpu_type@_@obj''_format@)' >> DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	$(SHELL) $(srcdir)/../move-if-change DEPA DEP
 
 # This rule needs a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(MULTI_CFILES)
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEP1: $(CFILES) $(MULTI_CFILES)
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	echo '' > targ-cpu.h; \
 	echo '' > obj-format.h; \
 	echo '' > targ-env.h; \
 	echo '' > itbl-cpu.h; \
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	$(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) $?
-	sed -e '/IF YOU PUT ANYTHING/,$$d' < .depdir/.dep > .dep1
-	rm -f .depdir/.dep
+	echo '' > itbl-parse.h; \
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	$(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) $?
+	sed -e '/IF YOU PUT ANYTHING/,$$d' < DEPDIR/DEP > DEP1
+	rm -f DEPDIR/DEP
 
 # Work out the special dependencies for the tc-*.c files.
-.tcdep: $(TARGET_CPU_CFILES)
-	rm -f .tcdepa
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEPTC: $(TARGET_CPU_CFILES)
+	rm -f DEPTCA
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
@@ -2297,44 +2339,45 @@
 	      echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \
 	      echo '#include "te-generic.h"' > targ-env.h; \
 	      echo '' > itbl-cpu.h; \
+	      echo '' > itbl-parse.h; \
 	      echo '#include "opcodes/'"$${c}"'-desc.h"' > cgen-desc.h; \
 	      rm -f dummy.c; \
 	      cp $${srcdir}/config/tc-$${c}.c dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
-	      sed -e "s/dummy.o: dummy.c/TCDEP_$${c}_$${o} =/" \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      sed -e "s/dummy.o: dummy.c/DEPTC_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.tcdepa; \
+		  -e '/^$$/d' < DEP >> ../DEPTCA; \
 	      rm -f dummy.c; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'TCDEP_hppa_som = $$(srcdir)/config/tc-hppa.h subsegs.h \' >> .tcdepa
-	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> .tcdepa
-	echo '  $$(INCDIR)/opcode/hppa.h $$(BFDDIR)/som.h' >> .tcdepa
-	# We don't try to handle all multi cases.
+	echo 'DEPTC_hppa_som = $$(srcdir)/config/tc-hppa.h subsegs.h \' >> DEPTCA
+	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> DEPTCA
+	echo '  $$(INCDIR)/opcode/hppa.h $$(BFDDIR)/som.h' >> DEPTCA
+# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'TCDEP_'"$${c}"'_multi = \' >> .tcdepa; \
-	    echo '$$(TCDEP_'"$${c}"'_coff) \' >> .tcdepa; \
+	    echo 'DEPTC_'"$${c}"'_multi = \' >> DEPTCA; \
+	    echo '$$(DEPTC_'"$${c}"'_coff) \' >> DEPTCA; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(TCDEP_'"$${c}"'_ecoff) \' >> .tcdepa; \
+	      echo '$$(DEPTC_'"$${c}"'_ecoff) \' >> DEPTCA; \
 	    else true; fi; \
-	    echo '$$(TCDEP_'"$${c}"'_elf)' >> .tcdepa; \
+	    echo '$$(DEPTC_'"$${c}"'_elf)' >> DEPTCA; \
 	  else true; fi; \
 	done
-	mv -f .tcdepa .tcdep
+	mv -f DEPTCA DEPTC
 
 # Work out the special dependencies for the obj-*.c files.
-.objdep: $(OBJ_FORMAT_CFILES)
-	rm -f .objdepa
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEPOBJ: $(OBJ_FORMAT_CFILES)
+	rm -f DEPOBJA
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
@@ -2343,76 +2386,77 @@
 	      echo '#include "obj-'"$${o}"'.h"' > obj-format.h; \
 	      echo '#include "te-generic.h"' > targ-env.h; \
 	      echo '' > itbl-cpu.h; \
+	      echo '' > itbl-parse.h; \
 	      rm -f dummy.c; \
 	      cp $${srcdir}/config/obj-$${o}.c dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
-	      sed -e "s/dummy.o: dummy.c/OBJDEP_$${c}_$${o} =/" \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      sed -e "s/dummy.o: dummy.c/DEPOBJ_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.objdepa; \
+		  -e '/^$$/d' < DEP >> ../DEPOBJA; \
 	      rm -f dummy.c; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'OBJDEP_hppa_som = $$(srcdir)/config/obj-som.h subsegs.h \' >> .objdepa
-	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> .objdepa
-	echo '  $$(BFDDIR)/som.h  $$(INCDIR)/aout/stab_gnu.h \' >> .objdepa
-	echo '  $$(INCDIR)/aout/stab.def' >> .objdepa
-	# We don't try to handle all multi cases.
+	echo 'DEPOBJ_hppa_som = $$(srcdir)/config/obj-som.h subsegs.h \' >> DEPOBJA
+	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> DEPOBJA
+	echo '  $$(BFDDIR)/som.h  $$(INCDIR)/aout/stab_gnu.h \' >> DEPOBJA
+	echo '  $$(INCDIR)/aout/stab.def' >> DEPOBJA
+# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'OBJDEP_'"$${c}"'_multi = \' >> .objdepa; \
-	    echo '$$(OBJDEP_'"$${c}"'_coff) \' >> .objdepa; \
+	    echo 'DEPOBJ_'"$${c}"'_multi = \' >> DEPOBJA; \
+	    echo '$$(DEPOBJ_'"$${c}"'_coff) \' >> DEPOBJA; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(OBJDEP_'"$${c}"'_ecoff) \' >> .objdepa; \
+	      echo '$$(DEPOBJ_'"$${c}"'_ecoff) \' >> DEPOBJA; \
 	    else true; fi; \
-	    echo '$$(OBJDEP_'"$${c}"'_elf)' >> .objdepa; \
+	    echo '$$(DEPOBJ_'"$${c}"'_elf)' >> DEPOBJA; \
 	  else true; fi; \
 	done
-	mv -f .objdepa .objdep
+	mv -f DEPOBJA DEPOBJ
 
 # Work out the dependencies for each CPU/OBJ combination.
 # Note that SOM is a special case, because it only works native.
-.dep2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_HFILES)
-	rm -f .dep2a
-	if [ -d .depdir ]; then true; else mkdir .depdir; fi
+DEP2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_HFILES)
+	rm -f DEP2a
+	if [ -d DEPDIR ]; then true; else mkdir DEPDIR; fi
 	srcdir=`cd $(srcdir); pwd`; \
-	cd .depdir; \
+	cd DEPDIR; \
 	for c in $(CPU_TYPES); do \
 	  for o in $(OBJ_FORMATS); do \
 	    $(CPU_OBJ_VALID) \
 	    if [ x$${valid} = xyes ]; then \
 	      echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \
 	      echo '#include "obj-'"$${o}"'.h"' > dummy.c; \
-	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep; \
-	      $(DEP) -f .dep -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
+	      echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP; \
+	      $(MKDEP) -f DEP -DBFD_ASSEMBLER -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) dummy.c; \
 	      sed -e "s/dummy.o: dummy.c/DEP_$${c}_$${o} =/" \
 		  -e '1,/DO NOT PUT ANYTHING AFTER/d' \
 		  -e '/IF YOU PUT ANYTHING/,$$d' \
-		  -e '/^$$/d' < .dep >> ../.dep2a; \
+		  -e '/^$$/d' < DEP >> ../DEP2a; \
 	    else true; fi; \
 	  done; \
 	done
-	echo 'DEP_hppa_som = $$(BFDDIR)/som.h' >> .dep2a
+	echo 'DEP_hppa_som = $$(BFDDIR)/som.h' >> DEP2a
 	# We don't try to handle all multi cases.
 	for c in $(CPU_TYPES); do \
 	  $(CPU_MULTI_VALID) \
 	  if [ x$${valid} = xyes ]; then \
 	    o=ecoff; \
 	    $(CPU_OBJ_VALID) \
-	    echo 'DEP_'"$${c}"'_multi = \' >> .dep2a; \
-	    echo '$$(DEP_'"$${c}"'_coff) \' >> .dep2a; \
+	    echo 'DEP_'"$${c}"'_multi = \' >> DEP2a; \
+	    echo '$$(DEP_'"$${c}"'_coff) \' >> DEP2a; \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(DEP_'"$${c}"'_ecoff) \' >> .dep2a; \
+	      echo '$$(DEP_'"$${c}"'_ecoff) \' >> DEP2a; \
 	    else true; fi; \
-	    echo '$$(DEP_'"$${c}"'_elf)' >> .dep2a; \
+	    echo '$$(DEP_'"$${c}"'_elf)' >> DEP2a; \
 	  else true; fi; \
 	done
-	mv -f .dep2a .dep2
+	mv -f DEP2a DEP2
 
 dep.sed: dep-in.sed config.status
 	srcdir=`cd $(srcdir); pwd`; \
@@ -2421,19 +2465,19 @@
 		-e "s!@BFDDIR@!$${srcdir}/../bfd!" \
 		-e "s!@SRCDIR@!$${srcdir}!"
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -2448,14 +2492,16 @@
 bignum-copy.o: bignum-copy.c
 cond.o: cond.c macro.h sb.h $(INCDIR)/obstack.h
 depend.o: depend.c
-ecoff.o: ecoff.c
+dwarf2dbg.o: dwarf2dbg.c dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h \
+  $(INCDIR)/elf/dwarf2.h
+ecoff.o: ecoff.c ecoff.h
 ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h
 expr.o: expr.c $(INCDIR)/obstack.h
 flonum-copy.o: flonum-copy.c
 flonum-konst.o: flonum-konst.c
 flonum-mult.o: flonum-mult.c
 frags.o: frags.c subsegs.h $(INCDIR)/obstack.h
-hash.o: hash.c
+hash.o: hash.c $(INCDIR)/obstack.h
 input-file.o: input-file.c input-file.h
 input-scrub.o: input-scrub.c input-file.h sb.h
 listing.o: listing.c input-file.h subsegs.h
@@ -2469,9 +2515,13 @@
 stabs.o: stabs.c $(INCDIR)/obstack.h subsegs.h ecoff.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
 subsegs.o: subsegs.c subsegs.h $(INCDIR)/obstack.h
-symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h
+symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h \
+  struc-symbol.h
 write.o: write.c subsegs.h $(INCDIR)/obstack.h output-file.h
 gasp.o: gasp.c sb.h macro.h
+itbl-ops.o: itbl-ops.c itbl-ops.h itbl-parse.h
+e-i386aout.o: $(srcdir)/config/e-i386aout.c emul.h \
+  emul-target.h
 e-i386coff.o: $(srcdir)/config/e-i386coff.c emul.h \
   emul-target.h
 e-i386elf.o: $(srcdir)/config/e-i386elf.c emul.h emul-target.h
@@ -2479,8 +2529,8 @@
   emul-target.h
 e-mipself.o: $(srcdir)/config/e-mipself.c emul.h emul-target.h
 $(OBJS): $(DEP_@target_cpu_type@_@obj_format@)
-$(TARG_CPU_O): $(TCDEP_@target_cpu_type@_@obj_format@)
-$(OBJ_FORMAT_O): $(OBJDEP_@target_cpu_type@_@obj_format@)
+$(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@)
+$(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@)
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gas/NEWS b/gas/NEWS
index 0844076..03f554c 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -2,13 +2,31 @@
 
 Changes in 2.10:
 
-Support for the Motorolla MCore 210 processor added.
+Support for ATMEL AVR.
 
-A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386 assembly
-programs with intel syntax.
+Support for IBM 370 ELF.  Somewhat experimental.
+
+Support for numbers with suffixes.
+
+Added support for breaking to the end of repeat loops.
+
+Added support for parallel instruction syntax (DOUBLEBAR_PARALLEL).
+
+New .elseif pseudo-op added.
+
+New --fatal-warnings option.
+
+picoJava architecture support added.
+
+Motorola MCore 210 processor support added.
+
+A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386
+assembly programs with intel syntax.
 
 New pseudo-ops .func,.endfunc to aid in debugging user-written assembler code.
 
+Added -gdwarf2 option to generate DWARF 2 debugging information.
+
 Full 16-bit mode support for i386.
 
 Greatly improved instruction operand checking for i386.  This change will
@@ -22,6 +40,8 @@
 
 Texas Instruments c80 (tms320c80) support added.
 
+i960 ELF support added.
+
 Changes in 2.9:
 
 Texas Instruments c30 (tms320c30) support added.
diff --git a/gas/aclocal.m4 b/gas/aclocal.m4
index 1c6d60c..4b4ca84 100644
--- a/gas/aclocal.m4
+++ b/gas/aclocal.m4
@@ -160,33 +160,75 @@
 AC_SUBST($1)])
 
 
-# serial 25 AM_PROG_LIBTOOL
-AC_DEFUN(AM_PROG_LIBTOOL,
-[AC_REQUIRE([AM_ENABLE_SHARED])dnl
-AC_REQUIRE([AM_ENABLE_STATIC])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([AM_PROG_LD])dnl
-AC_REQUIRE([AM_PROG_NM])dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-dnl
+# 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=
+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 "$silent" = yes && libtool_flags="$libtool_flags --silent"
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -208,37 +250,41 @@
 
 *-*-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
   ;;
 
-*-*-cygwin*)
-  AM_SYS_LIBTOOL_CYGWIN
+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
-
-# Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
-|| AC_MSG_ERROR([libtool configure failed])
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
 ])
 
-# AM_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AM_ENABLE_SHARED[(DEFAULT)]
+# 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(AM_ENABLE_SHARED,
-[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+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=>>AM_ENABLE_SHARED_DEFAULT],
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
 changequote([, ])dnl
 [p=${PACKAGE-default}
 case "$enableval" in
@@ -256,26 +302,22 @@
   IFS="$ac_save_ifs"
   ;;
 esac],
-enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
 ])
 
-# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AM_DISABLE_SHARED,
-[AM_ENABLE_SHARED(no)])
+# 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)])
 
-# AM_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AM_DISABLE_STATIC,
-[AM_ENABLE_STATIC(no)])
-
-# AM_ENABLE_STATIC - implement the --enable-static flag
-# Usage: AM_ENABLE_STATIC[(DEFAULT)]
+# 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(AM_ENABLE_STATIC,
-[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+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=>>AM_ENABLE_STATIC_DEFAULT],
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
 changequote([, ])dnl
 [p=${PACKAGE-default}
 case "$enableval" in
@@ -293,28 +335,73 @@
   IFS="$ac_save_ifs"
   ;;
 esac],
-enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
+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)])
 
-# AM_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AM_PROG_LD,
+
+# 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])
+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.
+    # Accept absolute paths.
 changequote(,)dnl
-  /* | [A-Za-z]:\\*)
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
 changequote([,])dnl
-    test -z "$LD" && LD="$ac_prog"
-    ;;
+      # 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
@@ -331,10 +418,10 @@
 fi
 AC_CACHE_VAL(ac_cv_path_LD,
 [if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -342,7 +429,7 @@
       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
+	test "$with_gnu_ld" != yes && break
       fi
     fi
   done
@@ -357,11 +444,10 @@
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
-AM_PROG_LD_GNU
+AC_PROG_LD_GNU
 ])
 
-AC_DEFUN(AM_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
@@ -371,29 +457,31 @@
 fi])
 ])
 
-# AM_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AM_PROG_NM,
+# 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}:"
-  for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+  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; then
+    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"
+	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"
+	ac_cv_path_NM="$ac_dir/nm -p"
+	break
       else
-        ac_cv_path_NM="$ac_dir/nm"
+	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
-      break
     fi
   done
   IFS="$ac_save_ifs"
@@ -401,15 +489,85 @@
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
 ])
 
-# AM_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
-AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN,
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-AC_CHECK_TOOL(AS, as, false)
+# 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,
diff --git a/gas/app.c b/gas/app.c
index 2a8df3a..2613e74 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -1,5 +1,5 @@
 /* This is the Assembler Pre-Processor
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -34,10 +34,14 @@
 #endif
 #endif
 
+#ifdef TC_M68K
 /* Whether we are scrubbing in m68k MRI mode.  This is different from
    flag_m68k_mri, because the two flags will be affected by the .mri
    pseudo-op at different times.  */
 static int scrub_m68k_mri;
+#else
+#define scrub_m68k_mri 0
+#endif
 
 /* The pseudo-op which switches in and out of MRI mode.  See the
    comment in do_scrub_chars.  */
@@ -68,6 +72,9 @@
 #define LEX_IS_DOUBLEDASH_1ST		12
 #endif
 #ifdef TC_M32R
+#define DOUBLEBAR_PARALLEL
+#endif
+#ifdef DOUBLEBAR_PARALLEL
 #define LEX_IS_DOUBLEBAR_1ST		13
 #endif
 #define IS_SYMBOL_COMPONENT(c)		(lex[c] == LEX_IS_SYMBOL_COMPONENT)
@@ -85,13 +92,11 @@
 
 void 
 do_scrub_begin (m68k_mri)
-     int m68k_mri;
+     int m68k_mri ATTRIBUTE_UNUSED;
 {
   const char *p;
   int c;
 
-  scrub_m68k_mri = m68k_mri;
-
   lex[' '] = LEX_IS_WHITESPACE;
   lex['\t'] = LEX_IS_WHITESPACE;
   lex['\r'] = LEX_IS_WHITESPACE;
@@ -99,11 +104,16 @@
   lex[';'] = LEX_IS_LINE_SEPARATOR;
   lex[':'] = LEX_IS_COLON;
 
+#ifdef TC_M68K
+  scrub_m68k_mri = m68k_mri;
+
   if (! m68k_mri)
+#endif
     {
       lex['"'] = LEX_IS_STRINGQUOTE;
 
-#ifndef TC_HPPA
+#if ! defined (TC_HPPA) && ! defined (TC_I370)
+      /* I370 uses single-quotes to delimit integer, float constants */
       lex['\''] = LEX_IS_ONECHAR_QUOTE;
 #endif
 
@@ -161,6 +171,7 @@
       lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST;
     }
 
+#ifdef TC_M68K
   if (m68k_mri)
     {
       lex['\''] = LEX_IS_STRINGQUOTE;
@@ -170,11 +181,12 @@
          then it can't be used in an expression.  */
       lex['!'] = LEX_IS_LINE_COMMENT_START;
     }
+#endif
 
 #ifdef TC_V850
   lex['-'] = LEX_IS_DOUBLEDASH_1ST;
 #endif
-#ifdef TC_M32R
+#ifdef DOUBLEBAR_PARALLEL
   lex['|'] = LEX_IS_DOUBLEBAR_1ST;
 #endif
 #ifdef TC_D30V
@@ -191,6 +203,7 @@
 static int add_newlines;
 static char *saved_input;
 static int saved_input_len;
+static char input_buffer[32 * 1024];
 static const char *mri_state;
 static char mri_last_ch;
 
@@ -208,7 +221,9 @@
     int          add_newlines;
     char *       saved_input;
     int          saved_input_len;
+#ifdef TC_M68K
     int          scrub_m68k_mri;
+#endif
     const char * mri_state;
     char         mri_last_ch;
 #if defined TC_ARM && defined OBJ_ELF
@@ -227,9 +242,17 @@
   saved->out_string = out_string;
   memcpy (saved->out_buf, out_buf, sizeof (out_buf));
   saved->add_newlines = add_newlines;
-  saved->saved_input = saved_input;
-  saved->saved_input_len = saved_input_len;
+  if (saved_input == NULL)
+    saved->saved_input = NULL;
+  else
+    {
+      saved->saved_input = xmalloc (saved_input_len);
+      memcpy (saved->saved_input, saved_input, saved_input_len);
+      saved->saved_input_len = saved_input_len;
+    }
+#ifdef TC_M68K
   saved->scrub_m68k_mri = scrub_m68k_mri;
+#endif
   saved->mri_state = mri_state;
   saved->mri_last_ch = mri_last_ch;
 #if defined TC_ARM && defined OBJ_ELF
@@ -256,9 +279,19 @@
   out_string = saved->out_string;
   memcpy (out_buf, saved->out_buf, sizeof (out_buf));
   add_newlines = saved->add_newlines;
-  saved_input = saved->saved_input;
-  saved_input_len = saved->saved_input_len;
+  if (saved->saved_input == NULL)
+    saved_input = NULL;
+  else
+    {
+      assert (saved->saved_input_len <= (int) (sizeof input_buffer));
+      memcpy (input_buffer, saved->saved_input, saved->saved_input_len);
+      saved_input = input_buffer;
+      saved_input_len = saved->saved_input_len;
+      free (saved->saved_input);
+    }
+#ifdef TC_M68K
   scrub_m68k_mri = saved->scrub_m68k_mri;
+#endif
   mri_state = saved->mri_state;
   mri_last_ch = saved->mri_last_ch;
 #if defined TC_ARM && defined OBJ_ELF
@@ -308,7 +341,7 @@
 
 int
 do_scrub_chars (get, tostart, tolen)
-     int (*get) PARAMS ((char **));
+     int (*get) PARAMS ((char *, int));
      char *tostart;
      int tolen;
 {
@@ -336,7 +369,7 @@
 #ifdef TC_V850
          12: After seeing a dash, looking for a second dash as a start of comment.
 #endif
-#ifdef TC_M32R
+#ifdef DOUBLEBAR_PARALLEL
 	 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
 #endif
 	  */
@@ -357,18 +390,15 @@
 
   /* This macro gets the next input character.  */
 
-#define GET()				\
-  (from < fromend			\
-   ? * (unsigned char *) (from++)	\
-   : ((saved_input != NULL		\
-       ? (free (saved_input),		\
-	  saved_input = NULL,		\
-	  0)				\
-       : 0),				\
-      fromlen = (*get) (&from),		\
-      fromend = from + fromlen,		\
-      (fromlen == 0			\
-       ? EOF				\
+#define GET()							\
+  (from < fromend						\
+   ? * (unsigned char *) (from++)				\
+   : (saved_input = NULL,					\
+      fromlen = (*get) (input_buffer, sizeof input_buffer),	\
+      from = input_buffer,					\
+      fromend = from + fromlen,					\
+      (fromlen == 0						\
+       ? EOF							\
        : * (unsigned char *) (from++))))
 
   /* This macro pushes a character back on the input stream.  */
@@ -400,9 +430,10 @@
     }
   else
     {
-      fromlen = (*get) (&from);
+      fromlen = (*get) (input_buffer, sizeof input_buffer);
       if (fromlen == 0)
 	return 0;
+      from = input_buffer;
       fromend = from + fromlen;
     }
 
@@ -748,6 +779,21 @@
 	      break;
 	    }
 
+#ifdef KEEP_WHITE_AROUND_COLON
+          if (lex[ch] == LEX_IS_COLON)
+            {
+              /* only keep this white if there's no white *after* the colon */
+              ch2 = GET ();
+              UNGET (ch2);
+              if (!IS_WHITESPACE (ch2))
+                {
+                  state = 9;
+                  UNGET (ch);
+                  PUT (' ');
+                  break;
+                }
+            }
+#endif
 	  if (IS_COMMENT (ch)
 	      || ch == '/'
 	      || IS_LINE_SEPARATOR (ch))
@@ -818,11 +864,7 @@
 	      state = 10;	/* Sp after symbol char */
 	      goto recycle;
 	    case 11:
-	      if (flag_m68k_mri
-#ifdef LABELS_WITHOUT_COLONS
-		  || 1
-#endif
-		  )
+	      if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
 		state = 1;
 	      else
 		{
@@ -957,10 +999,14 @@
 #endif
 
 	case LEX_IS_COLON:
+#ifdef KEEP_WHITE_AROUND_COLON
+          state = 9;
+#else
 	  if (state == 9 || state == 10)
 	    state = 3;
 	  else if (state != 3)
 	    state = 1;
+#endif
 	  PUT (ch);
 	  break;
 
@@ -1000,7 +1046,7 @@
 	  PUT ('\n');
 	  break;
 #endif	    
-#ifdef TC_M32R
+#ifdef DOUBLEBAR_PARALLEL
 	case LEX_IS_DOUBLEBAR_1ST:
 	  ch2 = GET();
 	  if (ch2 != '|')
@@ -1214,6 +1260,23 @@
 	    }
 	  else if (state == 10)
 	    {
+	      if (ch == '\\')
+		{
+		  /* Special handling for backslash: a backslash may
+		     be the beginning of a formal parameter (of a
+		     macro) following another symbol character, with
+		     whitespace in between.  If that is the case, we
+		     output a space before the parameter.  Strictly
+		     speaking, correct handling depends upon what the
+		     macro parameter expands into; if the parameter
+		     expands into something which does not start with
+		     an operand character, then we don't want to keep
+		     the space.  We don't have enough information to
+		     make the right choice, so here we are making the
+		     choice which is more likely to be correct.  */
+		  PUT (' ');
+		}
+
 	      state = 3;
 	    }
 	  PUT (ch);
@@ -1232,23 +1295,12 @@
      processed.  */
   if (fromend > from)
     {
-      char *save;
-
-      save = (char *) xmalloc (fromend - from);
-      memcpy (save, from, fromend - from);
-      if (saved_input != NULL)
-	free (saved_input);
-      saved_input = save;
+      saved_input = from;
       saved_input_len = fromend - from;
     }
   else
-    {
-      if (saved_input != NULL)
-	{
-	  free (saved_input);
-	  saved_input = NULL;
-	}
-    }
+    saved_input = NULL;
+
   return to - tostart;
 }
 
diff --git a/gas/as.c b/gas/as.c
index 0cdd357..647f4be 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1,5 +1,5 @@
 /* as.c - GAS main program.
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1987, 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -44,7 +44,9 @@
 #include "sb.h"
 #include "macro.h"
 
-#ifndef HAVE_ITBL_CPU
+#ifdef HAVE_ITBL_CPU
+#include "itbl-ops.h"
+#else
 #define itbl_parse(itbl_file) 1
 #define itbl_init()
 #endif
@@ -109,92 +111,12 @@
 
 static struct itbl_file_list *itbl_files;
 
-void
-print_version_id ()
-{
-  static int printed;
-  if (printed)
-    return;
-  printed = 1;
-
-#ifdef BFD_ASSEMBLER
-  fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"),
-	   VERSION, TARGET_ALIAS, BFD_VERSION);
-#else
-  fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS);
-#endif
-  fprintf (stderr, "\n");
-}
-
-static void
-show_usage (stream)
-     FILE *stream;
-{
-  fprintf (stream, _("Usage: %s [option...] [asmfile...]\n"), myname);
-
-  fprintf (stream, _("\
-Options:\n\
-  -a[sub-option...]	turn on listings\n\
-    Sub-options [default hls]:\n\
-    c   omit false conditionals\n\
-    d   omit debugging directives\n\
-    h   include high-level source\n\
-    l   include assembly\n\
-    m   include macro expansions\n\
-    n   omit forms processing\n\
-    s   include symbols\n\
-    =file set listing file name (must be last sub-option)\n"));
-  
-  fprintf (stream, _("\
-  -D		          produce assembler debugging messages\n\
-  --defsym SYM=VAL        define symbol SYM to given value\n\
-  -f		          skip whitespace and comment preprocessing\n\
-  --gstabs	          generate stabs debugging information\n\
-  --help		  show this message and exit\n\
-  -I DIR		  add DIR to search list for .include directives\n\
-  -J		          don't warn about signed overflow\n\
-  -K		          warn when differences altered for long displacements\n\
-  -L,--keep-locals        keep local symbols (e.g. starting with `L')\n"));
-  
-  fprintf (stream, _("\
-  -M,--mri	          assemble in MRI compatibility mode\n\
-  --MD FILE	          write dependency information in FILE (default none)\n\
-  -nocpp		  ignored\n\
-  -o OBJFILE	          name the object-file output OBJFILE (default a.out)\n\
-  -R		          fold data section into text section\n\
-  --statistics	          print various measured statistics from execution\n\
-  --strip-local-absolute  strip local absolute symbols\n\
-  --traditional-format	  Use same format as native assembler when possible\n\
-  --version		  print assembler version number and exit\n\
-  -W			  suppress warnings\n\
-  --itbl INSTTBL	  extend instruction set to include instructions\n\
-			  matching the specifications defined in file INSTTBL\n\
-  -w			  ignored\n\
-  -X			  ignored\n\
-  -Z			  generate object file even after errors\n"));
-  
-  fprintf (stream, _("\
-  --listing-lhs-width	  set the width in words of the output data column of\n\
-			  the listing\n\
-  --listing-lhs-width2	  set the width in words of the continuation lines\n\
-			  of the output data column; ignored if smaller than\n\
-			  the width of the first line\n\
-  --listing-rhs-width	  set the max width in characters of the lines from\n\
-			  the source file\n\
-  --listing-cont-lines	  set the maximum number of continuation lines used\n\
-			  for the output data column of the listing\n"));
-
-  md_show_usage (stream);
-
-  fprintf (stream, _("\nReport bugs to bug-gnu-utils@gnu.org\n"));
-}
-
 #ifdef USE_EMULATIONS
 #define EMULATION_ENVIRON "AS_EMULATION"
 
 extern struct emulation mipsbelf, mipslelf, mipself;
 extern struct emulation mipsbecoff, mipslecoff, mipsecoff;
-extern struct emulation i386coff, i386elf;
+extern struct emulation i386coff, i386elf, i386aout;
 
 static struct emulation *const emulations[] = { EMULATIONS };
 static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]);
@@ -276,6 +198,133 @@
 }
 #endif
 
+void
+print_version_id ()
+{
+  static int printed;
+  if (printed)
+    return;
+  printed = 1;
+
+#ifdef BFD_ASSEMBLER
+  fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"),
+	   VERSION, TARGET_ALIAS, BFD_VERSION);
+#else
+  fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS);
+#endif
+  fprintf (stderr, "\n");
+}
+
+static void
+show_usage (stream)
+     FILE *stream;
+{
+  fprintf (stream, _("Usage: %s [option...] [asmfile...]\n"), myname);
+
+  fprintf (stream, _("\
+Options:\n\
+  -a[sub-option...]	  turn on listings\n\
+                      	  Sub-options [default hls]:\n\
+                      	  c      omit false conditionals\n\
+                      	  d      omit debugging directives\n\
+                      	  h      include high-level source\n\
+                      	  l      include assembly\n\
+                      	  m      include macro expansions\n\
+                      	  n      omit forms processing\n\
+                      	  s      include symbols\n\
+                      	  L      include line debug statistics (if applicable)\n\
+                      	  =FILE  list to FILE (must be last sub-option)\n"));
+
+  fprintf (stream, _("\
+  -D                      produce assembler debugging messages\n"));
+  fprintf (stream, _("\
+  --defsym SYM=VAL        define symbol SYM to given value\n"));
+#ifdef USE_EMULATIONS
+  {
+    int i;
+    char *def_em;
+
+    fprintf (stream, "\
+  --em=[");
+    for (i = 0; i < n_emulations-1; i++)
+      fprintf (stream, "%s | ", emulations[i]->name);
+    fprintf (stream, "%s]\n", emulations[i]->name);
+
+    def_em = getenv (EMULATION_ENVIRON);
+    if (!def_em) 
+      def_em = DEFAULT_EMULATION;
+    fprintf (stream, _("\
+                          emulate output (default %s)\n"), def_em);
+  }
+#endif
+  fprintf (stream, _("\
+  -f                      skip whitespace and comment preprocessing\n"));
+  fprintf (stream, _("\
+  --gstabs                generate stabs debugging information\n"));
+  fprintf (stream, _("\
+  --gdwarf2               generate DWARF2 debugging information\n"));
+  fprintf (stream, _("\
+  --help                  show this message and exit\n"));
+  fprintf (stream, _("\
+  -I DIR                  add DIR to search list for .include directives\n"));
+  fprintf (stream, _("\
+  -J                      don't warn about signed overflow\n"));
+  fprintf (stream, _("\
+  -K                      warn when differences altered for long displacements\n"));
+  fprintf (stream, _("\
+  -L,--keep-locals        keep local symbols (e.g. starting with `L')\n"));
+  fprintf (stream, _("\
+  -M,--mri                assemble in MRI compatibility mode\n"));
+  fprintf (stream, _("\
+  --MD FILE               write dependency information in FILE (default none)\n"));
+  fprintf (stream, _("\
+  -nocpp                  ignored\n"));
+  fprintf (stream, _("\
+  -o OBJFILE              name the object-file output OBJFILE (default a.out)\n"));
+  fprintf (stream, _("\
+  -R                      fold data section into text section\n"));
+  fprintf (stream, _("\
+  --statistics            print various measured statistics from execution\n"));
+  fprintf (stream, _("\
+  --strip-local-absolute  strip local absolute symbols\n"));
+  fprintf (stream, _("\
+  --traditional-format    Use same format as native assembler when possible\n"));
+  fprintf (stream, _("\
+  --version               print assembler version number and exit\n"));
+  fprintf (stream, _("\
+  -W  --no-warn           suppress warnings\n"));
+  fprintf (stream, _("\
+  --warn                  don't suppress warnings\n"));
+  fprintf (stream, _("\
+  --fatal-warnings        treat warnings as errors\n"));
+  fprintf (stream, _("\
+  --itbl INSTTBL          extend instruction set to include instructions\n\
+                          matching the specifications defined in file INSTTBL\n"));
+  fprintf (stream, _("\
+  -w                      ignored\n"));
+  fprintf (stream, _("\
+  -X                      ignored\n"));
+  fprintf (stream, _("\
+  -Z                      generate object file even after errors\n"));
+  fprintf (stream, _("\
+  --listing-lhs-width     set the width in words of the output data column of\n\
+                          the listing\n"));
+  fprintf (stream, _("\
+  --listing-lhs-width2    set the width in words of the continuation lines\n\
+                          of the output data column; ignored if smaller than\n\
+                          the width of the first line\n"));
+  fprintf (stream, _("\
+  --listing-rhs-width     set the max width in characters of the lines from\n\
+                          the source file\n"));
+  fprintf (stream, _("\
+  --listing-cont-lines    set the maximum number of continuation lines used\n\
+                          for the output data column of the listing\n"));
+
+  md_show_usage (stream);
+
+  fprintf (stream, _("\nReport bugs to bug-gnu-utils@gnu.org\n"));
+}
+
 /*
  * Since it is easy to do here we interpret the special arg "-"
  * to mean "use stdin" and we set that argv[] pointing to "".
@@ -365,7 +414,14 @@
 #define OPTION_STRIP_LOCAL_ABSOLUTE (OPTION_STD_BASE + 15)
     {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE},
 #define OPTION_TRADITIONAL_FORMAT (OPTION_STD_BASE + 16)
-    {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}
+    {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
+#define OPTION_GDWARF2 (OPTION_STD_BASE + 17)
+    {"gdwarf2", no_argument, NULL, OPTION_GDWARF2},
+    {"no-warn", no_argument, NULL, 'W'},
+#define OPTION_WARN (OPTION_STD_BASE + 18)
+    {"warn", no_argument, NULL, OPTION_WARN},
+#define OPTION_WARN_FATAL (OPTION_STD_BASE + 19)
+    {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
   };
 
   /* Construct the option lists from the standard list and the
@@ -546,6 +602,10 @@
 	  debug_type = DEBUG_STABS;
 	  break;
  
+	case OPTION_GDWARF2:
+	  debug_type = DEBUG_DWARF2;
+	  break;
+
 	case 'J':
 	  flag_signed_overflow_ok = 1;
 	  break;
@@ -594,6 +654,16 @@
 	  flag_no_warnings = 1;
 	  break;
 
+	case OPTION_WARN:
+	  flag_no_warnings = 0;
+	  flag_fatal_warnings = 0;
+	  break;
+
+	case OPTION_WARN_FATAL:
+	  flag_no_warnings = 0;
+	  flag_fatal_warnings = 1;
+	  break;
+
 	case 'Z':
 	  flag_always_generate_output = 1;
 	  break;
@@ -824,6 +894,9 @@
     output_file_close (out_file_name);
 #endif
 
+  if (flag_fatal_warnings && had_warnings() > 0 && had_errors () == 0)
+    as_bad (_("%d warnings, treating warnings as errors"), had_warnings());
+
   if (had_errors () > 0 && ! flag_always_generate_output)
     keep_it = 0;
 
@@ -940,9 +1013,9 @@
   bfd_set_section_flags (stdoutput, text_section,
 			 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
 				       | SEC_CODE | SEC_READONLY));
-  /* @@ FIXME -- SEC_CODE seems to mean code only, rather than code possibly.*/
   bfd_set_section_flags (stdoutput, data_section,
-			 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC));
+			 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
+				       | SEC_DATA));
   bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
   seg_info (bss_section)->bss = 1;
   subseg_new (BFD_ABS_SECTION_NAME, 0);
diff --git a/gas/as.h b/gas/as.h
index a72dfad..4c4658a 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -1,5 +1,5 @@
 /* as.h - global header file
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -417,9 +417,6 @@
 /* True if we are assembling in MRI mode.  */
 COMMON int flag_mri;
 
-/* True if we are assembling in m68k MRI mode.  */
-COMMON int flag_m68k_mri;
-
 /* Should the data section be made read-only and appended to the text
    section?  */
 COMMON unsigned char flag_readonly_data_in_text; /* -R */
@@ -427,6 +424,9 @@
 /* True if warnings should be inhibited.  */
 COMMON int flag_no_warnings; /* -W */
 
+/* True if warnings count as errors.  */
+COMMON int flag_fatal_warnings; /* --fatal-warnings */
+
 /* True if we should attempt to generate output even if non-fatal errors
    are detected.  */
 COMMON unsigned char flag_always_generate_output; /* -Z */
@@ -457,7 +457,7 @@
 extern int listing;
 
 /* Type of debugging information we should generate.  We currently
-   only support stabs and ECOFF.  */
+   support stabs, ECOFF, and DWARF2.  */
 
 enum debug_info_type
   {
@@ -557,9 +557,11 @@
 char *app_push PARAMS ((void));
 char *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
 char *input_scrub_include_file PARAMS ((char *filename, char *position));
+extern void input_scrub_insert_line PARAMS((const char *line));
+extern void input_scrub_insert_file PARAMS((char *path));
 char *input_scrub_new_file PARAMS ((char *filename));
 char *input_scrub_next_buffer PARAMS ((char **bufp));
-int do_scrub_chars PARAMS ((int (*get) (char **), char *to, int tolen));
+int do_scrub_chars PARAMS ((int (*get) (char *, int), char *to, int tolen));
 int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
 			  long exponent_bits));
 int had_err PARAMS ((void));
@@ -585,6 +587,7 @@
 #ifdef BFD_ASSEMBLER
 segT subseg_get PARAMS ((const char *, int));
 #endif
+int subseg_text_p PARAMS ((segT));
 
 void start_dependencies PARAMS ((char *));
 void register_dependency PARAMS ((char *));
@@ -592,13 +595,13 @@
 
 struct expressionS;
 struct fix;
-struct symbol;
+typedef struct symbol symbolS;
 struct relax_type;
 typedef struct frag fragS;
 
 #ifdef BFD_ASSEMBLER
 /* literal.c */
-valueT add_to_literal_pool PARAMS ((struct symbol *, valueT, segT, int));
+valueT add_to_literal_pool PARAMS ((symbolS *, valueT, segT, int));
 #endif
 
 int check_eh_frame PARAMS ((struct expressionS *, unsigned int *));
@@ -611,7 +614,6 @@
 /* this one starts the chain of target dependant headers */
 #include "targ-env.h"
 
-#include "struc-symbol.h"
 #include "write.h"
 #include "frags.h"
 #include "hash.h"
@@ -626,6 +628,17 @@
 #endif
 #include "listing.h"
 
+#ifdef TC_M68K
+/* True if we are assembling in m68k MRI mode.  */
+COMMON int flag_m68k_mri;
+#else
+#define flag_m68k_mri 0
+#endif
+
+#ifndef NUMBERS_WITH_SUFFIX
+#define NUMBERS_WITH_SUFFIX 0
+#endif
+
 #ifndef LOCAL_LABELS_DOLLAR
 #define LOCAL_LABELS_DOLLAR 0
 #endif
@@ -634,12 +647,30 @@
 #define LOCAL_LABELS_FB 0
 #endif
 
+#ifndef LABELS_WITHOUT_COLONS
+#define LABELS_WITHOUT_COLONS 0
+#endif
+
+#ifndef NO_PSEUDO_DOT
+#define NO_PSEUDO_DOT 0
+#endif
+
 #ifndef TEXT_SECTION_NAME
 #define TEXT_SECTION_NAME	".text"
 #define DATA_SECTION_NAME	".data"
 #define BSS_SECTION_NAME	".bss"
 #endif
 
+#ifndef OCTETS_PER_BYTE_POWER
+#define OCTETS_PER_BYTE_POWER 0
+#endif
+#ifndef OCTETS_PER_BYTE
+#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
+#endif
+#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
+ #error "Octets per byte conflicts with its power-of-two definition!"
+#endif
+
 #endif /* GAS */
 
 /* end of as.h */
diff --git a/gas/atof-generic.c b/gas/atof-generic.c
index 316f665..de29f21 100644
--- a/gas/atof-generic.c
+++ b/gas/atof-generic.c
@@ -220,7 +220,7 @@
 	    && (!c || !strchr (string_of_decimal_exponent_marks, c)));
 	   p++)
 	{
-	  if (isdigit (c))
+	  if (isdigit ((unsigned char) c))
 	    {
 	      /* This may be retracted below. */
 	      number_of_digits_after_decimal++;
diff --git a/gas/cgen.c b/gas/cgen.c
index 3d2330e..e15e1b6 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -649,7 +649,8 @@
 
   assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
 
-  reloc->sym_ptr_ptr = & fixP->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
 
   /* Use fx_offset for these cases */
   if (   fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
diff --git a/gas/cond.c b/gas/cond.c
index 71a2a8e..025ca51 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -1,5 +1,5 @@
 /* cond.c - conditional assembly pseudo-ops, and .include
-   Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -64,7 +64,7 @@
      int arg;
 {
   register char *name;		/* points to name of symbol */
-  register struct symbol *symbolP;	/* Points to symbol */
+  register symbolS *symbolP;	/* Points to symbol */
   struct conditional_frame cframe;
 
   SKIP_WHITESPACE ();		/* Leading whitespace is part of operand. */
@@ -247,9 +247,89 @@
 }
 
 void 
-s_endif (arg)
+s_elseif (arg)
      int arg;
 {
+  expressionS operand;
+  int t;
+
+  if (current_cframe == NULL)
+    {
+      as_bad (_("\".elseif\" without matching \".if\" - ignored"));
+
+    }
+  else if (current_cframe->else_seen)
+    {
+      as_bad (_("\".elseif\" after \".else\" - ignored"));
+      as_bad_where (current_cframe->else_file_line.file,
+		    current_cframe->else_file_line.line,
+		    _("here is the previous \"else\""));
+      as_bad_where (current_cframe->if_file_line.file,
+		    current_cframe->if_file_line.line,
+		    _("here is the previous \"if\""));
+    }
+  else
+    {
+      as_where (&current_cframe->else_file_line.file,
+		&current_cframe->else_file_line.line);
+
+      if (!current_cframe->dead_tree)
+	{
+	  current_cframe->ignoring = !current_cframe->ignoring;
+	  if (LISTING_SKIP_COND ())
+	    {
+	      if (! current_cframe->ignoring)
+		listing_list (1);
+	      else
+		listing_list (2);
+	    }
+	}			/* if not a dead tree */
+    }				/* if error else do it */
+
+
+  SKIP_WHITESPACE ();		/* Leading whitespace is part of operand. */
+
+  if (current_cframe != NULL && current_cframe->ignoring)
+    {
+      operand.X_add_number = 0;
+      while (! is_end_of_line[(unsigned char) *input_line_pointer])
+	++input_line_pointer;
+    }
+  else
+    {
+      expression (&operand);
+      if (operand.X_op != O_constant)
+	as_bad (_("non-constant expression in \".elseif\" statement"));
+    }
+  
+  switch ((operatorT) arg)
+    {
+    case O_eq: t = operand.X_add_number == 0; break;
+    case O_ne: t = operand.X_add_number != 0; break;
+    case O_lt: t = operand.X_add_number < 0; break;
+    case O_le: t = operand.X_add_number <= 0; break;
+    case O_ge: t = operand.X_add_number >= 0; break;
+    case O_gt: t = operand.X_add_number > 0; break;
+    default:
+      abort ();
+      return;
+    }
+
+  current_cframe->ignoring = current_cframe->dead_tree || ! t;
+
+  if (LISTING_SKIP_COND ()
+      && current_cframe->ignoring
+      && (current_cframe->previous_cframe == NULL
+	  || ! current_cframe->previous_cframe->ignoring))
+    listing_list (2);
+
+  demand_empty_rest_of_line ();
+}
+
+void 
+s_endif (arg)
+     int arg ATTRIBUTE_UNUSED;
+{
   struct conditional_frame *hold;
 
   if (current_cframe == NULL)
@@ -280,7 +360,7 @@
 
 void 
 s_else (arg)
-     int arg;
+     int arg ATTRIBUTE_UNUSED;
 {
   if (current_cframe == NULL)
     {
@@ -372,11 +452,7 @@
 
   s = input_line_pointer;
 
-  if (flag_m68k_mri
-#ifdef NO_PSEUDO_DOT
-      || 1
-#endif
-      )
+  if (NO_PSEUDO_DOT || flag_m68k_mri)
     {
       if (s[-1] != '.')
 	--s;
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c
index d586e3a..dcda1bc 100644
--- a/gas/config/atof-ieee.c
+++ b/gas/config/atof-ieee.c
@@ -1,5 +1,5 @@
 /* atof_ieee.c - turn a Flonum into an IEEE floating point number
-   Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -160,7 +160,7 @@
 char *
 atof_ieee (str, what_kind, words)
      char *str;			/* Text to convert to binary. */
-     char what_kind;		/* 'd', 'f', 'g', 'h' */
+     int what_kind;		/* 'd', 'f', 'g', 'h' */
      LITTLENUM_TYPE *words;	/* Build the binary here. */
 {
   /* Extra bits for zeroed low-order bits.  The 1st MAX_PRECISION are
@@ -460,7 +460,7 @@
 	  /* Bigger than one littlenum */
 	  num_bits -= (LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits;
 	  *lp++ = word1;
-	  if (num_bits + exponent_bits + 1 >= precision * LITTLENUM_NUMBER_OF_BITS)
+	  if (num_bits + exponent_bits + 1 > precision * LITTLENUM_NUMBER_OF_BITS)
 	    {
 	      /* Exponent overflow */
 	      make_invalid_floating_point_number (words);
@@ -501,7 +501,7 @@
       if (next_bits (1))
 	{
 	  --lp;
-	  if (prec_bits > LITTLENUM_NUMBER_OF_BITS)
+	  if (prec_bits >= LITTLENUM_NUMBER_OF_BITS)
 	    {
 	      int n = 0;
 	      int tmp_bits;
@@ -515,7 +515,19 @@
 		  --n;
 		  tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
 		}
-	      if (tmp_bits > LITTLENUM_NUMBER_OF_BITS || (lp[n] & mask[tmp_bits]) != mask[tmp_bits])
+	      if (tmp_bits > LITTLENUM_NUMBER_OF_BITS
+		  || (lp[n] & mask[tmp_bits]) != mask[tmp_bits]
+		  || (prec_bits != (precision * LITTLENUM_NUMBER_OF_BITS
+				    - exponent_bits - 1)
+#ifdef TC_I386
+		      /* An extended precision float with only the integer
+			 bit set would be invalid.  That must be converted
+			 to the smallest normalized number.  */
+		      && !(precision == X_PRECISION
+			   && prec_bits == (precision * LITTLENUM_NUMBER_OF_BITS
+					    - exponent_bits - 2))
+#endif
+		      ))
 		{
 		  unsigned long carry;
 
@@ -539,11 +551,18 @@
 			    << ((LITTLENUM_NUMBER_OF_BITS - 1)
 				- exponent_bits));
 		  *lp++ = word1;
+#ifdef TC_I386
+		  /* Set the integer bit in the extended precision format.
+		     This cannot happen on the m68k where the mantissa
+		     just overflows into the integer bit above.  */
+		  if (precision == X_PRECISION)
+		    *lp++ = 1 << (LITTLENUM_NUMBER_OF_BITS - 1);
+#endif
 		  while (lp < words_end)
 		    *lp++ = 0;
 		}
 	    }
-	  else if ((*lp & mask[prec_bits]) != mask[prec_bits])
+	  else
 	    *lp += 1;
 	}
 
diff --git a/gas/config/atof-vax.c b/gas/config/atof-vax.c
index 45b90a8..76ff078 100644
--- a/gas/config/atof-vax.c
+++ b/gas/config/atof-vax.c
@@ -1,5 +1,6 @@
 /* atof_vax.c - turn a Flonum into a VAX floating point number
-   Copyright (C) 1987, 1992, 93, 95, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1992, 93, 95, 97, 98, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -260,7 +261,7 @@
 
 int				/* 0: OK. */
 flonum_gen2vax (format_letter, f, words)
-     char format_letter;	/* One of 'd' 'f' 'g' 'h'. */
+     int format_letter;		/* One of 'd' 'f' 'g' 'h'. */
      FLONUM_TYPE *f;
      LITTLENUM_TYPE *words;	/* Deliver answer here. */
 {
@@ -511,7 +512,7 @@
     };
 
   *sizeP = number_of_chars;
-  return kind_of_float ? 0 : _("Bad call to md_atof()");
+  return kind_of_float ? NULL : _("Bad call to md_atof()");
 }
 
 /* end of atof-vax.c */
diff --git a/gas/config/e-i386aout.c b/gas/config/e-i386aout.c
new file mode 100644
index 0000000..18fdf68
--- /dev/null
+++ b/gas/config/e-i386aout.c
@@ -0,0 +1,17 @@
+#include "as.h"
+#include "emul.h"
+
+static const char *
+i386aout_bfd_name ()
+{
+  abort ();
+  return NULL;
+}
+
+#define emul_bfd_name	i386aout_bfd_name
+#define emul_format	&aout_format_ops
+
+#define emul_name	"i386aout"
+#define emul_struct_name i386aout
+#define emul_default_endian 0
+#include "emul-target.h"
diff --git a/gas/config/go32.cfg b/gas/config/go32.cfg
deleted file mode 100644
index 4059395..0000000
--- a/gas/config/go32.cfg
+++ /dev/null
@@ -1,93 +0,0 @@
-/* config.h for go32 */

-

-#define I386COFF 1

-

-/* Define if using alloca.c.  */

-#undef C_ALLOCA

-

-/* 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.h> and it should be used (not on Ultrix).  */

-#undef HAVE_ALLOCA_H

-

-/* Define as __inline if that's what the C compiler calls it.  */

-#undef inline

-

-/* 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

-

-/* Should gas use high-level BFD interfaces?  */

-#undef BFD_ASSEMBLER

-

-/* If we aren't doing cross-assembling, some operations can be optimized,

-   since byte orders and value sizes don't need to be adjusted.  */

-#undef CROSS_COMPILE

-

-/* Some gas code wants to know these parameters.  */

-#define TARGET_ALIAS		"i386"

-#define TARGET_CPU		"i386"

-#define TARGET_CANONICAL	"i386-i386"

-#define TARGET_OS		"djgpp"

-#define TARGET_VENDOR		"djgpp"

-

-/* Some operating systems, for example DOS, require the use of "wb" mode when

-   opening a binary file for writing.  If only "w" is used, the file will not

-   be correct.  However, some other systems reject such a mode.  This indicates

-   which ../include/fopen-*.h header file we want to include, so that we can

-   get macros that'll do the right thing for this system.  */

-#define WANT_FOPEN_BIN 1

-

-/* Sometimes the system header files don't declare malloc and realloc.  */

-#undef NEED_DECLARATION_MALLOC

-

-/* Sometimes the system header files don't declare free.  */

-#undef NEED_DECLARATION_FREE

-

-/* Sometimes errno.h doesn't declare errno itself.  */

-#undef NEED_DECLARATION_ERRNO

-

-#define MANY_SEGMENTS 1

-

-/* Needed only for sparc configuration */

-#undef sparcv9

-

-/* Define if you have the remove function.  */

-#define HAVE_REMOVE 1

-

-/* Define if you have the unlink function.  */

-#define HAVE_UNLINK 1

-

-/* Define if you have the <errno.h> header file.  */

-#define HAVE_ERRNO_H 1

-

-/* Define if you have the <memory.h> header file.  */

-#define HAVE_MEMORY_H 1

-

-/* Define if you have the <stdarg.h> header file.  */

-#define HAVE_STDARG_H 1

-

-/* Define if you have the <stdlib.h> header file.  */

-#define HAVE_STDLIB_H 1

-

-/* Define if you have the <string.h> header file.  */

-#define HAVE_STRING_H 1

-

-/* Define if you have the <strings.h> header file.  */

-#undef HAVE_STRINGS_H

-

-/* Define if you have the <sys/types.h> header file.  */

-#define HAVE_SYS_TYPES_H 1

-

-/* Define if you have the <unistd.h> header file.  */

-#define HAVE_UNISTD_H 1

-

-/* Define if you have the <varargs.h> header file.  */

-#undef HAVE_VARARGS_H

diff --git a/gas/config/m68k-parse.h b/gas/config/m68k-parse.h
index e131342..cdb5f60 100644
--- a/gas/config/m68k-parse.h
+++ b/gas/config/m68k-parse.h
@@ -1,5 +1,6 @@
 /* m68k-parse.h -- header file for m68k assembler
-   Copyright (C) 1987, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -83,6 +84,9 @@
   ZPC,				/* Hack for Program space, but 0 addressing */
   SR,				/* Status Reg */
   CCR,				/* Condition code Reg */
+  ACC,				/* Accumulator Reg */
+  MACSR,			/* MAC Status Reg */
+  MASK,				/* Modulus Reg */
 
   /* These have to be grouped together for the movec instruction to work. */
   USP,				/*  User Stack Pointer */
@@ -165,6 +169,44 @@
   ZADDR5,
   ZADDR6,
   ZADDR7,
+
+  /* Upper and lower half of data and address registers.  Order *must*
+     be DATAxL, ADDRxL, DATAxU, ADDRxU. */
+  DATA0L,			/* lower half of data registers */
+  DATA1L,
+  DATA2L,
+  DATA3L,
+  DATA4L,
+  DATA5L,
+  DATA6L,
+  DATA7L,
+
+  ADDR0L,			/* lower half of address registers */
+  ADDR1L,
+  ADDR2L,
+  ADDR3L,
+  ADDR4L,
+  ADDR5L,
+  ADDR6L,
+  ADDR7L,
+
+  DATA0U,			/* upper half of data registers */
+  DATA1U,
+  DATA2U,
+  DATA3U,
+  DATA4U,
+  DATA5U,
+  DATA6U,
+  DATA7U,
+
+  ADDR0U,			/* upper half of address registers */
+  ADDR1U,
+  ADDR2U,
+  ADDR3U,
+  ADDR4U,
+  ADDR5U,
+  ADDR6U,
+  ADDR7U,
 };
 
 /* Size information.  */
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c
index b519347..eabbe92 100644
--- a/gas/config/obj-aout.c
+++ b/gas/config/obj-aout.c
@@ -1,5 +1,5 @@
 /* a.out object file format
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -14,9 +14,12 @@
 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 GAS; see the file COPYING.  If not, write
-to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+You should have received a copy of the GNU General Public License
+along with GAS; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#define OBJ_HEADER "obj-aout.h"
 
 #include "as.h"
 #ifdef BFD_ASSEMBLER
@@ -66,7 +69,7 @@
 static void obj_aout_weak PARAMS ((int));
 static void obj_aout_type PARAMS ((int));
 
-const pseudo_typeS obj_pseudo_table[] =
+const pseudo_typeS aout_pseudo_table[] =
 {
   {"line", obj_aout_line, 0},	/* source code line number */
   {"ln", obj_aout_line, 0},	/* coff line number that we use anyway */
@@ -93,8 +96,8 @@
   /* other stuff */
   {"ABORT", s_abort, 0},
 
-  {NULL}			/* end sentinel */
-};				/* obj_pseudo_table */
+  {NULL, NULL, 0}		/* end sentinel */
+};				/* aout_pseudo_table */
 
 
 #ifdef BFD_ASSEMBLER
@@ -108,18 +111,21 @@
   asection *sec;
   int desc, type, other;
 
-  flags = sym->bsym->flags;
-  desc = S_GET_DESC (sym);
-  type = S_GET_TYPE (sym);
-  other = S_GET_OTHER (sym);
-  sec = sym->bsym->section;
+  flags = symbol_get_bfdsym (sym)->flags;
+  desc = aout_symbol (symbol_get_bfdsym (sym))->desc;
+  type = aout_symbol (symbol_get_bfdsym (sym))->type;
+  other = aout_symbol (symbol_get_bfdsym (sym))->other;
+  sec = S_GET_SEGMENT (sym);
 
   /* Only frob simple symbols this way right now.  */
   if (! (type & ~ (N_TYPE | N_EXT)))
     {
       if (type == (N_UNDF | N_EXT)
 	  && sec == &bfd_abs_section)
-	sym->bsym->section = sec = bfd_und_section_ptr;
+	{
+	  sec = bfd_und_section_ptr;
+	  S_SET_SEGMENT (sym, sec);
+	}
 
       if ((type & N_TYPE) != N_INDR
 	  && (type & N_TYPE) != N_SETA
@@ -141,7 +147,7 @@
 	case N_SETB:
 	  /* Set the debugging flag for constructor symbols so that
 	     BFD leaves them alone.  */
-	  sym->bsym->flags |= BSF_DEBUGGING;
+	  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
 
 	  /* You can't put a common symbol in a set.  The way a set
 	     element works is that the symbol has a definition and a
@@ -164,29 +170,29 @@
 	  break;
 	case N_INDR:
 	  /* Put indirect symbols in the indirect section.  */
-	  sym->bsym->section = bfd_ind_section_ptr;
-	  sym->bsym->flags |= BSF_INDIRECT;
+	  S_SET_SEGMENT (sym, bfd_ind_section_ptr);
+	  symbol_get_bfdsym (sym)->flags |= BSF_INDIRECT;
 	  if (type & N_EXT)
 	    {
-	      sym->bsym->flags |= BSF_EXPORT;
-	      sym->bsym->flags &=~ BSF_LOCAL;
+	      symbol_get_bfdsym (sym)->flags |= BSF_EXPORT;
+	      symbol_get_bfdsym (sym)->flags &=~ BSF_LOCAL;
 	    }
 	  break;
 	case N_WARNING:
 	  /* Mark warning symbols.  */
-	  sym->bsym->flags |= BSF_WARNING;
+	  symbol_get_bfdsym (sym)->flags |= BSF_WARNING;
 	  break;
 	}
     }
   else
     {
-      sym->bsym->flags |= BSF_DEBUGGING;
+      symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
     }
 
-  S_SET_TYPE (sym, type);
+  aout_symbol (symbol_get_bfdsym (sym))->type = type;
 
   /* Double check weak symbols.  */
-  if (sym->bsym->flags & BSF_WEAK)
+  if (S_IS_WEAK (sym))
     {
       if (S_IS_COMMON (sym))
 	as_bad (_("Symbol `%s' can not be both weak and common"),
@@ -215,7 +221,7 @@
   assert (x == true);
 }
 
-#else
+#else /* ! BFD_ASSEMBLER */
 
 /* Relocation. */
 
@@ -291,7 +297,7 @@
 #endif /* CROSS_COMPILE */
 
 }
-#endif
+#endif /* ! defined (obj_header_append) */
 
 void
 obj_symbol_to_chars (where, symbolP)
@@ -416,9 +422,17 @@
 	    {
 	      ++input_line_pointer;
 	      if (strncmp (input_line_pointer, "object", 6) == 0)
+#ifdef BFD_ASSEMBLER
+		aout_symbol (symbol_get_bfdsym (sym))->other = 1;
+#else
 		S_SET_OTHER (sym, 1);
+#endif
 	      else if (strncmp (input_line_pointer, "function", 8) == 0)
+#ifdef BFD_ASSEMBLER
+		aout_symbol (symbol_get_bfdsym (sym))->other = 2;
+#else
 		S_SET_OTHER (sym, 2);
+#endif
 	    }
 	}
     }
@@ -427,11 +441,6 @@
   s_ignore (0);
 }
 
-void
-obj_read_begin_hook ()
-{
-}
-
 #ifndef BFD_ASSEMBLER
 
 void
@@ -508,7 +517,7 @@
 	    }
 	  else			/* .Stabd case. */
 	    symbolP->sy_name_offset = 0;
-	  symbolPP = &(symbol_next (symbolP));
+	  symbolPP = &symbolP->sy_next;
 	}
       else
 	{
@@ -626,4 +635,58 @@
 
 #endif /* ! BFD_ASSEMBLER */
 
+#ifdef BFD_ASSEMBLER
+
+/* Support for an AOUT emulation.  */
+
+static void aout_pop_insert PARAMS ((void));
+static int obj_aout_s_get_other PARAMS ((symbolS *));
+static int obj_aout_s_get_desc PARAMS ((symbolS *));
+
+static void
+aout_pop_insert ()
+{
+  pop_insert (aout_pseudo_table);
+}
+
+static int
+obj_aout_s_get_other (sym)
+     symbolS *sym;
+{
+  return aout_symbol (symbol_get_bfdsym (sym))->other;
+}
+
+static int
+obj_aout_s_get_desc (sym)
+     symbolS *sym;
+{
+  return aout_symbol (symbol_get_bfdsym (sym))->desc;
+}
+
+
+const struct format_ops aout_format_ops =
+{
+  bfd_target_aout_flavour,
+  1,	/* dfl_leading_underscore */
+  0,	/* emit_section_symbols */
+  obj_aout_frob_symbol,
+  obj_aout_frob_file,
+  0,	/* frob_file_after_relocs */
+  0,	/* s_get_size */
+  0,	/* s_set_size */
+  0,	/* s_get_align */
+  0,	/* s_set_align */
+  obj_aout_s_get_other,
+  obj_aout_s_get_desc,
+  0,	/* copy_symbol_attributes */
+  0,	/* generate_asm_lineno */
+  0,	/* process_stab */
+  0,	/* sec_sym_ok_for_reloc */
+  aout_pop_insert,
+  0,	/* ecoff_set_ext */
+  0,	/* read_begin_hook */
+  0 	/* symbol_new_hook */
+};
+#endif BFD_ASSEMBLER
+
 /* end of obj-aout.c */
diff --git a/gas/config/obj-aout.h b/gas/config/obj-aout.h
index 339070e..d08302a 100644
--- a/gas/config/obj-aout.h
+++ b/gas/config/obj-aout.h
@@ -1,5 +1,5 @@
 /* obj-aout.h, a.out object file format for gas, the assembler.
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1998
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -51,6 +51,12 @@
 
 #endif /* ! BFD_ASSEMBLER */
 
+extern const pseudo_typeS aout_pseudo_table[];
+
+#ifndef obj_pop_insert
+#define obj_pop_insert() pop_insert (aout_pseudo_table)
+#endif
+
 /* SYMBOL TABLE */
 /* Symbol table entry data type */
 
@@ -60,18 +66,24 @@
 
 #ifdef BFD_ASSEMBLER
 
-#define S_SET_OTHER(S,V)		(aout_symbol((S)->bsym)->other = (V))
-#define S_SET_TYPE(S,T)			(aout_symbol((S)->bsym)->type = (T))
-#define S_SET_DESC(S,D)			(aout_symbol((S)->bsym)->desc = (D))
-#define S_GET_OTHER(S)			(aout_symbol((S)->bsym)->other)
-#define S_GET_TYPE(S)			(aout_symbol((S)->bsym)->type)
-#define S_GET_DESC(S)			(aout_symbol((S)->bsym)->desc)
+#define S_SET_OTHER(S,V) \
+  (aout_symbol (symbol_get_bfdsym (S))->other = (V))
+#define S_SET_TYPE(S,T) \
+  (aout_symbol (symbol_get_bfdsym (S))->type = (T))
+#define S_SET_DESC(S,D)	\
+  (aout_symbol (symbol_get_bfdsym (S))->desc = (D))
+#define S_GET_OTHER(S) \
+  (aout_symbol (symbol_get_bfdsym (S))->other)
+#define S_GET_TYPE(S) \
+  (aout_symbol (symbol_get_bfdsym (S))->type)
+#define S_GET_DESC(S) \
+  (aout_symbol (symbol_get_bfdsym (S))->desc)
 
 asection *text_section, *data_section, *bss_section;
 
 #define obj_frob_symbol(S,PUNT)	obj_aout_frob_symbol (S, &PUNT)
 #define obj_frob_file()		obj_aout_frob_file ()
-extern void obj_aout_frob_symbol PARAMS ((struct symbol *, int *));
+extern void obj_aout_frob_symbol PARAMS ((symbolS *, int *));
 extern void obj_aout_frob_file PARAMS ((void));
 
 #define obj_sec_sym_ok_for_reloc(SEC)	(1)
@@ -230,6 +242,7 @@
 
 #endif
 
+#define obj_read_begin_hook()	{;}
 #define obj_symbol_new_hook(s)	{;}
 
 #define EMIT_SECTION_SYMBOLS		0
diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c
index c9b80f5..dc79718 100644
--- a/gas/config/obj-bout.c
+++ b/gas/config/obj-bout.c
@@ -14,9 +14,10 @@
    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 GAS; see the file COPYING.  If not, write
-   to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+   You should have received a copy of the GNU General Public License
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA. */
 
 #include "as.h"
 #include "obstack.h"
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 5639fbe..d750868 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -1,5 +1,5 @@
 /* coff object file format
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS.
@@ -32,8 +32,24 @@
 
 static void obj_coff_bss PARAMS ((int));
 const char *s_get_name PARAMS ((symbolS * s));
-static symbolS *def_symbol_in_progress;
+static void obj_coff_ln PARAMS ((int));
+static void obj_coff_def PARAMS ((int));
+static void obj_coff_endef PARAMS ((int));
+static void obj_coff_dim PARAMS ((int));
+static void obj_coff_line PARAMS ((int));
+static void obj_coff_size PARAMS ((int));
+static void obj_coff_scl PARAMS ((int));
+static void obj_coff_tag PARAMS ((int));
+static void obj_coff_val PARAMS ((int));
+static void obj_coff_type PARAMS ((int));
+static void obj_coff_ident PARAMS ((int));
+#ifdef BFD_ASSEMBLER
+static void obj_coff_loc PARAMS((int));
+#endif
 
+/* This is used to hold the symbol built by a sequence of pseudo-ops
+   from .def and .endef.  */
+static symbolS *def_symbol_in_progress;
 
 /* stack stuff */
 typedef struct
@@ -171,7 +187,7 @@
 
 static void
 obj_coff_bss (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (*input_line_pointer == '\n')
     subseg_new (".bss", get_absolute_expression ());
@@ -183,7 +199,7 @@
 
 static void
 obj_coff_weak (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   int c;
@@ -249,8 +265,8 @@
 {
   combined_entry_type *entry, *p;
 
-  entry = &coffsymbol (sym->bsym)->native[1];
-  p = coffsymbol (val->bsym)->native;
+  entry = &coffsymbol (symbol_get_bfdsym (sym))->native[1];
+  p = coffsymbol (symbol_get_bfdsym (val))->native;
   entry->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = p;
   entry->fix_end = 1;
 }
@@ -262,8 +278,8 @@
 {
   combined_entry_type *entry, *p;
 
-  entry = &coffsymbol (sym->bsym)->native[1];
-  p = coffsymbol (val->bsym)->native;
+  entry = &coffsymbol (symbol_get_bfdsym (sym))->native[1];
+  p = coffsymbol (symbol_get_bfdsym (val))->native;
   entry->u.auxent.x_sym.x_tagndx.p = p;
   entry->fix_tag = 1;
 }
@@ -272,7 +288,7 @@
 S_GET_DATA_TYPE (sym)
      symbolS *sym;
 {
-  return coffsymbol (sym->bsym)->native->u.syment.n_type;
+  return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type;
 }
 
 int
@@ -280,7 +296,7 @@
      symbolS *sym;
      int val;
 {
-  coffsymbol (sym->bsym)->native->u.syment.n_type = val;
+  coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type = val;
   return val;
 }
 
@@ -288,7 +304,7 @@
 S_GET_STORAGE_CLASS (sym)
      symbolS *sym;
 {
-  return coffsymbol (sym->bsym)->native->u.syment.n_sclass;
+  return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass;
 }
 
 int
@@ -296,7 +312,7 @@
      symbolS *sym;
      int val;
 {
-  coffsymbol (sym->bsym)->native->u.syment.n_sclass = val;
+  coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass = val;
   return val;
 }
 
@@ -334,12 +350,14 @@
 {
   symbolS *symbolP;
 
+  /* BFD converts filename to a .file symbol with an aux entry.  It
+     also handles chaining.  */
   symbolP = symbol_new (filename, bfd_abs_section_ptr, 0, &zero_address_frag);
 
   S_SET_STORAGE_CLASS (symbolP, C_FILE);
   S_SET_NUMBER_AUXILIARY (symbolP, 1);
 
-  symbolP->bsym->flags = BSF_DEBUGGING;
+  symbol_get_bfdsym (symbolP)->flags = BSF_DEBUGGING;
 
 #ifndef NO_LISTING
   {
@@ -385,7 +403,7 @@
   char * s  = (char *) xmalloc (sz);
   
   memset (s, 0, sz);
-  coffsymbol (symbolP->bsym)->native = (combined_entry_type *) s;
+  coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
 
   S_SET_DATA_TYPE (symbolP, T_NULL);
   S_SET_STORAGE_CLASS (symbolP, 0);
@@ -420,6 +438,12 @@
     {
       abort ();
     }
+  if (num <= 0) 
+    {
+      /* Zero is used as an end marker in the file.  */
+      as_warn (_("Line numbers must be positive integers\n"));
+      num = 1;
+    }
   new_line->next = line_nos;
   new_line->frag = frag;
   new_line->l.line_number = num;
@@ -434,7 +458,8 @@
 {
   if (line_nos)
     {
-      coffsymbol (current_lineno_sym->bsym)->lineno = (alent *) line_nos;
+      coffsymbol (symbol_get_bfdsym (current_lineno_sym))->lineno =
+	(alent *) line_nos;
       coff_n_line_nos++;
       line_nos = 0;
     }
@@ -479,6 +504,84 @@
   demand_empty_rest_of_line ();
 }
 
+/* .loc is essentially the same as .ln; parse it for assembler
+   compatibility.  */
+
+static void
+obj_coff_loc (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  int lineno;
+
+  /* FIXME: Why do we need this check?  We need it for ECOFF, but why
+     do we need it for COFF?  */
+  if (now_seg != text_section)
+    {
+      as_warn (_(".loc outside of .text"));
+      demand_empty_rest_of_line ();
+      return;
+    }
+
+  if (def_symbol_in_progress != NULL)
+    {
+      as_warn (_(".loc pseudo-op inside .def/.endef: ignored."));
+      demand_empty_rest_of_line ();
+      return;
+    }
+
+  /* Skip the file number.  */
+  SKIP_WHITESPACE ();
+  get_absolute_expression ();
+  SKIP_WHITESPACE ();
+
+  lineno = get_absolute_expression ();
+
+#ifndef NO_LISTING
+  {
+    extern int listing;
+
+    if (listing)
+      {
+        lineno += coff_line_base - 1;
+	listing_source_line (lineno);
+      }
+  }
+#endif
+
+  demand_empty_rest_of_line ();
+
+  add_lineno (frag_now, frag_now_fix (), lineno);
+}
+
+/* Handle the .ident pseudo-op.  */
+
+static void
+obj_coff_ident (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  segT current_seg = now_seg;
+  subsegT current_subseg = now_subseg;
+
+#ifdef TE_PE
+  {
+    segT sec;
+
+    /* We could put it in .comment, but that creates an extra section
+       that shouldn't be loaded into memory, which requires linker
+       changes...  For now, until proven otherwise, use .rdata.  */
+    sec = subseg_new (".rdata$zzz", 0);
+    bfd_set_section_flags (stdoutput, sec,
+			   ((SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA)
+			    & bfd_applicable_section_flags (stdoutput)));
+  }
+#else
+  subseg_new (".comment", 0);
+#endif
+
+  stringer (1);
+  subseg_set (current_seg, current_subseg);
+}
+
 /*
  *			def()
  *
@@ -500,7 +603,7 @@
 
 static void
 obj_coff_def (what)
-     int what;
+     int what ATTRIBUTE_UNUSED;
 {
   char name_end;		/* Char after the end of name */
   char *symbol_name;		/* Name of the debug symbol */
@@ -532,7 +635,7 @@
 
   /* Initialize the new symbol */
   def_symbol_in_progress = symbol_make (symbol_name_copy);
-  def_symbol_in_progress->sy_frag = &zero_address_frag;
+  symbol_set_frag (def_symbol_in_progress, &zero_address_frag);
   S_SET_VALUE (def_symbol_in_progress, 0);
 
   if (S_IS_STRING (def_symbol_in_progress))
@@ -547,7 +650,7 @@
 
 static void
 obj_coff_endef (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   symbolS *symbolP;
 
@@ -585,15 +688,31 @@
 	CONST char *name;
 	S_SET_SEGMENT (def_symbol_in_progress, text_section);
 
-	name = bfd_asymbol_name (def_symbol_in_progress->bsym);
-	if (name[1] == 'b' && name[2] == 'f')
-	  {
-	    if (! in_function ())
-	      as_warn (_("`%s' symbol without preceding function"), name);
-/*	    SA_SET_SYM_LNNO (def_symbol_in_progress, 12345);*/
-	    /* Will need relocating */
-	    SF_SET_PROCESS (def_symbol_in_progress);
-	    clear_function ();
+	name = S_GET_NAME (def_symbol_in_progress);
+	if (name[0] == '.' && name[2] == 'f' && name[3] == '\0')
+  	  {
+	    switch (name[1])
+	      {
+	      case 'b':  
+		/* .bf */
+		if (! in_function ())
+		  as_warn (_("`%s' symbol without preceding function"), name);
+		/* Will need relocating.  */
+		SF_SET_PROCESS (def_symbol_in_progress);
+		clear_function ();
+		break;
+#ifdef TE_PE
+	      case 'e':  
+		/* .ef */
+		/* The MS compilers output the actual endline, not the
+		   function-relative one... we want to match without
+		   changing the assembler input.  */
+		SA_SET_SYM_LNNO (def_symbol_in_progress, 
+				 (SA_GET_SYM_LNNO (def_symbol_in_progress)
+				  + coff_line_base));
+		break;
+#endif
+	      }
 	  }
       }
       break;
@@ -638,7 +757,10 @@
 
   /* Now that we have built a debug symbol, try to find if we should
      merge with an existing symbol or not.  If a symbol is C_EFCN or
-     SEG_ABSOLUTE or untagged SEG_DEBUG it never merges. */
+     absolute_section or untagged SEG_DEBUG it never merges.  We also
+     don't merge labels, which are in a different namespace, nor
+     symbols which have not yet been defined since they are typically
+     unique, nor do we merge tags with non-tags.  */
 
   /* Two cases for functions.  Either debug followed by definition or
      definition followed by debug.  For definition first, we will
@@ -653,16 +775,24 @@
      time. */
 
   if (S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_EFCN
+      || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL
       || (!strcmp (bfd_get_section_name (stdoutput,
 					 S_GET_SEGMENT (def_symbol_in_progress)),
 		   "*DEBUG*")
 	  && !SF_GET_TAG (def_symbol_in_progress))
       || S_GET_SEGMENT (def_symbol_in_progress) == absolute_section
-      || (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress), DO_NOT_STRIP)) == NULL)
+      || ! symbol_constant_p (def_symbol_in_progress)
+      || (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress),
+                                      DO_NOT_STRIP)) == NULL
+      || SF_GET_TAG (def_symbol_in_progress) != SF_GET_TAG (symbolP))
     {
+      /* If it already is at the end of the symbol list, do nothing */
       if (def_symbol_in_progress != symbol_lastP)
-	symbol_append (def_symbol_in_progress, symbol_lastP, &symbol_rootP,
-		       &symbol_lastP);
+        {
+	  symbol_remove (def_symbol_in_progress, &symbol_rootP, &symbol_lastP);
+	  symbol_append (def_symbol_in_progress, symbol_lastP, &symbol_rootP,
+			 &symbol_lastP);
+        }
     }
   else
     {
@@ -727,7 +857,7 @@
 
 static void
 obj_coff_dim (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int dim_index;
 
@@ -767,7 +897,7 @@
 
 static void
 obj_coff_line (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int this_base;
 
@@ -783,7 +913,7 @@
     coff_line_base = this_base;
 
   S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
-  SA_SET_SYM_LNNO (def_symbol_in_progress, coff_line_base);
+  SA_SET_SYM_LNNO (def_symbol_in_progress, this_base);
 
   demand_empty_rest_of_line ();
 
@@ -793,14 +923,14 @@
       extern int listing;
 
       if (listing)
-	listing_source_line ((unsigned int) coff_line_base);
+	listing_source_line ((unsigned int) this_base);
     }
 #endif
 }
 
 static void
 obj_coff_size (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -816,7 +946,7 @@
 
 static void
 obj_coff_scl (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -831,7 +961,7 @@
 
 static void
 obj_coff_tag (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *symbol_name;
   char name_end;
@@ -868,7 +998,7 @@
 
 static void
 obj_coff_type (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -890,7 +1020,7 @@
 
 static void
 obj_coff_val (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -909,24 +1039,33 @@
 #endif
       if (!strcmp (symbol_name, "."))
 	{
-	  def_symbol_in_progress->sy_frag = frag_now;
+	  symbol_set_frag (def_symbol_in_progress, frag_now);
 	  S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ());
 	  /* If the .val is != from the .def (e.g. statics) */
 	}
       else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name))
 	{
-	  def_symbol_in_progress->sy_value.X_op = O_symbol;
-	  def_symbol_in_progress->sy_value.X_add_symbol =
-	    symbol_find_or_make (symbol_name);
-	  def_symbol_in_progress->sy_value.X_op_symbol = NULL;
-	  def_symbol_in_progress->sy_value.X_add_number = 0;
+	  expressionS exp;
+
+	  exp.X_op = O_symbol;
+	  exp.X_add_symbol = symbol_find_or_make (symbol_name);
+	  exp.X_op_symbol = NULL;
+	  exp.X_add_number = 0;
+	  symbol_set_value_expression (def_symbol_in_progress, &exp);
 
 	  /* If the segment is undefined when the forward reference is
 	     resolved, then copy the segment id from the forward
 	     symbol.  */
 	  SF_SET_GET_SEGMENT (def_symbol_in_progress);
+
+	  /* FIXME: gcc can generate address expressions here in
+	     unusual cases (search for "obscure" in sdbout.c).  We
+	     just ignore the offset here, thus generating incorrect
+	     debugging information.  We ignore the rest of the line
+	     just below.  */
 	}
-      /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */
+      /* Otherwise, it is the name of a non debug symbol and its value
+         will be calculated later. */
       *input_line_pointer = name_end;
     }
   else
@@ -1034,7 +1173,7 @@
 	      coff_last_function = symp;
 	      if (S_GET_NUMBER_AUXILIARY (symp) < 1)
 		S_SET_NUMBER_AUXILIARY (symp, 1);
-	      auxp = &coffsymbol (symp->bsym)->native[1].u.auxent;
+	      auxp = SYM_AUXENT (symp);
 	      memset (auxp->x_sym.x_fcnary.x_ary.x_dimen, 0,
 		      sizeof (auxp->x_sym.x_fcnary.x_ary.x_dimen));
 	    }
@@ -1055,11 +1194,16 @@
 	*punt = 1;
 
       if (SF_GET_FUNCTION (symp))
-	symp->bsym->flags |= BSF_FUNCTION;
+	symbol_get_bfdsym (symp)->flags |= BSF_FUNCTION;
 
       /* more ... */
     }
 
+  /* Double check weak symbols.  */
+  if (S_IS_WEAK (symp) && S_IS_COMMON (symp))
+    as_bad (_("Symbol `%s' can not be both weak and common"),
+	    S_GET_NAME (symp));
+
   if (SF_GET_TAG (symp))
     last_tagP = symp;
   else if (S_GET_STORAGE_CLASS (symp) == C_EOS)
@@ -1068,17 +1212,17 @@
 #ifdef OBJ_XCOFF
   /* This is pretty horrible, but we have to set *punt correctly in
      order to call SA_SET_SYM_ENDNDX correctly.  */
-  if (! symp->sy_used_in_reloc
-      && ((symp->bsym->flags & BSF_SECTION_SYM) != 0
+  if (! symbol_used_in_reloc_p (symp)
+      && ((symbol_get_bfdsym (symp)->flags & BSF_SECTION_SYM) != 0
 	  || (! S_IS_EXTERNAL (symp)
-	      && ! symp->sy_tc.output
+	      && ! symbol_get_tc (symp)->output
 	      && S_GET_STORAGE_CLASS (symp) != C_FILE)))
     *punt = 1;
 #endif
 
   if (set_end != (symbolS *) NULL
       && ! *punt
-      && ((symp->bsym->flags & BSF_NOT_AT_END) != 0
+      && ((symbol_get_bfdsym (symp)->flags & BSF_NOT_AT_END) != 0
 	  || (S_IS_DEFINED (symp)
 	      && ! S_IS_COMMON (symp)
 	      && (! S_IS_EXTERNAL (symp) || SF_GET_FUNCTION (symp)))))
@@ -1087,9 +1231,13 @@
       set_end = NULL;
     }
 
-  if (next_set_end != NULL
-      && ! *punt)
-    set_end = next_set_end;
+  if (next_set_end != NULL)
+    {
+      if (set_end != NULL)
+	as_warn ("Warning: internal error: forgetting to set endndx of %s",
+		 S_GET_NAME (set_end));
+      set_end = next_set_end;
+    }
 
   if (! *punt
       && S_GET_STORAGE_CLASS (symp) == C_FCN
@@ -1100,28 +1248,28 @@
       coff_last_bf = symp;
     }
 
-  if (coffsymbol (symp->bsym)->lineno)
+  if (coffsymbol (symbol_get_bfdsym (symp))->lineno)
     {
       int i;
       struct line_no *lptr;
       alent *l;
 
-      lptr = (struct line_no *) coffsymbol (symp->bsym)->lineno;
+      lptr = (struct line_no *) coffsymbol (symbol_get_bfdsym (symp))->lineno;
       for (i = 0; lptr; lptr = lptr->next)
 	i++;
-      lptr = (struct line_no *) coffsymbol (symp->bsym)->lineno;
+      lptr = (struct line_no *) coffsymbol (symbol_get_bfdsym (symp))->lineno;
 
       /* We need i entries for line numbers, plus 1 for the first
 	 entry which BFD will override, plus 1 for the last zero
 	 entry (a marker for BFD).  */
       l = (alent *) xmalloc ((i + 2) * sizeof (alent));
-      coffsymbol (symp->bsym)->lineno = l;
+      coffsymbol (symbol_get_bfdsym (symp))->lineno = l;
       l[i + 1].line_number = 0;
       l[i + 1].u.sym = NULL;
       for (; i > 0; i--)
 	{
 	  if (lptr->frag)
-	    lptr->l.u.offset += lptr->frag->fr_address;
+	    lptr->l.u.offset += lptr->frag->fr_address / OCTETS_PER_BYTE;
 	  l[i] = lptr->l;
 	  lptr = lptr->next;
 	}
@@ -1130,9 +1278,9 @@
 
 void
 coff_adjust_section_syms (abfd, sec, x)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
-     PTR x;
+     PTR x ATTRIBUTE_UNUSED;
 {
   symbolS *secsym;
   segment_info_type *seginfo = seg_info (sec);
@@ -1166,6 +1314,8 @@
       && sec != bss_section)
     return;
   secsym = section_symbol (sec);
+  /* This is an estimate; we'll plug in the real value using
+     SET_SECTION_RELOCS later */
   SA_SET_SCN_NRELOC (secsym, nrelocs);
   SA_SET_SCN_NLINNO (secsym, nlnno);
 }
@@ -1189,13 +1339,14 @@
  *						 'd' (apparently m88k for data)
  *                                               'x' for text
  *						 'r' for read-only data
+ *						 's' for shared data (PE)
  * But if the argument is not a quoted string, treat it as a
  * subsegment number.
  */
 
 void
 obj_coff_section (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* Strip out the section name */
   char *section_name;
@@ -1224,7 +1375,7 @@
   SKIP_WHITESPACE ();
 
   exp = 0;
-  flags = SEC_NO_FLAGS;
+  flags = SEC_LOAD;
 
   if (*input_line_pointer == ',')
     {
@@ -1242,10 +1393,11 @@
 		{
 		case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break;
 		case 'n': flags &=~ SEC_LOAD; break;
-		case 'd':
+		case 'd': flags |= SEC_DATA | SEC_LOAD; /* fall through */
 		case 'w': flags &=~ SEC_READONLY; break;
-		case 'x': flags |= SEC_CODE; break;
+		case 'x': flags |= SEC_CODE | SEC_LOAD; break;
 		case 'r': flags |= SEC_READONLY; break;
+		case 's': flags |= SEC_SHARED; break;
 
 		case 'i': /* STYP_INFO */
 		case 'l': /* STYP_LIB */
@@ -1301,25 +1453,32 @@
   char *p;
   fragS *fragp;
   bfd_vma size, n_entries, mask;
+  bfd_vma align_power = (bfd_vma)sec->alignment_power + OCTETS_PER_BYTE_POWER;
 
   /* The COFF back end in BFD requires that all section sizes be
-     rounded up to multiples of the corresponding section alignments.
-     Seems kinda silly to me, but that's the way it is.  */
+     rounded up to multiples of the corresponding section alignments,
+     supposedly because standard COFF has no other way of encoding alignment
+     for sections.  If your COFF flavor has a different way of encoding
+     section alignment, then skip this step, as TICOFF does. */
   size = bfd_get_section_size_before_reloc (sec);
-  mask = ((bfd_vma) 1 << (bfd_vma) sec->alignment_power) - 1;
+  mask = ((bfd_vma) 1 << align_power) - 1;
+#if !defined(TICOFF)
   if (size & mask)
     {
       size = (size + mask) & ~mask;
       bfd_set_section_size (stdoutput, sec, size);
     }
+#endif
 
   /* If the section size is non-zero, the section symbol needs an aux
      entry associated with it, indicating the size.  We don't know
      all the values yet; coff_frob_symbol will fill them in later.  */
+#ifndef TICOFF
   if (size != 0
       || sec == text_section
       || sec == data_section
       || sec == bss_section)
+#endif
     {
       symbolS *secsym = section_symbol (sec);
 
@@ -1430,9 +1589,10 @@
 #define S_SET_ZEROES(s,v)		((s)->sy_symbol.ost_entry.n_zeroes = (v))
 
 #define MIN(a,b) ((a) < (b)? (a) : (b))
-/* This vector is used to turn an internal segment into a section #
-   suitable for insertion into a coff symbol table
- */
+
+/* This vector is used to turn a gas internal segment number into a
+   section number suitable for insertion into a coff symbol table.
+   This must correspond to seg_info_off_by_4.  */
 
 const short seg_N_TYPE[] =
 {				/* in: segT   out: N_TYPE bits */
@@ -1505,53 +1665,43 @@
 static void obj_coff_lcomm PARAMS ((int));
 static void obj_coff_text PARAMS ((int));
 static void obj_coff_data PARAMS ((int));
-static void obj_coff_ident PARAMS ((int));
 void obj_coff_section PARAMS ((int));
 
-/* Section stuff
+/* When not using BFD_ASSEMBLER, we permit up to 40 sections.
 
-   We allow more than just the standard 3 sections, infact, we allow
-   40 sections, (though the usual three have to be there).
+   This array maps a COFF section number into a gas section number.
+   Because COFF uses negative section numbers, you must add 4 to the
+   COFF section number when indexing into this array; this is done via
+   the SEG_INFO_FROM_SECTION_NUMBER macro.  This must correspond to
+   seg_N_TYPE.  */
 
-   This structure performs the mappings for us:
-*/
-
-
-typedef struct
+static const segT seg_info_off_by_4[] =
 {
-  segT seg_t;
-  int i;
-} seg_info_type;
-
-static const seg_info_type seg_info_off_by_4[] =
-{
- {SEG_PTV,  },
- {SEG_NTV,  },
- {SEG_DEBUG, },
- {SEG_ABSOLUTE,  },
- {SEG_UNKNOWN,	 },
- {SEG_E0}, {SEG_E1}, {SEG_E2}, {SEG_E3}, {SEG_E4},
- {SEG_E5}, {SEG_E6}, {SEG_E7}, {SEG_E8}, {SEG_E9},
- {SEG_E10},{SEG_E11},{SEG_E12},{SEG_E13},{SEG_E14},
- {SEG_E15},{SEG_E16},{SEG_E17},{SEG_E18},{SEG_E19},
- {SEG_E20},{SEG_E21},{SEG_E22},{SEG_E23},{SEG_E24},
- {SEG_E25},{SEG_E26},{SEG_E27},{SEG_E28},{SEG_E29},
- {SEG_E30},{SEG_E31},{SEG_E32},{SEG_E33},{SEG_E34},
- {SEG_E35},{SEG_E36},{SEG_E37},{SEG_E38},{SEG_E39},
- {(segT)40},
- {(segT)41},
- {(segT)42},
- {(segT)43},
- {(segT)44},
- {(segT)45},
- {(segT)0},
- {(segT)0},
- {(segT)0},
- {SEG_REGISTER}
+ SEG_PTV,
+ SEG_NTV,
+ SEG_DEBUG,
+ SEG_ABSOLUTE,
+ SEG_UNKNOWN,
+ SEG_E0,  SEG_E1,  SEG_E2,  SEG_E3,  SEG_E4,
+ SEG_E5,  SEG_E6,  SEG_E7,  SEG_E8,  SEG_E9,
+ SEG_E10, SEG_E11, SEG_E12, SEG_E13, SEG_E14,
+ SEG_E15, SEG_E16, SEG_E17, SEG_E18, SEG_E19,
+ SEG_E20, SEG_E21, SEG_E22, SEG_E23, SEG_E24,
+ SEG_E25, SEG_E26, SEG_E27, SEG_E28, SEG_E29,
+ SEG_E30, SEG_E31, SEG_E32, SEG_E33, SEG_E34,
+ SEG_E35, SEG_E36, SEG_E37, SEG_E38, SEG_E39,
+ (segT) 40,
+ (segT) 41,
+ (segT) 42,
+ (segT) 43,
+ (segT) 44,
+ (segT) 45,
+ (segT) 0,
+ (segT) 0,
+ (segT) 0,
+ SEG_REGISTER
 };
 
-
-
 #define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4])
 
 static relax_addressT
@@ -1572,14 +1722,14 @@
 s_get_segment (x)
      symbolS * x;
 {
-  return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum).seg_t;
+  return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum);
 }
 
 /* calculate the size of the frag chain and fill in the section header
    to contain all of it, also fill in the addr of the sections */
 static unsigned int
 size_section (abfd, idx)
-     bfd * abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      unsigned int idx;
 {
 
@@ -1843,7 +1993,7 @@
 static void
 fill_section (abfd, h, file_cursor)
      bfd * abfd;
-     object_headers *h;
+     object_headers *h ATTRIBUTE_UNUSED;
      unsigned long *file_cursor;
 {
 
@@ -2158,7 +2308,7 @@
 
 static void
 obj_coff_def (what)
-     int what;
+     int what ATTRIBUTE_UNUSED;
 {
   char name_end;		/* Char after the end of name */
   char *symbol_name;		/* Name of the debug symbol */
@@ -2213,7 +2363,7 @@
 
 static void
 obj_coff_endef (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   symbolS *symbolP = 0;
   /* DIM BUG FIX sac@cygnus.com */
@@ -2396,7 +2546,7 @@
 
 static void
 obj_coff_dim (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int dim_index;
 
@@ -2436,7 +2586,7 @@
 
 static void
 obj_coff_line (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int this_base;
   const char *name;
@@ -2481,7 +2631,7 @@
 
 static void
 obj_coff_size (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -2497,7 +2647,7 @@
 
 static void
 obj_coff_scl (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -2512,7 +2662,7 @@
 
 static void
 obj_coff_tag (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *symbol_name;
   char name_end;
@@ -2548,7 +2698,7 @@
 
 static void
 obj_coff_type (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -2570,7 +2720,7 @@
 
 static void
 obj_coff_val (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (def_symbol_in_progress == NULL)
     {
@@ -2607,12 +2757,11 @@
 	     symbol.  */
 	  SF_SET_GET_SEGMENT (def_symbol_in_progress);
 
-	  /* FIXME: gcc can generate address expressions
-	     here in unusual cases (search for "obscure"
-	     in sdbout.c).  We just ignore the offset
-	     here, thus generating incorrect debugging
-	     information.  We ignore the rest of the
-	     line just below.  */
+	  /* FIXME: gcc can generate address expressions here in
+	     unusual cases (search for "obscure" in sdbout.c).  We
+	     just ignore the offset here, thus generating incorrect
+	     debugging information.  We ignore the rest of the line
+	     just below.  */
 	}
       /* Otherwise, it is the name of a non debug symbol and
 	 its value will be calculated later. */
@@ -2997,7 +3146,7 @@
 static void
 crawl_symbols (h, abfd)
      object_headers *h;
-     bfd * abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
 {
   unsigned int i;
 
@@ -3231,6 +3380,7 @@
 	 at the next frag.  */
 
       subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
+
 #ifndef SUB_SEGMENT_ALIGN
 #define SUB_SEGMENT_ALIGN(SEG) 1
 #endif
@@ -3238,7 +3388,9 @@
       md_do_align (SUB_SEGMENT_ALIGN (now_seg), (char *) NULL, 0, 0,
 		   alignment_done);
 #endif
-      frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE, 0);
+      frag_align (SUB_SEGMENT_ALIGN (now_seg),
+		  subseg_text_p (now_seg) ? NOP_OPCODE : 0,
+		  0);
 #ifdef md_do_align
     alignment_done:
 #endif
@@ -3453,7 +3605,7 @@
 
 void
 obj_coff_section (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* Strip out the section name */
   char *section_name, *name;
@@ -3534,7 +3686,7 @@
 
 static void
 obj_coff_text (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   subseg_new (".text", get_absolute_expression ());
 }
@@ -3542,7 +3694,7 @@
 
 static void
 obj_coff_data (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (flag_readonly_data_in_text)
     subseg_new (".text", get_absolute_expression () + 1000);
@@ -3552,7 +3704,7 @@
 
 static void
 obj_coff_ident (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   segT current_seg = now_seg;		/* save current seg	*/
   subsegT current_subseg = now_subseg;
@@ -3811,7 +3963,7 @@
 
 static void
 obj_coff_lcomm (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   s_lcomm(0);
   return;
@@ -4258,6 +4410,12 @@
 #endif
 	}			/* if pcrel */
 
+#ifdef MD_APPLY_FIX3
+      md_apply_fix3 (fixP, (valueT *) &add_number, this_segment_type);
+#else
+      md_apply_fix (fixP, add_number);
+#endif
+
       if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow)
 	{
 #ifndef TC_M88K
@@ -4294,13 +4452,6 @@
 			  (unsigned long) (fragP->fr_address + where));
 #endif
 	}			/* not a bit fix */
-      /* Once this fix has been applied, we don't have to output
-	 anything nothing more need be done.  */
-#ifdef MD_APPLY_FIX3
-      md_apply_fix3 (fixP, (valueT *) &add_number, this_segment_type);
-#else
-      md_apply_fix (fixP, add_number);
-#endif
     }				/* For each fixS in this segment. */
 }				/* fixup_segment() */
 
@@ -4383,13 +4534,16 @@
 
 #endif /* not BFD_ASSEMBLER */
 
-const pseudo_typeS obj_pseudo_table[] =
+const pseudo_typeS coff_pseudo_table[] =
 {
   {"def", obj_coff_def, 0},
   {"dim", obj_coff_dim, 0},
   {"endef", obj_coff_endef, 0},
   {"line", obj_coff_line, 0},
   {"ln", obj_coff_ln, 0},
+#ifdef BFD_ASSEMBLER
+  {"loc", obj_coff_loc, 0},
+#endif
   {"appline", obj_coff_ln, 1},
   {"scl", obj_coff_scl, 0},
   {"size", obj_coff_size, 0},
@@ -4405,15 +4559,14 @@
      earlier versions of gas.  */
   {"bss", obj_coff_bss, 0},
   {"weak", obj_coff_weak, 0},
+  {"ident", obj_coff_ident, 0},
 #ifndef BFD_ASSEMBLER
   {"use", obj_coff_section, 0},
   {"text", obj_coff_text, 0},
   {"data", obj_coff_data, 0},
   {"lcomm", obj_coff_lcomm, 0},
-  {"ident", obj_coff_ident, 0},
 #else
   {"optim", s_ignore, 0},	/* For sun386i cc (?) */
-  {"ident", s_ignore, 0},	/* we don't yet handle this. */
 #endif
   {"version", s_ignore, 0},
   {"ABORT", s_abort, 0},
@@ -4421,62 +4574,43 @@
   /* The m88k uses sdef instead of def.  */
   {"sdef", obj_coff_def, 0},
 #endif
-  {NULL}			/* end sentinel */
-};				/* obj_pseudo_table */
+  {NULL, NULL, 0}		/* end sentinel */
+};				/* coff_pseudo_table */
 
 #ifdef BFD_ASSEMBLER
 
 /* Support for a COFF emulation.  */
 
+static void coff_pop_insert PARAMS ((void));
+
 static void
 coff_pop_insert ()
 {
-  pop_insert (obj_pseudo_table);
-}
-
-static int
-coff_sec_sym_ok_for_reloc (sec)
-     asection *sec;
-{
-  return 0;
-}
-
-static void
-no_func ()
-{
-  abort ();
+  pop_insert (coff_pseudo_table);
 }
 
 const struct format_ops coff_format_ops =
 {
   bfd_target_coff_flavour,
-  0,
-  1,
+  0,	/* dfl_leading_underscore */
+  1,	/* emit_section_symbols */
   coff_frob_symbol,
-  no_func,
+  0,	/* frob_file */
   coff_frob_file_after_relocs,
-  0, 0,
-  0, 0,
-  0,
-#if 0
-  obj_generate_asm_lineno,
-#else
-  no_func,
-#endif
-#if 0
-  obj_stab,
-#else
-  no_func,
-#endif
-  coff_sec_sym_ok_for_reloc,
+  0,	/* s_get_size */
+  0,	/* s_set_size */
+  0,	/* s_get_align */
+  0,	/* s_set_align */
+  0,	/* s_get_other */
+  0,	/* s_get_desc */
+  0,	/* copy_symbol_attributes */
+  0,	/* generate_asm_lineno */
+  0,	/* process_stab */
+  0,	/* sec_sym_ok_for_reloc */
   coff_pop_insert,
-#if 0
-  obj_set_ext,
-#else
-  no_func,
-#endif
+  0,	/* ecoff_set_ext */
   coff_obj_read_begin_hook,
-  coff_obj_symbol_new_hook,
+  coff_obj_symbol_new_hook
 };
 
 #endif
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index 4650477..f60ae36 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -1,5 +1,5 @@
 /* coff object file format
-   Copyright (C) 1989, 90, 91, 92, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1989, 90, 91, 92, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS.
@@ -110,12 +110,29 @@
 #endif
 
 #ifdef TC_SH
+
+#ifdef TE_PE
+#define COFF_WITH_PE
+#endif
+
 #include "coff/sh.h"
+
+#ifdef TE_PE
+#define TARGET_FORMAT "pe-shl"
+#else
 #define TARGET_FORMAT					\
   (shl							\
    ? (sh_small ? "coff-shl-small" : "coff-shl")		\
    : (sh_small ? "coff-sh-small" : "coff-sh"))
 #endif
+#endif
+
+#ifdef TC_MIPS
+#define COFF_WITH_PE
+#include "coff/mipspe.h"
+#undef  TARGET_FORMAT
+#define TARGET_FORMAT "pe-mips"
+#endif
 
 #ifdef TC_M88K
 #include "coff/m88k.h"
@@ -154,7 +171,7 @@
 #define OBJ_COFF_MAX_AUXENTRIES 1
 #endif /* OBJ_COFF_MAX_AUXENTRIES */
 
-extern void coff_obj_symbol_new_hook PARAMS ((struct symbol *));
+extern void coff_obj_symbol_new_hook PARAMS ((symbolS *));
 #define obj_symbol_new_hook coff_obj_symbol_new_hook
 
 extern void coff_obj_read_begin_hook PARAMS ((void));
@@ -211,32 +228,35 @@
 /* Alter the field names, for now, until we've fixed up the other
    references to use the new name.  */
 #ifdef TC_I960
-#define TC_SYMFIELD_TYPE	struct symbol *
+#define TC_SYMFIELD_TYPE	symbolS *
 #define sy_tc			bal
 #endif
 
 #define OBJ_SYMFIELD_TYPE	unsigned long
 #define sy_obj			sy_flags
 
-#define SYM_AUXENT(S)	(&coffsymbol ((S)->bsym)->native[1].u.auxent)
-#define SYM_AUXINFO(S)	(&coffsymbol ((S)->bsym)->native[1])
+#define SYM_AUXENT(S) \
+  (&coffsymbol (symbol_get_bfdsym (S))->native[1].u.auxent)
+#define SYM_AUXINFO(S) \
+  (&coffsymbol (symbol_get_bfdsym (S))->native[1])
 
 #define DO_NOT_STRIP	0
 
 extern void obj_coff_section PARAMS ((int));
 
 /* The number of auxiliary entries */
-#define S_GET_NUMBER_AUXILIARY(s)	(coffsymbol((s)->bsym)->native->u.syment.n_numaux)
+#define S_GET_NUMBER_AUXILIARY(s) \
+  (coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux)
 /* The number of auxiliary entries */
 #define S_SET_NUMBER_AUXILIARY(s,v)	(S_GET_NUMBER_AUXILIARY (s) = (v))
 
 /* True if a symbol name is in the string table, i.e. its length is > 8. */
 #define S_IS_STRING(s)		(strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
 
-extern int S_SET_DATA_TYPE PARAMS ((struct symbol *, int));
-extern int S_SET_STORAGE_CLASS PARAMS ((struct symbol *, int));
-extern int S_GET_STORAGE_CLASS PARAMS ((struct symbol *));
-extern void SA_SET_SYM_ENDNDX PARAMS ((struct symbol *, struct symbol *));
+extern int S_SET_DATA_TYPE PARAMS ((symbolS *, int));
+extern int S_SET_STORAGE_CLASS PARAMS ((symbolS *, int));
+extern int S_GET_STORAGE_CLASS PARAMS ((symbolS *));
+extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
 
 /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
 /* Omit the tv related fields */
@@ -298,9 +318,9 @@
 /* All other bits are unused. */
 
 /* Accessors */
-#define SF_GET(s)		((s)->sy_flags)
-#define SF_GET_DEBUG(s)		((s)->bsym->flags & BSF_DEBUGGING)
-#define SF_SET_DEBUG(s)		((s)->bsym->flags |= BSF_DEBUGGING)
+#define SF_GET(s)		(*symbol_get_obj (s))
+#define SF_GET_DEBUG(s)		(symbol_get_bfdsym (s)->flags & BSF_DEBUGGING)
+#define SF_SET_DEBUG(s)		(symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING)
 #define SF_GET_NORMAL_FIELD(s)	(SF_GET (s) & SF_NORMAL_MASK)
 #define SF_GET_DEBUG_FIELD(s)	(SF_GET (s) & SF_DEBUG_MASK)
 #define SF_GET_FILE(s)		(SF_GET (s) & SF_FILE)
@@ -346,13 +366,13 @@
 extern int coff_n_line_nos;
 
 #define obj_emit_lineno(WHERE,LINE,FILE_START)	abort ()
-extern void coff_add_linesym PARAMS ((struct symbol *));
+extern void coff_add_linesym PARAMS ((symbolS *));
 
 
 void c_dot_file_symbol PARAMS ((char *filename));
 #define obj_app_file c_dot_file_symbol
 
-extern void coff_frob_symbol PARAMS ((struct symbol *, int *));
+extern void coff_frob_symbol PARAMS ((symbolS *, int *));
 extern void coff_adjust_symtab PARAMS ((void));
 extern void coff_frob_section PARAMS ((segT));
 extern void coff_adjust_section_syms PARAMS ((bfd *, asection *, PTR));
@@ -364,10 +384,11 @@
 #define obj_frob_section(S)	coff_frob_section (S)
 #define obj_frob_file_after_relocs() coff_frob_file_after_relocs ()
 
-extern struct symbol *coff_last_function;
+extern symbolS *coff_last_function;
 
 /* Forward the segment of a forwarded symbol, handle assignments that
    just copy symbol values, etc.  */
+#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
 #ifndef TE_I386AIX
 #define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src) \
   (SF_GET_GET_SEGMENT (dest) \
@@ -379,6 +400,7 @@
    ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \
    : 0)
 #endif
+#endif
 
 /* sanity check */
 
@@ -778,7 +800,7 @@
 #define obj_app_file c_dot_file_symbol
 extern void obj_extra_stuff PARAMS ((object_headers * headers));
 
-extern segT s_get_segment PARAMS ((struct symbol * ptr));
+extern segT s_get_segment PARAMS ((symbolS *ptr));
 
 extern void c_section_header PARAMS ((struct internal_scnhdr * header,
 				      char *name,
@@ -792,7 +814,7 @@
 				      long alignment));
 
 #ifndef tc_coff_symbol_emit_hook
-void tc_coff_symbol_emit_hook PARAMS ((struct symbol *));
+void tc_coff_symbol_emit_hook PARAMS ((symbolS *));
 #endif
 
 /* sanity check */
@@ -818,6 +840,12 @@
 
 #endif /* not BFD_ASSEMBLER */
 
+extern const pseudo_typeS coff_pseudo_table[];
+
+#ifndef obj_pop_insert
+#define obj_pop_insert() pop_insert (coff_pseudo_table)
+#endif
+
 /* In COFF, if a symbol is defined using .def/.val SYM/.endef, it's OK
    to redefine the symbol later on.  This can happen if C symbols use
    a prefix, and a symbol is defined both with and without the prefix,
@@ -838,4 +866,8 @@
 extern void obj_coff_init_stab_section PARAMS ((segT));
 #define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
 
+/* Store the number of relocations in the section aux entry.  */
+#define SET_SECTION_RELOCS(sec, relocs, n) \
+  SA_SET_SCN_NRELOC (section_symbol (sec), n)
+
 #endif /* OBJ_FORMAT_H */
diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c
index ec3ce88..767dc58 100644
--- a/gas/config/obj-ecoff.c
+++ b/gas/config/obj-ecoff.c
@@ -1,5 +1,6 @@
 /* ECOFF object file format.
-   Copyright (C) 1993, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.
 
@@ -260,8 +261,9 @@
     = &ecoff_backend (stdoutput)->debug_swap;
   ecoff_symbol_type *esym;
 
-  know (bfd_asymbol_flavour (sym->bsym) == bfd_target_ecoff_flavour);
-  esym = ecoffsymbol (sym->bsym);
+  know (bfd_asymbol_flavour (symbol_get_bfdsym (sym))
+	== bfd_target_ecoff_flavour);
+  esym = ecoffsymbol (symbol_get_bfdsym (sym));
   esym->local = false;
   esym->native = xmalloc (debug_swap->external_ext_size);
   (*debug_swap->swap_ext_out) (stdoutput, ext, esym->native);
@@ -291,14 +293,18 @@
 const struct format_ops ecoff_format_ops =
 {
   bfd_target_ecoff_flavour,
-  0,
-  1,
+  0,	/* dfl_leading_underscore */
+  1,	/* emit_section_symbols */
   obj_ecoff_frob_symbol,
   ecoff_frob_file,
-  0,
-  0, 0,
-  0, 0,
-  0,
+  0,	/* frob_file_after_relocs */
+  0,	/* s_get_size */
+  0,	/* s_set_size */
+  0,	/* s_get_align */
+  0,	/* s_set_align */
+  0,	/* s_get_other */
+  0,	/* s_get_desc */
+  0,	/* copy_symbol_attributes */
   ecoff_generate_asm_lineno,
   ecoff_stab,
   ecoff_sec_sym_ok_for_reloc,
diff --git a/gas/config/obj-ecoff.h b/gas/config/obj-ecoff.h
index 427e619..8bca254 100644
--- a/gas/config/obj-ecoff.h
+++ b/gas/config/obj-ecoff.h
@@ -36,10 +36,14 @@
    symbols is undefined (this last is needed to distinguish a .extern
    symbols from a .comm symbol).  */
 
-#define TARGET_SYMBOL_FIELDS \
-  struct efdr *ecoff_file; \
-  struct localsym *ecoff_symbol; \
+struct ecoff_sy_obj
+{
+  struct efdr *ecoff_file;
+  struct localsym *ecoff_symbol;
   valueT ecoff_extern_size;
+};
+
+#define OBJ_SYMFIELD_TYPE struct ecoff_sy_obj
 
 /* Modify the ECOFF symbol.  */
 #define obj_frob_symbol(symp, punt) ecoff_frob_symbol (symp)
@@ -64,4 +68,4 @@
 #define obj_sec_sym_ok_for_reloc(SEC)	1
 
 #define obj_ecoff_set_ext ecoff_set_ext
-extern void obj_ecoff_set_ext PARAMS ((struct symbol *, EXTR *));
+extern void obj_ecoff_set_ext PARAMS ((symbolS *, EXTR *));
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index f50c4b7..21fd0fa 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1,5 +1,6 @@
 /* ELF object file format
-   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -45,6 +46,10 @@
 #include "elf/ppc.h"
 #endif
 
+#ifdef TC_I370
+#include "elf/i370.h"
+#endif
+
 static bfd_vma elf_s_get_size PARAMS ((symbolS *));
 static void elf_s_set_size PARAMS ((symbolS *, bfd_vma));
 static bfd_vma elf_s_get_align PARAMS ((symbolS *));
@@ -65,17 +70,17 @@
 static void obj_elf_ident PARAMS ((int));
 static void obj_elf_weak PARAMS ((int));
 static void obj_elf_local PARAMS ((int));
-static void obj_elf_common PARAMS ((int));
+static void obj_elf_visibility PARAMS ((int));
 static void obj_elf_symver PARAMS ((int));
 static void obj_elf_vtable_inherit PARAMS ((int));
 static void obj_elf_vtable_entry PARAMS ((int));
-static void obj_elf_data PARAMS ((int));
-static void obj_elf_text PARAMS ((int));
 static void obj_elf_subsection PARAMS ((int));
+static void obj_elf_popsection PARAMS ((int));
 
 static const pseudo_typeS elf_pseudo_table[] =
 {
   {"comm", obj_elf_common, 0},
+  {"common", obj_elf_common, 1},
   {"ident", obj_elf_ident, 0},
   {"local", obj_elf_local, 0},
   {"previous", obj_elf_previous, 0},
@@ -83,11 +88,18 @@
   {"section.s", obj_elf_section, 0},
   {"sect", obj_elf_section, 0},
   {"sect.s", obj_elf_section, 0},
+  {"pushsection", obj_elf_section, 1},
+  {"popsection", obj_elf_popsection, 0},
   {"size", obj_elf_size, 0},
   {"type", obj_elf_type, 0},
   {"version", obj_elf_version, 0},
   {"weak", obj_elf_weak, 0},
 
+  /* These define symbol visibility. */
+  {"internal", obj_elf_visibility, STV_INTERNAL},
+  {"hidden", obj_elf_visibility, STV_HIDDEN},
+  {"protected", obj_elf_visibility, STV_PROTECTED},
+
   /* These are used for stabs-in-elf configurations.  */
   {"line", obj_elf_line, 0},
 
@@ -111,7 +123,7 @@
   {"text", obj_elf_text, 0},
 
   /* End sentinel.  */
-  {NULL},
+  {NULL, NULL, 0},
 };
 
 static const pseudo_typeS ecoff_debug_pseudo_table[] =
@@ -156,7 +168,7 @@
   { "vreg",	s_ignore,		0 },
 #endif
 
-  {NULL}			/* end sentinel */
+  {NULL, NULL, 0}			/* end sentinel */
 };
 
 #undef NO_RELOC
@@ -214,6 +226,13 @@
   S_SET_ALIGN (sym, align);
 }
 
+int
+elf_s_get_other (sym)
+     symbolS *sym;
+{
+  return elf_symbol (symbol_get_bfdsym (sym))->internal_elf_sym.st_other;
+}
+
 static void
 elf_copy_symbol_attributes (dest, src)
      symbolS *dest, *src;
@@ -235,8 +254,8 @@
   symbolS *sym;
 
   sym = symbol_new (s, absolute_section, (valueT) 0, (struct frag *) 0);
-  sym->sy_frag = &zero_address_frag;
-  sym->bsym->flags |= BSF_FILE;
+  symbol_set_frag (sym, &zero_address_frag);
+  symbol_get_bfdsym (sym)->flags |= BSF_FILE;
 
   if (symbol_rootP != sym)
     {
@@ -252,9 +271,9 @@
 #endif
 }
 
-static void
-obj_elf_common (ignore)
-     int ignore;
+void
+obj_elf_common (is_common)
+     int is_common;
 {
   char *name;
   char c;
@@ -263,6 +282,12 @@
   symbolS *symbolP;
   int have_align;
 
+  if (flag_mri && is_common)
+    {
+      s_mri_common (0);
+      return;
+    }
+
   name = input_line_pointer;
   c = get_symbol_end ();
   /* just after name is now '\0' */
@@ -294,7 +319,7 @@
     }
   if (S_GET_VALUE (symbolP) != 0)
     {
-      if (S_GET_VALUE (symbolP) != size)
+      if (S_GET_VALUE (symbolP) != (valueT) size)
 	{
 	  as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
 		   S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
@@ -322,7 +347,7 @@
 	      as_warn (_("Common alignment negative; 0 assumed"));
 	    }
 	}
-      if (symbolP->local)
+      if (symbol_get_obj (symbolP)->local)
 	{
 	  segT old_sec;
 	  int old_subsec;
@@ -350,8 +375,8 @@
 	  if (align)
 	    frag_align (align, 0, 0);
 	  if (S_GET_SEGMENT (symbolP) == bss_section)
-	    symbolP->sy_frag->fr_symbol = 0;
-	  symbolP->sy_frag = frag_now;
+	    symbol_get_frag (symbolP)->fr_symbol = 0;
+	  symbol_set_frag (symbolP, frag_now);
 	  pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
 			    (offsetT) size, (char *) 0);
 	  *pfrag = 0;
@@ -389,7 +414,7 @@
       goto allocate_common;
     }
 
-  symbolP->bsym->flags |= BSF_OBJECT;
+  symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
 
   demand_empty_rest_of_line ();
   return;
@@ -411,7 +436,7 @@
 
 static void
 obj_elf_local (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   int c;
@@ -425,7 +450,7 @@
       *input_line_pointer = c;
       SKIP_WHITESPACE ();
       S_CLEAR_EXTERNAL (symbolP);
-      symbolP->local = 1;
+      symbol_get_obj (symbolP)->local = 1;
       if (c == ',')
 	{
 	  input_line_pointer++;
@@ -440,7 +465,7 @@
 
 static void
 obj_elf_weak (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   int c;
@@ -454,7 +479,7 @@
       *input_line_pointer = c;
       SKIP_WHITESPACE ();
       S_SET_WEAK (symbolP);
-      symbolP->local = 1;
+      symbol_get_obj (symbolP)->local = 1;
       if (c == ',')
 	{
 	  input_line_pointer++;
@@ -467,9 +492,61 @@
   demand_empty_rest_of_line ();
 }
 
+static void
+obj_elf_visibility (visibility)
+     int visibility;
+{
+  char *name;
+  int c;
+  symbolS *symbolP;
+  asymbol *bfdsym;
+  elf_symbol_type *elfsym;
+
+  do
+    {
+      name = input_line_pointer;
+      c = get_symbol_end ();
+      symbolP = symbol_find_or_make (name);
+      *input_line_pointer = c;
+
+      SKIP_WHITESPACE ();
+
+      bfdsym = symbol_get_bfdsym (symbolP);
+      elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
+
+      assert (elfsym);
+
+      elfsym->internal_elf_sym.st_other = visibility;
+
+      if (c == ',')
+	{
+	  input_line_pointer ++;
+
+	  SKIP_WHITESPACE ();
+
+	  if (*input_line_pointer == '\n')
+	    c = '\n';
+	}
+    }
+  while (c == ',');
+
+  demand_empty_rest_of_line ();
+}
+
+
 static segT previous_section;
 static int previous_subsection;
 
+struct section_stack
+{
+  struct section_stack *next;
+  segT seg, prev_seg;
+  int subseg, prev_subseg;
+};
+
+static struct section_stack *section_stack;
+
+
 /* Handle the .section pseudo-op.  This code supports two different
    syntaxes.
 
@@ -497,7 +574,7 @@
   int attributes;
 };
 
-static struct special_section special_sections[] =
+static struct special_section const special_sections[] =
 {
   { ".bss",	SHT_NOBITS,	SHF_ALLOC + SHF_WRITE		},
   { ".comment",	SHT_PROGBITS,	0				},
@@ -536,25 +613,198 @@
 };
 
 void
-obj_elf_section (xxx)
-     int xxx;
+obj_elf_change_section (name, type, attr, push)
+     char *name;
+     int type, attr, push;
 {
-  char *string;
   int new_sec;
   segT sec;
-  int type, attr;
-  int i;
-  flagword flags;
-  symbolS *secsym;
 
 #ifdef md_flush_pending_output
   md_flush_pending_output ();
 #endif
 
+  /* Switch to the section, creating it if necessary.  */
+  if (push)
+    {
+      struct section_stack *elt;
+      elt = xmalloc (sizeof (struct section_stack));
+      elt->next = section_stack;
+      elt->seg = now_seg;
+      elt->prev_seg = previous_section;
+      elt->subseg = now_subseg;
+      elt->prev_subseg = previous_subsection;
+      section_stack = elt;
+    }
+  previous_section = now_seg;
+  previous_subsection = now_subseg;
+
+  new_sec = bfd_get_section_by_name (stdoutput, name) == NULL;
+  sec = subseg_new (name, 0);
+
+  if (new_sec)
+    {
+      flagword flags;
+      symbolS *secsym;
+      int i;
+
+      /* See if this is one of the special sections.  */
+      for (i = 0; special_sections[i].name != NULL; i++)
+        if (strcmp (name, special_sections[i].name) == 0)
+          {
+	    if (type == SHT_NULL)
+	      type = special_sections[i].type;
+	    else if (type != special_sections[i].type)
+	      as_warn (_("Setting incorrect section type for %s"), name);
+
+	    if ((attr &~ special_sections[i].attributes) != 0)
+	      {
+	        /* As a GNU extension, we permit a .note section to be
+		   allocatable.  If the linker sees an allocateable .note
+		   section, it will create a PT_NOTE segment in the output
+		   file.  */
+		if (strcmp (name, ".note") != 0
+		    || attr != SHF_ALLOC)
+		  as_warn (_("Setting incorrect section attributes for %s"),
+			   name);
+	      }
+	    attr |= special_sections[i].attributes;
+	    break;
+	  }
+
+      /* Convert ELF type and flags to BFD flags.  */
+      flags = (SEC_RELOC
+	       | ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
+	       | ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
+	       | (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
+	       | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0));
+#ifdef md_elf_section_flags
+      flags = md_elf_section_flags (flags, attr, type);
+#endif
+
+      /* Prevent SEC_HAS_CONTENTS from being inadvertently set.  */
+      if (type == SHT_NOBITS)
+        seg_info (sec)->bss = 1;
+
+      bfd_set_section_flags (stdoutput, sec, flags);
+
+      /* Add a symbol for this section to the symbol table.  */
+      secsym = symbol_find (name);
+      if (secsym != NULL)
+	symbol_set_bfdsym (secsym, sec->symbol);
+      else
+        symbol_table_insert (section_symbol (sec));
+    }
+
+#ifdef md_elf_section_change_hook
+      md_elf_section_change_hook ();
+#endif
+}
+
+int
+obj_elf_parse_section_letters (str, len)
+     char *str;
+     size_t len;
+{
+  int attr = 0;
+
+  while (len > 0)
+    {
+      switch (*str)
+	{
+	case 'a':
+	  attr |= SHF_ALLOC;
+	  break;
+	case 'w':
+	  attr |= SHF_WRITE;
+	  break;
+	case 'x':
+	  attr |= SHF_EXECINSTR;
+	  break;
+	default:
+	  {
+	    char *bad_msg = _("Unrecognized .section attribute: want a,w,x");
+#ifdef md_elf_section_letter
+	    int md_attr = md_elf_section_letter (*str, &bad_msg);
+	    if (md_attr >= 0)
+	      attr |= md_attr;
+	    else
+#endif
+	      {
+		as_warn ("%s", bad_msg);
+		attr = -1;
+	      }
+	  }
+	  break;
+	}
+      str++, len--;
+    }
+
+  return attr;
+}
+
+int
+obj_elf_section_word (str, len)
+     char *str;
+     size_t len;
+{
+  if (len == 5 && strncmp (str, "write", 5) == 0)
+    return SHF_WRITE;
+  if (len == 5 && strncmp (str, "alloc", 5) == 0)
+    return SHF_ALLOC;
+  if (len == 9 && strncmp (str, "execinstr", 9) == 0)
+    return SHF_EXECINSTR;
+
+#ifdef md_elf_section_word
+  {
+    int md_attr = md_elf_section_word (str, len);
+    if (md_attr >= 0)
+      return md_attr;
+  }
+#endif
+
+  as_warn (_("Unrecognized section attribute"));
+  return 0;
+}
+
+int
+obj_elf_section_type (str, len)
+     char *str;
+     size_t len;
+{
+  if (len == 8 && strncmp (str, "progbits", 8) == 0)
+    return SHT_PROGBITS;
+  if (len == 6 && strncmp (str, "nobits", 6) == 0)
+    return SHT_NOBITS;
+
+#ifdef md_elf_section_type
+  {
+    int md_type = md_elf_section_type (str, len);
+    if (md_type >= 0)
+      return md_type;
+  }
+#endif
+
+  as_warn (_("Unrecognized section type"));
+  return 0;
+}
+
+void
+obj_elf_section (push)
+     int push;
+{
+  char *name, *beg, *end;
+  int type, attr, dummy;
+
+#ifndef TC_I370
   if (flag_mri)
     {
       char mri_type;
 
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
       previous_section = now_seg;
       previous_subsection = now_subseg;
 
@@ -566,13 +816,14 @@
 
       return;
     }
+#endif /* ! defined (TC_I370) */
 
   /* Get name of section.  */
   SKIP_WHITESPACE ();
   if (*input_line_pointer == '"')
     {
-      string = demand_copy_C_string (&xxx);
-      if (string == NULL)
+      name = demand_copy_C_string (&dummy);
+      if (name == NULL)
 	{
 	  ignore_rest_of_line ();
 	  return;
@@ -580,46 +831,21 @@
     }
   else
     {
-      char *p = input_line_pointer;
-      char c;
-      while (0 == strchr ("\n\t,; ", *p))
-	p++;
-      if (p == input_line_pointer)
+      end = input_line_pointer;
+      while (0 == strchr ("\n\t,; ", *end))
+	end++;
+      if (end == input_line_pointer)
 	{
 	  as_warn (_("Missing section name"));
 	  ignore_rest_of_line ();
 	  return;
 	}
-      c = *p;
-      *p = 0;
-      string = xmalloc ((unsigned long) (p - input_line_pointer + 1));
-      strcpy (string, input_line_pointer);
-      *p = c;
-      input_line_pointer = p;
+
+      name = xmalloc (end - input_line_pointer + 1);
+      memcpy (name, input_line_pointer, end - input_line_pointer);
+      name[end - input_line_pointer] = '\0';
+      input_line_pointer = end;
     }
-
-  /* Switch to the section, creating it if necessary.  */
-  previous_section = now_seg;
-  previous_subsection = now_subseg;
-
-  new_sec = bfd_get_section_by_name (stdoutput, string) == NULL;
-  sec = subseg_new (string, 0);
-
-  /* If this section already existed, we don't bother to change the
-     flag values.  */
-  if (! new_sec)
-    {
-      while (! is_end_of_line[(unsigned char) *input_line_pointer])
-	++input_line_pointer;
-      ++input_line_pointer;
-
-#ifdef md_elf_section_change_hook
-      md_elf_section_change_hook ();
-#endif
-
-      return;
-    }
-
   SKIP_WHITESPACE ();
 
   type = SHT_NULL;
@@ -629,81 +855,41 @@
     {
       /* Skip the comma.  */
       ++input_line_pointer;
-
       SKIP_WHITESPACE ();
 
       if (*input_line_pointer == '"')
 	{
-	  /* Pick up a string with a combination of a, w, x.  */
-	  ++input_line_pointer;
-	  while (*input_line_pointer != '"')
+	  beg = demand_copy_C_string (&dummy);
+	  if (beg == NULL)
 	    {
-	      switch (*input_line_pointer)
-		{
-		case 'a':
-		  attr |= SHF_ALLOC;
-		  break;
-		case 'w':
-		  attr |= SHF_WRITE;
-		  break;
-		case 'x':
-		  attr |= SHF_EXECINSTR;
-		  break;
-		default:
-		  {
-		    char *bad_msg = _("Bad .section directive: want a,w,x in string");
-#ifdef md_elf_section_letter
-		    int md_attr = md_elf_section_letter (*input_line_pointer, &bad_msg);
-		    if (md_attr)
-		      attr |= md_attr;
-		    else
-#endif
-		      {
-			as_warn (bad_msg);
-			ignore_rest_of_line ();
-			return;
-		      }
-		  }
-		}
-	      ++input_line_pointer;
+	      ignore_rest_of_line ();
+	      return;
 	    }
-
-	  /* Skip the closing quote.  */
-	  ++input_line_pointer;
+	  attr |= obj_elf_parse_section_letters (beg, strlen (beg));
 
 	  SKIP_WHITESPACE ();
 	  if (*input_line_pointer == ',')
 	    {
+	      char c;
 	      ++input_line_pointer;
 	      SKIP_WHITESPACE ();
-	      if (*input_line_pointer == '@' || *input_line_pointer == '%')
+	      c = *input_line_pointer;
+	      if (c == '"')
 		{
-		  ++input_line_pointer;
-		  if (strncmp (input_line_pointer, "progbits",
-			       sizeof "progbits" - 1) == 0)
+		  beg = demand_copy_C_string (&dummy);
+		  if (beg == NULL)
 		    {
-		      type = SHT_PROGBITS;
-		      input_line_pointer += sizeof "progbits" - 1;
+		      ignore_rest_of_line ();
+		      return;
 		    }
-		  else if (strncmp (input_line_pointer, "nobits",
-				    sizeof "nobits" - 1) == 0)
-		    {
-		      type = SHT_NOBITS;
-		      input_line_pointer += sizeof "nobits" - 1;
-		    }
-		  else
-		    {
-#ifdef md_elf_section_type
-		    int md_type = md_elf_section_type (&input_line_pointer);
-		    if (md_type)
-		      type = md_type;
-		    else
-#endif
-		      {
-			as_warn (_("Unrecognized section type"));
-			ignore_rest_of_line ();
-		      }
-		    }
+		  type = obj_elf_section_type (beg, strlen (beg));
+		}
+	      else if (c == '@' || c == '%')
+		{
+		  beg = ++input_line_pointer;
+		  c = get_symbol_end ();
+		  *input_line_pointer = c;
+		  type = obj_elf_section_type (beg, input_line_pointer - beg);
 		}
 	    }
 	}
@@ -711,6 +897,8 @@
 	{
 	  do
 	    {
+	      char c;
+
 	      SKIP_WHITESPACE ();
 	      if (*input_line_pointer != '#')
 		{
@@ -718,39 +906,12 @@
 		  ignore_rest_of_line ();
 		  return;
 		}
-	      ++input_line_pointer;
-	      if (strncmp (input_line_pointer, "write",
-			   sizeof "write" - 1) == 0)
-		{
-		  attr |= SHF_WRITE;
-		  input_line_pointer += sizeof "write" - 1;
-		}
-	      else if (strncmp (input_line_pointer, "alloc",
-				sizeof "alloc" - 1) == 0)
-		{
-		  attr |= SHF_ALLOC;
-		  input_line_pointer += sizeof "alloc" - 1;
-		}
-	      else if (strncmp (input_line_pointer, "execinstr",
-				sizeof "execinstr" - 1) == 0)
-		{
-		  attr |= SHF_EXECINSTR;
-		  input_line_pointer += sizeof "execinstr" - 1;
-		}
-	      else
-		{
-#ifdef md_elf_section_word
-		  int md_attr = md_elf_section_word (&input_line_pointer);
-		  if (md_attr)
-		    attr |= md_attr;
-		  else
-#endif
-		    {
-		      as_warn (_("Unrecognized section attribute"));
-		      ignore_rest_of_line ();
-		      return;
-		    }
-		}
+	      beg = ++input_line_pointer;
+	      c = get_symbol_end ();
+	      *input_line_pointer = c;
+
+	      attr |= obj_elf_section_word (beg, input_line_pointer - beg);
+
 	      SKIP_WHITESPACE ();
 	    }
 	  while (*input_line_pointer++ == ',');
@@ -758,77 +919,14 @@
 	}
     }
 
-  /* See if this is one of the special sections.  */
-  for (i = 0; special_sections[i].name != NULL; i++)
-    {
-      if (string[1] == special_sections[i].name[1]
-	  && strcmp (string, special_sections[i].name) == 0)
-	{
-	  if (type == SHT_NULL)
-	    type = special_sections[i].type;
-	  else if (type != special_sections[i].type)
-	    as_warn (_("Setting incorrect section type for %s"), string);
-
-	  if ((attr &~ special_sections[i].attributes) != 0)
-	    {
-	      /* As a GNU extension, we permit a .note section to be
-                 allocatable.  If the linker sees an allocateable
-                 .note section, it will create a PT_NOTE segment in
-                 the output file.  */
-	      if (strcmp (string, ".note") != 0
-		  || attr != SHF_ALLOC)
-		as_warn (_("Setting incorrect section attributes for %s"),
-			 string);
-	    }
-	  attr |= special_sections[i].attributes;
-
-	  break;
-	}
-    }
-
-  flags = (SEC_RELOC
-	   | ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
-	   | ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
-	   | (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
-	   | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0));
-  if (special_sections[i].name == NULL)
-    {
-      if (type == SHT_PROGBITS)
-	flags |= SEC_ALLOC | SEC_LOAD;
-      else if (type == SHT_NOBITS)
-	{
-	  flags |= SEC_ALLOC;
-	  flags &=~ SEC_LOAD;
-	}
-
-#ifdef md_elf_section_flags
-      flags = md_elf_section_flags (flags, attr, type);
-#endif
-    }
-
-  /* Prevent SEC_HAS_CONTENTS from being inadvertently set.  */
-  if (type == SHT_NOBITS)
-    seg_info (sec)->bss = 1;
-
-  bfd_set_section_flags (stdoutput, sec, flags);
-
-  /* Add a symbol for this section to the symbol table.  */
-  secsym = symbol_find (string);
-  if (secsym != NULL)
-    secsym->bsym = sec->symbol;
-  else
-    symbol_table_insert (section_symbol (sec));
-
-#ifdef md_elf_section_change_hook
-  md_elf_section_change_hook ();
-#endif
-
   demand_empty_rest_of_line ();
+
+  obj_elf_change_section (name, type, attr, push);
 }
 
 /* Change to the .data section.  */
 
-static void
+void
 obj_elf_data (i)
      int i;
 {
@@ -847,7 +945,7 @@
 
 /* Change to the .text section.  */
 
-static void
+void
 obj_elf_text (i)
      int i;
 {
@@ -866,7 +964,7 @@
 
 static void
 obj_elf_subsection (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register int temp;
 
@@ -898,8 +996,11 @@
 
 void
 obj_elf_previous (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
+  segT new_section;
+  int new_subsection;
+
   if (previous_section == 0)
     {
       as_bad (_(".previous without corresponding .section; ignored"));
@@ -910,8 +1011,38 @@
   md_flush_pending_output ();
 #endif
 
-  subseg_set (previous_section, previous_subsection);
-  previous_section = 0;
+  new_section = previous_section;
+  new_subsection = previous_subsection;
+  previous_section = now_seg;
+  previous_subsection = now_subseg;
+  subseg_set (new_section, new_subsection);
+
+#ifdef md_elf_section_change_hook
+  md_elf_section_change_hook ();
+#endif
+}
+
+static void
+obj_elf_popsection (xxx)
+     int xxx ATTRIBUTE_UNUSED;
+{
+  struct section_stack *top = section_stack;
+
+  if (top == NULL)
+    {
+      as_bad (_(".popsection without corresponding .pushsection; ignored"));
+      return;
+    }
+
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
+  section_stack = top->next;
+  previous_section = top->prev_seg;
+  previous_subsection = top->prev_subseg;
+  subseg_set (top->seg, top->subseg);
+  free (top);
 
 #ifdef md_elf_section_change_hook
   md_elf_section_change_hook ();
@@ -920,7 +1051,7 @@
 
 static void
 obj_elf_line (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* Assume delimiter is part of expression.  BSD4.2 as fails with
      delightful bug, so we are not being incompatible here. */
@@ -936,7 +1067,7 @@
 
 static void
 obj_elf_symver (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char c;
@@ -949,7 +1080,7 @@
 
   *input_line_pointer = c;
 
-  if (sym->sy_obj.versioned_name != NULL)
+  if (symbol_get_obj (sym)->versioned_name != NULL)
     {
       as_bad (_("multiple .symver directives for symbol `%s'"),
 	      S_GET_NAME (sym));
@@ -975,14 +1106,14 @@
       *input_line_pointer++ = c;
     }
 
-  sym->sy_obj.versioned_name = xstrdup (name);
+  symbol_get_obj (sym)->versioned_name = xstrdup (name);
 
   *input_line_pointer = c;
 
-  if (strchr (sym->sy_obj.versioned_name, ELF_VER_CHR) == NULL)
+  if (strchr (symbol_get_obj (sym)->versioned_name, ELF_VER_CHR) == NULL)
     {
       as_bad (_("missing version name in `%s' for symbol `%s'"),
-	      sym->sy_obj.versioned_name, S_GET_NAME (sym));
+	      symbol_get_obj (sym)->versioned_name, S_GET_NAME (sym));
       ignore_rest_of_line ();
       return;
     }
@@ -996,6 +1127,7 @@
 
 static void
 obj_elf_vtable_inherit (ignore)
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *cname, *pname;
   symbolS *csym, *psym;
@@ -1012,7 +1144,7 @@
      the same child symbol.  Also, we can currently only do this if the
      child symbol is already exists and is placed in a fragment.  */
 
-  if (csym == NULL || csym->sy_frag == NULL)
+  if (csym == NULL || symbol_get_frag (csym) == NULL)
     {
       as_bad ("expected `%s' to have already been set for .vtable_inherit",
 	      cname);
@@ -1037,7 +1169,7 @@
 
   if (input_line_pointer[0] == '0'
       && (input_line_pointer[1] == '\0'
-	  || isspace(input_line_pointer[1])))
+	  || isspace ((unsigned char) input_line_pointer[1])))
     {
       psym = section_symbol (absolute_section);
       ++input_line_pointer;
@@ -1055,17 +1187,19 @@
   if (bad)
     return;
 
-  assert (csym->sy_value.X_op == O_constant);
-  fix_new (csym->sy_frag, csym->sy_value.X_add_number, 0, psym, 0, 0,
+  assert (symbol_get_value_expression (csym)->X_op == O_constant);
+  fix_new (symbol_get_frag (csym),
+	   symbol_get_value_expression (csym)->X_add_number, 0, psym, 0, 0,
 	   BFD_RELOC_VTABLE_INHERIT);
 }
-  
+
 /* This handles the .vtable_entry pseudo-op, which is used to indicate
    to the linker that a vtable slot was used.  The syntax is
    ".vtable_entry tablename, offset".  */
 
 static void
 obj_elf_vtable_entry (ignore)
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   symbolS *sym;
@@ -1101,7 +1235,7 @@
 }
 
 void
-obj_read_begin_hook ()
+elf_obj_read_begin_hook ()
 {
 #ifdef NEED_ECOFF_DEBUG
   if (ECOFF_DEBUGGING)
@@ -1110,11 +1244,14 @@
 }
 
 void
-obj_symbol_new_hook (symbolP)
+elf_obj_symbol_new_hook (symbolP)
      symbolS *symbolP;
 {
-  symbolP->sy_obj.size = NULL;
-  symbolP->sy_obj.versioned_name = NULL;
+  struct elf_obj_sy *sy_obj;
+
+  sy_obj = symbol_get_obj (symbolP);
+  sy_obj->size = NULL;
+  sy_obj->versioned_name = NULL;
 
 #ifdef NEED_ECOFF_DEBUG
   if (ECOFF_DEBUGGING)
@@ -1124,7 +1261,7 @@
 
 void
 obj_elf_version (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   unsigned int c;
@@ -1191,7 +1328,7 @@
 
 static void
 obj_elf_size (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name = input_line_pointer;
   char c = get_symbol_end ();
@@ -1225,15 +1362,16 @@
     S_SET_SIZE (sym, exp.X_add_number);
   else
     {
-      sym->sy_obj.size = (expressionS *) xmalloc (sizeof (expressionS));
-      *sym->sy_obj.size = exp;
+      symbol_get_obj (sym)->size =
+	(expressionS *) xmalloc (sizeof (expressionS));
+      *symbol_get_obj (sym)->size = exp;
     }
   demand_empty_rest_of_line ();
 }
 
 /* Handle the ELF .type pseudo-op.  This sets the type of a symbol.
    There are four syntaxes:
-   
+
    The first (used on Solaris) is
        .type SYM,#function
    The second (used on UnixWare) is
@@ -1246,7 +1384,7 @@
 
 static void
 obj_elf_type (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char c;
@@ -1284,19 +1422,23 @@
 
   *input_line_pointer = c;
 
-  sym->bsym->flags |= type;
+  symbol_get_bfdsym (sym)->flags |= type;
 
   demand_empty_rest_of_line ();
 }
 
 static void
 obj_elf_ident (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   static segT comment_section;
   segT old_section = now_seg;
   int old_subsection = now_subseg;
 
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
   if (!comment_section)
     {
       char *p;
@@ -1351,7 +1493,7 @@
 adjust_stab_sections (abfd, sec, xxx)
      bfd *abfd;
      asection *sec;
-     PTR xxx;
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   char *name;
   asection *strsec;
@@ -1393,7 +1535,7 @@
      symbolS *sym;
      struct ecoff_extr *ext;
 {
-  sym->bsym->udata.p = (PTR) ext;
+  symbol_get_bfdsym (sym)->udata.p = (PTR) ext;
 }
 
 /* This function is called by bfd_ecoff_debug_externals.  It is
@@ -1417,8 +1559,8 @@
 /*ARGSUSED*/
 static void
 elf_set_index (sym, indx)
-     asymbol *sym;
-     bfd_size_type indx;
+     asymbol *sym ATTRIBUTE_UNUSED;
+     bfd_size_type indx ATTRIBUTE_UNUSED;
 {
 }
 
@@ -1429,35 +1571,39 @@
      symbolS *symp;
      int *puntp;
 {
+  struct elf_obj_sy *sy_obj;
+
 #ifdef NEED_ECOFF_DEBUG
   if (ECOFF_DEBUGGING)
     ecoff_frob_symbol (symp);
 #endif
 
-  if (symp->sy_obj.size != NULL)
+  sy_obj = symbol_get_obj (symp);
+
+  if (sy_obj->size != NULL)
     {
-      switch (symp->sy_obj.size->X_op)
+      switch (sy_obj->size->X_op)
 	{
 	case O_subtract:
 	  S_SET_SIZE (symp,
-		      (S_GET_VALUE (symp->sy_obj.size->X_add_symbol)
-		       + symp->sy_obj.size->X_add_number
-		       - S_GET_VALUE (symp->sy_obj.size->X_op_symbol)));
+		      (S_GET_VALUE (sy_obj->size->X_add_symbol)
+		       + sy_obj->size->X_add_number
+		       - S_GET_VALUE (sy_obj->size->X_op_symbol)));
 	  break;
 	case O_constant:
 	  S_SET_SIZE (symp,
-		      (S_GET_VALUE (symp->sy_obj.size->X_add_symbol)
-		       + symp->sy_obj.size->X_add_number));
+		      (S_GET_VALUE (sy_obj->size->X_add_symbol)
+		       + sy_obj->size->X_add_number));
 	  break;
 	default:
 	  as_bad (_(".size expression too complicated to fix up"));
 	  break;
 	}
-      free (symp->sy_obj.size);
-      symp->sy_obj.size = NULL;
+      free (sy_obj->size);
+      sy_obj->size = NULL;
     }
 
-  if (symp->sy_obj.versioned_name != NULL)
+  if (sy_obj->versioned_name != NULL)
     {
       /* This symbol was given a new name with the .symver directive.
 
@@ -1477,15 +1623,15 @@
 	  /* Verify that the name isn't using the @@ syntax--this is
              reserved for definitions of the default version to link
              against.  */
-	  p = strchr (symp->sy_obj.versioned_name, ELF_VER_CHR);
+	  p = strchr (sy_obj->versioned_name, ELF_VER_CHR);
 	  know (p != NULL);
 	  if (p[1] == ELF_VER_CHR)
 	    {
 	      as_bad (_("invalid attempt to declare external version name as default in symbol `%s'"),
-		      symp->sy_obj.versioned_name);
+		      sy_obj->versioned_name);
 	      *puntp = true;
 	    }
-	  S_SET_NAME (symp, symp->sy_obj.versioned_name);
+	  S_SET_NAME (symp, sy_obj->versioned_name);
 	}
       else
 	{
@@ -1497,7 +1643,7 @@
              where the loop will still see it.  It would probably be
              better to do this in obj_frob_file_before_adjust. */
 
-	  symp2 = symbol_find_or_make (symp->sy_obj.versioned_name);
+	  symp2 = symbol_find_or_make (sy_obj->versioned_name);
 
 	  /* Now we act as though we saw symp2 = sym.  */
 
@@ -1505,9 +1651,11 @@
 
 	  /* Subtracting out the frag address here is a hack because
              we are in the middle of the final loop.  */
-	  S_SET_VALUE (symp2, S_GET_VALUE (symp) - symp->sy_frag->fr_address);
+	  S_SET_VALUE (symp2,
+		       (S_GET_VALUE (symp)
+			- symbol_get_frag (symp)->fr_address));
 
-	  symp2->sy_frag = symp->sy_frag;
+	  symbol_set_frag (symp2, symbol_get_frag (symp));
 
 	  /* This will copy over the size information.  */
 	  copy_symbol_attributes (symp2, symp);
@@ -1521,7 +1669,7 @@
     }
 
   /* Double check weak symbols.  */
-  if (symp->bsym->flags & BSF_WEAK)
+  if (S_IS_WEAK (symp))
     {
       if (S_IS_COMMON (symp))
 	as_bad (_("Symbol `%s' can not be both weak and common"),
@@ -1537,19 +1685,23 @@
      .global directives to mark functions.  */
 
   if (S_IS_COMMON (symp))
-    symp->bsym->flags |= BSF_OBJECT;
+    symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
 
   if (strstr (TARGET_OS, "irix") != NULL
-      && (! S_IS_DEFINED (symp) && ((symp->bsym->flags & BSF_FUNCTION) == 0)))
-    symp->bsym->flags |= BSF_OBJECT;
+      && ! S_IS_DEFINED (symp)
+      && (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0)
+    symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
 #endif
 
-#ifdef TC_PPC
-  /* Frob the PowerPC, so that the symbol always has object type
-     if it is not some other type.  VxWorks needs this.  */
-  if ((symp->bsym->flags & (BSF_FUNCTION | BSF_FILE | BSF_SECTION_SYM)) == 0
+#if 0 /* TC_PPC */
+  /* If TC_PPC is defined, we used to force the type of a symbol to be
+     BSF_OBJECT if it was otherwise unset.  This was required by some
+     version of VxWorks.  Thomas de Lellis <tdel@windriver.com> says
+     that this is no longer needed, so it is now commented out.  */
+  if ((symbol_get_bfdsym (symp)->flags
+       & (BSF_FUNCTION | BSF_FILE | BSF_SECTION_SYM)) == 0
       && S_IS_DEFINED (symp))
-    symp->bsym->flags |= BSF_OBJECT;
+    symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
 #endif
 }
 
@@ -1621,7 +1773,11 @@
 	 this?  */
       sec->_raw_size = bfd_ecoff_debug_size (stdoutput, &debug, debug_swap);
 
-      if (! bfd_set_section_contents (stdoutput, sec, (PTR) NULL,
+      /* Pass BUF to bfd_set_section_contents because this will
+         eventually become a call to fwrite, and ISO C prohibits
+         passing a NULL pointer to a stdio function even if the
+         pointer will not be used.  */
+      if (! bfd_set_section_contents (stdoutput, sec, (PTR) buf,
 				      (file_ptr) 0, (bfd_size_type) 0))
 	as_fatal (_("Can't start writing .mdebug section: %s"),
 		  bfd_errmsg (bfd_get_error ()));
@@ -1652,14 +1808,14 @@
    SCO OpenServer 5 identifies it's ELF modules with a standard ELF
    .note section.
 
-   int_32 namesz  = 4 ;  Name size 
-   int_32 descsz  = 12 ; Descriptive information 
-   int_32 type    = 1 ;  
-   char   name[4] = "SCO" ; Originator name ALWAYS SCO + NULL 
+   int_32 namesz  = 4 ;  Name size
+   int_32 descsz  = 12 ; Descriptive information
+   int_32 type    = 1 ;
+   char   name[4] = "SCO" ; Originator name ALWAYS SCO + NULL
    int_32 version = (major ver # << 16)  | version of tools ;
    int_32 source  = (tool_id << 16 ) | 1 ;
    int_32 info    = 0 ;    These are set by the SCO tools, but we
-                           don't know enough about the source 
+                           don't know enough about the source
 			   environment to set them.  SCO ld currently
 			   ignores them, and recommends we set them
 			   to zero.  */
@@ -1691,7 +1847,7 @@
 
   /* process the version string */
 
-  i_note.namesz = 4; 
+  i_note.namesz = 4;
   i_note.descsz = 12;		/* 12 descriptive bytes */
   i_note.type = NT_VERSION;	/* Contains a version string */
 
@@ -1705,7 +1861,7 @@
   md_number_to_chars (p, (valueT) i_note.type, 4);
 
   p = frag_more (4);
-  strcpy (p, "SCO"); 
+  strcpy (p, "SCO");
 
   /* Note: this is the version number of the ELF we're representing */
   p = frag_more (4);
@@ -1722,7 +1878,7 @@
      and just set them to zero.  */
   p = frag_more (4);
   md_number_to_chars (p, 0x0000, 4);
- 
+
   frag_align (2, 0, 0);
 
   /* We probably can't restore the current segment, for there likely
@@ -1737,28 +1893,30 @@
 const struct format_ops elf_format_ops =
 {
   bfd_target_elf_flavour,
-  0,
-  1,
+  0,	/* dfl_leading_underscore */
+  1,	/* emit_section_symbols */
   elf_frob_symbol,
   elf_frob_file,
   elf_frob_file_after_relocs,
   elf_s_get_size, elf_s_set_size,
   elf_s_get_align, elf_s_set_align,
+  elf_s_get_other,
+  0,	/* s_get_desc */
   elf_copy_symbol_attributes,
 #ifdef NEED_ECOFF_DEBUG
   ecoff_generate_asm_lineno,
   ecoff_stab,
 #else
-  0,
-  0,				/* process_stab */
+  0,	/* generate_asm_lineno */
+  0,	/* process_stab */
 #endif
   elf_sec_sym_ok_for_reloc,
   elf_pop_insert,
 #ifdef NEED_ECOFF_DEBUG
   elf_ecoff_set_ext,
 #else
-  0,
+  0,	/* ecoff_set_ext */
 #endif
-  obj_read_begin_hook,
-  obj_symbol_new_hook,
+  elf_obj_read_begin_hook,
+  elf_obj_symbol_new_hook,
 };
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index 2f4bc5f..722c5fd 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -1,5 +1,6 @@
 /* ELF object file format.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -27,115 +28,17 @@
 
 #define OBJ_ELF 1
 
+#ifndef OUTPUT_FLAVOR
 #define OUTPUT_FLAVOR bfd_target_elf_flavour
+#endif
 
 #include <bfd.h>
 
 #define BYTES_IN_WORD 4		/* for now */
 #include "bfd/elf-bfd.h"
 
-/* Additional information we keep for each symbol.  */
-
-/* FIXME: For some reason, this structure is needed both here and in
-   obj-multi.h.  */
-#ifndef OBJ_SYMFIELD_TYPE
-struct elf_obj_sy
-{
-  /* Use this to keep track of .size expressions that involve
-     differences that we can't compute yet.  */
-  expressionS *size;
-
-  /* The name specified by the .symver directive.  */
-  char *versioned_name;
-};
-#endif
-
-#define OBJ_SYMFIELD_TYPE struct elf_obj_sy
-
-/* Symbol fields used by the ELF back end.  */
-#define ELF_TARGET_SYMBOL_FIELDS int local:1;
-
-/* Don't change this; change ELF_TARGET_SYMBOL_FIELDS instead.  */
-#define TARGET_SYMBOL_FIELDS ELF_TARGET_SYMBOL_FIELDS
-
 #include "targ-cpu.h"
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE  !FALSE
-#endif
-
-#define obj_begin() elf_begin ()
-extern void elf_begin PARAMS ((void));
-
-/* should be conditional on address size! */
-#define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
-
-#define S_GET_SIZE(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_size)
-#define S_SET_SIZE(S,V) \
-  (elf_symbol((S)->bsym)->internal_elf_sym.st_size = (V))
-
-#define S_GET_ALIGN(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_value)
-#define S_SET_ALIGN(S,V) \
-  (elf_symbol ((S)->bsym)->internal_elf_sym.st_value = (V))
-
-#define S_GET_OTHER(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other)
-#define S_SET_OTHER(S,V) \
-  (elf_symbol ((S)->bsym)->internal_elf_sym.st_other = (V))
-
-extern asection *gdb_section;
-
-#define obj_frob_file  elf_frob_file
-extern void elf_frob_file PARAMS ((void));
-
-#define obj_frob_file_after_relocs  elf_frob_file_after_relocs
-extern void elf_frob_file_after_relocs PARAMS ((void));
-
-#define obj_app_file elf_file_symbol
-extern void elf_file_symbol PARAMS ((char *));
-
-extern void obj_elf_section_change_hook PARAMS ((void));
-
-extern void obj_elf_section PARAMS ((int));
-extern void obj_elf_previous PARAMS ((int));
-extern void obj_elf_version PARAMS ((int));
-
-/* BFD wants to write the udata field, which is a no-no for the
-   globally defined sections.  */
-#define obj_sec_sym_ok_for_reloc(SEC)	((SEC)->owner != 0)
-
-/* When setting one symbol equal to another, by default we probably
-   want them to have the same "size", whatever it means in the current
-   context.  */
-#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC)			\
-do								\
-  {								\
-    if ((SRC)->sy_obj.size)					\
-      {								\
-	if ((DEST)->sy_obj.size == NULL)			\
-	  (DEST)->sy_obj.size =					\
-	    (expressionS *) xmalloc (sizeof (expressionS));	\
-	*(DEST)->sy_obj.size = *(SRC)->sy_obj.size;		\
-      }								\
-    else							\
-      {								\
-	if ((DEST)->sy_obj.size != NULL)			\
-	  free ((DEST)->sy_obj.size);				\
-	(DEST)->sy_obj.size = NULL;				\
-      }								\
-    S_SET_SIZE ((DEST), S_GET_SIZE (SRC));			\
-    S_SET_OTHER ((DEST), S_GET_OTHER (SRC));			\
-  }								\
-while (0)
-
-/* Stabs go in a separate section.  */
-#define SEPARATE_STAB_SECTIONS 1
-
-/* We need 12 bytes at the start of the section to hold some initial
-   information.  */
-extern void obj_elf_init_stab_section PARAMS ((segT));
-#define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
-
 #ifdef TC_ALPHA
 #define ECOFF_DEBUGGING alpha_flag_mdebug
 extern int alpha_flag_mdebug;
@@ -150,16 +53,151 @@
 #endif /* MIPS_STABS_ELF */
 #endif /* TC_MIPS */
 
-#ifdef ECOFF_DEBUGGING
-/* If we are generating ECOFF debugging information, we need some
-   additional fields for each symbol.  */
-#undef TARGET_SYMBOL_FIELDS
-#define TARGET_SYMBOL_FIELDS \
-  ELF_TARGET_SYMBOL_FIELDS \
-  struct efdr *ecoff_file; \
-  struct localsym *ecoff_symbol; \
-  valueT ecoff_extern_size;
+#ifdef OBJ_MAYBE_ECOFF
+#ifndef ECOFF_DEBUGGING
+#define ECOFF_DEBUGGING 1
+#endif
+#endif
 
+/* Additional information we keep for each symbol.  */
+struct elf_obj_sy
+{
+  /* Whether the symbol has been marked as local.  */
+  int local;
+
+  /* Use this to keep track of .size expressions that involve
+     differences that we can't compute yet.  */
+  expressionS *size;
+
+  /* The name specified by the .symver directive.  */
+  char *versioned_name;
+
+#ifdef ECOFF_DEBUGGING
+  /* If we are generating ECOFF debugging information, we need some
+     additional fields for each symbol.  */
+  struct efdr *ecoff_file;
+  struct localsym *ecoff_symbol;
+  valueT ecoff_extern_size;
+#endif
+};
+
+#define OBJ_SYMFIELD_TYPE struct elf_obj_sy
+
+#ifndef FALSE
+#define FALSE 0
+#define TRUE  !FALSE
+#endif
+
+#define obj_begin() elf_begin ()
+extern void elf_begin PARAMS ((void));
+
+/* should be conditional on address size! */
+#define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
+
+#ifndef S_GET_SIZE
+#define S_GET_SIZE(S) \
+  (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
+#endif
+#ifndef S_SET_SIZE
+#define S_SET_SIZE(S,V) \
+  (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
+#endif
+
+#ifndef S_GET_ALIGN
+#define S_GET_ALIGN(S) \
+  (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
+#endif
+#ifndef S_SET_ALIGN
+#define S_SET_ALIGN(S,V) \
+  (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
+#endif
+
+int elf_s_get_other PARAMS ((symbolS *));
+#ifndef S_GET_OTHER
+#define S_GET_OTHER(S)	(elf_s_get_other (S))
+#endif
+#ifndef S_SET_OTHER
+#define S_SET_OTHER(S,V) \
+  (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
+#endif
+
+extern asection *gdb_section;
+
+#ifndef obj_frob_file
+#define obj_frob_file  elf_frob_file
+#endif
+extern void elf_frob_file PARAMS ((void));
+
+#ifndef obj_frob_file_after_relocs
+#define obj_frob_file_after_relocs  elf_frob_file_after_relocs
+#endif
+extern void elf_frob_file_after_relocs PARAMS ((void));
+
+#define obj_app_file elf_file_symbol
+extern void elf_file_symbol PARAMS ((char *));
+
+extern void obj_elf_section_change_hook PARAMS ((void));
+
+extern void obj_elf_section PARAMS ((int));
+extern void obj_elf_previous PARAMS ((int));
+extern void obj_elf_version PARAMS ((int));
+extern void obj_elf_common PARAMS ((int));
+extern void obj_elf_data PARAMS ((int));
+extern void obj_elf_text PARAMS ((int));
+
+/* BFD wants to write the udata field, which is a no-no for the
+   globally defined sections.  */
+#ifndef obj_sec_sym_ok_for_reloc
+#define obj_sec_sym_ok_for_reloc(SEC)	((SEC)->owner != 0)
+#endif
+
+void elf_obj_read_begin_hook PARAMS ((void));
+#ifndef obj_read_begin_hook
+#define obj_read_begin_hook	elf_obj_read_begin_hook
+#endif
+
+void elf_obj_symbol_new_hook PARAMS ((symbolS *));
+#ifndef obj_symbol_new_hook
+#define obj_symbol_new_hook	elf_obj_symbol_new_hook
+#endif
+
+/* When setting one symbol equal to another, by default we probably
+   want them to have the same "size", whatever it means in the current
+   context.  */
+#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC)			\
+do								\
+  {								\
+    struct elf_obj_sy *srcelf = symbol_get_obj (SRC);		\
+    struct elf_obj_sy *destelf = symbol_get_obj (DEST);		\
+    if (srcelf->size)						\
+      {								\
+	if (destelf->size == NULL)				\
+	  destelf->size =					\
+	    (expressionS *) xmalloc (sizeof (expressionS));	\
+	*destelf->size = *srcelf->size;				\
+      }								\
+    else							\
+      {								\
+	if (destelf->size != NULL)				\
+	  free (destelf->size);					\
+	destelf->size = NULL;					\
+      }								\
+    S_SET_SIZE ((DEST), S_GET_SIZE (SRC));			\
+    S_SET_OTHER ((DEST), S_GET_OTHER (SRC));			\
+  }								\
+while (0)
+#endif
+
+/* Stabs go in a separate section.  */
+#define SEPARATE_STAB_SECTIONS 1
+
+/* We need 12 bytes at the start of the section to hold some initial
+   information.  */
+extern void obj_elf_init_stab_section PARAMS ((segT));
+#define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
+
+#ifdef ECOFF_DEBUGGING
 /* We smuggle stabs in ECOFF rather than using a separate section.
    The Irix linker can not handle a separate stabs section.  */
 
@@ -170,25 +208,28 @@
 #define INIT_STAB_SECTION(seg) \
   ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
 
+#undef OBJ_PROCESS_STAB
 #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc)		\
   if (ECOFF_DEBUGGING)							\
     ecoff_stab ((seg), (what), (string), (type), (other), (desc))
 #endif /* ECOFF_DEBUGGING */
 
-extern void elf_frob_symbol PARAMS ((struct symbol *, int *));
+extern void elf_frob_symbol PARAMS ((symbolS *, int *));
 #ifndef obj_frob_symbol
 #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
 #endif
 
 extern void elf_pop_insert PARAMS ((void));
+#ifndef obj_pop_insert
 #define obj_pop_insert()	elf_pop_insert()
+#endif
 
 #ifndef OBJ_MAYBE_ELF
 #define obj_ecoff_set_ext elf_ecoff_set_ext
 #ifdef ANSI_PROTOTYPES
 struct ecoff_extr;
 #endif
-extern void elf_ecoff_set_ext PARAMS ((struct symbol *, struct ecoff_extr *));
+extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
 #endif
 
 #endif /* _OBJ_ELF_H */
diff --git a/gas/config/obj-evax.h b/gas/config/obj-evax.h
index 1d9db19..745b1fe 100644
--- a/gas/config/obj-evax.h
+++ b/gas/config/obj-evax.h
@@ -1,5 +1,5 @@
 /* This file is obj-evax.h
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2000 Free Software Foundation, Inc.
    Contributed by Klaus Kämpf (kkaempf@progis.de) of
      proGIS Software, Aachen, Germany.
 
@@ -85,6 +85,8 @@
 
 #define LKP_S_K_SIZE 16
 
+#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 3
+
 /*
  * Local Variables:
  * comment-column: 0
diff --git a/gas/config/obj-multi.h b/gas/config/obj-multi.h
index fe8d98d..42b7eb3 100644
--- a/gas/config/obj-multi.h
+++ b/gas/config/obj-multi.h
@@ -1,50 +1,104 @@
-/* hi */
+/* Multiple object format emulation.
+   Copyright (C) 1995, 96, 97, 99, 2000
+   Free Software Foundation, Inc.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 later version.
+
+   GAS 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+#ifndef _OBJ_MULTI_H
+#define _OBJ_MULTI_H
+
+#ifdef OBJ_HEADER
+#include OBJ_HEADER
+#else
 
 #include "emul.h"
 #include "targ-cpu.h"
 
-#define OUTPUT_FLAVOR		(this_format->flavor)
-#define obj_frob_symbol(S,P)	(this_format->frob_symbol)(S,&(P))
-#define obj_frob_file		(this_format->frob_file)
-#define obj_frob_file_after_relocs (this_format->frob_file_after_relocs)
-#define obj_ecoff_set_ext	(this_format->ecoff_set_ext)
-#define obj_pop_insert		(this_format->pop_insert)
-#define obj_read_begin_hook()	(this_format->read_begin_hook?this_format->read_begin_hook():(void)0)
-#define obj_symbol_new_hook	(this_format->symbol_new_hook)
-#define obj_sec_sym_ok_for_reloc (this_format->sec_sym_ok_for_reloc)
-#define S_GET_SIZE		(this_format->s_get_size)
-#define S_SET_SIZE		(this_format->s_set_size)
-#define S_GET_ALIGN		(this_format->s_get_align)
-#define S_SET_ALIGN		(this_format->s_set_align)
-#define OBJ_COPY_SYMBOL_ATTRIBUTES (this_format->copy_symbol_attributes)
-#define OBJ_PROCESS_STAB	(this_format->process_stab)
+#define OUTPUT_FLAVOR					\
+	(this_format->flavor)
 
-#if defined (OBJ_MAYBE_ECOFF) || (defined (OBJ_MAYBE_ELF) && defined (TC_MIPS))
-#define ECOFF_DEBUGGING 1
-#endif
+#define obj_frob_symbol(S,P)				\
+	(*this_format->frob_symbol) (S, &(P))
 
-/* FIXME: What's the story here?  Why do we have to define
-   OBJ_SYMFIELD_TYPE both here and in obj-elf.h?  */
+#define obj_frob_file()					\
+	(this_format->frob_file				\
+	 ? (*this_format->frob_file) ()			\
+	 : (void) 0)
+
+#define obj_frob_file_after_relocs()			\
+	(this_format->frob_file_after_relocs		\
+	 ? (*this_format->frob_file_after_relocs) ()	\
+	 : (void) 0)
+
+#define obj_ecoff_set_ext				\
+	(*this_format->ecoff_set_ext)
+
+#define obj_pop_insert					\
+	(*this_format->pop_insert)
+
+#define obj_read_begin_hook()				\
+	(this_format->read_begin_hook			\
+	 ? (*this_format->read_begin_hook) ()		\
+	 : (void) 0)
+
+#define obj_symbol_new_hook(S)				\
+	(this_format->symbol_new_hook			\
+	 ? (*this_format->symbol_new_hook) (S)		\
+	 : (void) 0)
+
+#define obj_sec_sym_ok_for_reloc(A)			\
+	(this_format->sec_sym_ok_for_reloc		\
+	 ? (*this_format->sec_sym_ok_for_reloc) (A)	\
+	 : 0)
+
+#define S_GET_SIZE					\
+	(*this_format->s_get_size)
+
+#define S_SET_SIZE					\
+	(*this_format->s_set_size)
+
+#define S_GET_ALIGN					\
+	(*this_format->s_get_align)
+
+#define S_SET_ALIGN					\
+	(*this_format->s_set_align)
+
+#define S_GET_OTHER					\
+	(*this_format->s_get_other)
+
+#define S_GET_DESC					\
+	(*this_format->s_get_desc)
+
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(d,s)			\
+	(this_format->copy_symbol_attributes		\
+	 ? (*this_format->copy_symbol_attributes) (d, s) \
+	 : (void) 0)
+
+#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D)			\
+	(this_format->process_stab			\
+	 ? (*this_format->process_stab) (SEG,W,S,T,O,D)	\
+	 : (void) 0)
+
 #ifdef OBJ_MAYBE_ELF
-struct elf_obj_sy
-{
-  expressionS *size;
-  char *versioned_name;
-};
-#define OBJ_SYMFIELD_TYPE struct elf_obj_sy
-#define ELF_TARGET_SYMBOL_FIELDS int local:1;
-#else
-#define ELF_TARGET_SYMBOL_FIELDS
+/* We need OBJ_SYMFIELD_TYPE so that symbol_get_obj is defined in symbol.c
+   We also need various STAB defines for stab.c  */
+#include "obj-elf.h"
 #endif
 
-#ifdef ECOFF_DEBUGGING
-struct efdr;
-struct localsym;
-#define ECOFF_DEBUG_TARGET_SYMBOL_FIELDS struct efdr *ecoff_file; struct localsym *ecoff_symbol; valueT ecoff_extern_size;
-#else
-#define ECOFF_DEBUG_TARGET_SYMBOL_FIELDS
-#endif
-
-#define TARGET_SYMBOL_FIELDS \
-	ELF_TARGET_SYMBOL_FIELDS \
-	ECOFF_DEBUG_TARGET_SYMBOL_FIELDS
+#endif /* !OBJ_HEADER */
+#endif /* _OBJ_MULTI_H */
diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c
index 80af18f..65d4ada 100644
--- a/gas/config/obj-som.c
+++ b/gas/config/obj-som.c
@@ -26,11 +26,11 @@
 #include "aout/stab_gnu.h"
 #include "obstack.h"
 
-/* SOM does not need any pseudo-ops.  */
+static void obj_som_weak PARAMS ((int));
 
 const pseudo_typeS obj_pseudo_table[] =
 {
-  {NULL}
+  {"weak", obj_som_weak, 0}
 };
 
 static int version_seen = 0;
@@ -305,3 +305,35 @@
 {
   bfd_map_over_sections (stdoutput, adjust_stab_sections, (PTR) 0);
 }
+
+static void
+obj_som_weak (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  char *name;
+  int c;
+  symbolS *symbolP;
+ 
+  do
+    {
+      name = input_line_pointer;
+      c = get_symbol_end ();
+      symbolP = symbol_find_or_make (name);
+      *input_line_pointer = c;
+      SKIP_WHITESPACE ();
+      S_SET_WEAK (symbolP);
+#if 0
+      symbol_get_obj (symbolP)->local = 1;
+#endif
+      if (c == ',')
+        {
+          input_line_pointer++;
+          SKIP_WHITESPACE ();
+          if (*input_line_pointer == '\n')
+            c = '\n';
+        }
+    }
+  while (c == ',');
+  demand_empty_rest_of_line ();
+}
+
diff --git a/gas/config/obj-vms.h b/gas/config/obj-vms.h
index ac0c1fb..ad8fdce 100644
--- a/gas/config/obj-vms.h
+++ b/gas/config/obj-vms.h
@@ -1,5 +1,5 @@
 /* VMS object file format
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1999
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -214,18 +214,17 @@
 /* Force structure tags into scope so that their use in prototypes
    will never be their first occurance.  */
 struct fix;
-struct symbol;
 struct frag;
 
 /* obj-vms routines visible to the rest of gas.  */
 
 extern void tc_aout_fix_to_chars PARAMS ((char *,struct fix *,relax_addressT));
 
-extern int vms_resolve_symbol_redef PARAMS ((struct symbol *));
+extern int vms_resolve_symbol_redef PARAMS ((symbolS *));
 #define RESOLVE_SYMBOL_REDEFINITION(X)	vms_resolve_symbol_redef(X)
 
 /* Compiler-generated label "__vax_g_doubles" is used to augment .stabs. */
-extern void vms_check_for_special_label PARAMS ((struct symbol *));
+extern void vms_check_for_special_label PARAMS ((symbolS *));
 #define obj_frob_label(X) vms_check_for_special_label(X)
 
 extern void vms_check_for_main PARAMS ((void));
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 568617f..61dba4b 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -4,7 +4,7 @@
    Written by Alessandro Forin, based on earlier gas-1.38 target CPU files.
    Modified by Ken Raeburn for gas-2.x and ECOFF support.
    Modified by Richard Henderson for ELF support.
-   Modified by Klaus K"ampf for EVAX (openVMS/Alpha) support.
+   Modified by Klaus K"ampf for EVAX (OpenVMS/Alpha) support.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -51,6 +51,7 @@
 
 #include "as.h"
 #include "subsegs.h"
+#include "struc-symbol.h"
 #include "ecoff.h"
 
 #include "opcode/alpha.h"
@@ -64,6 +65,9 @@
 
 /* Local types */
 
+#define TOKENIZE_ERROR -1
+#define TOKENIZE_ERROR_REPORT -2
+
 #define MAX_INSN_FIXUPS 2
 #define MAX_INSN_ARGS 5
 
@@ -78,11 +82,22 @@
   unsigned insn;
   int nfixups;
   struct alpha_fixup fixups[MAX_INSN_FIXUPS];
+  unsigned sequence[MAX_INSN_FIXUPS];
 };
 
 enum alpha_macro_arg
 {
-  MACRO_EOA = 1, MACRO_IR, MACRO_PIR, MACRO_CPIR, MACRO_FPR, MACRO_EXP
+  MACRO_EOA = 1,
+  MACRO_IR,
+  MACRO_PIR,
+  MACRO_OPIR,
+  MACRO_CPIR,
+  MACRO_FPR,
+  MACRO_EXP,
+  MACRO_LITERAL,
+  MACRO_BASE,
+  MACRO_BYTOFF,
+  MACRO_JSR
 };
 
 struct alpha_macro
@@ -93,11 +108,25 @@
   enum alpha_macro_arg argsets[16];
 };
 
-/* Two extra symbols we want to see in our input.  This is a blatent
-   misuse of the expressionS.X_op field.  */
+/* Extra expression types. */
 
-#define O_pregister	(O_max+1)	/* O_register, but in parentheses */
-#define O_cpregister	(O_pregister+1)	/* + a leading comma */
+#define O_pregister	O_md1	/* O_register, in parentheses */
+#define O_cpregister	O_md2	/* + a leading comma */
+
+#ifdef RELOC_OP_P
+/* Note, the alpha_reloc_op table below depends on the ordering
+   of O_literal .. O_gprelow.  */
+#define O_literal	O_md3	/* !literal relocation */
+#define O_lituse_base	O_md4	/* !lituse_base relocation */
+#define O_lituse_bytoff	O_md5	/* !lituse_bytoff relocation */
+#define O_lituse_jsr	O_md6	/* !lituse_jsr relocation */
+#define O_gpdisp	O_md7	/* !gpdisp relocation */
+#define O_gprelhigh	O_md8	/* !gprelhigh relocation */
+#define O_gprellow	O_md9	/* !gprellow relocation */
+
+#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprellow)
+#endif
+
 
 /* Macros for extracting the type and number of encoded register tokens */
 
@@ -181,7 +210,8 @@
   PARAMS ((const char *, const expressionS *, int, int));
 
 static int load_expression
-  PARAMS ((int, const expressionS *, int *, expressionS *));
+  PARAMS ((int, const expressionS *, int *, expressionS *,
+	   const expressionS *));
 
 static void emit_ldgp PARAMS ((const expressionS *, int, const PTR));
 static void emit_division PARAMS ((const expressionS *, int, const PTR));
@@ -236,6 +266,10 @@
 #endif
 static void alpha_align PARAMS ((int, char *, symbolS *, int));
 
+#ifdef RELOC_OP_P
+static void alpha_adjust_symtab_relocs PARAMS ((bfd *, asection *, PTR));
+#endif
+
 
 /* Generic assembler global variables which must be defined by all
    targets.  */
@@ -433,6 +467,110 @@
 
 #endif
 
+#ifdef RELOC_OP_P
+/* A table to map the spelling of a relocation operand into an appropriate
+   bfd_reloc_code_real_type type.  The table is assumed to be ordered such
+   that op-O_literal indexes into it.  */
+
+#define ALPHA_RELOC_TABLE(op)						\
+&alpha_reloc_op[ ((!USER_RELOC_P (op))					\
+		  ? (abort (), 0)					\
+		  : (int)(op) - (int)O_literal) ]
+
+#define LITUSE_BASE	1
+#define LITUSE_BYTOFF	2
+#define LITUSE_JSR	3
+
+static const struct alpha_reloc_op_tag {
+  const char *name;				/* string to lookup */
+  size_t length;				/* size of the string */
+  bfd_reloc_code_real_type reloc;		/* relocation before frob */
+  operatorT op;					/* which operator to use */
+  int lituse;					/* addened to specify lituse */
+} alpha_reloc_op[] = {
+
+  {
+    "literal",					/* name */
+    sizeof ("literal")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_LITERAL,		/* reloc */
+    O_literal,					/* op */
+    0,						/* lituse */
+  },
+
+  {
+    "lituse_base",				/* name */
+    sizeof ("lituse_base")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_LITUSE_BASE,		/* reloc */
+    O_lituse_base,				/* op */
+    LITUSE_BASE,				/* lituse */
+  },
+
+  {
+    "lituse_bytoff",				/* name */
+    sizeof ("lituse_bytoff")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF,		/* reloc */
+    O_lituse_bytoff,				/* op */
+    LITUSE_BYTOFF,				/* lituse */
+  },
+
+  {
+    "lituse_jsr",				/* name */
+    sizeof ("lituse_jsr")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_LITUSE_JSR,		/* reloc */
+    O_lituse_jsr,				/* op */
+    LITUSE_JSR,					/* lituse */
+  },
+
+  {
+    "gpdisp",					/* name */
+    sizeof ("gpdisp")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_GPDISP,		/* reloc */
+    O_gpdisp,					/* op */
+    0,						/* lituse */
+  },
+
+  {
+    "gprelhigh",				/* name */
+    sizeof ("gprelhigh")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_GPRELHIGH,		/* reloc */
+    O_gprelhigh,				/* op */
+    0,						/* lituse */
+  },
+
+  {
+    "gprellow",					/* name */
+    sizeof ("gprellow")-1,			/* length */
+    BFD_RELOC_ALPHA_USER_GPRELLOW,		/* reloc */
+    O_gprellow,					/* op */
+    0,						/* lituse */
+  },
+};
+
+static const int alpha_num_reloc_op
+  = sizeof(alpha_reloc_op) / sizeof(*alpha_reloc_op);
+
+/* Maximum # digits needed to hold the largest sequence # */
+#define ALPHA_RELOC_DIGITS 25
+
+/* Whether a sequence number is valid.  */
+#define ALPHA_RELOC_SEQUENCE_OK(X) ((X) > 0 && ((unsigned)(X)) == (X))
+
+/* Structure to hold explict sequence information.  */
+struct alpha_literal_tag
+{
+  fixS *lituse;			/* head of linked list of !literals */
+  segT segment;			/* segment relocs are in or undefined_section*/
+  int multi_section_p;		/* True if more than one section was used */
+  unsigned sequence;		/* sequence # */
+  unsigned n_literals;		/* # of literals */
+  unsigned n_lituses;		/* # of lituses */
+  char string[1];		/* printable form of sequence to hash with */
+};
+
+/* Hash table to link up literals with the appropriate lituse */
+static struct hash_control *alpha_literal_hash;
+#endif
+
 /* A table of CPU names and opcode sets.  */
 
 static const struct cpu_type
@@ -466,7 +604,7 @@
   { "ev6", AXP_OPCODE_BASE|AXP_OPCODE_BWX|AXP_OPCODE_MAX|AXP_OPCODE_CIX },
 
   { "all", AXP_OPCODE_BASE },
-  { 0 }
+  { 0, 0 }
 };
 
 /* The macro table */
@@ -474,67 +612,48 @@
 static const struct alpha_macro alpha_macros[] = {
 /* Load/Store macros */
   { "lda",	emit_lda, NULL,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_LITERAL, MACRO_BASE, MACRO_EOA } },
   { "ldah",	emit_ldah, NULL,
     { MACRO_IR, MACRO_EXP, MACRO_EOA } },
 
   { "ldl",	emit_ir_load, "ldl",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldl_l",	emit_ir_load, "ldl_l",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldq",	emit_ir_load, "ldq",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_LITERAL, MACRO_EOA } },
   { "ldq_l",	emit_ir_load, "ldq_l",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldq_u",	emit_ir_load, "ldq_u",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldf",	emit_loadstore, "ldf",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldg",	emit_loadstore, "ldg",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "lds",	emit_loadstore, "lds",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldt",	emit_loadstore, "ldt",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
 
   { "ldb",	emit_ldX, (PTR)0,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldbu",	emit_ldXu, (PTR)0,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldw",	emit_ldX, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ldwu",	emit_ldXu, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
 
   { "uldw",	emit_uldX, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "uldwu",	emit_uldXu, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "uldl",	emit_uldX, (PTR)2,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "uldlu",	emit_uldXu, (PTR)2,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "uldq",	emit_uldXu, (PTR)3,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
 
   { "ldgp",	emit_ldgp, NULL,
     { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } },
@@ -559,48 +678,34 @@
 #endif
 
   { "stl",	emit_loadstore, "stl",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stl_c",	emit_loadstore, "stl_c",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stq",	emit_loadstore, "stq",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stq_c",	emit_loadstore, "stq_c",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stq_u",	emit_loadstore, "stq_u",
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stf",	emit_loadstore, "stf",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stg",	emit_loadstore, "stg",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "sts",	emit_loadstore, "sts",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stt",	emit_loadstore, "stt",
-    { MACRO_FPR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_FPR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
 
   { "stb",	emit_stX, (PTR)0,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "stw",	emit_stX, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ustw",	emit_ustX, (PTR)1,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ustl",	emit_ustX, (PTR)2,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
   { "ustq",	emit_ustX, (PTR)3,
-    { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA } },
+    { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
 
 /* Arithmetic macros */
 #if 0
@@ -663,15 +768,15 @@
       MACRO_IR, MACRO_EXP, MACRO_EOA */ } },
 
   { "jsr",	emit_jsrjmp, "jsr",
-    { MACRO_PIR, MACRO_EXP, MACRO_EOA,
-      MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA,
-      MACRO_EXP, MACRO_EOA } },
+    { MACRO_PIR, MACRO_EXP, MACRO_JSR, MACRO_EOA,
+      MACRO_PIR, MACRO_JSR, MACRO_EOA,
+      MACRO_IR,  MACRO_EXP, MACRO_JSR, MACRO_EOA,
+      MACRO_EXP, MACRO_JSR, MACRO_EOA } },
   { "jmp",	emit_jsrjmp, "jmp",
-    { MACRO_PIR, MACRO_EXP, MACRO_EOA,
-      MACRO_PIR, MACRO_EOA,
-      MACRO_IR, MACRO_EXP, MACRO_EOA,
-      MACRO_EXP, MACRO_EOA } },
+    { MACRO_PIR, MACRO_EXP, MACRO_JSR, MACRO_EOA,
+      MACRO_PIR, MACRO_JSR, MACRO_EOA,
+      MACRO_IR,  MACRO_EXP, MACRO_JSR, MACRO_EOA,
+      MACRO_EXP, MACRO_JSR, MACRO_EOA } },
   { "ret",	emit_retjcr, "ret",
     { MACRO_IR, MACRO_EXP, MACRO_EOA,
       MACRO_IR, MACRO_EOA,
@@ -695,7 +800,7 @@
       MACRO_EOA } },
 };
 
-static const int alpha_num_macros
+static const unsigned int alpha_num_macros
   = sizeof(alpha_macros) / sizeof(*alpha_macros);
 
 /* Public interface functions */
@@ -709,6 +814,13 @@
 {
   unsigned int i;
 
+  /* Verify that X_op field is wide enough.  */
+  {
+    expressionS e;
+    e.X_op = O_max;
+    assert (e.X_op == O_max);
+  }
+
   /* Create the opcode hash table */
 
   alpha_opcode_hash = hash_new ();
@@ -806,6 +918,11 @@
 #endif /* OBJ_ELF */
 
   subseg_set(text_section, 0);
+
+#ifdef RELOC_OP_P
+  /* Create literal lookup hash table.  */
+  alpha_literal_hash = hash_new();
+#endif
 }
 
 /* The public interface to the instruction assembler.  */
@@ -816,10 +933,11 @@
 {
   char opname[32];			/* current maximum is 13 */
   expressionS tok[MAX_INSN_ARGS];
-  int ntok, opnamelen, trunclen;
+  int ntok, trunclen;
+  size_t opnamelen;
 
   /* split off the opcode */
-  opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/468");
+  opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/46819");
   trunclen = (opnamelen < sizeof (opname) - 1
 	      ? opnamelen
 	      : sizeof (opname) - 1);
@@ -829,7 +947,9 @@
   /* tokenize the rest of the line */
   if ((ntok = tokenize_arguments (str + opnamelen, tok, MAX_INSN_ARGS)) < 0)
     {
-      as_bad (_("syntax error"));
+      if (ntok != TOKENIZE_ERROR_REPORT)
+	as_bad (_("syntax error"));
+
       return;
     }
 
@@ -1081,7 +1201,7 @@
 #endif
 
     do_reloc_gp:
-      fixP->fx_addsy = section_symbol (absolute_section);
+      fixP->fx_addsy = section_symbol (now_seg);
       md_number_to_chars (fixpos, value, 2);
       break;
 
@@ -1157,6 +1277,19 @@
       return 1;
 #endif
 
+#ifdef RELOC_OP_P
+    case BFD_RELOC_ALPHA_USER_LITERAL:
+    case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+    case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+    case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+      return 1;
+
+    case BFD_RELOC_ALPHA_USER_GPDISP:
+    case BFD_RELOC_ALPHA_USER_GPRELHIGH:
+    case BFD_RELOC_ALPHA_USER_GPRELLOW:
+      abort ();
+#endif
+
     default:
       {
 	const struct alpha_operand *operand;
@@ -1165,7 +1298,7 @@
 	  as_fatal (_("unhandled relocation type %s"),
 		    bfd_get_reloc_code_name (fixP->fx_r_type));
 
-	assert (-(int)fixP->fx_r_type < alpha_num_operands);
+	assert (-(int)fixP->fx_r_type < (int)alpha_num_operands);
 	operand = &alpha_operands[-(int)fixP->fx_r_type];
 
 	/* The rest of these fixups only exist internally during symbol
@@ -1173,7 +1306,7 @@
 	   Therefore they must be completely resolved as constants.  */
 
 	if (fixP->fx_addsy != 0
-	    && fixP->fx_addsy->bsym->section != absolute_section)
+	    && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section)
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
 			_("non-absolute expression in constant field"));
 
@@ -1317,6 +1450,15 @@
     case BFD_RELOC_ALPHA_LINKAGE:
     case BFD_RELOC_ALPHA_CODEADDR:
 #endif
+#ifdef RELOC_OP_P
+    case BFD_RELOC_ALPHA_USER_LITERAL:
+    case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+    case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+    case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+    case BFD_RELOC_ALPHA_USER_GPDISP:
+    case BFD_RELOC_ALPHA_USER_GPRELHIGH:
+    case BFD_RELOC_ALPHA_USER_GPRELLOW:
+#endif
       return 1;
 
     case BFD_RELOC_23_PCREL_S2:
@@ -1326,7 +1468,7 @@
       return 0;
 
     default:
-      assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < alpha_num_operands);
+      assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < (int)alpha_num_operands);
       return 0;
     }
 }
@@ -1358,6 +1500,9 @@
 #ifdef OBJ_ELF
     case BFD_RELOC_ALPHA_ELF_LITERAL:
 #endif
+#ifdef RELOC_OP_P
+    case BFD_RELOC_ALPHA_USER_LITERAL:
+#endif
 #ifdef OBJ_EVAX
     case BFD_RELOC_ALPHA_LINKAGE:
     case BFD_RELOC_ALPHA_CODEADDR:
@@ -1365,6 +1510,14 @@
       return 1;
 
     case BFD_RELOC_ALPHA_LITUSE:
+#ifdef RELOC_OP_P
+    case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+    case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+    case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+    case BFD_RELOC_ALPHA_USER_GPDISP:
+    case BFD_RELOC_ALPHA_USER_GPRELHIGH:
+    case BFD_RELOC_ALPHA_USER_GPRELLOW:
+#endif
       return 0;
 
     case BFD_RELOC_GPREL32:
@@ -1376,7 +1529,7 @@
 
     default:
       assert ((int)f->fx_r_type < 0
-	      && - (int)f->fx_r_type < alpha_num_operands);
+	      && - (int)f->fx_r_type < (int)alpha_num_operands);
       return 1;
     }
   /*NOTREACHED*/
@@ -1387,13 +1540,14 @@
 
 arelent *
 tc_gen_reloc (sec, fixp)
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
      fixS *fixp;
 {
   arelent *reloc;
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   /* Make sure none of our internal relocations make it this far.
@@ -1435,7 +1589,7 @@
        */
       if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))
 	  && !S_IS_COMMON(fixp->fx_addsy))
-	reloc->addend -= fixp->fx_addsy->bsym->value;
+	reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value;
 #endif
     }
 
@@ -1450,7 +1604,7 @@
 
 int
 tc_get_register (frame)
-     int frame;
+     int frame ATTRIBUTE_UNUSED;
 {
   int framereg = AXP_REG_SP;
 
@@ -1491,6 +1645,250 @@
 
 #endif /* OBJ_ECOFF */
 
+#ifdef RELOC_OP_P
+
+/* Before the relocations are written, reorder them, so that user supplied
+   !lituse relocations follow the appropriate !literal relocations.  Also
+   convert the gas-internal relocations to the appropriate linker relocations.
+   */
+
+void
+alpha_adjust_symtab ()
+{
+  if (alpha_literal_hash)
+    {
+#ifdef DEBUG2_ALPHA
+      fprintf (stderr, "alpha_adjust_symtab called\n");
+#endif
+
+      /* Go over each section, reordering the relocations so that all of the
+         explicit LITUSE's are adjacent to the explicit LITERAL's */
+      bfd_map_over_sections (stdoutput, alpha_adjust_symtab_relocs, (char *) 0);
+    }
+}
+
+
+/* Inner function to move LITUSE's next to the LITERAL.  */
+
+static void
+alpha_adjust_symtab_relocs (abfd, sec, ptr)
+     bfd *abfd;
+     asection *sec;
+     PTR ptr;
+{
+  segment_info_type *seginfo = seg_info (sec);
+  fixS **prevP;
+  fixS *fixp;
+  fixS *next;
+  fixS *lituse;
+  int n_lituses = 0;
+
+#ifdef DEBUG2_ALPHA
+  int n = 0;
+  int n_literals = 0;
+  int n_dup_literals = 0;
+#endif
+
+  /* If seginfo is NULL, we did not create this section; don't do anything with
+     it.  By using a pointer to a pointer, we can update the links in place.  */
+  if (seginfo == NULL)
+    return;
+
+  /* If there are no relocations, skip the section.  */
+  if (! seginfo->fix_root)
+    return;
+
+  /* First rebuild the fixup chain without the expicit lituse's.  */
+  prevP = &(seginfo->fix_root);
+  for (fixp = seginfo->fix_root; fixp; fixp = next)
+    {
+      next = fixp->fx_next;
+      fixp->fx_next = (fixS *)0;
+#ifdef DEBUG2_ALPHA
+      n++;
+#endif
+
+      switch (fixp->fx_r_type)
+	{
+	default:
+	  *prevP = fixp;
+	  prevP = &(fixp->fx_next);
+#ifdef DEBUG2_ALPHA
+	  fprintf (stderr,
+		   "alpha_adjust_symtab_relocs: 0x%lx, other relocation %s\n",
+		   (long)fixp,
+		   bfd_get_reloc_code_name (fixp->fx_r_type));
+#endif
+	  break;
+
+	case BFD_RELOC_ALPHA_USER_LITERAL:
+	  *prevP = fixp;
+	  prevP = &(fixp->fx_next);
+	  /* prevent assembler from trying to adjust the offset */
+#ifdef DEBUG2_ALPHA
+	  n_literals++;
+	  if (fixp->tc_fix_data.info->n_literals != 1)
+	    n_dup_literals++;
+	  fprintf (stderr,
+		   "alpha_adjust_symtab_relocs: 0x%lx, !literal!%.6d, # literals = %2d\n",
+		   (long)fixp,
+		   fixp->tc_fix_data.info->sequence,
+		   fixp->tc_fix_data.info->n_literals);
+#endif
+	  break;
+
+	  /* do not link in lituse's */
+	case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+	case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+	case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+	  n_lituses++;
+	  if (fixp->tc_fix_data.info->n_literals == 0)
+	    as_bad_where (fixp->fx_file, fixp->fx_line,
+			  _("No !literal!%d was found"),
+			  fixp->tc_fix_data.info->sequence);
+#ifdef DEBUG2_ALPHA
+	  fprintf (stderr,
+		   "alpha_adjust_symtab_relocs: 0x%lx, !lituse !%.6d, # lituses  = %2d, next_lituse = 0x%lx\n",
+		   (long)fixp,
+		   fixp->tc_fix_data.info->sequence,
+		   fixp->tc_fix_data.info->n_lituses,
+		   (long)fixp->tc_fix_data.next_lituse);
+#endif
+	  break;
+	}
+    }
+
+  /* If there were any lituses, go and add them to the chain, unless there is
+     more than one !literal for a given sequence number.  They are linked
+     through the next_lituse field in reverse order, so as we go through the
+     next_lituse chain, we effectively reverse the chain once again.  If there
+     was more than one !literal, we fall back to loading up the address w/o
+     optimization.  Also, if the !literals/!lituses are spread in different
+     segments (happens in the Linux kernel semaphores), suppress the
+     optimization.  */
+  if (n_lituses)
+    {
+      for (fixp = seginfo->fix_root; fixp; fixp = fixp->fx_next)
+	{
+	  switch (fixp->fx_r_type)
+	    {
+	    default:
+	      break;
+
+	    case BFD_RELOC_ALPHA_USER_LITERAL:
+#ifdef OBJ_ELF
+	      fixp->fx_r_type = BFD_RELOC_ALPHA_ELF_LITERAL;
+#else
+	      fixp->fx_r_type = BFD_RELOC_ALPHA_LITERAL;	/* XXX check this */
+#endif
+	      if (fixp->tc_fix_data.info->n_literals == 1
+		  && ! fixp->tc_fix_data.info->multi_section_p)
+		{
+		  for (lituse = fixp->tc_fix_data.info->lituse;
+		       lituse != (fixS *)0;
+		       lituse = lituse->tc_fix_data.next_lituse)
+		    {
+		      lituse->fx_next = fixp->fx_next;
+		      fixp->fx_next = lituse;
+		    }
+		}
+	      break;
+
+	    case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+	    case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+	    case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+	      fixp->fx_r_type = BFD_RELOC_ALPHA_LITUSE;
+	      break;
+	    }
+	}
+    }
+
+#ifdef DEBUG2_ALPHA
+  fprintf (stderr, "alpha_adjust_symtab_relocs: %s, %d literal%s, %d duplicate literal%s, %d lituse%s\n\n",
+	   sec->name,
+	   n_literals, (n_literals == 1) ? "" : "s",
+	   n_dup_literals, (n_dup_literals == 1) ? "" : "s",
+	   n_lituses, (n_lituses == 1) ? "" : "s");
+#endif
+}
+
+#endif /* RELOC_OP_P */
+
+
+#ifdef DEBUG_ALPHA
+static void
+debug_exp (tok, ntok)
+     expressionS tok[];
+     int ntok;
+{
+  int i;
+
+  fprintf (stderr, "debug_exp: %d tokens", ntok);
+  for (i = 0; i < ntok; i++)
+    {
+      expressionS *t = &tok[i];
+      const char *name;
+      switch (t->X_op)
+	{
+	default:			name = "unknown";		break;
+	case O_illegal:			name = "O_illegal";		break;
+	case O_absent:			name = "O_absent";		break;
+	case O_constant:		name = "O_constant";		break;
+	case O_symbol:			name = "O_symbol";		break;
+	case O_symbol_rva:		name = "O_symbol_rva";		break;
+	case O_register:		name = "O_register";		break;
+	case O_big:			name = "O_big";			break;
+	case O_uminus:			name = "O_uminus";		break;
+	case O_bit_not:			name = "O_bit_not";		break;
+	case O_logical_not:		name = "O_logical_not";		break;
+	case O_multiply:		name = "O_multiply";		break;
+	case O_divide:			name = "O_divide";		break;
+	case O_modulus:			name = "O_modulus";		break;
+	case O_left_shift:		name = "O_left_shift";		break;
+	case O_right_shift:		name = "O_right_shift";		break;
+	case O_bit_inclusive_or:	name = "O_bit_inclusive_or";	break;
+	case O_bit_or_not:		name = "O_bit_or_not";		break;
+	case O_bit_exclusive_or:	name = "O_bit_exclusive_or";	break;
+	case O_bit_and:			name = "O_bit_and";		break;
+	case O_add:			name = "O_add";			break;
+	case O_subtract:		name = "O_subtract";		break;
+	case O_eq:			name = "O_eq";			break;
+	case O_ne:			name = "O_ne";			break;
+	case O_lt:			name = "O_lt";			break;
+	case O_le:			name = "O_le";			break;
+	case O_ge:			name = "O_ge";			break;
+	case O_gt:			name = "O_gt";			break;
+	case O_logical_and:		name = "O_logical_and";		break;
+	case O_logical_or:		name = "O_logical_or";		break;
+	case O_index:			name = "O_index";		break;
+	case O_pregister:		name = "O_pregister";		break;
+	case O_cpregister:		name = "O_cpregister";		break;
+	case O_literal:			name = "O_literal";		break;
+	case O_lituse_base:		name = "O_lituse_base";		break;
+	case O_lituse_bytoff:		name = "O_lituse_bytoff";	break;
+	case O_lituse_jsr:		name = "O_lituse_jsr";		break;
+	case O_gpdisp:			name = "O_gpdisp";		break;
+	case O_gprelhigh:		name = "O_gprelhigh";		break;
+	case O_gprellow:		name = "O_gprellow";		break;
+	case O_md10:			name = "O_md10";		break;
+	case O_md11:			name = "O_md11";		break;
+	case O_md12:			name = "O_md12";		break;
+	case O_md13:			name = "O_md13";		break;
+	case O_md14:			name = "O_md14";		break;
+	case O_md15:			name = "O_md15";		break;
+	case O_md16:			name = "O_md16";		break;
+	}
+
+      fprintf (stderr, ", %s(%s, %s, %d)", name,
+	       (t->X_add_symbol) ? S_GET_NAME (t->X_add_symbol) : "--",
+	       (t->X_op_symbol) ? S_GET_NAME (t->X_op_symbol) : "--",
+	       (int)t->X_add_number);
+    }
+  fprintf (stderr, "\n");
+  fflush (stderr);
+}
+#endif
+
 /* Parse the arguments to an opcode.  */
 
 static int
@@ -1502,6 +1900,16 @@
   expressionS *end_tok = tok + ntok;
   char *old_input_line_pointer;
   int saw_comma = 0, saw_arg = 0;
+#ifdef DEBUG_ALPHA
+  expressionS *orig_tok = tok;
+#endif
+#ifdef RELOC_OP_P
+  char *p;
+  const struct alpha_reloc_op_tag *r;
+  int c, i;
+  size_t len;
+  int reloc_found_p = 0;
+#endif
 
   memset (tok, 0, sizeof (*tok) * ntok);
 
@@ -1517,6 +1925,72 @@
 	case '\0':
 	  goto fini;
 
+#ifdef RELOC_OP_P
+	case '!':
+	  /* A relocation operand can be placed after the normal operand on an
+	     assembly language statement, and has the following form:
+		!relocation_type!sequence_number.  */
+	  if (reloc_found_p)
+	    {			/* only support one relocation op per insn */
+	      as_bad (_("More than one relocation op per insn"));
+	      goto err_report;
+	    }
+
+	  if (!saw_arg)
+	    goto err;
+
+	  for (p = ++input_line_pointer;
+	       ((c = *p) != '!' && c != ';' && c != '#' && c != ','
+		&& !is_end_of_line[c]);
+	       p++)
+	    ;
+
+	  /* Parse !relocation_type */
+	  len = p - input_line_pointer;
+	  if (len == 0)
+	    {
+	      as_bad (_("No relocation operand"));
+	      goto err_report;
+	    }
+
+	  if (c != '!')
+	    {
+	      as_bad (_("No !sequence-number after !%s"), input_line_pointer);
+	      goto err_report;
+	    }
+
+	  r = &alpha_reloc_op[0];
+	  for (i = alpha_num_reloc_op-1; i >= 0; i--, r++)
+	    {
+	      if (len == r->length
+		  && memcmp (input_line_pointer, r->name, len) == 0)
+		break;
+	    }
+	  if (i < 0)
+	    {
+	      as_bad (_("Unknown relocation operand: !%s"), input_line_pointer);
+	      goto err_report;
+	    }
+
+	  input_line_pointer = ++p;
+
+	  /* Parse !sequence_number */
+	  memset (tok, '\0', sizeof (expressionS));
+	  expression (tok);
+
+	  if (tok->X_op != O_constant
+	      || ! ALPHA_RELOC_SEQUENCE_OK (tok->X_add_number))
+	    {
+	      as_bad (_("Bad sequence number: !%s!%s"), r->name, input_line_pointer);
+	      goto err_report;
+	    }
+
+	  tok->X_op = r->op;
+	  reloc_found_p = 1;
+	  ++tok;
+	  break;
+#endif
+
 	case ',':
 	  ++input_line_pointer;
 	  if (saw_comma || !saw_arg)
@@ -1547,6 +2021,7 @@
 	default:
 	  if (saw_arg && !saw_comma)
 	    goto err;
+
 	  expression (tok);
 	  if (tok->X_op == O_illegal || tok->X_op == O_absent)
 	    goto err;
@@ -1562,11 +2037,22 @@
   if (saw_comma)
     goto err;
   input_line_pointer = old_input_line_pointer;
+
+#ifdef DEBUG_ALPHA
+  debug_exp (orig_tok, ntok - (end_tok - tok));
+#endif
+
   return ntok - (end_tok - tok);
 
 err:
   input_line_pointer = old_input_line_pointer;
-  return -1;
+  return TOKENIZE_ERROR;
+
+#ifdef RELOC_OP_P
+err_report:
+  input_line_pointer = old_input_line_pointer;
+  return TOKENIZE_ERROR_REPORT;
+#endif
 }
 
 /* Search forward through all variants of an opcode looking for a
@@ -1704,24 +2190,38 @@
 		tokidx = 0;
 	      break;
 
+	      /* index register */
 	    case MACRO_IR:
 	      if (tokidx >= ntok || tok[tokidx].X_op != O_register
 		  || !is_ir_num(tok[tokidx].X_add_number))
 		goto match_failed;
 	      ++tokidx;
 	      break;
+
+	      /* parenthesized index register */
 	    case MACRO_PIR:
 	      if (tokidx >= ntok || tok[tokidx].X_op != O_pregister
 		  || !is_ir_num(tok[tokidx].X_add_number))
 		goto match_failed;
 	      ++tokidx;
 	      break;
+
+	      /* optional parenthesized index register */
+	    case MACRO_OPIR:
+	      if (tokidx < ntok && tok[tokidx].X_op == O_pregister
+		  && is_ir_num(tok[tokidx].X_add_number))
+		++tokidx;
+	      break;
+
+	      /* leading comma with a parenthesized index register */
 	    case MACRO_CPIR:
 	      if (tokidx >= ntok || tok[tokidx].X_op != O_cpregister
 		  || !is_ir_num(tok[tokidx].X_add_number))
 		goto match_failed;
 	      ++tokidx;
 	      break;
+
+	      /* floating point register */
 	    case MACRO_FPR:
 	      if (tokidx >= ntok || tok[tokidx].X_op != O_register
 		  || !is_fpr_num(tok[tokidx].X_add_number))
@@ -1729,6 +2229,7 @@
 	      ++tokidx;
 	      break;
 
+	      /* normal expression */
 	    case MACRO_EXP:
 	      if (tokidx >= ntok)
 		goto match_failed;
@@ -1739,6 +2240,15 @@
 		case O_register:
 		case O_pregister:
 		case O_cpregister:
+#ifdef RELOC_OP_P
+		case O_literal:
+		case O_lituse_base:
+		case O_lituse_bytoff:
+		case O_lituse_jsr:
+		case O_gpdisp:
+		case O_gprelhigh:
+		case O_gprellow:
+#endif
 		  goto match_failed;
 
 		default:
@@ -1747,6 +2257,38 @@
 	      ++tokidx;
 	      break;
 
+	      /* optional !literal!<number> */
+	    case MACRO_LITERAL:
+#ifdef RELOC_OP_P
+	      if (tokidx < ntok && tok[tokidx].X_op == O_literal)
+		tokidx++;
+#endif
+	      break;
+
+	      /* optional !lituse_base!<number> */
+	    case MACRO_BASE:
+#ifdef RELOC_OP_P
+	      if (tokidx < ntok && tok[tokidx].X_op == O_lituse_base)
+		tokidx++;
+#endif
+	      break;
+
+	      /* optional !lituse_bytoff!<number> */
+	    case MACRO_BYTOFF:
+#ifdef RELOC_OP_P
+	      if (tokidx < ntok && tok[tokidx].X_op == O_lituse_bytoff)
+		tokidx++;
+#endif
+	      break;
+
+	      /* optional !lituse_jsr!<number> */
+	    case MACRO_JSR:
+#ifdef RELOC_OP_P
+	      if (tokidx < ntok && tok[tokidx].X_op == O_lituse_jsr)
+		tokidx++;
+#endif
+	      break;
+
 	    match_failed:
 	      while (*arg != MACRO_EOA)
 		++arg;
@@ -1837,7 +2379,7 @@
   for (argidx = opcode->operands; *argidx; ++argidx)
     {
       const struct alpha_operand *operand = &alpha_operands[*argidx];
-      const expressionS *t;
+      const expressionS *t = (const expressionS *)0;
 
       if (operand->flags & AXP_OPERAND_FAKE)
 	{
@@ -1858,8 +2400,10 @@
 	      break;
 	    case AXP_OPERAND_DEFAULT_ZERO:
 	      {
-		static const expressionS zero_exp = { 0, 0, 0, O_constant, 1 };
+		static expressionS zero_exp;
 		t = &zero_exp;
+		zero_exp.X_op = O_constant;
+		zero_exp.X_unsigned = 1;
 	      }
 	      break;
 	    default:
@@ -1926,10 +2470,14 @@
   /* Apply the fixups in order */
   for (i = 0; i < insn->nfixups; ++i)
     {
-      const struct alpha_operand *operand;
+      const struct alpha_operand *operand = (const struct alpha_operand *)0;
       struct alpha_fixup *fixup = &insn->fixups[i];
       int size, pcrel;
       fixS *fixP;
+#ifdef RELOC_OP_P
+      char buffer[ALPHA_RELOC_DIGITS];
+      struct alpha_literal_tag *info;
+#endif
 
       /* Some fixups are only used internally and so have no howto */
       if ((int)fixup->reloc < 0)
@@ -1938,29 +2486,48 @@
 	  size = 4;
 	  pcrel = ((operand->flags & AXP_OPERAND_RELATIVE) != 0);
 	}
+      else switch (fixup->reloc)
+	{
 #ifdef OBJ_ELF
-      /* These relocation types are only used internally. */
-      else if (fixup->reloc == BFD_RELOC_ALPHA_GPDISP_HI16
-	       || fixup->reloc == BFD_RELOC_ALPHA_GPDISP_LO16)
-	{
-	  size = 2, pcrel = 0;
-	}
+	  /* These relocation types are only used internally. */
+	case BFD_RELOC_ALPHA_GPDISP_HI16:
+	case BFD_RELOC_ALPHA_GPDISP_LO16:
+	  size = 2;
+	  pcrel = 0;
+	  break;
 #endif
-      else
-	{
-	  reloc_howto_type *reloc_howto
-	    = bfd_reloc_type_lookup (stdoutput, fixup->reloc);
-	  assert (reloc_howto);
+#ifdef RELOC_OP_P
+	  /* and these also are internal only relocations */
+	case BFD_RELOC_ALPHA_USER_LITERAL:
+	case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+	case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+	case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+	case BFD_RELOC_ALPHA_USER_GPDISP:
+	case BFD_RELOC_ALPHA_USER_GPRELHIGH:
+	case BFD_RELOC_ALPHA_USER_GPRELLOW:
+	  size = 2;
+	  pcrel = 0;
+	  break;
+#endif
 
-	  size = bfd_get_reloc_size (reloc_howto);
-	  pcrel = reloc_howto->pc_relative;
+	default:
+	  {
+	    reloc_howto_type *reloc_howto
+	      = bfd_reloc_type_lookup (stdoutput, fixup->reloc);
+	    assert (reloc_howto);
+
+	    size = bfd_get_reloc_size (reloc_howto);
+	    pcrel = reloc_howto->pc_relative;
+	  }
+	  assert (size >= 1 && size <= 4);
+	  break;
 	}
-      assert (size >= 1 && size <= 4);
 
       fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
 			  &fixup->exp, pcrel, fixup->reloc);
 
-      /* Turn off complaints that the addend is too large for some fixups */
+      /* Turn off complaints that the addend is too large for some fixups,
+         and copy in the sequence number for the explicit relocations.  */
       switch (fixup->reloc)
 	{
 	case BFD_RELOC_ALPHA_GPDISP_LO16:
@@ -1974,6 +2541,69 @@
 	  fixP->fx_no_overflow = 1;
 	  break;
 
+#ifdef RELOC_OP_P
+	case BFD_RELOC_ALPHA_USER_LITERAL:
+	  fixP->fx_no_overflow = 1;
+	  sprintf (buffer, "!%u", insn->sequence[i]);
+	  info = ((struct alpha_literal_tag *)
+		  hash_find (alpha_literal_hash, buffer));
+
+	  if (! info)
+	    {
+	      size_t len = strlen (buffer);
+	      const char *errmsg;
+
+	      info = ((struct alpha_literal_tag *)
+		      xcalloc (sizeof (struct alpha_literal_tag) + len, 1));
+
+	      info->segment = now_seg;
+	      info->sequence = insn->sequence[i];
+	      strcpy (info->string, buffer);
+	      errmsg = hash_insert (alpha_literal_hash, info->string, (PTR)info);
+	      if (errmsg)
+		as_bad (errmsg);
+	    }
+
+	  ++info->n_literals;
+
+	  if (info->segment != now_seg)
+	    info->multi_section_p = 1;
+
+	  fixP->tc_fix_data.info = info;
+	  break;
+
+	case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+	case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+	case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+	  sprintf (buffer, "!%u", insn->sequence[i]);
+	  info = ((struct alpha_literal_tag *)
+		  hash_find (alpha_literal_hash, buffer));
+
+	  if (! info)
+	    {
+	      size_t len = strlen (buffer);
+	      const char *errmsg;
+
+	      info = ((struct alpha_literal_tag *)
+		      xcalloc (sizeof (struct alpha_literal_tag) + len, 1));
+
+	      info->segment = now_seg;
+	      info->sequence = insn->sequence[i];
+	      strcpy (info->string, buffer);
+	      errmsg = hash_insert (alpha_literal_hash, info->string, (PTR)info);
+	      if (errmsg)
+		as_bad (errmsg);
+	    }
+	  info->n_lituses++;
+	  fixP->tc_fix_data.info = info;
+	  fixP->tc_fix_data.next_lituse = info->lituse;
+	  info->lituse = fixP;
+	  if (info->segment != now_seg)
+	    info->multi_section_p = 1;
+
+	  break;
+#endif
+
 	default:
 	  if ((int)fixup->reloc < 0)
 	    {
@@ -2053,6 +2683,17 @@
 	}
     }
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, opname);
+      ntok--;
+    }
+#endif
+
   /* search opcodes */
   opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname);
   if (opcode)
@@ -2096,8 +2737,8 @@
 static void
 emit_ldgp (tok, ntok, unused)
      const expressionS *tok;
-     int ntok;
-     const PTR unused;
+     int ntok ATTRIBUTE_UNUSED;
+     const PTR unused ATTRIBUTE_UNUSED;
 {
 #ifdef OBJ_AOUT
 FIXME
@@ -2109,8 +2750,16 @@
   expressionS newtok[3];
   expressionS addend;
 
-  /* We're going to need this symbol in md_apply_fix().  */
-  (void) section_symbol (absolute_section);
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, "ldgp");
+      ntok--;
+    }
+#endif
 
 #ifdef OBJ_ECOFF
   if (regno (tok[2].X_add_number) == AXP_REG_PV)
@@ -2175,7 +2824,7 @@
   segment_info_type *seginfo = seg_info (alpha_link_section);
   fixS *fixp;
 
-  offset = -basesym->sy_obj;
+  offset = - *symbol_get_obj (basesym);
 
   /* @@ This assumes all entries in a given section will be of the same
      size...  Probably correct, but unwise to rely on.  */
@@ -2225,15 +2874,19 @@
    i.e. "ldq $targ, LIT($gp); addq $targ, $0, $targ".  Odd, perhaps,
    but this is what OSF/1 does.
 
+   If explicit relocations of the form !literal!<number> are allowed,
+   and used, then explict_reloc with be an expression pointer.
+
    Finally, the return value is true if the calling macro may emit a
    LITUSE reloc if otherwise appropriate.  */
 
 static int
-load_expression (targreg, exp, pbasereg, poffset)
+load_expression (targreg, exp, pbasereg, poffset, explicit_reloc)
      int targreg;
      const expressionS *exp;
      int *pbasereg;
      expressionS *poffset;
+     const expressionS *explicit_reloc;
 {
   int emit_lituse = 0;
   offsetT addend = exp->X_add_number;
@@ -2285,6 +2938,7 @@
 
 	assemble_tokens_to_insn ("ldq", newtok, 3, &insn);
 
+	assert (explicit_reloc == (const expressionS *)0);
 	assert (insn.nfixups == 1);
 	insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL;
 #endif /* OBJ_ECOFF */
@@ -2322,13 +2976,25 @@
 	assemble_tokens_to_insn ("ldq", newtok, 3, &insn);
 
 	assert (insn.nfixups == 1);
-	insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL;
+	if (!explicit_reloc)
+	  insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL;
+	else
+	  {
+#ifdef RELOC_OP_P
+	    insn.fixups[0].reloc
+	      = (ALPHA_RELOC_TABLE (explicit_reloc->X_op))->reloc;
+	    insn.sequence[0] = explicit_reloc->X_add_number;
+#else
+	    abort ();
+#endif
+	  }
 #endif /* OBJ_ELF */
 #ifdef OBJ_EVAX
 	offsetT link;
 
 	/* Find symbol or symbol pointer in link section.  */
 
+	assert (explicit_reloc == (const expressionS *)0);
 	if (exp->X_add_symbol == alpha_evax_proc.symbol)
 	  {
 	    if (range_signed_16 (addend))
@@ -2387,12 +3053,14 @@
       break;
 
     case O_constant:
+      assert (explicit_reloc == (const expressionS *)0);
       break;
 
     case O_subtract:
       /* Assume that this difference expression will be resolved to an
 	 absolute value and that that value will fit in 16 bits. */
 
+      assert (explicit_reloc == (const expressionS *)0);
       set_tok_reg (newtok[0], targreg);
       newtok[1] = *exp;
       set_tok_preg (newtok[2], basereg);
@@ -2498,8 +3166,9 @@
 	}
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
-      insn.fixups[0].exp.X_op = O_constant;
-      insn.fixups[0].exp.X_add_number = 1;
+      insn.fixups[0].exp.X_op = O_symbol;
+      insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[0].exp.X_add_number = LITUSE_BASE;
       emit_lituse = 0;
 
       emit_insn (&insn);
@@ -2579,19 +3248,66 @@
    large constants.  */
 
 static void
-emit_lda (tok, ntok, unused)
+emit_lda (tok, ntok, opname)
      const expressionS *tok;
      int ntok;
-     const PTR unused;
+     const PTR opname;
 {
   int basereg;
+  const expressionS *reloc = (const expressionS *)0;
+
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const struct alpha_reloc_op_tag *r;
+
+      reloc = &tok[ntok-1];
+      r = ALPHA_RELOC_TABLE (reloc->X_op);
+      switch (reloc->X_op)
+	{
+	default:
+	  as_bad (_("Cannot use !%s!%d with %s"), r->name,
+		  (int)reloc->X_add_number, (const char *)opname);
+
+	  reloc = (const expressionS *)0;
+	  ntok--;
+	  break;
+
+	case O_literal:
+	  ntok--;
+	  break;
+
+	  /* For lda $x,0($x)!lituse_base!y, don't use load_expression, since
+	     it is really too general for our needs.  Instead just generate the
+	     lda directly.  */
+	case O_lituse_base:
+	  if (ntok != 4
+	      || tok[0].X_op != O_register
+	      || !is_ir_num(tok[0].X_add_number)
+	      || tok[1].X_op != O_constant
+	      || tok[2].X_op != O_pregister
+	      || !is_ir_num(tok[2].X_add_number))
+	    {
+	      as_bad (_("bad instruction format for lda !%s!%d"), r->name,
+		      reloc->X_add_number);
+
+	      reloc = (const expressionS *)0;
+	      ntok--;
+	      break;
+	    }
+
+	  emit_loadstore (tok, ntok, "lda");
+	  return;
+	}
+    }
+#endif
 
   if (ntok == 2)
     basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register);
   else
     basereg = tok[2].X_add_number;
 
-  (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL);
+  (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL, reloc);
 }
 
 /* The ldah macro differs from the ldah instruction in that it has $31
@@ -2600,11 +3316,22 @@
 static void
 emit_ldah (tok, ntok, unused)
      const expressionS *tok;
-     int ntok;
-     const PTR unused;
+     int ntok ATTRIBUTE_UNUSED;
+     const PTR unused ATTRIBUTE_UNUSED;
 {
   expressionS newtok[3];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, "ldah");
+      ntok--;
+    }
+#endif
+
   newtok[0] = tok[0];
   newtok[1] = tok[1];
   set_tok_preg (newtok[2], AXP_REG_ZERO);
@@ -2626,19 +3353,66 @@
   expressionS newtok[3];
   struct alpha_insn insn;
 
+#ifdef RELOC_OP_P
+  const expressionS *reloc = (const expressionS *)0;
+
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const struct alpha_reloc_op_tag *r;
+
+      reloc = &tok[ntok-1];
+      switch (reloc->X_op)
+	{
+	case O_lituse_base:
+	  ntok--;
+	  break;
+
+	case O_literal:
+	  if (strcmp ((const char *)opname, "ldq") == 0)
+	    {
+	      emit_lda (tok, ntok, opname);
+	      return;
+	    }
+
+	  /* fall through */
+	default:
+	  ntok--;
+	  r = ALPHA_RELOC_TABLE (reloc->X_op);
+	  as_bad (_("Cannot use !%s!%d with %s"), r->name,
+		  (int)reloc->X_add_number, (const char *)opname);
+	}
+    }
+#endif
+
   if (ntok == 2)
     basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register);
   else
     basereg = tok[2].X_add_number;
 
   lituse = load_expression (tok[0].X_add_number, &tok[1], &basereg,
-			    &newtok[1]);
+			    &newtok[1], (const expressionS *)0);
 
   newtok[0] = tok[0];
   set_tok_preg (newtok[2], basereg);
 
   assemble_tokens_to_insn ((const char *)opname, newtok, 3, &insn);
 
+#ifdef RELOC_OP_P
+  if (reloc)
+    {
+      int nfixups = insn.nfixups;
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc->X_op);
+
+      assert (nfixups < MAX_INSN_FIXUPS);
+      insn.fixups[nfixups].reloc = r->reloc;
+      insn.fixups[nfixups].exp.X_op = O_symbol;
+      insn.fixups[nfixups].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[nfixups].exp.X_add_number = r->lituse;
+      insn.sequence[nfixups] = reloc->X_add_number;
+      insn.nfixups++;
+    }
+#endif
+
   if (lituse)
     {
       assert (insn.nfixups < MAX_INSN_FIXUPS);
@@ -2649,8 +3423,9 @@
 	}
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
-      insn.fixups[0].exp.X_op = O_constant;
-      insn.fixups[0].exp.X_add_number = 1;
+      insn.fixups[0].exp.X_op = O_symbol;
+      insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[0].exp.X_add_number = LITUSE_BASE;
     }
 
   emit_insn (&insn);
@@ -2669,6 +3444,21 @@
   expressionS newtok[3];
   struct alpha_insn insn;
 
+#ifdef RELOC_OP_P
+  const expressionS *reloc = (const expressionS *)0;
+
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      reloc = &tok[--ntok];
+      if (reloc->X_op != O_lituse_base)
+	{
+	  const struct alpha_reloc_op_tag *r = &alpha_reloc_op[ reloc->X_md ];
+	  as_bad (_("Cannot use !%s!%d with %s"), r->name,
+		  (int)reloc->X_add_number, (const char *)opname);
+	}
+    }
+#endif
+
   if (ntok == 2)
     basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register);
   else
@@ -2679,7 +3469,8 @@
       if (alpha_noat_on)
 	as_bad (_("macro requires $at register while noat in effect"));
 
-      lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1]);
+      lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1],
+				(const expressionS *)0);
     }
   else
     {
@@ -2692,6 +3483,22 @@
 
   assemble_tokens_to_insn ((const char *)opname, newtok, 3, &insn);
 
+#ifdef RELOC_OP_P
+  if (reloc)
+    {
+      int nfixups = insn.nfixups;
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc->X_op);
+
+      assert (nfixups < MAX_INSN_FIXUPS);
+      insn.fixups[nfixups].reloc = r->reloc;
+      insn.fixups[nfixups].exp.X_op = O_symbol;
+      insn.fixups[nfixups].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[nfixups].exp.X_add_number = r->lituse;
+      insn.sequence[nfixups] = reloc->X_add_number;
+      insn.nfixups++;
+    }
+#endif
+
   if (lituse)
     {
       assert (insn.nfixups < MAX_INSN_FIXUPS);
@@ -2702,8 +3509,9 @@
 	}
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
-      insn.fixups[0].exp.X_op = O_constant;
-      insn.fixups[0].exp.X_add_number = 1;
+      insn.fixups[0].exp.X_op = O_symbol;
+      insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[0].exp.X_add_number = LITUSE_BASE;
     }
 
   emit_insn (&insn);
@@ -2723,6 +3531,19 @@
     {
       expressionS newtok[3];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+	{
+	  const expressionS *reloc_exp = &tok[ntok-1];
+	  const struct alpha_reloc_op_tag *r
+	    = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+
+	  as_bad (_("Cannot use !%s!%d with %s"), r->name,
+		  (int)reloc_exp->X_add_number, "ldbu/ldwu");
+	  ntok--;
+	}
+#endif
+
       if (alpha_noat_on)
 	as_bad (_("macro requires $at register while noat in effect"));
 
@@ -2834,10 +3655,21 @@
 emit_ldil (tok, ntok, unused)
      const expressionS *tok;
      int ntok;
-     const PTR unused;
+     const PTR unused ATTRIBUTE_UNUSED;
 {
   expressionS newtok[2];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, "ldil");
+      ntok--;
+    }
+#endif
+
   memcpy (newtok, tok, sizeof(newtok));
   newtok[1].X_add_number = sign_extend_32 (tok[1].X_add_number);
 
@@ -3002,6 +3834,19 @@
       int bitshift = 64 - 8 * (1 << lgsize);
       expressionS newtok[3];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+	{
+	  const expressionS *reloc_exp = &tok[ntok-1];
+	  const struct alpha_reloc_op_tag *r
+	    = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+
+	  as_bad (_("Cannot use !%s!%d with %s"), r->name,
+		  (int)reloc_exp->X_add_number, "setxt");
+	  ntok--;
+	}
+#endif
+
       /* emit "sll src,bits,dst" */
 
       newtok[0] = tok[0];
@@ -3048,6 +3893,17 @@
   symbolS *sym;
   expressionS newtok[3];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, (char char *)symname);
+      ntok--;
+    }
+#endif
+
   xr = regno (tok[0].X_add_number);
   yr = regno (tok[1].X_add_number);
 
@@ -3147,6 +4003,17 @@
   symbolS *sym;
   expressionS newtok[3];
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, (const char *)symname);
+      ntok--;
+    }
+#endif
+
   xr = regno (tok[0].X_add_number);
   yr = regno (tok[1].X_add_number);
 
@@ -3243,6 +4110,17 @@
   expressionS newtok[3];
   int r, tokidx = 0, lituse = 0;
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, opname);
+      ntok--;
+    }
+#endif
+
   if (tokidx < ntok && tok[tokidx].X_op == O_register)
     r = regno (tok[tokidx++].X_add_number);
   else
@@ -3259,7 +4137,8 @@
   else
     {
       int basereg = alpha_gp_register;
-      lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL);
+      lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL,
+				(const expressionS *)0);
     }
 #endif
 
@@ -3287,8 +4166,9 @@
 	}
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
-      insn.fixups[0].exp.X_op = O_constant;
-      insn.fixups[0].exp.X_add_number = 3;
+      insn.fixups[0].exp.X_op = O_symbol;
+      insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg);
+      insn.fixups[0].exp.X_add_number = LITUSE_JSR;
     }
 
   emit_insn (&insn);
@@ -3307,6 +4187,17 @@
   expressionS newtok[3];
   int r, tokidx = 0;
 
+#ifdef RELOC_OP_P
+  if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+    {
+      const expressionS *reloc_exp = &tok[ntok-1];
+      const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
+      as_bad (_("Cannot use !%s!%d with %s"), r->name,
+	      (int)reloc_exp->X_add_number, opname);
+      ntok--;
+    }
+#endif
+
   if (tokidx < ntok && tok[tokidx].X_op == O_register)
     r = regno (tok[tokidx++].X_add_number);
   else
@@ -3457,7 +4348,7 @@
       p = frag_more (temp);
       new_seg->flags |= SEC_IS_COMMON;
       if (! S_IS_DEFINED (symbolP))
-	symbolP->bsym->section = new_seg;
+	S_SET_SEGMENT (symbolP, new_seg);
 #else
       S_SET_VALUE (symbolP, (valueT) temp);
 #endif
@@ -3468,7 +4359,7 @@
   subseg_set (current_section, current_subsec);
 #endif
 
-  know (symbolP->sy_frag == &zero_address_frag);
+  know (symbol_get_frag (symbolP) == &zero_address_frag);
 
   demand_empty_rest_of_line ();
 }
@@ -3534,7 +4425,7 @@
 
 static void
 s_alpha_ent (dummy)
-     int dummy;
+     int dummy ATTRIBUTE_UNUSED;
 {
   if (ECOFF_DEBUGGING)
     ecoff_directive_ent (0);
@@ -3557,7 +4448,7 @@
 	    as_warn (_("nested .ent directives"));
 
 	  sym = symbol_find_or_make (name);
-	  sym->bsym->flags |= BSF_FUNCTION;
+	  symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
 	  alpha_cur_ent_sym = sym;
 
 	  /* The .ent directive is sometimes followed by a number.  Not sure
@@ -3578,7 +4469,7 @@
 
 static void
 s_alpha_end (dummy)
-     int dummy;
+     int dummy ATTRIBUTE_UNUSED;
 {
   if (ECOFF_DEBUGGING)
     ecoff_directive_end (0);
@@ -3604,12 +4495,13 @@
 	  /* Create an expression to calculate the size of the function.  */
 	  if (sym)
 	    {
-	      sym->sy_obj.size = (expressionS *) xmalloc (sizeof (expressionS));
-	      sym->sy_obj.size->X_op = O_subtract;
-	      sym->sy_obj.size->X_add_symbol
+	      symbol_get_obj (sym)->size =
+		(expressionS *) xmalloc (sizeof (expressionS));
+	      symbol_get_obj (sym)->size->X_op = O_subtract;
+	      symbol_get_obj (sym)->size->X_add_symbol
 	        = symbol_new ("L0\001", now_seg, frag_now_fix (), frag_now);
-	      sym->sy_obj.size->X_op_symbol = sym;
-	      sym->sy_obj.size->X_add_number = 0;
+	      symbol_get_obj (sym)->size->X_op_symbol = sym;
+	      symbol_get_obj (sym)->size->X_add_number = 0;
 	    }
 
 	  alpha_cur_ent_sym = NULL;
@@ -3637,7 +4529,7 @@
 
 static void
 s_alpha_frame (dummy)
-     int dummy;
+     int dummy ATTRIBUTE_UNUSED;
 {
   if (ECOFF_DEBUGGING)
     ecoff_directive_frame (0);
@@ -3647,7 +4539,7 @@
 
 static void
 s_alpha_prologue (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   symbolS *sym;
   int arg;
@@ -3695,7 +4587,7 @@
     ecoff_directive_loc,
   };
 
-  assert (which >= 0 && which < sizeof(fns)/sizeof(*fns));
+  assert (which >= 0 && which < (int)(sizeof(fns)/sizeof(*fns)));
 
   if (ECOFF_DEBUGGING)
     (*fns[which])(0);
@@ -3765,7 +4657,7 @@
     }
 
   symbol = make_expr_symbol (&symexpr);
-  symbol->bsym->flags |= BSF_FUNCTION;
+  symbol_get_bfdsym (symbol)->flags |= BSF_FUNCTION;
   alpha_evax_proc.symbol = symbol;
 
   demand_empty_rest_of_line ();
@@ -3837,7 +4729,8 @@
       return;
     }
 
-  alpha_evax_proc.symbol->sy_obj = (valueT)seginfo->literal_pool_size;
+  *symbol_get_obj (alpha_evax_proc.symbol) =
+    (valueT) seginfo->literal_pool_size;
 
   expression (&exp);
   if (exp.X_op != O_symbol)
@@ -3849,7 +4742,8 @@
 
   entry_sym = make_expr_symbol (&exp);
   /* Save bfd symbol of proc desc in function symbol.  */
-  alpha_evax_proc.symbol->bsym->udata.p = (PTR)entry_sym->bsym;
+  symbol_get_bfdsym (alpha_evax_proc.symbol)->udata.p
+    = symbol_get_bfdsym (entry_sym);
 
   SKIP_WHITESPACE ();
   if (*input_line_pointer++ != ',')
@@ -4140,14 +5034,14 @@
   extern char *demand_copy_string PARAMS ((int *lenP));
 
   sprintf (case_hack, "<CASE:%01d%01d>",
-	    alpha_flag_hash_long_names, alpha_flag_show_after_trunc);
+	   alpha_flag_hash_long_names, alpha_flag_show_after_trunc);
 
   s = symbol_find_or_make (case_hack);
-  s->bsym->flags |= BSF_FILE;
+  symbol_get_bfdsym (s)->flags |= BSF_FILE;
 
   get_absolute_expression ();
   s = symbol_find_or_make (demand_copy_string (&length));
-  s->bsym->flags |= BSF_FILE;
+  symbol_get_bfdsym (s)->flags |= BSF_FILE;
   demand_empty_rest_of_line ();
 
   return;
@@ -4158,7 +5052,7 @@
 
 static void
 s_alpha_gprel32 (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   expressionS e;
   char *p;
@@ -4253,7 +5147,7 @@
 
 static void
 s_alpha_proc (is_static)
-     int is_static;
+     int is_static ATTRIBUTE_UNUSED;
 {
   char *name;
   char c;
@@ -4282,7 +5176,7 @@
       input_line_pointer++;
       temp = get_absolute_expression ();
     }
-  /*  symbolP->sy_other = (signed char) temp; */
+  /*  *symbol_get_obj (symbolP) = (signed char) temp; */
   as_warn (_("unhandled: .proc %s,%d"), name, temp);
   demand_empty_rest_of_line ();
 }
@@ -4292,7 +5186,7 @@
 
 static void
 s_alpha_set (x)
-     int x;
+     int x ATTRIBUTE_UNUSED;
 {
   char *name, ch, *s;
   int yesno = 1;
@@ -4329,7 +5223,7 @@
 
 static void
 s_alpha_base (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
 #if 0
   if (first_32bit_quadrant)
@@ -4364,7 +5258,7 @@
 
 static void
 s_alpha_align (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int align;
   char fill, *pfill;
@@ -4462,7 +5356,7 @@
 
 static void
 s_alpha_arch (ignored)
-     int ignored;
+     int ignored ATTRIBUTE_UNUSED;
 {
   char *name, ch;
   const struct cpu_type *p;
@@ -4706,7 +5600,7 @@
      int n;
      char *pfill;
      symbolS *label;
-     int force;
+     int force ATTRIBUTE_UNUSED;
 {
   if (alpha_current_align >= n)
     return;
@@ -4742,14 +5636,13 @@
 
   alpha_current_align = n;
 
-  if (label != NULL)
+  if (label != NULL && S_GET_SEGMENT (label) == now_seg)
     {
-      assert (S_GET_SEGMENT (label) == now_seg);
-      label->sy_frag = frag_now;
+      symbol_set_frag (label, frag_now);
       S_SET_VALUE (label, (valueT) frag_now_fix ());
     }
 
-  record_alignment(now_seg, n);
+  record_alignment (now_seg, n);
 
   /* ??? if alpha_flag_relax && force && elf, record the requested alignment
      in a reloc for the linker to see.  */
diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h
index ca6903a..632b04e 100644
--- a/gas/config/tc-alpha.h
+++ b/gas/config/tc-alpha.h
@@ -85,7 +85,7 @@
 extern void alpha_frob_ecoff_data PARAMS ((void));
 
 #define tc_frob_label(sym) alpha_define_label (sym)
-extern void alpha_define_label PARAMS ((struct symbol *));
+extern void alpha_define_label PARAMS ((symbolS *));
 
 #define md_cons_align(nbytes) alpha_cons_align (nbytes)
 extern void alpha_cons_align PARAMS ((int));
@@ -102,3 +102,47 @@
   { ".sdata",   SHT_PROGBITS,   SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  }, \
   { ".sbss",    SHT_NOBITS,     SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  },
 #endif
+
+/* Whether to add support for explict !relocation_op!sequence_number.  At the
+   moment, only do this for ELF, though ECOFF could use it as well.  */
+
+#ifdef OBJ_ELF
+#define RELOC_OP_P
+#endif
+
+#ifdef RELOC_OP_P
+/* Before the relocations are written, reorder them, so that user supplied
+   !lituse relocations follow the appropriate !literal relocations.  Also
+   convert the gas-internal relocations to the appropriate linker relocations.
+   */
+#define tc_adjust_symtab() alpha_adjust_symtab ()
+extern void alpha_adjust_symtab PARAMS ((void));
+
+/* New fields for supporting explicit relocations (such as !literal to mark
+   where a pointer is loaded from the global table, and !lituse_base to track
+   all of the normal uses of that pointer).  */
+
+#define TC_FIX_TYPE struct alpha_fix_tag
+
+struct alpha_fix_tag
+{
+  struct fix *next_lituse;		/* next !lituse */
+  struct alpha_literal_tag *info;	/* other members with same sequence */
+};
+
+/* Initialize the TC_FIX_TYPE field.  */
+#define TC_INIT_FIX_DATA(fixP)						\
+do {									\
+  fixP->tc_fix_data.next_lituse = (struct fix *)0;			\
+  fixP->tc_fix_data.info = (struct alpha_literal_tag *)0;		\
+} while (0)
+
+/* Work with DEBUG5 to print fields in tc_fix_type.  */
+#define TC_FIX_DATA_PRINT(stream,fixP)					\
+do {									\
+  if (fixP->tc_fix_data.info)						\
+    fprintf (stderr, "\tinfo = 0x%lx, next_lituse = 0x%lx\n", \
+	     (long)fixP->tc_fix_data.info,				\
+	     (long)fixP->tc_fix_data.next_lituse);			\
+} while (0)
+#endif
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index c07c2d7..3aafea3 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -1,5 +1,5 @@
 /* tc-arc.c -- Assembler for the ARC
-   Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
@@ -15,8 +15,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+   along with GAS; 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 <ctype.h>
@@ -797,7 +798,7 @@
 		   S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
 	}
     }
-  assert (symbolP->sy_frag == &zero_address_frag);
+  assert (symbol_get_frag (symbolP) == &zero_address_frag);
   if (*input_line_pointer != ',')
     {
       as_bad (_("expected comma after common length"));
@@ -830,8 +831,8 @@
 	  if (align)
 	    frag_align (align, 0, 0);
 	  if (S_GET_SEGMENT (symbolP) == bss_section)
-	    symbolP->sy_frag->fr_symbol = 0;
-	  symbolP->sy_frag = frag_now;
+	    symbol_get_frag (symbolP)->fr_symbol = 0;
+	  symbol_set_frag (symbolP, frag_now);
 	  p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
 			(offsetT) size, (char *) 0);
 	  *p = 0;
@@ -966,7 +967,7 @@
   new = (char *) xmalloc (strlen (name) + 1);
   strcpy (new, name);
   *input_line_pointer = c;
-  sym->sy_tc.real_name = new;
+  symbol_get_tc (sym)->real_name = new;
 
   demand_empty_rest_of_line ();
 }
@@ -1241,13 +1242,13 @@
 
   if (exp->X_op == O_right_shift
       && exp->X_op_symbol != NULL
-      && exp->X_op_symbol->sy_value.X_op == O_constant
-      && exp->X_op_symbol->sy_value.X_add_number == 2
+      && symbol_constant_p (exp->X_op_symbol)
+      && S_GET_VALUE (exp->X_op_symbol) == 2
       && exp->X_add_number == 0)
     {
       if (exp->X_add_symbol != NULL
-	  && (exp->X_add_symbol->sy_value.X_op == O_constant
-	      || exp->X_add_symbol->sy_value.X_op == O_symbol))
+	  && (symbol_constant_p (exp->X_add_symbol)
+	      || symbol_equated_p (exp->X_add_symbol)))
 	{
 	  *expnew = *exp;
 	  expnew->X_op = O_symbol;
@@ -1255,9 +1256,10 @@
 	  return data_p ? BFD_RELOC_ARC_B26 : arc_operand_map['J'];
 	}
       else if (exp->X_add_symbol != NULL
-	       && exp->X_add_symbol->sy_value.X_op == O_subtract)
+	       && (symbol_get_value_expression (exp->X_add_symbol)->X_op
+		   == O_subtract))
 	{
-	  *expnew = exp->X_add_symbol->sy_value;
+	  *expnew = *symbol_get_value_expression (exp->X_add_symbol);
 	  return data_p ? BFD_RELOC_ARC_B26 : arc_operand_map['J'];
 	}
     }
@@ -1445,7 +1447,8 @@
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
 
-  reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
@@ -1473,8 +1476,8 @@
 arc_frob_symbol (sym)
      symbolS *sym;
 {
-  if (sym->sy_tc.real_name != (char *) NULL)
-    S_SET_NAME (sym, sym->sy_tc.real_name);
+  if (symbol_get_tc (sym)->real_name != (char *) NULL)
+    S_SET_NAME (sym, symbol_get_tc (sym)->real_name);
 
   return 0;
 }
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 6a95ff4..5066201 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -1,5 +1,5 @@
 /* tc-arc.h - Macros and type defines for the ARC.
-   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
@@ -66,6 +66,6 @@
 #define TC_SYMFIELD_TYPE struct arc_tc_sy
 
 /* Finish up the symbol.  */
-extern int arc_frob_symbol PARAMS ((struct symbol *));
+extern int arc_frob_symbol PARAMS ((symbolS *));
 #define tc_frob_symbol(sym, punt) punt = arc_frob_symbol (sym)
 #endif
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index d898bf0..4779b3d 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -1,5 +1,5 @@
 /* tc-arm.c -- Assemble for the ARM
-   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
 	Modified by David Taylor (dtaylor@armltd.co.uk)
 
@@ -51,12 +51,18 @@
 #define ARM_LONGMUL	0x00000010	/* allow long multiplies */
 #define ARM_HALFWORD    0x00000020	/* allow half word loads */
 #define ARM_THUMB       0x00000040	/* allow BX instruction  */
+#define ARM_EXT_V5	0x00000080	/* allow CLZ etc	 */
+#define ARM_EXT_V5E     0x00000200	/* "El Segundo" 	 */
 
-#define ARM_ARCHv4	(ARM_7 | ARM_LONGMUL | ARM_HALFWORD)
+/* Architectures are the sum of the base and extensions.  */
+#define ARM_ARCH_V4	(ARM_7 | ARM_LONGMUL | ARM_HALFWORD)
+#define ARM_ARCH_V4T	(ARM_ARCH_V4 | ARM_THUMB)
+#define ARM_ARCH_V5	(ARM_ARCH_V4 | ARM_EXT_V5)
+#define ARM_ARCH_V5T	(ARM_ARCH_V5 | ARM_THUMB)
 
 /* Some useful combinations:  */
 #define ARM_ANY		0x00ffffff
-#define ARM_2UP		0x00fffffe
+#define ARM_2UP		(ARM_ANY - ARM_1)
 #define ARM_ALL		ARM_2UP		/* Not arm1 only */
 #define ARM_3UP		0x00fffffc
 #define ARM_6UP		0x00fffff8      /* Includes ARM7 */
@@ -73,7 +79,7 @@
      
 #ifndef CPU_DEFAULT
 #if defined __thumb__
-#define CPU_DEFAULT (ARM_ARCHv4 | ARM_THUMB)
+#define CPU_DEFAULT (ARM_ARCH_V4 | ARM_THUMB)
 #else
 #define CPU_DEFAULT ARM_ALL
 #endif
@@ -83,7 +89,8 @@
 #define FPU_DEFAULT FPU_ALL
 #endif
 
-#define streq(a,b)  (strcmp (a, b) == 0)
+#define streq(a, b)           (strcmp (a, b) == 0)
+#define skip_whitespace(str)  while (* (str) == ' ') ++ (str)
 
 static unsigned long	cpu_variant = CPU_DEFAULT | FPU_DEFAULT;
 static int target_oabi = 0;
@@ -97,16 +104,16 @@
 #endif
 
 /* This array holds the chars that always start a comment.  If the
-   pre-processor is disabled, these aren't very useful */
+   pre-processor is disabled, these aren't very useful.  */
 CONST char comment_chars[] = "@";
 
 /* This array holds the chars that only start a comment at the beginning of
    a line.  If the line seems to have the form '# 123 filename'
-   .line and .file directives will appear in the pre-processed output */
+   .line and .file directives will appear in the pre-processed output.  */
 /* Note that input_file.c hand checks for '#' at the beginning of the
    first line of the input file.  This is because the compiler outputs
-   #NO_APP at the beginning of its output. */
-/* Also note that comments like this one will always work. */
+   #NO_APP at the beginning of its output.  */
+/* Also note that comments like this one will always work.  */
 CONST char line_comment_chars[] = "#";
 
 #ifdef TE_LINUX
@@ -115,7 +122,8 @@
 CONST char line_separator_chars[] = "";
 #endif
 
-/* Chars that can be used to separate mant from exp in floating point nums */
+/* Chars that can be used to separate mant
+   from exp in floating point numbers.  */
 CONST char EXP_CHARS[] = "eE";
 
 /* Chars that mean this number is a floating point constant */
@@ -132,10 +140,11 @@
 symbolS * GOT_symbol;		/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
 #endif
 
-CONST int md_reloc_size = 8;		/* Size of relocation record */
+CONST int md_reloc_size = 8;	/* Size of relocation record */
 
-static int thumb_mode = 0;      /* non-zero if assembling thumb instructions */
-
+static int thumb_mode = 0;      /* 0: assemble for ARM, 1: assemble for Thumb,
+				   2: assemble for Thumb even though target cpu
+				   does not support thumb instructions.  */
 typedef struct arm_fix
 {
   int thumb_mode;
@@ -189,7 +198,7 @@
   "0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0", 0
 };
 
-/* Number of littlenums required to hold an extended precision number */
+/* Number of littlenums required to hold an extended precision number.  */
 #define MAX_LITTLENUMS 6
 
 LITTLENUM_TYPE fp_values[NUM_FLOAT_VALS][MAX_LITTLENUMS];
@@ -218,7 +227,7 @@
   unsigned long value;
 };
 
-/* This is to save a hash look-up in the common case */
+/* This is to save a hash look-up in the common case.  */
 #define COND_ALWAYS 0xe0000000
 
 static CONST struct asm_cond conds[] = 
@@ -243,7 +252,7 @@
 
 /* Warning: If the top bit of the set_bits is set, then the standard
    instruction bitmask is ignored, and the new bitmask is taken from
-   the set_bits: */
+   the set_bits:  */
 struct asm_flg
 {
   CONST char *  template;	/* Basic flag string */
@@ -408,54 +417,54 @@
   {"spsr_ctl",	SPSR_CTL}
 };
 
-/* Functions called by parser */
+/* Functions called by parser.  */
 /* ARM instructions */
-static void do_arit		PARAMS ((char *operands, unsigned long flags));
-static void do_cmp		PARAMS ((char *operands, unsigned long flags));
-static void do_mov		PARAMS ((char *operands, unsigned long flags));
-static void do_ldst		PARAMS ((char *operands, unsigned long flags));
-static void do_ldmstm		PARAMS ((char *operands, unsigned long flags));
-static void do_branch		PARAMS ((char *operands, unsigned long flags));
-static void do_swi		PARAMS ((char *operands, unsigned long flags));
-/* Pseudo Op codes */
-static void do_adr		PARAMS ((char *operands, unsigned long flags));
-static void do_nop		PARAMS ((char *operands, unsigned long flags));
-/* ARM 2 */
-static void do_mul		PARAMS ((char *operands, unsigned long flags));
-static void do_mla		PARAMS ((char *operands, unsigned long flags));
-/* ARM 3 */
-static void do_swap		PARAMS ((char *operands, unsigned long flags));
-/* ARM 6 */
-static void do_msr		PARAMS ((char *operands, unsigned long flags));
-static void do_mrs		PARAMS ((char *operands, unsigned long flags));
-/* ARM 7M */
-static void do_mull		PARAMS ((char *operands, unsigned long flags));
-/* ARM THUMB */
-static void do_bx               PARAMS ((char *operands, unsigned long flags));
+static void do_arit		PARAMS ((char *, unsigned long));
+static void do_cmp		PARAMS ((char *, unsigned long));
+static void do_mov		PARAMS ((char *, unsigned long));
+static void do_ldst		PARAMS ((char *, unsigned long));
+static void do_ldmstm		PARAMS ((char *, unsigned long));
+static void do_branch		PARAMS ((char *, unsigned long));
+static void do_swi		PARAMS ((char *, unsigned long));
+/* Pseudo Op codes */			       		      
+static void do_adr		PARAMS ((char *, unsigned long));
+static void do_adrl		PARAMS ((char *, unsigned long));
+static void do_nop		PARAMS ((char *, unsigned long));
+/* ARM 2 */				       		      
+static void do_mul		PARAMS ((char *, unsigned long));
+static void do_mla		PARAMS ((char *, unsigned long));
+/* ARM 3 */				       		      
+static void do_swap		PARAMS ((char *, unsigned long));
+/* ARM 6 */				       		      
+static void do_msr		PARAMS ((char *, unsigned long));
+static void do_mrs		PARAMS ((char *, unsigned long));
+/* ARM 7M */				       		      
+static void do_mull		PARAMS ((char *, unsigned long));
+/* ARM THUMB */				       		      
+static void do_bx               PARAMS ((char *, unsigned long));
 
-/* Coprocessor Instructions */
-static void do_cdp		PARAMS ((char *operands, unsigned long flags));
-static void do_lstc		PARAMS ((char *operands, unsigned long flags));
-static void do_co_reg		PARAMS ((char *operands, unsigned long flags));
-static void do_fp_ctrl		PARAMS ((char *operands, unsigned long flags));
-static void do_fp_ldst		PARAMS ((char *operands, unsigned long flags));
-static void do_fp_ldmstm	PARAMS ((char *operands, unsigned long flags));
-static void do_fp_dyadic	PARAMS ((char *operands, unsigned long flags));
-static void do_fp_monadic	PARAMS ((char *operands, unsigned long flags));
-static void do_fp_cmp		PARAMS ((char *operands, unsigned long flags));
-static void do_fp_from_reg	PARAMS ((char *operands, unsigned long flags));
-static void do_fp_to_reg	PARAMS ((char *operands, unsigned long flags));
+					       		      
+/* Coprocessor Instructions */		       		      
+static void do_cdp		PARAMS ((char *, unsigned long));
+static void do_lstc		PARAMS ((char *, unsigned long));
+static void do_co_reg		PARAMS ((char *, unsigned long));
+static void do_fp_ctrl		PARAMS ((char *, unsigned long));
+static void do_fp_ldst		PARAMS ((char *, unsigned long));
+static void do_fp_ldmstm	PARAMS ((char *, unsigned long));
+static void do_fp_dyadic	PARAMS ((char *, unsigned long));
+static void do_fp_monadic	PARAMS ((char *, unsigned long));
+static void do_fp_cmp		PARAMS ((char *, unsigned long));
+static void do_fp_from_reg	PARAMS ((char *, unsigned long));
+static void do_fp_to_reg	PARAMS ((char *, unsigned long));
 
-static void fix_new_arm		PARAMS ((fragS *frag, int where, 
-					 short int size, expressionS *exp,
-					 int pc_rel, int reloc));
-static int arm_reg_parse	PARAMS ((char **ccp));
-static int arm_psr_parse	PARAMS ((char **ccp));
-static void symbol_locate	PARAMS ((symbolS *, CONST char *, segT,
-					 valueT, fragS *));
+static void fix_new_arm		PARAMS ((fragS *, int, short, expressionS *, int, int));
+static int arm_reg_parse	PARAMS ((char **));
+static int arm_psr_parse	PARAMS ((char **));
+static void symbol_locate	PARAMS ((symbolS *, CONST char *, segT, valueT, fragS *));
 static int add_to_lit_pool	PARAMS ((void));
-static unsigned validate_immediate	PARAMS ((unsigned));
-static int validate_offset_imm	PARAMS ((int, int));
+static unsigned validate_immediate PARAMS ((unsigned));
+static unsigned validate_immediate_twopart PARAMS ((unsigned int, unsigned int *));
+static int validate_offset_imm	PARAMS ((unsigned int, int));
 static void opcode_select	PARAMS ((int));
 static void end_of_line		PARAMS ((char *));
 static int reg_required_here	PARAMS ((char **, int));
@@ -469,8 +478,7 @@
 static int my_get_float_expression	PARAMS ((char **));
 static int skip_past_comma	PARAMS ((char **));
 static int walk_no_bignums	PARAMS ((symbolS *));
-static int negate_data_op	PARAMS ((unsigned long *,
-					 unsigned long));
+static int negate_data_op	PARAMS ((unsigned long *, unsigned long));
 static int data_op2		PARAMS ((char **));
 static int fp_op2		PARAMS ((char **));
 static long reg_list		PARAMS ((char **));
@@ -484,27 +492,30 @@
 static void set_constant_flonums	PARAMS ((void));
 static valueT md_chars_to_number	PARAMS ((char *, int));
 static void insert_reg_alias	PARAMS ((char *, int));
-static void output_inst		PARAMS ((char *));
+static void output_inst		PARAMS ((void));
 #ifdef OBJ_ELF
-static bfd_reloc_code_real_type	arm_parse_reloc(void);
+static bfd_reloc_code_real_type	arm_parse_reloc PARAMS ((void));
 #endif
 
 /* ARM instructions take 4bytes in the object file, Thumb instructions
-   take 2: */
+   take 2:  */
 #define INSN_SIZE       4
 
 /* LONGEST_INST is the longest basic instruction name without conditions or 
- * flags.
- * ARM7M has 4 of length 5
- */
+   flags.  ARM7M has 4 of length 5.  */
 
 #define LONGEST_INST 5
 
+
 struct asm_opcode 
 {
   CONST char *           template;	/* Basic string to match */
   unsigned long          value;		/* Basic instruction code */
-  CONST char *           comp_suffix;	/* Compulsory suffix that must follow conds */
+
+  /* Compulsory suffix that must follow conds. If "", then the
+     instruction is not conditional and must have no suffix. */
+  CONST char *           comp_suffix;	
+
   CONST struct asm_flg * flags;	        /* Bits to toggle if flag 'n' set */
   unsigned long          variants;	/* Which CPU variants this exists for */
   /* Function to call to parse args */
@@ -535,11 +546,17 @@
   {"stm",   0x08000000, NULL,   stm_flags,   ARM_ANY,      do_ldmstm},
   {"ldm",   0x08100000, NULL,   ldm_flags,   ARM_ANY,      do_ldmstm},
   {"swi",   0x0f000000, NULL,   NULL,        ARM_ANY,      do_swi},
+#ifdef TE_WINCE
+  {"bl",    0x0b000000, NULL,   NULL,        ARM_ANY,      do_branch},
+  {"b",     0x0a000000, NULL,   NULL,        ARM_ANY,      do_branch},
+#else
   {"bl",    0x0bfffffe, NULL,   NULL,        ARM_ANY,      do_branch},
   {"b",     0x0afffffe, NULL,   NULL,        ARM_ANY,      do_branch},
-
+#endif
+  
 /* Pseudo ops */
   {"adr",   0x028f0000, NULL,   NULL,        ARM_ANY,      do_adr},
+  {"adrl",  0x028f0000, NULL,   NULL,        ARM_ANY,      do_adrl},
   {"nop",   0x01a00000, NULL,   NULL,        ARM_ANY,      do_nop},
 
 /* ARM 2 multiplies */
@@ -613,7 +630,7 @@
   {"flt",   0x0e000110, "sde",  round_flags, FPU_ALL,      do_fp_from_reg},
   {"fix",   0x0e100110, NULL,   fix_flags,   FPU_ALL,      do_fp_to_reg},
 
-/* Generic copressor instructions */
+/* Generic copressor instructions.  */
   {"cdp",   0x0e000000, NULL,  NULL,         ARM_2UP,      do_cdp},
   {"ldc",   0x0c100000, NULL,  cplong_flag,  ARM_2UP,      do_lstc},
   {"stc",   0x0c000000, NULL,  cplong_flag,  ARM_2UP,      do_lstc},
@@ -621,8 +638,7 @@
   {"mrc",   0x0e100010, NULL,  NULL,         ARM_2UP,      do_co_reg},
 };
 
-/* defines for various bits that we will want to toggle */
-
+/* Defines for various bits that we will want to toggle.  */
 #define INST_IMMEDIATE	0x02000000
 #define OFFSET_REG	0x02000000
 #define HWOFFSET_IMM    0x00400000
@@ -630,15 +646,14 @@
 #define PRE_INDEX	0x01000000
 #define INDEX_UP	0x00800000
 #define WRITE_BACK	0x00200000
-#define MULTI_SET_PSR	0x00400000
+#define LDM_TYPE_2_OR_3	0x00400000
 
 #define LITERAL_MASK	0xf000f000
 #define COND_MASK	0xf0000000
 #define OPCODE_MASK	0xfe1fffff
 #define DATA_OP_SHIFT	21
 
-/* Codes to distinguish the arithmetic instructions */
-
+/* Codes to distinguish the arithmetic instructions.  */
 #define OPCODE_AND	0
 #define OPCODE_EOR	1
 #define OPCODE_SUB	2
@@ -656,30 +671,30 @@
 #define OPCODE_BIC	14
 #define OPCODE_MVN	15
 
-static void do_t_nop		PARAMS ((char *operands));
-static void do_t_arit		PARAMS ((char *operands));
-static void do_t_add		PARAMS ((char *operands));
-static void do_t_asr		PARAMS ((char *operands));
-static void do_t_branch9	PARAMS ((char *operands));
-static void do_t_branch12	PARAMS ((char *operands));
-static void do_t_branch23	PARAMS ((char *operands));
-static void do_t_bx		PARAMS ((char *operands));
-static void do_t_compare	PARAMS ((char *operands));
-static void do_t_ldmstm		PARAMS ((char *operands));
-static void do_t_ldr		PARAMS ((char *operands));
-static void do_t_ldrb		PARAMS ((char *operands));
-static void do_t_ldrh		PARAMS ((char *operands));
-static void do_t_lds		PARAMS ((char *operands));
-static void do_t_lsl		PARAMS ((char *operands));
-static void do_t_lsr		PARAMS ((char *operands));
-static void do_t_mov		PARAMS ((char *operands));
-static void do_t_push_pop	PARAMS ((char *operands));
-static void do_t_str		PARAMS ((char *operands));
-static void do_t_strb		PARAMS ((char *operands));
-static void do_t_strh		PARAMS ((char *operands));
-static void do_t_sub		PARAMS ((char *operands));
-static void do_t_swi		PARAMS ((char *operands));
-static void do_t_adr		PARAMS ((char *operands));
+static void do_t_nop		PARAMS ((char *));
+static void do_t_arit		PARAMS ((char *));
+static void do_t_add		PARAMS ((char *));
+static void do_t_asr		PARAMS ((char *));
+static void do_t_branch9	PARAMS ((char *));
+static void do_t_branch12	PARAMS ((char *));
+static void do_t_branch23	PARAMS ((char *));
+static void do_t_bx		PARAMS ((char *));
+static void do_t_compare	PARAMS ((char *));
+static void do_t_ldmstm		PARAMS ((char *));
+static void do_t_ldr		PARAMS ((char *));
+static void do_t_ldrb		PARAMS ((char *));
+static void do_t_ldrh		PARAMS ((char *));
+static void do_t_lds		PARAMS ((char *));
+static void do_t_lsl		PARAMS ((char *));
+static void do_t_lsr		PARAMS ((char *));
+static void do_t_mov		PARAMS ((char *));
+static void do_t_push_pop	PARAMS ((char *));
+static void do_t_str		PARAMS ((char *));
+static void do_t_strb		PARAMS ((char *));
+static void do_t_strh		PARAMS ((char *));
+static void do_t_sub		PARAMS ((char *));
+static void do_t_swi		PARAMS ((char *));
+static void do_t_adr		PARAMS ((char *));
 
 #define T_OPCODE_MUL 0x4340
 #define T_OPCODE_TST 0x4200
@@ -735,7 +750,7 @@
 
 static int thumb_reg		PARAMS ((char ** str, int hi_lo));
 
-#define THUMB_SIZE	2	/* Size of thumb instruction */
+#define THUMB_SIZE	2	/* Size of thumb instruction.  */
 #define THUMB_REG_LO	0x1
 #define THUMB_REG_HI	0x2
 #define THUMB_REG_ANY	0x3
@@ -755,7 +770,7 @@
 
 #define THUMB_PP_PC_LR 0x0100
 
-/* These three are used for immediate shifts, do not alter */
+/* These three are used for immediate shifts, do not alter.  */
 #define THUMB_WORD 2
 #define THUMB_HALFWORD 1
 #define THUMB_BYTE 0
@@ -765,68 +780,70 @@
   CONST char *  template;	/* Basic string to match */
   unsigned long value;		/* Basic instruction code */
   int           size;
+  unsigned long          variants;    /* Which CPU variants this exists for */
   void (*       parms) PARAMS ((char *));  /* Function to call to parse args */
 };
 
 static CONST struct thumb_opcode tinsns[] =
 {
-  {"adc",	0x4140,		2,	do_t_arit},
-  {"add",	0x0000,		2,	do_t_add},
-  {"and",	0x4000,		2,	do_t_arit},
-  {"asr",	0x0000,		2,	do_t_asr},
-  {"b",		T_OPCODE_BRANCH, 2,	do_t_branch12},
-  {"beq",	0xd0fe,		2,	do_t_branch9},
-  {"bne",	0xd1fe,		2,	do_t_branch9},
-  {"bcs",	0xd2fe,		2,	do_t_branch9},
-  {"bhs",	0xd2fe,		2,	do_t_branch9},
-  {"bcc",	0xd3fe,		2,	do_t_branch9},
-  {"bul",	0xd3fe,		2,	do_t_branch9},
-  {"blo",	0xd3fe,		2,	do_t_branch9},
-  {"bmi",	0xd4fe,		2,	do_t_branch9},
-  {"bpl",	0xd5fe,		2,	do_t_branch9},
-  {"bvs",	0xd6fe,		2,	do_t_branch9},
-  {"bvc",	0xd7fe,		2,	do_t_branch9},
-  {"bhi",	0xd8fe,		2,	do_t_branch9},
-  {"bls",	0xd9fe,		2,	do_t_branch9},
-  {"bge",	0xdafe,		2,	do_t_branch9},
-  {"blt",	0xdbfe,		2,	do_t_branch9},
-  {"bgt",	0xdcfe,		2,	do_t_branch9},
-  {"ble",	0xddfe,		2,	do_t_branch9},
-  {"bic",	0x4380,		2,	do_t_arit},
-  {"bl",	0xf7fffffe,	4,	do_t_branch23},
-  {"bx",	0x4700,		2,	do_t_bx},
-  {"cmn",	T_OPCODE_CMN,	2,	do_t_arit},
-  {"cmp",	0x0000,		2,	do_t_compare},
-  {"eor",	0x4040,		2,	do_t_arit},
-  {"ldmia",	0xc800,		2,	do_t_ldmstm},
-  {"ldr",	0x0000,		2,	do_t_ldr},
-  {"ldrb",	0x0000,		2,	do_t_ldrb},
-  {"ldrh",	0x0000,		2,	do_t_ldrh},
-  {"ldrsb",	0x5600,		2,	do_t_lds},
-  {"ldrsh",	0x5e00,		2,	do_t_lds},
-  {"ldsb",	0x5600,		2,	do_t_lds},
-  {"ldsh",	0x5e00,		2,	do_t_lds},
-  {"lsl",	0x0000,		2,	do_t_lsl},
-  {"lsr",	0x0000,		2,	do_t_lsr},
-  {"mov",	0x0000,		2,	do_t_mov},
-  {"mul",	T_OPCODE_MUL,	2,	do_t_arit},
-  {"mvn",	T_OPCODE_MVN,	2,	do_t_arit},
-  {"neg",	T_OPCODE_NEG,	2,	do_t_arit},
-  {"orr",	0x4300,		2,	do_t_arit},
-  {"pop",	0xbc00,		2,	do_t_push_pop},
-  {"push",	0xb400,		2,	do_t_push_pop},
-  {"ror",	0x41c0,		2,	do_t_arit},
-  {"sbc",	0x4180,		2,	do_t_arit},
-  {"stmia",	0xc000,		2,	do_t_ldmstm},
-  {"str",	0x0000,		2,	do_t_str},
-  {"strb",	0x0000,		2,	do_t_strb},
-  {"strh",	0x0000,		2,	do_t_strh},
-  {"swi",	0xdf00,		2,	do_t_swi},
-  {"sub",	0x0000,		2,	do_t_sub},
-  {"tst",	T_OPCODE_TST,	2,	do_t_arit},
+  {"adc",	0x4140,		2,	ARM_THUMB, do_t_arit},
+  {"add",	0x0000,		2,	ARM_THUMB, do_t_add},
+  {"and",	0x4000,		2,	ARM_THUMB, do_t_arit},
+  {"asr",	0x0000,		2,	ARM_THUMB, do_t_asr},
+  {"b",		T_OPCODE_BRANCH, 2,	ARM_THUMB, do_t_branch12},
+  {"beq",	0xd0fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bne",	0xd1fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bcs",	0xd2fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bhs",	0xd2fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bcc",	0xd3fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bul",	0xd3fe,		2,	ARM_THUMB, do_t_branch9},
+  {"blo",	0xd3fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bmi",	0xd4fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bpl",	0xd5fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bvs",	0xd6fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bvc",	0xd7fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bhi",	0xd8fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bls",	0xd9fe,		2,	ARM_THUMB, do_t_branch9},
+  {"bge",	0xdafe,		2,	ARM_THUMB, do_t_branch9},
+  {"blt",	0xdbfe,		2,	ARM_THUMB, do_t_branch9},
+  {"bgt",	0xdcfe,		2,	ARM_THUMB, do_t_branch9},
+  {"ble",	0xddfe,		2,	ARM_THUMB, do_t_branch9},
+  {"bal",	0xdefe,		2,	ARM_THUMB, do_t_branch9},
+  {"bic",	0x4380,		2,	ARM_THUMB, do_t_arit},
+  {"bl",	0xf7fffffe,	4,	ARM_THUMB, do_t_branch23},
+  {"bx",	0x4700,		2,	ARM_THUMB, do_t_bx},
+  {"cmn",	T_OPCODE_CMN,	2,	ARM_THUMB, do_t_arit},
+  {"cmp",	0x0000,		2,	ARM_THUMB, do_t_compare},
+  {"eor",	0x4040,		2,	ARM_THUMB, do_t_arit},
+  {"ldmia",	0xc800,		2,	ARM_THUMB, do_t_ldmstm},
+  {"ldr",	0x0000,		2,	ARM_THUMB, do_t_ldr},
+  {"ldrb",	0x0000,		2,	ARM_THUMB, do_t_ldrb},
+  {"ldrh",	0x0000,		2,	ARM_THUMB, do_t_ldrh},
+  {"ldrsb",	0x5600,		2,	ARM_THUMB, do_t_lds},
+  {"ldrsh",	0x5e00,		2,	ARM_THUMB, do_t_lds},
+  {"ldsb",	0x5600,		2,	ARM_THUMB, do_t_lds},
+  {"ldsh",	0x5e00,		2,	ARM_THUMB, do_t_lds},
+  {"lsl",	0x0000,		2,	ARM_THUMB, do_t_lsl},
+  {"lsr",	0x0000,		2,	ARM_THUMB, do_t_lsr},
+  {"mov",	0x0000,		2,	ARM_THUMB, do_t_mov},
+  {"mul",	T_OPCODE_MUL,	2,	ARM_THUMB, do_t_arit},
+  {"mvn",	T_OPCODE_MVN,	2,	ARM_THUMB, do_t_arit},
+  {"neg",	T_OPCODE_NEG,	2,	ARM_THUMB, do_t_arit},
+  {"orr",	0x4300,		2,	ARM_THUMB, do_t_arit},
+  {"pop",	0xbc00,		2,	ARM_THUMB, do_t_push_pop},
+  {"push",	0xb400,		2,	ARM_THUMB, do_t_push_pop},
+  {"ror",	0x41c0,		2,	ARM_THUMB, do_t_arit},
+  {"sbc",	0x4180,		2,	ARM_THUMB, do_t_arit},
+  {"stmia",	0xc000,		2,	ARM_THUMB, do_t_ldmstm},
+  {"str",	0x0000,		2,	ARM_THUMB, do_t_str},
+  {"strb",	0x0000,		2,	ARM_THUMB, do_t_strb},
+  {"strh",	0x0000,		2,	ARM_THUMB, do_t_strh},
+  {"swi",	0xdf00,		2,	ARM_THUMB, do_t_swi},
+  {"sub",	0x0000,		2,	ARM_THUMB, do_t_sub},
+  {"tst",	T_OPCODE_TST,	2,	ARM_THUMB, do_t_arit},
   /* Pseudo ops: */
-  {"adr",       0x0000,         2,      do_t_adr},
-  {"nop",       0x46C0,         2,      do_t_nop},      /* mov r8,r8 */
+  {"adr",       0x0000,         2,      ARM_THUMB, do_t_adr},
+  {"nop",       0x46C0,         2,      ARM_THUMB, do_t_nop},      /* mov r8,r8 */
 };
 
 struct reg_entry
@@ -843,20 +860,22 @@
 #define REG_LR  14
 #define REG_SP  13
 
-/* These are the standard names;  Users can add aliases with .req */
+/* These are the standard names.  Users can add aliases with .req  */
 static CONST struct reg_entry reg_table[] =
 {
-  /* Processor Register Numbers */
+  /* Processor Register Numbers.  */
   {"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", REG_SP},{"r14", REG_LR},{"r15", REG_PC},
-  /* APCS conventions */
+  /* APCS conventions.  */
   {"a1", 0},	{"a2", 1},    {"a3", 2},     {"a4", 3},
   {"v1", 4},	{"v2", 5},    {"v3", 6},     {"v4", 7},     {"v5", 8},
   {"v6", 9},	{"sb", 9},    {"v7", 10},    {"sl", 10},
   {"fp", 11},	{"ip", 12},   {"sp", REG_SP},{"lr", REG_LR},{"pc", REG_PC},
-  /* FP Registers */
+  /* ATPCS additions to APCS conventions.  */
+  {"wr", 7},    {"v8", 11},
+  /* FP Registers.  */
   {"f0", 16},   {"f1", 17},   {"f2", 18},   {"f3", 19},
   {"f4", 20},   {"f5", 21},   {"f6", 22},   {"f7", 23},
   {"c0", 32},   {"c1", 33},   {"c2", 34},   {"c3", 35},
@@ -867,11 +886,20 @@
   {"cr4", 36},  {"cr5", 37},  {"cr6", 38},  {"cr7", 39},
   {"cr8", 40},  {"cr9", 41},  {"cr10", 42}, {"cr11", 43},
   {"cr12", 44}, {"cr13", 45}, {"cr14", 46}, {"cr15", 47},
+  /* ATPCS additions to float register names.  */
+  {"s0",16},	{"s1",17},	{"s2",18},	{"s3",19},
+  {"s4",20},	{"s5",21},	{"s6",22},	{"s7",23},
+  {"d0",16},	{"d1",17},	{"d2",18},	{"d3",19},
+  {"d4",20},	{"d5",21},	{"d6",22},	{"d7",23},
+  /* FIXME: At some point we need to add VFP register names.  */
+  /* Array terminator.  */
   {NULL, 0}
 };
 
-#define bad_args _("Bad arguments to instruction");
-#define bad_pc _("r15 not allowed here");
+#define BAD_ARGS 	_("Bad arguments to instruction")
+#define BAD_PC 		_("r15 not allowed here")
+#define BAD_FLAGS 	_("Instruction should not have flags")
+#define BAD_COND 	_("Instruction is not conditional")
 
 static struct hash_control * arm_ops_hsh = NULL;
 static struct hash_control * arm_tops_hsh = NULL;
@@ -882,10 +910,9 @@
 
 /* This table describes all the machine specific pseudo-ops the assembler
    has to support.  The fields are:
-   pseudo-op name without dot
-   function to call to execute this pseudo-op
-   Integer arg to pass to the function
-   */
+     pseudo-op name without dot
+     function to call to execute this pseudo-op
+     Integer arg to pass to the function.  */
 
 static void s_req PARAMS ((int));
 static void s_align PARAMS ((int));
@@ -897,7 +924,11 @@
 static void s_code PARAMS ((int));
 static void s_force_thumb PARAMS ((int));
 static void s_thumb_func PARAMS ((int));
+static void s_thumb_set PARAMS ((int));
+static void arm_s_text PARAMS ((int));
+static void arm_s_data PARAMS ((int));
 #ifdef OBJ_ELF
+static void arm_s_section PARAMS ((int));
 static void s_arm_elf_cons PARAMS ((int));
 #endif
 
@@ -905,27 +936,35 @@
 
 CONST pseudo_typeS md_pseudo_table[] =
 {
-  {"req",         s_req, 0},	/* Never called becasue '.req' does not start line */
-  {"bss",         s_bss, 0},
-  {"align",       s_align, 0},
-  {"arm",         s_arm, 0},
-  {"thumb",       s_thumb, 0},
-  {"code",        s_code, 0},
-  {"force_thumb", s_force_thumb, 0},
-  {"thumb_func",  s_thumb_func, 0},
-  {"even",        s_even, 0},
-  {"ltorg",       s_ltorg, 0},
-  {"pool",        s_ltorg, 0},
+  { "req",         s_req,         0 },	/* Never called becasue '.req' does not start line */
+  { "bss",         s_bss,         0 },
+  { "align",       s_align,       0 },
+  { "arm",         s_arm,         0 },
+  { "thumb",       s_thumb,       0 },
+  { "code",        s_code,        0 },
+  { "force_thumb", s_force_thumb, 0 },
+  { "thumb_func",  s_thumb_func,  0 },
+  { "thumb_set",   s_thumb_set,   0 },
+  { "even",        s_even,        0 },
+  { "ltorg",       s_ltorg,       0 },
+  { "pool",        s_ltorg,       0 },
+  /* Allow for the effect of section changes.  */
+  { "text",        arm_s_text,    0 },
+  { "data",        arm_s_data,    0 },
 #ifdef OBJ_ELF  
-  {"word",        s_arm_elf_cons, 4},
-  {"long",        s_arm_elf_cons, 4},
+  { "section",     arm_s_section, 0 },
+  { "section.s",   arm_s_section, 0 },
+  { "sect",        arm_s_section, 0 },
+  { "sect.s",      arm_s_section, 0 },
+  { "word",        s_arm_elf_cons, 4 },
+  { "long",        s_arm_elf_cons, 4 },
 #else
-  {"word",        cons, 4},
+  { "word",        cons, 4},
 #endif
-  {"extend",      float_cons, 'x'},
-  {"ldouble",     float_cons, 'x'},
-  {"packed",      float_cons, 'p'},
-  {0, 0, 0}
+  { "extend",      float_cons, 'x' },
+  { "ldouble",     float_cons, 'x' },
+  { "packed",      float_cons, 'p' },
+  { 0, 0, 0 }
 };
 
 /* Stuff needed to resolve the label ambiguity
@@ -955,7 +994,6 @@
 int       next_literal_pool_place = 0; /* Next free entry in the pool */
 int       lit_pool_num = 1; /* Next literal pool number */
 symbolS * current_poolP = NULL;
-symbolS * symbol_make_empty PARAMS ((void)); 
 
 static int
 add_to_lit_pool ()
@@ -963,14 +1001,16 @@
   int lit_count = 0;
 
   if (current_poolP == NULL)
-    current_poolP = symbol_make_empty ();
+    current_poolP = symbol_create (FAKE_LABEL_NAME, undefined_section,
+				   (valueT) 0, &zero_address_frag);
 
-  /* Check if this literal value is already in the pool: */
+  /* Check if this literal value is already in the pool:  */
   while (lit_count < next_literal_pool_place)
     {
       if (literals[lit_count].exp.X_op == inst.reloc.exp.X_op
           && inst.reloc.exp.X_op == O_constant
-          && literals[lit_count].exp.X_add_number == inst.reloc.exp.X_add_number
+          && literals[lit_count].exp.X_add_number
+	     == inst.reloc.exp.X_add_number
           && literals[lit_count].exp.X_unsigned == inst.reloc.exp.X_unsigned)
         break;
       lit_count++;
@@ -1027,7 +1067,7 @@
   S_SET_VALUE (symbolP, valu);
   symbol_clear_list_pointers(symbolP);
 
-  symbolP->sy_frag = frag;
+  symbol_set_frag (symbolP, frag);
 
   /* Link to end of symbol chain.  */
   {
@@ -1049,25 +1089,8 @@
 #endif /* DEBUG_SYMS */
 }
 
-symbolS *
-symbol_make_empty () 
-{
-  symbolS * symbolP; 
-
-  symbolP = (symbolS *) obstack_alloc (&notes, sizeof (symbolS));
-
-  /* symbol must be born in some fixed state.  This seems as good as any. */
-  memset (symbolP, 0, sizeof (symbolS));
-
-  symbolP->bsym = bfd_make_empty_symbol (stdoutput);
-  assert (symbolP->bsym != 0);
-  symbolP->bsym->udata.p = (PTR) symbolP;
-
-  return symbolP;
-}
-
-/* Check that an immediate is valid, and if so, convert it to the right format.  */
-
+/* Check that an immediate is valid, and if so,
+   convert it to the right format.  */
 static unsigned int
 validate_immediate (val)
      unsigned int val;
@@ -1084,13 +1107,52 @@
   return FAIL;
 }
 
+/* Check to see if an immediate can be computed as two seperate immediate
+   values, added together.  We already know that this value cannot be
+   computed by just one ARM instruction.  */
+static unsigned int
+validate_immediate_twopart (val, highpart)
+     unsigned int val;
+     unsigned int * highpart;
+{
+  unsigned int a;
+  unsigned int i;
+  
+  for (i = 0; i < 32; i += 2)
+    if (((a = rotate_left (val, i)) & 0xff) != 0)
+      {
+	if (a & 0xff00)
+	  {
+	    if (a & ~ 0xffff)
+	      continue;
+	    * highpart = (a  >> 8) | ((i + 24) << 7);
+	  }
+	else if (a & 0xff0000)
+	  {
+	    if (a & 0xff000000)
+	      continue;
+
+	    * highpart = (a >> 16) | ((i + 16) << 7);
+	  }
+	else
+	  {
+	    assert (a & 0xff000000);
+
+	    * highpart = (a >> 24) | ((i + 8) << 7);
+	  }
+
+	return (a & 0xff) | (i << 7);
+      }
+  
+  return FAIL;
+}
+
 static int
 validate_offset_imm (val, hwse)
-     int val;
+     unsigned int val;
      int hwse;
 {
-  if ((hwse && (val < -255 || val > 255))
-      || (val < -4095 || val > 4095))
+  if ((hwse && val > 255) || val > 4095)
      return FAIL;
   return val;
 }
@@ -1098,14 +1160,14 @@
     
 static void
 s_req (a)
-     int a;
+     int a ATTRIBUTE_UNUSED;
 {
   as_bad (_("Invalid syntax for .req directive."));
 }
 
 static void
 s_bss (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* We don't support putting frags in the BSS segment, we fake it by
      marking in_bss, then looking at s_skip for clues?.. */
@@ -1115,7 +1177,7 @@
 
 static void
 s_even (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (!need_pass_2)		/* Never make frag if expect extra pass. */
     frag_align (1, 0, 0);
@@ -1126,19 +1188,14 @@
 }
 
 static void
-s_ltorg (internal)
-     int internal;
+s_ltorg (ignored)
+     int ignored ATTRIBUTE_UNUSED;
 {
   int lit_count = 0;
   char sym_name[20];
 
   if (current_poolP == NULL)
-    {
-      /* Nothing to do */
-      if (!internal)
-	as_tsktsk (_("Nothing to put in the pool\n"));
-      return;
-    }
+    return;
 
   /* Align pool as you have word accesses */
   /* Only make a frag if we have to ... */
@@ -1147,9 +1204,6 @@
 
   record_alignment (now_seg, 2);
 
-  if (internal)
-    as_tsktsk (_("Inserting implicit pool at change of section"));
-
   sprintf (sym_name, "$$lit_\002%x", lit_pool_num++);
 
   symbol_locate (current_poolP, sym_name, now_seg,
@@ -1163,7 +1217,7 @@
 #endif
   
   while (lit_count < next_literal_pool_place)
-    /* First output the expression in the instruction to the pool */
+    /* First output the expression in the instruction to the pool.  */
     emit_expr (&(literals[lit_count++].exp), 4); /* .word */
 
   next_literal_pool_place = 0;
@@ -1172,7 +1226,7 @@
 
 static void
 s_align (unused)	/* Same as s_align_ptwo but align 0 => align 2 */
-     int unused;
+     int unused ATTRIBUTE_UNUSED;
 {
   register int temp;
   register long temp_fill;
@@ -1208,7 +1262,7 @@
 
 static void
 s_force_thumb (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* If we are not already in thumb mode go into it, EVEN if
      the target processor does not support thumb instructions.
@@ -1218,7 +1272,7 @@
      
   if (! thumb_mode)
     {
-      thumb_mode = 1;
+      thumb_mode = 2;
       
       record_alignment (now_seg, 1);
     }
@@ -1228,7 +1282,7 @@
 
 static void
 s_thumb_func (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* The following label is the name/address of the start of a Thumb function.
      We need to know this for the interworking support.  */
@@ -1238,6 +1292,145 @@
   demand_empty_rest_of_line ();
 }
 
+/* Perform a .set directive, but also mark the alias as
+   being a thumb function.  */
+
+static void
+s_thumb_set (equiv)
+     int equiv;
+{
+  /* XXX the following is a duplicate of the code for s_set() in read.c
+     We cannot just call that code as we need to get at the symbol that
+     is created.  */
+  register char *    name;
+  register char      delim;
+  register char *    end_name;
+  register symbolS * symbolP;
+
+  /*
+   * Especial apologies for the random logic:
+   * this just grew, and could be parsed much more simply!
+   * Dean in haste.
+   */
+  name      = input_line_pointer;
+  delim     = get_symbol_end ();
+  end_name  = input_line_pointer;
+  *end_name = delim;
+  
+  SKIP_WHITESPACE ();
+
+  if (*input_line_pointer != ',')
+    {
+      *end_name = 0;
+      as_bad (_("Expected comma after name \"%s\""), name);
+      *end_name = delim;
+      ignore_rest_of_line ();
+      return;
+    }
+
+  input_line_pointer++;
+  *end_name = 0;
+
+  if (name[0] == '.' && name[1] == '\0')
+    {
+      /* XXX - this should not happen to .thumb_set  */
+      abort ();
+    }
+
+  if ((symbolP = symbol_find (name)) == NULL
+      && (symbolP = md_undefined_symbol (name)) == NULL)
+    {
+#ifndef NO_LISTING
+      /* When doing symbol listings, play games with dummy fragments living
+	 outside the normal fragment chain to record the file and line info
+         for this symbol.  */
+      if (listing & LISTING_SYMBOLS)
+	{
+	  extern struct list_info_struct * listing_tail;
+	  fragS * dummy_frag = (fragS *) xmalloc (sizeof(fragS));
+	  memset (dummy_frag, 0, sizeof(fragS));
+	  dummy_frag->fr_type = rs_fill;
+	  dummy_frag->line = listing_tail;
+	  symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
+	  dummy_frag->fr_symbol = symbolP;
+	}
+      else
+#endif
+        symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag);
+			    
+#ifdef OBJ_COFF
+      /* "set" symbols are local unless otherwise specified. */
+      SF_SET_LOCAL (symbolP);
+#endif /* OBJ_COFF */
+    }				/* make a new symbol */
+
+  symbol_table_insert (symbolP);
+
+  * end_name = delim;
+
+  if (equiv
+      && S_IS_DEFINED (symbolP)
+      && S_GET_SEGMENT (symbolP) != reg_section)
+    as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
+
+  pseudo_set (symbolP);
+  
+  demand_empty_rest_of_line ();
+
+  /* XXX Now we come to the Thumb specific bit of code.  */
+  
+  THUMB_SET_FUNC (symbolP, 1);
+  ARM_SET_THUMB (symbolP, 1);
+#if defined OBJ_ELF || defined OBJ_COFF
+  ARM_SET_INTERWORK (symbolP, support_interwork);
+#endif
+}
+
+/* If we change section we must dump the literal pool first.  */
+static void
+arm_s_text (ignore)
+     int ignore;
+{
+  if (now_seg != text_section)
+    s_ltorg (0);
+  
+#ifdef OBJ_ELF
+  obj_elf_text (ignore);
+#else
+  s_text (ignore);
+#endif
+}
+
+static void
+arm_s_data (ignore)
+     int ignore;
+{
+  if (flag_readonly_data_in_text)
+    {
+      if (now_seg != text_section)
+	s_ltorg (0);
+    }
+  else if (now_seg != data_section)
+    s_ltorg (0);
+  
+#ifdef OBJ_ELF
+  obj_elf_data (ignore);
+#else
+  s_data (ignore);
+#endif
+}
+
+#ifdef OBJ_ELF
+static void
+arm_s_section (ignore)
+     int ignore;
+{
+  s_ltorg (0);
+
+  obj_elf_section (ignore);
+}
+#endif
+
 static void
 opcode_select (width)
      int width;
@@ -1275,7 +1468,7 @@
 
 static void
 s_arm (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   opcode_select (32);
   demand_empty_rest_of_line ();
@@ -1283,7 +1476,7 @@
 
 static void
 s_thumb (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   opcode_select (16);
   demand_empty_rest_of_line ();
@@ -1291,7 +1484,7 @@
 
 static void
 s_code (unused)
-     int unused;
+     int unused ATTRIBUTE_UNUSED;
 {
   register int temp;
 
@@ -1312,10 +1505,9 @@
 end_of_line (str)
      char * str;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
-  if (*str != '\0')
+  if (* str != '\0')
     inst.error = _("Garbage following instruction");
 }
 
@@ -1340,9 +1532,10 @@
   return comma ? SUCCESS : FAIL;
 }
 
-/* A standard register must be given at this point.  Shift is the place to
-   put it in the instruction. */
-
+/* A standard register must be given at this point.
+   Shift is the place to put it in inst.instruction.
+   Restores input start point on err.
+   Returns the reg#, or FAIL.  */
 static int
 reg_required_here (str, shift)
      char ** str;
@@ -1363,7 +1556,7 @@
   *str = start;
   
   /* In the few cases where we might be able to accept something else
-     this error can be overridden */
+     this error can be overridden.  */
   sprintf (buff, _("Register expected, not '%.100s'"), start);
   inst.error = buff;
 
@@ -1389,7 +1582,7 @@
     }
 
   /* In the few cases where we might be able to accept something else
-     this error can be overridden */
+     this error can be overridden.  */
   inst.error = _("<psr(f)> expected");
 
   /* Restore the start point.  */
@@ -1399,12 +1592,11 @@
 
 static int
 co_proc_number (str)
-     char **str;
+     char ** str;
 {
   int processor, pchar;
 
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
 
   /* The data sheet seems to imply that just a number on its own is valid
      here, but the RISC iX assembler seems to accept a prefix 'p'.  We will
@@ -1444,8 +1636,7 @@
 {
   expressionS expr;
 
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
 
   memset (&expr, '\0', sizeof (expr));
 
@@ -1483,10 +1674,10 @@
     }
 
   /* In the few cases where we might be able to accept something else
-     this error can be overridden */
+     this error can be overridden.  */
   inst.error = _("Co-processor register expected");
 
-  /* Restore the start point */
+  /* Restore the start point.  */
   *str = start;
   return FAIL;
 }
@@ -1507,10 +1698,10 @@
     }
 
   /* In the few cases where we might be able to accept something else
-     this error can be overridden */
+     this error can be overridden.  */
   inst.error = _("Floating point register expected");
 
-  /* Restore the start point */
+  /* Restore the start point.  */
   *str = start;
   return FAIL;
 }
@@ -1521,8 +1712,7 @@
 {
   int offset;
 
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
 
   if (! is_immediate_prefix (**str))
     {
@@ -1577,14 +1767,12 @@
       int reg;
 
       p++;
-      while (*p == ' ')
-	p++;
+      skip_whitespace (p);
 
       if ((reg = reg_required_here (& p, 16)) == FAIL)
 	return FAIL;
 
-      while (*p == ' ')
-	p++;
+      skip_whitespace (p);
 
       if (*p == ']')
 	{
@@ -1622,8 +1810,7 @@
 	  if (cp_address_offset (& p) == FAIL)
 	    return FAIL;
 
-	  while (*p == ' ')
-	    p++;
+	  skip_whitespace (p);
 
 	  if (*p++ != ']')
 	    {
@@ -1631,8 +1818,7 @@
 	      return FAIL;
 	    }
 
-	  while (*p == ' ')
-	    p++;
+	  skip_whitespace (p);
 
 	  if (*p == '!')
 	    {
@@ -1669,8 +1855,8 @@
      char * str;
      unsigned long flags;
 {
-  /* Do nothing really */
-  inst.instruction |= flags; /* This is pointless */
+  /* Do nothing really.  */
+  inst.instruction |= flags; /* This is pointless.  */
   end_of_line (str);
   return;
 }
@@ -1680,13 +1866,12 @@
      char *str;
      unsigned long flags;
 {
-  /* Only one syntax */
-  while (*str == ' ')
-    str++;
+  /* Only one syntax.  */
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
@@ -1702,7 +1887,7 @@
   return;
 }
 
-/* Three possible forms: "<psr>, Rm", "<psrf>, Rm", "<psrf>, #expression" */
+/* Three possible forms: "<psr>, Rm", "<psrf>, Rm", "<psrf>, #expression".  */
 static void
 do_msr (str, flags)
      char * str;
@@ -1710,8 +1895,7 @@
 {
   int reg;
 
-  while (*str == ' ')
-    str ++;
+  skip_whitespace (str);
 
   if (psr_required_here (&str, CPSR_ALL, SPSR_ALL) == SUCCESS)
     {
@@ -1721,7 +1905,7 @@
       if (skip_past_comma (&str) == FAIL
 	  || (reg = reg_required_here (&str, 0)) == FAIL)
 	{
-	  inst.error = bad_args;
+	  inst.error = BAD_ARGS;
 	  return;
 	}
     }
@@ -1733,13 +1917,13 @@
 	inst.instruction |= PSR_CONTROL;
       else
 	{
-	  inst.error = bad_args;
+	  inst.error = BAD_ARGS;
 	  return;
 	}
       
       if (skip_past_comma (&str) == FAIL)
 	{
-	  inst.error = bad_args;
+	  inst.error = BAD_ARGS;
 	  return;
 	}
       
@@ -1747,7 +1931,7 @@
       
       if ((reg = reg_required_here (& str, 0)) != FAIL)
 	;
-      /* Immediate expression */
+      /* Immediate expression.  */
       else if (is_immediate_prefix (* str))
 	{
 	  str ++;
@@ -1767,7 +1951,7 @@
 	  else
 	    {
 	      unsigned value = validate_immediate (inst.reloc.exp.X_add_number);
-	      if (value == FAIL)
+	      if (value == (unsigned) FAIL)
 		{
 		  inst.error = _("Invalid constant");
 		  return;
@@ -1804,27 +1988,26 @@
 {
   int rdlo, rdhi, rm, rs;
 
-  /* only one format "rdlo, rdhi, rm, rs" */
-  while (*str == ' ')
-    str++;
+  /* Only one format "rdlo, rdhi, rm, rs" */
+  skip_whitespace (str);
 
   if ((rdlo = reg_required_here (&str, 12)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (skip_past_comma (&str) == FAIL
       || (rdhi = reg_required_here (&str, 16)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (skip_past_comma (&str) == FAIL
       || (rm = reg_required_here (&str, 0)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
@@ -1835,13 +2018,13 @@
   if (skip_past_comma (&str) == FAIL
       || (rs = reg_required_here (&str, 8)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rdhi == REG_PC || rdhi == REG_PC || rdhi == REG_PC || rdhi == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
    
@@ -1857,32 +2040,31 @@
 {
   int rd, rm;
   
-  /* only one format "rd, rm, rs" */
-  while (*str == ' ')
-    str++;
+  /* Only one format "rd, rm, rs" */
+  skip_whitespace (str);
 
   if ((rd = reg_required_here (&str, 16)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rd == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
   if (skip_past_comma (&str) == FAIL
       || (rm = reg_required_here (&str, 0)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rm == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
@@ -1892,13 +2074,13 @@
   if (skip_past_comma (&str) == FAIL
       || (rm = reg_required_here (&str, 8)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rm == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
@@ -1914,32 +2096,31 @@
 {
   int rd, rm;
 
-  /* only one format "rd, rm, rs, rn" */
-  while (*str == ' ')
-    str++;
+  /* Only one format "rd, rm, rs, rn" */
+  skip_whitespace (str);
 
   if ((rd = reg_required_here (&str, 16)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rd == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
   if (skip_past_comma (&str) == FAIL
       || (rm = reg_required_here (&str, 0)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rm == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
@@ -1951,13 +2132,13 @@
       || skip_past_comma (&str) == FAIL
       || (rm = reg_required_here (&str, 12)) == FAIL)
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
   if (rd == REG_PC || rm == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
@@ -2039,14 +2220,14 @@
 walk_no_bignums (sp)
      symbolS * sp;
 {
-  if (sp->sy_value.X_op == O_big)
+  if (symbol_get_value_expression (sp)->X_op == O_big)
     return 1;
 
-  if (sp->sy_value.X_add_symbol)
+  if (symbol_get_value_expression (sp)->X_add_symbol)
     {
-      return (walk_no_bignums (sp->sy_value.X_add_symbol)
-	      || (sp->sy_value.X_op_symbol
-		  && walk_no_bignums (sp->sy_value.X_op_symbol)));
+      return (walk_no_bignums (symbol_get_value_expression (sp)->X_add_symbol)
+	      || (symbol_get_value_expression (sp)->X_op_symbol
+		  && walk_no_bignums (symbol_get_value_expression (sp)->X_op_symbol)));
     }
 
   return 0;
@@ -2110,8 +2291,7 @@
   char * p;
   char   c;
     
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
     
   for (p = *str; isalpha (*p); p++)
     ;
@@ -2136,9 +2316,8 @@
 	  return SUCCESS;
 	}
 
-      while (*p == ' ')
-	p++;
-
+      skip_whitespace (p);
+      
       if (unrestrict && reg_required_here (&p, 8) != FAIL)
 	{
 	  inst.instruction |= shft->value | SHIFT_BY_REG;
@@ -2281,7 +2460,7 @@
       return FAIL;
     }
 
-  if (value == FAIL)
+  if (value == (unsigned) FAIL)
     return FAIL;
 
   *instruction &= OPCODE_MASK;
@@ -2296,16 +2475,14 @@
   int value;
   expressionS expr;
 
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
     
   if (reg_required_here (str, 0) != FAIL)
     {
       if (skip_past_comma (str) == SUCCESS)
-	{
-	  /* Shift operation on register */
-	  return decode_shift (str, NO_SHIFT_RESTRICT);
-	}
+	/* Shift operation on register.  */
+	return decode_shift (str, NO_SHIFT_RESTRICT);
+
       return SUCCESS;
     }
   else
@@ -2315,6 +2492,7 @@
 	{
 	  (*str)++;
 	  inst.error = NULL;
+	  
 	  if (my_get_expression (&inst.reloc.exp, str))
 	    return FAIL;
 
@@ -2384,8 +2562,7 @@
 fp_op2 (str)
      char ** str;
 {
-  while (**str == ' ')
-    (*str)++;
+  skip_whitespace (* str);
 
   if (fp_reg_required_here (str, 0) != FAIL)
     return SUCCESS;
@@ -2397,8 +2574,8 @@
 	  int i;
 
 	  inst.error = NULL;
-	  while (**str == ' ')
-	    (*str)++;
+
+	  skip_whitespace (* str);
 
 	  /* First try and match exact strings, this is to guarantee that
 	     some formats will work even for cross assembly */
@@ -2442,8 +2619,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL
       || skip_past_comma (&str) == FAIL
@@ -2452,7 +2628,7 @@
       || data_op2 (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2467,23 +2643,22 @@
      unsigned long flags;
 {
   /* This is a pseudo-op of the form "adr rd, label" to be converted
-     into a relative address of the form "add rd, pc, #label-.-8" */
-
-  while (*str == ' ')
-    str++;
+     into a relative address of the form "add rd, pc, #label-.-8".  */
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL
       || skip_past_comma (&str) == FAIL
       || my_get_expression (&inst.reloc.exp, &str))
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
+  
   /* Frag hacking will turn this into a sub instruction if the offset turns
      out to be negative.  */
   inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE;
-  inst.reloc.exp.X_add_number -= 8; /* PC relative adjust */
+  inst.reloc.exp.X_add_number -= 8; /* PC relative adjust.  */
   inst.reloc.pc_rel = 1;
   inst.instruction |= flags;
   end_of_line (str);
@@ -2491,17 +2666,50 @@
 }
 
 static void
+do_adrl (str, flags)
+     char *        str;
+     unsigned long flags;
+{
+  /* This is a pseudo-op of the form "adrl rd, label" to be converted
+     into a relative address of the form:
+     	add rd, pc, #low(label-.-8)"
+     	add rd, rd, #high(label-.-8)"   */
+
+  skip_whitespace (str);
+
+  if (reg_required_here (& str, 12) == FAIL
+      || skip_past_comma (& str) == FAIL
+      || my_get_expression (& inst.reloc.exp, & str))
+    {
+      if (!inst.error)
+	inst.error = BAD_ARGS;
+      return;
+    }
+  
+  end_of_line (str);
+  
+  /* Frag hacking will turn this into a sub instruction if the offset turns
+     out to be negative.  */
+  inst.reloc.type              = BFD_RELOC_ARM_ADRL_IMMEDIATE;
+  inst.reloc.exp.X_add_number -= 8; /* PC relative adjust */
+  inst.reloc.pc_rel            = 1;
+  inst.instruction            |= flags;
+  inst.size                    = INSN_SIZE * 2;
+  
+  return;
+}
+
+static void
 do_cmp (str, flags)
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 16) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2509,7 +2717,7 @@
       || data_op2 (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2526,13 +2734,12 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2540,7 +2747,7 @@
       || data_op2 (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2584,7 +2791,7 @@
           /* Halfword and signextension instructions have the
              immediate value split across bits 11..8 and bits 3..0 */
           if (hwse)
-            inst.instruction |= add | HWOFFSET_IMM | (value >> 4) << 8 | value & 0xF;
+            inst.instruction |= add | HWOFFSET_IMM | ((value >> 4) << 8) | (value & 0xF);
           else
             inst.instruction |= add | value;
 	}
@@ -2635,7 +2842,8 @@
   /* This is not ideal, but it is the simplest way of dealing with the
      ARM7T halfword instructions (since they use a different
      encoding, but the same mnemonic): */
-  if (halfword = ((flags & 0x80000000) != 0))
+  halfword = (flags & 0x80000000) != 0;
+  if (halfword)
     {
       /* This is actually a load/store of a halfword, or a
          signed-extension load */
@@ -2652,13 +2860,12 @@
       flags = 0;
     }
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
     
   if ((conflict_reg = reg_required_here (& str, 12)) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -2673,29 +2880,29 @@
       int reg;
 
       str++;
-      while (*str == ' ')
-	str++;
+
+      skip_whitespace (str);
 
       if ((reg = reg_required_here (&str, 16)) == FAIL)
 	return;
 
-      conflict_reg = (((conflict_reg == reg)
-		       && (inst.instruction & LOAD_BIT))
-		      ? 1 : 0);
+      /* Conflicts can occur on stores as well as loads.  */
+      conflict_reg = (conflict_reg == reg);
 
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if (*str == ']')
 	{
-	  str++;
+	  str ++;
+	  
 	  if (skip_past_comma (&str) == SUCCESS)
 	    {
 	      /* [Rn],... (post inc) */
 	      if (ldst_extend (&str, halfword) == FAIL)
 		return;
 	      if (conflict_reg)
-		as_warn (_("destination register same as write-back base\n"));
+		as_warn (_("%s register same as write-back base"),
+			 (inst.instruction & LOAD_BIT) ? _("destination") : _("source") );
 	    }
 	  else
 	    {
@@ -2703,13 +2910,13 @@
               if (halfword)
                 inst.instruction |= HWOFFSET_IMM;
 
-              while (*str == ' ')
-               str++;
+              skip_whitespace (str);
 
               if (*str == '!')
                {
                  if (conflict_reg)
-                  as_warn (_("destination register same as write-back base\n"));
+		   as_warn (_("%s register same as write-back base"),
+			    (inst.instruction & LOAD_BIT) ? _("destination") : _("source") );
                  str++;
                  inst.instruction |= WRITE_BACK;
                }
@@ -2732,8 +2939,7 @@
 	  if (ldst_extend (&str, halfword) == FAIL)
 	    return;
 
-	  while (*str == ' ')
-	    str++;
+	  skip_whitespace (str);
 
 	  if (*str++ != ']')
 	    {
@@ -2741,13 +2947,13 @@
 	      return;
 	    }
 
-	  while (*str == ' ')
-	    str++;
+	  skip_whitespace (str);
 
 	  if (*str == '!')
 	    {
 	      if (conflict_reg)
-		as_tsktsk (_("destination register same as write-back base\n"));
+		as_warn (_("%s register same as write-back base"),
+			 (inst.instruction & LOAD_BIT) ? _("destination") : _("source") );
 	      str++;
 	      inst.instruction |= WRITE_BACK;
 	    }
@@ -2758,8 +2964,7 @@
       /* Parse an "ldr Rd, =expr" instruction; this is another pseudo op */
       str++;
 
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if (my_get_expression (&inst.reloc.exp, &str))
 	return;
@@ -2816,7 +3021,9 @@
         }
       else
         inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM;
+#ifndef TE_WINCE
       inst.reloc.exp.X_add_number -= 8;  /* PC rel adjust */
+#endif
       inst.reloc.pc_rel = 1;
       inst.instruction |= (REG_PC << 16);
       pre_inc = 1;
@@ -2853,8 +3060,7 @@
 	    {
 	      int reg;
 	    
-	      while (*str == ' ')
-		str++;
+	      skip_whitespace (str);
 
 	      if ((reg = reg_required_here (& str, -1)) == FAIL)
 		return FAIL;
@@ -2892,8 +3098,7 @@
 	    } while (skip_past_comma (&str) != FAIL
 		     || (in_range = 1, *str++ == '-'));
 	  str--;
-	  while (*str == ' ')
-	    str++;
+	  skip_whitespace (str);
 
 	  if (*str++ != '}')
 	    {
@@ -2944,8 +3149,7 @@
 	    }
 	}
 
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if (*str == '|' || *str == '+')
 	{
@@ -2966,8 +3170,7 @@
   int base_reg;
   long range;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((base_reg = reg_required_here (&str, 16)) == FAIL)
     return;
@@ -2978,8 +3181,8 @@
       return;
     }
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
+
   if (*str == '!')
     {
       flags |= WRITE_BACK;
@@ -2990,14 +3193,14 @@
       || (range = reg_list (&str)) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
   if (*str == '^')
     {
       str++;
-      flags |= MULTI_SET_PSR;
+      flags |= LDM_TYPE_2_OR_3;
     }
 
   inst.instruction |= flags | range;
@@ -3010,8 +3213,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
   
   /* Allow optional leading '#'.  */
   if (is_immediate_prefix (*str))
@@ -3036,8 +3238,7 @@
 {
   int reg;
   
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((reg = reg_required_here (&str, 12)) == FAIL)
     return;
@@ -3052,7 +3253,7 @@
       || (reg = reg_required_here (&str, 0)) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3065,24 +3266,22 @@
   if (skip_past_comma (&str) == FAIL
       || *str++ != '[')
     {
-      inst.error = bad_args;
+      inst.error = BAD_ARGS;
       return;
     }
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((reg = reg_required_here (&str, 16)) == FAIL)
     return;
 
   if (reg == REG_PC)
     {
-      inst.error = bad_pc;
+      inst.error = BAD_PC;
       return;
     }
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (*str++ != ']')
     {
@@ -3098,7 +3297,7 @@
 static void
 do_branch (str, flags)
      char *        str;
-     unsigned long flags;
+     unsigned long flags ATTRIBUTE_UNUSED;
 {
   if (my_get_expression (&inst.reloc.exp, &str))
     return;
@@ -3144,37 +3343,37 @@
 static void
 do_bx (str, flags)
      char *        str;
-     unsigned long flags;
+     unsigned long flags ATTRIBUTE_UNUSED;
 {
   int reg;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((reg = reg_required_here (&str, 0)) == FAIL)
-    return;
+    {
+      inst.error = BAD_ARGS;
+      return;
+    }
 
   if (reg == REG_PC)
-    as_tsktsk (_("Use of r15 in bx has undefined behaviour"));
+    inst.error = BAD_PC;
 
   end_of_line (str);
-  return;
 }
 
 static void
 do_cdp (str, flags)
      char *        str;
-     unsigned long flags;
+     unsigned long flags ATTRIBUTE_UNUSED;
 {
   /* Co-processor data operation.
      Format: CDP{cond} CP#,<expr>,CRd,CRn,CRm{,<expr>}  */
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (co_proc_number (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3182,7 +3381,7 @@
       || cp_opc_expr (&str, 20,4) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3190,7 +3389,7 @@
       || cp_reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3198,7 +3397,7 @@
       || cp_reg_required_here (&str, 16) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3206,7 +3405,7 @@
       || cp_reg_required_here (&str, 0) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3215,7 +3414,7 @@
       if (cp_opc_expr (&str, 5, 3) == FAIL)
 	{
 	  if (!inst.error)
-	    inst.error = bad_args;
+	    inst.error = BAD_ARGS;
 	  return;
 	}
     }
@@ -3232,13 +3431,12 @@
   /* Co-processor register load/store.
      Format: <LDC|STC{cond}[L] CP#,CRd,<address>  */
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (co_proc_number (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3246,7 +3444,7 @@
       || cp_reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3254,7 +3452,7 @@
       || cp_address_required_here (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3271,13 +3469,12 @@
   /* Co-processor register transfer.
      Format: <MCR|MRC>{cond} CP#,<expr1>,Rd,CRn,CRm{,<expr2>}  */
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (co_proc_number (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3285,7 +3482,7 @@
       || cp_opc_expr (&str, 21, 3) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3293,7 +3490,7 @@
       || reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3301,7 +3498,7 @@
       || cp_reg_required_here (&str, 16) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3309,7 +3506,7 @@
       || cp_reg_required_here (&str, 0) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3318,10 +3515,14 @@
       if (cp_opc_expr (&str, 5, 3) == FAIL)
 	{
 	  if (!inst.error)
-	    inst.error = bad_args;
+	    inst.error = BAD_ARGS;
 	  return;
 	}
     }
+  if (flags)
+    {
+      inst.error = BAD_COND;
+    }
 
   end_of_line (str);
   return;
@@ -3330,18 +3531,17 @@
 static void
 do_fp_ctrl (str, flags)
      char *        str;
-     unsigned long flags;
+     unsigned long flags ATTRIBUTE_UNUSED;
 {
   /* FP control registers.
      Format: <WFS|RFS|WFC|RFC>{cond} Rn  */
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3352,10 +3552,9 @@
 static void
 do_fp_ldst (str, flags)
      char *        str;
-     unsigned long flags;
+     unsigned long flags ATTRIBUTE_UNUSED;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   switch (inst.suffix)
     {
@@ -3377,7 +3576,7 @@
   if (fp_reg_required_here (&str, 12) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3385,7 +3584,7 @@
       || cp_address_required_here (&str) == FAIL)
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3399,13 +3598,12 @@
 {
   int num_regs;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (fp_reg_required_here (&str, 12) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3463,23 +3661,21 @@
 	  || *str != '[')
 	{
 	  if (! inst.error)
-	    inst.error = bad_args;
+	    inst.error = BAD_ARGS;
 	  return;
 	}
 
       str++;
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if ((reg = reg_required_here (&str, 16)) == FAIL)
 	return;
 
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if (*str != ']')
 	{
-	  inst.error = bad_args;
+	  inst.error = BAD_ARGS;
 	  return;
 	}
 
@@ -3527,7 +3723,7 @@
 	   || cp_address_required_here (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3539,8 +3735,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   switch (inst.suffix)
     {
@@ -3559,7 +3754,7 @@
   if (fp_reg_required_here (&str, 12) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3567,7 +3762,7 @@
       || fp_reg_required_here (&str, 16) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3575,7 +3770,7 @@
       || fp_op2 (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3589,8 +3784,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   switch (inst.suffix)
     {
@@ -3609,7 +3803,7 @@
   if (fp_reg_required_here (&str, 12) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3617,7 +3811,7 @@
       || fp_op2 (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3631,13 +3825,12 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (fp_reg_required_here (&str, 16) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3645,7 +3838,7 @@
       || fp_op2 (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3659,8 +3852,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   switch (inst.suffix)
     {
@@ -3679,7 +3871,7 @@
   if (fp_reg_required_here (&str, 16) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3687,7 +3879,7 @@
       || reg_required_here (&str, 12) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3701,8 +3893,7 @@
      char *        str;
      unsigned long flags;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (reg_required_here (&str, 12) == FAIL)
     return;
@@ -3711,7 +3902,7 @@
       || fp_reg_required_here (&str, 0) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3771,14 +3962,13 @@
 {
   int Rd, Rs, Rn = FAIL;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL
       || skip_past_comma (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3929,6 +4119,7 @@
 	    }
 	}
     }
+  
   end_of_line (str);
 }
 
@@ -3939,14 +4130,13 @@
 {
   int Rd, Rs, Rn = FAIL;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL
       || skip_past_comma (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -3954,7 +4144,7 @@
     {
       /* Two operand immediate format, set Rs to Rd.  */
       Rs = Rd;
-      str++;
+      str ++;
       if (my_get_expression (&inst.reloc.exp, &str))
 	return;
     }
@@ -4039,6 +4229,7 @@
 
       inst.instruction |= Rd | (Rs << 3);
     }
+  
   end_of_line (str);
 }
 
@@ -4049,14 +4240,13 @@
 {
   int Rd, Rs = FAIL;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL
       || skip_past_comma (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -4139,14 +4329,13 @@
 {
   int Rd, Rb, Ro = FAIL;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL
       || skip_past_comma (&str) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -4185,8 +4374,7 @@
       /* Parse an "ldr Rd, =expr" instruction; this is another pseudo op */
       str++;
 
-      while (*str == ' ')
-	str++;
+      skip_whitespace (str);
 
       if (my_get_expression (& inst.reloc.exp, & str))
 	return;
@@ -4350,18 +4538,14 @@
 {
   int Rd, Rs, Rn;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
-  if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL)
-    return;
-
-  if (skip_past_comma (&str) == FAIL
+  if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL
+      || skip_past_comma (&str) == FAIL
       || (Rs = thumb_reg (&str, THUMB_REG_LO)) == FAIL)
     {
-      if (! inst.error)
-	inst.error = bad_args;
-      return;
+    	inst.error = BAD_ARGS;
+      	return;
     }
 
   if (skip_past_comma (&str) != FAIL)
@@ -4374,7 +4558,7 @@
 	  || inst.instruction == T_OPCODE_NEG
  	  || inst.instruction == T_OPCODE_MVN)
 	{
-	  inst.error = bad_args;
+	  inst.error = BAD_ARGS;
 	  return;
 	}
 
@@ -4443,7 +4627,7 @@
   const char * name = S_GET_NAME (symbolP);
   symbolS *    new_target;
 
-  /* This definitonmust agree with the one in gcc/config/arm/thumb.c */
+  /* This definiton must agree with the one in gcc/config/arm/thumb.c */
 #define STUB_NAME ".real_start_of"
 
   if (name == NULL)
@@ -4476,8 +4660,9 @@
 do_t_branch23 (str)
      char * str;
 {
-  if (my_get_expression (&inst.reloc.exp, &str))
+  if (my_get_expression (& inst.reloc.exp, & str))
     return;
+  
   inst.reloc.type   = BFD_RELOC_THUMB_PCREL_BRANCH23;
   inst.reloc.pc_rel = 1;
   end_of_line (str);
@@ -4499,8 +4684,7 @@
 {
   int reg;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((reg = thumb_reg (&str, THUMB_REG_ANY)) == FAIL)
     return;
@@ -4529,8 +4713,7 @@
   int Rb;
   long range;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rb = thumb_reg (&str, THUMB_REG_LO)) == FAIL)
     return;
@@ -4544,7 +4727,7 @@
       || (range = reg_list (&str)) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -4593,8 +4776,7 @@
 {
   int Rd, Rb, Ro;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL
       || skip_past_comma (&str) == FAIL
@@ -4640,13 +4822,12 @@
 {
   long range;
 
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if ((range = reg_list (&str)) == FAIL)
     {
       if (! inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
@@ -4711,8 +4892,7 @@
 do_t_swi (str)
      char * str;
 {
-  while (*str == ' ')
-    str++;
+  skip_whitespace (str);
 
   if (my_get_expression (&inst.reloc.exp, &str))
     return;
@@ -4726,24 +4906,28 @@
 do_t_adr (str)
      char * str;
 {
-  /* This is a pseudo-op of the form "adr rd, label" to be converted
-     into a relative address of the form "add rd, pc, #label-.-4" */
-  while (*str == ' ')
-    str++;
+  int reg;
 
-  if (reg_required_here (&str, 4) == FAIL  /* Store Rd in temporary location inside instruction.  */
+  /* This is a pseudo-op of the form "adr rd, label" to be converted
+     into a relative address of the form "add rd, pc, #label-.-4".  */
+  skip_whitespace (str);
+
+  /* Store Rd in temporary location inside instruction.  */
+  if ((reg = reg_required_here (&str, 4)) == FAIL
+      || (reg > 7)  /* For Thumb reg must be r0..r7.  */
       || skip_past_comma (&str) == FAIL
       || my_get_expression (&inst.reloc.exp, &str))
     {
       if (!inst.error)
-	inst.error = bad_args;
+	inst.error = BAD_ARGS;
       return;
     }
 
   inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD;
-  inst.reloc.exp.X_add_number -= 4; /* PC relative adjust */
+  inst.reloc.exp.X_add_number -= 4; /* PC relative adjust.  */
   inst.reloc.pc_rel = 1;
-  inst.instruction |= REG_PC; /* Rd is already placed into the instruction */
+  inst.instruction |= REG_PC; /* Rd is already placed into the instruction.  */
+  
   end_of_line (str);
 }
 
@@ -4800,7 +4984,8 @@
 void
 md_begin ()
 {
-  int i;
+  unsigned mach;
+  unsigned int i;
   
   if (   (arm_ops_hsh = hash_new ()) == NULL
       || (arm_tops_hsh = hash_new ()) == NULL
@@ -4830,53 +5015,54 @@
   {
     unsigned int flags = 0;
     
-    /* Set the flags in the private structure */
+    /* Set the flags in the private structure.  */
     if (uses_apcs_26)      flags |= F_APCS26;
     if (support_interwork) flags |= F_INTERWORK;
     if (uses_apcs_float)   flags |= F_APCS_FLOAT;
     if (pic_code)          flags |= F_PIC;
+    if ((cpu_variant & FPU_ALL) == FPU_NONE) flags |= F_SOFT_FLOAT;
 
     bfd_set_private_flags (stdoutput, flags);
   }
 #endif
   
-  {
-    unsigned mach;
-    
-    /* Record the CPU type as well */
-    switch (cpu_variant & ARM_CPU_MASK)
-      {
-      case ARM_2:
-	mach = bfd_mach_arm_2;
-	break;
-	
-      case ARM_3: /* also ARM_250 */
-	mach = bfd_mach_arm_2a;
-	break;
-
-      default:
-      case ARM_6 | ARM_3 | ARM_2:	/* Actually no CPU type defined */
+  /* Record the CPU type as well.  */
+  switch (cpu_variant & ARM_CPU_MASK)
+    {
+    case ARM_2:
+      mach = bfd_mach_arm_2;
+      break;
+      
+    case ARM_3: 		/* Also ARM_250.  */
+      mach = bfd_mach_arm_2a;
+      break;
+      
+    default:
+    case ARM_6 | ARM_3 | ARM_2:	/* Actually no CPU type defined.  */
+      mach = bfd_mach_arm_4;
+      break;
+      
+    case ARM_7: 		/* Also ARM_6.  */
+      mach = bfd_mach_arm_3;
+      break;
+    }
+  
+  /* Catch special cases.  */
+  if (cpu_variant != (FPU_DEFAULT | CPU_DEFAULT))
+    {
+      if (cpu_variant & (ARM_EXT_V5 & ARM_THUMB))
+	mach = bfd_mach_arm_5T;
+      else if (cpu_variant & ARM_EXT_V5)
+	mach = bfd_mach_arm_5;
+      else if (cpu_variant & ARM_THUMB)
+	mach = bfd_mach_arm_4T;
+      else if ((cpu_variant & ARM_ARCH_V4) == ARM_ARCH_V4)
 	mach = bfd_mach_arm_4;
-	break;
-	
-      case ARM_7: 			/* also ARM_6 */
-	mach = bfd_mach_arm_3;
-	break;
-      }
-
-    /* Catch special cases */
-    if (cpu_variant != (FPU_DEFAULT | CPU_DEFAULT))
-      {
-	if (cpu_variant & ARM_THUMB)
-	  mach = bfd_mach_arm_4T;
-	else if ((cpu_variant & ARM_ARCHv4) == ARM_ARCHv4)
-	  mach = bfd_mach_arm_4;
-	else if (cpu_variant & ARM_LONGMUL)
-	  mach = bfd_mach_arm_3M;
-      }
-	
-    bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach);
-  }
+      else if (cpu_variant & ARM_LONGMUL)
+	mach = bfd_mach_arm_3M;
+    }
+  
+  bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach);
 }
 
 /* Turn an integer of n bytes (in val) into a stream of bytes appropriate
@@ -4884,8 +5070,7 @@
    This knows about the endian-ness of the target machine and does
    THE RIGHT THING, whatever it is.  Possible values for n are 1 (byte)
    2 (short) and 4 (long)  Floating numbers are put out as a series of
-   LITTLENUMS (shorts, here at least)
-   */
+   LITTLENUMS (shorts, here at least).  */
 void
 md_number_to_chars (buf, val, n)
      char * buf;
@@ -5010,8 +5195,7 @@
   return 0;
 }
 
-/* The knowledge of the PC's pipeline offset is built into the relocs
-   for the ELF port and into the insns themselves for the COFF port.  */
+/* The knowledge of the PC's pipeline offset is built into the insns themselves.  */ 
 long
 md_pcrel_from (fixP)
      fixS * fixP;
@@ -5025,26 +5209,31 @@
     {
       /* PC relative addressing on the Thumb is slightly odd
 	 as the bottom two bits of the PC are forced to zero
-	 for the calculation */
+	 for the calculation.  */
       return (fixP->fx_where + fixP->fx_frag->fr_address) & ~3;
     }
-  
+
+#ifdef TE_WINCE
+  /* The pattern was adjusted to accomodate CE's off-by-one fixups,
+     so we un-adjust here to compensate for the accomodation.  */
+  return fixP->fx_where + fixP->fx_frag->fr_address + 8;
+#else
   return fixP->fx_where + fixP->fx_frag->fr_address;
+#endif
 }
 
 /* Round up a section size to the appropriate boundary. */
 valueT
 md_section_align (segment, size)
-     segT   segment;
+     segT   segment ATTRIBUTE_UNUSED;
      valueT size;
 {
 #ifdef OBJ_ELF
-  /* Don't align the dwarf2 debug sections */
-  if (!strncmp (segment->name, ".debug", 5))
-    return size;
-#endif
+  return size;
+#else
   /* Round all sects to multiple of 4 */
   return (size + 3) & ~3;
+#endif
 }
 
 /* Under ELF we need to default _GLOBAL_OFFSET_TABLE.  Otherwise 
@@ -5163,7 +5352,7 @@
 
   /* Note whether this will delete the relocation.  */
 #if 0 /* patch from REarnshaw to JDavis (disabled for the moment, since it doesn't work fully) */
-  if ((fixP->fx_addsy == 0 || fixP->fx_addsy->sy_value.X_op == O_constant)
+  if ((fixP->fx_addsy == 0 || symbol_constant_p (fixP->fx_addsy))
       && !fixP->fx_pcrel)
 #else
   if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
@@ -5179,14 +5368,16 @@
 	  && S_IS_DEFINED (fixP->fx_addsy)
 	  && S_GET_SEGMENT (fixP->fx_addsy) != seg)
 	{
-	  if (fixP->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH)
+	  if (target_oabi
+	      && (fixP->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
+		))
 	    value = 0;
 	  else
 	    value += md_pcrel_from (fixP);
 	}
     }
 
-  fixP->fx_addnumber = value;	/* Remember value for emit_reloc */
+  fixP->fx_addnumber = value;	/* Remember value for emit_reloc.  */
 
   switch (fixP->fx_r_type)
     {
@@ -5200,7 +5391,8 @@
 	  && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL)
 	{
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
-			_("invalid constant (%x) after fixup\n"), value);
+			_("invalid constant (%lx) after fixup"),
+			(unsigned long) value);
 	  break;
 	}
 
@@ -5208,15 +5400,62 @@
       md_number_to_chars (buf, (valueT) newimm, INSN_SIZE);
       break;
 
-     case BFD_RELOC_ARM_OFFSET_IMM:
+    case BFD_RELOC_ARM_ADRL_IMMEDIATE:
+      {
+	unsigned int highpart = 0;
+	unsigned int newinsn  = 0xe1a00000; /* nop */
+	newimm = validate_immediate (value);
+	temp = md_chars_to_number (buf, INSN_SIZE);
+
+	/* If the instruction will fail, see if we can fix things up by
+	   changing the opcode.  */
+	if (newimm == (unsigned int) FAIL
+	    && (newimm = negate_data_op (& temp, value)) == (unsigned int) FAIL)
+	  {
+	    /* No ?  OK - try using two ADD instructions to generate the value.  */
+	    newimm = validate_immediate_twopart (value, & highpart);
+
+	    /* Yes - then make sure that the second instruction is also an add.  */
+	    if (newimm != (unsigned int) FAIL)
+	      newinsn = temp;
+	    /* Still No ?  Try using a negated value.  */
+	    else if (validate_immediate_twopart (- value, & highpart) != (unsigned int) FAIL)
+		temp = newinsn = (temp & OPCODE_MASK) | OPCODE_SUB << DATA_OP_SHIFT;
+	    /* Otherwise - give up.  */
+	    else
+	      {
+		as_bad_where (fixP->fx_file, fixP->fx_line,
+			      _("Unable to compute ADRL instructions for PC offset of 0x%x"), value);
+		break;
+	      }
+
+	    /* Replace the first operand in the 2nd instruction (which is the PC)
+	       with the destination register.  We have already added in the PC in the
+	       first instruction and we do not want to do it again.  */
+	    newinsn &= ~ 0xf0000;
+	    newinsn |= ((newinsn & 0x0f000) << 4);
+	  }
+
+	newimm |= (temp & 0xfffff000);
+	md_number_to_chars (buf, (valueT) newimm, INSN_SIZE);
+
+	highpart |= (newinsn & 0xfffff000);
+	md_number_to_chars (buf + INSN_SIZE, (valueT) highpart, INSN_SIZE);
+      }
+      break;
+
+    case BFD_RELOC_ARM_OFFSET_IMM:
       sign = value >= 0;
-      if ((value = validate_offset_imm (value, 0)) == FAIL)
+      
+      if (value < 0)
+	value = - value;
+      
+      if (validate_offset_imm (value, 0) == FAIL)
         {
-          as_bad (_("bad immediate value for offset (%d)"), val);
+	  as_bad_where (fixP->fx_file, fixP->fx_line, 
+                        _("bad immediate value for offset (%ld)"), (long) value);
           break;
         }
-      if (value < 0)
-	value = -value;
 
       newval = md_chars_to_number (buf, INSN_SIZE);
       newval &= 0xff7ff000;
@@ -5227,34 +5466,37 @@
      case BFD_RELOC_ARM_OFFSET_IMM8:
      case BFD_RELOC_ARM_HWLITERAL:
       sign = value >= 0;
-      if ((value = validate_offset_imm (value, 1)) == FAIL)
+      
+      if (value < 0)
+	value = - value;
+
+      if (validate_offset_imm (value, 1) == FAIL)
         {
           if (fixP->fx_r_type == BFD_RELOC_ARM_HWLITERAL)
 	    as_bad_where (fixP->fx_file, fixP->fx_line, 
-			_("invalid literal constant: pool needs to be closer\n"));
+			_("invalid literal constant: pool needs to be closer"));
           else
-            as_bad (_("bad immediate value for offset (%d)"), value);
+            as_bad (_("bad immediate value for half-word offset (%ld)"),
+		    (long) value);
           break;
         }
 
-      if (value < 0)
-	value = -value;
-
       newval = md_chars_to_number (buf, INSN_SIZE);
       newval &= 0xff7ff0f0;
-      newval |= ((value >> 4) << 8) | value & 0xf | (sign ? INDEX_UP : 0);
+      newval |= ((value >> 4) << 8) | (value & 0xf) | (sign ? INDEX_UP : 0);
       md_number_to_chars (buf, newval, INSN_SIZE);
       break;
 
     case BFD_RELOC_ARM_LITERAL:
       sign = value >= 0;
+      
       if (value < 0)
-	value = -value;
+	value = - value;
 
-      if ((value = validate_offset_imm (value, 0)) == FAIL)
+      if (validate_offset_imm (value, 0) == FAIL)
 	{
 	  as_bad_where (fixP->fx_file, fixP->fx_line, 
-			_("invalid literal constant: pool needs to be closer\n"));
+			_("invalid literal constant: pool needs to be closer"));
 	  break;
 	}
 
@@ -5315,19 +5557,67 @@
 
     case BFD_RELOC_ARM_PCREL_BRANCH:
       newval = md_chars_to_number (buf, INSN_SIZE);
+
+      /* Sign-extend a 24-bit number.  */
+#define SEXT24(x)	((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
+
 #ifdef OBJ_ELF
-      newval &= 0xff000000;
       if (! target_oabi)
-        value = fixP->fx_offset;
-      else
-#else
-	value = (value >> 2) & 0x00ffffff;
+	value = fixP->fx_offset;
 #endif
-      value  = (value + (newval & 0x00ffffff)) & 0x00ffffff;
-      newval = value | (newval & 0xff000000);
+
+      /* We are going to store value (shifted right by two) in the
+	 instruction, in a 24 bit, signed field.  Thus we need to check
+	 that none of the top 8 bits of the shifted value (top 7 bits of
+         the unshifted, unsigned value) are set, or that they are all set.  */
+      if ((value & 0xfe000000UL) != 0
+	  && ((value & 0xfe000000UL) != 0xfe000000UL))
+	{
+#ifdef OBJ_ELF
+	  /* Normally we would be stuck at this point, since we cannot store
+	     the absolute address that is the destination of the branch in the
+	     24 bits of the branch instruction.  If however, we happen to know
+	     that the destination of the branch is in the same section as the
+	     branch instruciton itself, then we can compute the relocation for
+	     ourselves and not have to bother the linker with it.
+	     
+	     FIXME: The tests for OBJ_ELF and ! target_oabi are only here
+	     because I have not worked out how to do this for OBJ_COFF or
+	     target_oabi.  */
+	  if (! target_oabi
+	      && fixP->fx_addsy != NULL
+	      && S_IS_DEFINED (fixP->fx_addsy)
+	      && S_GET_SEGMENT (fixP->fx_addsy) == seg)
+	    {
+	      /* Get pc relative value to go into the branch.  */
+	      value = * val;
+
+	      /* Permit a backward branch provided that enough bits are set.
+		 Allow a forwards branch, provided that enough bits are clear.  */
+	      if ((value & 0xfe000000UL) == 0xfe000000UL
+		  || (value & 0xfe000000UL) == 0)
+		fixP->fx_done = 1;
+	    }
+	  
+	  if (! fixP->fx_done)
+#endif
+	    as_bad_where (fixP->fx_file, fixP->fx_line,
+			  _("gas can't handle same-section branch dest >= 0x04000000"));
+	}
+
+      value >>= 2;
+      value += SEXT24 (newval);
+      
+      if ((value & 0xff000000UL) != 0
+	  && ((value & 0xff000000UL) != 0xff000000UL))
+	as_bad_where (fixP->fx_file, fixP->fx_line,
+		      _("out of range branch"));
+      
+      newval = (value & 0x00ffffff) | (newval & 0xff000000);
       md_number_to_chars (buf, newval, INSN_SIZE);
       break;
 
+
     case BFD_RELOC_THUMB_PCREL_BRANCH9: /* conditional branch */
       newval = md_chars_to_number (buf, THUMB_SIZE);
       {
@@ -5370,6 +5660,9 @@
         diff = ((newval & 0x7ff) << 12) | ((newval2 & 0x7ff) << 1);
         if (diff & 0x400000)
 	  diff |= ~0x3fffff;
+#ifdef OBJ_ELF
+	value = fixP->fx_offset;
+#endif
         value += diff;
         if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff))
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -5468,7 +5761,7 @@
 
 	  if ((value + 2) & ~0x3fe)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
-			  _("Invalid offset"));
+			  _("Invalid offset, value too big (0x%08X)"), value);
 
           /* Round up, since pc will be rounded down.  */
 	  newval |= (value + 2) >> 2;
@@ -5477,34 +5770,35 @@
 	case 9: /* SP load/store */
 	  if (value & ~0x3fc)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
-			  _("Invalid offset"));
+			  _("Invalid offset, value too big (0x%08X)"), value);
 	  newval |= value >> 2;
 	  break;
 
 	case 6: /* Word load/store */
 	  if (value & ~0x7c)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
-			  _("Invalid offset"));
+			  _("Invalid offset, value too big (0x%08X)"), value);
 	  newval |= value << 4; /* 6 - 2 */
 	  break;
 
 	case 7: /* Byte load/store */
 	  if (value & ~0x1f)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
-			  _("Invalid offset"));
+			  _("Invalid offset, value too big (0x%08X)"), value);
 	  newval |= value << 6;
 	  break;
 
 	case 8: /* Halfword load/store */
 	  if (value & ~0x3e)
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
-			  _("Invalid offset"));
+			  _("Invalid offset, value too big (0x%08X)"), value);
 	  newval |= value << 5; /* 6 - 1 */
 	  break;
 
 	default:
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
-			"Unable to process relocation for thumb opcode: %x", newval);
+			"Unable to process relocation for thumb opcode: %lx",
+			(unsigned long) newval);
 	  break;
 	}
       md_number_to_chars (buf, newval, THUMB_SIZE);
@@ -5543,7 +5837,8 @@
             if (subtract ||
                 value & ~0x3fc)
               as_bad_where (fixP->fx_file, fixP->fx_line,
-                            _("Invalid immediate for address calculation (value = 0x%08X)"), value);
+                            _("Invalid immediate for address calculation (value = 0x%08lX)"),
+			    (unsigned long) value);
             newval = (rs == REG_PC ? T_OPCODE_ADD_PC : T_OPCODE_ADD_SP);
             newval |= rd << 8;
             newval |= value >> 2;
@@ -5576,7 +5871,8 @@
         case 0x05: /* 8bit immediate CMP */
           if (value < 0 || value > 255)
             as_bad_where (fixP->fx_file, fixP->fx_line,
-                          _("Invalid immediate: %d is too large"), value);
+                          _("Invalid immediate: %ld is too large"),
+			  (long) value);
           newval |= value;
           break;
 
@@ -5590,7 +5886,7 @@
       /* 5bit shift value (0..31) */
       if (value < 0 || value > 31)
 	as_bad_where (fixP->fx_file, fixP->fx_line,
-		      _("Illegal Thumb shift value: %d"), value);
+		      _("Illegal Thumb shift value: %ld"), (long) value);
       newval = md_chars_to_number (buf, THUMB_SIZE) & 0xf03f;
       newval |= value << 6;
       md_number_to_chars (buf, newval , THUMB_SIZE);
@@ -5604,7 +5900,7 @@
     case BFD_RELOC_NONE:
     default:
       as_bad_where (fixP->fx_file, fixP->fx_line,
-		    _("Bad relocation fixup type (%d)\n"), fixP->fx_r_type);
+		    _("Bad relocation fixup type (%d)"), fixP->fx_r_type);
     }
 
   return 1;
@@ -5614,7 +5910,7 @@
    format.  */
 arelent *
 tc_gen_reloc (section, fixp)
-     asection * section;
+     asection * section ATTRIBUTE_UNUSED;
      fixS * fixp;
 {
   arelent * reloc;
@@ -5622,7 +5918,8 @@
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
 
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   /* @@ Why fx_addnumber sometimes and fx_offset other times?  */
@@ -5671,17 +5968,11 @@
     case BFD_RELOC_ARM_LITERAL:
     case BFD_RELOC_ARM_HWLITERAL:
       /* If this is called then the a literal has been referenced across
-	 a section boundry - possibly due to an implicit dump */
+	 a section boundary - possibly due to an implicit dump */
       as_bad_where (fixp->fx_file, fixp->fx_line,
-		    _("Literal referenced across section boundry (Implicit dump?)"));
+		    _("Literal referenced across section boundary (Implicit dump?)"));
       return NULL;
 
-    case BFD_RELOC_ARM_GOTPC:
-      assert (fixp->fx_pcrel != 0);
-      code = fixp->fx_r_type;
-      code = BFD_RELOC_32_PCREL;
-      break;
-
 #ifdef OBJ_ELF
     case BFD_RELOC_ARM_GOT32:
     case BFD_RELOC_ARM_GOTOFF:
@@ -5696,6 +5987,12 @@
 		    fixp->fx_r_type);
       return NULL;
 
+    case BFD_RELOC_ARM_ADRL_IMMEDIATE:
+      as_bad_where (fixp->fx_file, fixp->fx_line,
+		    _("ADRL used for a symbol not defined in the same file"),
+		    fixp->fx_r_type);
+      return NULL;
+
     case BFD_RELOC_ARM_OFFSET_IMM:
       as_bad_where (fixp->fx_file, fixp->fx_line,
 		    _("Internal_relocation (type %d) not fixed up (OFFSET_IMM)"),
@@ -5718,7 +6015,7 @@
 	  case BFD_RELOC_ARM_THUMB_SHIFT:  type = "THUMB_SHIFT";  break;
 	  case BFD_RELOC_ARM_THUMB_IMM:    type = "THUMB_IMM";    break;
 	  case BFD_RELOC_ARM_THUMB_OFFSET: type = "THUMB_OFFSET"; break;
-	  default:                         type = "<unknown>";    break;
+	  default:                         type = _("<unknown>"); break;
 	  }
 	as_bad_where (fixp->fx_file, fixp->fx_line,
 		      _("Can not represent %s relocation in this object file format (%d)"),
@@ -5731,7 +6028,10 @@
  if (code == BFD_RELOC_32_PCREL
      && GOT_symbol
      && fixp->fx_addsy == GOT_symbol)
-   code = BFD_RELOC_ARM_GOTPC;
+   {
+     code = BFD_RELOC_ARM_GOTPC;
+     reloc->addend = fixp->fx_offset = reloc->address;
+   }
 #endif
    
   reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
@@ -5744,21 +6044,25 @@
       return NULL;
     }
 
+   /* HACK: Since arm ELF uses Rel instead of Rela, encode the
+      vtable entry to be used in the relocation's section offset.  */
+   if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+     reloc->address = fixp->fx_offset;
+
   return reloc;
 }
 
 int
 md_estimate_size_before_relax (fragP, segtype)
-     fragS * fragP;
-     segT    segtype;
+     fragS * fragP ATTRIBUTE_UNUSED;
+     segT    segtype ATTRIBUTE_UNUSED;
 {
   as_fatal (_("md_estimate_size_before_relax\n"));
   return 1;
 }
 
 static void
-output_inst (str)
-     char * str;
+output_inst PARAMS ((void))
 {
   char * to = NULL;
     
@@ -5769,11 +6073,18 @@
     }
 
   to = frag_more (inst.size);
+  
   if (thumb_mode && (inst.size > THUMB_SIZE))
     {
       assert (inst.size == (2 * THUMB_SIZE));
       md_number_to_chars (to, inst.instruction >> 16, THUMB_SIZE);
-      md_number_to_chars (to + 2, inst.instruction, THUMB_SIZE);
+      md_number_to_chars (to + THUMB_SIZE, inst.instruction, THUMB_SIZE);
+    }
+  else if (inst.size > INSN_SIZE)
+    {
+      assert (inst.size == (2 * INSN_SIZE));
+      md_number_to_chars (to, inst.instruction, INSN_SIZE);
+      md_number_to_chars (to + INSN_SIZE, inst.instruction, INSN_SIZE);
     }
   else
     md_number_to_chars (to, inst.instruction, inst.size);
@@ -5803,7 +6114,7 @@
   /* Align the previous label if needed.  */
   if (last_label_seen != NULL)
     {
-      last_label_seen->sy_frag = frag_now;
+      symbol_set_frag (last_label_seen, frag_now);
       S_SET_VALUE (last_label_seen, (valueT) frag_now_fix ());
       S_SET_SEGMENT (last_label_seen, now_seg);
     }
@@ -5811,9 +6122,8 @@
   memset (&inst, '\0', sizeof (inst));
   inst.reloc.type = BFD_RELOC_NONE;
 
-  if (*str == ' ')
-    str++;			/* Skip leading white space */
-    
+  skip_whitespace (str);
+  
   /* Scan up to the end of the op-code, which must end in white space or
      end of string.  */
   for (start = p = str; *p != '\0'; p++)
@@ -5828,30 +6138,39 @@
 
   if (thumb_mode)
     {
-      CONST struct thumb_opcode *opcode;
+      CONST struct thumb_opcode * opcode;
 
       c = *p;
       *p = '\0';
       opcode = (CONST struct thumb_opcode *) hash_find (arm_tops_hsh, str);
       *p = c;
+      
       if (opcode)
 	{
+	  /* Check that this instruction is supported for this CPU.  */
+	  if (thumb_mode == 1 && (opcode->variants & cpu_variant) == 0)
+	     {
+	    	as_bad (_("selected processor does not support this opcode"));
+		return;
+	     }
+
 	  inst.instruction = opcode->value;
 	  inst.size = opcode->size;
 	  (*opcode->parms)(p);
-	  output_inst (start);
+	  output_inst ();
 	  return;
 	}
     }
   else
     {
-      CONST struct asm_opcode *opcode;
+      CONST struct asm_opcode * opcode;
+      unsigned long cond_code;
 
       inst.size = INSN_SIZE;
       /* p now points to the end of the opcode, probably white space, but we
 	 have to break the opcode up in case it contains condionals and flags;
 	 keep trying with progressively smaller basic instructions until one
-	 matches, or we run out of opcode. */
+	 matches, or we run out of opcode.  */
       q = (p - str > LONGEST_INST) ? str + LONGEST_INST : p;
       for (; q != str; q--)
 	{
@@ -5859,31 +6178,39 @@
 	  *q = '\0';
 	  opcode = (CONST struct asm_opcode *) hash_find (arm_ops_hsh, str);
 	  *q = c;
+	  
 	  if (opcode && opcode->template)
 	    {
 	      unsigned long flag_bits = 0;
-	      char *r;
+	      char * r;
 
-	      /* Check that this instruction is supported for this CPU */
+	      /* Check that this instruction is supported for this CPU.  */
 	      if ((opcode->variants & cpu_variant) == 0)
 		goto try_shorter;
 
 	      inst.instruction = opcode->value;
-	      if (q == p)		/* Just a simple opcode */
+	      if (q == p)		/* Just a simple opcode.  */
 		{
-		  if (opcode->comp_suffix != 0)
-		    as_bad (_("Opcode `%s' must have suffix from <%s>\n"), str,
-			    opcode->comp_suffix);
+		  if (opcode->comp_suffix)
+		    {
+		       if (*opcode->comp_suffix != '\0')
+		    	 as_bad (_("Opcode `%s' must have suffix from list: <%s>"),
+			     str, opcode->comp_suffix);
+		       else
+			 /* Not a conditional instruction. */
+		         (*opcode->parms)(q, 0);
+		    }
 		  else
 		    {
+		      /* A conditional instruction with default condition. */
 		      inst.instruction |= COND_ALWAYS;
 		      (*opcode->parms)(q, 0);
 		    }
-		  output_inst (start);
+		  output_inst ();
 		  return;
 		}
 
-	      /* Now check for a conditional */
+	      /* Not just a simple opcode.  Check if extra is a conditional. */
 	      r = q;
 	      if (p - r >= 2)
 		{
@@ -5899,18 +6226,33 @@
 			as_tsktsk (
 _("Warning: Use of the 'nv' conditional is deprecated\n"));
 
-		      inst.instruction |= cond->value;
+		      cond_code = cond->value;
 		      r += 2;
 		    }
 		  else
-		    inst.instruction |= COND_ALWAYS;
+		    cond_code = COND_ALWAYS;
 		}
 	      else
-		inst.instruction |= COND_ALWAYS;
+		cond_code = COND_ALWAYS;
 
-	      /* if there is a compulsory suffix, it should come here, before
-		 any optional flags. */
-	      if (opcode->comp_suffix)
+	      /* Apply the conditional, or complain it's not allowed. */
+	      if (opcode->comp_suffix && *opcode->comp_suffix == '\0')
+		{
+		   /* Instruction isn't conditional */
+		   if (cond_code != COND_ALWAYS)
+		     {
+		       as_bad (_("Opcode `%s' is unconditional\n"), str);
+		       return;
+		     }
+		}
+	      else
+		/* Instruction is conditional: set the condition into it. */
+		inst.instruction |= cond_code;	     
+
+
+	      /* If there is a compulsory suffix, it should come here, before
+		 any optional flags.  */
+	      if (opcode->comp_suffix && *opcode->comp_suffix != '\0')
 		{
 		  CONST char *s = opcode->comp_suffix;
 
@@ -5964,7 +6306,7 @@
 		}
 
 	      (*opcode->parms) (p, flag_bits);
-	      output_inst (start);
+	      output_inst ();
 	      return;
 	    }
 
@@ -5974,11 +6316,9 @@
     }
 
   /* It wasn't an instruction, but it might be a register alias of the form
-     alias .req reg
-     */
+     alias .req reg */
   q = p;
-  while (*q == ' ')
-    q++;
+  skip_whitespace (q);
 
   c = *p;
   *p = '\0';
@@ -5990,8 +6330,7 @@
       char * r;
       
       q += 4;
-      while (*q == ' ')
-	q++;
+      skip_whitespace (q);
 
       for (r = q; *r != '\0'; r++)
 	if (*r == ' ')
@@ -6011,20 +6350,17 @@
 	  if (reg == FAIL)
 	    {
 	      if (regnum != FAIL)
-		{
-		  insert_reg_alias (str, regnum);
-		}
+		insert_reg_alias (str, regnum);
 	      else
-		{
-		  as_warn (_("register '%s' does not exist\n"), q);
-		}
+		as_warn (_("register '%s' does not exist\n"), q);
 	    }
 	  else if (regnum != FAIL)
 	    {
 	      if (reg != regnum)
-		as_warn (_("ignoring redefinition of register alias '%s'"), copy_of_str );
+		as_warn (_("ignoring redefinition of register alias '%s'"),
+			 copy_of_str );
 	      
-	      /* Do not warn abpout redefinitions to the same alias.  */
+	      /* Do not warn about redefinitions to the same alias.  */
 	    }
 	  else
 	    as_warn (_("ignoring redefinition of register alias '%s' to non-existant register '%s'"),
@@ -6051,7 +6387,10 @@
  *            -m[arm]3                Arm 3 processor
  *            -m[arm]6[xx],           Arm 6 processors
  *            -m[arm]7[xx][t][[d]m]   Arm 7 processors
- *            -mstrongarm[110]	      Arm 8 processors
+ *            -m[arm]8[10]            Arm 8 processors
+ *            -m[arm]9[20][tdmi]      Arm 9 processors
+ *            -mstrongarm[110[0]]     StrongARM processors
+ *            -m[arm]v[2345]	      Arm architectures
  *            -mall                   All (except the ARM1)
  *    FP variants:
  *            -mfpa10, -mfpa11        FPA10 and 11 co-processor instructions
@@ -6140,7 +6479,8 @@
             }
           else if (streq (str, "thumb-interwork"))
             {
-              cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_THUMB | ARM_ARCHv4;
+	      if ((cpu_variant & ARM_THUMB) == 0)
+		cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_ARCH_V4T;
 #if defined OBJ_COFF || defined OBJ_ELF
               support_interwork = true;
 #endif
@@ -6262,6 +6602,7 @@
 		case 70:
 		case 700:
 		case 710:
+		case 720:
 		case 7100:
 		case 7500:
 		  break;
@@ -6274,7 +6615,7 @@
                 switch (* str)
                   {
                   case 't':
-                    cpu_variant |= (ARM_THUMB | ARM_ARCHv4);
+                    cpu_variant |= (ARM_THUMB | ARM_ARCH_V4);
                     break;
 
                   case 'm':
@@ -6301,39 +6642,56 @@
 
 	    case '8':
 	      if (streq (str, "8") || streq (str, "810"))
-		cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_8 | ARM_ARCHv4 | ARM_LONGMUL;
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_8 | ARM_ARCH_V4 | ARM_LONGMUL;
 	      else
 		goto bad;
 	      break;
 	      
 	    case '9':
 	      if (streq (str, "9"))
-		cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_9 | ARM_ARCHv4 | ARM_LONGMUL;
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_9 | ARM_ARCH_V4 | ARM_LONGMUL | ARM_THUMB;
+	      else if (streq (str, "920"))
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_9 | ARM_ARCH_V4 | ARM_LONGMUL;
+	      else if (streq (str, "920t"))
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_9 | ARM_ARCH_V4 | ARM_LONGMUL | ARM_THUMB;
 	      else if (streq (str, "9tdmi"))
-		cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_9 | ARM_ARCHv4 | ARM_LONGMUL | ARM_THUMB;
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_9 | ARM_ARCH_V4 | ARM_LONGMUL | ARM_THUMB;
 	      else
 		goto bad;
 	      break;
+
 	      
 	    case 's':
 	      if (streq (str, "strongarm")
 		  || streq (str, "strongarm110")
 		  || streq (str, "strongarm1100"))
-		cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_8 | ARM_ARCHv4 | ARM_LONGMUL;
+		cpu_variant = (cpu_variant & ~ARM_ANY)
+		  | ARM_8 | ARM_ARCH_V4 | ARM_LONGMUL;
 	      else
 		goto bad;
 	      break;
 		
 	    case 'v':
-	      /* Select variant based on architecture rather than processor */
+	      /* Select variant based on architecture rather than processor.  */
 	      switch (*++str)
 		{
 		case '2':
 		  switch (*++str)
 		    {
-		    case 'a': cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_3; break;
-		    case 0:   cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_2; break;
-		    default:  as_bad (_("Invalid architecture variant -m%s"), arg); break;
+		    case 'a':
+		      cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_3;
+		      break;
+		    case 0:
+		      cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_2;
+		      break;
+		    default:
+		      as_bad (_("Invalid architecture variant -m%s"), arg);
+		      break;
 		    }
 		  break;
 		  
@@ -6344,18 +6702,35 @@
 		    {
 		    case 'm': cpu_variant |= ARM_LONGMUL; break;
 		    case 0:   break;
-		    default:  as_bad (_("Invalid architecture variant -m%s"), arg); break;
+		    default:
+		      as_bad (_("Invalid architecture variant -m%s"), arg);
+		      break;
 		    }
 		  break;
 		  
 		case '4':
-		  cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_ARCHv4;
+		  cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_ARCH_V4;
 		  
 		  switch (*++str)
 		    {
 		    case 't': cpu_variant |= ARM_THUMB; break;
 		    case 0:   break;
-		    default:  as_bad (_("Invalid architecture variant -m%s"), arg); break;
+		    default:
+		      as_bad (_("Invalid architecture variant -m%s"), arg);
+		      break;
+		    }
+		  break;
+
+		case '5':
+		  cpu_variant = (cpu_variant & ~ARM_ANY) | ARM_ARCH_V5;
+		  switch (*++str)
+		    {
+		    case 't': cpu_variant |= ARM_THUMB; break;
+		    case 'e': cpu_variant |= ARM_EXT_V5E; break;
+		    case 0:   break;
+		    default:
+		      as_bad (_("Invalid architecture variant -m%s"), arg);
+		      break;
 		    }
 		  break;
 		  
@@ -6373,9 +6748,11 @@
 	}
       break;
 
+#if defined OBJ_ELF || defined OBJ_COFF
     case 'k':
       pic_code = 1;
       break;
+#endif
       
     default:
       return 0;
@@ -6388,39 +6765,29 @@
 md_show_usage (fp)
      FILE * fp;
 {
-  fprintf (fp,
-_("\
+  fprintf (fp, _("\
  ARM Specific Assembler Options:\n\
   -m[arm][<processor name>] select processor variant\n\
-  -m[arm]v[2|2a|3|3m|4|4t]  select architecture variant\n\
+  -m[arm]v[2|2a|3|3m|4|4t|5[t][e]] select architecture variant\n\
   -mthumb                   only allow Thumb instructions\n\
   -mthumb-interwork         mark the assembled code as supporting interworking\n\
   -mall                     allow any instruction\n\
   -mfpa10, -mfpa11          select floating point architecture\n\
   -mfpe-old                 don't allow floating-point multiple instructions\n\
-  -mno-fpu                  don't allow any floating-point instructions.\n"));
-  fprintf (fp,
-_("\
+  -mno-fpu                  don't allow any floating-point instructions.\n\
   -k                        generate PIC code.\n"));
 #if defined OBJ_COFF || defined OBJ_ELF
-  fprintf (fp,
-_("\
-  -mapcs-32, -mapcs-26      specify which ARM Procedure Calling Standard to use\n"));
-  fprintf (fp,
-_("\
-  -mapcs-float              floating point args are passed in FP regs\n"));
-  fprintf (fp,
-_("\
+  fprintf (fp, _("\
+  -mapcs-32, -mapcs-26      specify which ARM Procedure Calling Standard to use\n\
+  -mapcs-float              floating point args are passed in FP regs\n\
   -mapcs-reentrant          the code is position independent/reentrant\n"));
   #endif
 #ifdef OBJ_ELF
-  fprintf (fp,
-_("\
+  fprintf (fp, _("\
   -moabi                    support the old ELF ABI\n"));
 #endif
 #ifdef ARM_BI_ENDIAN
-  fprintf (fp,
-_("\
+  fprintf (fp, _("\
   -EB                       assemble code for a big endian cpu\n\
   -EL                       assemble code for a little endian cpu\n"));
 #endif
@@ -6469,24 +6836,7 @@
 }
 
 
-/*
- * This fix_new is called by cons via TC_CONS_FIX_NEW
- *
- * We check the expression to see if it is of the form
- *  __GLOBAL_OFFSET_TABLE + ???
- * If it is then this is a PC relative reference to the GOT.
- * i.e.
- * 	ldr	sl, L1
- * 	add	sl, pc, sl
- * L2:
- * 	...
- * L1:
- *	.word	__GLOBAL_OFFSET_TABLE + (. - (L2 + 4))
- *
- * In this case use a reloc type BFD_RELOC_ARM_GOTPC instead of the
- * normal BFD_RELOC_{16,32,64}
- */
-
+/* This fix_new is called by cons via TC_CONS_FIX_NEW.  */
 void
 cons_fix_new_arm (frag, where, size, exp)
      fragS *       frag;
@@ -6515,28 +6865,21 @@
       break;
     }
   
-  /* Look for possible GOTPC reloc */
-  
-  /*
-   * Look for pic assembler and 'undef symbol + expr symbol' expression
-   * and a 32 bit size.
-   */
-  
   fix_new_exp (frag, where, (int) size, exp, pcrel, type);
 }
 
 /* A good place to do this, although this was probably not intended
- * for this kind of use.  We need to dump the literal pool before
- * references are made to a null symbol pointer.  */
+   for this kind of use.  We need to dump the literal pool before
+   references are made to a null symbol pointer.  */
 void
 arm_cleanup ()
 {
-  if (current_poolP != NULL)
-    {
-      subseg_set (text_section, 0); /* Put it at the end of text section */
-      s_ltorg (0);
-      listing_prev_line ();
-    }
+  if (current_poolP == NULL)
+    return;
+  
+  subseg_set (text_section, 0); /* Put it at the end of text section.  */
+  s_ltorg (0);
+  listing_prev_line ();
 }
 
 void
@@ -6613,24 +6956,30 @@
         }
 
       if (ARM_IS_INTERWORK (sym))
-	coffsymbol(sym->bsym)->native->u.syment.n_flags = 0xFF;
+	coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_flags = 0xFF;
     }
 #endif
 #ifdef OBJ_ELF
   symbolS *         sym;
-  elf_symbol_type * elf_sym;
   char              bind;
 
   for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
     {
       if (ARM_IS_THUMB (sym))
         {
+	  elf_symbol_type * elf_sym;
+	  
+	  elf_sym = elf_symbol (symbol_get_bfdsym (sym));
+	  bind = ELF_ST_BIND (elf_sym);
+	  
+	  /* If it's a .thumb_func, declare it as so,
+	     otherwise tag label as .code 16.  */
 	  if (THUMB_IS_FUNC (sym))
-	    {
-	      elf_sym = elf_symbol (sym->bsym);
-	      bind = ELF_ST_BIND (elf_sym);
-	      elf_sym->internal_elf_sym.st_info = ELF_ST_INFO (bind, STT_ARM_TFUNC);
-            }
+	    elf_sym->internal_elf_sym.st_info =
+	      ELF_ST_INFO (bind, STT_ARM_TFUNC);
+	  else
+	    elf_sym->internal_elf_sym.st_info =
+	      ELF_ST_INFO (bind, STT_ARM_16BIT);
          }
      }
 #endif
@@ -6658,9 +7007,7 @@
 
   if (thumb_mode && (len = strlen (name)) > 5
       && streq (name + len - 5, "/data"))
-    {
-      *(name + len - 5) = 0;
-    }
+    *(name + len - 5) = 0;
 
   return name;
 }
@@ -6703,7 +7050,6 @@
 arm_fix_adjustable (fixP)
    fixS * fixP;
 {
-
   if (fixP->fx_addsy == NULL)
     return 1;
   
@@ -6755,7 +7101,8 @@
 {
   if (   fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
-      || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH)    
+      || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
+      || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23)    
     return 1;
   
   return 0;
@@ -6766,7 +7113,7 @@
 {
   char   id[16];
   char * ip;
-  int    i;
+  unsigned int i;
   static struct
   {
     char * str;
@@ -6782,7 +7129,7 @@
     /* Added support for parsing "var(PLT)" branch instructions */
     /* generated by GCC for PLT relocs */
     MAP ("(plt)",    BFD_RELOC_ARM_PLT32),
-    NULL, 0,         BFD_RELOC_UNUSED
+    { NULL, 0,         BFD_RELOC_UNUSED }
 #undef MAP    
   };
 
@@ -6834,7 +7181,8 @@
           int size = bfd_get_reloc_size (howto);
 
           if (size > nbytes)
-            as_bad ("%s relocations do not fit in %d bytes", howto->name, nbytes);
+            as_bad ("%s relocations do not fit in %d bytes",
+		    howto->name, nbytes);
           else
             {
               register char * p = frag_more ((int) nbytes);
@@ -6849,9 +7197,8 @@
     }
   while (*input_line_pointer++ == ',');
 
-  input_line_pointer--;		/* Put terminator back into stream. */
+  input_line_pointer--;		/* Put terminator back into stream.  */
   demand_empty_rest_of_line ();
 }
 
 #endif /* OBJ_ELF */
-
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index bf99e24..c5ab887 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -1,5 +1,6 @@
 /* This file is tc-arm.h
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999
+   Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
 	Modified by David Taylor (dtaylor@armltd.co.uk)
 
@@ -103,7 +104,7 @@
  extern void arm_start_line_hook PARAMS ((void));
 
 #define tc_frob_label(S) arm_frob_label (S)
- extern void arm_frob_label PARAMS ((struct symbol *));
+ extern void arm_frob_label PARAMS ((symbolS *));
 
 /* We also need to mark assembler created symbols:  */
 #define tc_frob_fake_label(S) arm_frob_label (S)
@@ -112,8 +113,13 @@
    deliberately not been updated to mark assembler created stabs
    symbols as Thumb.  */
 
+#define TC_FIX_TYPE PTR
+#define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL)
+
 #ifdef OBJ_ELF
+#include "write.h"        /* For definition of fixS */
 #define obj_fix_adjustable(fixP) arm_fix_adjustable (fixP)
+boolean arm_fix_adjustable PARAMS ((fixS *));
 #else
 #define obj_fix_adjustable(fixP) 0
 #endif
@@ -121,9 +127,9 @@
 /* We need to keep some local information on symbols.  */
 
 #define TC_SYMFIELD_TYPE unsigned int
-#define ARM_GET_FLAG(s)   	((s)->sy_tc)
-#define ARM_SET_FLAG(s,v) 	((s)->sy_tc |= (v))
-#define ARM_RESET_FLAG(s,v) 	((s)->sy_tc &= ~(v))
+#define ARM_GET_FLAG(s)   	(*symbol_get_tc (s))
+#define ARM_SET_FLAG(s,v) 	(*symbol_get_tc (s) |= (v))
+#define ARM_RESET_FLAG(s,v) 	(*symbol_get_tc (s) &= ~(v))
 
 #define ARM_FLAG_THUMB 		(1 << 0)	/* The symbol is a Thumb symbol rather than an Arm symbol.  */
 #define ARM_FLAG_INTERWORK 	(1 << 1)	/* The symbol is attached to code that suppports interworking.  */
@@ -138,9 +144,6 @@
 #define THUMB_SET_FUNC(s,t)     ((t) ? ARM_SET_FLAG (s, THUMB_FLAG_FUNC)    : ARM_RESET_FLAG (s, THUMB_FLAG_FUNC))
 
 
-#define TC_FIX_TYPE PTR
-#define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL)
-
 #define TC_START_LABEL(C,STR) \
   (c == ':' || (c == '/' && arm_data_in_code ()))
 int arm_data_in_code PARAMS ((void));
@@ -153,7 +156,8 @@
  extern void arm_adjust_symtab PARAMS ((void));
 
 #ifdef OBJ_ELF
-#define obj_frob_symbol(sym, punt)  armelf_frob_symbol (sym, punt)
+#define obj_frob_symbol(sym, punt)  armelf_frob_symbol ((sym), & (punt))
+void armelf_frob_symbol PARAMS ((symbolS *, int *));
 #endif
 
 #define tc_aout_pre_write_hook(x)	{;}	/* not used */
@@ -170,6 +174,9 @@
 
 #define LOCAL_LABEL(name) (name[0] == '.' && (name[1] == 'L'))
 #define LOCAL_LABELS_FB   1
+#ifdef OBJ_ELF
+#define LOCAL_LABEL_PREFIX '.'
+#endif
 
 /* This expression evaluates to false if the relocation is for a local object
    for which we still want to do the relocation at runtime.  True if we
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
new file mode 100644
index 0000000..ea8008c
--- /dev/null
+++ b/gas/config/tc-avr.c
@@ -0,0 +1,1252 @@
+/* tc-avr.c -- Assembler code for the ATMEL AVR
+
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Denis Chertykov <denisc@overta.ru>
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; 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 <ctype.h>
+#include "as.h"
+#include "subsegs.h"
+
+const char comment_chars[] = ";";
+const char line_comment_chars[] = "#";
+const char line_separator_chars[] = "$";
+
+#define AVR_ISA_1200      1
+#define AVR_ISA_2xxx      3
+#define AVR_ISA_MEGA_x03  0x17
+#define AVR_ISA_MEGA      0x10
+#define AVR_ISA_MEGA_161  0x1b
+
+const char *md_shortopts = "m:";
+struct mcu_type_s
+{
+  char *name;
+  int isa;
+  int mach;
+};
+
+static struct mcu_type_s mcu_types[] =
+{
+  {"avr1",      AVR_ISA_1200,     bfd_mach_avr1},
+  {"avr2",      AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"avr3",      AVR_ISA_MEGA_x03, bfd_mach_avr3},
+  {"avr4",      AVR_ISA_MEGA_161, bfd_mach_avr4},
+  {"at90s1200", AVR_ISA_1200,     bfd_mach_avr1},
+  {"at90s2313", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s2323", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s2333", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"attiny22" , AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s2343", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s4433", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s4414", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s4434", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s8515", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"at90s8535", AVR_ISA_2xxx,     bfd_mach_avr2},
+  {"atmega603", AVR_ISA_MEGA_x03, bfd_mach_avr3},
+  {"atmega103", AVR_ISA_MEGA_x03, bfd_mach_avr3},
+  {"atmega161", AVR_ISA_MEGA_161, bfd_mach_avr4},
+  {NULL, 0, 0}
+};
+
+
+/* Current MCU type.  */
+static struct mcu_type_s default_mcu = {"avr2", AVR_ISA_2xxx,bfd_mach_avr2};
+static struct mcu_type_s *avr_mcu = &default_mcu;
+
+const char EXP_CHARS[] = "eE";
+const char FLT_CHARS[] = "dD";
+static void avr_set_arch (int dummy);
+
+/* The target specific pseudo-ops which we support.  */
+const pseudo_typeS md_pseudo_table[] =
+{
+  {"arch", avr_set_arch,	0},
+  { NULL,	NULL,		0}
+};
+
+#define LDI_IMMEDIATE(x) (((x) & 0xf) | (((x) << 4) & 0xf00))
+#define REGISTER_P(x) ((x) == 'r' || (x) == 'd' || (x) == 'w')
+
+struct avr_opcodes_s
+{
+  char *name;
+  char *constraints;
+  char *opcode;
+  int insn_size;		/* in words */
+  int isa;
+  unsigned int bin_opcode;
+};
+
+static char * skip_space (char * s);
+static char * extract_word (char *from, char *to, int limit);
+static unsigned int avr_operand (struct avr_opcodes_s *opcode,
+				 int where, char *op, char **line);
+static unsigned int avr_operands (struct avr_opcodes_s *opcode, char **line);
+static unsigned int avr_get_constant (char * str, unsigned int max);
+static char *parse_exp (char *s, expressionS * op);
+static bfd_reloc_code_real_type avr_ldi_expression (expressionS *exp);
+long md_pcrel_from_section PARAMS ((fixS *, segT));
+
+/* constraint letters
+   r - any register
+   d - `ldi' register (r16-r31)
+   M - immediate value from 0 to 255
+   n - immediate value from 0 to 255 ( n = ~M ). Relocation impossible
+   w - `adiw' register (r24,r26,r28,r30)
+   s - immediate value from 0 to 7
+   P - Port address value from 0 to 64. (in, out)
+   p - Port address value from 0 to 32. (cbi, sbi, sbic, sbis)
+   K - immediate value from 0 to 64 (used in `adiw', `sbiw')
+   e - pointer regegisters (X,Y,Z)
+   b - base pointer register and displacement ([YZ]+disp)
+   i - immediate value
+   l - signed pc relative offset from -64 to 63
+   L - signed pc relative offset from -2048 to 2047
+   h - absolut code address (call, jmp)
+   S - immediate value from 0 to 7 (S = s << 4)
+*/
+struct avr_opcodes_s avr_opcodes[] =
+{
+  {"adc",  "r,r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00},
+  {"add",  "r,r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00},
+  {"and",  "r,r", "001000rdddddrrrr", 1, AVR_ISA_1200, 0x2000},
+  {"cp",   "r,r", "000101rdddddrrrr", 1, AVR_ISA_1200, 0x1400},
+  {"cpc",  "r,r", "000001rdddddrrrr", 1, AVR_ISA_1200, 0x0400},
+  {"cpse", "r,r", "000100rdddddrrrr", 1, AVR_ISA_1200, 0x1000},
+  {"eor",  "r,r", "001001rdddddrrrr", 1, AVR_ISA_1200, 0x2400},
+  {"mov",  "r,r", "001011rdddddrrrr", 1, AVR_ISA_1200, 0x2c00},
+  {"mul",  "r,r", "100111rdddddrrrr", 1, AVR_ISA_MEGA_161, 0x9c00},
+  {"or",   "r,r", "001010rdddddrrrr", 1, AVR_ISA_1200, 0x2800},
+  {"sbc",  "r,r", "000010rdddddrrrr", 1, AVR_ISA_1200, 0x0800},
+  {"sub",  "r,r", "000110rdddddrrrr", 1, AVR_ISA_1200, 0x1800},
+
+  {"clr",  "r=r", "001001rdddddrrrr", 1, AVR_ISA_1200, 0x2400},
+  {"lsl",  "r=r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00},
+  {"rol",  "r=r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00},
+  {"tst",  "r=r", "001000rdddddrrrr", 1, AVR_ISA_1200, 0x2000},
+
+  {"andi", "d,M", "0111KKKKddddKKKK", 1, AVR_ISA_1200, 0x7000},
+  /*XXX special case*/
+  {"cbr",  "d,n", "0111KKKKddddKKKK", 1, AVR_ISA_1200, 0x7000},
+  {"cpi",  "d,M", "0011KKKKddddKKKK", 1, AVR_ISA_1200, 0x3000},
+  {"ldi",  "d,M", "1110KKKKddddKKKK", 1, AVR_ISA_1200, 0xe000},
+  {"ori",  "d,M", "0110KKKKddddKKKK", 1, AVR_ISA_1200, 0x6000},
+  {"sbci", "d,M", "0100KKKKddddKKKK", 1, AVR_ISA_1200, 0x4000},
+  {"sbr",  "d,M", "0110KKKKddddKKKK", 1, AVR_ISA_1200, 0x6000},
+  {"subi", "d,M", "0101KKKKddddKKKK", 1, AVR_ISA_1200, 0x5000},
+
+  {"sbrc", "r,s", "1111110rrrrr0sss", 1, AVR_ISA_1200, 0xfc00},
+  {"sbrs", "r,s", "1111111rrrrr0sss", 1, AVR_ISA_1200, 0xfe00},
+  {"bld",  "r,s", "1111100ddddd0sss", 1, AVR_ISA_1200, 0xf800},
+  {"bst",  "r,s", "1111101ddddd0sss", 1, AVR_ISA_1200, 0xfa00},
+
+  {"in",   "r,P", "10110PPdddddPPPP", 1, AVR_ISA_1200, 0xb000},
+  {"out",  "P,r", "10111PPrrrrrPPPP", 1, AVR_ISA_1200, 0xb800},
+
+  {"adiw", "w,K", "10010110KKddKKKK", 1, AVR_ISA_2xxx, 0x9600},
+  {"sbiw", "w,K", "10010111KKddKKKK", 1, AVR_ISA_2xxx, 0x9700},
+
+  {"cbi",  "p,s", "10011000pppppsss", 1, AVR_ISA_1200, 0x9800},
+  {"sbi",  "p,s", "10011010pppppsss", 1, AVR_ISA_1200, 0x9a00},
+  {"sbic", "p,s", "10011001pppppsss", 1, AVR_ISA_1200, 0x9900},
+  {"sbis", "p,s", "10011011pppppsss", 1, AVR_ISA_1200, 0x9b00},
+
+  /* ee = {X=11,Y=10,Z=00, 0} */
+  {"ld",   "r,e", "100!000dddddee-+", 1, AVR_ISA_2xxx, 0x8000},
+  {"st",   "e,r", "100!001rrrrree-+", 1, AVR_ISA_2xxx, 0x8200},
+  {"ldd",  "r,b", "10o0oo0dddddbooo", 1, AVR_ISA_2xxx, 0x8000},
+  {"std",  "b,r", "10o0oo1rrrrrbooo", 1, AVR_ISA_2xxx, 0x8200},
+  {"sts",  "i,r", "1001001ddddd0000", 2, AVR_ISA_2xxx, 0x9200},
+  {"lds",  "r,i", "1001000ddddd0000", 2, AVR_ISA_2xxx, 0x9000},
+
+  {"brbc", "s,l", "111101lllllllsss", 1, AVR_ISA_1200, 0xf400},
+  {"brbs", "s,l", "111100lllllllsss", 1, AVR_ISA_1200, 0xf000},
+
+  {"brcc", "l",   "111101lllllll000", 1, AVR_ISA_1200, 0xf400},
+  {"brcs", "l",   "111100lllllll000", 1, AVR_ISA_1200, 0xf000},
+  {"breq", "l",   "111100lllllll001", 1, AVR_ISA_1200, 0xf001},
+  {"brge", "l",   "111101lllllll100", 1, AVR_ISA_1200, 0xf404},
+  {"brhc", "l",   "111101lllllll101", 1, AVR_ISA_1200, 0xf405},
+  {"brhs", "l",   "111100lllllll101", 1, AVR_ISA_1200, 0xf005},
+  {"brid", "l",   "111101lllllll111", 1, AVR_ISA_1200, 0xf407},
+  {"brie", "l",   "111100lllllll111", 1, AVR_ISA_1200, 0xf007},
+  {"brlo", "l",   "111100lllllll000", 1, AVR_ISA_1200, 0xf000},
+  {"brlt", "l",   "111100lllllll100", 1, AVR_ISA_1200, 0xf004},
+  {"brmi", "l",   "111100lllllll010", 1, AVR_ISA_1200, 0xf002},
+  {"brne", "l",   "111101lllllll001", 1, AVR_ISA_1200, 0xf401},
+  {"brpl", "l",   "111101lllllll010", 1, AVR_ISA_1200, 0xf402},
+  {"brsh", "l",   "111101lllllll000", 1, AVR_ISA_1200, 0xf400},
+  {"brtc", "l",   "111101lllllll110", 1, AVR_ISA_1200, 0xf406},
+  {"brts", "l",   "111100lllllll110", 1, AVR_ISA_1200, 0xf006},
+  {"brvc", "l",   "111101lllllll011", 1, AVR_ISA_1200, 0xf403},
+  {"brvs", "l",   "111100lllllll011", 1, AVR_ISA_1200, 0xf003},
+
+  {"rcall", "L",  "1101LLLLLLLLLLLL", 1, AVR_ISA_1200, 0xd000},
+  {"rjmp",  "L",  "1100LLLLLLLLLLLL", 1, AVR_ISA_1200, 0xc000},
+
+  {"call", "h",   "1001010hhhhh111h", 2, AVR_ISA_MEGA, 0x940e},
+  {"jmp",  "h",   "1001010hhhhh110h", 2, AVR_ISA_MEGA, 0x940c},
+
+  {"asr",  "r",   "1001010rrrrr0101", 1, AVR_ISA_1200, 0x9405},
+  {"com",  "r",   "1001010rrrrr0000", 1, AVR_ISA_1200, 0x9400},
+  {"dec",  "r",   "1001010rrrrr1010", 1, AVR_ISA_1200, 0x940a},
+  {"inc",  "r",   "1001010rrrrr0011", 1, AVR_ISA_1200, 0x9403},
+  {"lsr",  "r",   "1001010rrrrr0110", 1, AVR_ISA_1200, 0x9406},
+  {"neg",  "r",   "1001010rrrrr0001", 1, AVR_ISA_1200, 0x9401},
+  {"pop",  "r",   "1001000rrrrr1111", 1, AVR_ISA_2xxx, 0x900f},
+  {"push", "r",   "1001001rrrrr1111", 1, AVR_ISA_2xxx, 0x920f},
+  {"ror",  "r",   "1001010rrrrr0111", 1, AVR_ISA_1200, 0x9407},
+  {"ser",  "d",   "11101111dddd1111", 1, AVR_ISA_1200, 0xef0f},
+  {"swap", "r",   "1001010rrrrr0010", 1, AVR_ISA_1200, 0x9402},
+
+  {"bclr", "S",   "100101001SSS1000", 1, AVR_ISA_1200, 0x9488},
+  {"bset", "S",   "100101000SSS1000", 1, AVR_ISA_1200, 0x9408},
+
+  {"clc",  "", 	  "1001010010001000", 1, AVR_ISA_1200, 0x9488},
+  {"clh",  "", 	  "1001010011011000", 1, AVR_ISA_1200, 0x94d8},
+  {"cli",  "", 	  "1001010011111000", 1, AVR_ISA_1200, 0x94f8},
+  {"cln",  "", 	  "1001010010101000", 1, AVR_ISA_1200, 0x94a8},
+  {"cls",  "", 	  "1001010011001000", 1, AVR_ISA_1200, 0x94c8},
+  {"clt",  "", 	  "1001010011101000", 1, AVR_ISA_1200, 0x94e8},
+  {"clv",  "", 	  "1001010010111000", 1, AVR_ISA_1200, 0x94b8},
+  {"clz",  "", 	  "1001010010011000", 1, AVR_ISA_1200, 0x9498},
+  {"icall","", 	  "1001010100001001", 1, AVR_ISA_2xxx, 0x9509},
+  {"ijmp", "", 	  "1001010000001001", 1, AVR_ISA_2xxx, 0x9409},
+  {"lpm",  "", 	  "1001010111001000", 1, AVR_ISA_2xxx, 0x95c8},
+  {"nop",  "", 	  "0000000000000000", 1, AVR_ISA_1200, 0x0000},
+  {"ret",  "", 	  "1001010100001000", 1, AVR_ISA_1200, 0x9508},
+  {"reti", "", 	  "1001010100011000", 1, AVR_ISA_1200, 0x9518},
+  {"sec",  "", 	  "1001010000001000", 1, AVR_ISA_1200, 0x9408},
+  {"seh",  "", 	  "1001010001011000", 1, AVR_ISA_1200, 0x9458},
+  {"sei",  "", 	  "1001010001111000", 1, AVR_ISA_1200, 0x9478},
+  {"sen",  "", 	  "1001010000101000", 1, AVR_ISA_1200, 0x9428},
+  {"ses",  "", 	  "1001010001001000", 1, AVR_ISA_1200, 0x9448},
+  {"set",  "", 	  "1001010001101000", 1, AVR_ISA_1200, 0x9468},
+  {"sev",  "", 	  "1001010000111000", 1, AVR_ISA_1200, 0x9438},
+  {"sez",  "", 	  "1001010000011000", 1, AVR_ISA_1200, 0x9418},
+  {"sleep","", 	  "1001010110001000", 1, AVR_ISA_1200, 0x9588},
+  {"wdr",  "", 	  "1001010110101000", 1, AVR_ISA_1200, 0x95a8},
+  {"elpm", "", 	  "1001010111011000", 1, AVR_ISA_MEGA_x03, 0x95d8},
+  {NULL, NULL, NULL, 0, 0, 0}
+};
+
+
+
+#define EXP_MOD_NAME(i) exp_mod[i].name
+#define EXP_MOD_RELOC(i) exp_mod[i].reloc
+#define EXP_MOD_NEG_RELOC(i) exp_mod[i].neg_reloc
+#define HAVE_PM_P(i) exp_mod[i].have_pm
+
+struct exp_mod_s
+{
+  char * name;
+  bfd_reloc_code_real_type reloc;
+  bfd_reloc_code_real_type neg_reloc;
+  int have_pm;
+};
+
+static struct exp_mod_s exp_mod[] = {
+  {"hh8",    BFD_RELOC_AVR_HH8_LDI,    BFD_RELOC_AVR_HH8_LDI_NEG,    1},
+  {"pm_hh8", BFD_RELOC_AVR_HH8_LDI_PM, BFD_RELOC_AVR_HH8_LDI_PM_NEG, 0},
+  {"hi8",    BFD_RELOC_AVR_HI8_LDI,    BFD_RELOC_AVR_HI8_LDI_NEG,    1},
+  {"pm_hi8", BFD_RELOC_AVR_HI8_LDI_PM, BFD_RELOC_AVR_HI8_LDI_PM_NEG, 0},
+  {"lo8",    BFD_RELOC_AVR_LO8_LDI,    BFD_RELOC_AVR_LO8_LDI_NEG,    1},
+  {"pm_lo8", BFD_RELOC_AVR_LO8_LDI_PM, BFD_RELOC_AVR_LO8_LDI_PM_NEG, 0},
+  {"hlo8",   -BFD_RELOC_AVR_LO8_LDI,   -BFD_RELOC_AVR_LO8_LDI_NEG,   0},
+  {"hhi8",   -BFD_RELOC_AVR_HI8_LDI,   -BFD_RELOC_AVR_HI8_LDI_NEG,   0},
+};
+
+/* Opcode hash table.  */
+static struct hash_control *avr_hash;
+
+/* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx).  */
+static struct hash_control *avr_mod_hash;
+
+#define OPTION_MMCU (OPTION_MD_BASE + 1)
+
+struct option md_longopts[] = {
+  {"mmcu", required_argument, NULL, 'm'},
+  {NULL, no_argument, NULL, 0}
+};
+size_t md_longopts_size = sizeof(md_longopts);
+
+static inline char *
+skip_space (s)
+     char * s;
+{
+  while (*s == ' ' || *s == '\t')
+    ++s;
+  return s;
+}
+
+/* Extract one word from FROM and copy it to TO.  */
+static char *
+extract_word (char *from, char *to, int limit)
+{
+  char *op_start;
+  char *op_end;
+  int size = 0;
+
+  /* Drop leading whitespace.  */
+  from = skip_space (from);
+  *to = 0;
+  /* Find the op code end.  */
+  for (op_start = op_end = from; *op_end != 0 && is_part_of_name(*op_end); )
+    {
+      to[size++] = *op_end++;
+      if (size + 1 >= limit)
+	break;
+    }
+  to[size] = 0;
+  return op_end;
+}
+
+int
+md_estimate_size_before_relax (fragp, seg)
+     fragS *fragp;
+     asection *seg;
+{
+  abort ();
+  return 0;
+}
+
+void
+md_show_usage (stream)
+  FILE *stream;
+{
+  fprintf
+    (stream,
+     _ ("AVR options:\n"
+	"  -mmcu=[avr-name] select microcontroller variant\n"
+	"                   [avr-name] can be:\n"
+	"                   avr1 - AT90S1200\n"
+	"                   avr2 - AT90S2xxx, AT90S4xxx, AT90S85xx, ATtiny22\n"
+	"                   avr3 - ATmega103 or ATmega603\n"
+	"                   avr4 - ATmega161\n"
+	"                   or immediate microcontroller name.\n"));
+}
+
+static void
+avr_set_arch (dummy)
+     int dummy;
+{
+  char * str;
+  str = (char *)alloca (20);
+  input_line_pointer = extract_word (input_line_pointer, str, 20);
+  md_parse_option ('m', str);
+  bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
+}
+
+int
+md_parse_option (c, arg)
+     int c;
+     char *arg;
+{
+  char *t = alloca (strlen (arg) + 1);
+  char *s = t;
+  char *arg1 = arg;
+  do
+    *t = tolower (*arg1++);
+  while (*t++);
+
+  if (c == 'm')
+    {
+      int i;
+
+      for (i = 0; mcu_types[i].name; ++i)
+	if (strcmp (mcu_types[i].name, s) == 0)
+	  break;
+
+      if (!mcu_types[i].name)
+	as_fatal (_ ("unknown MCU: %s\n"), arg);
+      if (avr_mcu == &default_mcu)
+	avr_mcu = &mcu_types[i];
+      else
+	as_fatal (_ ("redefinition of mcu type `%s'"), mcu_types[i].name);
+      return 1;
+    }
+  return 0;
+}
+
+symbolS *
+md_undefined_symbol (name)
+  char *name;
+{
+  return 0;
+}
+
+/* Convert a string pointed to by input_line_pointer into a floating point
+   constant of type `type', and store the appropriate bytes to `*litP'.
+   The number of LITTLENUMS emitted is stored in `*sizeP'.  Returns NULL if
+   OK, or an error message otherwise.  */
+char *
+md_atof (type, litP, sizeP)
+     int type;
+     char *litP;
+     int *sizeP;
+{
+  int prec;
+  LITTLENUM_TYPE words[4];
+  LITTLENUM_TYPE *wordP;
+  char *t;
+
+  switch (type)
+    {
+    case 'f':
+      prec = 2;
+      break;
+    case 'd':
+      prec = 4;
+      break;
+    default:
+      *sizeP = 0;
+      return _("bad call to md_atof");
+    }
+
+  t = atof_ieee (input_line_pointer, type, words);
+  if (t)
+    input_line_pointer = t;
+
+  *sizeP = prec * sizeof (LITTLENUM_TYPE);
+  /* This loop outputs the LITTLENUMs in REVERSE order.  */
+  for (wordP = words + prec - 1; prec--;)
+    {
+      md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
+      litP += sizeof (LITTLENUM_TYPE);
+    }
+  return NULL;
+}
+
+void
+md_convert_frag (abfd, sec, fragP)
+  bfd *abfd;
+  asection *sec;
+  fragS *fragP;
+{
+  abort ();
+}
+
+
+void
+md_begin ()
+{
+  int i;
+  struct avr_opcodes_s *opcode;
+  avr_hash = hash_new();
+
+  /* Insert unique names into hash table.  This hash table then provides a
+     quick index to the first opcode with a particular name in the opcode
+     table.  */
+
+  for (opcode = avr_opcodes; opcode->name; opcode++)
+    hash_insert (avr_hash, opcode->name, (char *) opcode);
+
+  avr_mod_hash = hash_new ();
+
+  for (i = 0; i < sizeof (exp_mod) / sizeof (exp_mod[0]); ++i)
+    hash_insert (avr_mod_hash, EXP_MOD_NAME(i), (void*)(i+10));
+
+  for (i = 0; i < 32; i++)
+    {
+      char buf[5];
+
+      sprintf (buf, "r%d", i);
+      symbol_table_insert (symbol_new (buf, reg_section, i,
+				       &zero_address_frag));
+      sprintf (buf, "R%d", i);
+      symbol_table_insert (symbol_new (buf, reg_section, i,
+				       &zero_address_frag));
+    }
+
+  bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
+}
+
+
+static unsigned int
+avr_operands (opcode, line)
+     struct avr_opcodes_s *opcode;
+     char **line;
+{
+  char *op = opcode->constraints;
+  unsigned int bin = opcode->bin_opcode;
+  char *frag = frag_more (opcode->insn_size * 2);
+  char *str = *line;
+  int where = frag - frag_now->fr_literal;
+
+  /* Opcode have operands.  */
+  if (*op)
+    {
+      unsigned int reg1 = 0;
+      unsigned int reg2 = 0;
+      int reg1_present = 0;
+      int reg2_present = 0;
+
+      /* Parse first operand.  */
+      if (REGISTER_P (*op))
+	reg1_present = 1;
+      reg1 = avr_operand (opcode, where, op, &str);
+      ++op;
+
+      /* Parse second operand.  */
+      if (*op)
+	{
+	  if (*op == ',')
+	    ++op;
+	  if (*op == '=')
+	    {
+	      reg2 = reg1;
+	      reg2_present = 1;
+	    }
+	  else
+	    {
+	      if (REGISTER_P (*op))
+		reg2_present = 1;
+
+	      str = skip_space (str);
+	      if (*str++ != ',')
+		as_bad (_ ("`,' required"));
+	      str = skip_space (str);
+
+	      reg2 = avr_operand (opcode, where, op, &str);
+
+	    }
+	  if (reg1_present && reg2_present)
+	    reg2 = (reg2 & 0xf) | ((reg2 << 5) & 0x200);
+	  else if (reg2_present)
+	    reg2 <<= 4;
+	}
+      if (reg1_present)
+	reg1 <<= 4;
+      bin |= reg1 | reg2;
+    }
+  if (opcode->insn_size == 2)
+    {
+      bfd_putl32 ((bfd_vma)bin, frag);
+    }
+  else
+    {
+      bfd_putl16 ((bfd_vma)bin, frag);
+    }
+  *line = str;
+  return bin;
+}
+
+static unsigned int
+avr_get_constant (str, max)
+     char * str;
+     unsigned int max;
+{
+  expressionS ex;
+  str = skip_space (str);
+  input_line_pointer = str;
+  expression (&ex);
+
+  if (ex.X_op != O_constant)
+    as_bad (_("constant value required"));
+
+  if (ex.X_add_number > max)
+    as_bad (_("number must be less than %d"), max+1);
+  return ex.X_add_number;
+}
+
+static unsigned int
+avr_operand (opcode, where, op, line)
+     struct avr_opcodes_s *opcode;
+     int where;
+     char *op;
+     char **line;
+{
+  unsigned int op_mask = 0;
+  char *str = *line;
+  expressionS op_expr;
+
+  str = skip_space (str);
+  switch (*op)
+    {
+      /* Any register operand.  */
+    case 'w':
+    case 'd':
+    case 'r':
+      {
+	char r_name[256];
+	str = extract_word (str, r_name, sizeof (r_name));
+	parse_exp (r_name, &op_expr);
+	if (op_expr.X_op == O_register)
+	  {
+	    op_mask = op_expr.X_add_number;
+	    if (op_mask <= 31)
+	      {
+		if (*op == 'd')
+		  {
+		    if (op_mask < 16)
+		      as_bad (_ ("register number above 15 required"));
+		    op_mask -= 16;
+		  }
+		if (*op == 'w')
+		  {
+		    op_mask -= 24;
+		    if (op_mask & 1 || op_mask > 6)
+		      as_bad (_ ("register r24,r26,r28 or r30 required"));
+		    op_mask >>= 1;
+		  }
+		break;
+	      }
+	  }
+	as_bad (_ ("register required"));
+      }
+      break;
+
+    case 'e':
+      {
+	char c;
+	if (*str == '-')
+	  {
+	    str = skip_space (str+1);
+	    op_mask = 0x1002;
+	  }
+	c = tolower (*str);
+	if (c == 'x')
+	  op_mask |= 0x100c;
+	else if (c == 'y')
+	  op_mask |= 0x8;
+	else if (c != 'z')
+	  as_bad (_ ("pointer register (X,Y or Z) required"));
+
+	str = skip_space (str+1);
+	if (*str == '+')
+	  {
+	    ++str;
+	    if (op_mask & 2)
+	      as_bad (_ ("cannot both predecrement and postincrement"));
+	    op_mask |= 0x1001;
+	  }
+      }
+      break;
+
+    case 'b':
+      {
+	char c = tolower (*str++);
+	if (c == 'y')
+	  op_mask |= 0x8;
+	else if (c != 'z')
+	  as_bad (_ ("pointer register (Y or Z) required"));
+	str = skip_space (str);
+	if (*str++ == '+')
+	  {
+	    unsigned int x;
+	    x = avr_get_constant (str, 63);
+	    str = input_line_pointer;
+	    op_mask |= (x & 7) | ((x & (3 << 3)) << 7) | ((x & (1 << 5)) << 8);
+	  }
+      }
+      break;
+
+    case 'h':
+      {
+	str = parse_exp (str, &op_expr);
+	fix_new_exp (frag_now, where, opcode->insn_size * 2,
+		     &op_expr, false, BFD_RELOC_AVR_CALL);
+
+      }
+      break;
+
+    case 'L':
+      {
+	str = parse_exp (str, &op_expr);
+	fix_new_exp (frag_now, where, opcode->insn_size * 2,
+		     &op_expr, true, BFD_RELOC_AVR_13_PCREL);
+
+      }
+      break;
+
+    case 'l':
+      {
+	str = parse_exp (str, &op_expr);
+	fix_new_exp (frag_now, where, opcode->insn_size * 2,
+		     &op_expr, true, BFD_RELOC_AVR_7_PCREL);
+
+      }
+      break;
+
+    case 'i':
+      {
+	str = parse_exp (str, &op_expr);
+	fix_new_exp (frag_now, where+2, opcode->insn_size * 2,
+		     &op_expr, false, BFD_RELOC_16);
+
+      }
+      break;
+
+    case 'M':
+      {
+	bfd_reloc_code_real_type r_type;
+ 	input_line_pointer = str;
+ 	r_type = avr_ldi_expression (&op_expr);
+ 	str = input_line_pointer;
+	fix_new_exp (frag_now, where, 3,
+		     &op_expr, false, r_type);
+      }
+      break;
+
+    case 'n':
+      {
+	unsigned int x;
+	x = ~avr_get_constant (str, 255);
+	str = input_line_pointer;
+	op_mask |= (x & 0xf) | ((x << 4) & 0xf00);
+      }
+      break;
+
+    case 'K':
+      {
+	unsigned int x;
+	x = avr_get_constant (str, 63);
+	str = input_line_pointer;
+	op_mask |= (x & 0xf) | ((x & 0x30) << 2);
+      }
+      break;
+
+    case 'S':
+    case 's':
+      {
+	unsigned int x;
+	x = avr_get_constant (str, 7);
+	str = input_line_pointer;
+	if (*op == 'S')
+	  x <<= 4;
+	op_mask |= x;
+      }
+      break;
+
+    case 'P':
+      {
+	unsigned int x;
+	x = avr_get_constant (str, 63);
+	str = input_line_pointer;
+	op_mask |= (x & 0xf) | ((x & 0x30) << 5);
+      }
+      break;
+
+    case 'p':
+      {
+	unsigned int x;
+	x = avr_get_constant (str, 31);
+	str = input_line_pointer;
+	op_mask |= x << 3;
+      }
+      break;
+    default:
+      as_bad (_ ("unknown constraint `%c'"), *op);
+    }
+  *line = str;
+  return op_mask;
+}
+
+/* GAS will call this function for each section at the end of the assembly,
+   to permit the CPU backend to adjust the alignment of a section.  */
+valueT
+md_section_align (seg, addr)
+     asection *seg;
+     valueT addr;
+{
+  int align = bfd_get_section_alignment (stdoutput, seg);
+  return ((addr + (1 << align) - 1) & (-1 << align));
+}
+
+/* If you define this macro, it should return the offset between the
+   address of a PC relative fixup and the position from which the PC
+   relative adjustment should be made.  On many processors, the base
+   of a PC relative instruction is the next instruction, so this
+   macro would return the length of an instruction.  */
+long
+md_pcrel_from_section (fixp, sec)
+     fixS *fixp;
+     segT sec;
+{
+  if (fixp->fx_addsy != (symbolS *)NULL
+      && (!S_IS_DEFINED (fixp->fx_addsy)
+	  || (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
+    return 0;
+  return fixp->fx_frag->fr_address + fixp->fx_where;
+}
+
+/* GAS will call this for each fixup.  It should store the correct
+   value in the object file. */
+int
+md_apply_fix3 (fixp, valuep, seg)
+     fixS *fixp;
+     valueT *valuep;
+     segT seg;
+{
+  unsigned char *where;
+  unsigned long insn;
+  long value;
+
+  if (fixp->fx_addsy == (symbolS *) NULL)
+    {
+      value = *valuep;
+      fixp->fx_done = 1;
+    }
+  else if (fixp->fx_pcrel)
+    {
+      segT s = S_GET_SEGMENT (fixp->fx_addsy);
+      if (fixp->fx_addsy && (s == seg || s == absolute_section))
+	{
+	  value = S_GET_VALUE (fixp->fx_addsy) + *valuep;
+	  fixp->fx_done = 1;
+	}
+      else
+	value = *valuep;
+    }
+  else
+    {
+      value = fixp->fx_offset;
+      if (fixp->fx_subsy != (symbolS *) NULL)
+	{
+	  if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
+	    {
+	      value -= S_GET_VALUE (fixp->fx_subsy);
+	      fixp->fx_done = 1;
+	    }
+	  else
+	    {
+	      /* We don't actually support subtracting a symbol.  */
+ 	      as_bad_where (fixp->fx_file, fixp->fx_line,
+			    _ ("expression too complex"));
+	    }
+	}
+    }
+  switch (fixp->fx_r_type)
+    {
+    default:
+      fixp->fx_no_overflow = 1;
+      break;
+    case BFD_RELOC_AVR_7_PCREL:
+    case BFD_RELOC_AVR_13_PCREL:
+    case BFD_RELOC_32:
+    case BFD_RELOC_16:
+    case BFD_RELOC_AVR_CALL:
+      break;
+    }
+
+  if (fixp->fx_done)
+    {
+      /* Fetch the instruction, insert the fully resolved operand
+	 value, and stuff the instruction back again.  */
+      where = fixp->fx_frag->fr_literal + fixp->fx_where;
+      insn = bfd_getl16 (where);
+
+      switch (fixp->fx_r_type)
+	{
+	case BFD_RELOC_AVR_7_PCREL:
+	  if (value & 1)
+	    as_bad_where (fixp->fx_file, fixp->fx_line,
+			  _("odd address operand: %ld"), value);
+	  /* Instruction addresses are always right-shifted by 1.  */
+	  value >>= 1;
+	  --value;			/* Correct PC.  */
+	  if (value < -64 || value > 63)
+	    as_bad_where (fixp->fx_file, fixp->fx_line,
+			  _("operand out of range: %ld"), value);
+	  value = (value << 3) & 0x3f8;
+	  bfd_putl16 ((bfd_vma) (value | insn), where);
+	  break;
+
+	case BFD_RELOC_AVR_13_PCREL:
+	  if (value & 1)
+	    as_bad_where (fixp->fx_file, fixp->fx_line,
+			  _("odd address operand: %ld"), value);
+	  /* Instruction addresses are always right-shifted by 1.  */
+	  value >>= 1;
+	  --value;			/* Correct PC.  */
+	  /* XXX AT90S8515 must have WRAP here.  */
+
+	  if (value < -2048 || value > 2047)
+	    {
+	      if (avr_mcu->mach == bfd_mach_avr2)
+		{
+		  if (value > 2047)
+		    value -= 4096;
+		  else
+		    value += 4096;
+		}
+	      else
+		as_bad_where (fixp->fx_file, fixp->fx_line,
+			      _("operand out of range: %ld"), value);
+	    }
+
+	  value &= 0xfff;
+	  bfd_putl16 ((bfd_vma) (value | insn), where);
+	  break;
+
+	case BFD_RELOC_32:
+	  bfd_putl16 ((bfd_vma) value, where);
+	  break;
+
+	case BFD_RELOC_16:
+	  bfd_putl16 ((bfd_vma) value, where);
+	  break;
+
+	case BFD_RELOC_AVR_16_PM:
+	  bfd_putl16 ((bfd_vma) (value>>1), where);
+	  break;
+
+	case BFD_RELOC_AVR_LO8_LDI:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where);
+	  break;
+
+	case -BFD_RELOC_AVR_LO8_LDI:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where);
+	  break;
+
+	case BFD_RELOC_AVR_HI8_LDI:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 8), where);
+	  break;
+
+	case -BFD_RELOC_AVR_HI8_LDI:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 24), where);
+	  break;
+
+	case BFD_RELOC_AVR_HH8_LDI:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where);
+	  break;
+
+	case BFD_RELOC_AVR_LO8_LDI_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value), where);
+	  break;
+
+	case -BFD_RELOC_AVR_LO8_LDI_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where);
+	  break;
+
+	case BFD_RELOC_AVR_HI8_LDI_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 8), where);
+	  break;
+
+	case -BFD_RELOC_AVR_HI8_LDI_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 24), where);
+	  break;
+
+	case BFD_RELOC_AVR_HH8_LDI_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where);
+	  break;
+
+	case BFD_RELOC_AVR_LO8_LDI_PM:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 1), where);
+	  break;
+
+	case BFD_RELOC_AVR_HI8_LDI_PM:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 9), where);
+	  break;
+
+	case BFD_RELOC_AVR_HH8_LDI_PM:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 17), where);
+	  break;
+
+	case BFD_RELOC_AVR_LO8_LDI_PM_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 1), where);
+	  break;
+
+	case BFD_RELOC_AVR_HI8_LDI_PM_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 9), where);
+	  break;
+
+	case BFD_RELOC_AVR_HH8_LDI_PM_NEG:
+	  bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 17), where);
+	  break;
+
+	case BFD_RELOC_AVR_CALL:
+	  {
+	    unsigned long x;
+	    x = bfd_getl16 (where);
+	    if (value & 1)
+	      as_bad_where (fixp->fx_file, fixp->fx_line,
+			    _("odd address operand: %ld"), value);
+	    value >>= 1;
+	    x |= ((value & 0x10000) | ((value << 3) & 0x1f00000)) >> 16;
+	    bfd_putl16 ((bfd_vma) x, where);
+	    bfd_putl16 ((bfd_vma) (value & 0xffff), where+2);
+	  }
+	  break;
+
+	default:
+	  as_fatal ( _("line %d: unknown relocation type: 0x%x"),
+		     fixp->fx_line, fixp->fx_r_type);
+	  break;
+	}
+    }
+  else
+    {
+      switch (fixp->fx_r_type)
+	{
+	case -BFD_RELOC_AVR_HI8_LDI_NEG:
+	case -BFD_RELOC_AVR_HI8_LDI:
+	case -BFD_RELOC_AVR_LO8_LDI_NEG:
+	case -BFD_RELOC_AVR_LO8_LDI:
+	  as_bad_where (fixp->fx_file, fixp->fx_line,
+			_("only constant expression allowed"));
+	  fixp->fx_done = 1;
+	  break;
+	default:
+	  break;
+	}
+      fixp->fx_addnumber = value;
+    }
+  return 0;
+}
+
+
+/* A `BFD_ASSEMBLER' GAS will call this to generate a reloc.  GAS
+   will pass the resulting reloc to `bfd_install_relocation'.  This
+   currently works poorly, as `bfd_install_relocation' often does the
+   wrong thing, and instances of `tc_gen_reloc' have been written to
+   work around the problems, which in turns makes it difficult to fix
+   `bfd_install_relocation'. */
+
+/* If while processing a fixup, a reloc really needs to be created
+   then it is done here.  */
+
+arelent *
+tc_gen_reloc (seg, fixp)
+     asection *seg;
+     fixS *fixp;
+{
+  arelent *reloc;
+
+  reloc = (arelent *) xmalloc (sizeof (arelent));
+
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+
+  reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+  reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
+  if (reloc->howto == (reloc_howto_type *) NULL)
+    {
+      as_bad_where (fixp->fx_file, fixp->fx_line,
+                    _("reloc %d not supported by object file format"),
+		    (int)fixp->fx_r_type);
+      return NULL;
+    }
+
+  if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+      || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+    reloc->address = fixp->fx_offset;
+
+  reloc->addend = fixp->fx_offset;
+
+  return reloc;
+}
+
+
+void
+md_assemble (str)
+     char *str;
+{
+  struct avr_opcodes_s * opcode;
+  char op[11];
+
+  str = extract_word (str, op, sizeof(op));
+
+  if (!op[0])
+    as_bad (_ ("can't find opcode "));
+
+  opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op);
+
+  if (opcode == NULL)
+    {
+      as_bad (_ ("unknown opcode `%s'"), op);
+      return;
+    }
+
+  if ((opcode->isa & avr_mcu->isa) != opcode->isa)
+    as_bad (_ ("illegal opcode %s for mcu %s"), opcode->name, avr_mcu->name);
+
+  /* We used to set input_line_pointer to the result of get_operands,
+     but that is wrong.  Our caller assumes we don't change it.  */
+  {
+    char *t = input_line_pointer;
+    avr_operands (opcode, &str);
+    if (*str)
+      as_bad (_ ("garbage at end of line"));
+    input_line_pointer = t;
+  }
+}
+
+/* Parse ordinary expression.  */
+static char *
+parse_exp (s, op)
+     char *s;
+     expressionS * op;
+{
+  input_line_pointer = s;
+  expression (op);
+  if (op->X_op == O_absent)
+    as_bad (_("missing operand"));
+  return input_line_pointer;
+}
+
+
+/* Parse special expressions (needed for LDI command):
+   xx8 (address)
+   xx8 (-address)
+   pm_xx8 (address)
+   pm_xx8 (-address)
+   where xx is: hh, hi, lo
+*/
+static bfd_reloc_code_real_type
+avr_ldi_expression (exp)
+     expressionS *exp;
+{
+  char *str = input_line_pointer;
+  char *tmp;
+  char op[8];
+  int mod;
+  tmp = str;
+
+  str = extract_word (str, op, sizeof (op));
+  if (op[0])
+    {
+      mod = (int) hash_find (avr_mod_hash, op);
+      if (mod)
+	{
+	  int closes = 0;
+	  mod -= 10;
+	  str = skip_space (str);
+	  if (*str == '(')
+	    {
+	      int neg_p = 0;
+	      ++str;
+	      if (strncmp ("pm(", str, 3) == 0
+		  || strncmp ("-(pm(", str, 5) == 0)
+		{
+		  if (HAVE_PM_P(mod))
+		    {
+		      ++mod;
+		      ++closes;
+		    }
+		  else
+		    as_bad (_ ("illegal expression"));
+		  if (*str == '-')
+		    {
+		      neg_p = 1;
+		      ++closes;
+		      str += 5;
+		    }
+		  else
+		    str += 3;
+		}
+	      if (*str == '-' && *(str + 1) == '(')
+		{
+		  neg_p ^= 1;
+		  ++closes;
+		  str += 2;
+		}
+	      input_line_pointer = str;
+	      expression (exp);
+	      do
+		{
+		  if (*input_line_pointer != ')')
+		    {
+		      as_bad (_ ("`)' required"));
+		      break;
+		    }
+		  input_line_pointer++;
+		}
+	      while (closes--);
+	      return neg_p ? EXP_MOD_NEG_RELOC (mod) : EXP_MOD_RELOC (mod);
+	    }
+	}
+    }
+  input_line_pointer = tmp;
+  expression (exp);
+  return BFD_RELOC_AVR_LO8_LDI;
+}
+
+/* Flag to pass `pm' mode between `avr_parse_cons_expression' and
+   `avr_cons_fix_new' */
+static int exp_mod_pm = 0;
+
+/* Parse special CONS expression: pm (expression)
+   which is used for addressing to a program memory.
+   Relocation: BFD_RELOC_AVR_16_PM */
+void
+avr_parse_cons_expression (exp, nbytes)
+     expressionS *exp;
+     int nbytes;
+{
+  char * tmp;
+
+  exp_mod_pm = 0;
+
+  tmp = input_line_pointer = skip_space (input_line_pointer);
+
+  if (nbytes == 2)
+    {
+      char * pm_name = "pm";
+      int len = strlen (pm_name);
+      if (strncasecmp (input_line_pointer, pm_name, len) == 0)
+	{
+	  input_line_pointer = skip_space (input_line_pointer + len);
+	  if (*input_line_pointer == '(')
+	    {
+	      input_line_pointer = skip_space (input_line_pointer + 1);
+	      exp_mod_pm = 1;
+	      expression (exp);
+	      if (*input_line_pointer == ')')
+		++input_line_pointer;
+	      else
+		{
+		  as_bad (_ ("`)' required"));
+		  exp_mod_pm = 0;
+		}
+	      return;
+	    }
+	  input_line_pointer = tmp;
+	}
+    }
+  expression (exp);
+}
+
+void
+avr_cons_fix_new(frag, where, nbytes, exp)
+     fragS *frag;
+     int where;
+     int nbytes;
+     expressionS *exp;
+{
+  if (exp_mod_pm == 0)
+    {
+      if (nbytes == 2)
+	fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_16);
+      else if (nbytes == 4)
+	fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_32);
+      else
+	as_bad (_ ("illegal %srelocation size: %d"), "", nbytes);
+    }
+  else
+    {
+      if (nbytes == 2)
+	fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_AVR_16_PM);
+      else
+	as_bad (_ ("illegal %srelocation size: %d"), "`pm' ", nbytes);
+      exp_mod_pm = 0;
+    }
+}
diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h
new file mode 100644
index 0000000..2a8d3ee
--- /dev/null
+++ b/gas/config/tc-avr.h
@@ -0,0 +1,118 @@
+/* This file is tc-avr.h
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+   Contributed by Denis Chertykov <denisc@overta.ru>
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+#ifndef BFD_ASSEMBLER
+ #error AVR support requires BFD_ASSEMBLER
+#endif
+
+
+#define TC_AVR
+/*   By convention, you should define this macro in the `.h' file.  For
+     example, `tc-m68k.h' defines `TC_M68K'.  You might have to use this
+     if it is necessary to add CPU specific code to the object format
+     file. */
+
+#define TARGET_FORMAT "elf32-avr"
+/*   This macro is the BFD target name to use when creating the output
+     file.  This will normally depend upon the `OBJ_FMT' macro. */
+
+#define TARGET_ARCH bfd_arch_avr
+/*   This macro is the BFD architecture to pass to `bfd_set_arch_mach'. */
+
+#define TARGET_MACH 0
+/*   This macro is the BFD machine number to pass to
+     `bfd_set_arch_mach'.  If it is not defined, GAS will use 0. */
+
+#define TARGET_BYTES_BIG_ENDIAN 0
+/*   You should define this macro to be non-zero if the target is big
+     endian, and zero if the target is little endian. */
+
+#define ONLY_STANDARD_ESCAPES
+/*   If you define this macro, GAS will warn about the use of
+     nonstandard escape sequences in a string. */
+
+#define md_operand(x)
+/*   GAS will call this function for any expression that can not be
+     recognized.  When the function is called, `input_line_pointer'
+     will point to the start of the expression. */
+
+void avr_parse_cons_expression (expressionS *exp, int nbytes);
+
+#define TC_PARSE_CONS_EXPRESSION(EXPR,N) avr_parse_cons_expression (EXPR,N)
+/*
+     You may define this macro to parse an expression used in a data
+     allocation pseudo-op such as `.word'.  You can use this to
+     recognize relocation directives that may appear in such directives.*/
+
+void avr_cons_fix_new(fragS *frag,int where, int nbytes, expressionS *exp);
+
+#define TC_CONS_FIX_NEW(FRAG,WHERE,N,EXP) avr_cons_fix_new(FRAG,WHERE,N,EXP)
+/*   You may define this macro to generate a fixup for a data
+     allocation pseudo-op. */
+
+#define md_number_to_chars number_to_chars_littleendian
+/*   This should just call either `number_to_chars_bigendian' or
+     `number_to_chars_littleendian', whichever is appropriate.  On
+     targets like the MIPS which support options to change the
+     endianness, which function to call is a runtime decision.  On
+     other targets, `md_number_to_chars' can be a simple macro. */
+
+#define WORKING_DOT_WORD
+/*
+`md_short_jump_size'
+`md_long_jump_size'
+`md_create_short_jump'
+`md_create_long_jump'
+     If `WORKING_DOT_WORD' is defined, GAS will not do broken word
+     processing (*note Broken words::.).  Otherwise, you should set
+     `md_short_jump_size' to the size of a short jump (a jump that is
+     just long enough to jump around a long jmp) and
+     `md_long_jump_size' to the size of a long jump (a jump that can go
+     anywhere in the function), You should define
+     `md_create_short_jump' to create a short jump around a long jump,
+     and define `md_create_long_jump' to create a long jump. */
+
+#define MD_APPLY_FIX3
+
+#define TC_HANDLES_FX_DONE
+
+#undef RELOC_EXPANSION_POSSIBLE
+/*   If you define this macro, it means that `tc_gen_reloc' may return
+     multiple relocation entries for a single fixup.  In this case, the
+     return value of `tc_gen_reloc' is a pointer to a null terminated
+     array. */
+
+#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)   
+/*   If you define this macro, it should return the offset between the
+     address of a PC relative fixup and the position from which the PC
+     relative adjustment should be made.  On many processors, the base
+     of a PC relative instruction is the next instruction, so this
+     macro would return the length of an instruction. */
+
+#define LISTING_WORD_SIZE 2
+/*   The number of bytes to put into a word in a listing.  This affects
+     the way the bytes are clumped together in the listing.  For
+     example, a value of 2 might print `1234 5678' where a value of 1
+     would print `12 34 56 78'.  The default value is 4. */
+
+#define LEX_DOLLAR 0
+/* AVR port uses `$' as a logical line separator */
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index cf38f3e..d20ae10 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -1,6 +1,5 @@
 /* tc-d10v.c -- Assembler code for the Mitsubishi D10V
-
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -37,8 +36,8 @@
 
 #define AT_WORD_P(X) ((X)->X_op == O_right_shift \
 		      && (X)->X_op_symbol != NULL \
-		      && (X)->X_op_symbol->sy_value.X_op == O_constant \
-		      && (X)->X_op_symbol->sy_value.X_add_number == AT_WORD_RIGHT_SHIFT)
+		      && symbol_constant_p ((X)->X_op_symbol) \
+		      && S_GET_VALUE ((X)->X_op_symbol) == AT_WORD_RIGHT_SHIFT)
 #define AT_WORD_RIGHT_SHIFT 2
 
 
@@ -63,6 +62,8 @@
 static Fixups FixUps[2];
 static Fixups *fixups;
 
+static int do_not_ignore_hash = 0;
+
 /* True if instruction swapping warnings should be inhibited.  */
 static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap */
 
@@ -159,7 +160,7 @@
     {
       expressionP->X_op = O_register;
       /* temporarily store a pointer to the string here */
-      expressionP->X_op_symbol = (struct symbol *)input_line_pointer;
+      expressionP->X_op_symbol = (symbolS *)input_line_pointer;
       expressionP->X_add_number = reg_number;
       input_line_pointer = p;
       return 1;
@@ -195,10 +196,19 @@
 
   if (flags & OPERAND_SIGNED)
     {
-      max = (1 << (bits - 1))-1; 
-      min = - (1 << (bits - 1));  
-      if (((long)num > max) || ((long)num < min))
-	retval = 1;
+      /* Signed 3-bit integers are restricted to the (-2, 3) range */
+      if (flags & RESTRICTED_NUM3)
+	{
+	  if ((long) num < -2 || (long) num > 3)
+	    retval = 1;
+	}
+      else
+	{
+	  max = (1 << (bits - 1)) - 1; 
+	  min = - (1 << (bits - 1));  
+	  if (((long) num > max) || ((long) num < min))
+	    retval = 1;
+	}
     }
   else
     {
@@ -393,7 +403,8 @@
   char *p = input_line_pointer;
   int numops = 0;
   int post = 0;
-
+  int uses_at = 0;
+  
   while (*p)  
     {
       while (*p == ' ' || *p == '\t' || *p == ',') 
@@ -403,6 +414,8 @@
       
       if (*p == '@') 
 	{
+	  uses_at = 1;
+	  
 	  p++;
 	  exp[numops].X_op = O_absent;
 	  if (*p == '(') 
@@ -437,7 +450,20 @@
       if (!register_name (&exp[numops]))
 	{
 	  /* parse as an expression */
-	  expression (&exp[numops]);
+	  if (uses_at)
+	    {
+	      /* Any expression that involves the indirect addressing
+		 cannot also involve immediate addressing.  Therefore
+		 the use of the hash character is illegal.  */
+	      int save = do_not_ignore_hash;
+	      do_not_ignore_hash = 1;
+	      
+	      expression (&exp[numops]);
+	      
+	      do_not_ignore_hash = save;
+	    }
+	  else
+	    expression (&exp[numops]);
 	}
 
       if (strncasecmp (input_line_pointer, "@word", 5) == 0)
@@ -1227,7 +1253,7 @@
 		    value = S_GET_VALUE(myops[opnum].X_add_symbol) - value -
 		      (obstack_next_free(&frchain_now->frch_obstack) - frag_now->fr_literal);
 		  else
-		    value = S_GET_VALUE(myops[opnum].X_add_symbol);
+		    value += S_GET_VALUE(myops[opnum].X_add_symbol);
 
 		  if (AT_WORD_P (&myops[opnum]))
 		    {
@@ -1288,7 +1314,7 @@
 		  ((flags & OPERAND_PLUS)    && ((X_op != O_absent) || (num != OPERAND_PLUS))) ||
 		  ((flags & OPERAND_ATMINUS) && ((X_op != O_absent) || (num != OPERAND_ATMINUS))) ||
 		  ((flags & OPERAND_ATPAR)   && ((X_op != O_absent) || (num != OPERAND_ATPAR))) ||
-		  ((flags & OPERAND_ATSIGN)  && ((X_op != O_absent) || (num != OPERAND_ATSIGN))))
+		  ((flags & OPERAND_ATSIGN)  && ((X_op != O_absent) || ((num != OPERAND_ATSIGN) && (num != OPERAND_ATPAR)))))
 		{
 		  match = 0;
 		  break;
@@ -1376,7 +1402,8 @@
 {
   arelent *reloc;
   reloc = (arelent *) xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
@@ -1595,7 +1622,7 @@
 md_operand (expressionP)
      expressionS *expressionP;
 {
-  if (*input_line_pointer == '#')
+  if (*input_line_pointer == '#' && ! do_not_ignore_hash)
     {
       input_line_pointer++;
       expression (expressionP);
diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h
index c6ffd5c..18e6e30 100644
--- a/gas/config/tc-d10v.h
+++ b/gas/config/tc-d10v.h
@@ -60,3 +60,4 @@
 #define TC_FORCE_RELOCATION(fixp) d10v_force_relocation(fixp)
 extern int d10v_force_relocation PARAMS ((struct fix *));
 
+#define md_flush_pending_output  d10v_cleanup
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index c5033ba..f1dc0ea 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -1,6 +1,5 @@
 /* tc-d30v.c -- Assembler code for the Mitsubishi D30V
-
-   Copyright (C) 1997, 1998 Free Software Foundation.
+   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -32,6 +31,14 @@
 const char EXP_CHARS[] = "eE";
 const char FLT_CHARS[] = "dD";
 
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
 #define NOP_MULTIPLY 1
 #define NOP_ALL 2
 static int warn_nops = 0;
@@ -216,7 +223,7 @@
     {
       expressionP->X_op = O_register;
       /* temporarily store a pointer to the string here */
-      expressionP->X_op_symbol = (struct symbol *)input_line_pointer;
+      expressionP->X_op_symbol = (symbolS *)input_line_pointer;
       expressionP->X_add_number = reg_number;
       input_line_pointer = p;
       return 1;
@@ -234,38 +241,44 @@
      int flags;
 {
   long min, max;
-  int retval=0;
 
-  /* don't bother checking 32-bit values */
+  /* Don't bother checking 32-bit values.  */
   if (bits == 32)
-    return 0;
+    {
+      if (sizeof(unsigned long) * CHAR_BIT == 32)
+        return 0;
+
+      /* We don't record signed or unsigned for 32-bit quantities.
+	 Allow either.  */
+      min = -((unsigned long)1 << (bits - 1));
+      max = ((unsigned long)1 << bits) - 1;
+      return (long)num < min || (long)num > max;
+    }
 
   if (flags & OPERAND_SHIFT)
     {
       /* We know that all shifts are right by three bits.... */
       
       if (flags & OPERAND_SIGNED)
-	num = (unsigned long) (((/*signed*/ long) num) >> 3);
+	num = (unsigned long) ( (long) num >= 0) 
+		? ( ((long) num) >> 3 )
+		: ( (num >> 3) | ~(~(unsigned long)0 >> 3) );
       else
 	num >>= 3;
     }
 
   if (flags & OPERAND_SIGNED)
     {
-      max = (1 << (bits - 1))-1; 
-      min = - (1 << (bits - 1));
-      if (((long)num > max) || ((long)num < min))
-	retval = 1;
+      max = ((unsigned long)1 << (bits - 1)) - 1; 
+      min = - ((unsigned long)1 << (bits - 1));
+      return (long)num > max || (long)num < min;
     }
   else
     {
-      max = (1 << bits) - 1;
+      max = ((unsigned long)1 << bits) - 1;
       min = 0;
-      if ((num > max) || (num < min))
-	retval = 1;
+      return num > max || num < min;
     }
-  
-  return retval;
 }
 
 
@@ -569,7 +582,7 @@
      expressionS *opers;
 {
   int i, length, bits, shift, flags;
-  unsigned int number, id=0;
+  unsigned long number, id=0;
   long long insn;
   struct d30v_opcode *op = opcode->op;
   struct d30v_format *form = opcode->form;
@@ -644,10 +657,10 @@
       if (bits == 32)
 	{
 	  /* it's a LONG instruction */
-	  insn |= (number >> 26);	/* top 6 bits */
+	  insn |= ((number & 0xffffffff) >> 26);	/* top 6 bits */
 	  insn <<= 32;			/* shift the first word over */
-	  insn |= ((number & 0x03FC0000) << 2);  /* next 8 bits */ 
-	  insn |= number & 0x0003FFFF;		/* bottom 18 bits */
+	  insn |= ((number & 0x03FC0000) << 2);		/* next 8 bits */ 
+	  insn |= number & 0x0003FFFF;			/* bottom 18 bits */
 	}
       else
 	insn |= number << shift;
@@ -800,12 +813,16 @@
 	      fx = fx->next;
 	    }
 	}
-      else if (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR)
-	       && ((opcode1->op->flags_used & FLAG_DELAY) == 0)
-	       && ((opcode1->ecc == ECC_AL) || ! Optimizing))
+      else if ((opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR)
+		&& ((opcode1->op->flags_used & FLAG_DELAY) == 0)
+		&& ((opcode1->ecc == ECC_AL) || ! Optimizing))
+	       || opcode1->op->flags_used & FLAG_RP)
 	{
 	  /* We must emit (non-delayed) branch type instructions
 	     on their own with nothing in the right container.  */
+	  /* We must treat repeat instructions likewise, since the
+	     following instruction has to be separate from the repeat
+	     in order to be repeated.  */
 	  write_1_short (opcode1, insn1, fx->next, false);
 	  return 1;
 	}
@@ -1129,10 +1146,10 @@
   flags_used1 = op1->op->flags_used;
   flags_used2 = op2->op->flags_used;
 
-  /* ST2W/ST4HB combined with ADDppp/SUBppp is illegal.  */
-  if (((flags_set1 & (FLAG_MEM | FLAG_2WORD)) == (FLAG_MEM | FLAG_2WORD)
+  /* Check for illegal combinations with ADDppp/SUBppp.  */
+  if (((flags_set1 & FLAG_NOT_WITH_ADDSUBppp) != 0
        && (flags_used2 & FLAG_ADDSUBppp) != 0)
-      || ((flags_set2 & (FLAG_MEM | FLAG_2WORD)) == (FLAG_MEM | FLAG_2WORD)
+      || ((flags_set2 & FLAG_NOT_WITH_ADDSUBppp) != 0
 	  && (flags_used1 & FLAG_ADDSUBppp) != 0))
     return 0;
 
@@ -1745,7 +1762,8 @@
 {
   arelent *reloc;
   reloc = (arelent *) xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
@@ -2028,7 +2046,7 @@
   d30v_cleanup (false);
 
   /* Update the label's address with the current output pointer.  */
-  lab->sy_frag = frag_now;
+  symbol_set_frag (lab, frag_now);
   S_SET_VALUE (lab, (valueT) frag_now_fix ());
 
   /* Record this label for future adjustment after we find out what
@@ -2110,7 +2128,7 @@
       
       assert (S_GET_SEGMENT (label) == now_seg);
 
-      old_frag  = label->sy_frag;
+      old_frag  = symbol_get_frag (label);
       old_value = S_GET_VALUE (label);
       new_value = (valueT) frag_now_fix ();
       
@@ -2125,15 +2143,16 @@
 	 in the target fragment.  Note, this search is guaranteed to
 	 find at least one match when sym == label, so no special case
 	 code is necessary.  */
-      for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous)
+      for (sym = symbol_lastP; sym != NULL; sym = symbol_previous (sym))
 	{
-	  if (sym->sy_frag == old_frag && S_GET_VALUE (sym) == old_value)
+	  if (symbol_get_frag (sym) == old_frag
+	      && S_GET_VALUE (sym) == old_value)
 	    {
 	      label_seen = true;
-	      sym->sy_frag = frag_now;
+	      symbol_set_frag (sym, frag_now);
 	      S_SET_VALUE (sym, new_value);
 	    }
-	  else if (label_seen && sym->sy_frag != old_frag)
+	  else if (label_seen && symbol_get_frag (sym) != old_frag)
 	    break;
 	}
     }
diff --git a/gas/config/tc-d30v.h b/gas/config/tc-d30v.h
index acce285..dfebbb9 100644
--- a/gas/config/tc-d30v.h
+++ b/gas/config/tc-d30v.h
@@ -1,5 +1,5 @@
 /* tc-310v.h -- Header file for tc-d30v.c.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
    Written by Martin Hunt, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
@@ -15,8 +15,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA. */
 
 #define TC_D30V
 
@@ -52,7 +53,7 @@
 #define TC_START_LABEL(ch, ptr)      (ch == ':' && d30v_cleanup (false))
 #define md_start_line_hook()	     d30v_start_line (false)
 
-void d30v_frob_label PARAMS ((struct symbol *));
+void d30v_frob_label PARAMS ((symbolS *));
 #define tc_frob_label(sym)	     d30v_frob_label(sym)
 
 void d30v_cons_align PARAMS ((int));
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index aa075b7..aca5880 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -384,7 +384,7 @@
     {
       /* Address we want to reach in file space.  */
       target_address = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
-      target_address += fragP->fr_symbol->sy_frag->fr_address;
+      target_address += symbol_get_frag (fragP->fr_symbol)->fr_address;
       addend = (target_address - (opcode_address & -4)) >> 2;
     }
 
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 115ada1..736d6b9 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -311,7 +311,7 @@
 static char *
 skip_colonthing (ptr, exp, mode)
      char *ptr;
-     expressionS *exp;
+     expressionS *exp ATTRIBUTE_UNUSED;
      int *mode;
 {
   if (*ptr == ':')
@@ -399,7 +399,7 @@
 get_operand (ptr, op, dst, direction)
      char **ptr;
      struct h8_op *op;
-     unsigned int dst;
+     unsigned int dst ATTRIBUTE_UNUSED;
      int direction;
 {
   char *src = *ptr;
@@ -1343,21 +1343,21 @@
 
 void
 tc_crawl_symbol_chain (headers)
-     object_headers * headers;
+     object_headers * headers ATTRIBUTE_UNUSED;
 {
   printf (_("call to tc_crawl_symbol_chain \n"));
 }
 
 symbolS *
 md_undefined_symbol (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   return 0;
 }
 
 void
 tc_headers_hook (headers)
-     object_headers * headers;
+     object_headers * headers ATTRIBUTE_UNUSED;
 {
   printf (_("call to tc_headers_hook \n"));
 }
@@ -1433,15 +1433,15 @@
 
 int
 md_parse_option (c, arg)
-     int c;
-     char *arg;
+     int c ATTRIBUTE_UNUSED;
+     char *arg ATTRIBUTE_UNUSED;
 {
   return 0;
 }
 
 void
 md_show_usage (stream)
-     FILE *stream;
+     FILE *stream ATTRIBUTE_UNUSED;
 {
 }
 
@@ -1454,9 +1454,9 @@
 
 void
 md_convert_frag (headers, seg, fragP)
-     object_headers *headers;
-     segT seg;
-     fragS *fragP;
+     object_headers *headers ATTRIBUTE_UNUSED;
+     segT seg ATTRIBUTE_UNUSED;
+     fragS *fragP ATTRIBUTE_UNUSED;
 {
   printf (_("call to md_convert_frag \n"));
   abort ();
@@ -1500,8 +1500,8 @@
 
 int
 md_estimate_size_before_relax (fragP, segment_type)
-     register fragS *fragP;
-     register segT segment_type;
+     register fragS *fragP ATTRIBUTE_UNUSED;
+     register segT segment_type ATTRIBUTE_UNUSED;
 {
   printf (_("call tomd_estimate_size_before_relax \n"));
   abort ();
@@ -1519,7 +1519,7 @@
 }
 long
 md_pcrel_from (fixP)
-     fixS *fixP;
+     fixS *fixP ATTRIBUTE_UNUSED;
 {
   abort ();
 }
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 8785de8..7e95a4a 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1,5 +1,6 @@
 /* tc-hppa.c -- Assemble for the PA
-   Copyright (C) 1989, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -34,32 +35,40 @@
 /* Be careful, this file includes data *declarations*.  */
 #include "opcode/hppa.h"
 
+#if defined (OBJ_ELF) && defined (OBJ_SOM)
+error only one of OBJ_ELF and OBJ_SOM can be defined
+#endif
+
+/* If we are using ELF, then we probably can support dwarf2 debug
+   records.  Furthermore, if we are supporting dwarf2 debug records,
+   then we want to use the assembler support for compact line numbers.  */
+#ifdef OBJ_ELF
+#include "dwarf2dbg.h"
+struct dwarf2_line_info debug_line;
+#endif
+
 /* A "convient" place to put object file dependencies which do
    not need to be seen outside of tc-hppa.c.  */
 #ifdef OBJ_ELF
-/* Names of various debugging spaces/subspaces.  */
-#define GDB_DEBUG_SPACE_NAME ".stab"
-#define GDB_STRINGS_SUBSPACE_NAME ".stabstr"
-#define GDB_SYMBOLS_SUBSPACE_NAME ".stab"
-#define UNWIND_SECTION_NAME ".PARISC.unwind"
-/* Nonzero if CODE is a fixup code needing further processing.  */
-
 /* Object file formats specify relocation types.  */
-typedef elf32_hppa_reloc_type reloc_type;
+typedef elf_hppa_reloc_type reloc_type;
 
 /* Object file formats specify BFD symbol types.  */
 typedef elf_symbol_type obj_symbol_type;
 
+#ifdef BFD64
 /* How to generate a relocation.  */
-#define hppa_gen_reloc_type hppa_elf_gen_reloc_type
+#define hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
+#else
+#define hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
+#endif
 
 /* ELF objects can have versions, but apparently do not have anywhere
    to store a copyright string.  */
 #define obj_version obj_elf_version
 #define obj_copyright obj_elf_version
 
-/* Use space aliases.  */
-#define USE_ALIASES 1
+#define UNWIND_SECTION_NAME ".PARISC.unwind"
 #endif
 
 #ifdef OBJ_SOM
@@ -76,9 +85,6 @@
 #define obj_version obj_som_version
 #define obj_copyright obj_som_copyright
 
-/* Do not use space aliases.  */
-#define USE_ALIASES 0
-
 /* How to generate a relocation.  */
 #define hppa_gen_reloc_type hppa_som_gen_reloc_type
 
@@ -204,6 +210,8 @@
     fp_operand_format fpof1;
     fp_operand_format fpof2;
 
+    /* Whether or not we saw a truncation request on an fcnv insn.  */
+    int trunc;
 
     /* Holds the field selector for this instruction
        (for example L%, LR%, etc).  */
@@ -267,6 +275,7 @@
     unsigned int arg_count;
   };
 
+#ifdef OBJ_SOM
 /* This structure defines an entry in the subspace dictionary
    chain.  */
 
@@ -321,17 +330,6 @@
 
 typedef struct space_dictionary_chain sd_chain_struct;
 
-/* Structure for previous label tracking.  Needed so that alignments,
-   callinfo declarations, etc can be easily attached to a particular
-   label.  */
-typedef struct label_symbol_struct
-  {
-    struct symbol *lss_label;
-    sd_chain_struct *lss_space;
-    struct label_symbol_struct *lss_next;
-  }
-label_symbol_struct;
-
 /* This structure defines attributes of the default subspace
    dictionary entries.  */
 
@@ -378,9 +376,6 @@
     /* An index into the default spaces array.  */
     int def_space_index;
 
-    /* An alias for this section (or NULL if no alias exists).  */
-    char *alias;
-
     /* Subsegment associated with this subspace.  */
     subsegT subsegment;
   };
@@ -411,10 +406,24 @@
 
     /* Segment associated with this space.  */
     asection *segment;
-
-    /* An alias for this section (or NULL if no alias exists).  */
-    char *alias;
   };
+#endif
+
+/* Structure for previous label tracking.  Needed so that alignments,
+   callinfo declarations, etc can be easily attached to a particular
+   label.  */
+typedef struct label_symbol_struct
+  {
+    struct symbol *lss_label;
+#ifdef OBJ_SOM
+    sd_chain_struct *lss_space;
+#endif
+#ifdef OBJ_ELF
+    segT lss_segment;
+#endif
+    struct label_symbol_struct *lss_next;
+  }
+label_symbol_struct;
 
 /* Extra information needed to perform fixups (relocations) on the PA.  */
 struct hppa_fix_struct
@@ -461,7 +470,10 @@
 
 /* Prototypes for functions local to tc-hppa.c.  */
 
+#ifdef OBJ_SOM
 static void pa_check_current_space_and_subspace PARAMS ((void));
+#endif
+
 static fp_operand_format pa_parse_fp_format PARAMS ((char **s));
 static void pa_cons PARAMS ((int));
 static void pa_data PARAMS ((int));
@@ -483,7 +495,9 @@
 static int pa_parse_neg_cmpsub_cmpltr PARAMS ((char **, int));
 static int pa_parse_neg_add_cmpltr PARAMS ((char **, int));
 static int pa_parse_nonneg_add_cmpltr PARAMS ((char **, int));
-static void pa_align PARAMS ((int));
+static int pa_parse_cmpb_64_cmpltr PARAMS ((char **));
+static int pa_parse_cmpib_64_cmpltr PARAMS ((char **));
+static int pa_parse_addb_64_cmpltr PARAMS ((char **));
 static void pa_block PARAMS ((int));
 static void pa_brtab PARAMS ((int));
 static void pa_try PARAMS ((int));
@@ -492,9 +506,6 @@
 static void pa_callinfo PARAMS ((int));
 static void pa_code PARAMS ((int));
 static void pa_comm PARAMS ((int));
-#ifdef OBJ_SOM
-static void pa_compiler PARAMS ((int));
-#endif
 static void pa_copyright PARAMS ((int));
 static void pa_end PARAMS ((int));
 static void pa_enter PARAMS ((int));
@@ -510,15 +521,18 @@
 static void pa_origin PARAMS ((int));
 static void pa_proc PARAMS ((int));
 static void pa_procend PARAMS ((int));
-static void pa_space PARAMS ((int));
-static void pa_spnum PARAMS ((int));
-static void pa_subspace PARAMS ((int));
 static void pa_param PARAMS ((int));
 static void pa_undefine_label PARAMS ((void));
 static int need_pa11_opcode PARAMS ((struct pa_it *,
 				     struct pa_11_fp_reg_struct *));
 static int pa_parse_number PARAMS ((char **, struct pa_11_fp_reg_struct *));
 static label_symbol_struct *pa_get_label PARAMS ((void));
+#ifdef OBJ_SOM
+static void pa_compiler PARAMS ((int));
+static void pa_align PARAMS ((int));
+static void pa_space PARAMS ((int));
+static void pa_spnum PARAMS ((int));
+static void pa_subspace PARAMS ((int));
 static sd_chain_struct *create_new_space PARAMS ((char *, int, int,
 						  int, int, int,
 						  asection *, int));
@@ -539,6 +553,10 @@
 							    subsegT));
 static sd_chain_struct *pa_find_space_by_number PARAMS ((int));
 static unsigned int pa_subspace_start PARAMS ((sd_chain_struct *, int));
+static sd_chain_struct *pa_parse_space_stmt PARAMS ((char *, int));
+static int pa_next_subseg PARAMS ((sd_chain_struct *));
+static void pa_spaces_begin PARAMS ((void));
+#endif
 static void pa_ip PARAMS ((char *));
 static void fix_new_hppa PARAMS ((fragS *, int, int, symbolS *,
 				  long, expressionS *, int,
@@ -550,11 +568,10 @@
 static int pa_chk_field_selector PARAMS ((char **));
 static int is_same_frag PARAMS ((fragS *, fragS *));
 static void process_exit PARAMS ((void));
-static sd_chain_struct *pa_parse_space_stmt PARAMS ((char *, int));
 static int log2 PARAMS ((int));
-static int pa_next_subseg PARAMS ((sd_chain_struct *));
 static unsigned int pa_stringer_aux PARAMS ((char *));
-static void pa_spaces_begin PARAMS ((void));
+static fp_operand_format pa_parse_fp_cnv_format PARAMS ((char **s));
+static int pa_parse_ftest_gfx_completer PARAMS ((char **));
 
 #ifdef OBJ_ELF
 static void hppa_elf_mark_end_of_function PARAMS ((void));
@@ -563,6 +580,7 @@
 
 /* File and gloally scoped variable declarations.  */
 
+#ifdef OBJ_SOM
 /* Root and final entry in the space chain.  */
 static sd_chain_struct *space_dict_root;
 static sd_chain_struct *space_dict_last;
@@ -570,6 +588,7 @@
 /* The current space and subspace.  */
 static sd_chain_struct *current_space;
 static ssd_chain_struct *current_subspace;
+#endif
 
 /* Root of the call_info chain.  */
 static struct call_info *call_info_root;
@@ -596,7 +615,12 @@
 {
   /* align pseudo-ops on the PA specify the actual alignment requested,
      not the log2 of the requested alignment.  */
+#ifdef OBJ_SOM
   {"align", pa_align, 8},
+#endif
+#ifdef OBJ_ELF
+  {"align", s_align_bytes, 8},
+#endif
   {"begin_brtab", pa_brtab, 1},
   {"begin_try", pa_try, 1},
   {"block", pa_block, 1},
@@ -612,6 +636,7 @@
   {"copyright", pa_copyright, 0},
   {"data", pa_data, 0},
   {"double", pa_float_cons, 'd'},
+  {"dword", pa_cons, 8},
   {"end", pa_end, 0},
   {"end_brtab", pa_brtab, 0},
   {"end_try", pa_try, 0},
@@ -620,6 +645,9 @@
   {"equ", pa_equ, 0},
   {"exit", pa_exit, 0},
   {"export", pa_export, 0},
+#ifdef OBJ_ELF
+  { "file", dwarf2_directive_file },
+#endif
   {"fill", pa_fill, 0},
   {"float", pa_float_cons, 'f'},
   {"half", pa_cons, 2},
@@ -629,9 +657,14 @@
   {"lcomm", pa_lcomm, 0},
   {"leave", pa_leave, 0},
   {"level", pa_level, 0},
+#ifdef OBJ_ELF
+  { "loc", dwarf2_directive_loc },
+#endif
   {"long", pa_cons, 4},
   {"lsym", pa_lsym, 0},
+#ifdef OBJ_SOM
   {"nsubspa", pa_subspace, 1},
+#endif
   {"octa", pa_cons, 16},
   {"org", pa_origin, 0},
   {"origin", pa_origin, 0},
@@ -642,11 +675,15 @@
   {"reg", pa_equ, 1},
   {"short", pa_cons, 2},
   {"single", pa_float_cons, 'f'},
+#ifdef OBJ_SOM
   {"space", pa_space, 0},
   {"spnum", pa_spnum, 0},
+#endif
   {"string", pa_stringer, 0},
   {"stringz", pa_stringer, 1},
+#ifdef OBJ_SOM
   {"subspa", pa_subspace, 0},
+#endif
   {"text", pa_text, 0},
   {"version", pa_version, 0},
   {"word", pa_cons, 4},
@@ -701,9 +738,16 @@
 /* Holds the last field selector.  */
 static int hppa_field_selector;
 
+/* Nonzero when strict syntax checking is enabled.  Zero otherwise.
 
+   Each opcode in the table has a flag which indicates whether or not
+   strict syntax checking should be enabled for that instruction.  */
+static int strict = 0;
+
+#ifdef OBJ_SOM
 /* A dummy bfd symbol so that all relocations have symbols of some kind.  */
 static symbolS *dummy_symbol;
+#endif
 
 /* Nonzero if errors are to be printed.  */
 static int print_errors = 1;
@@ -982,6 +1026,7 @@
   {"lr", e_lrsel},
   {"ls", e_lssel},
   {"lt", e_ltsel},
+  {"ltp", e_ltpsel},
   {"n", e_nsel},
   {"nl", e_nlsel},
   {"nlr", e_nlrsel},
@@ -992,9 +1037,11 @@
   {"rr", e_rrsel},
   {"rs", e_rssel},
   {"rt", e_rtsel},
+  {"rtp", e_rtpsel},
   {"t", e_tsel},
 };
 
+#ifdef OBJ_SOM
 /* default space and subspace dictionaries */
 
 #define GDB_SYMBOLS          GDB_SYMBOLS_SUBSPACE_NAME
@@ -1012,31 +1059,23 @@
 
 static struct default_subspace_dict pa_def_subspaces[] =
 {
-  {"$CODE$", 1, 1, 1, 0, 0, 0, 24, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_CODE},
-  {"$DATA$", 1, 1, 0, 0, 0, 0, 24, 0x1f, 1, 8, 1, 1, ".data", SUBSEG_DATA},
-  {"$LIT$", 1, 1, 0, 0, 0, 0, 16, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_LIT},
-  {"$MILLICODE$", 1, 1, 0, 0, 0, 0, 8, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_MILLI},
-  {"$BSS$", 1, 1, 0, 0, 0, 1, 80, 0x1f, 1, 8, 1, 1, ".bss", SUBSEG_BSS},
-#ifdef OBJ_ELF
-  {"$UNWIND$", 1, 1, 0, 0, 0, 0, 64, 0x2c, 0, 4, 0, 0, ".PARISC.unwind", SUBSEG_UNWIND},
-#endif
+  {"$CODE$", 1, 1, 1, 0, 0, 0, 24, 0x2c, 0, 8, 0, 0, SUBSEG_CODE},
+  {"$DATA$", 1, 1, 0, 0, 0, 0, 24, 0x1f, 1, 8, 1, 1, SUBSEG_DATA},
+  {"$LIT$", 1, 1, 0, 0, 0, 0, 16, 0x2c, 0, 8, 0, 0, SUBSEG_LIT},
+  {"$MILLICODE$", 1, 1, 0, 0, 0, 0, 8, 0x2c, 0, 8, 0, 0, SUBSEG_MILLI},
+  {"$BSS$", 1, 1, 0, 0, 0, 1, 80, 0x1f, 1, 8, 1, 1, SUBSEG_BSS},
   {NULL, 0, 1, 0, 0, 0, 0, 255, 0x1f, 0, 4, 0, 0, 0}
 };
 
 static struct default_space_dict pa_def_spaces[] =
 {
-  {"$TEXT$", 0, 1, 1, 0, 8, ASEC_NULL, ".text"},
-  {"$PRIVATE$", 1, 1, 1, 1, 16, ASEC_NULL, ".data"},
-  {NULL, 0, 0, 0, 0, 0, ASEC_NULL, NULL}
+  {"$TEXT$", 0, 1, 1, 0, 8, ASEC_NULL},
+  {"$PRIVATE$", 1, 1, 1, 1, 16, ASEC_NULL},
+  {NULL, 0, 0, 0, 0, 0, ASEC_NULL}
 };
 
 /* Misc local definitions used by the assembler.  */
 
-/* Return nonzero if the string pointed to by S potentially represents
-   a right or left half of a FP register  */
-#define IS_R_SELECT(S)   (*(S) == 'R' || *(S) == 'r')
-#define IS_L_SELECT(S)   (*(S) == 'L' || *(S) == 'l')
-
 /* These macros are used to maintain spaces/subspaces.  */
 #define SPACE_DEFINED(space_chain)	(space_chain)->sd_defined
 #define SPACE_USER_DEFINED(space_chain) (space_chain)->sd_user_defined
@@ -1045,6 +1084,12 @@
 
 #define SUBSPACE_DEFINED(ss_chain)	(ss_chain)->ssd_defined
 #define SUBSPACE_NAME(ss_chain)		(ss_chain)->ssd_name
+#endif
+
+/* Return nonzero if the string pointed to by S potentially represents
+   a right or left half of a FP register  */
+#define IS_R_SELECT(S)   (*(S) == 'R' || *(S) == 'r')
+#define IS_L_SELECT(S)   (*(S) == 'L' || *(S) == 'l')
 
 /* Insert FIELD into OPCODE starting at bit START.  Continue pa_ip
    main loop after insertion.  */
@@ -1071,11 +1116,11 @@
 
 #define is_DP_relative(exp)			\
   ((exp).X_op == O_subtract			\
-   && strcmp((exp).X_op_symbol->bsym->name, "$global$") == 0)
+   && strcmp (S_GET_NAME ((exp).X_op_symbol), "$global$") == 0)
 
 #define is_PC_relative(exp)			\
   ((exp).X_op == O_subtract			\
-   && strcmp((exp).X_op_symbol->bsym->name, "$PIC_pcrel$0") == 0)
+   && strcmp (S_GET_NAME ((exp).X_op_symbol), "$PIC_pcrel$0") == 0)
 
 /* We need some complex handling for stabs (sym1 - sym2).  Luckily, we'll
    always be able to reduce the expression to a constant, so we don't
@@ -1098,18 +1143,6 @@
     as_fatal (_("Missing .procend\n"));
 }
 
-/* Check to make sure we have a valid space and subspace.  */
-
-static void
-pa_check_current_space_and_subspace ()
-{
-  if (current_space == NULL)
-    as_fatal (_("Not in a space.\n"));
-
-  if (current_subspace == NULL)
-    as_fatal (_("Not in a subspace.\n"));
-}
-
 /* Returns a pointer to the label_symbol_struct for the current space.
    or NULL if no label_symbol_struct exists for the current space.  */
 
@@ -1117,13 +1150,20 @@
 pa_get_label ()
 {
   label_symbol_struct *label_chain;
-  sd_chain_struct *space_chain = current_space;
 
   for (label_chain = label_symbols_rootp;
        label_chain;
        label_chain = label_chain->lss_next)
-    if (space_chain == label_chain->lss_space && label_chain->lss_label)
+    {
+#ifdef OBJ_SOM
+    if (current_space == label_chain->lss_space && label_chain->lss_label)
       return label_chain;
+#endif
+#ifdef OBJ_ELF
+    if (now_seg == label_chain->lss_segment && label_chain->lss_label)
+      return label_chain;
+#endif
+    }
 
   return NULL;
 }
@@ -1136,7 +1176,6 @@
      symbolS *symbol;
 {
   label_symbol_struct *label_chain = pa_get_label ();
-  sd_chain_struct *space_chain = current_space;
 
   if (label_chain)
     label_chain->lss_label = symbol;
@@ -1146,7 +1185,12 @@
       label_chain
 	= (label_symbol_struct *) xmalloc (sizeof (label_symbol_struct));
       label_chain->lss_label = symbol;
-      label_chain->lss_space = space_chain;
+#ifdef OBJ_SOM
+      label_chain->lss_space = current_space;
+#endif
+#ifdef OBJ_ELF
+      label_chain->lss_segment = now_seg;
+#endif
       label_chain->lss_next = NULL;
 
       if (label_symbols_rootp)
@@ -1164,13 +1208,19 @@
 {
   label_symbol_struct *label_chain;
   label_symbol_struct *prev_label_chain = NULL;
-  sd_chain_struct *space_chain = current_space;
 
   for (label_chain = label_symbols_rootp;
        label_chain;
        label_chain = label_chain->lss_next)
     {
-      if (space_chain == label_chain->lss_space && label_chain->lss_label)
+      if (1
+#ifdef OBJ_SOM
+ 	  && current_space == label_chain->lss_space && label_chain->lss_label
+#endif
+#ifdef OBJ_ELF
+ 	  && now_seg == label_chain->lss_segment && label_chain->lss_label
+#endif
+	  )
 	{
 	  /* Remove the label from the chain and free its memory.  */
 	  if (prev_label_chain)
@@ -1273,7 +1323,7 @@
 
   fix_new_hppa (frag, where, size,
 		(symbolS *) NULL, (offsetT) 0, exp, 0, rel_type,
-		hppa_field_selector, 32, 0, NULL);
+		hppa_field_selector, size * 8, 0, NULL);
 
   /* Reset field selector to its default state.  */
   hppa_field_selector = 0;
@@ -1304,7 +1354,9 @@
       flag_readonly_data_in_text = 0;
     }
 
+#ifdef OBJ_SOM
   pa_spaces_begin ();
+#endif
 
   op_hash = hash_new ();
 
@@ -1334,12 +1386,18 @@
   if (lose)
     as_fatal (_("Broken assembler.  No assembly attempted."));
 
+#ifdef OBJ_SOM
   /* SOM will change text_section.  To make sure we never put
      anything into the old one switch to the new one now.  */
   subseg_set (text_section, 0);
+#endif
 
+#ifdef OBJ_SOM
   dummy_symbol = symbol_find_or_make ("L$dummy");
   S_SET_SEGMENT (dummy_symbol, text_section);
+  /* Force the symbol to be converted to a real symbol. */
+  (void) symbol_get_bfdsym (dummy_symbol);
+#endif
 }
 
 /* Assemble a single instruction storing it into a frag.  */
@@ -1368,7 +1426,8 @@
 	  if (label_symbol->lss_label)
 	    {
 	      last_call_info->start_symbol = label_symbol->lss_label;
-	      label_symbol->lss_label->bsym->flags |= BSF_FUNCTION;
+	      symbol_get_bfdsym (label_symbol->lss_label)->flags
+		|= BSF_FUNCTION;
 #ifdef OBJ_SOM
 	      /* Also handle allocation of a fixup to hold the unwind
 		 information when the label appears after the proc/procend.  */
@@ -1405,6 +1464,23 @@
 		  (offsetT) 0, &the_insn.exp, the_insn.pcrel,
 		  the_insn.reloc, the_insn.field_selector,
 		  the_insn.format, the_insn.arg_reloc, NULL);
+
+#ifdef OBJ_ELF
+  if (debug_type == DEBUG_DWARF2)
+    {
+      bfd_vma addr;
+
+      /* First update the notion of the current source line.  */
+      dwarf2_where (&debug_line);
+
+      /* We want the offset of the start of this instruction within the
+	 the current frag.  */
+      addr = frag_now->fr_address + frag_now_fix () - 4;
+
+      /* And record the information.  */
+      dwarf2_gen_line_info (addr, &debug_line);
+    }
+#endif
 }
 
 /* Do the real work for assembling a single instruction.  Store results
@@ -1423,8 +1499,16 @@
   unsigned long opcode;
   struct pa_opcode *insn;
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
+
+  /* Convert everything up to the first whitespace character into lower
+     case.  */
+  for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++)
+    if (isupper (*s))
+      *s = tolower (*s);
 
   /* Skip to something interesting.  */
   for (s = str; isupper (*s) || islower (*s) || (*s >= '0' && *s <= '3'); ++s)
@@ -1451,14 +1535,6 @@
 
   save_s = str;
 
-  /* Convert everything into lower case.  */
-  while (*save_s)
-    {
-      if (isupper (*save_s))
-	*save_s = tolower (*save_s);
-      save_s++;
-    }
-
   /* Look up the opcode in the has table.  */
   if ((insn = (struct pa_opcode *) hash_find (op_hash, str)) == NULL)
     {
@@ -1478,6 +1554,7 @@
     {
       /* Do some initialization.  */
       opcode = insn->match;
+      strict = (insn->flags & FLAG_STRICT);
       memset (&the_insn, 0, sizeof (the_insn));
 
       the_insn.reloc = R_HPPA_NONE;
@@ -1502,6 +1579,10 @@
          sure that the operands match.  */
       for (args = insn->args;; ++args)
 	{
+	  /* Absorb white space in instruction.  */
+	  while (*s == ' ' || *s == '\t')
+	    s++;
+
 	  switch (*args)
 	    {
 
@@ -1533,26 +1614,65 @@
 	    /* Handle a 5 bit register or control register field at 10.  */
 	    case 'b':
 	    case '^':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
 	      num = pa_parse_number (&s, 0);
 	      CHECK_FIELD (num, 31, 0, 0);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 21);
 
+	    /* Handle %sar or %cr11.  No bits get set, we just verify that it
+	       is there.  */
+	    case '!':
+	      /* Skip whitespace before register.  */
+	      while (*s == ' ' || *s == '\t')
+		s = s + 1;
+
+	      if (!strncasecmp(s, "%sar", 4))
+	        {
+		  s += 4;
+		  continue;
+		}
+	      else if (!strncasecmp(s, "%cr11", 5))
+	        {
+		  s += 5;
+		  continue;
+		}
+	      break;
+
 	    /* Handle a 5 bit register field at 15.  */
 	    case 'x':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
 	      num = pa_parse_number (&s, 0);
 	      CHECK_FIELD (num, 31, 0, 0);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
 
 	    /* Handle a 5 bit register field at 31.  */
-	    case 'y':
 	    case 't':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
 	      num = pa_parse_number (&s, 0);
 	      CHECK_FIELD (num, 31, 0, 0);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
+	    /* Handle a 5 bit register field at 10 and 15.  */
+	    case 'a':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
+	      num = pa_parse_number (&s, 0);
+	      CHECK_FIELD (num, 31, 0, 0);
+	      opcode |= num << 16;
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 21);
+
 	    /* Handle a 5 bit field length at 31.  */
 	    case 'T':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
 	      CHECK_FIELD (num, 32, 1, 0);
 	      INSERT_FIELD_AND_CONTINUE (opcode, 32 - num, 0);
@@ -1560,546 +1680,1156 @@
 	    /* Handle a 5 bit immediate at 15.  */
 	    case '5':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 15, -16, 0);
+	      /* When in strict mode, we want to just reject this
+		 match instead of giving an out of range error.  */
+	      CHECK_FIELD (num, 15, -16, strict);
 	      low_sign_unext (num, 5, &num);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
 
 	    /* Handle a 5 bit immediate at 31.  */
 	    case 'V':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 15, -16, 0)
+	      /* When in strict mode, we want to just reject this
+		 match instead of giving an out of range error.  */
+	      CHECK_FIELD (num, 15, -16, strict)
 	      low_sign_unext (num, 5, &num);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
 	    /* Handle an unsigned 5 bit immediate at 31.  */
 	    case 'r':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
 	      CHECK_FIELD (num, 31, 0, 0);
-	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, strict);
 
 	    /* Handle an unsigned 5 bit immediate at 15.  */
 	    case 'R':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 31, 0, 0);
+	      CHECK_FIELD (num, 31, 0, strict);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
+
+	    /* Handle an unsigned 10 bit immediate at 15.  */
+	    case 'U':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 1023, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
 
 	    /* Handle a 2 bit space identifier at 17.  */
 	    case 's':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
 	      num = pa_parse_number (&s, 0);
 	      CHECK_FIELD (num, 3, 0, 1);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 14);
 
 	    /* Handle a 3 bit space identifier at 18.  */
 	    case 'S':
+	      /* This should be more strict.  Small steps.  */
+	      if (strict && *s != '%')
+		break;
 	      num = pa_parse_number (&s, 0);
 	      CHECK_FIELD (num, 7, 0, 1);
 	      dis_assemble_3 (num, &num);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
 
-	    /* Handle a completer for an indexing load or store.  */
+	    /* Handle all completers.  */
 	    case 'c':
-	      {
-		int uu = 0;
-		int m = 0;
-		int i = 0;
-		while (*s == ',' && i < 2)
+	      switch (*++args)
+		{
+
+		/* Handle a completer for an indexing load or store.  */
+		case 'x':
 		  {
-		    s++;
-		    if (strncasecmp (s, "sm", 2) == 0)
+		    int uu = 0;
+		    int m = 0;
+		    int i = 0;
+		    while (*s == ',' && i < 2)
 		      {
-			uu = 1;
-			m = 1;
+			s++;
+			if (strncasecmp (s, "sm", 2) == 0)
+			  {
+			    uu = 1;
+			    m = 1;
+			    s++;
+			    i++;
+			  }
+			else if (strncasecmp (s, "m", 1) == 0)
+			  m = 1;
+			else if ((strncasecmp (s, "s ", 2) == 0)
+				 || (strncasecmp (s, "s,", 2) == 0))
+			  uu = 1;
+			/* When in strict mode this is a match failure.  */
+			else if (strict)
+			  {
+			    s--;
+			    break;
+			  }
+			else
+			  as_bad (_("Invalid Indexed Load Completer."));
 			s++;
 			i++;
 		      }
-		    else if (strncasecmp (s, "m", 1) == 0)
-		      m = 1;
-		    else if (strncasecmp (s, "s", 1) == 0)
-		      uu = 1;
-		    else
-		      as_bad (_("Invalid Indexed Load Completer."));
-		    s++;
-		    i++;
-		  }
-		if (i > 2)
-		  as_bad (_("Invalid Indexed Load Completer Syntax."));
-		opcode |= m << 5;
-		INSERT_FIELD_AND_CONTINUE (opcode, uu, 13);
-	      }
-
-	    /* Handle a short load/store completer.  */
-	    case 'C':
-	      {
-		int a = 0;
-		int m = 0;
-		if (*s == ',')
-		  {
-		    s++;
-		    if (strncasecmp (s, "ma", 2) == 0)
-		      {
-			a = 0;
-			m = 1;
-		      }
-		    else if (strncasecmp (s, "mb", 2) == 0)
-		      {
-			a = 1;
-			m = 1;
-		      }
-		    else
-		      as_bad (_("Invalid Short Load/Store Completer."));
-		    s += 2;
+		    if (i > 2)
+		      as_bad (_("Invalid Indexed Load Completer Syntax."));
+		    opcode |= m << 5;
+		    INSERT_FIELD_AND_CONTINUE (opcode, uu, 13);
 		  }
 
-		if (*args == 'C')
+		/* Handle a short load/store completer.  */
+		case 'm':
+		case 'q':
+		case 'J':
+		case 'e':
 		  {
+		    int a = 0;
+		    int m = 0;
+		    if (*s == ',')
+		      {
+			int found = 0;
+			s++;
+			if (strncasecmp (s, "ma", 2) == 0)
+			  {
+			    a = 0;
+			    m = 1;
+			    found = 1;
+			  }
+			else if (strncasecmp (s, "mb", 2) == 0)
+			  {
+			    a = 1;
+			    m = 1;
+			    found = 1;
+			  }
+
+			/* When in strict mode, pass through for cache op.  */
+			if (!found && strict)
+			  s--;
+			else
+			  {
+			    if (!found)
+			      as_bad (_("Invalid Short Load/Store Completer."));
+			    s += 2;
+			  }
+		      }
+		    /* If we did not get a ma/mb completer, then we do not
+		       consider this a positive match for 'ce'.  */
+		    else if (*args == 'e')
+		      break;
+
+		   /* 'J', 'm' and 'q' are the same, except for where they
+		       encode the before/after field.  */
+		   if (*args == 'm')
+		      {
+			opcode |= m << 5;
+			INSERT_FIELD_AND_CONTINUE (opcode, a, 13);
+		      }
+		    else if (*args == 'q')
+		      {
+			opcode |= m << 3;
+			INSERT_FIELD_AND_CONTINUE (opcode, a, 2);
+		      }
+		    else if (*args == 'J')
+		      {
+		        /* M bit is explicit in the major opcode.  */
+			INSERT_FIELD_AND_CONTINUE (opcode, a, 2);
+		      }
+		    else if (*args == 'e')
+		      {
+			/* Gross!  Hide these values in the immediate field
+			   of the instruction, then pull them out later.  */
+			opcode |= m << 8;
+			opcode |= a << 9;
+			continue;
+		      }
+		  }
+
+		/* Handle a stbys completer.  */
+		case 's':
+		  {
+		    int a = 0;
+		    int m = 0;
+		    int i = 0;
+		    while (*s == ',' && i < 2)
+		      {
+			s++;
+			if (strncasecmp (s, "m", 1) == 0)
+			  m = 1;
+			else if ((strncasecmp (s, "b ", 2) == 0)
+				 || (strncasecmp (s, "b,", 2) == 0))
+			  a = 0;
+			else if (strncasecmp (s, "e", 1) == 0)
+			  a = 1;
+			/* When in strict mode this is a match failure.  */
+			else if (strict)
+			  {
+			    s--;
+			    break;
+			  }
+			else
+			  as_bad (_("Invalid Store Bytes Short Completer"));
+			s++;
+			i++;
+		      }
+		    if (i > 2)
+		      as_bad (_("Invalid Store Bytes Short Completer"));
 		    opcode |= m << 5;
 		    INSERT_FIELD_AND_CONTINUE (opcode, a, 13);
 		  }
-	      }
 
-	    /* Handle a stbys completer.  */
-	    case 'Y':
-	      {
-		int a = 0;
-		int m = 0;
-		int i = 0;
-		while (*s == ',' && i < 2)
-		  {
-		    s++;
-		    if (strncasecmp (s, "m", 1) == 0)
-		      m = 1;
-		    else if (strncasecmp (s, "b", 1) == 0)
-		      a = 0;
-		    else if (strncasecmp (s, "e", 1) == 0)
-		      a = 1;
-		    else
-		      as_bad (_("Invalid Store Bytes Short Completer"));
-		    s++;
-		    i++;
-		  }
-		if (i > 2)
-		  as_bad (_("Invalid Store Bytes Short Completer"));
-		opcode |= m << 5;
-		INSERT_FIELD_AND_CONTINUE (opcode, a, 13);
-	      }
-
-	    /* Handle a non-negated compare/stubtract condition.  */
-	    case '<':
-	      cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s, 1);
-	      if (cmpltr < 0)
-		{
-		  as_bad (_("Invalid Compare/Subtract Condition: %c"), *s);
+		/* Handle load cache hint completer.  */
+		case 'c':
 		  cmpltr = 0;
-		}
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
-
-	    /* Handle a negated or non-negated compare/subtract condition.  */
-	    case '?':
-	      save_s = s;
-	      cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s, 1);
-	      if (cmpltr < 0)
-		{
-		  s = save_s;
-		  cmpltr = pa_parse_neg_cmpsub_cmpltr (&s, 1);
-		  if (cmpltr < 0)
+		  if (!strncmp(s, ",sl", 3))
 		    {
-		      as_bad (_("Invalid Compare/Subtract Condition."));
-		      cmpltr = 0;
+		      s += 3;
+		      cmpltr = 2;
 		    }
-		  else
-		    {
-		      /* Negated condition requires an opcode change.  */
-		      opcode |= 1 << 27;
-		    }
-		}
-	
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+		  INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
 
-	    /* Handle non-negated add condition.  */
-	    case '!':
-	      cmpltr = pa_parse_nonneg_add_cmpltr (&s, 1);
-	      if (cmpltr < 0)
-		{
-		  as_bad (_("Invalid Compare/Subtract Condition: %c"), *s);
+		/* Handle store cache hint completer.  */
+		case 'C':
 		  cmpltr = 0;
-		}
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
-
-	    /* Handle a negated or non-negated add condition.  */
-	    case '@':
-	      save_s = s;
-	      cmpltr = pa_parse_nonneg_add_cmpltr (&s, 1);
-	      if (cmpltr < 0)
-		{
-		  s = save_s;
-		  cmpltr = pa_parse_neg_add_cmpltr (&s, 1);
-		  if (cmpltr < 0)
+		  if (!strncmp(s, ",sl", 3))
 		    {
-		      as_bad (_("Invalid Compare/Subtract Condition"));
-		      cmpltr = 0;
+		      s += 3;
+		      cmpltr = 2;
 		    }
-		  else
+		  else if (!strncmp(s, ",bc", 3))
 		    {
-		      /* Negated condition requires an opcode change.  */
-		      opcode |= 1 << 27;
-		    }
-		}
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
-
-	    /* Handle a compare/subtract condition.  */
-	    case 'a':
-	      cmpltr = 0;
-	      flag = 0;
-	      if (*s == ',')
-		{
-		  s++;
-		  name = s;
-		  while (*s != ',' && *s != ' ' && *s != '\t')
-		    s += 1;
-		  c = *s;
-		  *s = 0x00;
-		  if (strcmp (name, "=") == 0)
-		    cmpltr = 1;
-		  else if (strcmp (name, "<") == 0)
-		    cmpltr = 2;
-		  else if (strcmp (name, "<=") == 0)
-		    cmpltr = 3;
-		  else if (strcasecmp (name, "<<") == 0)
-		    cmpltr = 4;
-		  else if (strcasecmp (name, "<<=") == 0)
-		    cmpltr = 5;
-		  else if (strcasecmp (name, "sv") == 0)
-		    cmpltr = 6;
-		  else if (strcasecmp (name, "od") == 0)
-		    cmpltr = 7;
-		  else if (strcasecmp (name, "tr") == 0)
-		    {
-		      cmpltr = 0;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, "<>") == 0)
-		    {
+		      s += 3;
 		      cmpltr = 1;
-		      flag = 1;
 		    }
-		  else if (strcmp (name, ">=") == 0)
-		    {
-		      cmpltr = 2;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, ">") == 0)
-		    {
-		      cmpltr = 3;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, ">>=") == 0)
-		    {
-		      cmpltr = 4;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, ">>") == 0)
-		    {
-		      cmpltr = 5;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "nsv") == 0)
-		    {
-		      cmpltr = 6;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "ev") == 0)
-		    {
-		      cmpltr = 7;
-		      flag = 1;
-		    }
-		  else
-		    as_bad (_("Invalid Add Condition: %s"), name);
-		  *s = c;
-		}
-	      opcode |= cmpltr << 13;
-	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+		  INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
 
-	    /* Handle a non-negated add condition.  */
-	    case 'd':
-	      cmpltr = 0;
-	      flag = 0;
-	      if (*s == ',')
-		{
-		  s++;
-		  name = s;
-		  while (*s != ',' && *s != ' ' && *s != '\t')
-		    s += 1;
-		  c = *s;
-		  *s = 0x00;
-		  if (strcmp (name, "=") == 0)
-		    cmpltr = 1;
-		  else if (strcmp (name, "<") == 0)
-		    cmpltr = 2;
-		  else if (strcmp (name, "<=") == 0)
-		    cmpltr = 3;
-		  else if (strcasecmp (name, "nuv") == 0)
-		    cmpltr = 4;
-		  else if (strcasecmp (name, "znv") == 0)
-		    cmpltr = 5;
-		  else if (strcasecmp (name, "sv") == 0)
-		    cmpltr = 6;
-		  else if (strcasecmp (name, "od") == 0)
-		    cmpltr = 7;
-		  else if (strcasecmp (name, "tr") == 0)
+		/* Handle load and clear cache hint completer.  */
+		case 'd':
+		  cmpltr = 0;
+		  if (!strncmp(s, ",co", 3))
 		    {
-		      cmpltr = 0;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, "<>") == 0)
-		    {
+		      s += 3;
 		      cmpltr = 1;
-		      flag = 1;
 		    }
-		  else if (strcmp (name, ">=") == 0)
-		    {
-		      cmpltr = 2;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, ">") == 0)
-		    {
-		      cmpltr = 3;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "uv") == 0)
-		    {
-		      cmpltr = 4;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "vnz") == 0)
-		    {
-		      cmpltr = 5;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "nsv") == 0)
-		    {
-		      cmpltr = 6;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "ev") == 0)
-		    {
-		      cmpltr = 7;
-		      flag = 1;
-		    }
-		  else
-		    as_bad (_("Invalid Add Condition: %s"), name);
-		  *s = c;
-		}
-	      opcode |= cmpltr << 13;
-	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+		  INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
 
-	    /* HANDLE a logical instruction condition.  */
-	    case '&':
-	      cmpltr = 0;
-	      flag = 0;
-	      if (*s == ',')
-		{
-		  s++;
-		  name = s;
-		  while (*s != ',' && *s != ' ' && *s != '\t')
-		    s += 1;
-		  c = *s;
-		  *s = 0x00;
+		/* Handle load ordering completer. */
+		case 'o':
+		  if (strncmp(s, ",o", 2) != 0)
+		    break;
+		  s += 2;
+		  continue;
 
+		/* Handle a branch gate completer.  */
+		case 'g':
+		  if (strncasecmp (s, ",gate", 5) != 0)
+		    break;
+		  s += 5;
+		  continue;
 
-		  if (strcmp (name, "=") == 0)
-		    cmpltr = 1;
-		  else if (strcmp (name, "<") == 0)
-		    cmpltr = 2;
-		  else if (strcmp (name, "<=") == 0)
-		    cmpltr = 3;
-		  else if (strcasecmp (name, "od") == 0)
-		    cmpltr = 7;
-		  else if (strcasecmp (name, "tr") == 0)
-		    {
-		      cmpltr = 0;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, "<>") == 0)
-		    {
-		      cmpltr = 1;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, ">=") == 0)
-		    {
-		      cmpltr = 2;
-		      flag = 1;
-		    }
-		  else if (strcmp (name, ">") == 0)
-		    {
-		      cmpltr = 3;
-		      flag = 1;
-		    }
-		  else if (strcasecmp (name, "ev") == 0)
-		    {
-		      cmpltr = 7;
-		      flag = 1;
-		    }
-		  else
-		    as_bad (_("Invalid Logical Instruction Condition."));
-		  *s = c;
-		}
-	      opcode |= cmpltr << 13;
-	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+		/* Handle a branch link and push completer.  */
+		case 'p':
+		  if (strncasecmp (s, ",l,push", 7) != 0)
+		    break;
+		  s += 7;
+		  continue;
 
-	    /* Handle a unit instruction condition.  */
-	    case 'U':
-	      cmpltr = 0;
-	      flag = 0;
-	      if (*s == ',')
-		{
-		  s++;
+		/* Handle a branch link completer.  */
+		case 'l':
+		  if (strncasecmp (s, ",l", 2) != 0)
+		    break;
+		  s += 2;
+		  continue;
 
+		/* Handle a branch pop completer.  */
+		case 'P':
+		  if (strncasecmp (s, ",pop", 4) != 0)
+		    break;
+		  s += 4;
+		  continue;
 
-		  if (strncasecmp (s, "sbz", 3) == 0)
+		/* Handle a local processor completer.  */
+		case 'L':
+		  if (strncasecmp (s, ",l", 2) != 0)
+		    break;
+		  s += 2;
+		  continue;
+
+		/* Handle a PROBE read/write completer.  */
+		case 'w':
+		  flag = 0;
+		  if (!strncasecmp (s, ",w", 2))
 		    {
-		      cmpltr = 2;
-		      s += 3;
-		    }
-		  else if (strncasecmp (s, "shz", 3) == 0)
-		    {
-		      cmpltr = 3;
-		      s += 3;
-		    }
-		  else if (strncasecmp (s, "sdc", 3) == 0)
-		    {
-		      cmpltr = 4;
-		      s += 3;
-		    }
-		  else if (strncasecmp (s, "sbc", 3) == 0)
-		    {
-		      cmpltr = 6;
-		      s += 3;
-		    }
-		  else if (strncasecmp (s, "shc", 3) == 0)
-		    {
-		      cmpltr = 7;
-		      s += 3;
-		    }
-		  else if (strncasecmp (s, "tr", 2) == 0)
-		    {
-		      cmpltr = 0;
 		      flag = 1;
 		      s += 2;
 		    }
-		  else if (strncasecmp (s, "nbz", 3) == 0)
+		  else if (!strncasecmp (s, ",r", 2))
 		    {
-		      cmpltr = 2;
-		      flag = 1;
-		      s += 3;
+		      flag = 0;
+		      s += 2;
 		    }
-		  else if (strncasecmp (s, "nhz", 3) == 0)
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+		/* Handle MFCTL wide completer.  */
+		case 'W':
+		  if (strncasecmp (s, ",w", 2) != 0)
+		    break;
+		  s += 2;
+		  continue;
+
+		/* Handle an RFI restore completer.  */
+		case 'r':
+		  flag = 0;
+		  if (!strncasecmp (s, ",r", 2))
 		    {
-		      cmpltr = 3;
-		      flag = 1;
-		      s += 3;
+		      flag = 5;
+		      s += 2;
 		    }
-		  else if (strncasecmp (s, "ndc", 3) == 0)
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 5);
+
+		/* Handle a system control completer.  */
+		case 'Z':
+		  if (*s == ',' && (*(s + 1) == 'm' || *(s + 1) == 'M'))
 		    {
-		      cmpltr = 4;
 		      flag = 1;
-		      s += 3;
+		      s += 2;
 		    }
-		  else if (strncasecmp (s, "nbc", 3) == 0)
+		  else
+		    flag = 0;
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 5);
+
+		/* Handle intermediate/final completer for DCOR.  */
+		case 'i':
+		  flag = 0;
+		  if (!strncasecmp (s, ",i", 2))
 		    {
-		      cmpltr = 6;
 		      flag = 1;
-		      s += 3;
+		      s += 2;
 		    }
-		  else if (strncasecmp (s, "nhc", 3) == 0)
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+		/* Handle zero/sign extension completer.  */
+		case 'z':
+		  flag = 1;
+		  if (!strncasecmp (s, ",z", 2))
 		    {
-		      cmpltr = 7;
+		      flag = 0;
+		      s += 2;
+		    }
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 10);
+
+		/* Handle add completer.  */
+		case 'a':
+		  flag = 1;
+		  if (!strncasecmp (s, ",l", 2))
+		    {
+		      flag = 2;
+		      s += 2;
+		    }
+		  else if (!strncasecmp (s, ",tsv", 4))
+		    {
+		      flag = 3;
+		      s += 4;
+		    }
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 10);
+
+		/* Handle 64 bit carry for ADD.  */
+		case 'Y':
+		  flag = 0;
+		  if (!strncasecmp (s, ",dc,tsv", 7) ||
+		      !strncasecmp (s, ",tsv,dc", 7))
+		    {
 		      flag = 1;
+		      s += 7;
+		    }
+		  else if (!strncasecmp (s, ",dc", 3))
+		    {
+		      flag = 0;
 		      s += 3;
 		    }
 		  else
-		    as_bad (_("Invalid Logical Instruction Condition."));
-		}
-	      opcode |= cmpltr << 13;
-	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+		    break;
 
-	    /* Handle a shift/extract/deposit condition.  */
-	    case '|':
-	    case '>':
-	      cmpltr = 0;
-	      if (*s == ',')
-		{
-		  save_s = s++;
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
 
-
-		  name = s;
-		  while (*s != ',' && *s != ' ' && *s != '\t')
-		    s += 1;
-		  c = *s;
-		  *s = 0x00;
-		  if (strcmp (name, "=") == 0)
-		    cmpltr = 1;
-		  else if (strcmp (name, "<") == 0)
-		    cmpltr = 2;
-		  else if (strcasecmp (name, "od") == 0)
-		    cmpltr = 3;
-		  else if (strcasecmp (name, "tr") == 0)
-		    cmpltr = 4;
-		  else if (strcmp (name, "<>") == 0)
-		    cmpltr = 5;
-		  else if (strcmp (name, ">=") == 0)
-		    cmpltr = 6;
-		  else if (strcasecmp (name, "ev") == 0)
-		    cmpltr = 7;
-		  /* Handle movb,n.  Put things back the way they were.
-		     This includes moving s back to where it started.  */
-		  else if (strcasecmp (name, "n") == 0 && *args == '|')
+		/* Handle 32 bit carry for ADD.  */
+		case 'y':
+		  flag = 0;
+		  if (!strncasecmp (s, ",c,tsv", 6) ||
+		      !strncasecmp (s, ",tsv,c", 6))
 		    {
-		      *s = c;
-		      s = save_s;
+		      flag = 1;
+		      s += 6;
+		    }
+		  else if (!strncasecmp (s, ",c", 2))
+		    {
+		      flag = 0;
+		      s += 2;
+		    }
+		  else
+		    break;
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+		/* Handle trap on signed overflow.  */
+		case 'v':
+		  flag = 0;
+		  if (!strncasecmp (s, ",tsv", 4))
+		    {
+		      flag = 1;
+		      s += 4;
+		    }
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+		/* Handle trap on condition and overflow.  */
+		case 't':
+		  flag = 0;
+		  if (!strncasecmp (s, ",tc,tsv", 7) ||
+		      !strncasecmp (s, ",tsv,tc", 7))
+		    {
+		      flag = 1;
+		      s += 7;
+		    }
+		  else if (!strncasecmp (s, ",tc", 3))
+		    {
+		      flag = 0;
+		      s += 3;
+		    }
+		  else
+		    break;
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+		/* Handle 64 bit borrow for SUB.  */
+		case 'B':
+		  flag = 0;
+		  if (!strncasecmp (s, ",db,tsv", 7) ||
+		      !strncasecmp (s, ",tsv,db", 7))
+		    {
+		      flag = 1;
+		      s += 7;
+		    }
+		  else if (!strncasecmp (s, ",db", 3))
+		    {
+		      flag = 0;
+		      s += 3;
+		    }
+		  else
+		    break;
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+		/* Handle 32 bit borrow for SUB.  */
+		case 'b':
+		  flag = 0;
+		  if (!strncasecmp (s, ",b,tsv", 6) ||
+		      !strncasecmp (s, ",tsv,b", 6))
+		    {
+		      flag = 1;
+		      s += 6;
+		    }
+		  else if (!strncasecmp (s, ",b", 2))
+		    {
+		      flag = 0;
+		      s += 2;
+		    }
+		  else
+		    break;
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+		/* Handle trap condition completer for UADDCM.  */
+		case 'T':
+		  flag = 0;
+		  if (!strncasecmp (s, ",tc", 3))
+		    {
+		      flag = 1;
+		      s += 3;
+		    }
+
+		  INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+		/* Handle signed/unsigned at 21.  */
+		case 'S':
+		  {
+		    int sign = 1;
+		    if (strncasecmp (s, ",s", 2) == 0)
+		      {
+			sign = 1;
+			s += 2;
+		      }
+		    else if (strncasecmp (s, ",u", 2) == 0)
+		      {
+			sign = 0;
+			s += 2;
+		      }
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, sign, 10);
+		  }
+
+		/* Handle left/right combination at 17:18.  */
+		case 'h':
+		  if (*s++ == ',')
+		    {
+		      int lr = 0;
+		      if (*s == 'r')
+			lr = 2;
+		      else if (*s == 'l')
+			lr = 0;
+		      else
+			as_bad(_("Invalid left/right combination completer"));
+
+		      s++;
+		      INSERT_FIELD_AND_CONTINUE (opcode, lr, 13);
+		    }
+		  else
+		    as_bad(_("Invalid left/right combination completer"));
+		  break;
+
+		/* Handle saturation at 24:25.  */
+		case 'H':
+		  {
+		    int sat = 3;
+		    if (strncasecmp (s, ",ss", 3) == 0)
+		      {
+			sat = 1;
+			s += 3;
+		      }
+		    else if (strncasecmp (s, ",us", 3) == 0)
+		      {
+			sat = 0;
+			s += 3;
+		      }
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, sat, 6);
+		  }
+
+		/* Handle permutation completer.  */
+		case '*':
+		  if (*s++ == ',')
+		    {
+		      int permloc[4];
+		      int perm = 0;
+		      int i = 0;
+		      permloc[0] = 13;
+		      permloc[1] = 10;
+		      permloc[2] = 8;
+		      permloc[3] = 6;
+		      for (; i < 4; i++)
+		        {
+			  switch (*s++)
+			    {
+			    case '0':
+			      perm = 0;
+			      break;
+			    case '1':
+			      perm = 1;
+			      break;
+			    case '2':
+			      perm = 2;
+			      break;
+			    case '3':
+			      perm = 3;
+			      break;
+			    default:
+			      as_bad(_("Invalid permutation completer"));
+			    }
+			  opcode |= perm << permloc[i];
+			}
 		      continue;
 		    }
 		  else
-		    as_bad (_("Invalid Shift/Extract/Deposit Condition."));
-		  *s = c;
-		}
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+		    as_bad(_("Invalid permutation completer"));
+		  break;
 
-	    /* Handle bvb and bb conditions.  */
-	    case '~':
-	      cmpltr = 0;
-	      if (*s == ',')
-		{
-		  s++;
-		  if (strncmp (s, "<", 1) == 0)
-		    {
-		      cmpltr = 0;
-		      s++;
-		    }
-		  else if (strncmp (s, ">=", 2) == 0)
-		    {
-		      cmpltr = 1;
-		      s += 2;
-		    }
-		  else
-		    as_bad (_("Invalid Bit Branch Condition: %c"), *s);
+		default:
+		  abort ();
 		}
-	      INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15);
+	      break;
 
-	    /* Handle a system control completer.  */
-	    case 'Z':
-	      if (*s == ',' && (*(s + 1) == 'm' || *(s + 1) == 'M'))
-		{
-		  flag = 1;
-		  s += 2;
-		}
-	      else
-		flag = 0;
+	    /* Handle all conditions.  */
+	    case '?':
+	      {
+		args++;
+		switch (*args)
+		  {
+ 		  /* Handle FP compare conditions.  */
+ 		  case 'f':
+ 		    cond = pa_parse_fp_cmp_cond (&s);
+ 		    INSERT_FIELD_AND_CONTINUE (opcode, cond, 0);
 
-	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 5);
+		  /* Handle an add condition.  */
+		  case 'A':
+		  case 'a':
+ 		    cmpltr = 0;
+ 		    flag = 0;
+		    if (*s == ',')
+		      {
+			s++;
+
+			/* 64 bit conditions.  */
+			if (*args == 'A')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+			name = s;
+
+			name = s;
+			while (*s != ',' && *s != ' ' && *s != '\t')
+			  s += 1;
+			c = *s;
+			*s = 0x00;
+			if (strcmp (name, "=") == 0)
+			  cmpltr = 1;
+			else if (strcmp (name, "<") == 0)
+			  cmpltr = 2;
+			else if (strcmp (name, "<=") == 0)
+			  cmpltr = 3;
+			else if (strcasecmp (name, "nuv") == 0)
+			  cmpltr = 4;
+			else if (strcasecmp (name, "znv") == 0)
+			  cmpltr = 5;
+			else if (strcasecmp (name, "sv") == 0)
+			  cmpltr = 6;
+			else if (strcasecmp (name, "od") == 0)
+			  cmpltr = 7;
+			else if (strcasecmp (name, "tr") == 0)
+			  {
+			    cmpltr = 0;
+			    flag = 1;
+			  }
+			else if (strcmp (name, "<>") == 0)
+			  {
+			    cmpltr = 1;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">=") == 0)
+			  {
+			    cmpltr = 2;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">") == 0)
+			  {
+			    cmpltr = 3;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "uv") == 0)
+			  {
+			    cmpltr = 4;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "vnz") == 0)
+			  {
+			    cmpltr = 5;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "nsv") == 0)
+			  {
+			    cmpltr = 6;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "ev") == 0)
+			  {
+			    cmpltr = 7;
+			    flag = 1;
+			  }
+			/* ",*" is a valid condition.  */
+			else if (*args == 'a')
+			  as_bad (_("Invalid Add Condition: %s"), name);
+			*s = c;
+		      }
+		    opcode |= cmpltr << 13;
+		    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+		  /* Handle non-negated add and branch condition.  */
+		  case 'd':
+		    cmpltr = pa_parse_nonneg_add_cmpltr (&s, 1);
+		    if (cmpltr < 0)
+		      {
+			as_bad (_("Invalid Add and Branch Condition: %c"), *s);
+			cmpltr = 0;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		  /* Handle 64 bit wide-mode add and branch condition.  */
+		  case 'W':
+		    cmpltr = pa_parse_addb_64_cmpltr (&s);
+		    if (cmpltr < 0)
+		      {
+			as_bad (_("Invalid Add and Branch Condition: %c"), *s);
+			cmpltr = 0;
+		      }
+		    else
+		      {
+			/* Negated condition requires an opcode change. */
+			opcode |= (cmpltr & 8) << 24;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13);
+
+		  /* Handle a negated or non-negated add and branch
+		     condition.  */
+		  case '@':
+		    save_s = s;
+		    cmpltr = pa_parse_nonneg_add_cmpltr (&s, 1);
+		    if (cmpltr < 0)
+		      {
+			s = save_s;
+			cmpltr = pa_parse_neg_add_cmpltr (&s, 1);
+			if (cmpltr < 0)
+			  {
+			    as_bad (_("Invalid Compare/Subtract Condition"));
+			    cmpltr = 0;
+			  }
+			else
+			  {
+			    /* Negated condition requires an opcode change. */
+			    opcode |= 1 << 27;
+			  }
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		  /* Handle branch on bit conditions.  */
+		  case 'B':
+		  case 'b':
+		    cmpltr = 0;
+		    if (*s == ',')
+		      {
+			s++;
+
+			if (*args == 'B')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+
+			if (strncmp (s, "<", 1) == 0)
+			  {
+			    cmpltr = 0;
+			    s++;
+			  }
+			else if (strncmp (s, ">=", 2) == 0)
+			  {
+			    cmpltr = 1;
+			    s += 2;
+			  }
+			else
+			  as_bad (_("Invalid Bit Branch Condition: %c"), *s);
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15);
+
+		  /* Handle a compare/subtract condition.  */
+		  case 'S':
+		  case 's':
+		    cmpltr = 0;
+		    flag = 0;
+		    if (*s == ',')
+		      {
+			s++;
+
+			/* 64 bit conditions.  */
+			if (*args == 'S')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+			name = s;
+
+			name = s;
+			while (*s != ',' && *s != ' ' && *s != '\t')
+			  s += 1;
+			c = *s;
+			*s = 0x00;
+			if (strcmp (name, "=") == 0)
+			  cmpltr = 1;
+			else if (strcmp (name, "<") == 0)
+			  cmpltr = 2;
+			else if (strcmp (name, "<=") == 0)
+			  cmpltr = 3;
+			else if (strcasecmp (name, "<<") == 0)
+			  cmpltr = 4;
+			else if (strcasecmp (name, "<<=") == 0)
+			  cmpltr = 5;
+			else if (strcasecmp (name, "sv") == 0)
+			  cmpltr = 6;
+			else if (strcasecmp (name, "od") == 0)
+			  cmpltr = 7;
+			else if (strcasecmp (name, "tr") == 0)
+			  {
+			    cmpltr = 0;
+			    flag = 1;
+			  }
+			else if (strcmp (name, "<>") == 0)
+			  {
+			    cmpltr = 1;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">=") == 0)
+			  {
+			    cmpltr = 2;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">") == 0)
+			  {
+			    cmpltr = 3;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, ">>=") == 0)
+			  {
+			    cmpltr = 4;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, ">>") == 0)
+			  {
+			    cmpltr = 5;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "nsv") == 0)
+			  {
+			    cmpltr = 6;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "ev") == 0)
+			  {
+			    cmpltr = 7;
+			    flag = 1;
+			  }
+			/* ",*" is a valid condition.  */
+			else if (*args != 'S')
+			  as_bad (_("Invalid Compare/Subtract Condition: %s"),
+				  name);
+			*s = c;
+		      }
+		    opcode |= cmpltr << 13;
+		    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+		  /* Handle a non-negated compare condition.  */
+		  case 't':
+		    cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s, 1);
+		    if (cmpltr < 0)
+		      {
+			as_bad (_("Invalid Compare/Subtract Condition: %c"), *s);
+			cmpltr = 0;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		  /* Handle a 32 bit compare and branch condition.  */
+		  case 'n':
+		    save_s = s;
+		    cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s, 1);
+		    if (cmpltr < 0)
+		      {
+			s = save_s;
+			cmpltr = pa_parse_neg_cmpsub_cmpltr (&s, 1);
+			if (cmpltr < 0)
+			  {
+			    as_bad (_("Invalid Compare and Branch Condition."));
+			    cmpltr = 0;
+			  }
+			else
+			  {
+			    /* Negated condition requires an opcode change. */
+			    opcode |= 1 << 27;
+			  }
+		      }
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		  /* Handle a 64 bit compare and branch condition.  */
+		  case 'N':
+		    cmpltr = pa_parse_cmpb_64_cmpltr (&s);
+		    if (cmpltr >= 0)
+		      {
+			/* Negated condition requires an opcode change. */
+			opcode |= (cmpltr & 8) << 26;
+		      }
+		    else
+		      /* Not a 64 bit cond.  Give 32 bit a chance. */
+		      break;
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13);
+
+		  /* Handle a 64 bit cmpib condition.  */
+		  case 'Q':
+		    cmpltr = pa_parse_cmpib_64_cmpltr (&s);
+		    if (cmpltr < 0)
+		      /* Not a 64 bit cond.  Give 32 bit a chance. */
+		      break;
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		    /* Handle a logical instruction condition.  */
+		  case 'L':
+		  case 'l':
+		    cmpltr = 0;
+		    flag = 0;
+		    if (*s == ',')
+		      {
+			s++;
+
+			/* 64 bit conditions.  */
+			if (*args == 'L')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+			name = s;
+
+			name = s;
+			while (*s != ',' && *s != ' ' && *s != '\t')
+			  s += 1;
+			c = *s;
+			*s = 0x00;
+
+
+			if (strcmp (name, "=") == 0)
+			  cmpltr = 1;
+			else if (strcmp (name, "<") == 0)
+			  cmpltr = 2;
+			else if (strcmp (name, "<=") == 0)
+			  cmpltr = 3;
+			else if (strcasecmp (name, "od") == 0)
+			  cmpltr = 7;
+			else if (strcasecmp (name, "tr") == 0)
+			  {
+			    cmpltr = 0;
+			    flag = 1;
+			  }
+			else if (strcmp (name, "<>") == 0)
+			  {
+			    cmpltr = 1;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">=") == 0)
+			  {
+			    cmpltr = 2;
+			    flag = 1;
+			  }
+			else if (strcmp (name, ">") == 0)
+			  {
+			    cmpltr = 3;
+			    flag = 1;
+			  }
+			else if (strcasecmp (name, "ev") == 0)
+			  {
+			    cmpltr = 7;
+			    flag = 1;
+			  }
+			/* ",*" is a valid condition.  */
+			else if (*args != 'L')
+			  as_bad (_("Invalid Logical Instruction Condition."));
+			*s = c;
+		      }
+		    opcode |= cmpltr << 13;
+		    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+		  /* Handle a shift/extract/deposit condition.  */
+		  case 'X':
+		  case 'x':
+		  case 'y':
+		    cmpltr = 0;
+		    if (*s == ',')
+		      {
+			save_s = s++;
+
+			/* 64 bit conditions.  */
+			if (*args == 'X')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+			name = s;
+
+			name = s;
+			while (*s != ',' && *s != ' ' && *s != '\t')
+			  s += 1;
+			c = *s;
+			*s = 0x00;
+			if (strcmp (name, "=") == 0)
+			  cmpltr = 1;
+			else if (strcmp (name, "<") == 0)
+			  cmpltr = 2;
+			else if (strcasecmp (name, "od") == 0)
+			  cmpltr = 3;
+			else if (strcasecmp (name, "tr") == 0)
+			  cmpltr = 4;
+			else if (strcmp (name, "<>") == 0)
+			  cmpltr = 5;
+			else if (strcmp (name, ">=") == 0)
+			  cmpltr = 6;
+			else if (strcasecmp (name, "ev") == 0)
+			  cmpltr = 7;
+			/* Handle movb,n.  Put things back the way they were.
+			   This includes moving s back to where it started.  */
+			else if (strcasecmp (name, "n") == 0 && *args == 'y')
+			  {
+			    *s = c;
+			    s = save_s;
+			    continue;
+			  }
+			/* ",*" is a valid condition.  */
+			else if (*args != 'X')
+			  as_bad (_("Invalid Shift/Extract/Deposit Condition."));
+			*s = c;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+		  /* Handle a unit instruction condition.  */
+		  case 'U':
+		  case 'u':
+		    cmpltr = 0;
+		    flag = 0;
+		    if (*s == ',')
+		      {
+			s++;
+
+			/* 64 bit conditions.  */
+			if (*args == 'U')
+			  {
+			    if (*s == '*')
+			      s++;
+			    else
+			      break;
+			  }
+			else if (*s == '*')
+			  break;
+
+			if (strncasecmp (s, "sbz", 3) == 0)
+			  {
+			    cmpltr = 2;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "shz", 3) == 0)
+			  {
+			    cmpltr = 3;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "sdc", 3) == 0)
+			  {
+			    cmpltr = 4;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "sbc", 3) == 0)
+			  {
+			    cmpltr = 6;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "shc", 3) == 0)
+			  {
+			    cmpltr = 7;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "tr", 2) == 0)
+			  {
+			    cmpltr = 0;
+			    flag = 1;
+			    s += 2;
+			  }
+			else if (strncasecmp (s, "nbz", 3) == 0)
+			  {
+			    cmpltr = 2;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "nhz", 3) == 0)
+			  {
+			    cmpltr = 3;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "ndc", 3) == 0)
+			  {
+			    cmpltr = 4;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "nbc", 3) == 0)
+			  {
+			    cmpltr = 6;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "nhc", 3) == 0)
+			  {
+			    cmpltr = 7;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "swz", 3) == 0)
+			  {
+			    cmpltr = 1;
+			    flag = 0;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "swc", 3) == 0)
+			  {
+			    cmpltr = 5;
+			    flag = 0;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "nwz", 3) == 0)
+			  {
+			    cmpltr = 1;
+			    flag = 1;
+			    s += 3;
+			  }
+			else if (strncasecmp (s, "nwc", 3) == 0)
+			  {
+			    cmpltr = 5;
+			    flag = 1;
+			    s += 3;
+			  }
+			/* ",*" is a valid condition.  */
+			else if (*args != 'U')
+			  as_bad (_("Invalid Unit Instruction Condition."));
+		      }
+		    opcode |= cmpltr << 13;
+		    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+		  default:
+		    abort ();
+		  }
+		break;
+	      }
 
 	    /* Handle a nullification completer for branch instructions.  */
 	    case 'n':
@@ -2111,6 +2841,52 @@
 	      nullif = pa_parse_nullif (&s);
 	      INSERT_FIELD_AND_CONTINUE (opcode, nullif, 5);
 
+	    /* Handle ,%r2 completer for new syntax branches.  */
+	    case 'L':
+	      if (*s == ',' && strncasecmp (s + 1, "%r2", 3) == 0)
+		s += 4;
+	      else if (*s == ',' && strncasecmp (s + 1, "%rp", 3) == 0)
+		s += 4;
+	      else
+		break;
+	      continue;
+
+	    /* Handle 3 bit entry into the fp compare array.   Valid values
+	       are 0..6 inclusive.  */
+	    case 'h':
+	      get_expression (s);
+	      s = expr_end;
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  num = evaluate_absolute (&the_insn);
+		  CHECK_FIELD (num, 6, 0, 0);
+		  num++;
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
+		}
+	      else
+		break;
+
+	    /* Handle 3 bit entry into the fp compare array.   Valid values
+	       are 0..6 inclusive.  */
+	    case 'm':
+	      get_expression (s);
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  s = expr_end;
+		  num = evaluate_absolute (&the_insn);
+		  CHECK_FIELD (num, 6, 0, 0);
+		  num = (num + 1) ^ 1;
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
+		}
+	      else
+		break;
+
+	    /* Handle graphics test completers for ftest */
+	    case '=':
+	      {
+		num = pa_parse_ftest_gfx_completer (&s);
+		INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+	      }
 
 	    /* Handle a 11 bit immediate at 31.  */
 	    case 'i':
@@ -2136,6 +2912,125 @@
 		  continue;
 		}
 
+	    /* Handle a 14 bit immediate at 31.  */
+	    case 'J':
+	      the_insn.field_selector = pa_chk_field_selector (&s);
+	      get_expression (s);
+	      s = expr_end;
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  int a, m;
+
+		  /* XXX the completer stored away tibits of information
+		     for us to extract.  We need a cleaner way to do this.
+		     Now that we have lots of letters again, it would be
+		     good to rethink this.  */
+		  m = (opcode & (1 << 8)) != 0;
+		  a = (opcode & (1 << 9)) != 0;
+		  opcode &= ~ (3 << 8);
+		  num = evaluate_absolute (&the_insn);
+		  if ((a == 1 && num >= 0) || (a == 0 && num < 0))
+		    break;
+		  CHECK_FIELD (num, 8191, -8192, 0);
+		  low_sign_unext (num, 14, &num);
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+		}
+	      else
+		{
+		  break;
+		}
+
+	    /* Handle a 14 bit immediate at 31.  */
+	    case 'K':
+	      the_insn.field_selector = pa_chk_field_selector (&s);
+	      get_expression (s);
+	      s = expr_end;
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  int a, m;
+
+		  /* XXX the completer stored away tibits of information
+		     for us to extract.  We need a cleaner way to do this.
+		     Now that we have lots of letters again, it would be
+		     good to rethink this.  */
+		  m = (opcode & (1 << 8)) != 0;
+		  a = (opcode & (1 << 9)) != 0;
+		  opcode &= ~ (3 << 8);
+		  num = evaluate_absolute (&the_insn);
+		  if ((a == 1 && num < 0) || (a == 0 && num > 0))
+		    break;
+		  if (num % 4)
+		    break;
+		  CHECK_FIELD (num, 8191, -8192, 0);
+		  if (num < 0)
+		    opcode |= 1;
+                  num &= 0x1fff;
+                  num >>= 2;
+                  INSERT_FIELD_AND_CONTINUE (opcode, num, 3);
+		}
+	      else
+		{
+		  break;
+		}
+
+	    /* Handle 14 bit immediated, shifted left three times.  */
+	    case '#':
+	      the_insn.field_selector = pa_chk_field_selector (&s);
+	      get_expression (s);
+	      s = expr_end;
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  num = evaluate_absolute (&the_insn);
+		  if (num & 0x7)
+		    break;
+		  CHECK_FIELD (num, 8191, -8192, 0);
+		  if (num < 0)
+		    opcode |= 1;
+		  num &= 0x1fff;
+		  num >>= 3;
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 4);
+		}
+	      else
+		{
+		  if (is_DP_relative (the_insn.exp))
+		    the_insn.reloc = R_HPPA_GOTOFF;
+		  else if (is_PC_relative (the_insn.exp))
+		    the_insn.reloc = R_HPPA_PCREL_CALL;
+		  else
+		    the_insn.reloc = R_HPPA;
+		  the_insn.format = 14;
+		  continue;
+		}
+	      break;
+
+	    /* Handle 14 bit immediate, shifted left twice.  */
+	    case 'd':
+	      the_insn.field_selector = pa_chk_field_selector (&s);
+	      get_expression (s);
+	      s = expr_end;
+	      if (the_insn.exp.X_op == O_constant)
+		{
+		  num = evaluate_absolute (&the_insn);
+		  if (num & 0x3)
+		    break;
+		  CHECK_FIELD (num, 8191, -8192, 0);
+		  if (num < 0)
+		    opcode |= 1;
+		  num &= 0x1fff;
+		  num >>= 2;
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 3);
+		}
+	      else
+		{
+		  if (is_DP_relative (the_insn.exp))
+		    the_insn.reloc = R_HPPA_GOTOFF;
+		  else if (is_PC_relative (the_insn.exp))
+		    the_insn.reloc = R_HPPA_PCREL_CALL;
+		  else
+		    the_insn.reloc = R_HPPA;
+		  the_insn.format = 14;
+		  continue;
+		}
 
 	    /* Handle a 14 bit immediate at 31.  */
 	    case 'j':
@@ -2253,6 +3148,45 @@
 		  continue;
 		}
 
+	    /* Handle a 22 bit branch displacement.  */
+	    case 'X':
+	      the_insn.field_selector = pa_chk_field_selector (&s);
+	      get_expression (s);
+	      s = expr_end;
+	      the_insn.pcrel = 1;
+	      if (!the_insn.exp.X_add_symbol
+		  || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol),
+			      "L$0\001"))
+		{
+		  unsigned int w3, w2, w1, w, result;
+
+		  num = evaluate_absolute (&the_insn);
+		  if (num % 4)
+		    {
+		      as_bad (_("Branch to unaligned address"));
+		      break;
+		    }
+		  CHECK_FIELD (num, 8388607, -8388608, 0);
+
+		  if (the_insn.exp.X_add_symbol)
+		    num -= 8;
+
+		  sign_unext (num >> 2, 22, &result);
+		  dis_assemble_22 (result, &w3, &w1, &w2, &w);
+		  INSERT_FIELD_AND_CONTINUE (opcode,
+					     ((w3 << 21) | (w2 << 2)
+					      | (w1 << 16) | w),
+					     0);
+		}
+	      else
+		{
+		  the_insn.reloc = R_HPPA_PCREL_CALL;
+		  the_insn.format = 22;
+		  the_insn.arg_reloc = last_call_desc.arg_reloc;
+		  memset (&last_call_desc, 0, sizeof (struct call_desc));
+		  continue;
+		}
+
 	    /* Handle an absolute 17 bit branch target.  */
 	    case 'z':
 	      the_insn.field_selector = pa_chk_field_selector (&s);
@@ -2290,81 +3224,212 @@
 		  continue;
 		}
 
+	    /* Handle '%r1' implicit operand of addil instruction.  */
+	    case 'Z':
+	      if (*s == ',' && *(s + 1) == '%' && *(s + 3) == '1'
+		  && (*(s + 2) == 'r' || *(s + 2) == 'R'))
+		{
+		  s += 4;
+		  continue;
+		}
+	      else
+	        break;
+
+	    /* Handle '%sr0,%r31' implicit operand of be,l instruction.  */
+	    case 'Y':
+	      if (strncasecmp (s, "%sr0,%r31", 9) != 0)
+		break;
+	      s += 9;
+	      continue;
+
+	    /* Handle immediate value of 0 for ordered load/store instructions.  */
+	    case '@':
+	      if (*s != '0')
+		break;
+	      s++;
+	      continue;
+
+	    /* Handle a 2 bit shift count at 25.  */
+	    case '.':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 3, 1, strict);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
+
+	    /* Handle a 4 bit shift count at 25.  */
+	    case '*':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 15, 0, strict);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
+
 	    /* Handle a 5 bit shift count at 26.  */
 	    case 'p':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 31, 0, 0);
+	      CHECK_FIELD (num, 31, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, 31 - num, 5);
 
+	    /* Handle a 6 bit shift count at 20,22:26.  */
+	    case '~':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 63, 0, strict);
+	      num = 63 - num;
+	      opcode |= (num & 0x20) << 6;
+	      INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 5);
+
+	    /* Handle a 6 bit field length at 23,27:31.  */
+	    case '%':
+	      flag = 0;
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 64, 1, strict);
+	      num--;
+	      opcode |= (num & 0x20) << 3;
+	      num = 31 - (num & 0x1f);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
+	    /* Handle a 6 bit field length at 19,27:31.  */
+	    case '|':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 64, 1, strict);
+	      num--;
+	      opcode |= (num & 0x20) << 7;
+	      num = 31 - (num & 0x1f);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
 	    /* Handle a 5 bit bit position at 26.  */
 	    case 'P':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 31, 0, 0);
+	      CHECK_FIELD (num, 31, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 5);
 
+	    /* Handle a 6 bit bit position at 20,22:26.  */
+	    case 'q':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 63, 0, strict);
+	      opcode |= (num & 0x20) << 6;
+	      INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 5);
+
+	    /* Handle a 5 bit immediate at 10 with 'd' as the complement
+	       of the high bit of the immediate.  */
+	    case 'B':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 63, 0, strict);
+	      if (num & 0x20)
+		;
+	      else
+		opcode |= (1 << 13);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 21);
+
 	    /* Handle a 5 bit immediate at 10.  */
 	    case 'Q':
-
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      if (the_insn.exp.X_op != O_constant)
 		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 31, 0, 0);
+	      CHECK_FIELD (num, 31, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 21);
 
+	    /* Handle a 9 bit immediate at 28.  */
+	    case '$':
+	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
+	      s = expr_end;
+	      CHECK_FIELD (num, 511, 1, strict);
+	      INSERT_FIELD_AND_CONTINUE (opcode, num, 3);
+
 	    /* Handle a 13 bit immediate at 18.  */
 	    case 'A':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 8191, 0, 0);
+	      CHECK_FIELD (num, 8191, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
 
 	    /* Handle a 26 bit immediate at 31.  */
 	    case 'D':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 671108864, 0, 0);
+	      CHECK_FIELD (num, 671108864, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
 	    /* Handle a 3 bit SFU identifier at 25.  */
-	    case 'f':
+	    case 'v':
 	      if (*s++ != ',')
 		as_bad (_("Invalid SFU identifier"));
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 7, 0, 0);
+	      CHECK_FIELD (num, 7, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
 
 	    /* Handle a 20 bit SOP field for spop0.  */
 	    case 'O':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 1048575, 0, 0);
+	      CHECK_FIELD (num, 1048575, 0, strict);
 	      num = (num & 0x1f) | ((num & 0x000fffe0) << 6);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
 	    /* Handle a 15bit SOP field for spop1.  */
 	    case 'o':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 32767, 0, 0);
+	      CHECK_FIELD (num, 32767, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 11);
 
 	    /* Handle a 10bit SOP field for spop3.  */
 	    case '0':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 1023, 0, 0);
+	      CHECK_FIELD (num, 1023, 0, strict);
 	      num = (num & 0x1f) | ((num & 0x000003e0) << 6);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
 	    /* Handle a 15 bit SOP field for spop2.  */
 	    case '1':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 32767, 0, 0);
+	      CHECK_FIELD (num, 32767, 0, strict);
 	      num = (num & 0x1f) | ((num & 0x00007fe0) << 6);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
@@ -2373,18 +3438,97 @@
 	      if (*s++ != ',')
 		as_bad (_("Invalid COPR identifier"));
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 7, 0, 0);
+	      CHECK_FIELD (num, 7, 0, strict);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
 
 	    /* Handle a 22bit SOP field for copr.  */
 	    case '2':
 	      num = pa_get_absolute_expression (&the_insn, &s);
+	      if (strict && the_insn.exp.X_op != O_constant)
+		break;
 	      s = expr_end;
-	      CHECK_FIELD (num, 4194303, 0, 0);
+	      CHECK_FIELD (num, 4194303, 0, strict);
 	      num = (num & 0x1f) | ((num & 0x003fffe0) << 4);
 	      INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
 
+	    /* Handle a source FP operand format completer.  */
+	    case '{':
+	      if (*s == ',' && *(s+1) == 't')
+		{
+		  the_insn.trunc = 1;
+		  s += 2;
+		}
+	      else
+		the_insn.trunc = 0;
+	      flag = pa_parse_fp_cnv_format (&s);
+	      the_insn.fpof1 = flag;
+	      if (flag == W || flag == UW)
+		flag = SGL;
+	      if (flag == DW || flag == UDW)
+		flag = DBL;
+	      if (flag == QW || flag == UQW)
+		flag = QUAD;
+	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+	    /* Handle a destination FP operand format completer.  */
+	    case '_':
+	      /* pa_parse_format needs the ',' prefix.  */
+	      s--;
+	      flag = pa_parse_fp_cnv_format (&s);
+	      the_insn.fpof2 = flag;
+	      if (flag == W || flag == UW)
+		flag = SGL;
+	      if (flag == DW || flag == UDW)
+		flag = DBL;
+	      if (flag == QW || flag == UQW)
+		flag = QUAD;
+	      opcode |= flag << 13;
+	      if (the_insn.fpof1 == SGL
+		  || the_insn.fpof1 == DBL
+		  || the_insn.fpof1 == QUAD)
+		{
+		  if (the_insn.fpof2 == SGL
+		      || the_insn.fpof2 == DBL
+		      || the_insn.fpof2 == QUAD)
+		    flag = 0;
+		  else if (the_insn.fpof2 == W
+		      || the_insn.fpof2 == DW
+		      || the_insn.fpof2 == QW)
+		    flag = 2;
+		  else if (the_insn.fpof2 == UW
+		      || the_insn.fpof2 == UDW
+		      || the_insn.fpof2 == UQW)
+		    flag = 6;
+		  else
+		    abort ();
+		}
+	      else if (the_insn.fpof1 == W
+		       || the_insn.fpof1 == DW
+		       || the_insn.fpof1 == QW)
+		{
+		  if (the_insn.fpof2 == SGL
+		      || the_insn.fpof2 == DBL
+		      || the_insn.fpof2 == QUAD)
+		    flag = 1;
+		  else
+		    abort ();
+		}
+	      else if (the_insn.fpof1 == UW
+		       || the_insn.fpof1 == UDW
+		       || the_insn.fpof1 == UQW)
+		{
+		  if (the_insn.fpof2 == SGL
+		      || the_insn.fpof2 == DBL
+		      || the_insn.fpof2 == QUAD)
+		    flag = 5;
+		  else
+		    abort ();
+		}
+	      flag |= the_insn.trunc;
+	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 15);
 
 	    /* Handle a source FP operand format completer.  */
 	    case 'F':
@@ -2400,191 +3544,11 @@
 	      the_insn.fpof2 = flag;
 	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 13);
 
-	    /* Handle FP compare conditions.  */
-	    case 'M':
-	      cond = pa_parse_fp_cmp_cond (&s);
-	      INSERT_FIELD_AND_CONTINUE (opcode, cond, 0);
-
-	    /* Handle L/R register halves like 't'.  */
-	    case 'v':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		opcode |= result.number_part;
-
-		/* 0x30 opcodes are FP arithmetic operation opcodes
-		   and need to be turned into 0x38 opcodes.  This
-		   is not necessary for loads/stores.  */
-		if (need_pa11_opcode (&the_insn, &result)
-		    && ((opcode & 0xfc000000) == 0x30000000))
-		  opcode |= 1 << 27;
-
-		INSERT_FIELD_AND_CONTINUE (opcode, result.l_r_select & 1, 6);
-	      }
-
-	    /* Handle L/R register halves like 'b'.  */
-	    case 'E':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		opcode |= result.number_part << 21;
-		if (need_pa11_opcode (&the_insn, &result))
-		  {
-		    opcode |= (result.l_r_select & 1) << 7;
-		    opcode |= 1 << 27;
-		  }
-		continue;
-	      }
-
-	    /* Handle L/R register halves like 'b'.  */
-	    case '3':
-	      {
-		struct pa_11_fp_reg_struct result;
-		int regnum;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		opcode |= (result.number_part & 0x1c) << 11;
-		opcode |= (result.number_part & 0x3) << 9;
-		opcode |= (result.l_r_select & 1) << 8;
-		continue;
-	      }
-
-	    /* Handle L/R register halves like 'x'.  */
-	    case 'e':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		opcode |= (result.number_part & 0x1f) << 16;
-		if (need_pa11_opcode (&the_insn, &result))
-		  {
-		    opcode |= (result.l_r_select & 1) << 1;
-		  }
-		continue;
-	      }
-
-	    /* Handle L/R register halves like 'x'.  */
-	    case 'X':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		opcode |= (result.number_part & 0x1f) << 16;
-		if (need_pa11_opcode (&the_insn, &result))
-		  {
-		    opcode |= (result.l_r_select & 1) << 12;
-		    opcode |= 1 << 27;
-		  }
-		continue;
-	      }
-
-	    /* Handle a 5 bit register field at 10.  */
-	    case '4':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		if (the_insn.fpof1 == SGL)
-		  {
-		    if (result.number_part < 16)
-		      {
-			as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
-			break;
-		      }
-
-		    result.number_part &= 0xF;
-		    result.number_part |= (result.l_r_select & 1) << 4;
-		  }
-		INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 21);
-	      }
-
-	    /* Handle a 5 bit register field at 15.  */
-	    case '6':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		if (the_insn.fpof1 == SGL)
-		  {
-		    if (result.number_part < 16)
-		      {
-			as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
-			break;
-		      }
-		    result.number_part &= 0xF;
-		    result.number_part |= (result.l_r_select & 1) << 4;
-		  }
-		INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 16);
-	      }
-
-	    /* Handle a 5 bit register field at 31.  */
-	    case '7':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		if (the_insn.fpof1 == SGL)
-		  {
-		    if (result.number_part < 16)
-		      {
-			as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
-			break;
-		      }
-		    result.number_part &= 0xF;
-		    result.number_part |= (result.l_r_select & 1) << 4;
-		  }
-		INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 0);
-	      }
-
-	    /* Handle a 5 bit register field at 20.  */
-	    case '8':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		if (the_insn.fpof1 == SGL)
-		  {
-		    if (result.number_part < 16)
-		      {
-			as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
-			break;
-		      }
-		    result.number_part &= 0xF;
-		    result.number_part |= (result.l_r_select & 1) << 4;
-		  }
-		INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 11);
-	      }
-
-	    /* Handle a 5 bit register field at 25.  */
-	    case '9':
-	      {
-		struct pa_11_fp_reg_struct result;
-
-		pa_parse_number (&s, &result);
-		CHECK_FIELD (result.number_part, 31, 0, 0);
-		if (the_insn.fpof1 == SGL)
-		  {
-		    if (result.number_part < 16)
-		      {
-			as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
-			break;
-		      }
-		    result.number_part &= 0xF;
-		    result.number_part |= (result.l_r_select & 1) << 4;
-		  }
-		INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 6);
-	      }
+	    /* Handle a source FP operand format completer at 20.  */
+	    case 'I':
+	      flag = pa_parse_fp_format (&s);
+	      the_insn.fpof1 = flag;
+	      INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
 
 	    /* Handle a floating point operand format at 26.
 	       Only allows single and double precision.  */
@@ -2605,6 +3569,263 @@
 		}
 	      break;
 
+	    /* Handle all floating point registers.  */
+	    case 'f':
+	      switch (*++args)
+	        {
+		/* Float target register.  */
+		case 't':
+		  /* This should be more strict.  Small steps.  */
+		  if (strict && *s != '%')
+		    break;
+		  num = pa_parse_number (&s, 0);
+		  CHECK_FIELD (num, 31, 0, 0);
+		  INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
+		/* Float target register with L/R selection.  */
+		case 'T':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= result.number_part;
+
+		    /* 0x30 opcodes are FP arithmetic operation opcodes
+		       and need to be turned into 0x38 opcodes.  This
+		       is not necessary for loads/stores.  */
+		    if (need_pa11_opcode (&the_insn, &result)
+			&& ((opcode & 0xfc000000) == 0x30000000))
+		      opcode |= 1 << 27;
+
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.l_r_select & 1, 6);
+		  }
+
+		/* Float operand 1.  */
+		case 'a':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= result.number_part << 21;
+		    if (need_pa11_opcode (&the_insn, &result))
+		      {
+			opcode |= (result.l_r_select & 1) << 7;
+			opcode |= 1 << 27;
+		      }
+		    continue;
+		  }
+
+		/* Float operand 1 with L/R selection.  */
+		case 'X':
+		case 'A':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= result.number_part << 21;
+		    opcode |= (result.l_r_select & 1) << 7;
+		    continue;
+		  }
+
+		/* Float operand 2.  */
+		case 'b':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= (result.number_part & 0x1f) << 16;
+		    if (need_pa11_opcode (&the_insn, &result))
+		      {
+			opcode |= (result.l_r_select & 1) << 12;
+			opcode |= 1 << 27;
+		      }
+		    continue;
+		  }
+
+		/* Float operand 2 with L/R selection.  */
+		case 'B':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= (result.number_part & 0x1f) << 16;
+		    opcode |= (result.l_r_select & 1) << 12;
+		    continue;
+		  }
+
+		/* Float operand 3 for fmpyfadd, fmpynfadd.  */
+		case 'C':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= (result.number_part & 0x1c) << 11;
+		    opcode |= (result.number_part & 0x3) << 9;
+		    opcode |= (result.l_r_select & 1) << 8;
+		    continue;
+		  }
+
+		/* Float mult operand 1 for fmpyadd, fmpysub */
+		case 'i':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    if (the_insn.fpof1 == SGL)
+		      {
+			if (result.number_part < 16)
+			  {
+			    as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
+			    break;
+			  }
+
+			result.number_part &= 0xF;
+			result.number_part |= (result.l_r_select & 1) << 4;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 21);
+		  }
+
+		/* Float mult operand 2 for fmpyadd, fmpysub */
+		case 'j':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    if (the_insn.fpof1 == SGL)
+		      {
+		        if (result.number_part < 16)
+		          {
+		    	as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
+		    	break;
+		          }
+		        result.number_part &= 0xF;
+		        result.number_part |= (result.l_r_select & 1) << 4;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 16);
+		  }
+
+		/* Float mult target for fmpyadd, fmpysub */
+		case 'k':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    if (the_insn.fpof1 == SGL)
+		      {
+		        if (result.number_part < 16)
+		          {
+		    	as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
+		    	break;
+		          }
+		        result.number_part &= 0xF;
+		        result.number_part |= (result.l_r_select & 1) << 4;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 0);
+		  }
+
+		/* Float add operand 1 for fmpyadd, fmpysub */
+		case 'l':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    if (the_insn.fpof1 == SGL)
+		      {
+		        if (result.number_part < 16)
+		          {
+		    	as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
+		    	break;
+		          }
+		        result.number_part &= 0xF;
+		        result.number_part |= (result.l_r_select & 1) << 4;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 6);
+		  }
+
+		/* Float add target for fmpyadd, fmpysub */
+		case 'm':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    /* This should be more strict.  Small steps.  */
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    if (the_insn.fpof1 == SGL)
+		      {
+		        if (result.number_part < 16)
+		          {
+		    	as_bad  (_("Invalid register for single precision fmpyadd or fmpysub"));
+		    	break;
+		          }
+		        result.number_part &= 0xF;
+		        result.number_part |= (result.l_r_select & 1) << 4;
+		      }
+		    INSERT_FIELD_AND_CONTINUE (opcode, result.number_part, 11);
+		  }
+
+		/* Handle L/R register halves like 'x'.  */
+		case 'e':
+		  {
+		    struct pa_11_fp_reg_struct result;
+
+		    if (strict && *s != '%')
+		      break;
+		    pa_parse_number (&s, &result);
+		    CHECK_FIELD (result.number_part, 31, 0, 0);
+		    opcode |= (result.number_part & 0x1f) << 16;
+		    if (need_pa11_opcode (&the_insn, &result))
+		      {
+			opcode |= (result.l_r_select & 1) << 1;
+		      }
+		    continue;
+		  }
+		default:
+		  abort ();
+		}
+	      break;
+
 	    default:
 	      abort ();
 	    }
@@ -2730,13 +3951,14 @@
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
 
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   codes = (bfd_reloc_code_real_type **) hppa_gen_reloc_type (stdoutput,
 			       fixp->fx_r_type,
 			       hppa_fixp->fx_r_format,
 			       hppa_fixp->fx_r_field,
 			       fixp->fx_subsy != NULL,
-			       fixp->fx_addsy->bsym);
+			       symbol_get_bfdsym (fixp->fx_addsy));
 
   if (codes == NULL)
     abort ();
@@ -2759,7 +3981,8 @@
 
       code = *codes[0];
 
-      reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+      reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+      *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
       reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
       reloc->addend = 0;	/* default */
@@ -2809,7 +4032,8 @@
     {
       code = *codes[i];
 
-      relocs[i]->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+      relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+      *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       relocs[i]->howto = bfd_reloc_type_lookup (stdoutput, code);
       relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
@@ -2820,23 +4044,25 @@
 	     of two symbols.  With that in mind we fill in all four
 	     relocs now and break out of the loop.  */
 	  assert (i == 1);
-	  relocs[0]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
+	  relocs[0]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
 	  relocs[0]->howto = bfd_reloc_type_lookup (stdoutput, *codes[0]);
 	  relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 	  relocs[0]->addend = 0;
-	  relocs[1]->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+	  relocs[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+	  *relocs[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
 	  relocs[1]->howto = bfd_reloc_type_lookup (stdoutput, *codes[1]);
 	  relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 	  relocs[1]->addend = 0;
-	  relocs[2]->sym_ptr_ptr = &fixp->fx_subsy->bsym;
+	  relocs[2]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+	  *relocs[2]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
 	  relocs[2]->howto = bfd_reloc_type_lookup (stdoutput, *codes[2]);
 	  relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 	  relocs[2]->addend = 0;
-	  relocs[3]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
+	  relocs[3]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
 	  relocs[3]->howto = bfd_reloc_type_lookup (stdoutput, *codes[3]);
 	  relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 	  relocs[3]->addend = 0;
-	  relocs[4]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
+	  relocs[4]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
 	  relocs[4]->howto = bfd_reloc_type_lookup (stdoutput, *codes[4]);
 	  relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;
 	  relocs[4]->addend = 0;
@@ -2874,7 +4100,8 @@
 	case R_N0SEL:
 	case R_N1SEL:
 	  /* There is no symbol or addend associated with these fixups.  */
-	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;
+          relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+          *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
 	  relocs[i]->addend = 0;
 	  break;
 
@@ -2882,7 +4109,8 @@
 	case R_ENTRY:
 	case R_EXIT:
 	  /* There is no symbol associated with these fixups.  */
-	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;
+          relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+          *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
 	  relocs[i]->addend = fixp->fx_offset;
 	  break;
 
@@ -3027,7 +4255,7 @@
   if (hppa_fixP)
     {
       unsigned long buf_wd = bfd_get_32 (stdoutput, buf);
-      unsigned char fmt = bfd_hppa_insn2fmt (buf_wd);
+      int fmt = bfd_hppa_insn2fmt (buf_wd);
 
       /* If there is a symbol associated with this fixup, then it's something
 	 which will need a SOM relocation (except for some PC-relative relocs).
@@ -3039,7 +4267,7 @@
 	  && fmt != 32
 #endif
 	  )
-	new_val = ((fmt == 12 || fmt == 17) ? 8 : 0);
+	new_val = ((fmt == 12 || fmt == 17 || fmt == 22) ? 8 : 0);
 #ifdef OBJ_SOM
       /* These field selectors imply that we do not want an addend.  */
       else if (hppa_fixP->fx_r_field == e_psel
@@ -3048,7 +4276,7 @@
 	       || hppa_fixP->fx_r_field == e_tsel
 	       || hppa_fixP->fx_r_field == e_rtsel
 	       || hppa_fixP->fx_r_field == e_ltsel)
-	new_val = ((fmt == 12 || fmt == 17) ? 8 : 0);
+	new_val = ((fmt == 12 || fmt == 17 || fmt == 22) ? 8 : 0);
       /* This is truely disgusting.  The machine independent code blindly
 	 adds in the value of the symbol being relocated against.  Damn!  */
       else if (fmt == 32
@@ -3063,20 +4291,22 @@
       /* Handle pc-relative exceptions from above.  */
 #define arg_reloc_stub_needed(CALLER, CALLEE) \
   ((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
-      if ((fmt == 12 || fmt == 17)
+      if ((fmt == 12 || fmt == 17 || fmt == 22)
 	  && fixP->fx_addsy
 	  && fixP->fx_pcrel
+#ifdef OBJ_SOM
 	  && !arg_reloc_stub_needed ((long) ((obj_symbol_type *)
-			fixP->fx_addsy->bsym)->tc_data.ap.hppa_arg_reloc,
-				    hppa_fixP->fx_arg_reloc)
-	  && ((int)(*valp) > -262144 && (int)(*valp) < 262143)
+		symbol_get_bfdsym (fixP->fx_addsy))->tc_data.ap.hppa_arg_reloc,
+		hppa_fixP->fx_arg_reloc)
+#endif
+	  && (((int)(*valp) > -262144 && (int)(*valp) < 262143) && fmt != 22)
 	  && S_GET_SEGMENT (fixP->fx_addsy) == hppa_fixP->segment
 	  && !(fixP->fx_subsy
 	       && S_GET_SEGMENT (fixP->fx_subsy) != hppa_fixP->segment))
-	      
+
 	new_val = hppa_field_adjust (*valp, 0, hppa_fixP->fx_r_field);
 #undef arg_reloc_stub_needed
-	
+
       switch (fmt)
 	{
 	/* Handle all opcodes with the 'j' operand type.  */
@@ -3153,6 +4383,29 @@
 	    break;
 	  }
 
+	case 22:
+	  {
+	    int distance = *valp, w3;
+
+	    CHECK_FIELD (new_val, 8388607, -8388608, 0);
+
+	    /* If this is an absolute branch (ie no link) with an out of
+	       range target, then we want to complain.  */
+	    if (fixP->fx_r_type == R_HPPA_PCREL_CALL
+		&& (distance > 8388607 || distance < -8388608)
+		&& (bfd_get_32 (stdoutput, buf) & 0xffe00000) == 0xe8000000)
+	      CHECK_FIELD (distance, 8388607, -8388608, 0);
+
+	    /* Mask off 22 bits to be changed.  */
+	    bfd_put_32 (stdoutput,
+			bfd_get_32 (stdoutput, buf) & 0xfc00e002,
+			buf);
+	    sign_unext ((new_val - 8) >> 2, 22, &resulti);
+	    dis_assemble_22 (resulti, &w3, &w1, &w2, &w);
+	    result = ((w3 << 21) | (w2 << 2) | (w1 << 16) | w);
+	    break;
+	  }
+
 	case 32:
 	  result = 0;
 	  bfd_put_32 (stdoutput, new_val, buf);
@@ -3507,6 +4760,126 @@
   return 0;
 }
 
+/* Parse a graphics test complete for ftest.  */
+
+static int
+pa_parse_ftest_gfx_completer (s)
+     char **s;
+{
+  int value;
+
+  value = 0;
+  if (strncasecmp (*s, "acc8", 4) == 0)
+    {
+      value = 5;
+      *s += 4;
+    }
+  else if (strncasecmp (*s, "acc6", 4) == 0)
+    {
+      value = 9;
+      *s += 4;
+    }
+  else if (strncasecmp (*s, "acc4", 4) == 0)
+    {
+      value = 13;
+      *s += 4;
+    }
+  else if (strncasecmp (*s, "acc2", 4) == 0)
+    {
+      value = 17;
+      *s += 4;
+    }
+  else if (strncasecmp (*s, "acc", 3) == 0)
+    {
+      value = 1;
+      *s += 3;
+    }
+  else if (strncasecmp (*s, "rej8", 4) == 0)
+    {
+      value = 6;
+      *s += 4;
+    }
+  else if (strncasecmp (*s, "rej", 3) == 0)
+    {
+      value = 2;
+      *s += 3;
+    }
+  else
+    {
+      value = 0;
+      as_bad (_("Invalid FTEST completer: %s"), *s);
+    }
+
+  return value;
+}
+
+/* Parse an FP operand format completer returning the completer
+   type.  */
+
+static fp_operand_format
+pa_parse_fp_cnv_format (s)
+     char **s;
+{
+  int format;
+
+  format = SGL;
+  if (**s == ',')
+    {
+      *s += 1;
+      if (strncasecmp (*s, "sgl", 3) == 0)
+	{
+	  format = SGL;
+	  *s += 4;
+	}
+      else if (strncasecmp (*s, "dbl", 3) == 0)
+	{
+	  format = DBL;
+	  *s += 4;
+	}
+      else if (strncasecmp (*s, "quad", 4) == 0)
+	{
+	  format = QUAD;
+	  *s += 5;
+	}
+      else if (strncasecmp (*s, "w", 1) == 0)
+	{
+	  format = W;
+	  *s += 2;
+	}
+      else if (strncasecmp (*s, "uw", 2) == 0)
+	{
+	  format = UW;
+	  *s += 3;
+	}
+      else if (strncasecmp (*s, "dw", 2) == 0)
+	{
+	  format = DW;
+	  *s += 3;
+	}
+      else if (strncasecmp (*s, "udw", 3) == 0)
+	{
+	  format = UDW;
+	  *s += 4;
+	}
+      else if (strncasecmp (*s, "qw", 2) == 0)
+	{
+	  format = QW;
+	  *s += 3;
+	}
+      else if (strncasecmp (*s, "uqw", 3) == 0)
+	{
+	  format = UQW;
+	  *s += 4;
+	}
+      else
+	{
+	  format = ILLEGAL_FMT;
+	  as_bad (_("Invalid FP Operand Format: %3s"), *s);
+	}
+    }
+
+  return format;
+}
 
 /* Parse an FP operand format completer returning the completer
    type.  */
@@ -3568,13 +4941,11 @@
     name[0] = tolower ((*str)[0]),
     name[1] = tolower ((*str)[1]),
     name[2] = 0;
-#ifdef OBJ_SOM
   else if ((*str)[3] == '\'' || (*str)[3] == '%')
     name[0] = tolower ((*str)[0]),
     name[1] = tolower ((*str)[1]),
     name[2] = tolower ((*str)[2]),
     name[3] = 0;
-#endif
   else
     return e_fsel;
 
@@ -3669,6 +5040,14 @@
       *s = c;
       return evaluate_absolute (insn);
     }
+  /* When in strict mode we have a non-match, fix up the pointers
+     and return to our caller.  */
+  if (insn->exp.X_op != O_constant && strict)
+    {
+      expr_end = input_line_pointer;
+      input_line_pointer = save_in;
+      return 0;
+    }
   if (insn->exp.X_op != O_constant)
     {
       as_bad (_("Bad segment (should be absolute)."));
@@ -3994,6 +5373,169 @@
 }
 
 
+/* Parse a 64 bit compare and branch completer returning the number (for
+   encoding in instrutions) of the given completer.
+
+   Nonnegated comparisons are returned as 0-7, negated comparisons are
+   returned as 8-15.  */
+
+static int
+pa_parse_cmpb_64_cmpltr (s)
+     char **s;
+{
+  int cmpltr;
+  char *name = *s + 1;
+  char c;
+  char *save_s = *s;
+
+  cmpltr = -1;
+  if (**s == ',')
+    {
+      *s += 1;
+      while (**s != ',' && **s != ' ' && **s != '\t')
+	*s += 1;
+      c = **s;
+      **s = 0x00;
+
+      if (strcmp (name, "*") == 0)
+	{
+	  cmpltr = 0;
+	}
+      else if (strcmp (name, "*=") == 0)
+	{
+	  cmpltr = 1;
+	}
+      else if (strcmp (name, "*<") == 0)
+	{
+	  cmpltr = 2;
+	}
+      else if (strcmp (name, "*<=") == 0)
+	{
+	  cmpltr = 3;
+	}
+      else if (strcmp (name, "*<<") == 0)
+	{
+	  cmpltr = 4;
+	}
+      else if (strcmp (name, "*<<=") == 0)
+	{
+	  cmpltr = 5;
+	}
+      else if (strcasecmp (name, "*sv") == 0)
+	{
+	  cmpltr = 6;
+	}
+      else if (strcasecmp (name, "*od") == 0)
+	{
+	  cmpltr = 7;
+	}
+      else if (strcasecmp (name, "*tr") == 0)
+	{
+	  cmpltr = 8;
+	}
+      else if (strcmp (name, "*<>") == 0)
+	{
+	  cmpltr = 9;
+	}
+      else if (strcmp (name, "*>=") == 0)
+	{
+	  cmpltr = 10;
+	}
+      else if (strcmp (name, "*>") == 0)
+	{
+	  cmpltr = 11;
+	}
+      else if (strcmp (name, "*>>=") == 0)
+	{
+	  cmpltr = 12;
+	}
+      else if (strcmp (name, "*>>") == 0)
+	{
+	  cmpltr = 13;
+	}
+      else if (strcasecmp (name, "*nsv") == 0)
+	{
+	  cmpltr = 14;
+	}
+      else if (strcasecmp (name, "*ev") == 0)
+	{
+	  cmpltr = 15;
+	}
+      else
+	{
+	  cmpltr = -1;
+	}
+      **s = c;
+    }
+
+
+  return cmpltr;
+}
+
+/* Parse a 64 bit compare immediate and branch completer returning the number
+   (for encoding in instrutions) of the given completer.  */
+
+static int
+pa_parse_cmpib_64_cmpltr (s)
+     char **s;
+{
+  int cmpltr;
+  char *name = *s + 1;
+  char c;
+  char *save_s = *s;
+
+  cmpltr = -1;
+  if (**s == ',')
+    {
+      *s += 1;
+      while (**s != ',' && **s != ' ' && **s != '\t')
+	*s += 1;
+      c = **s;
+      **s = 0x00;
+
+      if (strcmp (name, "*<<") == 0)
+	{
+	  cmpltr = 0;
+	}
+      else if (strcmp (name, "*=") == 0)
+	{
+	  cmpltr = 1;
+	}
+      else if (strcmp (name, "*<") == 0)
+	{
+	  cmpltr = 2;
+	}
+      else if (strcmp (name, "*<=") == 0)
+	{
+	  cmpltr = 3;
+	}
+      else if (strcmp (name, "*>>=") == 0)
+	{
+	  cmpltr = 4;
+	}
+      else if (strcmp (name, "*<>") == 0)
+	{
+	  cmpltr = 5;
+	}
+      else if (strcasecmp (name, "*>=") == 0)
+	{
+	  cmpltr = 6;
+	}
+      else if (strcasecmp (name, "*>") == 0)
+	{
+	  cmpltr = 7;
+	}
+      else
+	{
+	  cmpltr = -1;
+	}
+      **s = c;
+    }
+
+
+  return cmpltr;
+}
+
 /* Parse a non-negated addition completer returning the number
    (for encoding in instrutions) of the given completer.
 
@@ -4144,6 +5686,109 @@
   return cmpltr;
 }
 
+/* Parse a 64 bit wide mode add and branch completer returning the number (for
+   encoding in instrutions) of the given completer.  */
+
+static int
+pa_parse_addb_64_cmpltr (s)
+     char **s;
+{
+  int cmpltr;
+  char *name = *s + 1;
+  char c;
+  char *save_s = *s;
+  int nullify = 0;
+
+  cmpltr = 0;
+  if (**s == ',')
+    {
+      *s += 1;
+      while (**s != ',' && **s != ' ' && **s != '\t')
+	*s += 1;
+      c = **s;
+      **s = 0x00;
+      if (strcmp (name, "=") == 0)
+	{
+	  cmpltr = 1;
+	}
+      else if (strcmp (name, "<") == 0)
+	{
+	  cmpltr = 2;
+	}
+      else if (strcmp (name, "<=") == 0)
+	{
+	  cmpltr = 3;
+	}
+      else if (strcasecmp (name, "nuv") == 0)
+	{
+	  cmpltr = 4;
+	}
+      else if (strcasecmp (name, "*=") == 0)
+	{
+	  cmpltr = 5;
+	}
+      else if (strcasecmp (name, "*<") == 0)
+	{
+	  cmpltr = 6;
+	}
+      else if (strcasecmp (name, "*<=") == 0)
+	{
+	  cmpltr = 7;
+	}
+      else if (strcmp (name, "tr") == 0)
+	{
+	  cmpltr = 8;
+	}
+      else if (strcmp (name, "<>") == 0)
+	{
+	  cmpltr = 9;
+	}
+      else if (strcmp (name, ">=") == 0)
+	{
+	  cmpltr = 10;
+	}
+      else if (strcmp (name, ">") == 0)
+	{
+	  cmpltr = 11;
+	}
+      else if (strcasecmp (name, "uv") == 0)
+	{
+	  cmpltr = 12;
+	}
+      else if (strcasecmp (name, "*<>") == 0)
+	{
+	  cmpltr = 13;
+	}
+      else if (strcasecmp (name, "*>=") == 0)
+	{
+	  cmpltr = 14;
+	}
+      else if (strcasecmp (name, "*>") == 0)
+	{
+	  cmpltr = 15;
+	}
+      /* If we have something like addb,n then there is no condition
+         completer.  */
+      else if (strcasecmp (name, "n") == 0)
+	{
+	  cmpltr = 0;
+	  nullify = 1;
+	}
+      else
+	{
+	  cmpltr = -1;
+	}
+      **s = c;
+    }
+
+  /* Reset pointers if this was really a ,n for a branch instruction.  */
+  if (nullify)
+    *s = save_s;
+
+  return cmpltr;
+}
+
+#ifdef OBJ_SOM
 /* Handle an alignment directive.  Special so that we can update the
    alignment of the subspace if necessary.  */
 static void
@@ -4160,6 +5805,7 @@
   if (log2 (bytes) != -1)
     record_alignment (current_subspace->ssd_seg, log2 (bytes));
 }
+#endif
 
 /* Handle a .BLOCK type pseudo-op.  */
 
@@ -4172,8 +5818,10 @@
   unsigned int temp_size;
   unsigned int i;
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   temp_size = get_absolute_expression ();
 
@@ -4251,8 +5899,10 @@
 pa_call (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   pa_call_args (&last_call_desc);
   demand_empty_rest_of_line ();
@@ -4338,26 +5988,35 @@
 {
   char *unwind;
   asection *seg, *save_seg;
+  asymbol *sym;
   subsegT subseg, save_subseg;
-  int i;
+  int i, reloc;
   char c, *p;
 
-  /* Get into the right seg/subseg.  This may involve creating
-     the seg the first time through.  Make sure to have the
-     old seg/subseg so that we can reset things when we are done.  */
-  subseg = SUBSEG_UNWIND;
-  seg = bfd_get_section_by_name (stdoutput, UNWIND_SECTION_NAME);
-  if (seg == ASEC_NULL)
-    {
-      seg = bfd_make_section_old_way (stdoutput, UNWIND_SECTION_NAME);
-      bfd_set_section_flags (stdoutput, seg,
-			     SEC_READONLY | SEC_HAS_CONTENTS
-			     | SEC_LOAD | SEC_RELOC);
-    }
+  if (now_seg != text_section)
+    return;
+
+  if (bfd_get_arch_info (stdoutput)->bits_per_address == 32)
+    reloc = R_PARISC_DIR32;
+  else
+    reloc = R_PARISC_SEGREL32;
 
   save_seg = now_seg;
   save_subseg = now_subseg;
-  subseg_set (seg, subseg);
+  /* Get into the right seg/subseg.  This may involve creating
+     the seg the first time through.  Make sure to have the
+     old seg/subseg so that we can reset things when we are done.  */
+  seg = bfd_get_section_by_name (stdoutput, UNWIND_SECTION_NAME);
+  if (seg == ASEC_NULL)
+    {
+      seg = subseg_new (UNWIND_SECTION_NAME, 0);
+      bfd_set_section_flags (stdoutput, seg,
+			     SEC_READONLY | SEC_HAS_CONTENTS
+			     | SEC_LOAD | SEC_RELOC | SEC_ALLOC | SEC_DATA);
+      bfd_set_section_alignment (stdoutput, seg, 2);
+    }
+
+  subseg_set (seg, 0);
 
 
   /* Get some space to hold relocation information for the unwind
@@ -4368,7 +6027,8 @@
   /* Relocation info. for start offset of the function.  */
   fix_new_hppa (frag_now, p - frag_now->fr_literal, 4,
 		call_info->start_symbol, (offsetT) 0,
-		(expressionS *) NULL, 0, R_PARISC_DIR32, e_fsel, 32, 0, NULL);
+		(expressionS *) NULL, 0, reloc,
+		e_fsel, 32, 0, NULL);
 
   p = frag_more (4);
   md_number_to_chars (p, 0, 4);
@@ -4383,7 +6043,8 @@
 
   fix_new_hppa (frag_now, p - frag_now->fr_literal, 4,
 		call_info->end_symbol, (offsetT) 0,
-		(expressionS *) NULL, 0, R_PARISC_DIR32, e_fsel, 32, 0, NULL);
+		(expressionS *) NULL, 0, reloc,
+		e_fsel, 32, 0, NULL);
 
   /* Dump it. */
   unwind = (char *) &call_info->ci_unwind;
@@ -4411,8 +6072,10 @@
   char *name, c, *p;
   int temp;
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   /* .CALLINFO must appear within a procedure definition.  */
   if (!within_procedure)
@@ -4549,9 +6212,11 @@
 pa_code (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   current_space = is_defined_space ("$TEXT$");
   current_subspace
     = pa_subsegment_to_subspace (current_space->sd_seg, 0);
+#endif
   s_text (0);
   pa_undefine_label ();
 }
@@ -4601,7 +6266,7 @@
       /* colon() has already set the frag to the current location in the
          current subspace; we need to reset the fragment to the zero address
          fragment.  We also need to reset the segment pointer.  */
-      symbol->sy_frag = &zero_address_frag;
+      symbol_set_frag (symbol, &zero_address_frag);
     }
   demand_empty_rest_of_line ();
 }
@@ -4620,8 +6285,10 @@
 pa_enter (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   as_bad (_("The .ENTER pseudo-op is not supported"));
   demand_empty_rest_of_line ();
@@ -4633,8 +6300,10 @@
 pa_entry (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   if (!within_procedure)
     as_bad (_("Misplaced .entry. Ignored."));
@@ -4738,8 +6407,10 @@
 pa_exit (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   if (!within_procedure)
     as_bad (_(".EXIT must appear within a procedure"));
@@ -4808,13 +6479,13 @@
   char *name, c, *p;
   unsigned int temp, arg_reloc;
   pa_symbol_type type = SYMBOL_TYPE_UNKNOWN;
-  obj_symbol_type *symbol = (obj_symbol_type *) symbolP->bsym;
+  obj_symbol_type *symbol = (obj_symbol_type *) symbol_get_bfdsym (symbolP);
 
   if (strncasecmp (input_line_pointer, "absolute", 8) == 0)
 
     {
       input_line_pointer += 8;
-      symbolP->bsym->flags &= ~BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags &= ~BSF_FUNCTION;
       S_SET_SEGMENT (symbolP, bfd_abs_section_ptr);
       type = SYMBOL_TYPE_ABSOLUTE;
     }
@@ -4827,54 +6498,56 @@
          Complain if one tries to EXPORT a CODE type since that's never
          done.  Both GCC and HP C still try to IMPORT CODE types, so
          silently fix them to be ENTRY types.  */
-      if (symbolP->bsym->flags & BSF_FUNCTION)
+      if (S_IS_FUNCTION (symbolP))
 	{
 	  if (is_export)
-	    as_tsktsk (_("Using ENTRY rather than CODE in export directive for %s"), symbolP->bsym->name);
+	    as_tsktsk (_("Using ENTRY rather than CODE in export directive for %s"),
+		       S_GET_NAME (symbolP));
 
-	  symbolP->bsym->flags |= BSF_FUNCTION;
+	  symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
 	  type = SYMBOL_TYPE_ENTRY;
 	}
       else
 	{
-	  symbolP->bsym->flags &= ~BSF_FUNCTION;
+	  symbol_get_bfdsym (symbolP)->flags &= ~BSF_FUNCTION;
 	  type = SYMBOL_TYPE_CODE;
 	}
     }
   else if (strncasecmp (input_line_pointer, "data", 4) == 0)
     {
       input_line_pointer += 4;
-      symbolP->bsym->flags &= ~BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags &= ~BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
       type = SYMBOL_TYPE_DATA;
     }
   else if ((strncasecmp (input_line_pointer, "entry", 5) == 0))
     {
       input_line_pointer += 5;
-      symbolP->bsym->flags |= BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
       type = SYMBOL_TYPE_ENTRY;
     }
   else if (strncasecmp (input_line_pointer, "millicode", 9) == 0)
     {
       input_line_pointer += 9;
-      symbolP->bsym->flags |= BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
       type = SYMBOL_TYPE_MILLICODE;
     }
   else if (strncasecmp (input_line_pointer, "plabel", 6) == 0)
     {
       input_line_pointer += 6;
-      symbolP->bsym->flags &= ~BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags &= ~BSF_FUNCTION;
       type = SYMBOL_TYPE_PLABEL;
     }
   else if (strncasecmp (input_line_pointer, "pri_prog", 8) == 0)
     {
       input_line_pointer += 8;
-      symbolP->bsym->flags |= BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
       type = SYMBOL_TYPE_PRI_PROG;
     }
   else if (strncasecmp (input_line_pointer, "sec_prog", 8) == 0)
     {
       input_line_pointer += 8;
-      symbolP->bsym->flags |= BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
       type = SYMBOL_TYPE_SEC_PROG;
     }
 
@@ -4882,7 +6555,7 @@
      than BFD understands.  This is how we get this information
      to the SOM BFD backend.  */
 #ifdef obj_set_symbol_type
-  obj_set_symbol_type (symbolP->bsym, (int) type);
+  obj_set_symbol_type (symbol_get_bfdsym (symbolP), (int) type);
 #endif
 
   /* Now that the type of the exported symbol has been handled,
@@ -4903,7 +6576,9 @@
 	  name = input_line_pointer;
 	  c = get_symbol_end ();
 	  arg_reloc = pa_align_arg_reloc (temp, pa_build_arg_reloc (name));
+#ifdef OBJ_SOM
 	  symbol->tc_data.ap.hppa_arg_reloc |= arg_reloc;
+#endif
 	  *input_line_pointer = c;
 	}
       /* The return value.  */
@@ -4915,7 +6590,9 @@
 	  name = input_line_pointer;
 	  c = get_symbol_end ();
 	  arg_reloc = pa_build_arg_reloc (name);
+#ifdef OBJ_SOM
 	  symbol->tc_data.ap.hppa_arg_reloc |= arg_reloc;
+#endif
 	  *input_line_pointer = c;
 	}
       /* Privelege level.  */
@@ -4925,7 +6602,9 @@
 	  *p = c;
 	  input_line_pointer++;
 	  temp = atoi (input_line_pointer);
+#ifdef OBJ_SOM
 	  symbol->tc_data.ap.hppa_priv_level = temp;
+#endif
 	  c = get_symbol_end ();
 	  *input_line_pointer = c;
 	}
@@ -4976,7 +6655,7 @@
 	     the the current segment.  Note only BSF_FUNCTION really
 	     matters, we do not need to set the full SYMBOL_TYPE_* info.  */
 	  if (now_seg == text_section)
-	    symbol->bsym->flags |= BSF_FUNCTION;
+	    symbol_get_bfdsym (symbol)->flags |= BSF_FUNCTION;
 
 	  /* If the section is undefined, then the symbol is undefined
 	     Since this is an import, leave the section undefined.  */
@@ -5030,8 +6709,10 @@
 pa_leave (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   as_bad (_("The .LEAVE pseudo-op is not supported"));
   demand_empty_rest_of_line ();
@@ -5058,6 +6739,12 @@
       if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 11))
 	as_warn (_("could not set architecture and machine"));
     }
+  else if (strncmp (level, "2.0w", 4) == 0)
+    {
+      input_line_pointer += 4;
+      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 25))
+	as_warn (_("could not set architecture and machine"));
+    }
   else if (strncmp (level, "2.0", 3) == 0)
     {
       input_line_pointer += 3;
@@ -5078,8 +6765,10 @@
 pa_origin (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   s_org (0);
   pa_undefine_label ();
@@ -5129,8 +6818,10 @@
 {
   struct call_info *call_info;
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   if (within_procedure)
     as_fatal (_("Nested procedures"));
@@ -5176,7 +6867,7 @@
 	if (label_symbol->lss_label)
 	  {
 	    last_call_info->start_symbol = label_symbol->lss_label;
-	    label_symbol->lss_label->bsym->flags |= BSF_FUNCTION;
+	    symbol_get_bfdsym (label_symbol->lss_label)->flags |= BSF_FUNCTION;
 	  }
 	else
 	  as_bad (_("Missing function name for .PROC (corrupted label chain)"));
@@ -5196,8 +6887,10 @@
      int unused;
 {
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   /* If we are within a procedure definition, make sure we've
      defined a label for the procedure; handle case where the
@@ -5215,7 +6908,8 @@
 	  if (label_symbol->lss_label)
 	    {
 	      last_call_info->start_symbol = label_symbol->lss_label;
-	      label_symbol->lss_label->bsym->flags |= BSF_FUNCTION;
+	      symbol_get_bfdsym (label_symbol->lss_label)->flags
+		|= BSF_FUNCTION;
 #ifdef OBJ_SOM
 	      /* Also handle allocation of a fixup to hold the unwind
 		 information when the label appears after the proc/procend.  */
@@ -5257,6 +6951,38 @@
   pa_undefine_label ();
 }
 
+/* If VALUE is an exact power of two between zero and 2^31, then
+   return log2 (VALUE).  Else return -1.  */
+
+static int
+log2 (value)
+     int value;
+{
+  int shift = 0;
+
+  while ((1 << shift) != value && shift < 32)
+    shift++;
+
+  if (shift >= 32)
+    return -1;
+  else
+    return shift;
+}
+
+
+#ifdef OBJ_SOM
+/* Check to make sure we have a valid space and subspace.  */
+
+static void
+pa_check_current_space_and_subspace ()
+{
+  if (current_space == NULL)
+    as_fatal (_("Not in a space.\n"));
+
+  if (current_subspace == NULL)
+    as_fatal (_("Not in a subspace.\n"));
+}
+
 /* Parse the parameters to a .SPACE directive; if CREATE_FLAG is nonzero,
    then create a new space entry to hold the information specified
    by the parameters to the .SPACE directive.  */
@@ -5525,24 +7251,6 @@
   demand_empty_rest_of_line ();
 }
 
-/* If VALUE is an exact power of two between zero and 2^31, then
-   return log2 (VALUE).  Else return -1.  */
-
-static int
-log2 (value)
-     int value;
-{
-  int shift = 0;
-
-  while ((1 << shift) != value && shift < 32)
-    shift++;
-
-  if (shift >= 32)
-    return -1;
-  else
-    return shift;
-}
-
 /* Handle a .SUBSPACE pseudo-op; this switches the current subspace to the
    given subspace, creating the new subspace if necessary.
 
@@ -5553,7 +7261,7 @@
 pa_subspace (create_new)
      int create_new;
 {
-  char *name, *ss_name, *alias, c;
+  char *name, *ss_name, c;
   char loadable, code_only, common, dup_common, zero, sort;
   int i, access, space_index, alignment, quadrant, applicable, flags;
   sd_chain_struct *space;
@@ -5587,7 +7295,6 @@
       space_index = ~0;
       alignment = 1;
       quadrant = 0;
-      alias = NULL;
 
       space = current_space;
       if (create_new)
@@ -5624,8 +7331,6 @@
 		  quadrant = pa_def_subspaces[i].quadrant;
 		  access = pa_def_subspaces[i].access;
 		  sort = pa_def_subspaces[i].sort;
-		  if (USE_ALIASES && pa_def_subspaces[i].alias)
-		    alias = pa_def_subspaces[i].alias;
 		  break;
 		}
 	      i++;
@@ -5734,14 +7439,6 @@
 	section = subseg_force_new (ss_name, 0);
       else if (ssd)
 	section = ssd->ssd_seg;
-      else if (alias)
-	section = subseg_new (alias, 0);
-      else if (!alias && USE_ALIASES)
-	{
-	  as_warn (_("Ignoring subspace decl due to ELF BFD bugs."));
-	  demand_empty_rest_of_line ();
-	  return;
-	}
       else
 	section = subseg_new (ss_name, 0);
 
@@ -5798,10 +7495,7 @@
       char *name;
 
       /* Pick the right name to use for the new section.  */
-      if (pa_def_spaces[i].alias && USE_ALIASES)
-	name = pa_def_spaces[i].alias;
-      else
-	name = pa_def_spaces[i].name;
+      name = pa_def_spaces[i].name;
 
       pa_def_spaces[i].segment = subseg_new (name, 0);
       create_new_space (pa_def_spaces[i].name, pa_def_spaces[i].spnum,
@@ -5821,16 +7515,8 @@
 
       /* Pick the right name for the new section and pick the right
          subsegment number.  */
-      if (pa_def_subspaces[i].alias && USE_ALIASES)
-	{
-	  name = pa_def_subspaces[i].alias;
-	  subsegment = pa_def_subspaces[i].subsegment;
-	}
-      else
-	{
-	  name = pa_def_subspaces[i].name;
-	  subsegment = 0;
-	}
+      name = pa_def_subspaces[i].name;
+      subsegment = 0;
 
       /* Create the new section.  */
       segment = subseg_new (name, subsegment);
@@ -5839,7 +7525,7 @@
       /* For SOM we want to replace the standard .text, .data, and .bss
          sections with our own.   We also want to set BFD flags for
 	 all the built-in subspaces.  */
-      if (!strcmp (pa_def_subspaces[i].name, "$CODE$") && !USE_ALIASES)
+      if (!strcmp (pa_def_subspaces[i].name, "$CODE$"))
 	{
 	  text_section = segment;
 	  applicable = bfd_applicable_section_flags (stdoutput);
@@ -5849,7 +7535,7 @@
 					       | SEC_READONLY
 					       | SEC_HAS_CONTENTS));
 	}
-      else if (!strcmp (pa_def_subspaces[i].name, "$DATA$") && !USE_ALIASES)
+      else if (!strcmp (pa_def_subspaces[i].name, "$DATA$"))
 	{
 	  data_section = segment;
 	  applicable = bfd_applicable_section_flags (stdoutput);
@@ -5860,14 +7546,14 @@
 
 
 	}
-      else if (!strcmp (pa_def_subspaces[i].name, "$BSS$") && !USE_ALIASES)
+      else if (!strcmp (pa_def_subspaces[i].name, "$BSS$"))
 	{
 	  bss_section = segment;
 	  applicable = bfd_applicable_section_flags (stdoutput);
 	  bfd_set_section_flags (stdoutput, segment,
 				 applicable & SEC_ALLOC);
 	}
-      else if (!strcmp (pa_def_subspaces[i].name, "$LIT$") && !USE_ALIASES)
+      else if (!strcmp (pa_def_subspaces[i].name, "$LIT$"))
 	{
 	  applicable = bfd_applicable_section_flags (stdoutput);
 	  bfd_set_section_flags (stdoutput, segment,
@@ -5876,8 +7562,7 @@
 					       | SEC_READONLY
 					       | SEC_HAS_CONTENTS));
 	}
-      else if (!strcmp (pa_def_subspaces[i].name, "$MILLICODE$")
-	       && !USE_ALIASES)
+      else if (!strcmp (pa_def_subspaces[i].name, "$MILLICODE$"))
 	{
 	  applicable = bfd_applicable_section_flags (stdoutput);
 	  bfd_set_section_flags (stdoutput, segment,
@@ -5886,7 +7571,7 @@
 					       | SEC_READONLY
 					       | SEC_HAS_CONTENTS));
 	}
-      else if (!strcmp (pa_def_subspaces[i].name, "$UNWIND$") && !USE_ALIASES)
+      else if (!strcmp (pa_def_subspaces[i].name, "$UNWIND$"))
 	{
 	  applicable = bfd_applicable_section_flags (stdoutput);
 	  bfd_set_section_flags (stdoutput, segment,
@@ -6037,7 +7722,7 @@
      we'll set it to 1 which "locks-in" the subspace attributes.  */
   SUBSPACE_DEFINED (chain_entry) = 0;
 
-  chain_entry->ssd_subseg = USE_ALIASES ? pa_next_subseg (space) : 0;
+  chain_entry->ssd_subseg = 0;
   chain_entry->ssd_seg = seg;
   chain_entry->ssd_next = NULL;
 
@@ -6256,7 +7941,6 @@
      sd_chain_struct *space;
      int quadrant;
 {
-#ifdef OBJ_SOM
   /* FIXME.  Assumes everyone puts read/write data at 0x4000000, this
      is not correct for the PA OSF1 port.  */
   if ((strcmp (SPACE_NAME (space), "$PRIVATE$") == 0) && quadrant == 1)
@@ -6265,7 +7949,6 @@
     return 0x40000000;
   else
     return 0;
-#endif
   return 0;
 }
 
@@ -6278,6 +7961,7 @@
   space->sd_last_subseg++;
   return space->sd_last_subseg;
 }
+#endif
 
 /* Helper function for pa_stringer.  Used to find the end of
    a string.  */
@@ -6288,8 +7972,10 @@
 {
   unsigned int c = *s & CHAR_MASK;
 
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   switch (c)
     {
@@ -6430,9 +8116,11 @@
 pa_data (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   current_space = is_defined_space ("$PRIVATE$");
   current_subspace
     = pa_subsegment_to_subspace (current_space->sd_seg, 0);
+#endif
   s_data (0);
   pa_undefine_label ();
 }
@@ -6453,8 +8141,10 @@
 pa_fill (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   s_fill (0);
   pa_undefine_label ();
@@ -6466,8 +8156,10 @@
 pa_lcomm (needs_align)
      int needs_align;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   s_lcomm (needs_align);
   pa_undefine_label ();
@@ -6479,8 +8171,10 @@
 pa_lsym (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();
+#endif
 
   s_lsym (0);
   pa_undefine_label ();
@@ -6492,9 +8186,11 @@
 pa_text (unused)
      int unused;
 {
+#ifdef OBJ_SOM
   current_space = is_defined_space ("$TEXT$");
   current_subspace
     = pa_subsegment_to_subspace (current_space->sd_seg, 0);
+#endif
 
   s_text (0);
   pa_undefine_label ();
@@ -6519,7 +8215,7 @@
    selectors).
 
    Reject reductions involving symbols with external scope; such
-   reductions make life a living hell for object file editors. 
+   reductions make life a living hell for object file editors.
 
    FIXME.  Also reject R_HPPA relocations which are 32bits wide in
    the code space.  The SOM BFD backend doesn't know how to pull the
@@ -6539,7 +8235,7 @@
     return 0;
 
   /* Reject reductions of symbols in sym1-sym2 expressions when
-     the fixup will occur in a CODE subspace. 
+     the fixup will occur in a CODE subspace.
 
      XXX FIXME: Long term we probably want to reject all of these;
      for example reducing in the debug section would lose if we ever
@@ -6549,7 +8245,7 @@
       && (hppa_fix->segment->flags & SEC_CODE))
     {
       /* Apparently sy_used_in_reloc never gets set for sub symbols.  */
-      fixp->fx_subsy->sy_used_in_reloc = 1;
+      symbol_mark_used_in_reloc (fixp->fx_subsy);
       return 0;
     }
 
@@ -6571,7 +8267,7 @@
       || hppa_fix->fx_r_field == e_lpsel)
     return 0;
 
-  if (fixp->fx_addsy && fixp->fx_addsy->bsym->flags & BSF_GLOBAL)
+  if (fixp->fx_addsy && S_IS_EXTERNAL (fixp->fx_addsy))
     return 0;
 
   /* Reject absolute calls (jumps).  */
@@ -6579,8 +8275,7 @@
     return 0;
 
   /* Reject reductions of function symbols.  */
-  if (fixp->fx_addsy == 0
-      || (fixp->fx_addsy->bsym->flags & BSF_FUNCTION) == 0)
+  if (fixp->fx_addsy == 0 || ! S_IS_FUNCTION (fixp->fx_addsy))
     return 1;
 
   return 0;
@@ -6612,15 +8307,16 @@
 #define arg_reloc_stub_needed(CALLER, CALLEE) \
   ((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
 
+#ifdef OBJ_SOM
   /* It is necessary to force PC-relative calls/jumps to have a relocation
      entry if they're going to need either a argument relocation or long
      call stub.  FIXME.  Can't we need the same for absolute calls?  */
   if (fixp->fx_pcrel && fixp->fx_addsy
       && (arg_reloc_stub_needed ((long) ((obj_symbol_type *)
-				  fixp->fx_addsy->bsym)->tc_data.ap.hppa_arg_reloc,
-
-				 hppa_fixp->fx_arg_reloc)))
+	symbol_get_bfdsym (fixp->fx_addsy))->tc_data.ap.hppa_arg_reloc,
+	hppa_fixp->fx_arg_reloc)))
     return 1;
+#endif
   distance = (fixp->fx_offset + S_GET_VALUE (fixp->fx_addsy)
 	      - md_pcrel_from (fixp));
   /* Now check and see if we're going to need a long-branch stub.  */
@@ -6677,7 +8373,7 @@
 				frag_now);
 
 	  assert (symbolP);
-	  symbolP->bsym->flags = BSF_LOCAL;
+	  S_CLEAR_EXTERNAL (symbolP);
 	  symbol_table_insert (symbolP);
 	}
 
@@ -6707,10 +8403,19 @@
        call_info_pointer = call_info_pointer->ci_next)
     {
       elf_symbol_type *esym
-      = (elf_symbol_type *) call_info_pointer->start_symbol->bsym;
+	= ((elf_symbol_type *)
+	   symbol_get_bfdsym (call_info_pointer->start_symbol));
       esym->internal_elf_sym.st_size =
 	S_GET_VALUE (call_info_pointer->end_symbol)
 	- S_GET_VALUE (call_info_pointer->start_symbol) + 4;
     }
 }
 #endif
+
+#ifdef OBJ_ELF
+pa_end_of_source ()
+{
+  if (debug_type == DEBUG_DWARF2)
+    dwarf2_finish ();
+}
+#endif
diff --git a/gas/config/tc-hppa.h b/gas/config/tc-hppa.h
index c1541d9..266c8ca 100644
--- a/gas/config/tc-hppa.h
+++ b/gas/config/tc-hppa.h
@@ -1,5 +1,6 @@
 /* tc-hppa.h -- Header file for the PA
-   Copyright (C) 1989, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -48,9 +49,14 @@
 /* FIXME.  The lack of a place to put things which are both target cpu
    and target format dependent makes hacks like this necessary.  */
 #ifdef OBJ_ELF
+#ifdef BFD64
+#include "bfd/elf64-hppa.h"
+#define TARGET_FORMAT "elf64-hppa"
+#else
 #include "bfd/elf32-hppa.h"
 #define TARGET_FORMAT "elf32-hppa"
 #endif
+#endif
 
 #ifdef OBJ_SOM
 #include "bfd/som.h"
@@ -66,7 +72,7 @@
 #define ASEC_NULL (asection *)0
 
 /* Labels are not required to have a colon for a suffix.  */
-#define LABELS_WITHOUT_COLONS
+#define LABELS_WITHOUT_COLONS 1
 
 /* FIXME.  This should be static and declared in tc-hppa.c, but 
    pa_define_label gets used outside of tc-hppa.c via tc_frob_label.
@@ -128,9 +134,9 @@
    *not* end up in the symbol table.  Likewise for absolute symbols
    with local scope.  */
 #define tc_frob_symbol(sym,punt) \
-    if ((S_GET_SEGMENT (sym) == &bfd_und_section && sym->sy_used == 0) \
+    if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym)) \
 	|| (S_GET_SEGMENT (sym) == &bfd_abs_section \
-	    && (sym->bsym->flags & BSF_EXPORT) == 0)) \
+	    && ! S_IS_EXTERNAL (sym))) \
       punt = 1
 
 /* We need to be able to make relocations involving the difference of
@@ -147,14 +153,18 @@
 #ifdef OBJ_ELF
 #define tc_frob_symbol(sym,punt) \
   { \
-    if ((S_GET_SEGMENT (sym) == &bfd_und_section && sym->sy_used == 0) \
+    if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym)) \
 	|| (S_GET_SEGMENT (sym) == &bfd_abs_section \
-	    && (sym->bsym->flags & BSF_EXPORT) == 0)) \
+	    && ! S_IS_EXTERNAL (sym)) \
+	|| strcmp (S_GET_NAME (sym), "$global$") == 0) \
       punt = 1; \
   }
 #endif
 
 #define md_operand(x)
+#ifdef OBJ_ELF
+#define md_end() pa_end_of_source ()
+#endif
 
 #define TC_FIX_TYPE PTR
 #define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL)
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
new file mode 100644
index 0000000..2183273
--- /dev/null
+++ b/gas/config/tc-i370.c
@@ -0,0 +1,2967 @@
+/* tc-i370.c -- Assembler for the IBM 360/370/390 instruction set.
+   Loosely based on the ppc files by Linas Vepstas <linas@linas.org> 1998, 99
+   Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Cygnus Support.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA. */
+
+/* This assembler implements a very hacked version of an elf-like thing
+ * that gcc emits (when gcc is suitably hacked).  To make it behave more
+ * HLASM-like, try turning on the -M or --mri flag (as there are various
+ * similarities between HLASM and the MRI assemblers, such as section
+ * names, lack of leading . in pseudo-ops, DC and DS, etc ...
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include "as.h"
+#include "subsegs.h"
+#include "struc-symbol.h"
+
+#include "opcode/i370.h"
+
+#ifdef OBJ_ELF
+#include "elf/i370.h"
+#endif
+
+/* This is the assembler for the System/390 Architecture  */
+
+/* Tell the main code what the endianness is.  */
+extern int target_big_endian;
+
+
+/* Generic assembler global variables which must be defined by all
+   targets.  */
+
+#ifdef OBJ_ELF
+/* This string holds the chars that always start a comment.  If the
+   pre-processor is disabled, these aren't very useful.  The macro
+   tc_comment_chars points to this.  We use this, rather than the
+   usual comment_chars, so that we can switch for Solaris conventions.  */
+static const char i370_eabi_comment_chars[] = "#";
+
+const char *i370_comment_chars = i370_eabi_comment_chars;
+#else
+const char comment_chars[] = "#";
+#endif
+
+/* Characters which start a comment at the beginning of a line.  */
+const char line_comment_chars[] = "#*";
+
+/* Characters which may be used to separate multiple commands on a
+   single line.  */
+const char line_separator_chars[] = ";";
+
+/* Characters which are used to indicate an exponent in a floating
+   point number.  */
+const char EXP_CHARS[] = "eE";
+
+/* Characters which mean that a number is a floating point constant,
+   as in 0d1.0.  */
+const char FLT_CHARS[] = "dD";
+
+
+void
+md_show_usage (stream)
+     FILE *stream;
+{
+  fprintf(stream, "\
+S/370 options: (these have not yet been tested and may not work) \n\
+-u        		ignored\n\
+-mregnames        	Allow symbolic names for registers\n\
+-mno-regnames        	Do not allow symbolic names for registers\n");
+#ifdef OBJ_ELF
+  fprintf(stream, "\
+-mrelocatable        	support for GCC's -mrelocatble option\n\
+-mrelocatable-lib       support for GCC's -mrelocatble-lib option\n\
+-V        		print assembler version number\n");
+#endif
+}
+
+
+static void i370_byte PARAMS ((int));
+static void i370_tc PARAMS ((int));
+static void i370_ebcdic PARAMS ((int));
+
+static void i370_dc PARAMS ((int));
+static void i370_ds PARAMS ((int));
+static void i370_rmode PARAMS ((int));
+static void i370_csect PARAMS ((int));
+static void i370_dsect PARAMS ((int));
+static void i370_ltorg PARAMS ((int));
+static void i370_using PARAMS ((int));
+static void i370_drop PARAMS ((int));
+static void i370_make_relative PARAMS ((expressionS *exp, expressionS *baseaddr));
+
+#ifdef OBJ_ELF
+static bfd_reloc_code_real_type i370_elf_suffix PARAMS ((char **, expressionS *));
+static void i370_elf_cons PARAMS ((int));
+static void i370_elf_rdata PARAMS ((int));
+static void i370_elf_lcomm PARAMS ((int));
+static void i370_elf_validate_fix PARAMS ((fixS *, segT));
+#endif
+
+
+
+/* The target specific pseudo-ops which we support.  */
+
+const pseudo_typeS md_pseudo_table[] =
+{
+  /* Pseudo-ops which must be overridden.  */
+  { "byte",     i370_byte,	0 },
+
+  { "dc",       i370_dc,	0 },
+  { "ds",       i370_ds,	0 },
+  { "rmode",    i370_rmode,	0 },
+  { "csect",    i370_csect,	0 },
+  { "dsect",    i370_dsect,	0 },
+
+  /* enable ebcdic strings e.g. for 3270 support */
+  { "ebcdic",   i370_ebcdic,	0 },
+
+#ifdef OBJ_ELF
+  { "long",     i370_elf_cons,	4 },
+  { "word",     i370_elf_cons,	4 },
+  { "short",    i370_elf_cons,	2 },
+  { "rdata",    i370_elf_rdata,	0 },
+  { "rodata",   i370_elf_rdata,	0 },
+  { "lcomm",    i370_elf_lcomm,	0 },
+#endif
+
+  /* This pseudo-op is used even when not generating XCOFF output.  */
+  { "tc",       i370_tc,	0 },
+
+  /* dump the literal pool */
+  { "ltorg",    i370_ltorg,	0 },
+
+  /* support the hlasm-style USING directive */
+  { "using",    i370_using,	0 },
+  { "drop",     i370_drop,	0 },
+
+  { NULL,       NULL,		0 }
+};
+
+/* ***************************************************************** */
+
+/* Whether to use user friendly register names.  */
+#define TARGET_REG_NAMES_P true
+
+static boolean reg_names_p = TARGET_REG_NAMES_P;
+
+static boolean register_name PARAMS ((expressionS *));
+static void i370_set_cpu PARAMS ((void));
+static i370_insn_t i370_insert_operand
+  PARAMS ((i370_insn_t insn, const struct i370_operand *operand, offsetT val));
+static void i370_macro PARAMS ((char *str, const struct i370_macro *macro));
+
+/* Predefined register names if -mregnames */
+/* In general, there are lots of them, in an attempt to be compatible */
+/* with a number of assemblers.                      */
+
+/* Structure to hold information about predefined registers.  */
+struct pd_reg
+  {
+    char *name;
+    int value;
+  };
+
+/* List of registers that are pre-defined:
+
+   Each general register has predefined names of the form:
+   1. r<reg_num> which has the value <reg_num>.
+   2. r.<reg_num> which has the value <reg_num>.
+
+
+   Each floating point register has predefined names of the form:
+   1. f<reg_num> which has the value <reg_num>.
+   2. f.<reg_num> which has the value <reg_num>.
+
+   There are only four floating point registers, and these are
+   commonly labelled 0,2,4 and 6.  Thus, there is no f1, f3, etc.
+
+
+   There are individual registers as well:
+   rbase or r.base has the value  3  (base register)
+   rpgt or r.pgt   has the value  4  (page origin table pointer)
+   rarg or r.arg   has the value 11  (argument pointer)
+   rtca or r.tca   has the value 12  (table of contents pointer)
+   rtoc or r.toc   has the value 12  (table of contents pointer)
+   sp or r.sp      has the value 13  (stack pointer)
+   dsa or r.dsa    has the value 13  (stack pointer)
+   lr              has the value 14  (link reg)
+
+   The table is sorted. Suitable for searching by a binary search. */
+
+static const struct pd_reg pre_defined_registers[] =
+{
+  { "arg", 11 },  /* Argument Pointer */
+  { "base", 3 },  /* Base Reg */
+
+  { "f.0", 0 },     /* Floating point registers */
+  { "f.2", 2 },
+  { "f.4", 4 },
+  { "f.6", 6 },
+
+  { "f0", 0 },
+  { "f2", 2 },
+  { "f4", 4 },
+  { "f6", 6 },
+
+
+  { "dsa",13 },    /* stack pointer */
+  { "lr", 14 },    /* Link Register */
+  { "pgt", 4 },    /* Page Origin Table Pointer */
+
+  { "r.0", 0 },    /* General Purpose Registers */
+  { "r.1", 1 },
+  { "r.10", 10 },
+  { "r.11", 11 },
+  { "r.12", 12 },
+  { "r.13", 13 },
+  { "r.14", 14 },
+  { "r.15", 15 },
+  { "r.2", 2 },
+  { "r.3", 3 },
+  { "r.4", 4 },
+  { "r.5", 5 },
+  { "r.6", 6 },
+  { "r.7", 7 },
+  { "r.8", 8 },
+  { "r.9", 9 },
+
+  { "r.arg", 11 },  /* Argument Pointer */
+  { "r.base", 3 },  /* Base Reg */
+  { "r.dsa", 13 },  /* Stack Pointer */
+  { "r.pgt", 4 },   /* Page Origin Table Pointer */
+  { "r.sp", 13 },   /* Stack Pointer */
+
+  { "r.tca", 12 },  /* Pointer to the table of contents */
+  { "r.toc", 12 },  /* Pointer to the table of contents */
+
+  { "r0", 0 },     /* More general purpose registers */
+  { "r1", 1 },
+  { "r10", 10 },
+  { "r11", 11 },
+  { "r12", 12 },
+  { "r13", 13 },
+  { "r14", 14 },
+  { "r15", 15 },
+  { "r2", 2 },
+  { "r3", 3 },
+  { "r4", 4 },
+  { "r5", 5 },
+  { "r6", 6 },
+  { "r7", 7 },
+  { "r8", 8 },
+  { "r9", 9 },
+
+  { "rbase", 3 },  /* Base Reg */
+
+  { "rtca", 12 },  /* Pointer to the table of contents */
+  { "rtoc", 12 },  /* Pointer to the table of contents */
+
+  { "sp", 13 },   /* Stack Pointer */
+
+};
+
+#define REG_NAME_CNT        (sizeof(pre_defined_registers) / sizeof(struct pd_reg))
+
+/* Given NAME, find the register number associated with that name, return
+   the integer value associated with the given name or -1 on failure.  */
+
+static int reg_name_search
+  PARAMS ((const struct pd_reg *, int, const char * name));
+
+static int
+reg_name_search (regs, regcount, name)
+     const struct pd_reg *regs;
+     int regcount;
+     const char *name;
+{
+  int middle, low, high;
+  int cmp;
+
+  low = 0;
+  high = regcount - 1;
+
+  do
+    {
+      middle = (low + high) / 2;
+      cmp = strcasecmp (name, regs[middle].name);
+      if (cmp < 0)
+        high = middle - 1;
+      else if (cmp > 0)
+        low = middle + 1;
+      else
+        return regs[middle].value;
+    }
+  while (low <= high);
+
+  return -1;
+}
+
+/*
+ * Summary of register_name().
+ *
+ * in:        Input_line_pointer points to 1st char of operand.
+ *
+ * out:        A expressionS.
+ *      The operand may have been a register: in this case, X_op == O_register,
+ *      X_add_number is set to the register number, and truth is returned.
+ *        Input_line_pointer->(next non-blank) char after operand, or is in its
+ *      original state.
+ */
+
+static boolean
+register_name (expressionP)
+     expressionS *expressionP;
+{
+  int reg_number;
+  char *name;
+  char *start;
+  char c;
+
+  /* Find the spelling of the operand */
+  start = name = input_line_pointer;
+  if (name[0] == '%' && isalpha (name[1]))
+    name = ++input_line_pointer;
+
+  else if (!reg_names_p)
+    return false;
+
+  while (' ' == *name)
+    name = ++input_line_pointer;
+
+  /* if its a number, treat it as a number */
+  /* if its alpha, look to see if it's in the register table */
+  if (!isalpha (name[0]))
+    {
+      reg_number = get_single_number();
+      c = get_symbol_end ();
+    }
+  else
+    {
+      c = get_symbol_end ();
+      reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
+    }
+
+  /* if numeric, make sure its not out of bounds */
+  if ((0 <= reg_number) && (16 >= reg_number))
+    {
+      expressionP->X_op = O_register;
+      expressionP->X_add_number = reg_number;
+
+      /* make the rest nice */
+      expressionP->X_add_symbol = NULL;
+      expressionP->X_op_symbol = NULL;
+      *input_line_pointer = c;   /* put back the delimiting char */
+      return true;
+    }
+
+    /* reset the line as if we had not done anything */
+    *input_line_pointer = c;   /* put back the delimiting char */
+    input_line_pointer = start; /* reset input_line pointer */
+    return false;
+}
+
+/* Local variables.  */
+
+/* The type of processor we are assembling for.  This is one or more
+   of the I370_OPCODE flags defined in opcode/i370.h.  */
+static int i370_cpu = 0;
+
+/* The base register to use for opcode with optional operands.
+ * We define two of these: "text" and "other".  Normally, "text"
+ * would get used in the .text section for branches, while "other"
+ * gets used in the .data section for address constants.
+ *
+ * The idea of a second base register in a different section
+ * is foreign to the usual HLASM-style semantics; however, it
+ * allows us to provide support for dynamically loaded libraries,
+ * by allowing us to place address constants in a section other
+ * than the text section. The "other" section need not be the
+ * .data section, it can be any section that isn't the .text section.
+ *
+ * Note that HLASM defines a multiple, concurrent .using semantic
+ * that we do not: in calculating offsets, it uses either the most
+ * recent .using directive, or the one with the smallest displacement.
+ * This allows HLASM to support a quasi-block-scope-like behaviour.
+ * Handy for people writing assembly by hand ... but not supported
+ * by us.
+ */
+static int i370_using_text_regno = -1;
+static int i370_using_other_regno = -1;
+
+/* The base address for address literals */
+static expressionS i370_using_text_baseaddr;
+static expressionS i370_using_other_baseaddr;
+
+/* the "other" section, used only for syntax error detection */
+static segT i370_other_section = undefined_section;
+
+/* Opcode hash table.  */
+static struct hash_control *i370_hash;
+
+/* Macro hash table.  */
+static struct hash_control *i370_macro_hash;
+
+#ifdef OBJ_ELF
+/* What type of shared library support to use */
+static enum { SHLIB_NONE, SHLIB_PIC, SHILB_MRELOCATABLE } shlib = SHLIB_NONE;
+#endif
+
+/* Flags to set in the elf header */
+static flagword i370_flags = 0;
+
+#ifndef WORKING_DOT_WORD
+const int md_short_jump_size = 4;
+const int md_long_jump_size = 4;
+#endif
+
+#ifdef OBJ_ELF
+CONST char *md_shortopts = "l:um:K:VQ:";
+#else
+CONST char *md_shortopts = "um:";
+#endif
+struct option md_longopts[] =
+{
+  {NULL, no_argument, NULL, 0}
+};
+size_t md_longopts_size = sizeof(md_longopts);
+
+int
+md_parse_option (c, arg)
+     int c;
+     char *arg;
+{
+  switch (c)
+    {
+    case 'u':
+      /* -u means that any undefined symbols should be treated as
+         external, which is the default for gas anyhow.  */
+      break;
+
+#ifdef OBJ_ELF
+    case 'K':
+      /* Recognize -K PIC */
+      if (strcmp (arg, "PIC") == 0 || strcmp (arg, "pic") == 0)
+        {
+          shlib = SHLIB_PIC;
+          i370_flags |= EF_I370_RELOCATABLE_LIB;
+        }
+      else
+        return 0;
+
+      break;
+#endif
+
+    case 'm':
+
+      /* -m360 mean to assemble for the ancient 360 architecture */
+      if (strcmp (arg, "360") == 0 || strcmp (arg, "i360") == 0)
+	i370_cpu = I370_OPCODE_360;
+      /* -mxa means to assemble for the IBM 370 XA  */
+      else if (strcmp (arg, "xa") == 0)
+	i370_cpu = I370_OPCODE_370_XA;
+      /* -many means to assemble for any architecture (370/XA).  */
+      else if (strcmp (arg, "any") == 0)
+	i370_cpu = I370_OPCODE_370;
+
+      else if (strcmp (arg, "regnames") == 0)
+	reg_names_p = true;
+
+      else if (strcmp (arg, "no-regnames") == 0)
+	reg_names_p = false;
+
+#ifdef OBJ_ELF
+      /* -mrelocatable/-mrelocatable-lib -- warn about initializations that require relocation */
+      else if (strcmp (arg, "relocatable") == 0)
+        {
+          shlib = SHILB_MRELOCATABLE;
+          i370_flags |= EF_I370_RELOCATABLE;
+        }
+
+      else if (strcmp (arg, "relocatable-lib") == 0)
+        {
+          shlib = SHILB_MRELOCATABLE;
+          i370_flags |= EF_I370_RELOCATABLE_LIB;
+        }
+
+#endif
+      else
+        {
+          as_bad ("invalid switch -m%s", arg);
+          return 0;
+        }
+      break;
+
+#ifdef OBJ_ELF
+      /* -V: SVR4 argument to print version ID.  */
+    case 'V':
+      print_version_id ();
+      break;
+
+      /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
+         should be emitted or not.  FIXME: Not implemented.  */
+    case 'Q':
+      break;
+
+#endif
+
+    default:
+      return 0;
+    }
+
+  return 1;
+}
+
+
+/* Set i370_cpu if it is not already set.
+   Currently defaults to the reasonable superset;
+   but can be made more fine grained if desred. */
+
+static void
+i370_set_cpu ()
+{
+  const char *default_os  = TARGET_OS;
+  const char *default_cpu = TARGET_CPU;
+
+  /* override with the superset for the moment. */
+  i370_cpu = I370_OPCODE_ESA390_SUPERSET;
+  if (i370_cpu == 0)
+    {
+      if (strcmp (default_cpu, "i360") == 0)
+        i370_cpu = I370_OPCODE_360;
+      else if (strcmp (default_cpu, "i370") == 0)
+        i370_cpu = I370_OPCODE_370;
+      else if (strcmp (default_cpu, "XA") == 0)
+        i370_cpu = I370_OPCODE_370_XA;
+      else
+        as_fatal ("Unknown default cpu = %s, os = %s", default_cpu, default_os);
+    }
+}
+
+/* Figure out the BFD architecture to use.  */
+// hack alert -- specify the different 370 architectures
+
+enum bfd_architecture
+i370_arch ()
+{
+   return bfd_arch_i370;
+}
+
+/* This function is called when the assembler starts up.  It is called
+   after the options have been parsed and the output file has been
+   opened.  */
+
+void
+md_begin ()
+{
+  register const struct i370_opcode *op;
+  const struct i370_opcode *op_end;
+  const struct i370_macro *macro;
+  const struct i370_macro *macro_end;
+  boolean dup_insn = false;
+
+  i370_set_cpu ();
+
+#ifdef OBJ_ELF
+  /* Set the ELF flags if desired. */
+  if (i370_flags)
+    bfd_set_private_flags (stdoutput, i370_flags);
+#endif
+
+  /* Insert the opcodes into a hash table.  */
+  i370_hash = hash_new ();
+
+   op_end = i370_opcodes + i370_num_opcodes;
+   for (op = i370_opcodes; op < op_end; op++)
+     {
+       know ((op->opcode & op->mask) == op->opcode);
+
+       if ((op->flags & i370_cpu) != 0)
+         {
+           const char *retval;
+
+           retval = hash_insert (i370_hash, op->name, (PTR) op);
+           if (retval != (const char *) NULL)
+             {
+               as_bad ("Internal assembler error for instruction %s", op->name);
+               dup_insn = true;
+             }
+         }
+     }
+
+  /* Insert the macros into a hash table.  */
+  i370_macro_hash = hash_new ();
+
+  macro_end = i370_macros + i370_num_macros;
+  for (macro = i370_macros; macro < macro_end; macro++)
+    {
+      if ((macro->flags & i370_cpu) != 0)
+        {
+          const char *retval;
+
+          retval = hash_insert (i370_macro_hash, macro->name, (PTR) macro);
+          if (retval != (const char *) NULL)
+            {
+              as_bad ("Internal assembler error for macro %s", macro->name);
+              dup_insn = true;
+            }
+        }
+    }
+
+  if (dup_insn)
+    abort ();
+}
+
+/* Insert an operand value into an instruction.  */
+
+static i370_insn_t
+i370_insert_operand (insn, operand, val)
+     i370_insn_t insn;
+     const struct i370_operand *operand;
+     offsetT val;
+{
+  if (operand->insert)
+    {
+      const char *errmsg;
+
+      /* used for 48-bit insn's */
+      errmsg = NULL;
+      insn = (*operand->insert) (insn, (long) val, &errmsg);
+      if (errmsg)
+        as_bad ("%s", errmsg);
+    }
+  else
+    {
+      /* this is used only for 16, 32 bit insn's */
+      insn.i[0] |= (((long) val & ((1 << operand->bits) - 1))
+		    << operand->shift);
+    }
+
+  return insn;
+}
+
+
+#ifdef OBJ_ELF
+/* Parse @got, etc. and return the desired relocation.
+ * Currently, i370 does not support (don't really need to support) any
+ * of these fancier markups ... for example, no one is going to
+ * write 'L 6,=V(bogus)@got' it just doesn't make sense (at least to me).
+ * So basically, we could get away with this routine returning
+ * BFD_RELOC_UNUSED in all circumstances.  However, I'll leave
+ * in for now in case someone ambitious finds a good use for this stuff ...
+ * this routine was pretty much just copied from the powerpc code ...
+ */
+static bfd_reloc_code_real_type
+i370_elf_suffix (str_p, exp_p)
+     char **str_p;
+     expressionS *exp_p;
+{
+  struct map_bfd
+  {
+    char *string;
+    int length;
+    bfd_reloc_code_real_type reloc;
+  };
+
+  char ident[20];
+  char *str = *str_p;
+  char *str2;
+  int ch;
+  int len;
+  struct map_bfd *ptr;
+
+#define MAP(str,reloc) { str, sizeof(str)-1, reloc }
+
+  static struct map_bfd mapping[] =
+  {
+    //     MAP ("l",        	BFD_RELOC_LO16),
+    //     MAP ("h",        	BFD_RELOC_HI16),
+    //     MAP ("ha",        	BFD_RELOC_HI16_S),
+    MAP ("fixup",        BFD_RELOC_CTOR),          /* warnings with -mrelocatable */
+    { (char *)0,        0,	BFD_RELOC_UNUSED }
+  };
+
+  if (*str++ != '@')
+    return BFD_RELOC_UNUSED;
+
+  for (ch = *str, str2 = ident;
+       (str2 < ident + sizeof (ident) - 1
+        && (isalnum (ch) || ch == '@'));
+       ch = *++str)
+    {
+      *str2++ = (islower (ch)) ? ch : tolower (ch);
+    }
+
+  *str2 = '\0';
+  len = str2 - ident;
+
+  ch = ident[0];
+  for (ptr = &mapping[0]; ptr->length > 0; ptr++)
+    if (ch == ptr->string[0]
+        && len == ptr->length
+        && memcmp (ident, ptr->string, ptr->length) == 0)
+      {
+        if (exp_p->X_add_number != 0
+            && (ptr->reloc == BFD_RELOC_16_GOTOFF
+        	|| ptr->reloc == BFD_RELOC_LO16_GOTOFF
+        	|| ptr->reloc == BFD_RELOC_HI16_GOTOFF
+        	|| ptr->reloc == BFD_RELOC_HI16_S_GOTOFF))
+          as_warn ("identifier+constant@got means identifier@got+constant");
+
+        /* Now check for identifier@suffix+constant */
+        if (*str == '-' || *str == '+')
+          {
+            char *orig_line = input_line_pointer;
+            expressionS new_exp;
+
+            input_line_pointer = str;
+            expression (&new_exp);
+            if (new_exp.X_op == O_constant)
+              {
+        	exp_p->X_add_number += new_exp.X_add_number;
+        	str = input_line_pointer;
+              }
+
+            if (&input_line_pointer != str_p)
+              input_line_pointer = orig_line;
+          }
+
+        *str_p = str;
+        return ptr->reloc;
+      }
+
+  return BFD_RELOC_UNUSED;
+}
+
+/* Like normal .long/.short/.word, except support @got, etc. */
+/* clobbers input_line_pointer, checks end-of-line. */
+static void
+i370_elf_cons (nbytes)
+     register int nbytes;        /* 1=.byte, 2=.word, 4=.long */
+{
+  expressionS exp;
+  bfd_reloc_code_real_type reloc;
+
+  if (is_it_end_of_statement ())
+    {
+      demand_empty_rest_of_line ();
+      return;
+    }
+
+  do
+    {
+      expression (&exp);
+      if (exp.X_op == O_symbol
+          && *input_line_pointer == '@'
+          && (reloc = i370_elf_suffix (&input_line_pointer, &exp)) != BFD_RELOC_UNUSED)
+        {
+          reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, reloc);
+          int size = bfd_get_reloc_size (reloc_howto);
+
+          if (size > nbytes)
+            as_bad ("%s relocations do not fit in %d bytes\n", reloc_howto->name, nbytes);
+
+          else
+            {
+              register char *p = frag_more ((int) nbytes);
+              int offset = nbytes - size;
+
+              fix_new_exp (frag_now, p - frag_now->fr_literal + offset, size, &exp, 0, reloc);
+            }
+        }
+      else
+        emit_expr (&exp, (unsigned int) nbytes);
+    }
+  while (*input_line_pointer++ == ',');
+
+  input_line_pointer--;        	/* Put terminator back into stream. */
+  demand_empty_rest_of_line ();
+}
+
+
+/* ASCII to EBCDIC conversion table.  */
+static unsigned char ascebc[256] =
+{
+ /*00  NL    SH    SX    EX    ET    NQ    AK    BL */
+     0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,
+ /*08  BS    HT    LF    VT    FF    CR    SO    SI */
+     0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ /*10  DL    D1    D2    D3    D4    NK    SN    EB */
+     0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,
+ /*18  CN    EM    SB    EC    FS    GS    RS    US */
+     0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
+ /*20  SP     !     "     #     $     %     &     ' */
+     0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,
+ /*28   (     )     *     +     ,     -    .      / */
+     0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
+ /*30   0     1     2     3     4     5     6     7 */
+     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ /*38   8     9     :     ;     <     =     >     ? */
+     0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
+ /*40   @     A     B     C     D     E     F     G */
+     0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ /*48   H     I     J     K     L     M     N     O */
+     0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
+ /*50   P     Q     R     S     T     U     V     W */
+     0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,
+ /*58   X     Y     Z     [     \     ]     ^     _ */
+     0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
+ /*60   `     a     b     c     d     e     f     g */
+     0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ /*68   h     i     j     k     l     m     n     o */
+     0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+ /*70   p     q     r     s     t     u     v     w */
+     0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
+ /*78   x     y     z     {     |     }     ~    DL */
+     0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF
+};
+
+/* EBCDIC to ASCII conversion table.  */
+unsigned char ebcasc[256] =
+{
+ /*00  NU    SH    SX    EX    PF    HT    LC    DL */
+     0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7F,
+ /*08              SM    VT    FF    CR    SO    SI */
+     0x00, 0x00, 0x00, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ /*10  DE    D1    D2    TM    RS    NL    BS    IL */
+     0x10, 0x11, 0x12, 0x13, 0x14, 0x0A, 0x08, 0x00,
+ /*18  CN    EM    CC    C1    FS    GS    RS    US */
+     0x18, 0x19, 0x00, 0x00, 0x1C, 0x1D, 0x1E, 0x1F,
+ /*20  DS    SS    FS          BP    LF    EB    EC */
+     0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x17, 0x1B,
+ /*28              SM    C2    EQ    AK    BL       */
+     0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07, 0x00,
+ /*30              SY          PN    RS    UC    ET */
+     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ /*38                    C3    D4    NK          SU */
+     0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1A,
+ /*40  SP                                           */
+     0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*48                     .     <     (     +     | */
+     0x00, 0x00, 0x00, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
+ /*50   &                                           */
+     0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*58               !     $     *     )     ;     ^ */
+     0x00, 0x00, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
+ /*60   -     /                                     */
+     0x2D, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*68                     ,     %     _     >     ? */
+     0x00, 0x00, 0x00, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
+ /*70                                               */
+     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*78         `     :     #     @     '     =     " */
+     0x00, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
+ /*80         a     b     c     d     e     f     g */
+     0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ /*88   h     i           {                         */
+     0x68, 0x69, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x00,
+ /*90         j     k     l     m     n     o     p */
+     0x00, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
+ /*98   q     r           }                         */
+     0x71, 0x72, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00,
+ /*A0         ~     s     t     u     v     w     x */
+     0x00, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ /*A8   y     z                       [             */
+     0x79, 0x7A, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00,
+ /*B0                                               */
+     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*B8                                 ]             */
+     0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00,
+ /*C0   {     A     B     C     D     E     F     G */
+     0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ /*C8   H     I                                     */
+     0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*D0   }     J     K     L     M     N     O     P */
+     0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+ /*D8   Q     R                                     */
+     0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*E0   \           S     T     U     V     W     X */
+     0x5C, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ /*E8   Y     Z                                     */
+     0x59, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*F0   0     1     2     3     4     5     6     7 */
+     0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ /*F8   8     9                                     */
+     0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
+};
+
+/* ebcdic translation tables needed for 3270 support */
+static void
+i370_ebcdic (unused)
+     int unused;
+{
+  char *p, *end;
+  char delim = 0;
+  size_t nbytes;
+
+  nbytes = strlen (input_line_pointer);
+  end = input_line_pointer + nbytes;
+  while ('\r' == *end) end --;
+  while ('\n' == *end) end --;
+
+  delim = *input_line_pointer;
+  if (('\'' == delim) || ('\"' == delim)) {
+    input_line_pointer ++;
+    end = rindex (input_line_pointer, delim);
+  }
+
+  if (end > input_line_pointer)
+    {
+      nbytes = end - input_line_pointer +1;
+      p = frag_more (nbytes);
+      while (end > input_line_pointer)
+	{
+	  *p = ascebc [(unsigned char)(*input_line_pointer)];
+	  ++p; ++input_line_pointer;
+	}
+      *p = '\0';
+    }
+  if (delim == *input_line_pointer) ++input_line_pointer;
+}
+
+
+/* stub out a couple of routines */
+static void
+i370_rmode (unused)
+     int unused;
+{
+  as_tsktsk ("rmode ignored");
+}
+
+static void
+i370_dsect (sect)
+     int sect;
+{
+  char *save_line = input_line_pointer;
+  static char section[] = ".data\n";
+
+  /* Just pretend this is .section .data */
+  input_line_pointer = section;
+  obj_elf_section (sect);
+
+  input_line_pointer = save_line;
+}
+
+static void
+i370_csect (unused)
+     int unused;
+{
+  as_tsktsk ("csect not supported");
+}
+
+
+/* DC Define Const  is only partially supported.
+ * For samplecode on what to do, look at i370_elf_cons() above.
+ * This code handles pseudoops of the style
+ * DC   D'3.141592653'   # in sysv4, .double 3.14159265
+ * DC   F'1'             # in sysv4, .long   1
+ */
+static void
+i370_dc(unused)
+     int unused;
+{
+  char * p, tmp[50];
+  int nbytes=0;
+  expressionS exp;
+  char type=0;
+
+  if (is_it_end_of_statement ())
+    {
+      demand_empty_rest_of_line ();
+      return;
+    }
+
+  /* figure out the size */
+  type = *input_line_pointer++;
+  switch (type)
+    {
+    case 'H':  /* 16-bit */
+      nbytes = 2;
+      break;
+    case 'E':  /* 32-bit */
+    case 'F':  /* 32-bit */
+      nbytes = 4;
+      break;
+    case 'D':  /* 64-bit */
+      nbytes = 8;
+      break;
+    default:
+      as_bad ("unsupported DC type");
+      return;
+    }
+
+  /* get rid of pesky quotes */
+  if ('\'' == *input_line_pointer)
+    {
+      char * close;
+      ++input_line_pointer;
+      close = strchr (input_line_pointer, '\'');
+      if (close)
+	*close= ' ';
+      else
+	as_bad ("missing end-quote");
+    }
+  if ('\"' == *input_line_pointer)
+    {
+      char * close;
+      ++input_line_pointer;
+      close = strchr (input_line_pointer, '\"');
+      if (close)
+	*close= ' ';
+      else
+	as_bad ("missing end-quote");
+    }
+
+  switch (type)
+    {
+    case 'H':  /* 16-bit */
+    case 'F':  /* 32-bit */
+      expression (&exp);
+      emit_expr (&exp, nbytes);
+      break;
+    case 'E':  /* 32-bit */
+    case 'D':  /* 64-bit */
+      md_atof (type, tmp, &nbytes);
+      p = frag_more (nbytes);
+      memcpy (p, tmp, nbytes);
+      break;
+    default:
+      as_bad ("unsupported DC type");
+      return;
+    }
+
+  demand_empty_rest_of_line ();
+}
+
+
+/* provide minimal support for DS Define Storage */
+static void
+i370_ds (unused)
+     int unused;
+{
+  /* DS 0H or DS 0F or DS 0D */
+  if ('0' == *input_line_pointer)
+    {
+      int alignment = 0;  /* left shift 1<<align */
+      input_line_pointer ++;
+      switch (*input_line_pointer++)
+	{
+	case 'H':  /* 16-bit */
+	  alignment = 1;
+	  break;
+	case 'F':  /* 32-bit */
+	  alignment = 2;
+	  break;
+	case 'D':  /* 64-bit */
+	  alignment = 3;
+	  break;
+	default:
+	  as_bad ("unsupported alignment");
+	  return;
+	}
+      frag_align (alignment, 0, 0);
+      record_alignment (now_seg, alignment);
+    }
+  else
+    {
+      as_bad ("this DS form not yet supported");
+    }
+}
+
+/* Solaris pseudo op to change to the .rodata section.  */
+static void
+i370_elf_rdata (sect)
+     int sect;
+{
+  char *save_line = input_line_pointer;
+  static char section[] = ".rodata\n";
+
+  /* Just pretend this is .section .rodata */
+  input_line_pointer = section;
+  obj_elf_section (sect);
+
+  input_line_pointer = save_line;
+}
+
+/* Pseudo op to make file scope bss items */
+static void
+i370_elf_lcomm(unused)
+     int unused;
+{
+  register char *name;
+  register char c;
+  register char *p;
+  offsetT size;
+  register symbolS *symbolP;
+  offsetT align;
+  segT old_sec;
+  int old_subsec;
+  char *pfrag;
+  int align2;
+
+  name = input_line_pointer;
+  c = get_symbol_end ();
+
+  /* just after name is now '\0' */
+  p = input_line_pointer;
+  *p = c;
+  SKIP_WHITESPACE ();
+  if (*input_line_pointer != ',')
+    {
+      as_bad ("Expected comma after symbol-name: rest of line ignored.");
+      ignore_rest_of_line ();
+      return;
+    }
+
+  input_line_pointer++;        	/* skip ',' */
+  if ((size = get_absolute_expression ()) < 0)
+    {
+      as_warn (".COMMon length (%ld.) <0! Ignored.", (long) size);
+      ignore_rest_of_line ();
+      return;
+    }
+
+  /* The third argument to .lcomm is the alignment.  */
+  if (*input_line_pointer != ',')
+    align = 8;
+  else
+    {
+      ++input_line_pointer;
+      align = get_absolute_expression ();
+      if (align <= 0)
+        {
+          as_warn ("ignoring bad alignment");
+          align = 8;
+        }
+    }
+
+  *p = 0;
+  symbolP = symbol_find_or_make (name);
+  *p = c;
+
+  if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
+    {
+      as_bad ("Ignoring attempt to re-define symbol `%s'.",
+              S_GET_NAME (symbolP));
+      ignore_rest_of_line ();
+      return;
+    }
+
+  if (S_GET_VALUE (symbolP) && S_GET_VALUE (symbolP) != (valueT) size)
+    {
+      as_bad ("Length of .lcomm \"%s\" is already %ld. Not changed to %ld.",
+              S_GET_NAME (symbolP),
+              (long) S_GET_VALUE (symbolP),
+              (long) size);
+
+      ignore_rest_of_line ();
+      return;
+    }
+
+  /* allocate_bss: */
+  old_sec = now_seg;
+  old_subsec = now_subseg;
+  if (align)
+    {
+      /* convert to a power of 2 alignment */
+      for (align2 = 0; (align & 1) == 0; align >>= 1, ++align2)
+	;
+      if (align != 1)
+        {
+          as_bad ("Common alignment not a power of 2");
+          ignore_rest_of_line ();
+          return;
+        }
+    }
+  else
+    align2 = 0;
+
+  record_alignment (bss_section, align2);
+  subseg_set (bss_section, 0);
+  if (align2)
+    frag_align (align2, 0, 0);
+  if (S_GET_SEGMENT (symbolP) == bss_section)
+    symbol_get_frag (symbolP)->fr_symbol = 0;
+  symbol_set_frag (symbolP, frag_now);
+  pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
+        	    (char *) 0);
+  *pfrag = 0;
+  S_SET_SIZE (symbolP, size);
+  S_SET_SEGMENT (symbolP, bss_section);
+  subseg_set (old_sec, old_subsec);
+  demand_empty_rest_of_line ();
+}
+
+/* Validate any relocations emitted for -mrelocatable, possibly adding
+   fixups for word relocations in writable segments, so we can adjust
+   them at runtime.  */
+static void
+i370_elf_validate_fix (fixp, seg)
+     fixS *fixp;
+     segT seg;
+{
+  if (fixp->fx_done || fixp->fx_pcrel)
+    return;
+
+  switch (shlib)
+    {
+    case SHLIB_NONE:
+    case SHLIB_PIC:
+      return;
+
+    case SHILB_MRELOCATABLE:
+      if (fixp->fx_r_type <= BFD_RELOC_UNUSED
+          && fixp->fx_r_type != BFD_RELOC_16_GOTOFF
+          && fixp->fx_r_type != BFD_RELOC_HI16_GOTOFF
+          && fixp->fx_r_type != BFD_RELOC_LO16_GOTOFF
+          && fixp->fx_r_type != BFD_RELOC_HI16_S_GOTOFF
+          && fixp->fx_r_type != BFD_RELOC_32_BASEREL
+          && fixp->fx_r_type != BFD_RELOC_LO16_BASEREL
+          && fixp->fx_r_type != BFD_RELOC_HI16_BASEREL
+          && fixp->fx_r_type != BFD_RELOC_HI16_S_BASEREL
+          && strcmp (segment_name (seg), ".got2") != 0
+          && strcmp (segment_name (seg), ".dtors") != 0
+          && strcmp (segment_name (seg), ".ctors") != 0
+          && strcmp (segment_name (seg), ".fixup") != 0
+          && strcmp (segment_name (seg), ".stab") != 0
+          && strcmp (segment_name (seg), ".gcc_except_table") != 0
+          && strcmp (segment_name (seg), ".ex_shared") != 0)
+        {
+          if ((seg->flags & (SEC_READONLY | SEC_CODE)) != 0
+              || fixp->fx_r_type != BFD_RELOC_CTOR)
+            {
+              as_bad_where (fixp->fx_file, fixp->fx_line,
+        		    "Relocation cannot be done when using -mrelocatable");
+            }
+        }
+      return;
+    }
+}
+#endif /* OBJ_ELF */
+
+
+
+#define LITERAL_POOL_SUPPORT
+#ifdef LITERAL_POOL_SUPPORT
+/* Provide support for literal pools within the text section. */
+/* Loosely based on similar code from tc-arm.c  */
+/*
+ * We will use four symbols to locate four parts of the literal pool.
+ *    These four sections contain 64,32,16 and 8-bit constants; we use
+ *    four sections so that all memory access can be appropriately aligned.
+ *    That is, we want to avoid mixing these together so that we don't
+ *    waste space padding out to alignments.  The four pointers
+ *    longlong_poolP, word_poolP, etc. point to a symbol labeling the
+ *    start of each pool part.
+ *
+ * lit_pool_num increments from zero to infinity and uniquely id's
+ *    -- its used to generate the *_poolP symbol name.
+ */
+
+#define MAX_LITERAL_POOL_SIZE 1024
+
+typedef struct literalS
+{
+  struct expressionS  exp;
+  char * sym_name;
+  char size;  /* 1,2,4 or 8 */
+  short offset;
+} literalT;
+
+literalT literals[MAX_LITERAL_POOL_SIZE];
+int next_literal_pool_place = 0; /* Next free entry in the pool */
+
+static symbolS *longlong_poolP = NULL;   /* 64-bit pool entries */
+static symbolS *word_poolP = NULL;       /* 32-bit pool entries */
+static symbolS *short_poolP = NULL;      /* 16-bit pool entries */
+static symbolS *byte_poolP = NULL;       /* 8-bit  pool entries */
+
+static int lit_pool_num = 1;
+
+/* create a new, empty symbol */
+static symbolS *
+symbol_make_empty (void)
+{
+  return symbol_create (FAKE_LABEL_NAME, undefined_section,
+  			(valueT) 0, &zero_address_frag);
+}
+
+/* add an expression to the literal pool */
+static  void
+add_to_lit_pool (expressionS *exx, char *name, int sz)
+{
+  int lit_count = 0;
+  int offset_in_pool = 0;
+
+  /* start a new pool, if necessary */
+  if (8 == sz && NULL == longlong_poolP)
+    longlong_poolP = symbol_make_empty();
+  else if (4 == sz && NULL == word_poolP)
+    word_poolP = symbol_make_empty();
+  else if (2 == sz && NULL == short_poolP)
+    short_poolP = symbol_make_empty();
+  else if (1 == sz && NULL == byte_poolP)
+    byte_poolP = symbol_make_empty();
+
+  /* Check if this literal value is already in the pool: */
+  /* hack alert -- we should probably be checking expressions
+   * of type O_symbol as well ...  */
+  /* hack alert XXX this is probably(certainly?) broken for O_big,
+   * which includes 64-bit long-longs ...
+   */
+  while (lit_count < next_literal_pool_place)
+    {
+      if (exx->X_op == O_constant
+          && literals[lit_count].exp.X_op == exx->X_op
+          && literals[lit_count].exp.X_add_number == exx->X_add_number
+          && literals[lit_count].exp.X_unsigned == exx->X_unsigned
+          && literals[lit_count].size == sz)
+        break;
+      else if (literals[lit_count].sym_name
+	       && name
+	       && !strcmp (name, literals[lit_count].sym_name))
+        break;
+      if (sz == literals[lit_count].size)
+	offset_in_pool += sz;
+      lit_count ++;
+    }
+
+  if (lit_count == next_literal_pool_place) /* new entry */
+    {
+      if (next_literal_pool_place > MAX_LITERAL_POOL_SIZE)
+        {
+          as_bad("Literal Pool Overflow");
+        }
+
+      literals[next_literal_pool_place].exp = *exx;
+      literals[next_literal_pool_place].size = sz;
+      literals[next_literal_pool_place].offset = offset_in_pool;
+      if (name)
+	{
+	  literals[next_literal_pool_place].sym_name = strdup (name);
+	}
+      else
+	{
+	  literals[next_literal_pool_place].sym_name = NULL;
+	}
+      next_literal_pool_place++;
+    }
+
+  /* ???_poolP points to the begining of the literal pool.
+   * X_add_number is the offset from the begining of the
+   * literal pool to this expr minus the location of the most
+   * recent .using directive.  Thus, the grand total value of the
+   * expression is the distance from .using to the literal.
+   */
+  if (8 == sz)
+    exx->X_add_symbol = longlong_poolP;
+  else if (4 == sz)
+    exx->X_add_symbol = word_poolP;
+  else if (2 == sz)
+    exx->X_add_symbol = short_poolP;
+  else if (1 == sz)
+    exx->X_add_symbol = byte_poolP;
+  exx->X_add_number = offset_in_pool;
+  exx->X_op_symbol = NULL;
+
+  /* If the user has set up a base reg in another section,
+   * use that; otherwise use the text section.  */
+  if (0 < i370_using_other_regno)
+    {
+      i370_make_relative (exx, &i370_using_other_baseaddr);
+    }
+  else
+    {
+      i370_make_relative (exx, &i370_using_text_baseaddr);
+    }
+}
+
+/* The symbol setup for the literal pool is done in two steps.  First,
+ * a symbol that represents the start of the literal pool is created,
+ * above, in the add_to_pool() routine. This sym ???_poolP.
+ * However, we don't know what fragment its in until a bit later.
+ * So we defer the frag_now thing, and the symbol name, until .ltorg time
+ */
+
+/* Can't use symbol_new here, so have to create a symbol and then at
+   a later date assign it a value. Thats what these functions do */
+static void
+symbol_locate (symbolP, name, segment, valu, frag)
+     symbolS *symbolP;
+     CONST char *name;		/* It is copied, the caller can modify */
+     segT segment;		/* Segment identifier (SEG_<something>) */
+     valueT valu;		/* Symbol value */
+     fragS *frag;		/* Associated fragment */
+{
+  size_t name_length;
+  char *preserved_copy_of_name;
+
+  name_length = strlen (name) + 1;      /* +1 for \0 */
+  obstack_grow (&notes, name, name_length);
+  preserved_copy_of_name = obstack_finish (&notes);
+
+  S_SET_NAME (symbolP, preserved_copy_of_name);
+
+  S_SET_SEGMENT (symbolP, segment);
+  S_SET_VALUE (symbolP, valu);
+  symbol_clear_list_pointers(symbolP);
+
+  symbol_set_frag (symbolP, frag);
+
+  /*
+   * Link to end of symbol chain.
+   */
+  {
+    extern int symbol_table_frozen;
+    if (symbol_table_frozen)
+      abort ();
+  }
+
+  symbol_append (symbolP, symbol_lastP, &symbol_rootP, &symbol_lastP);
+
+  obj_symbol_new_hook (symbolP);
+
+#ifdef tc_symbol_new_hook
+  tc_symbol_new_hook (symbolP);
+#endif
+
+#define DEBUG_SYMS
+#ifdef DEBUG_SYMS
+  verify_symbol_chain(symbol_rootP, symbol_lastP);
+#endif /* DEBUG_SYMS */
+}
+
+/* i370_addr_offset() will convert operand expressions
+ * that appear to be absolute into thier base-register
+ * relative form.  These expressions come in two types:
+ *
+ * (1) of the form "* + const" * where "*" means
+ * relative offset since the last using
+ * i.e. "*" means ".-using_baseaddr"
+ *
+ * (2) labels, which are never absolute, but are always
+ * relative to the last "using".  Anything with an alpha
+ * character is considered to be a label (since symbols
+ * can never be operands), and since we've already handled
+ * register operands. For example, "BL .L33" branch low
+ * to .L33 RX form insn frequently terminates for-loops,
+ */
+static boolean
+i370_addr_offset (expressionS *exx)
+{
+  char *dot, *lab;
+  int islabel = 0;
+  int all_digits = 0;
+
+  /* search for a label; anything with an alpha char will do */
+  /* local labels consist of N digits followed by either b or f */
+  lab = input_line_pointer;
+  while (*lab && (',' != *lab) && ('(' != *lab))
+    {
+      if (isdigit(*lab))
+	{
+	  all_digits = 1;
+	}
+      else if (isalpha(*lab))
+	{
+	  if (!all_digits)
+	    {
+	      islabel = 1;
+	      break;
+	    }
+	  else if (('f' == *lab) || ('b' == *lab))
+	    {
+	      islabel = 1;
+	      break;
+	    }
+	  if (all_digits)
+	    break;
+	}
+      else if ('.' != *lab)
+        break;
+      ++lab;
+    }
+
+  /* See if operand has a * in it */
+  dot = strchr (input_line_pointer, '*');
+
+  if (!dot && !islabel)
+    return false;
+
+  /* replace * with . and let expr munch on it.  */
+  if (dot)
+    *dot = '.';
+  expression (exx);
+
+  /* OK, now we have to subtract the "using" location  */
+  /* normally branches appear in the text section only... */
+  if (0 == strncmp (now_seg->name, ".text", 5) || 0 > i370_using_other_regno)
+    {
+      i370_make_relative (exx, &i370_using_text_baseaddr);
+    }
+  else
+    {
+      i370_make_relative (exx, &i370_using_other_baseaddr);
+    }
+
+  /* put the * back */
+  if (dot)
+    *dot = '*';
+
+  return true;
+}
+
+/* handle address constants of various sorts */
+/* The currently supported types are
+ *    =A(some_symb)
+ *    =V(some_extern)
+ *    =X'deadbeef'    hexadecimal
+ *    =F'1234'        32-bit const int
+ *    =H'1234'        16-bit const int
+ */
+static boolean
+i370_addr_cons (expressionS *exp)
+{
+  char *name;
+  char *sym_name, delim;
+  int name_len;
+  int hex_len=0;
+  int cons_len=0;
+
+  name = input_line_pointer;
+  sym_name = input_line_pointer;
+  /* Find the spelling of the operand */
+  if (name[0] == '=' && isalpha (name[1]))
+    {
+      name = ++input_line_pointer;
+    }
+  else
+    {
+      return false;
+    }
+  switch (name[0])
+    {
+    case 'A':
+    case 'V':
+      /* A == address-of */
+      /* V == extern */
+      ++input_line_pointer;
+      expression (exp);
+
+      /* we use a simple string name to collapse together
+       * multiple refrences to the same address literal
+       */
+      name_len = strcspn (sym_name, ", ");
+      delim = *(sym_name + name_len);
+      *(sym_name + name_len) = 0x0;
+      add_to_lit_pool (exp, sym_name, 4);
+      *(sym_name + name_len) = delim;
+
+      break;
+    case 'H':
+    case 'F':
+    case 'X':
+    case 'E':  /* single-precision float point */
+    case 'D':  /* double-precision float point */
+
+      /* H == 16-bit fixed-point const; expression must be const */
+      /* F == fixed-point const; expression must be const */
+      /* X == fixed-point const; expression must be const */
+      if ('H' == name[0]) cons_len = 2;
+      else if ('F' == name[0]) cons_len = 4;
+      else if ('X' == name[0]) cons_len = -1;
+      else if ('E' == name[0]) cons_len = 4;
+      else if ('D' == name[0]) cons_len = 8;
+
+      /* extract length, if it is present; hack alert -- assume single-digit
+       * length */
+      if ('L' == name[1])
+	{
+	  cons_len = name[2] - '0';  /* should work for ascii and ebcdic */
+	  input_line_pointer += 2;
+	}
+
+      ++input_line_pointer;
+
+      /* get rid of pesky quotes */
+      if ('\'' == *input_line_pointer)
+	{
+	  char * close;
+	  ++input_line_pointer;
+	  close = strchr (input_line_pointer, '\'');
+	  if (close)
+	    *close= ' ';
+	  else
+	    as_bad ("missing end-quote");
+	}
+      if ('\"' == *input_line_pointer)
+	{
+	  char * close;
+	  ++input_line_pointer;
+	  close = strchr (input_line_pointer, '\"');
+	  if (close)
+	    *close= ' ';
+	  else
+	    as_bad ("missing end-quote");
+	}
+      if (('X' == name[0]) || ('E' == name[0]) || ('D' == name[0]))
+	{
+	  char tmp[50];
+	  char *save;
+
+	  /* The length of hex constants is specified directly with L,
+	   * or implied through the number of hex digits. For example:
+	   * =X'AB'       one byte
+	   * =X'abcd'     two bytes
+	   * =X'000000AB' four bytes
+	   * =XL4'AB'     four bytes, left-padded withn zero
+	   */
+	  if (('X' == name[0]) && (0 > cons_len))
+	    {
+	      save = input_line_pointer;
+	      while (*save)
+		{
+		  if (isxdigit(*save))
+		    hex_len++;
+		  save++;
+		}
+	      cons_len = (hex_len+1) /2;
+	    }
+	  /* I beleive this works even for =XL8'dada0000beeebaaa'
+	   * which should parse out to X_op == O_big
+	   * Note that floats and doubles get represented as
+	   * 0d3.14159265358979  or 0f 2.7
+	   */
+	  tmp[0] = '0';
+	  tmp[1] = name[0];
+	  tmp[2] = 0;
+	  strcat (tmp, input_line_pointer);
+	  save = input_line_pointer;
+	  input_line_pointer = tmp;
+	  expression (exp);
+	  input_line_pointer = save + (input_line_pointer-tmp-2);
+
+	  /* fix up lengths for floats and doubles */
+	  if (O_big == exp->X_op)
+	    {
+	      exp->X_add_number = cons_len / CHARS_PER_LITTLENUM;
+	    }
+	}
+      else
+	{
+	  expression (exp);
+	}
+      /* O_big occurs when more than 4 bytes worth gets parsed */
+      if ((exp->X_op != O_constant) && (exp->X_op != O_big))
+	{
+	  as_bad ("expression not a constant");
+	  return false;
+	}
+      add_to_lit_pool (exp, 0x0, cons_len);
+      break;
+
+    default:
+      as_bad ("Unknown/unsupported address literal type");
+      return false;
+    }
+
+  return true;
+}
+
+
+/* Dump the contents of the literal pool that we've accumulated so far.
+ * This aligns the pool to the size of the largest literal in the pool.
+ */
+
+static void
+i370_ltorg (ignore)
+     int ignore;
+{
+  int litsize;
+  int lit_count = 0;
+  int biggest_literal_size = 0;
+  int biggest_align = 0;
+  char pool_name[20];
+
+  if (strncmp (now_seg->name, ".text", 5))
+    {
+      if (i370_other_section == undefined_section)
+        {
+          as_bad (".ltorg without prior .using in section %s",
+		  now_seg->name);
+        }
+      if (i370_other_section != now_seg)
+        {
+	  as_bad (".ltorg in section %s paired to .using in section %s",
+		  now_seg->name, i370_other_section->name);
+        }
+    }
+  if (! longlong_poolP
+      && ! word_poolP
+      && ! short_poolP
+      && ! byte_poolP)
+    {
+      /* Nothing to do */
+      /* as_tsktsk ("Nothing to put in the pool\n"); */
+      return;
+    }
+
+  /* find largest literal .. 2 4 or 8 */
+  lit_count = 0;
+  while (lit_count < next_literal_pool_place)
+    {
+      if (biggest_literal_size < literals[lit_count].size)
+	biggest_literal_size = literals[lit_count].size;
+      lit_count ++;
+    }
+  if (1 == biggest_literal_size) biggest_align = 0;
+  else if (2 == biggest_literal_size) biggest_align = 1;
+  else if (4 == biggest_literal_size) biggest_align = 2;
+  else if (8 == biggest_literal_size) biggest_align = 3;
+  else as_bad ("bad alignment of %d bytes in literal pool", biggest_literal_size);
+  if (0 == biggest_align) biggest_align = 1;
+
+
+  /* Align pool for short, word, double word accesses */
+  frag_align (biggest_align, 0, 0);
+  record_alignment (now_seg, biggest_align);
+
+  /* Note that the gas listing will print only the first five
+   * entries in the pool .... wonder how to make it print more ...
+   */
+  /* output largest literals first, then the smaller ones. */
+  for (litsize=8; litsize; litsize /=2)
+    {
+      symbolS *current_poolP = NULL;
+      switch (litsize)
+	{
+	case 8:
+	  current_poolP = longlong_poolP; break;
+	case 4:
+	  current_poolP = word_poolP; break;
+	case 2:
+	  current_poolP = short_poolP; break;
+	case 1:
+	  current_poolP = byte_poolP; break;
+	default:
+	  as_bad ("bad literal size\n");
+	}
+      if (NULL == current_poolP)
+	continue;
+      sprintf (pool_name, ".LITP%01d%06d", litsize, lit_pool_num);
+      symbol_locate (current_poolP, pool_name, now_seg,
+		     (valueT) frag_now_fix (), frag_now);
+      symbol_table_insert (current_poolP);
+
+      lit_count = 0;
+      while (lit_count < next_literal_pool_place)
+	{
+	  if (litsize == literals[lit_count].size)
+	    {
+#define EMIT_ADDR_CONS_SYMBOLS
+#ifdef EMIT_ADDR_CONS_SYMBOLS
+	      /* create a bogus symbol, add it to the pool ...
+	       * For the most part, I think this is a useless excercise,
+	       * except that having these symbol names in the objects
+	       * is vaguely useful for debugging ...
+	       */
+	      if (literals[lit_count].sym_name)
+		{
+		  symbolS * symP = symbol_make_empty();
+		  symbol_locate (symP, literals[lit_count].sym_name, now_seg,
+				 (valueT) frag_now_fix (), frag_now);
+		  symbol_table_insert (symP);
+		}
+#endif /* EMIT_ADDR_CONS_SYMBOLS */
+
+	      emit_expr (&(literals[lit_count].exp), literals[lit_count].size);
+	    }
+	  lit_count ++;
+	}
+    }
+
+  next_literal_pool_place = 0;
+  longlong_poolP = NULL;
+  word_poolP = NULL;
+  short_poolP = NULL;
+  byte_poolP = NULL;
+  lit_pool_num++;
+}
+
+#endif /* LITERAL_POOL_SUPPORT */
+
+
+/* add support for the HLASM-like USING directive to indicate
+ * the base register to use ...  we don't support the full
+ * hlasm semantics for this ... we merely pluck a base address
+ * and a register number out.  We print a warning if using is
+ * called multiple times.  I suppose we should check to see
+ * if the regno is valid ...
+ */
+static void
+i370_using (ignore)
+     int ignore;
+{
+  expressionS ex, baseaddr;
+  int iregno;
+  char *star;
+
+  /* if "*" appears in a using, it means "."  */
+  /* replace it with "." so that expr doesn't get confused. */
+  star = strchr (input_line_pointer, '*');
+  if (star)
+    *star = '.';
+
+  /* the first arg to using will usually be ".", but it can
+   * be a more complex exprsssion too ... */
+  expression (&baseaddr);
+  if (star)
+    *star = '*';
+  if (O_constant != baseaddr.X_op
+      && O_symbol != baseaddr.X_op
+      && O_uminus != baseaddr.X_op)
+  {
+    as_bad (".using: base address expression illegal or too complex");
+  }
+
+  if (*input_line_pointer != '\0') ++input_line_pointer;
+
+  /* the second arg to using had better be a register */
+  register_name (&ex);
+  demand_empty_rest_of_line ();
+  iregno = ex.X_add_number;
+
+  if (0 == strncmp (now_seg->name, ".text", 5))
+    {
+      i370_using_text_baseaddr = baseaddr;
+      i370_using_text_regno = iregno;
+    }
+  else
+    {
+      i370_using_other_baseaddr = baseaddr;
+      i370_using_other_regno = iregno;
+      i370_other_section = now_seg;
+    }
+}
+
+static void
+i370_drop (ignore)
+     int ignore;
+{
+  expressionS ex;
+  int iregno;
+
+  register_name (&ex);
+  demand_empty_rest_of_line ();
+  iregno = ex.X_add_number;
+
+  if (0 == strncmp (now_seg->name, ".text", 5))
+    {
+      if (iregno != i370_using_text_regno)
+        {
+          as_bad ("droping register %d in section %s does not match using register %d",
+		  iregno, now_seg->name, i370_using_text_regno);
+        }
+      i370_using_text_regno = -1;
+      i370_using_text_baseaddr.X_op = O_absent;
+    }
+  else
+    {
+      if (iregno != i370_using_other_regno)
+        {
+          as_bad ("droping register %d in section %s does not match using register %d",
+		  iregno, now_seg->name, i370_using_other_regno);
+        }
+      if (i370_other_section != now_seg)
+        {
+          as_bad ("droping register %d in section %s previously used in section %s",
+		  iregno, now_seg->name, i370_other_section->name);
+        }
+      i370_using_other_regno = -1;
+      i370_using_other_baseaddr.X_op = O_absent;
+      i370_other_section = undefined_section;
+    }
+}
+
+/* Make the first argument an address-relative expression
+ * by subtracting the second argument.
+ */
+static void
+i370_make_relative (expressionS *exx, expressionS *baseaddr)
+{
+
+  if (O_constant == baseaddr->X_op)
+    {
+       exx->X_op = O_symbol;
+       exx->X_add_number -= baseaddr->X_add_number;
+    }
+  else if (O_symbol == baseaddr->X_op)
+    {
+       exx->X_op = O_subtract;
+       exx->X_op_symbol = baseaddr->X_add_symbol;
+       exx->X_add_number -= baseaddr->X_add_number;
+    }
+  else if (O_uminus == baseaddr->X_op)
+    {
+       exx->X_op = O_add;
+       exx->X_op_symbol = baseaddr->X_add_symbol;
+       exx->X_add_number += baseaddr->X_add_number;
+     }
+  else
+     {
+       as_bad ("Missing or bad .using directive");
+     }
+}
+
+/* We need to keep a list of fixups.  We can't simply generate them as
+   we go, because that would require us to first create the frag, and
+   that would screw up references to ``.''.  */
+
+struct i370_fixup
+{
+  expressionS exp;
+  int opindex;
+  bfd_reloc_code_real_type reloc;
+};
+
+#define MAX_INSN_FIXUPS (5)
+
+/* This routine is called for each instruction to be assembled.  */
+
+void
+md_assemble (str)
+     char *str;
+{
+  char *s, *opcode_str;
+  const struct i370_opcode *opcode;
+  i370_insn_t insn;
+  const unsigned char *opindex_ptr;
+  int have_optional_index, have_optional_basereg, have_optional_reg;
+  int skip_optional_index, skip_optional_basereg, skip_optional_reg;
+  int use_text=0, use_other=0;
+  int off_by_one;
+  struct i370_fixup fixups[MAX_INSN_FIXUPS];
+  int fc;
+  char *f;
+  int i;
+#ifdef OBJ_ELF
+  bfd_reloc_code_real_type reloc;
+#endif
+
+  /* Get the opcode.  */
+  for (s = str; *s != '\0' && ! isspace (*s); s++)
+    ;
+  if (*s != '\0')
+    *s++ = '\0';
+  opcode_str = str;
+
+  /* Look up the opcode in the hash table.  */
+  opcode = (const struct i370_opcode *) hash_find (i370_hash, str);
+  if (opcode == (const struct i370_opcode *) NULL)
+    {
+      const struct i370_macro *macro;
+
+      assert (i370_macro_hash);
+      macro = (const struct i370_macro *) hash_find (i370_macro_hash, str);
+      if (macro == (const struct i370_macro *) NULL)
+        as_bad ("Unrecognized opcode: `%s'", str);
+      else
+	i370_macro (s, macro);
+
+      return;
+    }
+
+  insn = opcode->opcode;
+
+  str = s;
+  while (isspace (*str))
+    ++str;
+
+  /* I370 operands are either expressions or address constants.
+     Many operand types are optional.  The optional operands
+     are always surrounded by parens, and are used to denote the base
+     register ... e.g. "A R1, D2" or "A R1, D2(,B2) as opposed to
+     the fully-formed "A R1, D2(X2,B2)".  Note also the = sign,
+     such as A R1,=A(i) where the address-of operator =A implies
+     use of both a base register, and a missing index register.
+
+     So, before we start seriously parsing the operands, we check
+     to see if we have an optional operand, and, if we do, we count
+     the number of commas to see which operand should be omitted.  */
+
+  have_optional_index = have_optional_basereg = have_optional_reg = 0;
+  for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++)
+    {
+      const struct i370_operand *operand;
+      operand = &i370_operands[*opindex_ptr];
+      if ((operand->flags & I370_OPERAND_INDEX) != 0)
+	have_optional_index = 1;
+      if ((operand->flags & I370_OPERAND_BASE) != 0)
+	have_optional_basereg = 1;
+      if ((operand->flags & I370_OPERAND_OPTIONAL) != 0)
+	have_optional_reg = 1;
+    }
+
+  skip_optional_index = skip_optional_basereg = skip_optional_reg = 0;
+  if (have_optional_index || have_optional_basereg)
+    {
+      unsigned int opcount, nwanted;
+
+      /* There is an optional operand.  Count the number of
+	 commas and open-parens in the input line.  */
+      if (*str == '\0')
+	opcount = 0;
+      else
+	{
+	  opcount = 1;
+	  s = str;
+	  while ((s = strpbrk (s, ",(=")) != (char *) NULL)
+	    {
+	      ++opcount;
+	      ++s;
+	      if (',' == *s) ++s;  /* avoid counting things like (, */
+	      if ('=' == *s) { ++s; --opcount; }
+	    }
+	}
+
+      /* If there are fewer operands in the line then are called
+	 for by the instruction, we want to skip the optional
+	 operand.  */
+      nwanted = strlen (opcode->operands);
+      if (have_optional_index)
+	{
+	  if (opcount < nwanted)
+	    skip_optional_index = 1;
+	  if (have_optional_basereg && ((opcount+1) < nwanted))
+	    skip_optional_basereg = 1;
+	  if (have_optional_reg && ((opcount+1) < nwanted))
+	    skip_optional_reg = 1;
+	}
+      else
+	{
+	  if (have_optional_basereg && (opcount < nwanted))
+	    skip_optional_basereg = 1;
+	  if (have_optional_reg && (opcount < nwanted))
+	    skip_optional_reg = 1;
+	}
+    }
+
+  /* Perform some off-by-one hacks on the length field of certain instructions.
+   * Its such a shame to have to do this, but the problem is that HLASM got
+   * defined so that the lengths differ by one from the actual machine instructions.
+   * this code should probably be moved to a special inster-operand routine.
+   * Sigh. Affected instructions are Compare Logical, Move and Exclusive OR
+   * hack alert -- aren't *all* SS instructions affected ??
+   */
+  off_by_one = 0;
+  if (0 == strcasecmp ("CLC", opcode->name)
+      || 0 == strcasecmp ("ED", opcode->name)
+      || 0 == strcasecmp ("EDMK", opcode->name)
+      || 0 == strcasecmp ("MVC", opcode->name)
+      || 0 == strcasecmp ("MVCIN", opcode->name)
+      || 0 == strcasecmp ("MVN", opcode->name)
+      || 0 == strcasecmp ("MVZ", opcode->name)
+      || 0 == strcasecmp ("NC", opcode->name)
+      || 0 == strcasecmp ("OC", opcode->name)
+      || 0 == strcasecmp ("XC", opcode->name))
+    off_by_one = 1;
+
+  /* Gather the operands.  */
+  fc = 0;
+  for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++)
+    {
+      const struct i370_operand *operand;
+      const char *errmsg;
+      char *hold;
+      expressionS ex;
+
+      operand = &i370_operands[*opindex_ptr];
+      errmsg = NULL;
+
+      /* If this is an index operand, and we are skipping it,
+	 just insert a zero.  */
+      if (skip_optional_index &&
+	  ((operand->flags & I370_OPERAND_INDEX) != 0))
+        {
+          insn = i370_insert_operand (insn, operand, 0);
+          continue;
+        }
+
+      /* If this is the base operand, and we are skipping it,
+	 just insert the current using basreg.  */
+      if (skip_optional_basereg &&
+          ((operand->flags & I370_OPERAND_BASE) != 0))
+        {
+          int basereg = -1;
+          if (use_text)
+            {
+              if (0 == strncmp (now_seg->name, ".text", 5)
+		  || 0 > i370_using_other_regno)
+                {
+                  basereg = i370_using_text_regno;
+                }
+              else
+                {
+                  basereg = i370_using_other_regno;
+                }
+            }
+          else if (use_other)
+            {
+              if (0 > i370_using_other_regno)
+                {
+                  basereg = i370_using_text_regno;
+                }
+              else
+                {
+                  basereg = i370_using_other_regno;
+                }
+            }
+          if (0 > basereg)
+            {
+              as_bad ("not using any base register");
+            }
+          insn = i370_insert_operand (insn, operand, basereg);
+          continue;
+        }
+
+      /* If this is an optional operand, and we are skipping it,
+	 Use zero (since a non-zero value would denote a register)  */
+      if (skip_optional_reg
+	  && ((operand->flags & I370_OPERAND_OPTIONAL) != 0))
+        {
+          insn = i370_insert_operand (insn, operand, 0);
+          continue;
+        }
+
+      /* Gather the operand.  */
+      hold = input_line_pointer;
+      input_line_pointer = str;
+
+      /* register names are only allowed where there are registers ... */
+      if ((operand->flags & I370_OPERAND_GPR) != 0)
+        {
+          /* quickie hack to get past things like (,r13) */
+          if (skip_optional_index && (',' == *input_line_pointer))
+            {
+              *input_line_pointer = ' ';
+              input_line_pointer ++;
+            }
+          if (! register_name (&ex))
+            {
+              as_bad ("expecting a register for operand %d",
+		      opindex_ptr - opcode->operands + 1);
+            }
+        }
+
+      /* check for a address constant expression */
+      /* We will put PSW-relative addresses in the text section,
+       * and adress literals in the .data (or other) section. */
+      else if (i370_addr_cons (&ex))
+	use_other=1;
+      else if (i370_addr_offset (&ex))
+	use_text=1;
+      else expression (&ex);
+
+      str = input_line_pointer;
+      input_line_pointer = hold;
+
+      /* perform some off-by-one hacks on the length field of certain instructions.
+       * Its such a shame to have to do this, but the problem is that HLASM got
+       * defined so that the programmer specifies a length that is one greater
+       * than what the machine instruction wants.
+       * Sigh.
+       */
+      if (off_by_one && (0 == strcasecmp ("SS L", operand->name)))
+	{
+	  ex.X_add_number --;
+	}
+
+      if (ex.X_op == O_illegal)
+        as_bad ("illegal operand");
+      else if (ex.X_op == O_absent)
+        as_bad ("missing operand");
+      else if (ex.X_op == O_register)
+        {
+          insn = i370_insert_operand (insn, operand, ex.X_add_number);
+        }
+      else if (ex.X_op == O_constant)
+        {
+#ifdef OBJ_ELF
+          /* Allow @HA, @L, @H on constants.
+           * Well actually, no we don't; there really don't make sense
+           * (at least not to me) for the i370.  However, this code is
+           * left here for any dubious future expansion reasons ... */
+          char *orig_str = str;
+
+          if ((reloc = i370_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED)
+            switch (reloc)
+              {
+              default:
+        	str = orig_str;
+        	break;
+
+              case BFD_RELOC_LO16:
+        	/* X_unsigned is the default, so if the user has done
+                   something which cleared it, we always produce a
+                   signed value.  */
+		ex.X_add_number = (((ex.X_add_number & 0xffff)
+				    ^ 0x8000)
+				   - 0x8000);
+        	break;
+
+              case BFD_RELOC_HI16:
+        	ex.X_add_number = (ex.X_add_number >> 16) & 0xffff;
+        	break;
+
+              case BFD_RELOC_HI16_S:
+        	ex.X_add_number = (((ex.X_add_number >> 16) & 0xffff)
+        			   + ((ex.X_add_number >> 15) & 1));
+        	break;
+              }
+#endif
+          insn = i370_insert_operand (insn, operand, ex.X_add_number);
+        }
+#ifdef OBJ_ELF
+      else if ((reloc = i370_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED)
+        {
+          as_tsktsk ("md_assemble(): suffixed relocations not supported\n");
+
+          /* We need to generate a fixup for this expression.  */
+          if (fc >= MAX_INSN_FIXUPS)
+            as_fatal ("too many fixups");
+          fixups[fc].exp = ex;
+          fixups[fc].opindex = 0;
+          fixups[fc].reloc = reloc;
+          ++fc;
+        }
+#endif /* OBJ_ELF */
+
+      else
+        {
+          /* We need to generate a fixup for this expression.  */
+          /* Typically, the expression will just be a symbol ...
+           * printf ("insn %s needs fixup for %s \n",
+           *        opcode->name, ex.X_add_symbol->bsym->name);
+           */
+
+          if (fc >= MAX_INSN_FIXUPS)
+            as_fatal ("too many fixups");
+          fixups[fc].exp = ex;
+          fixups[fc].opindex = *opindex_ptr;
+          fixups[fc].reloc = BFD_RELOC_UNUSED;
+          ++fc;
+        }
+
+      /* skip over delimiter (close paren, or comma) */
+      if ((')' == *str) && (',' == *(str+1)))
+	++str;
+      if (*str != '\0')
+	++str;
+    }
+
+  while (isspace (*str))
+    ++str;
+
+  if (*str != '\0')
+    as_bad ("junk at end of line: `%s'", str);
+
+  /* Write out the instruction.  */
+  f = frag_more (opcode->len);
+  if (4 >= opcode->len)
+    {
+      md_number_to_chars (f, insn.i[0], opcode->len);
+    }
+  else
+    {
+      md_number_to_chars (f, insn.i[0], 4);
+      if (6 == opcode->len)
+	{
+	  md_number_to_chars ((f+4), ((insn.i[1])>>16), 2);
+	}
+      else
+	{
+	  /* not used --- don't have any 8 byte instructions */
+	  as_bad ("Internal Error: bad instruction length");
+	  md_number_to_chars ((f+4), insn.i[1], opcode->len -4);
+	}
+    }
+
+  /* Create any fixups.  At this point we do not use a
+     bfd_reloc_code_real_type, but instead just use the
+     BFD_RELOC_UNUSED plus the operand index.  This lets us easily
+     handle fixups for any operand type, although that is admittedly
+     not a very exciting feature.  We pick a BFD reloc type in
+     md_apply_fix.  */
+  for (i = 0; i < fc; i++)
+    {
+      const struct i370_operand *operand;
+
+      operand = &i370_operands[fixups[i].opindex];
+      if (fixups[i].reloc != BFD_RELOC_UNUSED)
+	{
+	  reloc_howto_type *reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
+	  int size;
+	  fixS *fixP;
+
+	  if (!reloc_howto)
+	    abort ();
+
+	  size = bfd_get_reloc_size (reloc_howto);
+
+	  if (size < 1 || size > 4)
+	    abort();
+
+	  printf (" gwana doo fixup %d \n", i);
+	  fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
+         		      &fixups[i].exp, reloc_howto->pc_relative,
+         		      fixups[i].reloc);
+
+	  /* Turn off complaints that the addend is too large for things like
+	     foo+100000@ha.  */
+	  switch (fixups[i].reloc)
+	    {
+	    case BFD_RELOC_16_GOTOFF:
+	    case BFD_RELOC_LO16:
+	    case BFD_RELOC_HI16:
+	    case BFD_RELOC_HI16_S:
+	      fixP->fx_no_overflow = 1;
+	      break;
+	    default:
+	      break;
+	    }
+	}
+      else
+	{
+	  fix_new_exp (frag_now, f - frag_now->fr_literal, opcode->len,
+		       &fixups[i].exp,
+		       (operand->flags & I370_OPERAND_RELATIVE) != 0,
+		       ((bfd_reloc_code_real_type)
+			(fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
+	}
+    }
+}
+
+/* Handle a macro.  Gather all the operands, transform them as
+   described by the macro, and call md_assemble recursively.  All the
+   operands are separated by commas; we don't accept parentheses
+   around operands here.  */
+
+static void
+i370_macro (str, macro)
+     char *str;
+     const struct i370_macro *macro;
+{
+  char *operands[10];
+  unsigned int count;
+  char *s;
+  unsigned int len;
+  const char *format;
+  int arg;
+  char *send;
+  char *complete;
+
+  /* Gather the users operands into the operands array.  */
+  count = 0;
+  s = str;
+  while (1)
+    {
+      if (count >= sizeof operands / sizeof operands[0])
+        break;
+      operands[count++] = s;
+      s = strchr (s, ',');
+      if (s == (char *) NULL)
+        break;
+      *s++ = '\0';
+    }
+
+  if (count != macro->operands)
+    {
+      as_bad ("wrong number of operands");
+      return;
+    }
+
+  /* Work out how large the string must be (the size is unbounded
+     because it includes user input).  */
+  len = 0;
+  format = macro->format;
+  while (*format != '\0')
+    {
+      if (*format != '%')
+        {
+          ++len;
+          ++format;
+        }
+      else
+        {
+          arg = strtol (format + 1, &send, 10);
+          know (send != format && arg >= 0 && arg < count);
+          len += strlen (operands[arg]);
+          format = send;
+        }
+    }
+
+  /* Put the string together.  */
+  complete = s = (char *) alloca (len + 1);
+  format = macro->format;
+  while (*format != '\0')
+    {
+      if (*format != '%')
+        *s++ = *format++;
+      else
+        {
+          arg = strtol (format + 1, &send, 10);
+          strcpy (s, operands[arg]);
+          s += strlen (s);
+          format = send;
+        }
+    }
+  *s = '\0';
+
+  /* Assemble the constructed instruction.  */
+  md_assemble (complete);
+}
+
+#ifdef OBJ_ELF
+/* For ELF, add support for SHF_EXCLUDE and SHT_ORDERED */
+
+int
+i370_section_letter (letter, ptr_msg)
+     int letter;
+     char **ptr_msg;
+{
+  if (letter == 'e')
+    return SHF_EXCLUDE;
+
+  *ptr_msg = "Bad .section directive: want a,w,x,e in string";
+  return 0;
+}
+
+int
+i370_section_word (str, len)
+    char *str;
+    size_t len;
+{
+  if (len == 7 && strncmp (str, "exclude", 7) == 0)
+    return SHF_EXCLUDE;
+
+  return -1;
+}
+
+int
+i370_section_type (str, len)
+    char *str;
+    size_t len;
+{
+  if (len == 7 && strncmp (str, "ordered", 7) == 0)
+     return SHT_ORDERED;
+
+  return -1;
+}
+
+int
+i370_section_flags (flags, attr, type)
+     int flags;
+     int attr;
+     int type;
+{
+  if (type == SHT_ORDERED)
+    flags |= SEC_ALLOC | SEC_LOAD | SEC_SORT_ENTRIES;
+
+  if (attr & SHF_EXCLUDE)
+    flags |= SEC_EXCLUDE;
+
+  return flags;
+}
+#endif /* OBJ_ELF */
+
+
+/* Pseudo-op handling.  */
+
+/* The .byte pseudo-op.  This is similar to the normal .byte
+   pseudo-op, but it can also take a single ASCII string.  */
+
+static void
+i370_byte (ignore)
+     int ignore;
+{
+  if (*input_line_pointer != '\"')
+    {
+      cons (1);
+      return;
+    }
+
+  /* Gather characters.  A real double quote is doubled.  Unusual
+     characters are not permitted.  */
+  ++input_line_pointer;
+  while (1)
+    {
+      char c;
+
+      c = *input_line_pointer++;
+
+      if (c == '\"')
+        {
+        if (*input_line_pointer != '\"')
+            break;
+          ++input_line_pointer;
+        }
+
+      FRAG_APPEND_1_CHAR (c);
+    }
+
+  demand_empty_rest_of_line ();
+}
+
+/* The .tc pseudo-op.  This is used when generating XCOFF and ELF.
+   This takes two or more arguments.
+
+   When generating XCOFF output, the first argument is the name to
+   give to this location in the toc; this will be a symbol with class
+   TC.  The rest of the arguments are 4 byte values to actually put at
+   this location in the TOC; often there is just one more argument, a
+   relocateable symbol reference.
+
+   When not generating XCOFF output, the arguments are the same, but
+   the first argument is simply ignored.  */
+
+static void
+i370_tc (ignore)
+     int ignore;
+{
+
+  /* Skip the TOC symbol name.  */
+  while (is_part_of_name (*input_line_pointer)
+         || *input_line_pointer == '['
+         || *input_line_pointer == ']'
+         || *input_line_pointer == '{'
+         || *input_line_pointer == '}')
+    ++input_line_pointer;
+
+  /* Align to a four byte boundary.  */
+  frag_align (2, 0, 0);
+  record_alignment (now_seg, 2);
+
+  if (*input_line_pointer != ',')
+    demand_empty_rest_of_line ();
+  else
+    {
+      ++input_line_pointer;
+      cons (4);
+    }
+}
+
+/* Turn a string in input_line_pointer into a floating point constant
+   of type type, and store the appropriate bytes in *litp.  The number
+   of LITTLENUMS emitted is stored in *sizep .  An error message is
+   returned, or NULL on OK.  */
+
+char *
+md_atof (type, litp, sizep)
+     int type;
+     char *litp;
+     int *sizep;
+{
+  int prec;
+  LITTLENUM_TYPE words[4];
+  char *t;
+  int i;
+
+  switch (type)
+    {
+    case 'f':
+    case 'E':
+      type = 'f';
+      prec = 2;
+      break;
+
+    case 'd':
+    case 'D':
+      type = 'd';
+      prec = 4;
+      break;
+
+    default:
+      *sizep = 0;
+      return "bad call to md_atof";
+    }
+
+  /* 360/370/390 have two float formats: an old, funky 360 single-precision
+   * format, and the ieee format.  Support only the ieee format. */
+  t = atof_ieee (input_line_pointer, type, words);
+  if (t)
+    input_line_pointer = t;
+
+  *sizep = prec * 2;
+
+  for (i = 0; i < prec; i++)
+    {
+      md_number_to_chars (litp, (valueT) words[i], 2);
+      litp += 2;
+    }
+
+  return NULL;
+}
+
+/* Write a value out to the object file, using the appropriate
+   endianness.  */
+
+void
+md_number_to_chars (buf, val, n)
+     char *buf;
+     valueT val;
+     int n;
+{
+    number_to_chars_bigendian (buf, val, n);
+}
+
+/* Align a section (I don't know why this is machine dependent).  */
+
+valueT
+md_section_align (seg, addr)
+     asection *seg;
+     valueT addr;
+{
+  int align = bfd_get_section_alignment (stdoutput, seg);
+
+  return (addr + (1 << align) - 1) & (-1 << align);
+}
+
+/* We don't have any form of relaxing.  */
+
+int
+md_estimate_size_before_relax (fragp, seg)
+     fragS *fragp;
+     asection *seg;
+{
+  abort ();
+  return 0;
+}
+
+/* Convert a machine dependent frag.  We never generate these.  */
+
+void
+md_convert_frag (abfd, sec, fragp)
+     bfd *abfd;
+     asection *sec;
+     fragS *fragp;
+{
+  abort ();
+}
+
+/* We have no need to default values of symbols.  */
+
+/*ARGSUSED*/
+symbolS *
+md_undefined_symbol (name)
+     char *name;
+{
+  return 0;
+}
+
+/* Functions concerning relocs.  */
+
+/* The location from which a PC relative jump should be calculated,
+   given a PC relative reloc.  */
+
+long
+md_pcrel_from_section (fixp, sec)
+     fixS *fixp;
+     segT sec;
+{
+  return fixp->fx_frag->fr_address + fixp->fx_where;
+}
+
+
+/* Apply a fixup to the object code.  This is called for all the
+   fixups we generated by the call to fix_new_exp, above.  In the call
+   above we used a reloc code which was the largest legal reloc code
+   plus the operand index.  Here we undo that to recover the operand
+   index.  At this point all symbol values should be fully resolved,
+   and we attempt to completely resolve the reloc.  If we can not do
+   that, we determine the correct reloc code and put it back in the
+   fixup.
+
+   See gas/cgen.c for more sample code and explanations of what's
+   going on here ...
+*/
+
+int
+md_apply_fix3 (fixp, valuep, seg)
+     fixS *fixp;
+     valueT *valuep;
+     segT seg;
+{
+  valueT value;
+
+  value = *valuep;
+  if (fixp->fx_addsy != NULL)
+    {
+      /* Notes:
+         Branches to labels will come in here with fixp->fx_pcrel set to 1
+         and fixp->fx_subsy not null, and holding the value of the base
+         (i.e. the value of the .using). These we want to ignore.
+
+         'Strong' and 'weak' symbols will come in here with
+         fixp->fx_pcrel==0, fixp->fx_addsy defined, and
+         *valuep holding the value of the symbol.
+
+         'Strong' symbols will have S_GET_VALUE(fx_addsy) equal to zero,
+         whereas 'weak' symbols will have S_GET_VALUE(fx_addsy) set to the
+         symbol value (usually).
+
+         We want to subtract S_GET_VALUE(fx_addsy) if it set, and
+         for all practical purposes, do a fixup with value zero.  This
+         is because the linker/loader, at a later time, will do this
+         fixup with the correct value. If we fixup now with a value,
+         it will get double-fixed, leading to garbage.
+
+         Note that subsy will also be set for strong/weak symbols
+         when the user program was compiled with -g.  In that case,
+         subsy will hold the base address (i.e. the .using address).
+      */
+
+      if (fixp->fx_addsy->sy_used_in_reloc
+          && S_GET_SEGMENT (fixp->fx_addsy) != absolute_section
+          && S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
+          && ! bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy)))
+        value -= S_GET_VALUE (fixp->fx_addsy);
+
+#ifdef DEBUG
+      printf ("\nmd_apply_fix3: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
+	      S_GET_NAME (fixp->fx_addsy),
+	      fixp->fx_frag->fr_address + fixp->fx_where,
+	      fixp->fx_file, fixp->fx_line,
+	      S_GET_VALUE (fixp->fx_addsy), value);
+#endif
+    }
+  else
+    {
+      fixp->fx_done = 1;
+      return 1;
+    }
+
+  /* Apply fixups to operands.  Note that there should be no relocations
+     for any operands, since no instruction ever takes an operand
+     that requires reloc.  */
+  if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+    {
+      int opindex;
+      const struct i370_operand *operand;
+      char *where;
+      i370_insn_t insn;
+
+      opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+
+      operand = &i370_operands[opindex];
+
+#ifdef DEBUG
+      printf ("\nmd_apply_fix3: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
+	      operand->name,
+	      fixp->fx_frag->fr_address + fixp->fx_where,
+	      fixp->fx_file, fixp->fx_line,
+	      value);
+#endif
+      /* Fetch the instruction, insert the fully resolved operand
+         value, and stuff the instruction back again.
+         fisxp->fx_size is the length of the instruction. */
+      where = fixp->fx_frag->fr_literal + fixp->fx_where;
+      insn.i[0] = bfd_getb32 ((unsigned char *) where);
+      if (6 <= fixp->fx_size)
+	{    /* deal with 48-bit insn's */
+	  insn.i[1] = bfd_getb32 (((unsigned char *) where)+4);
+	}
+      insn = i370_insert_operand (insn, operand, (offsetT) value);
+      bfd_putb32 ((bfd_vma) insn.i[0], (unsigned char *) where);
+      if (6 <= fixp->fx_size)
+	{   /* deal with 48-bit insn's */
+	  bfd_putb32 ((bfd_vma) insn.i[1], (((unsigned char *) where)+4));
+	}
+
+      /* we are done, right? right !! */
+      fixp->fx_done = 1;
+      if (fixp->fx_done)
+        {
+          /* Nothing else to do here.  */
+          return 1;
+        }
+
+      /* Determine a BFD reloc value based on the operand information.
+	 We are only prepared to turn a few of the operands into
+	 relocs.  In fact, we support *zero* operand relocations ...
+	 Why?  Because we are not expecting the compiler to generate
+	 any operands that need relocation.  Due to the 12-bit naturew of
+	 i370 addressing, this would be unusual. */
+#if 0
+      if ((operand->flags & I370_OPERAND_RELATIVE) != 0
+          && operand->bits == 12
+          && operand->shift == 0)
+        fixp->fx_r_type = BFD_RELOC_I370_D12;
+      else
+#endif
+        {
+          char *sfile;
+          unsigned int sline;
+
+          /* Use expr_symbol_where to see if this is an expression
+             symbol.  */
+          if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
+            as_bad_where (fixp->fx_file, fixp->fx_line,
+        		  "unresolved expression that must be resolved");
+          else
+            as_bad_where (fixp->fx_file, fixp->fx_line,
+        		  "unsupported relocation type");
+          fixp->fx_done = 1;
+          return 1;
+        }
+    }
+  else
+    {
+      /* We branch to here if the fixup is not to a symbol that
+       * appears in an instruction operand, but is rather some
+       * declared storage.
+       */
+#ifdef OBJ_ELF
+      i370_elf_validate_fix (fixp, seg);
+#endif
+#ifdef DEBUG
+      printf ("md_apply_fix3: reloc case %d in segment  %s %s:%d\n",
+	      fixp->fx_r_type, segment_name (seg), fixp->fx_file, fixp->fx_line);
+      printf ("\tcurrent fixup value is 0x%x \n", value);
+#endif
+      switch (fixp->fx_r_type)
+        {
+        case BFD_RELOC_32:
+        case BFD_RELOC_CTOR:
+          if (fixp->fx_pcrel)
+            fixp->fx_r_type = BFD_RELOC_32_PCREL;
+	  /* fall through */
+
+        case BFD_RELOC_RVA:
+        case BFD_RELOC_32_PCREL:
+        case BFD_RELOC_32_BASEREL:
+#ifdef DEBUG
+          printf ("\t32 bit relocation at 0x%x\n",
+		  fixp->fx_frag->fr_address + fixp->fx_where);
+#endif
+          md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+        		      value, 4);
+          break;
+
+        case BFD_RELOC_LO16:
+        case BFD_RELOC_16:
+          if (fixp->fx_pcrel)
+            as_bad_where (fixp->fx_file, fixp->fx_line,
+        		  "cannot emit PC relative %s relocation%s%s",
+        		  bfd_get_reloc_code_name (fixp->fx_r_type),
+        		  fixp->fx_addsy != NULL ? " against " : "",
+        		  (fixp->fx_addsy != NULL
+        		   ? S_GET_NAME (fixp->fx_addsy)
+        		   : ""));
+
+          md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+        		      value, 2);
+          break;
+
+          /* This case happens when you write, for example,
+             lis %r3,(L1-L2)@ha
+             where L1 and L2 are defined later.  */
+        case BFD_RELOC_HI16:
+          if (fixp->fx_pcrel)
+            abort ();
+          md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+        		      value >> 16, 2);
+          break;
+        case BFD_RELOC_HI16_S:
+          if (fixp->fx_pcrel)
+            abort ();
+          md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+        		      (value + 0x8000) >> 16, 2);
+          break;
+
+        case BFD_RELOC_8:
+          if (fixp->fx_pcrel)
+            abort ();
+
+          md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+        		      value, 1);
+          break;
+
+        default:
+          fprintf(stderr,
+        	  "Gas failure, reloc value %d\n", fixp->fx_r_type);
+          fflush(stderr);
+          abort ();
+        }
+    }
+
+  fixp->fx_addnumber = value;
+
+  return 1;
+}
+
+/* Generate a reloc for a fixup.  */
+
+arelent *
+tc_gen_reloc (seg, fixp)
+     asection *seg;
+     fixS *fixp;
+{
+  arelent *reloc;
+
+  reloc = (arelent *) xmalloc (sizeof (arelent));
+
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+  reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+  reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
+  if (reloc->howto == (reloc_howto_type *) NULL)
+    {
+      as_bad_where (fixp->fx_file, fixp->fx_line,
+        	    "reloc %d not supported by object file format", (int)fixp->fx_r_type);
+      return NULL;
+    }
+  reloc->addend = fixp->fx_addnumber;
+
+#ifdef DEBUG
+  printf ("\ngen_reloc(): sym %s (%s:%d) at addr 0x%x addend=0x%x\n",
+	  fixp->fx_addsy->bsym->name,
+	  fixp->fx_file, fixp->fx_line,
+	  reloc->address, reloc->addend);
+#endif
+
+  return reloc;
+}
diff --git a/gas/config/tc-i370.h b/gas/config/tc-i370.h
new file mode 100644
index 0000000..8f32fa8
--- /dev/null
+++ b/gas/config/tc-i370.h
@@ -0,0 +1,104 @@
+/* tc-i370.h -- Header file for tc-i370.c.
+   Copyright (C) 1994, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Cygnus Support.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA. */
+
+#define TC_I370
+
+#ifdef ANSI_PROTOTYPES
+struct fix;
+#endif
+
+/* Set the endianness we are using.  Default to big endian.  */
+#ifndef TARGET_BYTES_BIG_ENDIAN
+#define TARGET_BYTES_BIG_ENDIAN 1
+#endif
+
+#ifndef BFD_ASSEMBLER
+ #error I370 support requires BFD_ASSEMBLER
+#endif
+
+/* The target BFD architecture.  */
+#define TARGET_ARCH (i370_arch ())
+extern enum bfd_architecture i370_arch PARAMS ((void));
+
+/* Whether or not the target is big endian */
+extern int target_big_endian;
+
+/* The target BFD format.  */
+#ifdef OBJ_ELF
+#define TARGET_FORMAT ("elf32-i370")
+#endif
+
+/* Permit temporary numeric labels.  */
+#define LOCAL_LABELS_FB 1
+
+/* $ is used to refer to the current location.  */
+/* #define DOLLAR_DOT */
+
+#ifdef OBJ_ELF
+#define DIFF_EXPR_OK		/* foo-. gets turned into PC relative relocs */
+#endif
+
+/* We don't need to handle .word strangely.  */
+#define WORKING_DOT_WORD
+
+/* We set the fx_done field appropriately in md_apply_fix.  */
+#define TC_HANDLES_FX_DONE
+
+
+#ifdef OBJ_ELF
+
+/* Branch prediction relocations must force relocation.  */
+#define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) 1
+
+/* Support for SHF_EXCLUDE and SHT_ORDERED */
+extern int i370_section_letter PARAMS ((int, char **));
+extern int i370_section_type PARAMS ((char *, size_t));
+extern int i370_section_word PARAMS ((char *, size_t));
+extern int i370_section_flags PARAMS ((int, int, int));
+
+#define md_elf_section_letter(LETTER, PTR_MSG)	i370_section_letter (LETTER, PTR_MSG)
+#define md_elf_section_type(STR, LEN)		i370_section_type (STR, LEN)
+#define md_elf_section_word(STR, LEN)		i370_section_word (STR, LEN)
+#define md_elf_section_flags(FLAGS, ATTR, TYPE)	i370_section_flags (FLAGS, ATTR, TYPE)
+
+#define tc_comment_chars i370_comment_chars
+extern const char *i370_comment_chars;
+
+/* We must never ever try to resolve references to externally visible
+   symbols in the assembler, because the .o file might go into a shared
+   library, and some other shared library might override that symbol.  */
+#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)  \
+  ((FIX)->fx_addsy == NULL \
+   || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
+       && ! S_IS_WEAK ((FIX)->fx_addsy) \
+       && S_IS_DEFINED ((FIX)->fx_addsy) \
+       && ! S_IS_COMMON ((FIX)->fx_addsy)))
+
+#endif /* OBJ_ELF */
+
+/* call md_apply_fix3 with segment instead of md_apply_fix */
+#define MD_APPLY_FIX3
+
+/* call md_pcrel_from_section, not md_pcrel_from */
+#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
+extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
+
+#define md_operand(x)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 7149d71..3a01bab 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1,5 +1,5 @@
 /* i386.c -- Assemble code for the Intel 80386
-   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.
 
    This file is part of GAS, the GNU Assembler.
@@ -32,14 +32,14 @@
 #include "subsegs.h"
 #include "opcode/i386.h"
 
-#ifndef TC_RELOC
-#define TC_RELOC(X,Y) (Y)
-#endif
-
 #ifndef REGISTER_WARNINGS
 #define REGISTER_WARNINGS 1
 #endif
 
+#ifndef INFER_ADDR_PREFIX
+#define INFER_ADDR_PREFIX 1
+#endif
+
 #ifndef SCALE1_WHEN_NO_INDEX
 /* Specifying a scale factor besides 1 when there is no index is
    futile.  eg. `mov (%ebx,2),%al' does exactly the same as
@@ -59,6 +59,7 @@
 static int smallest_imm_type PARAMS ((long));
 static int add_prefix PARAMS ((unsigned int));
 static void set_16bit_code_flag PARAMS ((int));
+static void set_16bit_gcc_code_flag PARAMS((int));
 static void set_intel_syntax PARAMS ((int));
 
 #ifdef BFD_ASSEMBLER
@@ -69,6 +70,13 @@
 /* 'md_assemble ()' gathers together information and puts it into a
    i386_insn. */
 
+union i386_op
+  {
+    expressionS *disps;
+    expressionS *imms;
+    const reg_entry *regs;
+  };
+
 struct _i386_insn
   {
     /* TM holds the template for the insn were currently assembling. */
@@ -78,8 +86,6 @@
        (e.g. 'l' for 'movl')  */
     char suffix;
 
-    /* Operands are coded with OPERANDS, TYPES, DISPS, IMMS, and REGS. */
-
     /* OPERANDS gives the number of given operands. */
     unsigned int operands;
 
@@ -89,12 +95,12 @@
     unsigned int reg_operands, disp_operands, mem_operands, imm_operands;
 
     /* TYPES [i] is the type (see above #defines) which tells us how to
-       search through DISPS [i] & IMMS [i] & REGS [i] for the required
-       operand.  */
+       use OP[i] for the corresponding operand.  */
     unsigned int types[MAX_OPERANDS];
 
-    /* Displacements (if given) for each operand. */
-    expressionS *disps[MAX_OPERANDS];
+    /* Displacement expression, immediate expression, or register for each
+       operand.  */
+    union i386_op op[MAX_OPERANDS];
 
     /* Relocation type for operand */
 #ifdef BFD_ASSEMBLER
@@ -103,12 +109,6 @@
     int disp_reloc[MAX_OPERANDS];
 #endif
 
-    /* Immediate operands (if given) for each operand. */
-    expressionS *imms[MAX_OPERANDS];
-
-    /* Register operands (if given) for each operand. */
-    const reg_entry *regs[MAX_OPERANDS];
-
     /* BASE_REG, INDEX_REG, and LOG2_SCALE_FACTOR are used to encode
        the base index byte below.  */
     const reg_entry *base_reg;
@@ -225,10 +225,15 @@
 
 static int allow_naked_reg = 0;  /* 1 if register prefix % not required */
 
+static char stackop_size = '\0';  /* Used in 16 bit gcc mode to add an l
+				     suffix to call, ret, enter, leave, push,
+				     and pop instructions so that gcc has the
+				     same stack frame as in 32 bit mode.  */
+
 /* Interface to relax_segment.
    There are 2 relax states for 386 jump insns: one for conditional &
-   one for unconditional jumps.  This is because the these two types
-   of jumps add different sizes to frags when we're figuring out what
+   one for unconditional jumps.  This is because these two types of
+   jumps add different sizes to frags when we're figuring out what
    sort of jump to choose to reach a given label.  */
 
 /* types */
@@ -264,12 +269,12 @@
 
 const relax_typeS md_relax_table[] =
 {
-/* The fields are:
-   1) most positive reach of this state,
-   2) most negative reach of this state,
-   3) how many bytes this mode will add to the size of the current frag
-   4) which index into the table to try if we can't fit into this one.
-   */
+  /* The fields are:
+     1) most positive reach of this state,
+     2) most negative reach of this state,
+     3) how many bytes this mode will add to the size of the current frag
+     4) which index into the table to try if we can't fit into this one.
+  */
   {1, 1, 0, 0},
   {1, 1, 0, 0},
   {1, 1, 0, 0},
@@ -343,6 +348,8 @@
   static const char f32_15[] =
     {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90,	/* jmp .+15; lotsa nops	*/
      0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90};
+  static const char f16_3[] =
+    {0x8d,0x74,0x00};				/* lea 0(%esi),%esi	*/
   static const char f16_4[] =
     {0x8d,0xb4,0x00,0x00};			/* lea 0w(%si),%si	*/
   static const char f16_5[] =
@@ -362,7 +369,7 @@
     f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15
   };
   static const char *const f16_patt[] = {
-    f32_1, f32_2, f32_3, f16_4, f16_5, f16_6, f16_7, f16_8,
+    f32_1, f32_2, f16_3, f16_4, f16_5, f16_6, f16_7, f16_8,
     f32_15, f32_15, f32_15, f32_15, f32_15, f32_15, f32_15
   };
 
@@ -510,14 +517,23 @@
 
 static void
 set_16bit_code_flag (new_16bit_code_flag)
-	int new_16bit_code_flag;
+     int new_16bit_code_flag;
 {
   flag_16bit_code = new_16bit_code_flag;
+  stackop_size = '\0';
+}
+
+static void
+set_16bit_gcc_code_flag (new_16bit_code_flag)
+     int new_16bit_code_flag;
+{
+  flag_16bit_code = new_16bit_code_flag;
+  stackop_size = new_16bit_code_flag ? 'l' : '\0';
 }
 
 static void
 set_intel_syntax (syntax_flag)
-	int syntax_flag;
+     int syntax_flag;
 {
   /* Find out if register prefixing is specified.  */
   int ask_naked_reg = 0;
@@ -533,18 +549,18 @@
       else if (strcmp(string, "noprefix") == 0)
 	ask_naked_reg = -1;
       else
-	as_bad (_("Bad argument to syntax directive."));
+	as_bad (_("bad argument to syntax directive."));
       *input_line_pointer = e;
     }
   demand_empty_rest_of_line ();
-  
+
   intel_syntax = syntax_flag;
 
   if (ask_naked_reg == 0)
     {
 #ifdef BFD_ASSEMBLER
       allow_naked_reg = (intel_syntax
-                         && (bfd_get_symbol_leading_char (stdoutput) != '\0')); 
+			 && (bfd_get_symbol_leading_char (stdoutput) != '\0'));
 #else
       allow_naked_reg = 0; /* conservative default */
 #endif
@@ -569,6 +585,7 @@
   {"value", cons, 2},
   {"noopt", s_ignore, 0},
   {"optim", s_ignore, 0},
+  {"code16gcc", set_16bit_gcc_code_flag, 1},
   {"code16", set_16bit_code_flag, 1},
   {"code32", set_16bit_code_flag, 0},
   {"intel_syntax", set_intel_syntax, 1},
@@ -682,8 +699,6 @@
 #ifdef LEX_AT
     identifier_chars['@'] = '@';
 #endif
-    register_chars[')'] = ')';
-    register_chars['('] = '(';
     digit_chars['-'] = '-';
     identifier_chars['_'] = '_';
     identifier_chars['.'] = '.';
@@ -740,12 +755,12 @@
       pt (x->types[i]);
       fprintf (stdout, "\n");
       if (x->types[i]
-	  & (Reg | SReg2 | SReg3 | Control | Debug | Test | RegMMX))
-	fprintf (stdout, "%s\n", x->regs[i]->reg_name);
+	  & (Reg | SReg2 | SReg3 | Control | Debug | Test | RegMMX | RegXMM))
+	fprintf (stdout, "%s\n", x->op[i].regs->reg_name);
       if (x->types[i] & Imm)
-	pe (x->imms[i]);
+	pe (x->op[i].imms);
       if (x->types[i] & Disp)
-	pe (x->disps[i]);
+	pe (x->op[i].disps);
     }
 }
 
@@ -776,9 +791,9 @@
 pe (e)
      expressionS *e;
 {
-  fprintf (stdout, "    operation       %d\n", e->X_op);
-  fprintf (stdout, "    add_number    %d (%x)\n",
-	   e->X_add_number, e->X_add_number);
+  fprintf (stdout, "    operation     %d\n", e->X_op);
+  fprintf (stdout, "    add_number    %ld (%lx)\n",
+	   (long) e->X_add_number, (long) e->X_add_number);
   if (e->X_add_symbol)
     {
       fprintf (stdout, "    add_symbol    ");
@@ -835,6 +850,7 @@
   { Acc, "Acc" },
   { JumpAbsolute, "Jump Absolute" },
   { RegMMX, "rMMX" },
+  { RegXMM, "rXMM" },
   { EsSeg, "es" },
   { 0, "" }
 };
@@ -871,7 +887,7 @@
   return 0;
 #else
   /* For COFF */
-  return fixp->fx_r_type==7;
+  return fixp->fx_r_type == 7;
 #endif
 }
 
@@ -895,7 +911,7 @@
 	case 2: return BFD_RELOC_16_PCREL;
 	case 4: return BFD_RELOC_32_PCREL;
 	}
-      as_bad (_("Can not do %d byte pc-relative relocation"), size);
+      as_bad (_("can not do %d byte pc-relative relocation"), size);
     }
   else
     {
@@ -905,7 +921,7 @@
 	case 2: return BFD_RELOC_16;
 	case 4: return BFD_RELOC_32;
 	}
-      as_bad (_("Can not do %d byte relocation"), size);
+      as_bad (_("can not do %d byte relocation"), size);
     }
 
   return BFD_RELOC_NONE;
@@ -918,11 +934,12 @@
  * some cases we force the original symbol to be used.
  */
 int
-tc_i386_fix_adjustable(fixP)
-     fixS * fixP;
+tc_i386_fix_adjustable (fixP)
+     fixS *fixP;
 {
-#ifdef OBJ_ELF
-  /* Prevent all adjustments to global symbols. */
+#if defined (OBJ_ELF) || defined (TE_PE)
+  /* Prevent all adjustments to global symbols, or else dynamic
+     linking will not work correctly.  */
   if (S_IS_EXTERN (fixP->fx_addsy))
     return 0;
   if (S_IS_WEAK (fixP->fx_addsy))
@@ -932,6 +949,7 @@
   if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF
       || fixP->fx_r_type == BFD_RELOC_386_PLT32
       || fixP->fx_r_type == BFD_RELOC_386_GOT32
+      || fixP->fx_r_type == BFD_RELOC_RVA
       || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
     return 0;
@@ -948,12 +966,15 @@
 #define BFD_RELOC_386_GOTOFF	0
 #endif
 
-int
+static int
+intel_float_operand PARAMS ((char *mnemonic));
+
+static int
 intel_float_operand (mnemonic)
      char *mnemonic;
 {
   if (mnemonic[0] == 'f' && mnemonic[1] =='i')
-    return 0;
+    return 2;
 
   if (mnemonic[0] == 'f')
     return 1;
@@ -1065,30 +1086,27 @@
 
     if (!current_templates)
       {
-	/* See if we can get a match by trimming off a suffix.	*/
+	/* See if we can get a match by trimming off a suffix.  */
 	switch (mnem_p[-1])
 	  {
-	  case DWORD_MNEM_SUFFIX:
 	  case WORD_MNEM_SUFFIX:
 	  case BYTE_MNEM_SUFFIX:
 	  case SHORT_MNEM_SUFFIX:
-#if LONG_MNEM_SUFFIX != DWORD_MNEM_SUFFIX
 	  case LONG_MNEM_SUFFIX:
-#endif
 	    i.suffix = mnem_p[-1];
 	    mnem_p[-1] = '\0';
 	    current_templates = hash_find (op_hash, mnemonic);
-            break;
+	    break;
 
-          /* Intel Syntax */
-          case INTEL_DWORD_MNEM_SUFFIX:
-            if (intel_syntax)
-              {
-                i.suffix = mnem_p[-1];
-                mnem_p[-1] = '\0';
-                current_templates = hash_find (op_hash, mnemonic);
-                break;
-              }
+	  /* Intel Syntax */
+	  case DWORD_MNEM_SUFFIX:
+	    if (intel_syntax)
+	      {
+		i.suffix = mnem_p[-1];
+		mnem_p[-1] = '\0';
+		current_templates = hash_find (op_hash, mnemonic);
+		break;
+	      }
 	  }
 	if (!current_templates)
 	  {
@@ -1137,10 +1155,10 @@
 		  {
 		    if (paren_not_balanced)
 		      {
-                        if (!intel_syntax)
+			if (!intel_syntax)
 			  as_bad (_("unbalanced parenthesis in operand %d."),
 				  i.operands + 1);
-                        else
+			else
 			  as_bad (_("unbalanced brackets in operand %d."),
 				  i.operands + 1);
 			return;
@@ -1155,20 +1173,20 @@
 			    i.operands + 1);
 		    return;
 		  }
-                if (!intel_syntax)
-                  {
+		if (!intel_syntax)
+		  {
 		    if (*l == '(')
 		      ++paren_not_balanced;
 		    if (*l == ')')
 		      --paren_not_balanced;
-                  }
-                else
-                  {
+		  }
+		else
+		  {
 		    if (*l == '[')
 		      ++paren_not_balanced;
 		    if (*l == ']')
 		      --paren_not_balanced;
-                  }
+		  }
 		l++;
 	      }
 	    if (l != token_start)
@@ -1184,10 +1202,10 @@
 		/* now parse operand adding info to 'i' as we go along */
 		END_STRING_AND_SAVE (l);
 
-                if (intel_syntax)
-                  operand_ok = i386_intel_operand (token_start, intel_float_operand (mnemonic));
-                else
-                  operand_ok = i386_operand (token_start);
+		if (intel_syntax)
+		  operand_ok = i386_intel_operand (token_start, intel_float_operand (mnemonic));
+		else
+		  operand_ok = i386_operand (token_start);
 
 		RESTORE_END_STRING (l);	/* restore old contents */
 		if (!operand_ok)
@@ -1230,9 +1248,8 @@
      with the template operand types. */
 
 #define MATCH(overlap, given, template) \
-  ((overlap) \
-   && ((given) & BaseIndex) == ((overlap) & BaseIndex) \
-   && ((given) & JumpAbsolute) == ((template) & JumpAbsolute))
+  ((overlap & ~JumpAbsolute) \
+   && ((given) & (BaseIndex|JumpAbsolute)) == ((overlap) & (BaseIndex|JumpAbsolute)))
 
   /* If given types r0 and r1 are registers they must be of the same type
      unless the expected operand type register overlap is null.
@@ -1244,90 +1261,105 @@
 
   {
     register unsigned int overlap0, overlap1;
-    expressionS *exp;
     unsigned int overlap2;
     unsigned int found_reverse_match;
     int suffix_check;
 
-    /* All intel opcodes have reversed operands except for BOUND and ENTER */
-    if (intel_syntax
-        && (strcmp (mnemonic, "enter") != 0)
-        && (strcmp (mnemonic, "bound") != 0)
-        && (strncmp (mnemonic, "fsub", 4) !=0)
-        && (strncmp (mnemonic, "fdiv", 4) !=0))
+    /* All intel opcodes have reversed operands except for "bound" and
+       "enter".  We also don't reverse intersegment "jmp" and "call"
+       instructions with 2 immediate operands so that the immediate segment
+       precedes the offset, as it does when in AT&T mode.  "enter" and the
+       intersegment "jmp" and "call" instructions are the only ones that
+       have two immediate operands.  */
+    if (intel_syntax && i.operands > 1
+	&& (strcmp (mnemonic, "bound") != 0)
+	&& !((i.types[0] & Imm) && (i.types[1] & Imm)))
       {
-        const reg_entry *temp_reg;
-        expressionS *temp_disp;
-        expressionS *temp_imm;
-        unsigned int temp_type;
-        int xchg1, xchg2;
+	union i386_op temp_op;
+	unsigned int temp_type;
+	int xchg1 = 0;
+	int xchg2 = 0;
 
-        if (i.operands == 2)
-          {
-            xchg1 = 0;
-            xchg2 = 1;
-          }
-        else if (i.operands == 3)
-          {
-            xchg1 = 0;
-            xchg2 = 2;
-          }
+	if (i.operands == 2)
+	  {
+	    xchg1 = 0;
+	    xchg2 = 1;
+	  }
+	else if (i.operands == 3)
+	  {
+	    xchg1 = 0;
+	    xchg2 = 2;
+	  }
+	temp_type = i.types[xchg2];
+	i.types[xchg2] = i.types[xchg1];
+	i.types[xchg1] = temp_type;
+	temp_op = i.op[xchg2];
+	i.op[xchg2] = i.op[xchg1];
+	i.op[xchg1] = temp_op;
 
-        if (i.operands > 1)
-          {
-            temp_type = i.types[xchg2];
-            if (temp_type & (Reg | FloatReg))
-              temp_reg = i.regs[xchg2];
-            else if (temp_type & Imm)
-              temp_imm = i.imms[xchg2];
-            else if (temp_type & Disp)
-              temp_disp = i.disps[xchg2];
-           
-            i.types[xchg2] = i.types[xchg1];
+	if (i.mem_operands == 2)
+	  {
+	    const seg_entry *temp_seg;
+	    temp_seg = i.seg[0];
+	    i.seg[0] = i.seg[1];
+	    i.seg[1] = temp_seg;
+	  }
+      }
 
-            if (i.types[xchg1] & (Reg | FloatReg))
-              {
-                i.regs[xchg2] = i.regs[xchg1];
-                i.regs[xchg1] = NULL;
-              }
-            else if (i.types[xchg2] & Imm)
-              {
-                i.imms[xchg2] = i.imms[xchg1];
-                i.imms[xchg1] = NULL;
-              }
-            else if (i.types[xchg2] & Disp)
-              {
-                i.disps[xchg2] = i.disps[xchg1];
-                i.disps[xchg1] = NULL;
-              }
+    if (i.imm_operands)
+      {
+	/* Try to ensure constant immediates are represented in the smallest
+	   opcode possible.  */
+	char guess_suffix = 0;
+	int op;
 
-            if (temp_type & (Reg | FloatReg))
-              {
-                i.regs[xchg1] = temp_reg;
-                if (! (i.types[xchg1] & (Reg | FloatReg)))
-                  i.regs[xchg2] = NULL;
-              }
-            else if (temp_type & Imm)
-              {
-                i.imms[xchg1] = temp_imm;
-                if (! (i.types[xchg1] & Imm))
-                  i.imms[xchg2] = NULL;
-              }
-            else if (temp_type & Disp)
-              {
-                i.disps[xchg1] = temp_disp;
-                if (! (i.types[xchg1] & Disp))
-                  i.disps[xchg2] = NULL;
-              }
+	if (i.suffix)
+	  guess_suffix = i.suffix;
+	else if (i.reg_operands)
+	  {
+	    /* Figure out a suffix from the last register operand specified.
+	       We can't do this properly yet, ie. excluding InOutPortReg,
+	       but the following works for instructions with immediates.
+	       In any case, we can't set i.suffix yet.  */
+	    for (op = i.operands; --op >= 0; )
+	      if (i.types[op] & Reg)
+		{
+		  if (i.types[op] & Reg8)
+		    guess_suffix = BYTE_MNEM_SUFFIX;
+		  else if (i.types[op] & Reg16)
+		    guess_suffix = WORD_MNEM_SUFFIX;
+		  break;
+		}
+	  }
+	for (op = i.operands; --op >= 0; )
+	  if ((i.types[op] & Imm)
+	      && i.op[op].imms->X_op == O_constant)
+	    {
+	      /* If a suffix is given, this operand may be shortened.  */
+	      switch (guess_suffix)
+		{
+		case WORD_MNEM_SUFFIX:
+		  i.types[op] |= Imm16;
+		  break;
+		case BYTE_MNEM_SUFFIX:
+		  i.types[op] |= Imm16 | Imm8 | Imm8S;
+		  break;
+		}
 
-           i.types[xchg1] = temp_type;
-           }
-       if (!strcmp(mnemonic,"jmp")
-           || !strcmp (mnemonic, "call"))
-         if ((i.types[0] & Reg) || i.types[0] & BaseIndex)
-           i.types[0] |= JumpAbsolute;
-         
-       }
+	      /* If this operand is at most 16 bits, convert it to a
+		 signed 16 bit number before trying to see whether it will
+		 fit in an even smaller size.  This allows a 16-bit operand
+		 such as $0xffe0 to be recognised as within Imm8S range.  */
+	      if ((i.types[op] & Imm16)
+		  && (i.op[op].imms->X_add_number & ~(offsetT)0xffff) == 0)
+		{
+		  i.op[op].imms->X_add_number =
+		    (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
+		}
+	      i.types[op] |= smallest_imm_type ((long) i.op[op].imms->X_add_number);
+	    }
+      }
+
     overlap0 = 0;
     overlap1 = 0;
     overlap2 = 0;
@@ -1339,10 +1371,10 @@
 		       : (i.suffix == SHORT_MNEM_SUFFIX
 			  ? No_sSuf
 			  : (i.suffix == LONG_MNEM_SUFFIX
-                             ? No_lSuf 
-                             : (i.suffix == INTEL_DWORD_MNEM_SUFFIX 
-                                ? No_dSuf 
-                                : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0))))));
+			     ? No_lSuf
+			     : (i.suffix == DWORD_MNEM_SUFFIX
+				? No_dSuf
+				: (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0))))));
 
     for (t = current_templates->start;
 	 t < current_templates->end;
@@ -1352,17 +1384,13 @@
 	if (i.operands != t->operands)
 	  continue;
 
-        /* For some opcodes, don't check the suffix */
-        if (intel_syntax)
-          {
-            if (strcmp (t->name, "fnstcw")
-                && strcmp (t->name, "fldcw")
-                && (t->opcode_modifier & suffix_check))
-              continue;
-          }
-        /* Must not have disallowed suffix. */ 
-        else if ((t->opcode_modifier & suffix_check))
-            continue;
+	/* Check the suffix, except for some instructions in intel mode.  */
+	if ((t->opcode_modifier & suffix_check)
+	    && !(intel_syntax
+		 && t->base_opcode == 0xd9
+		 && (t->extension_opcode == 5	/* 0xd9,5 "fldcw"  */
+		     || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw"  */
+	  continue;
 
 	else if (!t->operands)
 	  break;		/* 0 operands always matches */
@@ -1419,9 +1447,9 @@
 		    || !CONSISTENT_REGISTER_MATCH (overlap1, i.types[1],
 						   t->operand_types[1],
 						   overlap2, i.types[2],
-	                                           t->operand_types[2]))
+						   t->operand_types[2]))
 
-                  continue;
+		  continue;
 	      }
 	    /* found either forward/reverse 2 or 3 operand match here:
 	       slip through to break */
@@ -1435,6 +1463,12 @@
 	return;
       }
 
+    if (!intel_syntax
+	&& (i.types[0] & JumpAbsolute) != (t->operand_types[0] & JumpAbsolute))
+      {
+	as_warn (_("indirect %s without `*'"), t->name);
+      }
+
     if ((t->opcode_modifier & (IsPrefix|IgnoreSize)) == (IsPrefix|IgnoreSize))
       {
 	/* Warn them that a data or address size prefix doesn't affect
@@ -1446,10 +1480,21 @@
     i.tm = *t;
     if (found_reverse_match)
       {
+	/* If we found a reverse match we must alter the opcode
+	   direction bit.  found_reverse_match holds bits to change
+	   (different for int & float insns).  */
+
+	i.tm.base_opcode ^= found_reverse_match;
+
 	i.tm.operand_types[0] = t->operand_types[1];
 	i.tm.operand_types[1] = t->operand_types[0];
       }
 
+    /* Undo SYSV386_COMPAT brokenness when in Intel mode.  See i386.h  */
+     if (SYSV386_COMPAT
+	 && intel_syntax
+	 && (i.tm.base_opcode & 0xfffffde0) == 0xdce0)
+       i.tm.base_opcode ^= FloatR;
 
     if (i.tm.opcode_modifier & FWait)
       if (! add_prefix (FWAIT_OPCODE))
@@ -1493,7 +1538,7 @@
 	if (i.tm.opcode_modifier & Size16)
 	  i.suffix = WORD_MNEM_SUFFIX;
 	else
-	  i.suffix = DWORD_MNEM_SUFFIX;
+	  i.suffix = LONG_MNEM_SUFFIX;
       }
     else if (i.reg_operands)
       {
@@ -1506,11 +1551,12 @@
 	       register type.  */
 	    int op;
 	    for (op = i.operands; --op >= 0; )
-	      if (i.types[op] & Reg)
+	      if ((i.types[op] & Reg)
+		  && !(i.tm.operand_types[op] & InOutPortReg))
 		{
 		  i.suffix = ((i.types[op] & Reg8) ? BYTE_MNEM_SUFFIX :
 			      (i.types[op] & Reg16) ? WORD_MNEM_SUFFIX :
-			      DWORD_MNEM_SUFFIX);
+			      LONG_MNEM_SUFFIX);
 		  break;
 		}
 	  }
@@ -1525,15 +1571,15 @@
 		if (i.types[op] & Reg8)
 		  continue;
 
-                /* movzx and movsx should not generate this warning. */
-                if (intel_syntax
-                    && (i.tm.base_opcode == 0xfb7
-                        || i.tm.base_opcode == 0xfb6
-                        || i.tm.base_opcode == 0xfbe
-                        || i.tm.base_opcode == 0xfbf))
-                  continue;
+		/* movzx and movsx should not generate this warning. */
+		if (intel_syntax
+		    && (i.tm.base_opcode == 0xfb7
+			|| i.tm.base_opcode == 0xfb6
+			|| i.tm.base_opcode == 0xfbe
+			|| i.tm.base_opcode == 0xfbf))
+		  continue;
 
-		if ((i.types[op] & WordReg) && i.regs[op]->reg_num < 4
+		if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4
 #if 0
 		    /* Check that the template allows eight bit regs
 		       This kills insns such as `orb $1,%edx', which
@@ -1545,25 +1591,27 @@
 #if REGISTER_WARNINGS
 		    if ((i.tm.operand_types[op] & InOutPortReg) == 0)
 		      as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
-			       (i.regs[op] - (i.types[op] & Reg16 ? 8 : 16))->reg_name,
-			       i.regs[op]->reg_name,
+			       (i.op[op].regs - (i.types[op] & Reg16 ? 8 : 16))->reg_name,
+			       i.op[op].regs->reg_name,
 			       i.suffix);
 #endif
 		    continue;
 		  }
 		/* Any other register is bad */
-		if (i.types[op] & (Reg | RegMMX | Control | Debug | Test
-				   | FloatReg | FloatAcc | SReg2 | SReg3))
+		if (i.types[op] & (Reg | RegMMX | RegXMM
+				   | SReg2 | SReg3
+				   | Control | Debug | Test
+				   | FloatReg | FloatAcc))
 		  {
 		    as_bad (_("`%%%s' not allowed with `%s%c'"),
-			    i.regs[op]->reg_name,
+			    i.op[op].regs->reg_name,
 			    i.tm.name,
 			    i.suffix);
 		    return;
 		  }
 	      }
 	  }
-	else if (i.suffix == DWORD_MNEM_SUFFIX)
+	else if (i.suffix == LONG_MNEM_SUFFIX)
 	  {
 	    int op;
 	    for (op = i.operands; --op >= 0; )
@@ -1573,7 +1621,7 @@
 		  && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0)
 		{
 		  as_bad (_("`%%%s' not allowed with `%s%c'"),
-			  i.regs[op]->reg_name,
+			  i.op[op].regs->reg_name,
 			  i.tm.name,
 			  i.suffix);
 		  return;
@@ -1584,8 +1632,8 @@
 		       && (i.tm.operand_types[op] & (Reg32|Acc)) != 0)
 		{
 		  as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
-			   (i.regs[op] + 8)->reg_name,
-			   i.regs[op]->reg_name,
+			   (i.op[op].regs + 8)->reg_name,
+			   i.op[op].regs->reg_name,
 			   i.suffix);
 		}
 #endif
@@ -1600,7 +1648,7 @@
 		  && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0)
 		{
 		  as_bad (_("`%%%s' not allowed with `%s%c'"),
-			  i.regs[op]->reg_name,
+			  i.op[op].regs->reg_name,
 			  i.tm.name,
 			  i.suffix);
 		  return;
@@ -1611,8 +1659,8 @@
 		       && (i.tm.operand_types[op] & (Reg16|Acc)) != 0)
 		{
 		  as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
-			   (i.regs[op] - 8)->reg_name,
-			   i.regs[op]->reg_name,
+			   (i.op[op].regs - 8)->reg_name,
+			   i.op[op].regs->reg_name,
 			   i.suffix);
 		}
 #endif
@@ -1620,6 +1668,10 @@
 	else
 	  abort();
       }
+    else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix)
+      {
+	i.suffix = stackop_size;
+      }
 
     /* Make still unresolved immediate matches conform to size of immediate
        given in i.suffix.  Note: overlap2 cannot be an immediate!  */
@@ -1629,12 +1681,12 @@
       {
 	if (i.suffix)
 	  {
-	   overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
-			(i.suffix == WORD_MNEM_SUFFIX ? Imm16 : Imm32));
+	    overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
+			 (i.suffix == WORD_MNEM_SUFFIX ? Imm16 : Imm32));
 	  }
 	else if (overlap0 == (Imm16 | Imm32))
 	  {
-	   overlap0 =
+	    overlap0 =
 	      (flag_16bit_code ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32;
 	  }
 	else
@@ -1649,12 +1701,12 @@
       {
 	if (i.suffix)
 	  {
-	   overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
-			(i.suffix == WORD_MNEM_SUFFIX ? Imm16 : Imm32));
+	    overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
+			 (i.suffix == WORD_MNEM_SUFFIX ? Imm16 : Imm32));
 	  }
 	else if (overlap1 == (Imm16 | Imm32))
 	  {
-	   overlap1 =
+	    overlap1 =
 	      (flag_16bit_code ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32;
 	  }
 	else
@@ -1690,15 +1742,15 @@
 
     /* For movzx and movsx, need to check the register type */
     if (intel_syntax
-        && (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe))
+	&& (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe))
       if (i.suffix && i.suffix == BYTE_MNEM_SUFFIX)
-        {
-          unsigned int prefix = DATA_PREFIX_OPCODE;
+	{
+	  unsigned int prefix = DATA_PREFIX_OPCODE;
 
-          if ((i.regs[1]->reg_type & Reg16) != 0)
-            if (!add_prefix (prefix))
-              return;
-        }
+	  if ((i.op[1].regs->reg_type & Reg16) != 0)
+	    if (!add_prefix (prefix))
+	      return;
+	}
 
     if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX)
       {
@@ -1713,8 +1765,7 @@
 	/* Now select between word & dword operations via the operand
 	   size prefix, except for instructions that will ignore this
 	   prefix anyway.  */
-	if (((intel_syntax && (i.suffix == INTEL_DWORD_MNEM_SUFFIX))
-             || i.suffix == DWORD_MNEM_SUFFIX
+	if (((intel_syntax && (i.suffix == DWORD_MNEM_SUFFIX))
 	     || i.suffix == LONG_MNEM_SUFFIX) == flag_16bit_code
 	    && !(i.tm.opcode_modifier & IgnoreSize))
 	  {
@@ -1727,32 +1778,26 @@
 	  }
 	/* Size floating point instruction.  */
 	if (i.suffix == LONG_MNEM_SUFFIX
-            || (intel_syntax && i.suffix == INTEL_DWORD_MNEM_SUFFIX))
+	    || (intel_syntax && i.suffix == DWORD_MNEM_SUFFIX))
 	  {
 	    if (i.tm.opcode_modifier & FloatMF)
 	      i.tm.base_opcode ^= 4;
 	  }
-
-        if (intel_syntax && i.suffix == LONG_DOUBLE_MNEM_SUFFIX)
-          {
-            if (i.tm.opcode_modifier & FloatMF)
-              i.tm.base_opcode ^= 2;
-          }
       }
 
-    if (i.tm.base_opcode == AMD_3DNOW_OPCODE)
+    if (i.tm.opcode_modifier & ImmExt)
       {
-	/* These AMD specific instructions have an opcode suffix which
-	   is coded in the same place as an 8-bit immediate field
-	   would be.  Here we fake an 8-bit immediate operand from the
-	   opcode suffix stored in tm.extension_opcode.  */
+	/* These AMD 3DNow! and Intel Katmai New Instructions have an
+	   opcode suffix which is coded in the same place as an 8-bit
+	   immediate field would be.  Here we fake an 8-bit immediate
+	   operand from the opcode suffix stored in tm.extension_opcode.  */
 
 	expressionS *exp;
 
-	assert(i.imm_operands == 0 && i.operands <= 2);
+	assert(i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS);
 
 	exp = &im_expressions[i.imm_operands++];
-	i.imms[i.operands] = exp;
+	i.op[i.operands].imms = exp;
 	i.types[i.operands++] = Imm8;
 	exp->X_op = O_constant;
 	exp->X_add_number = i.tm.extension_opcode;
@@ -1762,17 +1807,11 @@
     /* For insns with operands there are more diddles to do to the opcode. */
     if (i.operands)
       {
-        /* Default segment register this instruction will use
+	/* Default segment register this instruction will use
 	   for memory accesses.  0 means unknown.
 	   This is only for optimizing out unnecessary segment overrides.  */
 	const seg_entry *default_seg = 0;
 
-	/* If we found a reverse match we must alter the opcode
-	   direction bit.  found_reverse_match holds bits to change
-	   (different for int & float insns).  */
-
-	i.tm.base_opcode ^= found_reverse_match;
-
 	/* The imul $imm, %reg instruction is converted into
 	   imul $imm, %reg, %reg, and the clr %reg instruction
 	   is converted into xor %reg, %reg.  */
@@ -1780,7 +1819,9 @@
 	  {
 	    unsigned int first_reg_op = (i.types[0] & Reg) ? 0 : 1;
 	    /* Pretend we saw the extra register operand. */
-	    i.regs[first_reg_op+1] = i.regs[first_reg_op];
+	    assert (i.op[first_reg_op+1].regs == 0);
+	    i.op[first_reg_op+1].regs = i.op[first_reg_op].regs;
+	    i.types[first_reg_op+1] = i.types[first_reg_op];
 	    i.reg_operands = 2;
 	  }
 
@@ -1789,7 +1830,7 @@
 	    /* The register or float register operand is in operand 0 or 1. */
 	    unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1;
 	    /* Register goes in low 3 bits of opcode. */
-	    i.tm.base_opcode |= i.regs[op]->reg_num;
+	    i.tm.base_opcode |= i.op[op].regs->reg_num;
 	    if ((i.tm.opcode_modifier & Ugh) != 0)
 	      {
 		/* Warn about some common errors, but press on regardless.
@@ -1798,14 +1839,14 @@
 		  {
 		    /* reversed arguments on faddp, fsubp, etc. */
 		    as_warn (_("translating to `%s %%%s,%%%s'"), i.tm.name,
-			     i.regs[1]->reg_name,
-			     i.regs[0]->reg_name);
+			     i.op[1].regs->reg_name,
+			     i.op[0].regs->reg_name);
 		  }
 		else
 		  {
 		    /* extraneous `l' suffix on fp insn */
 		    as_warn (_("translating to `%s %%%s'"), i.tm.name,
-			     i.regs[0]->reg_name);
+			     i.op[0].regs->reg_name);
 		  }
 	      }
 	  }
@@ -1822,45 +1863,29 @@
 	      {
 		unsigned int source, dest;
 		source = ((i.types[0]
-			   & (Reg
-			      | SReg2
-			      | SReg3
-			      | Control
-			      | Debug
-			      | Test
-			      | RegMMX))
+			   & (Reg | RegMMX | RegXMM
+			      | SReg2 | SReg3
+			      | Control | Debug | Test))
 			  ? 0 : 1);
 		dest = source + 1;
 
-		/* Certain instructions expect the destination to be
-		   in the i.rm.reg field.  This is by far the
-		   exceptional case.  For these instructions, if the
-		   source operand is a register, we must reverse the
-		   i.rm.reg and i.rm.regmem fields.  We accomplish
-		   this by pretending that the two register operands
-		   were given in the reverse order.  */
-		if (i.tm.opcode_modifier & ReverseRegRegmem)
-		  {
-		    const reg_entry *tmp = i.regs[source];
-		    i.regs[source] = i.regs[dest];
-		    i.regs[dest] = tmp;
-		  }
-
 		i.rm.mode = 3;
-		/* We must be careful to make sure that all
-		   segment/control/test/debug/MMX registers go into
-		   the i.rm.reg field (despite whether they are
-		   source or destination operands). */
-		if (i.regs[dest]->reg_type
-		    & (SReg2 | SReg3 | Control | Debug | Test | RegMMX))
+		/* One of the register operands will be encoded in the
+		   i.tm.reg field, the other in the combined i.tm.mode
+		   and i.tm.regmem fields.  If no form of this
+		   instruction supports a memory destination operand,
+		   then we assume the source operand may sometimes be
+		   a memory operand and so we need to store the
+		   destination in the i.rm.reg field.  */
+		if ((i.tm.operand_types[dest] & AnyMem) == 0)
 		  {
-		    i.rm.reg = i.regs[dest]->reg_num;
-		    i.rm.regmem = i.regs[source]->reg_num;
+		    i.rm.reg = i.op[dest].regs->reg_num;
+		    i.rm.regmem = i.op[source].regs->reg_num;
 		  }
 		else
 		  {
-		    i.rm.reg = i.regs[source]->reg_num;
-		    i.rm.regmem = i.regs[dest]->reg_num;
+		    i.rm.reg = i.op[source].regs->reg_num;
+		    i.rm.regmem = i.op[dest].regs->reg_num;
 		  }
 	      }
 	    else
@@ -1981,8 +2006,11 @@
 		      {
 			/* Fakes a zero displacement assuming that i.types[op]
 			   holds the correct displacement size. */
+			expressionS *exp;
+
+			assert (i.op[op].disps == 0);
 			exp = &disp_expressions[i.disp_operands++];
-			i.disps[op] = exp;
+			i.op[op].disps = exp;
 			exp->X_op = O_constant;
 			exp->X_add_number = 0;
 			exp->X_add_symbol = (symbolS *) 0;
@@ -1999,20 +2027,22 @@
 		  {
 		    unsigned int op =
 		      ((i.types[0]
-			& (Reg | SReg2 | SReg3 | Control | Debug
-			   | Test | RegMMX))
+			& (Reg | RegMMX | RegXMM
+			   | SReg2 | SReg3
+			   | Control | Debug | Test))
 		       ? 0
 		       : ((i.types[1]
-			   & (Reg | SReg2 | SReg3 | Control | Debug
-			      | Test | RegMMX))
+			   & (Reg | RegMMX | RegXMM
+			      | SReg2 | SReg3
+			      | Control | Debug | Test))
 			  ? 1
 			  : 2));
 		    /* If there is an extension opcode to put here, the
 		       register number must be put into the regmem field. */
 		    if (i.tm.extension_opcode != None)
-		      i.rm.regmem = i.regs[op]->reg_num;
+		      i.rm.regmem = i.op[op].regs->reg_num;
 		    else
-		      i.rm.reg = i.regs[op]->reg_num;
+		      i.rm.reg = i.op[op].regs->reg_num;
 
 		    /* Now, if no memory operand has set i.rm.mode = 0, 1, 2
 		       we must set it to 3 to indicate this is a register
@@ -2028,12 +2058,12 @@
 	  }
 	else if (i.tm.opcode_modifier & (Seg2ShortForm | Seg3ShortForm))
 	  {
-	    if (i.tm.base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1)
+	    if (i.tm.base_opcode == POP_SEG_SHORT && i.op[0].regs->reg_num == 1)
 	      {
 		as_bad (_("you can't `pop %%cs'"));
 		return;
 	      }
-	    i.tm.base_opcode |= (i.regs[0]->reg_num << 3);
+	    i.tm.base_opcode |= (i.op[0].regs->reg_num << 3);
 	  }
 	else if ((i.tm.base_opcode & ~(D|W)) == MOV_AX_DISP32)
 	  {
@@ -2060,18 +2090,28 @@
       }
     else if ((i.tm.opcode_modifier & Ugh) != 0)
       {
-       /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc */
-       as_warn (_("translating to `%sp'"), i.tm.name);
+	/* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc.  */
+	as_warn (_("translating to `%sp'"), i.tm.name);
       }
   }
 
   /* Handle conversion of 'int $3' --> special int3 insn. */
-  if (i.tm.base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3)
+  if (i.tm.base_opcode == INT_OPCODE && i.op[0].imms->X_add_number == 3)
     {
       i.tm.base_opcode = INT3_OPCODE;
       i.imm_operands = 0;
     }
 
+  if ((i.tm.opcode_modifier & (Jump | JumpByte | JumpDword))
+      && i.op[0].disps->X_op == O_constant)
+    {
+      /* Convert "jmp constant" (and "call constant") to a jump (call) to
+	 the absolute address given by the constant.  Since ix86 jumps and
+	 calls are pc relative, we need to generate a reloc.  */
+      i.op[0].disps->X_add_symbol = &abs_symbol;
+      i.op[0].disps->X_op = O_symbol;
+    }
+
   /* We are ready to output the insn. */
   {
     register char *p;
@@ -2079,96 +2119,60 @@
     /* Output jumps. */
     if (i.tm.opcode_modifier & Jump)
       {
-	long n = (long) i.disps[0]->X_add_number;
-	int prefix = (i.prefix[DATA_PREFIX] != 0);
-	int code16 = 0;
+	int size;
+	int code16;
+	int prefix;
 
-	if (prefix)
-	  {
-	    i.prefixes -= 1;
-	    code16 = CODE16;
-	  }
+	code16 = 0;
 	if (flag_16bit_code)
-	  code16 ^= CODE16;
+	  code16 = CODE16;
 
-	if (!intel_syntax && (i.prefixes != 0))
+	prefix = 0;
+	if (i.prefix[DATA_PREFIX])
+	  {
+	    prefix = 1;
+	    i.prefixes -= 1;
+	    code16 ^= CODE16;
+	  }
+
+	size = 4;
+	if (code16)
+	  size = 2;
+
+	if (i.prefixes != 0 && !intel_syntax)
 	  as_warn (_("skipping prefixes on this instruction"));
 
-	if (i.disps[0]->X_op == O_constant)
-	  {
-	    if (fits_in_signed_byte (n))
-	      {
-		insn_size += 2;
-		p = frag_more (2);
-		p[0] = i.tm.base_opcode;
-		p[1] = n;
-	      }
-	    else
-	      {
-	        /* Use 16-bit jumps only for 16-bit code,
-		   because text segments are limited to 64K anyway;
-	           Use 32-bit jumps for 32-bit code, because they're faster,
-		   and a 16-bit jump will clear the top 16 bits of %eip.  */
-		int jmp_size = code16 ? 2 : 4;
-	      	if (code16 && !fits_in_signed_word (n))
-		  {
-		    as_bad (_("16-bit jump out of range"));
-		    return;
-		  }
-
-		if (i.tm.base_opcode == JUMP_PC_RELATIVE)
-		  {		/* pace */
-		    /* unconditional jump */
-		    insn_size += prefix + 1 + jmp_size;
-		    p = frag_more (prefix + 1 + jmp_size);
-		    if (prefix)
-		      *p++ = DATA_PREFIX_OPCODE;
-		    *p++ = (char) 0xe9;
-		    md_number_to_chars (p, (valueT) n, jmp_size);
-		  }
-		else
-		  {
-		    /* conditional jump */
-		    insn_size += prefix + 2 + jmp_size;
-		    p = frag_more (prefix + 2 + jmp_size);
-		    if (prefix)
-		      *p++ = DATA_PREFIX_OPCODE;
-		    *p++ = TWO_BYTE_OPCODE_ESCAPE;
-		    *p++ = i.tm.base_opcode + 0x10;
-		    md_number_to_chars (p, (valueT) n, jmp_size);
-		  }
-	      }
-	  }
-	else
-	  {
-	    int size = code16 ? 2 : 4;
-
-	    /* It's a symbol; end frag & setup for relax.
-	       Make sure there are more than 6 chars left in the current frag;
-	       if not we'll have to start a new one. */
-	    frag_grow (prefix + 1 + 2 + size);
-	    insn_size += 1 + prefix;
-	    p = frag_more (1 + prefix);
-	    if (prefix)
-	      *p++ = DATA_PREFIX_OPCODE;
-	    *p = i.tm.base_opcode;
-	    frag_var (rs_machine_dependent,
-		      prefix + 2 + size, /* 2 opcode/prefix + displacement */
-		      1,
-		      ((unsigned char) *p == JUMP_PC_RELATIVE
-		       ? ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL) | code16
-		       : ENCODE_RELAX_STATE (COND_JUMP, SMALL) | code16),
-		      i.disps[0]->X_add_symbol,
-		      (offsetT) n, p);
-	  }
+	/* It's always a symbol;  End frag & setup for relax.
+	   Make sure there is enough room in this frag for the largest
+	   instruction we may generate in md_convert_frag.  This is 2
+	   bytes for the opcode and room for the prefix and largest
+	   displacement.  */
+	frag_grow (prefix + 2 + size);
+	insn_size += prefix + 1;
+	/* Prefix and 1 opcode byte go in fr_fix.  */
+	p = frag_more (prefix + 1);
+	if (prefix)
+	  *p++ = DATA_PREFIX_OPCODE;
+	*p = i.tm.base_opcode;
+	/* 1 possible extra opcode + displacement go in fr_var.  */
+	frag_var (rs_machine_dependent,
+		  1 + size,
+		  1,
+		  ((unsigned char) *p == JUMP_PC_RELATIVE
+		   ? ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL) | code16
+		   : ENCODE_RELAX_STATE (COND_JUMP, SMALL) | code16),
+		  i.op[0].disps->X_add_symbol,
+		  i.op[0].disps->X_add_number,
+		  p);
       }
     else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
       {
-	int size = (i.tm.opcode_modifier & JumpByte) ? 1 : 4;
-	long n = (long) i.disps[0]->X_add_number;
+	int size;
 
-	if (size == 1) /* then this is a loop or jecxz type instruction */
+	if (i.tm.opcode_modifier & JumpByte)
 	  {
+	    /* This is a loop or jecxz type instruction.  */
+	    size = 1;
 	    if (i.prefix[ADDR_PREFIX])
 	      {
 		insn_size += 1;
@@ -2178,23 +2182,26 @@
 	  }
 	else
 	  {
-	    int code16 = 0;
+	    int code16;
+
+	    code16 = 0;
+	    if (flag_16bit_code)
+	      code16 = CODE16;
 
 	    if (i.prefix[DATA_PREFIX])
 	      {
 		insn_size += 1;
 		FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE);
 		i.prefixes -= 1;
-		code16 = CODE16;
+		code16 ^= CODE16;
 	      }
-	    if (flag_16bit_code)
-	      code16 ^= CODE16;
 
+	    size = 4;
 	    if (code16)
 	      size = 2;
 	  }
 
-	if (!intel_syntax && (i.prefixes != 0))
+	if (i.prefixes != 0 && !intel_syntax)
 	  as_warn (_("skipping prefixes on this instruction"));
 
 	if (fits_in_unsigned_byte (i.tm.base_opcode))
@@ -2204,57 +2211,39 @@
 	  }
 	else
 	  {
-	    insn_size += 2 + size;	/* opcode can be at most two bytes */
+	    /* opcode can be at most two bytes */
+	    insn_size += 2 + size;
 	    p = frag_more (2 + size);
 	    *p++ = (i.tm.base_opcode >> 8) & 0xff;
 	  }
 	*p++ = i.tm.base_opcode & 0xff;
 
-	if (i.disps[0]->X_op == O_constant)
-	  {
-	    if (size == 1 && !fits_in_signed_byte (n))
-	      {
-		as_bad (_("`%s' only takes byte displacement; %ld shortened to %d"),
-			i.tm.name, n, *p);
-	      }
-	    else if (size == 2 && !fits_in_signed_word (n))
-	      {
-		as_bad (_("16-bit jump out of range"));
-		return;
-	      }
-	    md_number_to_chars (p, (valueT) n, size);
-	  }
-	else
-	  {
-	    fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-			 i.disps[0], 1, reloc (size, 1, i.disp_reloc[0]));
-
-	  }
+	fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+		     i.op[0].disps, 1, reloc (size, 1, i.disp_reloc[0]));
       }
     else if (i.tm.opcode_modifier & JumpInterSegment)
       {
 	int size;
-	int reloc_type;
-	int prefix = i.prefix[DATA_PREFIX] != 0;
-	int code16 = 0;
+	int prefix;
+	int code16;
 
-	if (prefix)
-	  {
-	    code16 = CODE16;
-	    i.prefixes -= 1;
-	  }
+	code16 = 0;
 	if (flag_16bit_code)
-	  code16 ^= CODE16;
+	  code16 = CODE16;
+
+	prefix = 0;
+	if (i.prefix[DATA_PREFIX])
+	  {
+	    prefix = 1;
+	    i.prefixes -= 1;
+	    code16 ^= CODE16;
+	  }
 
 	size = 4;
-	reloc_type = BFD_RELOC_32;
 	if (code16)
-	  {
-	    size = 2;
-	    reloc_type = BFD_RELOC_16;
-	  }
+	  size = 2;
 
-	if (!intel_syntax && (i.prefixes != 0))
+	if (i.prefixes != 0 && !intel_syntax)
 	  as_warn (_("skipping prefixes on this instruction"));
 
 	insn_size += prefix + 1 + 2 + size;  /* 1 opcode; 2 segment; offset */
@@ -2262,11 +2251,13 @@
 	if (prefix)
 	  *p++ = DATA_PREFIX_OPCODE;
 	*p++ = i.tm.base_opcode;
-	if (i.imms[1]->X_op == O_constant)
+	if (i.op[1].imms->X_op == O_constant)
 	  {
-	    long n = (long) i.imms[1]->X_add_number;
+	    long n = (long) i.op[1].imms->X_add_number;
 
-	    if (size == 2 && !fits_in_unsigned_word (n))
+	    if (size == 2
+		&& !fits_in_unsigned_word (n)
+		&& !fits_in_signed_word (n))
 	      {
 		as_bad (_("16-bit jump out of range"));
 		return;
@@ -2275,11 +2266,11 @@
 	  }
 	else
 	  fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-		       i.imms[1], 0, reloc_type);
-	if (i.imms[0]->X_op != O_constant)
+		       i.op[1].imms, 0, reloc (size, 0, i.disp_reloc[0]));
+	if (i.op[0].imms->X_op != O_constant)
 	  as_bad (_("can't handle non absolute segment in `%s'"),
 		  i.tm.name);
-	md_number_to_chars (p + size, (valueT) i.imms[0]->X_add_number, 2);
+	md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
       }
     else
       {
@@ -2365,50 +2356,45 @@
 
 	    for (n = 0; n < i.operands; n++)
 	      {
-		if (i.disps[n])
+		if (i.types[n] & Disp)
 		  {
-		    if (i.disps[n]->X_op == O_constant)
+		    if (i.op[n].disps->X_op == O_constant)
 		      {
-			if (i.types[n] & Disp8)
+			int size = 4;
+			long val = (long) i.op[n].disps->X_add_number;
+
+			if (i.types[n] & (Disp8 | Disp16))
 			  {
-			    insn_size += 1;
-			    p = frag_more (1);
-			    md_number_to_chars (p,
-						(valueT) i.disps[n]->X_add_number,
-						1);
+			    long mask;
+
+			    size = 2;
+			    mask = ~ (long) 0xffff;
+			    if (i.types[n] & Disp8)
+			      {
+				size = 1;
+				mask = ~ (long) 0xff;
+			      }
+
+			    if ((val & mask) != 0 && (val & mask) != mask)
+			      as_warn (_("%ld shortened to %ld"),
+				       val, val & ~mask);
 			  }
-			else if (i.types[n] & Disp16)
-			  {
-			    insn_size += 2;
-			    p = frag_more (2);
-			    md_number_to_chars (p,
-						(valueT) i.disps[n]->X_add_number,
-						2);
-			  }
-			else
-			  {	/* Disp32 */
-			    insn_size += 4;
-			    p = frag_more (4);
-			    md_number_to_chars (p,
-						(valueT) i.disps[n]->X_add_number,
-						4);
-			  }
-		      }
-		    else if (i.types[n] & Disp32)
-		      {
-			insn_size += 4;
-			p = frag_more (4);
-			fix_new_exp (frag_now, p - frag_now->fr_literal, 4,
-				     i.disps[n], 0,
-				     TC_RELOC (i.disp_reloc[n], BFD_RELOC_32));
+			insn_size += size;
+			p = frag_more (size);
+			md_number_to_chars (p, (valueT) val, size);
 		      }
 		    else
-		      { /* must be Disp16 */
-			insn_size += 2;
-			p = frag_more (2);
-			fix_new_exp (frag_now, p - frag_now->fr_literal, 2,
-				     i.disps[n], 0,
-				     TC_RELOC (i.disp_reloc[n], BFD_RELOC_16));
+		      {
+			int size = 4;
+
+			if (i.types[n] & Disp16)
+			  size = 2;
+
+			insn_size += size;
+			p = frag_more (size);
+			fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+				     i.op[n].disps, 0,
+				     reloc (size, 0, i.disp_reloc[n]));
 		      }
 		  }
 	      }
@@ -2421,68 +2407,68 @@
 
 	    for (n = 0; n < i.operands; n++)
 	      {
-		if (i.imms[n])
+		if (i.types[n] & Imm)
 		  {
-		    if (i.imms[n]->X_op == O_constant)
+		    if (i.op[n].imms->X_op == O_constant)
 		      {
-			if (i.types[n] & (Imm8 | Imm8S))
+			int size = 4;
+			long val = (long) i.op[n].imms->X_add_number;
+
+			if (i.types[n] & (Imm8 | Imm8S | Imm16))
 			  {
-			    insn_size += 1;
-			    p = frag_more (1);
-			    md_number_to_chars (p,
-						(valueT) i.imms[n]->X_add_number,
-						1);
+			    long mask;
+
+			    size = 2;
+			    mask = ~ (long) 0xffff;
+			    if (i.types[n] & (Imm8 | Imm8S))
+			      {
+				size = 1;
+				mask = ~ (long) 0xff;
+			      }
+			    if ((val & mask) != 0 && (val & mask) != mask)
+			      as_warn (_("%ld shortened to %ld"),
+				       val, val & ~mask);
 			  }
-			else if (i.types[n] & Imm16)
-			  {
-			    insn_size += 2;
-			    p = frag_more (2);
-			    md_number_to_chars (p,
-						(valueT) i.imms[n]->X_add_number,
-						2);
-			  }
-			else
-			  {
-			    insn_size += 4;
-			    p = frag_more (4);
-			    md_number_to_chars (p,
-						(valueT) i.imms[n]->X_add_number,
-						4);
-			  }
+			insn_size += size;
+			p = frag_more (size);
+			md_number_to_chars (p, (valueT) val, size);
 		      }
 		    else
 		      {		/* not absolute_section */
 			/* Need a 32-bit fixup (don't support 8bit
-			   non-absolute ims).  Try to support other
+			   non-absolute imms).  Try to support other
 			   sizes ... */
-			int r_type;
-			int size;
-			int pcrel = 0;
+#ifdef BFD_ASSEMBLER
+			enum bfd_reloc_code_real reloc_type;
+#else
+			int reloc_type;
+#endif
+			int size = 4;
 
-			if (i.types[n] & (Imm8 | Imm8S))
-			  size = 1;
-			else if (i.types[n] & Imm16)
+			if (i.types[n] & Imm16)
 			  size = 2;
-			else
-			  size = 4;
+			else if (i.types[n] & (Imm8 | Imm8S))
+			  size = 1;
+
 			insn_size += size;
 			p = frag_more (size);
-			r_type = reloc (size, 0, i.disp_reloc[0]);
+			reloc_type = reloc (size, 0, i.disp_reloc[0]);
 #ifdef BFD_ASSEMBLER
-			if (r_type == BFD_RELOC_32
+			if (reloc_type == BFD_RELOC_32
 			    && GOT_symbol
-			    && GOT_symbol == i.imms[n]->X_add_symbol
-			    && (i.imms[n]->X_op == O_symbol
-				|| (i.imms[n]->X_op == O_add
-				    && (i.imms[n]->X_op_symbol->sy_value.X_op
+			    && GOT_symbol == i.op[n].imms->X_add_symbol
+			    && (i.op[n].imms->X_op == O_symbol
+				|| (i.op[n].imms->X_op == O_add
+				    && ((symbol_get_value_expression
+					 (i.op[n].imms->X_op_symbol)->X_op)
 					== O_subtract))))
 			  {
-			    r_type = BFD_RELOC_386_GOTPC;
-			    i.imms[n]->X_add_number += 3;
+			    reloc_type = BFD_RELOC_386_GOTPC;
+			    i.op[n].imms->X_add_number += 3;
 			  }
 #endif
 			fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-				     i.imms[n], pcrel, r_type);
+				     i.op[n].imms, 0, reloc_type);
 		      }
 		  }
 	      }
@@ -2498,30 +2484,6 @@
   }
 }
 
-static int i386_is_reg PARAMS ((char *));
-
-static int
-i386_is_reg (reg_string)
-     char *reg_string;
-{
-  register char *s = reg_string;
-  register char *p;
-  char reg_name_given[MAX_REG_NAME_SIZE + 1];
-
-  if (is_space_char (*s))
-    ++s;
-
-  p = reg_name_given;
-  while ((*p++ = register_chars[(unsigned char) *s++]) != '\0')
-    if (p >= reg_name_given + MAX_REG_NAME_SIZE)
-      return 0;
-
-  if (!hash_find (reg_hash, reg_name_given))
-    return 0;
-  else
-    return 1;
-}
- 
 static int i386_immediate PARAMS ((char *));
 
 static int
@@ -2534,12 +2496,12 @@
 
   if (i.imm_operands == MAX_IMMEDIATE_OPERANDS)
     {
-      as_bad (_("Only 1 or 2 immediate operands are allowed"));
+      as_bad (_("only 1 or 2 immediate operands are allowed"));
       return 0;
     }
 
   exp = &im_expressions[i.imm_operands++];
-  i.imms[this_operand] = exp;
+  i.op[this_operand].imms = exp;
 
   if (is_space_char (*imm_start))
     ++imm_start;
@@ -2548,114 +2510,114 @@
   input_line_pointer = imm_start;
 
 #ifndef LEX_AT
-    {
-      /*
-       * We can have operands of the form
-       *   <symbol>@GOTOFF+<nnn>
-       * Take the easy way out here and copy everything
-       * into a temporary buffer...
-       */
-      register char *cp;
+  {
+    /*
+     * We can have operands of the form
+     *   <symbol>@GOTOFF+<nnn>
+     * Take the easy way out here and copy everything
+     * into a temporary buffer...
+     */
+    register char *cp;
 
-      cp = strchr (input_line_pointer, '@');
-      if (cp != NULL)
-        {
-	  char *tmpbuf;
-	  int len, first;
+    cp = strchr (input_line_pointer, '@');
+    if (cp != NULL)
+      {
+	char *tmpbuf;
+	int len = 0;
+	int first;
 
-	  /* GOT relocations are not supported in 16 bit mode */
-	  if (flag_16bit_code)
-	    as_bad (_("GOT relocations not supported in 16 bit mode"));
+	/* GOT relocations are not supported in 16 bit mode */
+	if (flag_16bit_code)
+	  as_bad (_("GOT relocations not supported in 16 bit mode"));
 
-	  if (GOT_symbol == NULL)
-	    GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
+	if (GOT_symbol == NULL)
+	  GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
 
-	  if (strncmp (cp + 1, "PLT", 3) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
-	      len = 3;
-	    }
-	  else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
-	      len = 6;
-	    }
-	  else if (strncmp (cp + 1, "GOT", 3) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
-	      len = 3;
-	    }
-	  else
-	    as_bad (_("Bad reloc specifier in expression"));
+	if (strncmp (cp + 1, "PLT", 3) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
+	    len = 3;
+	  }
+	else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
+	    len = 6;
+	  }
+	else if (strncmp (cp + 1, "GOT", 3) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
+	    len = 3;
+	  }
+	else
+	  as_bad (_("bad reloc specifier in expression"));
 
-	  /* Replace the relocation token with ' ', so that errors like
-	     foo@GOTOFF1 will be detected.  */
-	  first = cp - input_line_pointer;
-	  tmpbuf = (char *) alloca (strlen(input_line_pointer));
-	  memcpy (tmpbuf, input_line_pointer, first);
-	  tmpbuf[first] = ' ';
-	  strcpy (tmpbuf + first + 1, cp + 1 + len);
-	  input_line_pointer = tmpbuf;
-	}
-    }
+	/* Replace the relocation token with ' ', so that errors like
+	   foo@GOTOFF1 will be detected.  */
+	first = cp - input_line_pointer;
+	tmpbuf = (char *) alloca (strlen(input_line_pointer));
+	memcpy (tmpbuf, input_line_pointer, first);
+	tmpbuf[first] = ' ';
+	strcpy (tmpbuf + first + 1, cp + 1 + len);
+	input_line_pointer = tmpbuf;
+      }
+  }
 #endif
 
   exp_seg = expression (exp);
 
+  SKIP_WHITESPACE ();
   if (*input_line_pointer)
-    as_bad (_("Ignoring junk `%s' after expression"), input_line_pointer);
+    as_bad (_("ignoring junk `%s' after expression"), input_line_pointer);
 
   input_line_pointer = save_input_line_pointer;
 
-  if (exp->X_op == O_absent)
+  if (exp->X_op == O_absent || exp->X_op == O_big)
     {
       /* missing or bad expr becomes absolute 0 */
-      as_bad (_("Missing or invalid immediate expression `%s' taken as 0"),
-              imm_start);
+      as_bad (_("missing or invalid immediate expression `%s' taken as 0"),
+	      imm_start);
       exp->X_op = O_constant;
       exp->X_add_number = 0;
       exp->X_add_symbol = (symbolS *) 0;
       exp->X_op_symbol = (symbolS *) 0;
-      i.types[this_operand] |= Imm;
     }
-  else if (exp->X_op == O_constant)
+
+  if (exp->X_op == O_constant)
     {
-      i.types[this_operand] |=
-	smallest_imm_type ((long) exp->X_add_number);
-  
-      /* If a suffix is given, this operand may be shortended. */
-      switch (i.suffix)
-        {
-        case WORD_MNEM_SUFFIX:
-          i.types[this_operand] |= Imm16;
-          break;
-        case BYTE_MNEM_SUFFIX:
-          i.types[this_operand] |= Imm16 | Imm8 | Imm8S;
-          break;
-        }
+      int bigimm = Imm32;
+      if (flag_16bit_code ^ (i.prefix[DATA_PREFIX] != 0))
+	bigimm = Imm16;
+      i.types[this_operand] |= bigimm;
     }
-#ifdef OBJ_AOUT
-  else if (exp_seg != text_section
-           && exp_seg != data_section
-           && exp_seg != bss_section
-           && exp_seg != undefined_section
+#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
+  else if (
 #ifdef BFD_ASSEMBLER
-           && !bfd_is_com_section (exp_seg)
+	   OUTPUT_FLAVOR == bfd_target_aout_flavour &&
 #endif
-          )
+	   exp_seg != text_section
+	   && exp_seg != data_section
+	   && exp_seg != bss_section
+	   && exp_seg != undefined_section
+#ifdef BFD_ASSEMBLER
+	   && !bfd_is_com_section (exp_seg)
+#endif
+	   )
     {
-    seg_unimplemented:
-      as_bad (_("Unimplemented segment type %d in operand"), exp_seg);
+#ifdef BFD_ASSEMBLER
+      as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
+#else
+      as_bad (_("unimplemented segment type %d in operand"), exp_seg);
+#endif
       return 0;
     }
 #endif
   else
     {
       /* This is an address.  The size of the address will be
-         determined later, depending on destination register,
-         suffix, or the default for the section.  We exclude
-         Imm8S here so that `push $foo' and other instructions
-         with an Imm8S form will use Imm16 or Imm32.  */
+	 determined later, depending on destination register,
+	 suffix, or the default for the section.  We exclude
+	 Imm8S here so that `push $foo' and other instructions
+	 with an Imm8S form will use Imm16 or Imm32.  */
       i.types[this_operand] |= (Imm8 | Imm16 | Imm32);
     }
 
@@ -2689,13 +2651,13 @@
     default:
     bad_scale:
       as_bad (_("expecting scale factor of 1, 2, 4, or 8: got `%s'"),
-              scale);
+	      scale);
       return 0;
     }
   if (i.log2_scale_factor != 0 && ! i.index_reg)
     {
       as_warn (_("scale factor of %d without an index register"),
-               1 << i.log2_scale_factor);
+	       1 << i.log2_scale_factor);
 #if SCALE1_WHEN_NO_INDEX
       i.log2_scale_factor = 0;
 #endif
@@ -2715,17 +2677,12 @@
   char *save_input_line_pointer;
   int bigdisp = Disp32;
 
-  /*  All of the pieces of the displacement expression are handled together. */
-  if (intel_syntax && i.disp_operands != 0)
-    return 1;
-
   if (flag_16bit_code ^ (i.prefix[ADDR_PREFIX] != 0))
     bigdisp = Disp16;
   i.types[this_operand] |= bigdisp;
 
   exp = &disp_expressions[i.disp_operands];
-  i.disps[this_operand] = exp;
-  i.disp_reloc[this_operand] = NO_RELOC;
+  i.op[this_operand].disps = exp;
   i.disp_operands++;
   save_input_line_pointer = input_line_pointer;
   input_line_pointer = disp_start;
@@ -2737,139 +2694,168 @@
 #if GCC_ASM_O_HACK
   END_STRING_AND_SAVE (disp_end + 1);
   if ((i.types[this_operand] & BaseIndex) != 0
-       && displacement_string_end[-1] == '+')
+      && displacement_string_end[-1] == '+')
     {
       /* This hack is to avoid a warning when using the "o"
-         constraint within gcc asm statements.
-         For instance:
+	 constraint within gcc asm statements.
+	 For instance:
 
-        #define _set_tssldt_desc(n,addr,limit,type) \
-        __asm__ __volatile__ ( \
-        "movw %w2,%0\n\t" \
-        "movw %w1,2+%0\n\t" \
-        "rorl $16,%1\n\t" \
-        "movb %b1,4+%0\n\t" \
-        "movb %4,5+%0\n\t" \
-        "movb $0,6+%0\n\t" \
-        "movb %h1,7+%0\n\t" \
-        "rorl $16,%1" \
-        : "=o"(*(n)) : "q" (addr), "ri"(limit), "i"(type))
+	 #define _set_tssldt_desc(n,addr,limit,type) \
+	 __asm__ __volatile__ ( \
+	 "movw %w2,%0\n\t" \
+	 "movw %w1,2+%0\n\t" \
+	 "rorl $16,%1\n\t" \
+	 "movb %b1,4+%0\n\t" \
+	 "movb %4,5+%0\n\t" \
+	 "movb $0,6+%0\n\t" \
+	 "movb %h1,7+%0\n\t" \
+	 "rorl $16,%1" \
+	 : "=o"(*(n)) : "q" (addr), "ri"(limit), "i"(type))
 
-        This works great except that the output assembler ends
-        up looking a bit weird if it turns out that there is
-        no offset.  You end up producing code that looks like:
+	 This works great except that the output assembler ends
+	 up looking a bit weird if it turns out that there is
+	 no offset.  You end up producing code that looks like:
 
-        #APP
-               movw $235,(%eax)
-               movw %dx,2+(%eax)
-               rorl $16,%edx
-               movb %dl,4+(%eax)
-               movb $137,5+(%eax)
-               movb $0,6+(%eax)
-               movb %dh,7+(%eax)
-               rorl $16,%edx
-        #NO_APP
+	 #APP
+	 movw $235,(%eax)
+	 movw %dx,2+(%eax)
+	 rorl $16,%edx
+	 movb %dl,4+(%eax)
+	 movb $137,5+(%eax)
+	 movb $0,6+(%eax)
+	 movb %dh,7+(%eax)
+	 rorl $16,%edx
+	 #NO_APP
 
-        So here we provide the missing zero.
-    */
+	 So here we provide the missing zero.
+      */
 
-    *displacement_string_end = '0';
+      *displacement_string_end = '0';
     }
 #endif
 #ifndef LEX_AT
+  {
+    /*
+     * We can have operands of the form
+     *   <symbol>@GOTOFF+<nnn>
+     * Take the easy way out here and copy everything
+     * into a temporary buffer...
+     */
+    register char *cp;
+
+    cp = strchr (input_line_pointer, '@');
+    if (cp != NULL)
+      {
+	char *tmpbuf;
+	int len = 0;
+	int first;
+
+	/* GOT relocations are not supported in 16 bit mode */
+	if (flag_16bit_code)
+	  as_bad (_("GOT relocations not supported in 16 bit mode"));
+
+	if (GOT_symbol == NULL)
+	  GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
+
+	if (strncmp (cp + 1, "PLT", 3) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
+	    len = 3;
+	  }
+	else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
+	    len = 6;
+	  }
+	else if (strncmp (cp + 1, "GOT", 3) == 0)
+	  {
+	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
+	    len = 3;
+	  }
+	else
+	  as_bad (_("bad reloc specifier in expression"));
+
+	/* Replace the relocation token with ' ', so that errors like
+	   foo@GOTOFF1 will be detected.  */
+	first = cp - input_line_pointer;
+	tmpbuf = (char *) alloca (strlen(input_line_pointer));
+	memcpy (tmpbuf, input_line_pointer, first);
+	tmpbuf[first] = ' ';
+	strcpy (tmpbuf + first + 1, cp + 1 + len);
+	input_line_pointer = tmpbuf;
+      }
+  }
+#endif
+
+  exp_seg = expression (exp);
+
+#ifdef BFD_ASSEMBLER
+  /* We do this to make sure that the section symbol is in
+     the symbol table.  We will ultimately change the relocation
+     to be relative to the beginning of the section */
+  if (i.disp_reloc[this_operand] == BFD_RELOC_386_GOTOFF)
     {
-      /*
-       * We can have operands of the form
-       *   <symbol>@GOTOFF+<nnn>
-       * Take the easy way out here and copy everything
-       * into a temporary buffer...
-       */
-      register char *cp;
-
-      cp = strchr (input_line_pointer, '@');
-      if (cp != NULL)
-        {
-	  char *tmpbuf;
-	  int len, first;
-
-	 /* GOT relocations are not supported in 16 bit mode */
-	 if (flag_16bit_code)
-	   as_bad (_("GOT relocations not supported in 16 bit mode"));
-
-	  if (GOT_symbol == NULL)
-	    GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
-
-	  if (strncmp (cp + 1, "PLT", 3) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
-	      len = 3;
-	    }
-	  else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
-	      len = 6;
-	    }
-	  else if (strncmp (cp + 1, "GOT", 3) == 0)
-	    {
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
-	      len = 3;
-	    }
-	  else
-	    as_bad (_("Bad reloc specifier in expression"));
-
-	  /* Replace the relocation token with ' ', so that errors like
-	     foo@GOTOFF1 will be detected.  */
-	  first = cp - input_line_pointer;
-	  tmpbuf = (char *) alloca (strlen(input_line_pointer));
-	  memcpy (tmpbuf, input_line_pointer, first);
-	  tmpbuf[first] = ' ';
-	  strcpy (tmpbuf + first + 1, cp + 1 + len);
-	  input_line_pointer = tmpbuf;
-	}
+      if (S_IS_LOCAL(exp->X_add_symbol)
+	  && S_GET_SEGMENT (exp->X_add_symbol) != undefined_section)
+	section_symbol (S_GET_SEGMENT (exp->X_add_symbol));
+      assert (exp->X_op == O_symbol);
+      exp->X_op = O_subtract;
+      exp->X_op_symbol = GOT_symbol;
+      i.disp_reloc[this_operand] = BFD_RELOC_32;
     }
 #endif
 
-    exp_seg = expression (exp);
-
-#ifdef BFD_ASSEMBLER
-    /* We do this to make sure that the section symbol is in
-       the symbol table.  We will ultimately change the relocation
-       to be relative to the beginning of the section */
-    if (i.disp_reloc[this_operand] == BFD_RELOC_386_GOTOFF)
-      {
-        if (S_IS_LOCAL(exp->X_add_symbol)
-            && S_GET_SEGMENT (exp->X_add_symbol) != undefined_section)
-          section_symbol(exp->X_add_symbol->bsym->section);
-        assert (exp->X_op == O_symbol);
-        exp->X_op = O_subtract;
-        exp->X_op_symbol = GOT_symbol;
-        i.disp_reloc[this_operand] = BFD_RELOC_32;
-      }
-#endif
-
-     if (*input_line_pointer)
-       as_bad (_("Ignoring junk `%s' after expression"),
-               input_line_pointer);
+  SKIP_WHITESPACE ();
+  if (*input_line_pointer)
+    as_bad (_("ignoring junk `%s' after expression"),
+	    input_line_pointer);
 #if GCC_ASM_O_HACK
-     RESTORE_END_STRING (disp_end + 1);
+  RESTORE_END_STRING (disp_end + 1);
 #endif
-     RESTORE_END_STRING (disp_end);
-     input_line_pointer = save_input_line_pointer;
+  RESTORE_END_STRING (disp_end);
+  input_line_pointer = save_input_line_pointer;
 
-     if (exp->X_op == O_constant)
-       {
-         if (fits_in_signed_byte (exp->X_add_number))
-           i.types[this_operand] |= Disp8;
-       }
-#ifdef OBJ_AOUT
-     else if (exp_seg != text_section
-              && exp_seg != data_section
-              && exp_seg != bss_section
-              && exp_seg != undefined_section)
-            {
-              as_bad (_ ("Unimplemented segment type %d in operand"), exp_seg);
-              return 0;
-            }
+  if (exp->X_op == O_absent || exp->X_op == O_big)
+    {
+      /* missing or bad expr becomes absolute 0 */
+      as_bad (_("missing or invalid displacement expression `%s' taken as 0"),
+	      disp_start);
+      exp->X_op = O_constant;
+      exp->X_add_number = 0;
+      exp->X_add_symbol = (symbolS *) 0;
+      exp->X_op_symbol = (symbolS *) 0;
+    }
+
+  if (exp->X_op == O_constant)
+    {
+      if (i.types[this_operand] & Disp16)
+	{
+	  /* We know this operand is at most 16 bits, so convert to a
+	     signed 16 bit number before trying to see whether it will
+	     fit in an even smaller size.  */
+	  exp->X_add_number =
+	    (((exp->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
+	}
+      if (fits_in_signed_byte (exp->X_add_number))
+	i.types[this_operand] |= Disp8;
+    }
+#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
+  else if (
+#ifdef BFD_ASSEMBLER
+	   OUTPUT_FLAVOR == bfd_target_aout_flavour &&
+#endif
+	   exp_seg != text_section
+	   && exp_seg != data_section
+	   && exp_seg != bss_section
+	   && exp_seg != undefined_section)
+    {
+#ifdef BFD_ASSEMBLER
+      as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
+#else
+      as_bad (_("unimplemented segment type %d in operand"), exp_seg);
+#endif
+      return 0;
+    }
 #endif
   return 1;
 }
@@ -2881,64 +2867,67 @@
      char **op_string;
      int got_a_float;
 {
-    if (!strncasecmp (*op_string, "BYTE PTR", 8))
-      {
-        i.suffix = BYTE_MNEM_SUFFIX;
-        *op_string += 8;
-        return BYTE_PTR;
+  if (!strncasecmp (*op_string, "BYTE PTR", 8))
+    {
+      i.suffix = BYTE_MNEM_SUFFIX;
+      *op_string += 8;
+      return BYTE_PTR;
 
-      }
-    else if (!strncasecmp (*op_string, "WORD PTR", 8))
-      {
-        i.suffix = WORD_MNEM_SUFFIX;
-        *op_string += 8;
-        return WORD_PTR;
-      }
+    }
+  else if (!strncasecmp (*op_string, "WORD PTR", 8))
+    {
+      if (got_a_float == 2)	/* "fi..." */
+	i.suffix = SHORT_MNEM_SUFFIX;
+      else
+	i.suffix = WORD_MNEM_SUFFIX;
+      *op_string += 8;
+      return WORD_PTR;
+    }
 
-    else if (!strncasecmp (*op_string, "DWORD PTR", 9))
-      {
-        if (got_a_float)
-          i.suffix = SHORT_MNEM_SUFFIX;
-        else
-          i.suffix = DWORD_MNEM_SUFFIX;
-        *op_string += 9;
-        return DWORD_PTR;
-      }
+  else if (!strncasecmp (*op_string, "DWORD PTR", 9))
+    {
+      if (got_a_float == 1)	/* "f..." */
+	i.suffix = SHORT_MNEM_SUFFIX;
+      else
+	i.suffix = LONG_MNEM_SUFFIX;
+      *op_string += 9;
+      return DWORD_PTR;
+    }
 
-    else if (!strncasecmp (*op_string, "QWORD PTR", 9))
-      {
-        i.suffix = INTEL_DWORD_MNEM_SUFFIX;
-        *op_string += 9;
-        return QWORD_PTR;
-      }
+  else if (!strncasecmp (*op_string, "QWORD PTR", 9))
+    {
+      i.suffix = DWORD_MNEM_SUFFIX;
+      *op_string += 9;
+      return QWORD_PTR;
+    }
 
-    else if (!strncasecmp (*op_string, "XWORD PTR", 9))
-      {
-        i.suffix = LONG_DOUBLE_MNEM_SUFFIX;
-        *op_string += 9;
-        return XWORD_PTR;
-      }
+  else if (!strncasecmp (*op_string, "XWORD PTR", 9))
+    {
+      i.suffix = LONG_DOUBLE_MNEM_SUFFIX;
+      *op_string += 9;
+      return XWORD_PTR;
+    }
 
-    else if (!strncasecmp (*op_string, "SHORT", 5))
-      {
-        *op_string += 5;
-        return SHORT;
-      }
+  else if (!strncasecmp (*op_string, "SHORT", 5))
+    {
+      *op_string += 5;
+      return SHORT;
+    }
 
-    else if (!strncasecmp (*op_string, "OFFSET FLAT:", 12))
-      {
-        *op_string += 12;
-        return OFFSET_FLAT;
-      }
+  else if (!strncasecmp (*op_string, "OFFSET FLAT:", 12))
+    {
+      *op_string += 12;
+      return OFFSET_FLAT;
+    }
 
-    else if (!strncasecmp (*op_string, "FLAT", 4))
-      {
-        *op_string += 4;
-        return FLAT;
-      }
+  else if (!strncasecmp (*op_string, "FLAT", 4))
+    {
+      *op_string += 4;
+      return FLAT;
+    }
 
-    else return NONE_FOUND;
-} 
+  else return NONE_FOUND;
+}
 
 static char * build_displacement_string PARAMS ((int, char *));
 
@@ -2954,10 +2943,10 @@
 
   temp_string[0] = '\0';
   tc = end_of_operand_string = strchr (op_string, '[');
-  if ( initial_disp && !end_of_operand_string)
+  if (initial_disp && !end_of_operand_string)
     {
       strcpy (temp_string, op_string);
-      return (temp_string);
+      return temp_string;
     }
 
   /* Build the whole displacement string */
@@ -2967,45 +2956,46 @@
       temp_string[end_of_operand_string - op_string] = '\0';
       temp_disp = tc;
     }
-  else 
+  else
     temp_disp = op_string;
 
   while (*temp_disp != '\0')
     {
+      char *end_op;
       int add_minus = (*temp_disp == '-');
 
       if (*temp_disp == '+' || *temp_disp == '-' || *temp_disp == '[')
-        temp_disp++;
+	temp_disp++;
 
       if (is_space_char (*temp_disp))
-        temp_disp++;
+	temp_disp++;
 
       /* Don't consider registers */
-      if (*temp_disp != REGISTER_PREFIX
-          && !(allow_naked_reg && i386_is_reg (temp_disp)))
-        {
-          char *string_start = temp_disp;
+      if ( !((*temp_disp == REGISTER_PREFIX || allow_naked_reg)
+	     && parse_register (temp_disp, &end_op)) )
+	{
+	  char *string_start = temp_disp;
 
-          while (*temp_disp != ']'
-                 && *temp_disp != '+'
-                 && *temp_disp != '-'
-                 && *temp_disp != '*')
-            ++temp_disp;
+	  while (*temp_disp != ']'
+		 && *temp_disp != '+'
+		 && *temp_disp != '-'
+		 && *temp_disp != '*')
+	    ++temp_disp;
 
-          if (add_minus)
-            strcat (temp_string, "-");
-          else
-            strcat (temp_string, "+");
+	  if (add_minus)
+	    strcat (temp_string, "-");
+	  else
+	    strcat (temp_string, "+");
 
-          strncat (temp_string, string_start, temp_disp - string_start);
-          if (*temp_disp == '+' || *temp_disp == '-')
-            --temp_disp;
-        }
+	  strncat (temp_string, string_start, temp_disp - string_start);
+	  if (*temp_disp == '+' || *temp_disp == '-')
+	    --temp_disp;
+	}
 
       while (*temp_disp != '\0'
-             && *temp_disp != '+'
-             && *temp_disp != '-')
-        ++temp_disp;
+	     && *temp_disp != '+'
+	     && *temp_disp != '-')
+	++temp_disp;
     }
 
   return temp_string;
@@ -3048,8 +3038,8 @@
 
   if (*op_string++ != 's')
     {
-       as_bad (_("bad segment name `%s'"), op_string);
-       return 0;
+      as_bad (_("bad segment name `%s'"), op_string);
+      return 0;
     }
 
   if (is_space_char (*op_string))
@@ -3057,59 +3047,134 @@
 
   if (*op_string != ':')
     {
-       as_bad (_("bad segment name `%s'"), op_string);
-       return 0;
+      as_bad (_("bad segment name `%s'"), op_string);
+      return 0;
     }
 
-  return 1; 
-  
+  return 1;
+
+}
+
+static int i386_index_check PARAMS((const char *));
+
+/* Make sure the memory operand we've been dealt is valid.
+   Returns 1 on success, 0 on a failure.
+*/
+static int
+i386_index_check (operand_string)
+     const char *operand_string;
+{
+#if INFER_ADDR_PREFIX
+  int fudged = 0;
+
+ tryprefix:
+#endif
+  if (flag_16bit_code ^ (i.prefix[ADDR_PREFIX] != 0)
+      /* 16 bit mode checks */
+      ? ((i.base_reg
+	  && ((i.base_reg->reg_type & (Reg16|BaseIndex))
+	      != (Reg16|BaseIndex)))
+	 || (i.index_reg
+	     && (((i.index_reg->reg_type & (Reg16|BaseIndex))
+		  != (Reg16|BaseIndex))
+		 || ! (i.base_reg
+		       && i.base_reg->reg_num < 6
+		       && i.index_reg->reg_num >= 6
+		       && i.log2_scale_factor == 0))))
+      /* 32 bit mode checks */
+      : ((i.base_reg
+	  && (i.base_reg->reg_type & Reg32) == 0)
+	 || (i.index_reg
+	     && ((i.index_reg->reg_type & (Reg32|BaseIndex))
+		 != (Reg32|BaseIndex)))))
+    {
+#if INFER_ADDR_PREFIX
+      if (i.prefix[ADDR_PREFIX] == 0 && stackop_size != '\0')
+	{
+	  i.prefix[ADDR_PREFIX] = ADDR_PREFIX_OPCODE;
+	  i.prefixes += 1;
+	  /* Change the size of any displacement too.  At most one of
+	     Disp16 or Disp32 is set.
+	     FIXME.  There doesn't seem to be any real need for separate
+	     Disp16 and Disp32 flags.  The same goes for Imm16 and Imm32.
+	     Removing them would probably clean up the code quite a lot.
+	  */
+	  if (i.types[this_operand] & (Disp16|Disp32))
+	     i.types[this_operand] ^= (Disp16|Disp32);
+	  fudged = 1;
+	  goto tryprefix;
+	}
+      if (fudged)
+	as_bad (_("`%s' is not a valid base/index expression"),
+		operand_string);
+      else
+#endif
+	as_bad (_("`%s' is not a valid %s bit base/index expression"),
+		operand_string,
+		flag_16bit_code ^ (i.prefix[ADDR_PREFIX] != 0) ? "16" : "32");
+      return 0;
+    }
+  return 1;
 }
 
 static int i386_intel_memory_operand PARAMS ((char *));
 
 static int
-i386_intel_memory_operand (op_string)
-     char *op_string;
+i386_intel_memory_operand (operand_string)
+     char *operand_string;
 {
-
+  char *op_string = operand_string;
   char *end_of_operand_string;
 
-  if (is_digit_char (*op_string)
-      && strchr (op_string, '[') == 0)
+  if ((i.mem_operands == 1
+       && (current_templates->start->opcode_modifier & IsString) == 0)
+      || i.mem_operands == 2)
     {
-      if (!i386_immediate (op_string))
-        return 0;
-      else
-        return 1;
+      as_bad (_("too many memory references for `%s'"),
+	      current_templates->start->name);
+      return 0;
+    }
+
+  /* First check for a segment override.  */
+  if (*op_string != '[')
+    {
+      char *end_seg;
+
+      end_seg = strchr (op_string, ':');
+      if (end_seg)
+	{
+	  if (!i386_parse_seg (op_string))
+	    return 0;
+	  op_string = end_seg + 1;
+	}
     }
 
   /* Look for displacement preceding open bracket */
   if (*op_string != '[')
     {
-      char *end_seg;
       char *temp_string;
 
-      end_seg = strchr (op_string, ':');
-      if (end_seg)
-        {
-           if (!i386_parse_seg (op_string))
-             return 0;
-           op_string = end_seg + 1;
-        }
+      if (i.disp_operands)
+	return 0;
 
       temp_string = build_displacement_string (true, op_string);
+
       if (!i386_displacement (temp_string, temp_string + strlen (temp_string)))
-        return 0;
+	{
+	  free (temp_string);
+	  return 0;
+	}
+      free (temp_string);
 
       end_of_operand_string = strchr (op_string, '[');
       if (!end_of_operand_string)
-        end_of_operand_string = op_string + strlen (op_string);
+	end_of_operand_string = op_string + strlen (op_string);
 
       if (is_space_char (*end_of_operand_string))
-        --end_of_operand_string;
+	--end_of_operand_string;
 
       op_string = end_of_operand_string;
-     }
+    }
 
   if (*op_string == '[')
     {
@@ -3120,92 +3185,101 @@
       end_of_operand_string = op_string;
 
       while (*op_string != ']')
-        {
+	{
+	  const reg_entry *temp_reg;
+	  char *end_op;
+	  char *temp_string;
 
-          while (*end_of_operand_string != '+'
-                 && *end_of_operand_string != '-'
-                 && *end_of_operand_string != '*'
-                 && *end_of_operand_string != ']')
-            end_of_operand_string++;
+	  while (*end_of_operand_string != '+'
+		 && *end_of_operand_string != '-'
+		 && *end_of_operand_string != '*'
+		 && *end_of_operand_string != ']')
+	    end_of_operand_string++;
 
-          if (*op_string == '+')
-            {
-              char *temp_string = op_string + 1;
-              if (is_space_char (*temp_string))
-                ++temp_string;
-              if (*temp_string == REGISTER_PREFIX
-                  || (allow_naked_reg && i386_is_reg (temp_string)))
-                ++op_string;
-            }
+	  temp_string = op_string;
+	  if (*temp_string == '+')
+	    {
+	      ++temp_string;
+	      if (is_space_char (*temp_string))
+		++temp_string;
+	    }
 
-          if (*op_string == REGISTER_PREFIX
-              || (allow_naked_reg && i386_is_reg (op_string)))
-            {
-              const reg_entry *temp_reg;
-              char *end_op;
+	  if ((*temp_string == REGISTER_PREFIX || allow_naked_reg)
+	      && (temp_reg = parse_register (temp_string, &end_op)) != NULL)
+	    {
+	      if (i.base_reg == NULL)
+		i.base_reg = temp_reg;
+	      else
+		i.index_reg = temp_reg;
 
-              END_STRING_AND_SAVE (end_of_operand_string);
-              temp_reg = parse_register (op_string, &end_op);
-              RESTORE_END_STRING (end_of_operand_string);
+	      i.types[this_operand] |= BaseIndex;
+	    }
+	  else if (*temp_string == REGISTER_PREFIX)
+	    {
+	      as_bad (_("bad register name `%s'"), temp_string);
+	      return 0;
+	    }
+	  else if (is_digit_char (*op_string)
+		   || *op_string == '+' || *op_string == '-')
+	    {
+	      char *temp_str;
 
-              if (temp_reg == NULL)
-                return 0;
+	      if (i.disp_operands != 0)
+		return 0;
 
-              if (i.base_reg == NULL)
-                i.base_reg = temp_reg;
-              else
-                i.index_reg = temp_reg;
+	      temp_string = build_displacement_string (false, op_string);
 
-              i.types[this_operand] |= BaseIndex;
+	      temp_str = temp_string;
+	      if (*temp_str == '+')
+		++temp_str;
 
-            }
-          else if (is_digit_char (*op_string) || *op_string == '+' || *op_string == '-')
-            {
+	      if (!i386_displacement (temp_str, temp_str + strlen (temp_str)))
+		{
+		  free (temp_string);
+		  return 0;
+		}
+	      free (temp_string);
 
-              char *temp_string = build_displacement_string (false, op_string);
+	      ++op_string;
+	      end_of_operand_string = op_string;
+	      while (*end_of_operand_string != ']'
+		     && *end_of_operand_string != '+'
+		     && *end_of_operand_string != '-'
+		     && *end_of_operand_string != '*')
+		++end_of_operand_string;
+	    }
+	  else if (*op_string == '*')
+	    {
+	      ++op_string;
 
-              if (*temp_string == '+')
-                ++temp_string;
+	      if (i.base_reg && !i.index_reg)
+		{
+		  i.index_reg = i.base_reg;
+		  i.base_reg = 0;
+		}
 
-              if (!i386_displacement (temp_string, temp_string + strlen (temp_string)))
-                return 0;
-             
-              ++op_string;
-              end_of_operand_string = op_string;
-              while (*end_of_operand_string != ']'
-                     && *end_of_operand_string != '+'
-                     && *end_of_operand_string != '-'
-                     && *end_of_operand_string != '*')
-               ++end_of_operand_string;
-            }
-          else if (*op_string == '*')
-            {
-              ++op_string;
-
-              if (i.base_reg && !i.index_reg)
-                {
-                  i.index_reg = i.base_reg;
-                  i.base_reg = 0;
-                }
-
-              if (!i386_scale (op_string))
-                return 0;
-            }
-          op_string = end_of_operand_string;
-          ++end_of_operand_string;
-        }
+	      if (!i386_scale (op_string))
+		return 0;
+	    }
+	  op_string = end_of_operand_string;
+	  ++end_of_operand_string;
+	}
     }
 
+  if (i386_index_check (operand_string) == 0)
+    return 0;
+
+  i.mem_operands++;
   return 1;
 }
 
-static int i386_intel_operand PARAMS ((char *, int));
-
 static int
 i386_intel_operand (operand_string, got_a_float)
      char *operand_string;
      int got_a_float;
 {
+  const reg_entry * r;
+  char *end_op;
   char *op_string = operand_string;
 
   int operand_modifier = i386_operand_modifier (&op_string, got_a_float);
@@ -3219,151 +3293,85 @@
     case DWORD_PTR:
     case QWORD_PTR:
     case XWORD_PTR:
-      if ((i.mem_operands == 1
-           && (current_templates->start->opcode_modifier & IsString) == 0)
-          || i.mem_operands == 2)
-        {
-          as_bad (_("too many memory references for `%s'"),
-                  current_templates->start->name);
-          return 0;
-        }
-
       if (!i386_intel_memory_operand (op_string))
-        return 0;
-
-      i.mem_operands++;
+	return 0;
       break;
 
     case FLAT:
-
     case OFFSET_FLAT:
       if (!i386_immediate (op_string))
-        return 0;
+	return 0;
       break;
 
     case SHORT:
-
     case NONE_FOUND:
-    /* Should be register or immediate */
-    if (is_digit_char (*op_string)
-        && strchr (op_string, '[') == 0)
-      {
-      if (!i386_immediate (op_string))
-        return 0;
-      }
-    else if (*op_string == REGISTER_PREFIX
-             || (allow_naked_reg
-	         && i386_is_reg (op_string)))
-      {
-
-        register const reg_entry * r;
-        char *end_op;
-
-        r = parse_register (op_string, &end_op);
-        if (r == NULL)
-          return 0;
-
-        /* Check for a segment override by searching for ':' after a
-           segment register.  */
-        op_string = end_op;
-        if (is_space_char (*op_string))
-          ++op_string;
-        if (*op_string == ':' && (r->reg_type & (SReg2 | SReg3)))
-          {
-            switch (r->reg_num)
-              {
-              case 0:
-                i.seg[i.mem_operands] = &es;
-                break;
-              case 1:
-                i.seg[i.mem_operands] = &cs;
-                break;
-              case 2:
-                i.seg[i.mem_operands] = &ss;
-                break;
-              case 3:
-                i.seg[i.mem_operands] = &ds;
-                break;
-              case 4:
-                i.seg[i.mem_operands] = &fs;
-                break;
-              case 5:
-                i.seg[i.mem_operands] = &gs;
-                break;
-              }
-
-          }
-        i.types[this_operand] |= r->reg_type & ~BaseIndex;
-        i.regs[this_operand] = r;
-        i.reg_operands++;
-      }
-
-    else 
-      {
-
-        if (!i386_intel_memory_operand (op_string))
-          return 0;
-
-        i.mem_operands++;
-      }
-    break;
-
-  }  /* end switch */
-  /* Special case for (%dx) while doing input/output op.  */
-  if (i.base_reg
-      && i.base_reg->reg_type == (Reg16 | InOutPortReg)
-      && i.index_reg == 0
-      && i.log2_scale_factor == 0
-      && i.seg[i.mem_operands] == 0
-      && (i.types[this_operand] & Disp) == 0)
-     {
-       i.types[this_operand] = InOutPortReg;
-       return 1;
-     }
-  /* Make sure the memory operand we've been dealt is valid.  */
-  if (flag_16bit_code ^ (i.prefix[ADDR_PREFIX] != 0))
-    {
-      if ((i.base_reg
-	   && ((i.base_reg->reg_type & (Reg16|BaseIndex))
-		!= (Reg16|BaseIndex)))
-	      || (i.index_reg
-		  && (((i.index_reg->reg_type & (Reg16|BaseIndex))
-		       != (Reg16|BaseIndex))
-		      || ! (i.base_reg
-			    && i.base_reg->reg_num < 6
-			    && i.index_reg->reg_num >= 6
-			    && i.log2_scale_factor == 0))))
-	 {
-	   as_bad (_("`%s' is not a valid %s bit base/index expression"),
-                   operand_string, "16");
-           return 0;
-	 }
-    }
-      else
+      /* Should be register or immediate */
+      if (is_digit_char (*op_string)
+	  && strchr (op_string, '[') == 0)
 	{
-	  if ((i.base_reg
-	       && (i.base_reg->reg_type & Reg32) == 0)
-	      || (i.index_reg
-		  && ((i.index_reg->reg_type & (Reg32|BaseIndex))
-		      != (Reg32|BaseIndex))))
-	    {
-	      as_bad (_("`%s' is not a valid %s bit base/index expression"),
-		      operand_string, "32");
-	      return 0;
-	    }
+	  if (!i386_immediate (op_string))
+	    return 0;
 	}
+      else if ((*op_string == REGISTER_PREFIX || allow_naked_reg)
+	       && (r = parse_register (op_string, &end_op)) != NULL)
+	{
+	  /* Check for a segment override by searching for ':' after a
+	     segment register.  */
+	  op_string = end_op;
+	  if (is_space_char (*op_string))
+	    ++op_string;
+	  if (*op_string == ':' && (r->reg_type & (SReg2 | SReg3)))
+	    {
+	      switch (r->reg_num)
+		{
+		case 0:
+		  i.seg[i.mem_operands] = &es;
+		  break;
+		case 1:
+		  i.seg[i.mem_operands] = &cs;
+		  break;
+		case 2:
+		  i.seg[i.mem_operands] = &ss;
+		  break;
+		case 3:
+		  i.seg[i.mem_operands] = &ds;
+		  break;
+		case 4:
+		  i.seg[i.mem_operands] = &fs;
+		  break;
+		case 5:
+		  i.seg[i.mem_operands] = &gs;
+		  break;
+		}
+
+	    }
+	  i.types[this_operand] |= r->reg_type & ~BaseIndex;
+	  i.op[this_operand].regs = r;
+	  i.reg_operands++;
+	}
+      else if (*op_string == REGISTER_PREFIX)
+	{
+	  as_bad (_("bad register name `%s'"), op_string);
+	  return 0;
+	}
+      else if (!i386_intel_memory_operand (op_string))
+	return 0;
+
+      break;
+    }  /* end switch */
+
   return 1;
 }
 
 /* Parse OPERAND_STRING into the i386_insn structure I.  Returns non-zero
    on error. */
 
-static int i386_operand PARAMS ((char *));
-
 static int
 i386_operand (operand_string)
      char *operand_string;
 {
+  const reg_entry *r;
+  char *end_op;
   char *op_string = operand_string;
 
   if (is_space_char (*op_string))
@@ -3375,31 +3383,24 @@
     {
       ++op_string;
       if (is_space_char (*op_string))
-        ++op_string;
+	++op_string;
       i.types[this_operand] |= JumpAbsolute;
     }
 
   /* Check if operand is a register. */
-  if (*op_string == REGISTER_PREFIX
-      || (allow_naked_reg && i386_is_reg (op_string)))
+  if ((*op_string == REGISTER_PREFIX || allow_naked_reg)
+      && (r = parse_register (op_string, &end_op)) != NULL)
     {
-      register const reg_entry *r;
-      char *end_op;
-
-      r = parse_register (op_string, &end_op);
-      if (r == NULL)
-        return 0;
-
       /* Check for a segment override by searching for ':' after a
 	 segment register.  */
       op_string = end_op;
       if (is_space_char (*op_string))
-        ++op_string;
+	++op_string;
       if (*op_string == ':' && (r->reg_type & (SReg2 | SReg3)))
-        {
-          switch (r->reg_num)
-            {
-            case 0:
+	{
+	  switch (r->reg_num)
+	    {
+	    case 0:
 	      i.seg[i.mem_operands] = &es;
 	      break;
 	    case 1:
@@ -3424,8 +3425,6 @@
 	  if (is_space_char (*op_string))
 	    ++op_string;
 
-	  /* Pretend given string starts here. */
-	  operand_string = op_string;
 	  if (!is_digit_char (*op_string)
 	      && !is_identifier_char (*op_string)
 	      && *op_string != '('
@@ -3446,34 +3445,41 @@
 	}
       if (*op_string)
 	{
-	  as_bad (_("Junk `%s' after register"), op_string);
+	  as_bad (_("junk `%s' after register"), op_string);
 	  return 0;
 	}
       i.types[this_operand] |= r->reg_type & ~BaseIndex;
-      i.regs[this_operand] = r;
+      i.op[this_operand].regs = r;
       i.reg_operands++;
     }
+  else if (*op_string == REGISTER_PREFIX)
+    {
+      as_bad (_("bad register name `%s'"), op_string);
+      return 0;
+    }
   else if (*op_string == IMMEDIATE_PREFIX)
     {				/* ... or an immediate */
       ++op_string;
+      if (i.types[this_operand] & JumpAbsolute)
+	{
+	  as_bad (_("immediate operand illegal with absolute jump"));
+	  return 0;
+	}
       if (!i386_immediate (op_string))
-        return 0;
+	return 0;
     }
-  else if (is_digit_char (*op_string) 
-           || is_identifier_char (*op_string)
+  else if (is_digit_char (*op_string)
+	   || is_identifier_char (*op_string)
 	   || *op_string == '(' )
     {
       /* This is a memory reference of some sort. */
-      char *end_of_operand_string;
-      register char *base_string;
-      int found_base_index_form;
+      char *base_string;
 
       /* Start and end of displacement string expression (if found). */
       char *displacement_string_start;
       char *displacement_string_end;
 
     do_memory_reference:
-
       if ((i.mem_operands == 1
 	   && (current_templates->start->opcode_modifier & IsString) == 0)
 	  || i.mem_operands == 2)
@@ -3487,17 +3493,19 @@
 	 looking for an ')' at the end of the operand, searching
 	 for the '(' matching it, and finding a REGISTER_PREFIX or ','
 	 after the '('.  */
-      found_base_index_form = 0;
-      end_of_operand_string = op_string + strlen (op_string);
+      base_string = op_string + strlen (op_string);
 
-      --end_of_operand_string;
-      if (is_space_char (*end_of_operand_string))
-	--end_of_operand_string;
+      --base_string;
+      if (is_space_char (*base_string))
+	--base_string;
 
-      base_string = end_of_operand_string;
+      /* If we only have a displacement, set-up for it to be parsed later. */
+      displacement_string_start = op_string;
+      displacement_string_end = base_string + 1;
 
       if (*base_string == ')')
 	{
+	  char *temp_string;
 	  unsigned int parens_balanced = 1;
 	  /* We've already checked that the number of left & right ()'s are
 	     equal, so this loop will not be infinite. */
@@ -3511,115 +3519,93 @@
 	    }
 	  while (parens_balanced);
 
-	  /* If there is a displacement set-up for it to be parsed later. */
-	  displacement_string_start = op_string;
-	  displacement_string_end = base_string;
+	  temp_string = base_string;
 
 	  /* Skip past '(' and whitespace.  */
 	  ++base_string;
 	  if (is_space_char (*base_string))
 	    ++base_string;
 
-	  if (*base_string == REGISTER_PREFIX
-	      || (allow_naked_reg && i386_is_reg (base_string))
-	      || *base_string == ',')
-	    found_base_index_form = 1;
-	}
-
-      /* If we can't parse a base index register expression, we've found
-	 a pure displacement expression.  We set up displacement_string_start
-	 and displacement_string_end for the code below. */
-      if (!found_base_index_form)
-	{
-	  displacement_string_start = op_string;
-	  displacement_string_end = end_of_operand_string + 1;
-	}
-      else
-	{
-	  i.types[this_operand] |= BaseIndex;
-
-	  /* Find base register (if any). */
-	  if (*base_string != ',')
+	  if (*base_string == ','
+	      || ((*base_string == REGISTER_PREFIX || allow_naked_reg)
+		  && (i.base_reg = parse_register (base_string, &end_op)) != NULL))
 	    {
-	      char *end_op;
+	      displacement_string_end = temp_string;
 
-	      /* Trim off the closing ')' so that parse_register won't
-		 see it.  */
-	      END_STRING_AND_SAVE (end_of_operand_string);
-	      i.base_reg = parse_register (base_string, &end_op);
-	      RESTORE_END_STRING (end_of_operand_string);
+	      i.types[this_operand] |= BaseIndex;
 
-	      if (i.base_reg == NULL)
-		return 0;
-
-	      base_string = end_op;
-	      if (is_space_char (*base_string))
-		++base_string;
-	    }
-
-	  /* There may be an index reg or scale factor here.  */
-	  if (*base_string == ',')
-	    {
-	      ++base_string;
-	      if (is_space_char (*base_string))
-		++base_string;
-
-	      if (*base_string == REGISTER_PREFIX
-		  || (allow_naked_reg && i386_is_reg (base_string)))
+	      if (i.base_reg)
 		{
-		  char *end_op;
-
-		  END_STRING_AND_SAVE (end_of_operand_string);
-		  i.index_reg = parse_register (base_string, &end_op);
-		  RESTORE_END_STRING (end_of_operand_string);
-
-		  if (i.index_reg == NULL)
-		    return 0;
-
 		  base_string = end_op;
 		  if (is_space_char (*base_string))
 		    ++base_string;
-		  if (*base_string == ',')
-		    {
-		      ++base_string;
-		      if (is_space_char (*base_string))
-			++base_string;
-		    }
-		  else if (*base_string != ')' )
-		    {
-		      as_bad (_("expecting `,' or `)' after index register in `%s'"),
-			      operand_string);
-		      return 0;
-		    }
 		}
 
-	      /* Check for scale factor. */
-	      if (isdigit ((unsigned char) *base_string))
+	      /* There may be an index reg or scale factor here.  */
+	      if (*base_string == ',')
 		{
-                  if (!i386_scale (base_string))
-                    return 0;
-
 		  ++base_string;
 		  if (is_space_char (*base_string))
 		    ++base_string;
-		  if (*base_string != ')')
+
+		  if ((*base_string == REGISTER_PREFIX || allow_naked_reg)
+		      && (i.index_reg = parse_register (base_string, &end_op)) != NULL)
 		    {
-		      as_bad (_("expecting `)' after scale factor in `%s'"),
-			      operand_string);
+		      base_string = end_op;
+		      if (is_space_char (*base_string))
+			++base_string;
+		      if (*base_string == ',')
+			{
+			  ++base_string;
+			  if (is_space_char (*base_string))
+			    ++base_string;
+			}
+		      else if (*base_string != ')' )
+			{
+			  as_bad (_("expecting `,' or `)' after index register in `%s'"),
+				  operand_string);
+			  return 0;
+			}
+		    }
+		  else if (*base_string == REGISTER_PREFIX)
+		    {
+		      as_bad (_("bad register name `%s'"), base_string);
+		      return 0;
+		    }
+
+		  /* Check for scale factor. */
+		  if (isdigit ((unsigned char) *base_string))
+		    {
+		      if (!i386_scale (base_string))
+			return 0;
+
+		      ++base_string;
+		      if (is_space_char (*base_string))
+			++base_string;
+		      if (*base_string != ')')
+			{
+			  as_bad (_("expecting `)' after scale factor in `%s'"),
+				  operand_string);
+			  return 0;
+			}
+		    }
+		  else if (!i.index_reg)
+		    {
+		      as_bad (_("expecting index register or scale factor after `,'; got '%c'"),
+			      *base_string);
 		      return 0;
 		    }
 		}
-	      else if (!i.index_reg)
+	      else if (*base_string != ')')
 		{
-		  as_bad (_("expecting index register or scale factor after `,'; got '%c'"),
-			  *base_string);
+		  as_bad (_("expecting `,' or `)' after base register in `%s'"),
+			  operand_string);
 		  return 0;
 		}
 	    }
-	  else if (*base_string != ')')
+	  else if (*base_string == REGISTER_PREFIX)
 	    {
-	      as_bad (_("expecting `,' or `)' after base register in `%s'"),
-		      operand_string);
+	      as_bad (_("bad register name `%s'"), base_string);
 	      return 0;
 	    }
 	}
@@ -3629,9 +3615,9 @@
 	 displacement_string_end are meaningful.  */
       if (displacement_string_start != displacement_string_end)
 	{
-          if (!i386_displacement (displacement_string_start, 
-                                  displacement_string_end))
-            return 0;
+	  if (!i386_displacement (displacement_string_start,
+				  displacement_string_end))
+	    return 0;
 	}
 
       /* Special case for (%dx) while doing input/output op.  */
@@ -3645,38 +3631,9 @@
 	  i.types[this_operand] = InOutPortReg;
 	  return 1;
 	}
-      /* Make sure the memory operand we've been dealt is valid.  */
-      if (flag_16bit_code ^ (i.prefix[ADDR_PREFIX] != 0))
-	{
-	  if ((i.base_reg
-	       && ((i.base_reg->reg_type & (Reg16|BaseIndex))
-		   != (Reg16|BaseIndex)))
-	      || (i.index_reg
-		  && (((i.index_reg->reg_type & (Reg16|BaseIndex))
-		       != (Reg16|BaseIndex))
-		      || ! (i.base_reg
-			    && i.base_reg->reg_num < 6
-			    && i.index_reg->reg_num >= 6
-			    && i.log2_scale_factor == 0))))
-	    {
-	      as_bad (_("`%s' is not a valid %s bit base/index expression"),
-		      operand_string, "16");
-	      return 0;
-	    }
-	}
-      else
-	{
-	  if ((i.base_reg
-	       && (i.base_reg->reg_type & Reg32) == 0)
-	      || (i.index_reg
-		  && ((i.index_reg->reg_type & (Reg32|BaseIndex))
-		      != (Reg32|BaseIndex))))
-	    {
-	      as_bad (_("`%s' is not a valid %s bit base/index expression"),
-		      operand_string, "32");
-	      return 0;
-	    }
-	}
+
+      if (i386_index_check (operand_string) == 0)
+	return 0;
       i.mem_operands++;
     }
   else
@@ -3691,7 +3648,7 @@
 }
 
 /*
- *			md_estimate_size_before_relax()
+ * md_estimate_size_before_relax()
  *
  * Called just before relax().
  * Any symbol that is now undefined will not become defined.
@@ -3719,7 +3676,24 @@
       /* symbol is undefined in this segment */
       int code16 = fragP->fr_subtype & CODE16;
       int size = code16 ? 2 : 4;
-      int pcrel_reloc = code16 ? BFD_RELOC_16_PCREL : BFD_RELOC_32_PCREL;
+#ifdef BFD_ASSEMBLER
+      enum bfd_reloc_code_real reloc_type;
+#else
+      int reloc_type;
+#endif
+
+      if (GOT_symbol /* Not quite right - we should switch on presence of
+			@PLT, but I cannot see how to get to that from
+			here.  We should have done this in md_assemble to
+			really get it right all of the time, but I think it
+			does not matter that much, as this will be right
+			most of the time. ERY  */
+	  && S_GET_SEGMENT(fragP->fr_symbol) == undefined_section)
+	reloc_type = BFD_RELOC_386_PLT32;
+      else if (code16)
+	reloc_type = BFD_RELOC_16_PCREL;
+      else
+	reloc_type = BFD_RELOC_32_PCREL;
 
       switch (opcode[0])
 	{
@@ -3729,31 +3703,19 @@
 	  fix_new (fragP, old_fr_fix, size,
 		   fragP->fr_symbol,
 		   fragP->fr_offset, 1,
-		   (GOT_symbol && /* Not quite right - we should switch on
-				     presence of @PLT, but I cannot see how
-				     to get to that from here.  We should have
-				     done this in md_assemble to really
-				     get it right all of the time, but I
-				     think it does not matter that much, as
-				     this will be right most of the time. ERY*/
-		    S_GET_SEGMENT(fragP->fr_symbol) == undefined_section)
-		   ? BFD_RELOC_386_PLT32 : pcrel_reloc);
+		   reloc_type);
 	  break;
 
 	default:
-	  /* This changes the byte-displacement jump 0x7N -->
-			   the dword-displacement jump 0x0f8N */
+	  /* This changes the byte-displacement jump 0x7N
+	     to the dword-displacement jump 0x0f,0x8N.  */
 	  opcode[1] = opcode[0] + 0x10;
-	  opcode[0] = TWO_BYTE_OPCODE_ESCAPE;	/* two-byte escape */
+	  opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
 	  fragP->fr_fix += 1 + size;	/* we've added an opcode byte */
 	  fix_new (fragP, old_fr_fix + 1, size,
 		   fragP->fr_symbol,
 		   fragP->fr_offset, 1,
-		   (GOT_symbol &&  /* Not quite right - we should switch on
-				     presence of @PLT, but I cannot see how
-				     to get to that from here.  ERY */
-		    S_GET_SEGMENT(fragP->fr_symbol) == undefined_section)
-		   ? BFD_RELOC_386_PLT32 : pcrel_reloc);
+		   reloc_type);
 	  break;
 	}
       frag_wane (fragP);
@@ -3775,14 +3737,14 @@
 #ifndef BFD_ASSEMBLER
 void
 md_convert_frag (headers, sec, fragP)
-     object_headers *headers;
-     segT sec;
+     object_headers *headers ATTRIBUTE_UNUSED;
+     segT sec ATTRIBUTE_UNUSED;
      register fragS *fragP;
 #else
 void
 md_convert_frag (abfd, sec, fragP)
-     bfd *abfd;
-     segT sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     segT sec ATTRIBUTE_UNUSED;
      register fragS *fragP;
 #endif
 {
@@ -3798,7 +3760,7 @@
   /* Address we want to reach in file space. */
   target_address = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
 #ifdef BFD_ASSEMBLER /* not needed otherwise? */
-  target_address += fragP->fr_symbol->sy_frag->fr_address;
+  target_address += symbol_get_frag (fragP->fr_symbol)->fr_address;
 #endif
 
   /* Address opcode resides at in file space. */
@@ -3864,8 +3826,8 @@
 md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
      char *ptr;
      addressT from_addr, to_addr;
-     fragS *frag;
-     symbolS *to_symbol;
+     fragS *frag ATTRIBUTE_UNUSED;
+     symbolS *to_symbol ATTRIBUTE_UNUSED;
 {
   long offset;
 
@@ -3910,20 +3872,39 @@
 md_apply_fix3 (fixP, valp, seg)
      fixS *fixP;		/* The fix we're to put in.  */
      valueT *valp;		/* Pointer to the value of the bits.  */
-     segT seg;			/* Segment fix is from.  */
+     segT seg ATTRIBUTE_UNUSED;	/* Segment fix is from.  */
 {
   register char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
   valueT value = *valp;
 
-  if (fixP->fx_r_type == BFD_RELOC_32 && fixP->fx_pcrel)
-     fixP->fx_r_type = BFD_RELOC_32_PCREL;
-
 #if defined (BFD_ASSEMBLER) && !defined (TE_Mach)
-  /*
-   * This is a hack.  There should be a better way to
-   * handle this.
-   */
-  if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy)
+  if (fixP->fx_pcrel)
+    {
+      switch (fixP->fx_r_type)
+	{
+	default:
+	  break;
+
+	case BFD_RELOC_32:
+	  fixP->fx_r_type = BFD_RELOC_32_PCREL;
+	  break;
+	case BFD_RELOC_16:
+	  fixP->fx_r_type = BFD_RELOC_16_PCREL;
+	  break;
+	case BFD_RELOC_8:
+	  fixP->fx_r_type = BFD_RELOC_8_PCREL;
+	  break;
+	}
+    }
+
+  /* This is a hack.  There should be a better way to handle this.
+     This covers for the fact that bfd_install_relocation will
+     subtract the current location (for partial_inplace, PC relative
+     relocations); see more below.  */
+  if ((fixP->fx_r_type == BFD_RELOC_32_PCREL
+       || fixP->fx_r_type == BFD_RELOC_16_PCREL
+       || fixP->fx_r_type == BFD_RELOC_8_PCREL)
+      && fixP->fx_addsy)
     {
 #ifndef OBJ_AOUT
       if (OUTPUT_FLAVOR == bfd_target_elf_flavour
@@ -3934,28 +3915,59 @@
 	value += fixP->fx_where + fixP->fx_frag->fr_address;
 #endif
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-      if (OUTPUT_FLAVOR == bfd_target_elf_flavour
-	  && (S_GET_SEGMENT (fixP->fx_addsy) == seg
-	      || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)
-	  && ! S_IS_EXTERNAL (fixP->fx_addsy)
-	  && ! S_IS_WEAK (fixP->fx_addsy)
-	  && S_IS_DEFINED (fixP->fx_addsy)
-	  && ! S_IS_COMMON (fixP->fx_addsy))
+      if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
 	{
-	  /* Yes, we add the values in twice.  This is because
-	     bfd_perform_relocation subtracts them out again.  I think
-	     bfd_perform_relocation is broken, but I don't dare change
-	     it.  FIXME.  */
-	  value += fixP->fx_where + fixP->fx_frag->fr_address;
+	  segT fseg = S_GET_SEGMENT (fixP->fx_addsy);
+
+	  if ((fseg == seg
+	       || (symbol_section_p (fixP->fx_addsy)
+		   && fseg != absolute_section))
+	      && ! S_IS_EXTERNAL (fixP->fx_addsy)
+	      && ! S_IS_WEAK (fixP->fx_addsy)
+	      && S_IS_DEFINED (fixP->fx_addsy)
+	      && ! S_IS_COMMON (fixP->fx_addsy))
+	    {
+	      /* Yes, we add the values in twice.  This is because
+		 bfd_perform_relocation subtracts them out again.  I think
+		 bfd_perform_relocation is broken, but I don't dare change
+		 it.  FIXME.  */
+	      value += fixP->fx_where + fixP->fx_frag->fr_address;
+	    }
 	}
 #endif
 #if defined (OBJ_COFF) && defined (TE_PE)
       /* For some reason, the PE format does not store a section
-         address offset for a PC relative symbol.  */
+	 address offset for a PC relative symbol.  */
       if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
 	value += md_pcrel_from (fixP);
+      else if (S_IS_EXTERNAL (fixP->fx_addsy)
+	       || S_IS_WEAK (fixP->fx_addsy))
+	{
+	  /* We are generating an external relocation for this defined
+             symbol.  We add the address, because
+             bfd_install_relocation will subtract it.  VALUE already
+             holds the symbol value, because fixup_segment added it
+             in.  We subtract it out, and then we subtract it out
+             again because bfd_install_relocation will add it in
+             again.  */
+	  value += md_pcrel_from (fixP);
+	  value -= 2 * S_GET_VALUE (fixP->fx_addsy);
+	}
 #endif
     }
+#ifdef TE_PE
+  else if (fixP->fx_addsy != NULL
+	   && S_IS_DEFINED (fixP->fx_addsy)
+	   && (S_IS_EXTERNAL (fixP->fx_addsy)
+	       || S_IS_WEAK (fixP->fx_addsy)))
+    {
+      /* We are generating an external relocation for this defined
+         symbol.  VALUE already holds the symbol value, and
+         bfd_install_relocation will add it in again.  We don't want
+         either addition.  */
+      value -= 2 * S_GET_VALUE (fixP->fx_addsy);
+    }
+#endif
 
   /* Fix a few things - the dynamic linker expects certain values here,
      and we must not dissappoint it. */
@@ -3970,19 +3982,19 @@
       break;
     case BFD_RELOC_386_GOTPC:
 /*
- *  This is tough to explain.  We end up with this one if we have
+ *   This is tough to explain.  We end up with this one if we have
  * operands that look like "_GLOBAL_OFFSET_TABLE_+[.-.L284]".  The goal
  * here is to obtain the absolute address of the GOT, and it is strongly
  * preferable from a performance point of view to avoid using a runtime
- * relocation for this.  The actual sequence of instructions often look 
+ * relocation for this.  The actual sequence of instructions often look
  * something like:
- * 
- * 	call	.L66
+ *
+ *	call	.L66
  * .L66:
- * 	popl	%ebx
- * 	addl	$_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
- * 
- * 	The call and pop essentially return the absolute address of
+ *	popl	%ebx
+ *	addl	$_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
+ *
+ *   The call and pop essentially return the absolute address of
  * the label .L66 and store it in %ebx.  The linker itself will
  * ultimately change the first operand of the addl so that %ebx points to
  * the GOT, but to keep things simple, the .o file must have this operand
@@ -3991,17 +4003,17 @@
  * treat a GOTPC relocation as asking for a pcrel offset to the GOT to be
  * added in, and the addend of the relocation is stored in the operand
  * field for the instruction itself.
- * 
- * 	Our job here is to fix the operand so that it would add the correct
+ *
+ *   Our job here is to fix the operand so that it would add the correct
  * offset so that %ebx would point to itself.  The thing that is tricky is
  * that .-.L66 will point to the beginning of the instruction, so we need
  * to further modify the operand so that it will point to itself.
  * There are other cases where you have something like:
- * 
- * 	.long	$_GLOBAL_OFFSET_TABLE_+[.-.L66]
- * 
+ *
+ *	.long	$_GLOBAL_OFFSET_TABLE_+[.-.L66]
+ *
  * and here no correction would be required.  Internally in the assembler
- * we treat operands of this form as not being pcrel since the '.' is 
+ * we treat operands of this form as not being pcrel since the '.' is
  * explicitly mentioned, and I wonder whether it would simplify matters
  * to do it this way.  Who knows.  In earlier versions of the PIC patches,
  * the pcrel_adjust field was used to store the correction, but since the
@@ -4010,7 +4022,7 @@
       value -= 1;
       break;
     case BFD_RELOC_386_GOT32:
-      value = 0; /* Fully resolved at runtime.  No addend. */
+      value = 0; /* Fully resolved at runtime.  No addend.  */
       break;
     case BFD_RELOC_386_GOTOFF:
       break;
@@ -4023,9 +4035,9 @@
     default:
       break;
     }
-#endif
-
-#endif
+#endif /* defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) */
+  *valp = value;
+#endif /* defined (BFD_ASSEMBLER) && !defined (TE_Mach) */
   md_number_to_chars (p, value, fixP->fx_size);
 
   return 1;
@@ -4056,7 +4068,7 @@
    is stored in *sizeP .  An error message is returned, or NULL on OK.  */
 char *
 md_atof (type, litP, sizeP)
-     char type;
+     int type;
      char *litP;
      int *sizeP;
 {
@@ -4116,17 +4128,16 @@
   return output_invalid_buf;
 }
 
-/* REG_STRING starts *before* REGISTER_PREFIX.  */
 
-static const reg_entry * parse_register PARAMS ((char *, char **));
+/* REG_STRING starts *before* REGISTER_PREFIX.  */
 
 static const reg_entry *
 parse_register (reg_string, end_op)
      char *reg_string;
      char **end_op;
 {
-  register char *s = reg_string;
-  register char *p;
+  char *s = reg_string;
+  char *p;
   char reg_name_given[MAX_REG_NAME_SIZE + 1];
   const reg_entry *r;
 
@@ -4138,35 +4149,49 @@
     ++s;
 
   p = reg_name_given;
-  while ((*p++ = register_chars[(unsigned char) *s++]) != '\0')
+  while ((*p++ = register_chars[(unsigned char) *s]) != '\0')
     {
       if (p >= reg_name_given + MAX_REG_NAME_SIZE)
-	{
-          if (!allow_naked_reg)
-            {
-	      *p = '\0';
-	      as_bad (_("bad register name `%s'"), reg_name_given);
-            }
-	  return (const reg_entry *) NULL;
-	}
+	return (const reg_entry *) NULL;
+      s++;
     }
 
-  *end_op = s - 1;
+  *end_op = s;
 
   r = (const reg_entry *) hash_find (reg_hash, reg_name_given);
 
-  if (r == NULL)
+  /* Handle floating point regs, allowing spaces in the (i) part.  */
+  if (r == i386_regtab /* %st is first entry of table */)
     {
-      if (!allow_naked_reg)
-        as_bad (_("bad register name `%s'"), reg_name_given);
-      return (const reg_entry *) NULL;
+      if (is_space_char (*s))
+	++s;
+      if (*s == '(')
+	{
+	  ++s;
+	  if (is_space_char (*s))
+	    ++s;
+	  if (*s >= '0' && *s <= '7')
+	    {
+	      r = &i386_float_regtab[*s - '0'];
+	      ++s;
+	      if (is_space_char (*s))
+		++s;
+	      if (*s == ')')
+		{
+		  *end_op = s + 1;
+		  return r;
+		}
+	    }
+	  /* We have "%st(" then garbage */
+	  return (const reg_entry *) NULL;
+	}
     }
 
   return r;
 }
 
-#ifdef OBJ_ELF
-CONST char *md_shortopts = "kmVQ:";
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+CONST char *md_shortopts = "kmVQ:sq";
 #else
 CONST char *md_shortopts = "m";
 #endif
@@ -4178,7 +4203,7 @@
 int
 md_parse_option (c, arg)
      int c;
-     char *arg;
+     char *arg ATTRIBUTE_UNUSED;
 {
   switch (c)
     {
@@ -4200,6 +4225,16 @@
 	 should be emitted or not.  FIXME: Not implemented.  */
     case 'Q':
       break;
+
+    case 's':
+      /* -s: On i386 Solaris, this tells the native assembler to use
+         .stab instead of .stab.excl.  We always use .stab anyhow.  */
+      break;
+
+    case 'q':
+      /* -q: On i386 Solaris, this tells the native assembler does
+         fewer checks.  */
+      break;
 #endif
 
     default:
@@ -4213,12 +4248,21 @@
      FILE *stream;
 {
   fprintf (stream, _("\
--m			do long jump\n"));
+  -m			  do long jump\n"));
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+  fprintf (stream, _("\
+  -V			  print assembler version number\n\
+  -k			  ignored\n\
+  -Qy, -Qn		  ignored\n\
+  -q			  ignored\n\
+  -s			  ignored\n"));
+#endif
 }
 
 #ifdef BFD_ASSEMBLER
-#ifdef OBJ_MAYBE_ELF
-#ifdef OBJ_MAYBE_COFF
+#if ((defined (OBJ_MAYBE_ELF) && defined (OBJ_MAYBE_COFF)) \
+     || (defined (OBJ_MAYBE_ELF) && defined (OBJ_MAYBE_AOUT)) \
+     || (defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)))
 
 /* Pick the target format to use.  */
 
@@ -4227,57 +4271,68 @@
 {
   switch (OUTPUT_FLAVOR)
     {
+#ifdef OBJ_MAYBE_AOUT
+    case bfd_target_aout_flavour:
+     return AOUT_TARGET_FORMAT;
+#endif
+#ifdef OBJ_MAYBE_COFF
     case bfd_target_coff_flavour:
       return "coff-i386";
+#endif
+#ifdef OBJ_MAYBE_ELF
     case bfd_target_elf_flavour:
       return "elf32-i386";
+#endif
     default:
       abort ();
       return NULL;
     }
 }
 
-#endif /* OBJ_MAYBE_COFF */
-#endif /* OBJ_MAYBE_ELF */
+#endif /* OBJ_MAYBE_ more than one */
 #endif /* BFD_ASSEMBLER */
 
-/* ARGSUSED */
 symbolS *
 md_undefined_symbol (name)
      char *name;
 {
-	if (*name == '_' && *(name+1) == 'G'
-	    && strcmp(name, GLOBAL_OFFSET_TABLE_NAME) == 0)
-	  {
-	    if (!GOT_symbol)
-	      {
-		if (symbol_find (name))
-		  as_bad (_("GOT already in symbol table"));
-		GOT_symbol = symbol_new (name, undefined_section,
-					 (valueT) 0, &zero_address_frag);
-	      };
-	    return GOT_symbol;
-	  }
+  if (name[0] == GLOBAL_OFFSET_TABLE_NAME[0]
+      && name[1] == GLOBAL_OFFSET_TABLE_NAME[1]
+      && name[2] == GLOBAL_OFFSET_TABLE_NAME[2]
+      && strcmp (name, GLOBAL_OFFSET_TABLE_NAME) == 0)
+    {
+      if (!GOT_symbol)
+	{
+	  if (symbol_find (name))
+	    as_bad (_("GOT already in symbol table"));
+	  GOT_symbol = symbol_new (name, undefined_section,
+				   (valueT) 0, &zero_address_frag);
+	};
+      return GOT_symbol;
+    }
   return 0;
 }
 
 /* Round up a section size to the appropriate boundary.  */
 valueT
 md_section_align (segment, size)
-     segT segment;
+     segT segment ATTRIBUTE_UNUSED;
      valueT size;
 {
-#ifdef OBJ_AOUT
 #ifdef BFD_ASSEMBLER
-  /* For a.out, force the section size to be aligned.  If we don't do
-     this, BFD will align it for us, but it will not write out the
-     final bytes of the section.  This may be a bug in BFD, but it is
-     easier to fix it here since that is how the other a.out targets
-     work.  */
-  int align;
+#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
+  if (OUTPUT_FLAVOR == bfd_target_aout_flavour)
+    {
+      /* For a.out, force the section size to be aligned.  If we don't do
+	 this, BFD will align it for us, but it will not write out the
+	 final bytes of the section.  This may be a bug in BFD, but it is
+	 easier to fix it here since that is how the other a.out targets
+	 work.  */
+      int align;
 
-  align = bfd_get_section_alignment (stdoutput, segment);
-  size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
+      align = bfd_get_section_alignment (stdoutput, segment);
+      size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
+    }
 #endif
 #endif
 
@@ -4299,7 +4354,7 @@
 
 static void
 s_bss (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register int temp;
 
@@ -4324,12 +4379,9 @@
     }
 }
 
-#define F(SZ,PCREL)		(((SZ) << 1) + (PCREL))
-#define MAP(SZ,PCREL,TYPE)	case F(SZ,PCREL): code = (TYPE); break
-
 arelent *
 tc_gen_reloc (section, fixp)
-     asection *section;
+     asection *section ATTRIBUTE_UNUSED;
      fixS *fixp;
 {
   arelent *rel;
@@ -4347,27 +4399,35 @@
       code = fixp->fx_r_type;
       break;
     default:
-      switch (F (fixp->fx_size, fixp->fx_pcrel))
+      if (fixp->fx_pcrel)
 	{
-	  MAP (1, 0, BFD_RELOC_8);
-	  MAP (2, 0, BFD_RELOC_16);
-	  MAP (4, 0, BFD_RELOC_32);
-	  MAP (1, 1, BFD_RELOC_8_PCREL);
-	  MAP (2, 1, BFD_RELOC_16_PCREL);
-	  MAP (4, 1, BFD_RELOC_32_PCREL);
-	default:
-	  if (fixp->fx_pcrel)
-	    as_bad (_("Can not do %d byte pc-relative relocation"),
-		    fixp->fx_size);
-	  else
-	    as_bad (_("Can not do %d byte relocation"), fixp->fx_size);
-	  code = BFD_RELOC_32;
-	  break;
+	  switch (fixp->fx_size)
+	    {
+	    default:
+	      as_bad (_("can not do %d byte pc-relative relocation"),
+		      fixp->fx_size);
+	      code = BFD_RELOC_32_PCREL;
+	      break;
+	    case 1: code = BFD_RELOC_8_PCREL;  break;
+	    case 2: code = BFD_RELOC_16_PCREL; break;
+	    case 4: code = BFD_RELOC_32_PCREL; break;
+	    }
+	}
+      else
+	{
+	  switch (fixp->fx_size)
+	    {
+	    default:
+	      as_bad (_("can not do %d byte relocation"), fixp->fx_size);
+	      code = BFD_RELOC_32;
+	      break;
+	    case 1: code = BFD_RELOC_8;  break;
+	    case 2: code = BFD_RELOC_16; break;
+	    case 4: code = BFD_RELOC_32; break;
+	    }
 	}
       break;
     }
-#undef MAP
-#undef F
 
   if (code == BFD_RELOC_32
       && GOT_symbol
@@ -4375,7 +4435,8 @@
     code = BFD_RELOC_386_GOTPC;
 
   rel = (arelent *) xmalloc (sizeof (arelent));
-  rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
 
   rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
   /* HACK: Since i386 ELF uses Rel instead of Rela, encode the
@@ -4392,7 +4453,7 @@
   if (rel->howto == NULL)
     {
       as_bad_where (fixp->fx_file, fixp->fx_line,
-		    _("Cannot represent relocation type %s"),
+		    _("cannot represent relocation type %s"),
 		    bfd_get_reloc_code_name (code));
       /* Set howto to a garbage value so that we can keep going.  */
       rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
@@ -4470,6 +4531,6 @@
 
 #endif /* I386COFF */
 
-#endif /* BFD_ASSEMBLER? */
+#endif /* ! BFD_ASSEMBLER */
 
 /* end of tc-i386.c */
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index d876d61..1d830ee 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -1,5 +1,6 @@
 /* tc-i386.h -- Header file for tc-i386.c
-   Copyright (C) 1989, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 1989, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -37,11 +38,6 @@
    type.  The idea is that if the original type is already some kind of PIC
    relocation, we leave it alone, otherwise we give it the desired type */
 
-#define TC_RELOC(X,Y) (((X) != BFD_RELOC_386_PLT32 && \
-	   (X) != BFD_RELOC_386_GOTOFF && \
-	   (X) != BFD_RELOC_386_GOT32 && \
-	   (X) != BFD_RELOC_386_GOTPC) ? Y : X)
-
 #define tc_fix_adjustable(X)  tc_i386_fix_adjustable(X)
 extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
 
@@ -73,35 +69,36 @@
 
 #define TARGET_ARCH		bfd_arch_i386
 
-#ifdef OBJ_AOUT
 #ifdef TE_NetBSD
-#define TARGET_FORMAT		"a.out-i386-netbsd"
+#define AOUT_TARGET_FORMAT	"a.out-i386-netbsd"
 #endif
 #ifdef TE_386BSD
-#define TARGET_FORMAT		"a.out-i386-bsd"
+#define AOUT_TARGET_FORMAT	"a.out-i386-bsd"
 #endif
 #ifdef TE_LINUX
-#define TARGET_FORMAT		"a.out-i386-linux"
+#define AOUT_TARGET_FORMAT	"a.out-i386-linux"
 #endif
 #ifdef TE_Mach
-#define TARGET_FORMAT		"a.out-mach3"
+#define AOUT_TARGET_FORMAT	"a.out-mach3"
 #endif
 #ifdef TE_DYNIX
-#define TARGET_FORMAT		"a.out-i386-dynix"
+#define AOUT_TARGET_FORMAT	"a.out-i386-dynix"
 #endif
-#ifndef TARGET_FORMAT
-#define TARGET_FORMAT		"a.out-i386"
+#ifndef AOUT_TARGET_FORMAT
+#define AOUT_TARGET_FORMAT	"a.out-i386"
 #endif
-#endif /* OBJ_AOUT */
 
+#if ((defined (OBJ_MAYBE_ELF) && defined (OBJ_MAYBE_COFF)) \
+     || (defined (OBJ_MAYBE_ELF) && defined (OBJ_MAYBE_AOUT)) \
+     || (defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)))
+extern const char *i386_target_format PARAMS ((void));
+#define TARGET_FORMAT i386_target_format ()
+#else
 #ifdef OBJ_ELF
 #define TARGET_FORMAT		"elf32-i386"
 #endif
-
-#ifdef OBJ_MAYBE_ELF
-#ifdef OBJ_MAYBE_COFF
-extern const char *i386_target_format PARAMS ((void));
-#define TARGET_FORMAT i386_target_format ()
+#ifdef OBJ_AOUT
+#define TARGET_FORMAT		AOUT_TARGET_FORMAT
 #endif
 #endif
 
@@ -117,7 +114,21 @@
 extern short tc_coff_fix2rtype PARAMS ((struct fix *));
 #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
 extern int tc_coff_sizemachdep PARAMS ((fragS *frag));
+
+#ifdef TE_GO32
+/* DJGPP now expects some sections to be 2**4 aligned.  */
+#define SUB_SEGMENT_ALIGN(SEG)						\
+  ((strcmp (obj_segment_name (SEG), ".text") == 0			\
+    || strcmp (obj_segment_name (SEG), ".data") == 0			\
+    || strncmp (obj_segment_name (SEG), ".gnu.linkonce.t", 15) == 0	\
+    || strncmp (obj_segment_name (SEG), ".gnu.linkonce.d", 15) == 0	\
+    || strncmp (obj_segment_name (SEG), ".gnu.linkonce.r", 15) == 0)	\
+   ? 4									\
+   : 2)
+#else
 #define SUB_SEGMENT_ALIGN(SEG) 2
+#endif
+
 #define TC_RVA_RELOC 7
 /* Need this for PIC relocations */
 #define NEED_FX_R_TYPE
@@ -201,7 +212,6 @@
 #define NO_BASE_REGISTER_16 6
 
 /* these are the instruction mnemonic suffixes.  */
-#define DWORD_MNEM_SUFFIX 'l'
 #define WORD_MNEM_SUFFIX  'w'
 #define BYTE_MNEM_SUFFIX  'b'
 #define SHORT_MNEM_SUFFIX 's'
@@ -209,7 +219,7 @@
 /* Intel Syntax */
 #define LONG_DOUBLE_MNEM_SUFFIX 'x'
 /* Intel Syntax */
-#define INTEL_DWORD_MNEM_SUFFIX 'd'
+#define DWORD_MNEM_SUFFIX 'd'
 
 /* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
 #define REGMEM_FIELD_HAS_REG 0x3/* always = 0x3 */
@@ -270,14 +280,21 @@
 #define Acc	      0x200000	/* Accumulator %al or %ax or %eax */
 #define JumpAbsolute  0x400000
 #define RegMMX	      0x800000	/* MMX register */
-#define EsSeg	     0x1000000	/* String insn operand with fixed es segment */
+#define RegXMM	     0x1000000	/* XMM registers in PIII */
+#define EsSeg	     0x2000000	/* String insn operand with fixed es segment */
+/* InvMem is for instructions with a modrm byte that only allow a
+   general register encoding in the i.tm.mode and i.tm.regmem fields,
+   eg. control reg moves.  They really ought to support a memory form,
+   but don't, so we add an InvMem flag to the register operand to
+   indicate that it should be encoded in the i.tm.regmem field.  */
+#define InvMem	     0x4000000
 
 #define Reg	(Reg8|Reg16|Reg32)	/* gen'l register */
 #define WordReg (Reg16|Reg32)
 #define ImplicitRegister (InOutPortReg|ShiftCount|Acc|FloatAcc)
 #define Imm	(Imm8|Imm8S|Imm16|Imm32) /* gen'l immediate */
 #define Disp	(Disp8|Disp16|Disp32)	/* General displacement */
-#define AnyMem	(Disp|BaseIndex)	/* General memory */
+#define AnyMem	(Disp|BaseIndex|InvMem)	/* General memory */
 /* The following aliases are defined because the opcode table
    carefully specifies the allowed memory types for each instruction.
    At the moment we can only tell a memory reference size by the
@@ -323,7 +340,6 @@
 #define D		   0x2	/* D = 0 if Reg --> Regmem;
 				   D = 1 if Regmem --> Reg:    MUST BE 0x2 */
 #define Modrm		   0x4
-#define ReverseRegRegmem   0x8  /* swap reg,regmem fields for 2 reg case */
 #define FloatR		   0x8	/* src/dest swap for floats:   MUST BE 0x8 */
 #define ShortForm	  0x10	/* register is in low 3 bits of opcode */
 #define FloatMF		  0x20	/* FP insn memory format bit, sized by 0x4 */
@@ -337,16 +353,18 @@
 #define Size16		0x2000	/* needs size prefix if in 32-bit mode */
 #define Size32		0x4000	/* needs size prefix if in 16-bit mode */
 #define IgnoreSize	0x8000  /* instruction ignores operand size prefix */
-#define No_bSuf	       0x10000	/* b suffix on instruction illegal */
-#define No_wSuf	       0x20000	/* w suffix on instruction illegal */
-#define No_lSuf	       0x40000	/* l suffix on instruction illegal */
-#define No_sSuf	       0x80000	/* s suffix on instruction illegal */
-#define FWait	      0x100000	/* instruction needs FWAIT */
-#define IsString      0x200000	/* quick test for string instructions */
-#define regKludge     0x400000	/* fake an extra reg operand for clr, imul */
-#define IsPrefix      0x800000	/* opcode is a prefix */
-#define No_dSuf      0x1000000  /* d suffix on instruction illegal */
-#define No_xSuf      0x2000000  /* x suffix on instruction illegal */
+#define DefaultSize    0x10000  /* default insn size depends on mode */
+#define No_bSuf	       0x20000	/* b suffix on instruction illegal */
+#define No_wSuf	       0x40000	/* w suffix on instruction illegal */
+#define No_lSuf	       0x80000	/* l suffix on instruction illegal */
+#define No_sSuf	      0x100000	/* s suffix on instruction illegal */
+#define No_dSuf       0x200000  /* d suffix on instruction illegal */
+#define No_xSuf       0x400000  /* x suffix on instruction illegal */
+#define FWait	      0x800000	/* instruction needs FWAIT */
+#define IsString     0x1000000	/* quick test for string instructions */
+#define regKludge    0x2000000	/* fake an extra reg operand for clr, imul */
+#define IsPrefix     0x4000000	/* opcode is a prefix */
+#define ImmExt	     0x8000000	/* instruction has extension in 8 bit imm */
 #define Ugh	    0x80000000	/* deprecated fp insn, gets a warning */
 
   /* operand_types[i] describes the type of operand i.  This is made
@@ -422,21 +440,10 @@
 extern const struct relax_type md_relax_table[];
 #define TC_GENERIC_RELAX_TABLE md_relax_table
 
-
-extern int flag_16bit_code;
-
-#ifdef BFD_ASSEMBLER
-#define md_maybe_text() \
-  ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
-#else
-#define md_maybe_text() \
-  (now_seg != data_section && now_seg != bss_section)
-#endif
-
 #define md_do_align(n, fill, len, max, around)				\
 if ((n) && !need_pass_2							\
     && (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1))		\
-    && md_maybe_text ())						\
+    && subseg_text_p (now_seg))						\
   {									\
     char *p;								\
     p = frag_var (rs_align_code, 15, 1, (relax_substateT) max,		\
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index f2e2b19..3317282 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1,5 +1,5 @@
 /* tc-i860.c -- Assemble for the I860
-   Copyright (C) 1989, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1989, 92, 93, 94, 95, 98, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1118,9 +1118,9 @@
 	      ri.r_extern = 0;
 	      ri.r_symbolnum = S_GET_TYPE (symbolP);
 	    }
-	  if (symbolP && symbolP->sy_frag)
+	  if (symbolP && symbol_get_frag (symbolP))
 	    {
-	      ri.r_addend = symbolP->sy_frag->fr_address;
+	      ri.r_addend = symbol_get_frag (symbolP)->fr_address;
 	    }
 	  ri.r_type = fixP->fx_r_type;
 	  if (fixP->fx_pcrel)
@@ -1184,9 +1184,9 @@
 	      | ((r_extern << 6) & 0x40)
 	      | (fixP->fx_r_type & 0x3F));
 
-  if (fixP->fx_addsy->sy_frag)
+  if (symbol_get_frag (fixP->fx_addsy))
     {
-      r_addend = fixP->fx_addsy->sy_frag->fr_address;
+      r_addend = symbol_get_frag (fixP->fx_addsy)->fr_address;
     }
 
   if (fixP->fx_pcrel)
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 936b662..d8c15c0 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1,5 +1,5 @@
 /* tc-i960.c - All the i80960-specific stuff
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS.
@@ -101,7 +101,22 @@
 #define TC_S_FORCE_TO_SYSPROC(s)	(S_SET_STORAGE_CLASS((s), C_SCALL))
 
 #else /* ! OBJ_COFF */
-you lose;
+#ifdef OBJ_ELF
+#define TC_S_IS_SYSPROC(s)	0
+
+#define TC_S_IS_BALNAME(s)	0
+#define TC_S_IS_CALLNAME(s)	0
+#define TC_S_IS_BADPROC(s)	0
+
+#define TC_S_SET_SYSPROC(s, p)
+#define TC_S_GET_SYSPROC(s) 0
+
+#define TC_S_FORCE_TO_BALNAME(s)
+#define TC_S_FORCE_TO_CALLNAME(s)
+#define TC_S_FORCE_TO_SYSPROC(s)
+#else
+ #error COFF, a.out, b.out, and ELF are the only supported formats.
+#endif /* ! OBJ_ELF */
 #endif /* ! OBJ_COFF */
 #endif /* ! OBJ_A/BOUT */
 
@@ -1009,7 +1024,6 @@
 }
 
 
-#ifndef BFD_ASSEMBLER
 /*****************************************************************************
    md_convert_frag:
   	Called by base assembler after address relaxation is finished:  modify
@@ -1023,11 +1037,19 @@
   	Replace the cobr with a two instructions (a compare and a branch).
 
   *************************************************************************** */
+#ifndef BFD_ASSEMBLER
 void
 md_convert_frag (headers, seg, fragP)
      object_headers *headers;
      segT seg;
      fragS *fragP;
+#else
+void
+md_convert_frag (abfd, sec, fragP)
+     bfd *abfd;
+     segT sec;
+     fragS *fragP;
+#endif
 {
   fixS *fixP;			/* Structure describing needed address fix */
 
@@ -1082,6 +1104,7 @@
   return 0;
 }				/* md_estimate_size_before_relax() */
 
+#if defined(OBJ_AOUT) | defined(OBJ_BOUT)
 
 /*****************************************************************************
    md_ri_to_chars:
@@ -1096,7 +1119,8 @@
   	does do the reordering (Ian Taylor 28 Aug 92).
 
   *************************************************************************** */
-void
+
+static void
 md_ri_to_chars (where, ri)
      char *where;
      struct relocation_info *ri;
@@ -1114,7 +1138,8 @@
 	      | (ri->r_callj << 6));
 }
 
-#endif /* BFD_ASSEMBLER */
+#endif /* defined(OBJ_AOUT) | defined(OBJ_BOUT) */
+
 
 /* FOLLOWING ARE THE LOCAL ROUTINES, IN ALPHABETICAL ORDER  */
 
@@ -2613,7 +2638,9 @@
 	}
       TC_S_FORCE_TO_BALNAME (balP);
 
+#ifndef OBJ_ELF
       tc_set_bal_of_call (callP, balP);
+#endif
     }				/* if only one arg, or the args are the same */
 }
 
@@ -2819,25 +2846,42 @@
   return fixP->fx_where + fixP->fx_frag->fr_address;
 }
 
+#ifdef BFD_ASSEMBLER
+int
+md_apply_fix (fixP, valp)
+     fixS *fixP;
+     valueT *valp;
+#else
 void
 md_apply_fix (fixP, val)
      fixS *fixP;
      long val;
+#endif
 {
+#ifdef BFD_ASSEMBLER
+  long val = *valp;
+#endif
   char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
 
   if (!fixP->fx_bit_fixP)
     {
+#ifndef BFD_ASSEMBLER
       /* For callx, we always want to write out zero, and emit a
 	 symbolic relocation.  */
       if (fixP->fx_bsr)
 	val = 0;
 
       fixP->fx_addnumber = val;
+#endif
+
       md_number_to_imm (place, val, fixP->fx_size, fixP);
     }
   else
     md_number_to_field (place, val, fixP->fx_bit_fixP);
+
+#ifdef BFD_ASSEMBLER
+  return 0;
+#endif
 }
 
 #if defined(OBJ_AOUT) | defined(OBJ_BOUT)
@@ -2937,8 +2981,14 @@
      segT seg;
      valueT addr;		/* Address to be rounded up */
 {
-  return ((addr + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg]));
-}				/* md_section_align() */
+  int align;
+#ifdef BFD_ASSEMBLER
+  align = bfd_get_section_alignment (stdoutput, seg);
+#else
+  align = section_alignment[(int) seg];
+#endif
+  return (addr + (1 << align) - 1) & (-1 << align);
+}
 
 extern int coff_flags;
 
@@ -3007,6 +3057,8 @@
 
 #endif /* OBJ_COFF */
 
+#ifndef BFD_ASSEMBLER
+
 /* Things going on here:
 
    For bout, We need to assure a couple of simplifying
@@ -3066,6 +3118,8 @@
     }				/* walk the symbol chain */
 }
 
+#endif /* ! BFD_ASSEMBLER */
+
 /* For aout or bout, the bal immediately follows the call.
 
    For coff, we cheat and store a pointer to the bal symbol in the
@@ -3105,7 +3159,7 @@
     }				/* if not in order */
 
 #else /* ! OBJ_ABOUT */
-  (as yet unwritten.);
+  as_fatal ("Only supported for a.out, b.out, or COFF");
 #endif /* ! OBJ_ABOUT */
 #endif /* ! OBJ_COFF */
 }
@@ -3124,7 +3178,7 @@
 #ifdef OBJ_ABOUT
   retval = symbol_next (callP);
 #else
-  (as yet unwritten.);
+  as_fatal ("Only supported for a.out, b.out, or COFF");
 #endif /* ! OBJ_ABOUT */
 #endif /* ! OBJ_COFF */
 
@@ -3228,4 +3282,68 @@
   return 0;
 }
 
+#ifdef BFD_ASSEMBLER
+
+/* From cgen.c:  */
+
+static short
+tc_bfd_fix2rtype (fixP)
+     fixS *fixP;
+{
+#if 0
+  if (fixP->fx_bsr)
+    abort ();
+#endif
+
+  if (fixP->fx_pcrel == 0 && fixP->fx_size == 4)
+    return BFD_RELOC_32;
+
+  if (fixP->fx_pcrel != 0 && fixP->fx_size == 4)
+    return BFD_RELOC_24_PCREL;
+
+  abort ();
+  return 0;
+}
+
+/* Translate internal representation of relocation info to BFD target
+   format.
+
+   FIXME: To what extent can we get all relevant targets to use this?  */
+
+arelent *
+tc_gen_reloc (section, fixP)
+     asection *section;
+     fixS *fixP;
+{
+  arelent * reloc;
+
+  reloc = (arelent *) xmalloc (sizeof (arelent));
+
+  /* HACK: Is this right? */
+  fixP->fx_r_type = tc_bfd_fix2rtype (fixP);
+
+  reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
+  if (reloc->howto == (reloc_howto_type *) NULL)
+    {
+      as_bad_where (fixP->fx_file, fixP->fx_line,
+		    "internal error: can't export reloc type %d (`%s')",
+		    fixP->fx_r_type,
+		    bfd_get_reloc_code_name (fixP->fx_r_type));
+      return NULL;
+    }
+
+  assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
+
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
+  reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
+  reloc->addend = fixP->fx_addnumber;
+
+  return reloc;
+}
+
+/* end from cgen.c */
+
+#endif /* BFD_ASSEMBLER */
+
 /* end of tc-i960.c */
diff --git a/gas/config/tc-i960.h b/gas/config/tc-i960.h
index f606967..2746ede 100644
--- a/gas/config/tc-i960.h
+++ b/gas/config/tc-i960.h
@@ -1,5 +1,5 @@
 /* tc-i960.h - Basic 80960 instruction formats.
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -22,6 +22,11 @@
 #ifndef TC_I960
 #define TC_I960 1
 
+#ifdef OBJ_ELF
+#define TARGET_FORMAT "elf32-i960"
+#define TARGET_ARCH bfd_arch_i960
+#endif
+
 #define TARGET_BYTES_BIG_ENDIAN 0
 
 #define WORKING_DOT_WORD
@@ -125,7 +130,7 @@
 #ifdef OBJ_COFF
 
 /* We store the bal information in the sy_tc field.  */
-#define TC_SYMFIELD_TYPE struct symbol *
+#define TC_SYMFIELD_TYPE symbolS *
 
 #define TC_ADJUST_RELOC_COUNT(FIXP,COUNT) \
   { fixS *tcfixp = (FIXP); \
@@ -135,20 +140,36 @@
   }
 #endif
 
-extern int i960_validate_fix PARAMS ((struct fix *, segT, struct symbol **));
+extern int i960_validate_fix PARAMS ((struct fix *, segT, symbolS **));
 #define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
 	if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
 
+#ifdef OBJ_ELF
+#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)  \
+  ((FIX)->fx_addsy == NULL \
+   || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
+       && ! S_IS_WEAK ((FIX)->fx_addsy) \
+       && S_IS_DEFINED ((FIX)->fx_addsy) \
+       && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#endif
+
+#ifndef OBJ_ELF
 #define tc_fix_adjustable(FIXP)		((FIXP)->fx_bsr == 0)
+#else
+#define tc_fix_adjustable(FIXP)						\
+  ((FIXP)->fx_bsr == 0							\
+   && ! S_IS_EXTERNAL ((FIXP)->fx_addsy)				\
+   && ! S_IS_WEAK ((FIXP)->fx_addsy))
+#endif
 
 extern void brtab_emit PARAMS ((void));
 #define md_end()	brtab_emit ()
 
 extern void reloc_callj ();
 
-extern void tc_set_bal_of_call PARAMS ((struct symbol *, struct symbol *));
+extern void tc_set_bal_of_call PARAMS ((symbolS *, symbolS *));
 
-extern struct symbol *tc_get_bal_of_call PARAMS ((struct symbol *));
+extern struct symbol *tc_get_bal_of_call PARAMS ((symbolS *));
 
 extern void i960_handle_align ();
 #define HANDLE_ALIGN(FRAG)	i960_handle_align (FRAG)
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index 997e623..7745338 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -91,6 +91,20 @@
    shouldn't assume or require it to).  */
 static int warn_unmatched_high = 0;
 
+/* Non-zero if -m32rx has been specified, in which case support for the
+   extended M32RX instruction set should be enabled.  */
+static int enable_m32rx = 0;
+
+/* Non-zero if -m32rx -hidden has been specified, in which case support for
+   the special M32RX instruction set should be enabled.  */
+static int enable_special = 0;
+
+/* Non-zero if the programmer should be warned when an explicit parallel
+   instruction might have constraint violations.  */
+static int warn_explicit_parallel_conflicts = 1;
+
+/* Non-zero if insns can be made parallel.  */
+static int optimize;
 
 /* stuff for .scomm symbols.  */
 static segT     sbss_section;
@@ -127,28 +141,48 @@
 static struct m32r_hi_fixup * m32r_hi_fixup_list;
 
 
+static void
+allow_m32rx (on)
+     int on;
+{
+  enable_m32rx = on;
+
+  if (stdoutput != NULL)
+    bfd_set_arch_mach (stdoutput, TARGET_ARCH,
+		       enable_m32rx ? bfd_mach_m32rx : bfd_mach_m32r);
+}
 
-#define M32R_SHORTOPTS ""
+#define M32R_SHORTOPTS "O"
 const char * md_shortopts = M32R_SHORTOPTS;
 
 struct option md_longopts[] =
 {
-
+#define OPTION_M32R		(OPTION_MD_BASE)
+#define OPTION_M32RX		(OPTION_M32R + 1)
+#define OPTION_WARN_PARALLEL	(OPTION_M32RX + 1)
+#define OPTION_NO_WARN_PARALLEL	(OPTION_WARN_PARALLEL + 1)
+#define OPTION_SPECIAL		(OPTION_NO_WARN_PARALLEL + 1)
+#define OPTION_WARN_UNMATCHED 	(OPTION_SPECIAL + 1)
+#define OPTION_NO_WARN_UNMATCHED (OPTION_WARN_UNMATCHED + 1)
+  {"m32r",  no_argument, NULL, OPTION_M32R},
+  {"m32rx", no_argument, NULL, OPTION_M32RX},
+  {"warn-explicit-parallel-conflicts", no_argument, NULL, OPTION_WARN_PARALLEL},
+  {"Wp", no_argument, NULL, OPTION_WARN_PARALLEL},
+  {"no-warn-explicit-parallel-conflicts", no_argument, NULL, OPTION_NO_WARN_PARALLEL},
+  {"Wnp", no_argument, NULL, OPTION_NO_WARN_PARALLEL},
+  {"hidden", no_argument, NULL, OPTION_SPECIAL},
   /* Sigh.  I guess all warnings must now have both variants.  */
-#define OPTION_WARN_UNMATCHED (OPTION_MD_BASE + 4)
-  {"warn-unmatched-high", OPTION_WARN_UNMATCHED},
-  {"Wuh", OPTION_WARN_UNMATCHED},
-#define OPTION_NO_WARN_UNMATCHED (OPTION_MD_BASE + 5)
-  {"no-warn-unmatched-high", OPTION_WARN_UNMATCHED},
-  {"Wnuh", OPTION_WARN_UNMATCHED},
+  {"warn-unmatched-high", no_argument, NULL, OPTION_WARN_UNMATCHED},
+  {"Wuh", no_argument, NULL, OPTION_WARN_UNMATCHED},
+  {"no-warn-unmatched-high", no_argument, NULL, OPTION_NO_WARN_UNMATCHED},
+  {"Wnuh", no_argument, NULL, OPTION_NO_WARN_UNMATCHED},
 
 #if 0 /* not supported yet */
-#define OPTION_RELAX  (OPTION_MD_BASE + 6)
+#define OPTION_RELAX		(OPTION_NO_WARN_UNMATCHED + 1)
+#define OPTION_CPU_DESC		(OPTION_RELAX + 1)
   {"relax", no_argument, NULL, OPTION_RELAX},
-#define OPTION_CPU_DESC (OPTION_MD_BASE + 7)
   {"cpu-desc", required_argument, NULL, OPTION_CPU_DESC},
 #endif
-
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -160,6 +194,36 @@
 {
   switch (c)
     {
+    case 'O':
+      optimize = 1;
+      break;
+
+    case OPTION_M32R:
+      allow_m32rx (0);
+      break;
+      
+    case OPTION_M32RX:
+      allow_m32rx (1);
+      break;
+      
+    case OPTION_WARN_PARALLEL:
+      warn_explicit_parallel_conflicts = 1;
+      break;
+      
+    case OPTION_NO_WARN_PARALLEL:
+      warn_explicit_parallel_conflicts = 0;
+      break;
+
+    case OPTION_SPECIAL:
+      if (enable_m32rx)
+	enable_special = 1;
+      else
+	{
+	  /* Pretend that we do not recognise this option.  */
+	  as_bad (_("Unrecognised option: -hidden"));
+	  return 0;
+	}
+      break;
 
     case OPTION_WARN_UNMATCHED:
       warn_unmatched_high = 1;
@@ -181,6 +245,7 @@
     default:
       return 0;
     }
+  
   return 1;
 }
 
@@ -190,6 +255,25 @@
 {
   fprintf (stream, _(" M32R specific command line options:\n"));
 
+  fprintf (stream, _("\
+  -m32r                   disable support for the m32rx instruction set\n"));
+  fprintf (stream, _("\
+  -m32rx                  support the extended m32rx instruction set\n"));
+  fprintf (stream, _("\
+  -O                      try to combine instructions in parallel\n"));
+
+  fprintf (stream, _("\
+  -warn-explicit-parallel-conflicts     warn when parallel instructions\n"));
+  fprintf (stream, _("\
+                                         violate contraints\n"));
+  fprintf (stream, _("\
+  -no-warn-explicit-parallel-conflicts  do not warn when parallel\n"));
+  fprintf (stream, _("\
+                                         instructions violate contraints\n"));
+  fprintf (stream, _("\
+  -Wp                     synonym for -warn-explicit-parallel-conflicts\n"));
+  fprintf (stream, _("\
+  -Wnp                    synonym for -no-warn-explicit-parallel-conflicts\n"));
 
   fprintf (stream, _("\
   -warn-unmatched-high    warn when an (s)high reloc has no matching low reloc\n"));
@@ -224,6 +308,9 @@
   { "fillinsn", fill_insn,	0 },
   { "scomm",	m32r_scomm,	0 },
   { "debugsym",	debug_sym,	0 },
+  /* Not documented as so far there is no need for them.... */  
+  { "m32r",	allow_m32rx,	0 },
+  { "m32rx",	allow_m32rx,	1 },
   { NULL, NULL, 0 }
 };
 
@@ -245,7 +332,7 @@
 {
   /* Only do this if the fill pattern wasn't specified.  */
   if (fill == NULL
-      && (now_seg->flags & SEC_CODE) != 0
+      && subseg_text_p (now_seg)
       /* Only do this special handling if aligning to at least a
 	 4 byte boundary.  */
       && n > 1
@@ -336,7 +423,7 @@
       link->symbol = symbolP;
       link->next = debug_sym_link;
       debug_sym_link = link;
-      symbolP->local = 1;
+      symbol_get_obj (symbolP)->local = 1;
     }
 
   *end_name = delim;
@@ -464,9 +551,427 @@
   scom_symbol.name            = ".scommon";
   scom_symbol.section         = & scom_section;
 
+  allow_m32rx (enable_m32rx);
 }
 
+#define OPERAND_IS_COND_BIT(operand, indices, index) \
+  ((operand)->hw_type == HW_H_COND			\
+   || ((operand)->hw_type == HW_H_PSW)			\
+   || ((operand)->hw_type == HW_H_CR			\
+       && (indices [index] == 0 || indices [index] == 1)))
 
+/* Returns true if an output of instruction 'a' is referenced by an operand
+   of instruction 'b'.  If 'check_outputs' is true then b's outputs are
+   checked, otherwise its inputs are examined.  */
+
+static int
+first_writes_to_seconds_operands (a, b, check_outputs)
+     m32r_insn * a;
+     m32r_insn * b;
+     const int   check_outputs;
+{
+  const CGEN_OPINST * a_operands = CGEN_INSN_OPERANDS (a->insn);
+  const CGEN_OPINST * b_ops = CGEN_INSN_OPERANDS (b->insn);
+  int a_index;
+
+  /* If at least one of the instructions takes no operands, then there is
+     nothing to check.  There really are instructions without operands,
+     eg 'nop'.  */
+  if (a_operands == NULL || b_ops == NULL)
+    return 0;
+      
+  /* Scan the operand list of 'a' looking for an output operand.  */
+  for (a_index = 0;
+       a_operands->type != CGEN_OPINST_END;
+       a_index ++, a_operands ++)
+    {
+      if (a_operands->type == CGEN_OPINST_OUTPUT)
+	{
+	  int b_index;
+	  const CGEN_OPINST * b_operands = b_ops;
+
+	  /* Special Case:
+	     The Condition bit 'C' is a shadow of the CBR register (control
+	     register 1) and also a shadow of bit 31 of the program status
+	     word (control register 0).  For now this is handled here, rather
+	     than by cgen.... */
+	  
+	  if (OPERAND_IS_COND_BIT (a_operands, a->indices, a_index))
+	    {
+	      /* Scan operand list of 'b' looking for another reference to the
+		 condition bit, which goes in the right direction.  */
+	      for (b_index = 0;
+		   b_operands->type != CGEN_OPINST_END;
+		   b_index ++, b_operands ++)
+		{
+		  if ((b_operands->type
+		       == (check_outputs
+			   ? CGEN_OPINST_OUTPUT
+			   : CGEN_OPINST_INPUT))
+		      && OPERAND_IS_COND_BIT (b_operands, b->indices, b_index))
+		    return 1;
+		}
+	    }
+	  else
+	    {
+	      /* Scan operand list of 'b' looking for an operand that
+		 references the same hardware element, and which goes in the
+		 right direction.  */
+	      for (b_index = 0;
+		   b_operands->type != CGEN_OPINST_END;
+		   b_index ++, b_operands ++)
+		{
+		  if ((b_operands->type
+		       == (check_outputs
+			   ? CGEN_OPINST_OUTPUT
+			   : CGEN_OPINST_INPUT))
+		      && (b_operands->hw_type == a_operands->hw_type)
+		      && (a->indices [a_index] == b->indices [b_index]))
+		    return 1;
+		}
+	    }
+	}
+    }
+
+  return 0;
+}
+
+/* Returns true if the insn can (potentially) alter the program counter.  */
+
+static int
+writes_to_pc (a)
+     m32r_insn * a;
+{
+#if 0  /* Once PC operands are working.... */
+  const CGEN_OPINST * a_operands == CGEN_INSN_OPERANDS (gas_cgen_cpu_desc,
+							a->insn);
+
+  if (a_operands == NULL)
+    return 0;
+
+  while (a_operands->type != CGEN_OPINST_END)
+    {
+      if (a_operands->operand != NULL
+	  && CGEN_OPERAND_INDEX (gas_cgen_cpu_desc, a_operands->operand) == M32R_OPERAND_PC)
+	return 1;
+      
+      a_operands ++;
+    }
+#else
+  if (CGEN_INSN_ATTR_VALUE (a->insn, CGEN_INSN_UNCOND_CTI)
+      || CGEN_INSN_ATTR_VALUE (a->insn, CGEN_INSN_COND_CTI))
+    return 1;
+#endif
+  return 0;
+}
+
+/* Returns NULL if the two 16 bit insns can be executed in parallel,
+   otherwise it returns a pointer to an error message explaining why not.  */
+
+static const char *
+can_make_parallel (a, b)
+     m32r_insn * a;
+     m32r_insn * b;
+{
+  PIPE_ATTR a_pipe;
+  PIPE_ATTR b_pipe;
+  
+  /* Make sure the instructions are the right length.  */
+  if (   CGEN_FIELDS_BITSIZE (& a->fields) != 16
+      || CGEN_FIELDS_BITSIZE (& b->fields) != 16)
+    abort();
+
+  if (first_writes_to_seconds_operands (a, b, true))
+    return _("Instructions write to the same destination register.");
+  
+  a_pipe = CGEN_INSN_ATTR_VALUE (a->insn, CGEN_INSN_PIPE);
+  b_pipe = CGEN_INSN_ATTR_VALUE (b->insn, CGEN_INSN_PIPE);
+
+  /* Make sure that the instructions use the correct execution pipelines.  */
+  if (   a_pipe == PIPE_NONE
+      || b_pipe == PIPE_NONE)
+    return _("Instructions do not use parallel execution pipelines.");
+
+  /* Leave this test for last, since it is the only test that can
+     go away if the instructions are swapped, and we want to make
+     sure that any other errors are detected before this happens.  */
+  if (   a_pipe == PIPE_S
+      || b_pipe == PIPE_O)
+    return _("Instructions share the same execution pipeline");
+  
+  return NULL;
+}
+
+/* Force the top bit of the second 16-bit insn to be set.  */
+
+static void
+make_parallel (buffer)
+     CGEN_INSN_BYTES_PTR buffer;
+{
+#if CGEN_INT_INSN_P
+  *buffer |= 0x8000;
+#else
+  buffer [CGEN_CPU_ENDIAN (gas_cgen_cpu_desc) == CGEN_ENDIAN_BIG ? 0 : 1]
+    |= 0x80;
+#endif
+}
+
+/* Same as make_parallel except buffer contains the bytes in target order.  */
+
+static void
+target_make_parallel (buffer)
+     char *buffer;
+{
+  buffer [CGEN_CPU_ENDIAN (gas_cgen_cpu_desc) == CGEN_ENDIAN_BIG ? 0 : 1]
+    |= 0x80;
+}
+
+/* Assemble two instructions with an explicit parallel operation (||) or
+   sequential operation (->).  */
+
+static void
+assemble_two_insns (str, str2, parallel_p)
+     char * str;
+     char * str2;
+     int    parallel_p;
+{
+  char *    str3;
+  m32r_insn first;
+  m32r_insn second;
+  char *    errmsg;
+  char      save_str2 = *str2;
+
+  * str2 = 0; /* Seperate the two instructions.  */
+
+  /* Make sure the two insns begin on a 32 bit boundary.
+     This is also done for the serial case (foo -> bar), relaxing doesn't
+     affect insns written like this.
+     Note that we must always do this as we can't assume anything about
+     whether we're currently on a 32 bit boundary or not.  Relaxing may
+     change this.  */
+  fill_insn (0);
+
+  first.debug_sym_link = debug_sym_link;
+  debug_sym_link = (sym_linkS *)0;
+
+  /* Parse the first instruction.  */
+  if (! (first.insn = m32r_cgen_assemble_insn
+	 (gas_cgen_cpu_desc, str, & first.fields, first.buffer, & errmsg)))
+    {
+      as_bad (errmsg);
+      return;
+    }
+
+  /* Check it.  */
+  if (CGEN_FIELDS_BITSIZE (&first.fields) != 16)
+    {
+      /* xgettext:c-format */
+      as_bad (_("not a 16 bit instruction '%s'"), str);
+      return;
+    }
+  else if (! enable_special
+      && CGEN_INSN_ATTR_VALUE (first.insn, CGEN_INSN_SPECIAL))
+    {
+      /* xgettext:c-format */
+      as_bad (_("unknown instruction '%s'"), str);
+      return;
+    }
+  else if (! enable_m32rx
+      /* FIXME: Need standard macro to perform this test.  */
+      && CGEN_INSN_ATTR_VALUE (first.insn, CGEN_INSN_MACH) == (1 << MACH_M32RX))
+    {
+      /* xgettext:c-format */
+      as_bad (_("instruction '%s' is for the M32RX only"), str);
+      return;
+    }
+    
+  /* Check to see if this is an allowable parallel insn.  */
+  if (parallel_p && CGEN_INSN_ATTR_VALUE (first.insn, CGEN_INSN_PIPE) == PIPE_NONE)
+    {
+      /* xgettext:c-format */
+      as_bad (_("instruction '%s' cannot be executed in parallel."), str);
+      return;
+    }
+  
+  *str2 = save_str2; /* Restore the original assembly text, just in case it is needed.  */
+  str3  = str;       /* Save the original string pointer.  */
+  str   = str2 + 2;  /* Advanced past the parsed string.  */
+  str2  = str3;      /* Remember the entire string in case it is needed for error messages.  */
+
+  /* Convert the opcode to lower case.  */
+  {
+    char *s2 = str;
+    
+    while (isspace (*s2 ++))
+      continue;
+
+    --s2;
+
+    while (isalnum (*s2))
+      {
+	if (isupper ((unsigned char) *s2))
+	  *s2 = tolower (*s2);
+	s2 ++;
+      }
+  }
+  
+  /* Preserve any fixups that have been generated and reset the list to empty.  */
+  gas_cgen_save_fixups ();
+
+  /* Get the indices of the operands of the instruction.  */
+  /* FIXME: CGEN_FIELDS is already recorded, but relying on that fact
+     doesn't seem right.  Perhaps allow passing fields like we do insn.  */
+  /* FIXME: ALIAS insns do not have operands, so we use this function
+     to find the equivalent insn and overwrite the value stored in our
+     structure.  We still need the original insn, however, since this
+     may have certain attributes that are not present in the unaliased
+     version (eg relaxability).  When aliases behave differently this
+     may have to change.  */
+  first.orig_insn = first.insn;
+  {
+    CGEN_FIELDS tmp_fields;
+    first.insn = cgen_lookup_get_insn_operands
+      (gas_cgen_cpu_desc, NULL, INSN_VALUE (first.buffer), NULL, 16,
+       first.indices, &tmp_fields);
+  }
+  
+  if (first.insn == NULL)
+    as_fatal (_("internal error: lookup/get operands failed"));
+
+  second.debug_sym_link = NULL;
+
+  /* Parse the second instruction.  */
+  if (! (second.insn = m32r_cgen_assemble_insn
+	 (gas_cgen_cpu_desc, str, & second.fields, second.buffer, & errmsg)))
+    {
+      as_bad (errmsg);
+      return;
+    }
+
+  /* Check it.  */
+  if (CGEN_FIELDS_BITSIZE (&second.fields) != 16)
+    {
+      /* xgettext:c-format */
+      as_bad (_("not a 16 bit instruction '%s'"), str);
+      return;
+    }
+  else if (! enable_special
+      && CGEN_INSN_ATTR_VALUE (second.insn, CGEN_INSN_SPECIAL))
+    {
+      /* xgettext:c-format */
+      as_bad (_("unknown instruction '%s'"), str);
+      return;
+    }
+  else if (! enable_m32rx
+      && CGEN_INSN_ATTR_VALUE (second.insn, CGEN_INSN_MACH) == (1 << MACH_M32RX))
+    {
+      /* xgettext:c-format */
+      as_bad (_("instruction '%s' is for the M32RX only"), str);
+      return;
+    }
+
+  /* Check to see if this is an allowable parallel insn.  */
+  if (parallel_p && CGEN_INSN_ATTR_VALUE (second.insn, CGEN_INSN_PIPE) == PIPE_NONE)
+    {
+      /* xgettext:c-format */
+      as_bad (_("instruction '%s' cannot be executed in parallel."), str);
+      return;
+    }
+  
+  if (parallel_p && ! enable_m32rx)
+    {
+      if (CGEN_INSN_NUM (first.insn) != M32R_INSN_NOP
+	  && CGEN_INSN_NUM (second.insn) != M32R_INSN_NOP)
+	{
+	  /* xgettext:c-format */
+	  as_bad (_("'%s': only the NOP instruction can be issued in parallel on the m32r"), str2);
+	  return;
+	}
+    }
+
+  /* Get the indices of the operands of the instruction.  */
+  second.orig_insn = second.insn;
+  {
+    CGEN_FIELDS tmp_fields;
+    second.insn = cgen_lookup_get_insn_operands
+      (gas_cgen_cpu_desc, NULL, INSN_VALUE (second.buffer), NULL, 16,
+       second.indices, &tmp_fields);
+  }
+  
+  if (second.insn == NULL)
+    as_fatal (_("internal error: lookup/get operands failed"));
+
+  /* We assume that if the first instruction writes to a register that is
+     read by the second instruction it is because the programmer intended
+     this to happen, (after all they have explicitly requested that these
+     two instructions be executed in parallel).  Although if the global
+     variable warn_explicit_parallel_conflicts is true then we do generate
+     a warning message.  Similarly we assume that parallel branch and jump
+     instructions are deliberate and should not produce errors.  */
+  
+  if (parallel_p && warn_explicit_parallel_conflicts)
+    {
+      if (first_writes_to_seconds_operands (& first, & second, false))
+	/* xgettext:c-format */
+	as_warn (_("%s: output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?"), str2);
+      
+      if (first_writes_to_seconds_operands (& second, & first, false))
+	/* xgettext:c-format */
+	as_warn (_("%s: output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?"), str2);
+    }
+      
+  if (!parallel_p
+      || (errmsg = (char *) can_make_parallel (& first, & second)) == NULL)
+    {
+      /* Get the fixups for the first instruction.  */
+      gas_cgen_swap_fixups ();
+
+      /* Write it out.  */
+      expand_debug_syms (first.debug_sym_link, 1);
+      gas_cgen_finish_insn (first.orig_insn, first.buffer,
+			    CGEN_FIELDS_BITSIZE (& first.fields), 0, NULL);
+      
+      /* Force the top bit of the second insn to be set.  */
+      if (parallel_p)
+	make_parallel (second.buffer);
+
+      /* Get its fixups.  */
+      gas_cgen_restore_fixups ();
+
+      /* Write it out.  */
+      expand_debug_syms (second.debug_sym_link, 1);
+      gas_cgen_finish_insn (second.orig_insn, second.buffer,
+			    CGEN_FIELDS_BITSIZE (& second.fields), 0, NULL);
+    }
+  /* Try swapping the instructions to see if they work that way.  */
+  else if (can_make_parallel (& second, & first) == NULL)
+    {
+      /* Write out the second instruction first.  */
+      expand_debug_syms (second.debug_sym_link, 1);
+      gas_cgen_finish_insn (second.orig_insn, second.buffer,
+			    CGEN_FIELDS_BITSIZE (& second.fields), 0, NULL);
+      
+      /* Force the top bit of the first instruction to be set.  */
+      make_parallel (first.buffer);
+
+      /* Get the fixups for the first instruction.  */
+      gas_cgen_restore_fixups ();
+
+      /* Write out the first instruction.  */
+      expand_debug_syms (first.debug_sym_link, 1);
+      gas_cgen_finish_insn (first.orig_insn, first.buffer,
+			    CGEN_FIELDS_BITSIZE (& first.fields), 0, NULL);
+    }
+  else
+    {
+      as_bad ("'%s': %s", str2, errmsg);
+      return;
+    }
+      
+  /* Set these so m32r_fill_insn can use them.  */
+  prev_seg    = now_seg;
+  prev_subseg = now_subseg;
+}
 
 void
 md_assemble (str)
@@ -479,6 +984,19 @@
   /* Initialize GAS's cgen interface for a new instruction.  */
   gas_cgen_init_parse ();
 
+  /* Look for a parallel instruction seperator.  */
+  if ((str2 = strstr (str, "||")) != NULL)
+    {
+      assemble_two_insns (str, str2, 1);
+      return;
+    }
+
+  /* Also look for a sequential instruction seperator.  */
+  if ((str2 = strstr (str, "->")) != NULL)
+    {
+      assemble_two_insns (str, str2, 0);
+      return;
+    }
   
   insn.debug_sym_link = debug_sym_link;
   debug_sym_link = (sym_linkS *)0;
@@ -492,6 +1010,20 @@
       return;
     }
 
+  if (! enable_special
+      && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_SPECIAL))
+    {
+      /* xgettext:c-format */
+      as_bad (_("unknown instruction '%s'"), str);
+      return;
+    }
+  else if (! enable_m32rx
+	   && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_MACH) == (1 << MACH_M32RX))
+    {
+      /* xgettext:c-format */
+      as_bad (_("instruction '%s' is for the M32RX only"), str);
+      return;
+    }
   
   if (CGEN_INSN_BITSIZE (insn.insn) == 32)
     {
@@ -513,16 +1045,62 @@
   else
     {
       int on_32bit_boundary_p;
+      int swap = false;
 
       if (CGEN_INSN_BITSIZE (insn.insn) != 16)
 	abort();
 
       insn.orig_insn = insn.insn;
 
+      /* If the previous insn was relaxable, then it may be expanded
+	 to fill the current 16 bit slot.  Emit a NOP here to occupy
+	 this slot, so that we can start at optimizing at a 32 bit
+	 boundary.  */
+      if (prev_insn.insn && seen_relaxable_p && optimize)
+	fill_insn (0);
+      
+      if (enable_m32rx)
+	{
+	  /* Get the indices of the operands of the instruction.
+	     FIXME: See assemble_parallel for notes on orig_insn.  */
+	  {
+	    CGEN_FIELDS tmp_fields;
+	    insn.insn = cgen_lookup_get_insn_operands
+	      (gas_cgen_cpu_desc, NULL, INSN_VALUE (insn.buffer), NULL,
+	       16, insn.indices, &tmp_fields);
+	  }
+	  
+	  if (insn.insn == NULL)
+	    as_fatal (_("internal error: lookup/get operands failed"));
+	}
+
       /* Compute whether we're on a 32 bit boundary or not.
 	 prev_insn.insn is NULL when we're on a 32 bit boundary.  */
       on_32bit_boundary_p = prev_insn.insn == NULL;
 
+      /* Look to see if this instruction can be combined with the
+	 previous instruction to make one, parallel, 32 bit instruction.
+	 If the previous instruction (potentially) changed the flow of
+	 program control, then it cannot be combined with the current
+	 instruction.  If the current instruction is relaxable, then it
+	 might be replaced with a longer version, so we cannot combine it.
+	 Also if the output of the previous instruction is used as an
+	 input to the current instruction then it cannot be combined.
+	 Otherwise call can_make_parallel() with both orderings of the
+	 instructions to see if they can be combined.  */
+      if (     ! on_32bit_boundary_p
+	  &&   enable_m32rx
+	  &&   optimize
+	  &&   CGEN_INSN_ATTR_VALUE (insn.orig_insn, CGEN_INSN_RELAXABLE) == 0
+	  && ! writes_to_pc (& prev_insn)
+	  && ! first_writes_to_seconds_operands (& prev_insn, &insn, false)
+	  )
+	{
+	  if (can_make_parallel (& prev_insn, & insn) == NULL)
+	    make_parallel (insn.buffer);
+	  else if (can_make_parallel (& insn, & prev_insn) == NULL)
+	    swap = true;
+	}
 
       expand_debug_syms (insn.debug_sym_link, 1);
 
@@ -543,6 +1121,33 @@
 	  insn.fixups[i] = fi.fixups[i];
       }
 
+      if (swap)
+	{
+	  int i,tmp;
+
+#define SWAP_BYTES(a,b) tmp = a; a = b; b = tmp
+
+	  /* Swap the two insns */
+	  SWAP_BYTES (prev_insn.addr [0], insn.addr [0]);
+	  SWAP_BYTES (prev_insn.addr [1], insn.addr [1]);
+
+	  target_make_parallel (insn.addr);
+
+	  /* Swap any relaxable frags recorded for the two insns.  */
+	  /* FIXME: Clarify.  relaxation precludes parallel insns */
+	  if (prev_insn.frag->fr_opcode == prev_insn.addr)
+	    prev_insn.frag->fr_opcode = insn.addr;
+	  else if (insn.frag->fr_opcode == insn.addr)
+	    insn.frag->fr_opcode = prev_insn.addr;
+
+	  /* Update the addresses in any fixups.
+	     Note that we don't have to handle the case where each insn is in
+	     a different frag as we ensure they're in the same frag above.  */
+	  for (i = 0; i < prev_insn.num_fixups; ++i)
+	    prev_insn.fixups[i]->fx_where += 2;
+	  for (i = 0; i < insn.num_fixups; ++i)
+	    insn.fixups[i]->fx_where -= 2;
+	}
 
       /* Keep track of whether we've seen a pair of 16 bit insns.
 	 prev_insn.insn is NULL when we're on a 32 bit boundary.  */
@@ -694,7 +1299,7 @@
       return;
     }
 
-  if (symbolP->local)
+  if (symbol_get_obj (symbolP)->local)
     {
       segT   old_sec    = now_seg;
       int    old_subsec = now_subseg;
@@ -707,9 +1312,9 @@
 	frag_align (align2, 0, 0);
       
       if (S_GET_SEGMENT (symbolP) == sbss_section)
-	symbolP->sy_frag->fr_symbol = 0;
+	symbol_get_frag (symbolP)->fr_symbol = 0;
       
-      symbolP->sy_frag = frag_now;
+      symbol_set_frag (symbolP, frag_now);
       
       pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
 			(char *) 0);
@@ -936,7 +1541,7 @@
     {
       /* Address we want to reach in file space.  */
       target_address = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
-      target_address += fragP->fr_symbol->sy_frag->fr_address;
+      target_address += symbol_get_frag (fragP->fr_symbol)->fr_address;
       addend = (target_address - (opcode_address & -4)) >> 2;
     }
 
@@ -1282,6 +1887,18 @@
    fixS *fixP;
 {
 
+  bfd_reloc_code_real_type reloc_type;
+ 
+  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
+    {
+      const CGEN_INSN *insn = NULL;
+      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
+      const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
+      reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
+    }
+  else
+    reloc_type = fixP->fx_r_type;
+
   if (fixP->fx_addsy == NULL)
     return 1;
   
@@ -1292,8 +1909,8 @@
     return 0;
   
   /* We need the symbol name for the VTABLE entries */
-  if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
-      || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+  if (reloc_type == BFD_RELOC_VTABLE_INHERIT
+      || reloc_type == BFD_RELOC_VTABLE_ENTRY)
     return 0;
 
   return 1;
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 856dd4e..0749665 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -1,5 +1,5 @@
 /* tc-m68k.c -- Assemble for the m68k family
-   Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -27,6 +27,10 @@
 #include "opcode/m68k.h"
 #include "m68k-parse.h"
 
+#if defined (OBJ_ELF)
+#include "elf/m68k.h"
+#endif
+
 /* This string holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful.  The macro
    tc_comment_chars points to this.  We use this, rather than the
@@ -189,7 +193,7 @@
   USP, VBR, URP, SRP, PCR,
   0
 };
-static const enum m68k_register mcf5200_control_regs[] = {
+static const enum m68k_register mcf_control_regs[] = {
   CACR, TC, ITT0, ITT1, DTT0, DTT1, VBR, ROMBAR, 
   RAMBAR0, RAMBAR1, MBAR,
   0
@@ -247,9 +251,10 @@
   reloc[5];			/* Five is enough??? */
 };
 
-#define cpu_of_arch(x)		((x) & (m68000up|mcf5200))
+#define cpu_of_arch(x)		((x) & (m68000up|mcf))
 #define float_of_arch(x)	((x) & mfloat)
 #define mmu_of_arch(x)		((x) & mmmu)
+#define arch_coldfire_p(x)	(((x) & mcf) != 0)
 
 /* Macros for determining if cpu supports a specific addressing mode */
 #define HAVE_LONG_BRANCH(x)	((x) & (m68020|m68030|m68040|m68060|cpu32))
@@ -391,6 +396,8 @@
   { m68881, "68881", 0 },
   { m68851, "68851", 0 },
   { mcf5200, "5200", 0 },
+  { mcf5206e, "5206e", 0 },
+  { mcf5307, "5307", 0},
   /* Aliases (effectively, so far as gas is concerned) for the above
      cpus.  */
   { m68020, "68k", 1 },
@@ -418,6 +425,9 @@
   { cpu32,  "68349", 1 },
   { cpu32,  "68360", 1 },
   { m68881, "68882", 1 },
+  { mcf5200, "5202", 1 },
+  { mcf5200, "5204", 1 },
+  { mcf5200, "5206", 1 },
 };
 
 static const int n_archs = sizeof (archs) / sizeof (archs[0]);
@@ -897,7 +907,8 @@
 #undef MAP
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 #ifndef OBJ_ELF
   if (fixp->fx_pcrel)
@@ -1471,11 +1482,26 @@
 		    losing++;
 		  break;
 
+		case 'E':
+		  if (opP->reg != ACC)
+		    losing++;
+		  break;
+
 		case 'F':
 		  if (opP->mode != FPREG)
 		    losing++;
 		  break;
 
+		case 'G':
+		  if (opP->reg != MACSR)
+		    losing++;
+		  break;
+
+		case 'H':
+		  if (opP->reg != MASK)
+		    losing++;
+		  break;
+
 		case 'I':
 		  if (opP->mode != CONTROL
 		      || opP->reg < COP0
@@ -1737,6 +1763,19 @@
 		    ++losing;
 		  break;
 
+		case 'u':
+		  if (opP->reg < DATA0L || opP->reg > ADDR7U)
+		    losing++;
+		  /* FIXME: kludge instead of fixing parser:
+                     upper/lower registers are *not* CONTROL
+                     registers, but ordinary ones. */
+		  if ((opP->reg >= DATA0L && opP->reg <= DATA7L)
+		      || (opP->reg >= DATA0U && opP->reg <= DATA7U))
+		    opP->mode = DREG;
+		  else
+		    opP->mode = AREG;
+		  break;
+
 		default:
 		  abort ();
 		}		/* switch on type of operand */
@@ -1994,11 +2033,11 @@
 		      && ((opP->disp.size == SIZE_UNSPEC
 			   && flag_short_refs == 0
 			   && cpu_of_arch (current_architecture) >= m68020
-			   && cpu_of_arch (current_architecture) != mcf5200)
+			   && ! arch_coldfire_p (current_architecture))
 			  || opP->disp.size == SIZE_LONG)))
 		{
 		  if (cpu_of_arch (current_architecture) < m68020
-		      || cpu_of_arch (current_architecture) == mcf5200)
+		      || arch_coldfire_p (current_architecture))
 		    opP->error =
 		      _("displacement too large for this architecture; needs 68020 or higher");
 		  if (opP->reg == PC)
@@ -2107,12 +2146,16 @@
 		  if ((opP->index.scale != 1 
 		       && cpu_of_arch (current_architecture) < m68020)
 		      || (opP->index.scale == 8 
-			  && current_architecture == mcf5200))
+			  && arch_coldfire_p (current_architecture)))
 		    {
 		      opP->error =
 			_("scale factor invalid on this architecture; needs cpu32 or 68020 or higher");
 		    }
 
+		  if (arch_coldfire_p (current_architecture)
+		      && opP->index.size == SIZE_WORD)
+		    opP->error = _("invalid index size for coldfire");
+
 		  switch (opP->index.scale)
 		    {
 		    case 1:
@@ -2144,7 +2187,7 @@
 		    {
 		      if (siz1 == SIZE_BYTE
 			  || cpu_of_arch (current_architecture) < m68020
-			  || cpu_of_arch (current_architecture) == mcf5200
+			  || arch_coldfire_p (current_architecture)
 			  || (siz1 == SIZE_UNSPEC
 			      && ! isvar (&opP->disp)
 			      && issbyte (baseo)))
@@ -2211,7 +2254,7 @@
 	      /* It isn't simple.  */
 
 	      if (cpu_of_arch (current_architecture) < m68020
-		  || cpu_of_arch (current_architecture) == mcf5200)
+		  || arch_coldfire_p (current_architecture))
 		opP->error =
 		  _("invalid operand mode for this architecture; needs 68020 or higher");
 
@@ -2570,10 +2613,17 @@
 	  install_operand (s[1], opP->reg - DATA);
 	  break;
 
+	case 'E':		/* Ignore it */
+	  break;
+
 	case 'F':
 	  install_operand (s[1], opP->reg - FP0);
 	  break;
 
+	case 'G':		/* Ignore it */
+	case 'H':
+	  break;
+
 	case 'I':
 	  tmpreg = opP->reg - COP0;
 	  install_operand (s[1], tmpreg);
@@ -2901,6 +2951,11 @@
 	  addword (tmpreg >> 16);
 	  addword (tmpreg & 0xFFFF);
 	  break;
+	case 'u':
+	  install_operand (s[1], opP->reg - DATA0L);
+	  opP->reg -= (DATA0L);
+	  opP->reg &= 0x0F;	/* remove upper/lower bit */
+	  break;
 	default:
 	  abort ();
 	}
@@ -3040,6 +3095,30 @@
       the_ins.opcode[1] = (val >> 16);
       the_ins.opcode[2] = val & 0xffff;
       break;
+    case 'm':
+      the_ins.opcode[0] |= ((val & 0x8) << (6 - 3));
+      the_ins.opcode[0] |= ((val & 0x7) << 9);
+      the_ins.opcode[1] |= ((val & 0x10) << (7 - 4));
+      break;
+    case 'n':
+      the_ins.opcode[0] |= ((val & 0x8) << (6 - 3));
+      the_ins.opcode[0] |= ((val & 0x7) << 9);
+      break;
+    case 'o':
+      the_ins.opcode[1] |= val << 12;
+      the_ins.opcode[1] |= ((val & 0x10) << (7 - 4));
+      break;
+    case 'M':
+      the_ins.opcode[0] |= (val & 0xF);
+      the_ins.opcode[1] |= ((val & 0x10) << (6 - 4));
+      break;
+    case 'N':
+      the_ins.opcode[1] |= (val & 0xF);
+      the_ins.opcode[1] |= ((val & 0x10) << (6 - 4));
+      break;
+    case 'h':
+      the_ins.opcode[1] |= ((val != 1) << 10);
+      break;
     case 'c':
     default:
       as_fatal (_("failed sanity check."));
@@ -3241,6 +3320,10 @@
   { "ccr", CCR },
   { "cc", CCR },
 
+  { "acc", ACC },
+  { "macsr", MACSR },
+  { "mask", MASK },
+
   /* control registers */
   { "sfc", SFC },		/* Source Function Code */
   { "sfcr", SFC },
@@ -3345,6 +3428,43 @@
   { "za6", ZADDR6 },
   { "za7", ZADDR7 },
 
+  /* Upper and lower data and address registers, used by macw and msacw. */
+  { "d0l", DATA0L },
+  { "d1l", DATA1L },
+  { "d2l", DATA2L },
+  { "d3l", DATA3L },
+  { "d4l", DATA4L },
+  { "d5l", DATA5L },
+  { "d6l", DATA6L },
+  { "d7l", DATA7L },
+
+  { "a0l", ADDR0L },
+  { "a1l", ADDR1L },
+  { "a2l", ADDR2L },
+  { "a3l", ADDR3L },
+  { "a4l", ADDR4L },
+  { "a5l", ADDR5L },
+  { "a6l", ADDR6L },
+  { "a7l", ADDR7L },
+
+  { "d0u", DATA0U },
+  { "d1u", DATA1U },
+  { "d2u", DATA2U },
+  { "d3u", DATA3U },
+  { "d4u", DATA4U },
+  { "d5u", DATA5U },
+  { "d6u", DATA6U },
+  { "d7u", DATA7U },
+
+  { "a0u", ADDR0U },
+  { "a1u", ADDR1U },
+  { "a2u", ADDR2U },
+  { "a3u", ADDR3U },
+  { "a4u", ADDR4U },
+  { "a5u", ADDR5U },
+  { "a6u", ADDR6U },
+  { "a7u", ADDR7U },
+
   { 0, 0 }
 };
 
@@ -3779,7 +3899,9 @@
       control_regs = cpu32_control_regs;
       break;
     case mcf5200:
-      control_regs = mcf5200_control_regs;
+    case mcf5206e:
+    case mcf5307:
+      control_regs = mcf_control_regs;
       break;
     default:
       abort ();
@@ -3853,7 +3975,7 @@
   select_control_regs ();
 
   if (cpu_of_arch (current_architecture) < m68020
-      || cpu_of_arch (current_architecture) == mcf5200)
+      || arch_coldfire_p (current_architecture))
     md_relax_table[TAB (PCINDEX, BYTE)].rlx_more = 0;
 }
 
@@ -4171,7 +4293,7 @@
   disp = (disp + fragP->fr_offset) - object_address;
 
 #ifdef BFD_ASSEMBLER
-  disp += fragP->fr_symbol->sy_frag->fr_address;
+  disp += symbol_get_frag (fragP->fr_symbol)->fr_address;
 #endif
 
   switch (fragP->fr_subtype)
@@ -4373,8 +4495,8 @@
 
 void
 md_convert_frag (abfd, sec, fragP)
-     bfd *abfd;
-     segT sec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     segT sec ATTRIBUTE_UNUSED;
      fragS *fragP;
 {
   md_convert_frag_1 (fragP);
@@ -4620,14 +4742,14 @@
 	 word mode.  */
       if (fragP->fr_symbol && S_GET_VALUE (fragP->fr_symbol) == 0)
 	{
+	  fragS *stop;
 	  fragS *l;
 
-	  for (l = fragP->fr_next;
-	       l != fragP->fr_symbol->sy_frag;
-	       l = l->fr_next)
+	  stop = symbol_get_frag (fragP->fr_symbol);
+	  for (l = fragP->fr_next; l != stop; l = l->fr_next)
 	    if (l->fr_fix + l->fr_var != 0)
 	      break;
-	  if (l == fragP->fr_symbol->sy_frag)
+	  if (l == stop)
 	    {
 	      fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
 	      fragP->fr_var += 2;
@@ -4712,8 +4834,8 @@
 md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
      char *ptr;
      addressT from_addr, to_addr;
-     fragS *frag;
-     symbolS *to_symbol;
+     fragS *frag ATTRIBUTE_UNUSED;
+     symbolS *to_symbol ATTRIBUTE_UNUSED;
 {
   valueT offset;
 
@@ -4898,7 +5020,7 @@
 
 static void
 s_data1 (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   subseg_set (data_section, 1);
   demand_empty_rest_of_line ();
@@ -4906,7 +5028,7 @@
 
 static void
 s_data2 (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   subseg_set (data_section, 2);
   demand_empty_rest_of_line ();
@@ -4914,7 +5036,7 @@
 
 static void
 s_bss (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   /* We don't support putting frags in the BSS segment, we fake it
      by marking in_bss, then looking at s_skip for clues.  */
@@ -4925,7 +5047,7 @@
 
 static void
 s_even (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register int temp;
   register long temp_fill;
@@ -4940,7 +5062,7 @@
 
 static void
 s_proc (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   demand_empty_rest_of_line ();
 }
@@ -5016,7 +5138,7 @@
 
 static void
 s_chip (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *stop = NULL;
   char stopc;
@@ -5033,7 +5155,7 @@
 
 static void
 s_fopt (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   SKIP_WHITESPACE ();
 
@@ -5143,7 +5265,7 @@
 
 static void
 s_opt (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   do
     {
@@ -5211,8 +5333,8 @@
 
 static void
 skip_to_comma (arg, on)
-     int arg;
-     int on;
+     int arg ATTRIBUTE_UNUSED;
+     int on ATTRIBUTE_UNUSED;
 {
   while (*input_line_pointer != ','
 	 && ! is_end_of_line[(unsigned char) *input_line_pointer])
@@ -5223,8 +5345,8 @@
 
 static void
 opt_nest (arg, on)
-     int arg;
-     int on;
+     int arg ATTRIBUTE_UNUSED;
+     int on ATTRIBUTE_UNUSED;
 {
   if (*input_line_pointer != '=')
     {
@@ -5240,8 +5362,8 @@
 
 static void
 opt_chip (arg, on)
-     int arg;
-     int on;
+     int arg ATTRIBUTE_UNUSED;
+     int on ATTRIBUTE_UNUSED;
 {
   if (*input_line_pointer != '=')
     {
@@ -5257,7 +5379,7 @@
 
 static void
 opt_list (arg, on)
-     int arg;
+     int arg ATTRIBUTE_UNUSED;
      int on;
 {
   listing_list (on);
@@ -5267,7 +5389,7 @@
 
 static void
 opt_list_symbols (arg, on)
-     int arg;
+     int arg ATTRIBUTE_UNUSED;
      int on;
 {
   if (on)
@@ -5280,7 +5402,7 @@
 
 static void
 s_reg (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *s;
   int c;
@@ -5351,7 +5473,7 @@
 
   S_SET_SEGMENT (line_label, reg_section);
   S_SET_VALUE (line_label, ~mask);
-  line_label->sy_frag = &zero_address_frag;
+  symbol_set_frag (line_label, &zero_address_frag);
 
   if (flag_mri)
     mri_comment_end (stop, stopc);
@@ -5384,7 +5506,7 @@
 
 static void
 s_save (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   struct save_opts *s;
 
@@ -5409,7 +5531,7 @@
 
 static void
 s_restore (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   struct save_opts *s;
 
@@ -6086,7 +6208,7 @@
 
 static void
 s_mri_endi (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (mri_control_stack == NULL
       || mri_control_stack->type != mri_if)
@@ -6429,7 +6551,7 @@
 
 static void
 s_mri_endf (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (mri_control_stack == NULL
       || mri_control_stack->type != mri_for)
@@ -6465,7 +6587,7 @@
 
 static void
 s_mri_repeat (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   struct mri_control_info *n;
 
@@ -6570,7 +6692,7 @@
 
 static void
 s_mri_endw (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *buf;
 
@@ -6929,7 +7051,7 @@
 /* ARGSUSED */
 symbolS *
 md_undefined_symbol (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -6937,7 +7059,7 @@
 /* Round up a section size to the appropriate boundary.  */
 valueT
 md_section_align (segment, size)
-     segT segment;
+     segT segment ATTRIBUTE_UNUSED;
      valueT size;
 {
 #ifdef OBJ_AOUT
@@ -7005,5 +7127,12 @@
 
 #endif
 #endif
-
+#ifdef OBJ_ELF
+void m68k_elf_final_processing()
+{
+   /* Set file-specific flags if this is a cpu32 processor */
+   if (cpu_of_arch (current_architecture) & cpu32)
+     elf_elfheader (stdoutput)->e_flags |= EF_CPU32;
+}
+#endif
 /* end of tc-m68k.c */
diff --git a/gas/config/tc-m68k.h b/gas/config/tc-m68k.h
index bc8308a..b3daf5e 100644
--- a/gas/config/tc-m68k.h
+++ b/gas/config/tc-m68k.h
@@ -1,5 +1,5 @@
 /* This file is tc-m68k.h
-   Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -22,7 +22,6 @@
 #define TC_M68K 1
 
 #ifdef ANSI_PROTOTYPES
-struct symbol;
 struct fix;
 #endif
 
@@ -124,7 +123,7 @@
 #define LEX_TILDE LEX_BEGIN_NAME
 #define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s)
 /* On the Delta, dots are not required before pseudo-ops.  */
-#define NO_PSEUDO_DOT
+#define NO_PSEUDO_DOT 1
 #ifndef BFD_ASSEMBLER
 #undef LOCAL_LABEL
 #define LOCAL_LABEL(name) \
@@ -138,13 +137,13 @@
 extern int m68k_conditional_pseudoop PARAMS ((pseudo_typeS *));
 #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop)
 
-extern void m68k_frob_label PARAMS ((struct symbol *));
+extern void m68k_frob_label PARAMS ((symbolS *));
 #define tc_frob_label(sym) m68k_frob_label (sym)
 
 extern void m68k_flush_pending_output PARAMS ((void));
 #define md_flush_pending_output() m68k_flush_pending_output ()
 
-extern void m68k_frob_symbol PARAMS ((struct symbol *));
+extern void m68k_frob_symbol PARAMS ((symbolS *));
 
 #ifdef BFD_ASSEMBLER
 
@@ -176,6 +175,8 @@
 
 #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X)
 extern int tc_m68k_fix_adjustable PARAMS ((struct fix *));
+#define elf_tc_final_processing m68k_elf_final_processing
+extern void m68k_elf_final_processing PARAMS ((void));
 #endif
 
 #define TC_FORCE_RELOCATION(FIX)			\
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index 931a496a..f77460a 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -1,7 +1,7 @@
 /* m88k.c -- Assembler for the Motorola 88000
    Contributed by Devon Bowen of Buffalo University
    and Torbjorn Granlund of the Swedish Institute of Computer Science.
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -1214,9 +1214,9 @@
 	      ri.r_extern = 0;
 	      ri.r_symbolnum = symbolP->sy_type & N_TYPE;
 	    }
-	  if (symbolP && symbolP->sy_frag)
+	  if (symbolP && symbol_get_frag (symbolP))
 	    {
-	      ri.r_addend = symbolP->sy_frag->fr_address;
+	      ri.r_addend = symbol_get_frag (symbolP)->fr_address;
 	    }
 	  ri.r_type = fixP->fx_r_type;
 	  if (fixP->fx_pcrel)
@@ -1294,10 +1294,10 @@
 	    frag_align (bss_align, 0, 0);
 
 	  /* detach from old frag */
-	  if (symbolP->sy_type == N_BSS && symbolP->sy_frag != NULL)
-	    symbolP->sy_frag->fr_symbol = NULL;
+	  if (symbolP->sy_type == N_BSS && symbol_get_frag (symbolP) != NULL)
+	    symbol_get_frag (symbolP)->fr_symbol = NULL;
 
-	  symbolP->sy_frag  = frag_now;
+	  symbol_set_frag (symbolP, frag_now);
 	  p = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
 			(offsetT) temp, (char *)0);
 	  *p = 0;
diff --git a/gas/config/tc-m88k.h b/gas/config/tc-m88k.h
index 426b697..cbd69c8 100644
--- a/gas/config/tc-m88k.h
+++ b/gas/config/tc-m88k.h
@@ -1,7 +1,7 @@
 /* m88k.h -- Assembler for the Motorola 88000
    Contributed by Devon Bowen of Buffalo University
    and Torbjorn Granlund of the Swedish Institute of Computer Science.
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 2000
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -70,7 +70,7 @@
 #endif
 
 /* The m88k uses pseudo-ops with no leading period.  */
-#define NO_PSEUDO_DOT
+#define NO_PSEUDO_DOT 1
 
 /* Don't warn on word overflow; it happens on %hi relocs.  */
 #undef WARN_SIGNED_OVERFLOW_WORD
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 7e78435..d072f03 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -1,6 +1,5 @@
 /* tc-mcore.c -- Assemble code for M*Core
-
-   Copyright (C) 1993,1994, 1999 Free Software Foundation.
+   Copyright (C) 1999, 2000 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -15,8 +14,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   along with GAS; 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 "as.h"
@@ -40,29 +40,33 @@
 static void   mcore_cons PARAMS ((int));
 static void   mcore_float_cons PARAMS ((int));
 static void   mcore_stringer PARAMS ((int));
+static void   mcore_fill   PARAMS ((int));
 static int    log2 PARAMS ((unsigned int));
-static char * parse_reg PARAMS ((char *, unsigned *));
-static char * parse_creg PARAMS ((char *, unsigned *));
-static char * parse_exp PARAMS ((char *, expressionS *));
+static char * parse_reg    PARAMS ((char *, unsigned *));
+static char * parse_creg   PARAMS ((char *, unsigned *));
+static char * parse_exp    PARAMS ((char *, expressionS *));
+static char * parse_rt     PARAMS ((char *, char **, int, expressionS *));
+static char * parse_imm    PARAMS ((char *, unsigned *, unsigned, unsigned));
+static char * parse_mem    PARAMS ((char *, unsigned *, unsigned *, unsigned));
+static char * parse_psrmod PARAMS ((char *, unsigned *));
 static void   make_name PARAMS ((char *, char *, int));
 static int    enter_literal PARAMS ((expressionS *, int));
-static char * parse_rt PARAMS ((char *, char **, int, expressionS *));
-static char * parse_imm PARAMS ((char *, unsigned *, unsigned, unsigned));
-static char * parse_mem PARAMS ((char *, unsigned *, unsigned *, unsigned));
 static void   dump_literals PARAMS ((int));
 static void   check_literals PARAMS ((int, int));
 static void   mcore_s_text    PARAMS ((int));
 static void   mcore_s_data    PARAMS ((int));
-#ifdef OBJ_ELF
 static void   mcore_s_section PARAMS ((int));
+static void   mcore_s_bss     PARAMS ((int));
+#ifdef OBJ_ELF
+static void   mcore_s_comm    PARAMS ((int));
 #endif
 
 /* Several places in this file insert raw instructions into the
    object. They should use MCORE_INST_XXX macros to get the opcodes
    and then use these two macros to crack the MCORE_INST value into
    the appropriate byte values.  */
-#define	INST_BYTE0(x)	(((x) >> 8) & 0xFF)
-#define	INST_BYTE1(x)	((x) & 0xFF)
+#define	INST_BYTE0(x)  (target_big_endian ? (((x) >> 8) & 0xFF) : ((x) & 0xFF))
+#define	INST_BYTE1(x)  (target_big_endian ? ((x) & 0xFF) : (((x) >> 8) & 0xFF))
 
 const char comment_chars[] = "#/";
 const char line_separator_chars[] = ";";
@@ -70,7 +74,6 @@
 
 const int md_reloc_size = 8;
 
-static int relax;		/* set if -relax seen */
 static int do_jsri2bsr = 0;	/* change here from 1 by Cruess 19 August 97 */
 static int sifilter_mode = 0;
 
@@ -101,6 +104,14 @@
 #define U12_LEN	        2
 #define U32_LEN	        8	/* allow for align */
 
+typedef enum
+{
+  M210,
+  M340
+}
+cpu_type;
+
+cpu_type cpu = M340;
 
 /* Initialize the relax table */
 const relax_typeS md_relax_table[] =
@@ -165,7 +176,6 @@
   { "import",   s_ignore,         0 },
   { "literals", mcore_s_literals, 0 },
   { "page",     listing_eject,    0 },
-  { "bss",      s_lcomm_bytes,    1 },
 
   /* The following are to intercept the placement of data into the text
      section (eg addresses for a switch table), so that the space they
@@ -177,11 +187,11 @@
   { "byte",     mcore_cons,           1 },
   { "dc",       mcore_cons,           2 },
   { "dc.b",     mcore_cons,           1 },
-  { "dc.d",     mcore_float_cons,    'd' },
+  { "dc.d",     mcore_float_cons,    'd'},
   { "dc.l",     mcore_cons,           4 },
-  { "dc.s",     mcore_float_cons,    'f' },
+  { "dc.s",     mcore_float_cons,    'f'},
   { "dc.w",     mcore_cons,           2 },
-  { "dc.x",     mcore_float_cons,    'x' },
+  { "dc.x",     mcore_float_cons,    'x'},
   { "double",   mcore_float_cons,    'd'},
   { "float",    mcore_float_cons,    'f'},
   { "hword",    mcore_cons,           2 },
@@ -193,17 +203,20 @@
   { "single",   mcore_float_cons,    'f'},
   { "string",   mcore_stringer,       1 },
   { "word",     mcore_cons,           2 },
+  { "fill",     mcore_fill,           0 },
 
   /* Allow for the effect of section changes.  */
   { "text",      mcore_s_text,    0 },
   { "data",      mcore_s_data,    0 },
-  
-#ifdef OBJ_ELF
+  { "bss",       mcore_s_bss,     1 },
+#ifdef OBJ_EF
+  { "comm",      mcore_s_comm,    0 },
+#endif
   { "section",   mcore_s_section, 0 },
   { "section.s", mcore_s_section, 0 },
   { "sect",      mcore_s_section, 0 },
   { "sect.s",    mcore_s_section, 0 },
-#endif  
+  
   { 0,          0,                0 }
 };
 
@@ -305,12 +318,52 @@
 }
 
 static void
+mcore_fill (unused)
+     int unused;
+{
+  if (now_seg == text_section)
+    {
+      char * str = input_line_pointer;
+      int    size = 1;
+      int    repeat;
+
+      repeat = atoi (str);
+      
+      /* Look to see if a size has been specified.  */
+      while (*str != '\n' && *str != 0 && *str != ',')
+	++ str;
+      
+      if (* str == ',')
+	{
+	  size = atoi (str + 1);
+
+	  if (size > 8)
+	    size = 8;
+	  else if (size < 0)
+	    size = 0;
+	}
+
+      poolspan += size * repeat;
+    }
+  
+  s_fill (unused);
+
+  check_literals (2, 0);
+}
+
+/* Handle the section changing pseudo-ops.  These call through to the
+   normal implementations, but they dump the literal pool first.  */
+static void
 mcore_s_text (ignore)
      int ignore;
 {
   dump_literals (0);
   
+#ifdef OBJ_ELF
+  obj_elf_text (ignore);
+#else
   s_text (ignore);
+#endif
 }
 
 static void
@@ -319,11 +372,64 @@
 {
   dump_literals (0);
   
+#ifdef OBJ_ELF
+  obj_elf_data (ignore);
+#else
   s_data (ignore);
+#endif
 }
 
+static void
+mcore_s_section (ignore)
+     int ignore;
+{
+  /* Scan forwards to find the name of the section.  If the section
+     being switched to is ".line" then this is a DWARF1 debug section
+     which is arbitarily placed inside generated code.  In this case
+     do not dump the literal pool because it is a) inefficient and
+     b) would require the generation of extra code to jump around the
+     pool.  */
+  char * ilp = input_line_pointer;
+
+  while (*ilp != 0 && isspace(*ilp))
+    ++ ilp;
+
+  if (strncmp (ilp, ".line", 5) == 0
+      && (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
+    ;
+  else
+    dump_literals (0);
+
+#ifdef OBJ_ELF
+  obj_elf_section (ignore);
+#endif
+#ifdef OBJ_COFF
+  obj_coff_section (ignore);
+#endif
+}
+
+static void
+mcore_s_bss (needs_align)
+     int needs_align;
+{
+  dump_literals (0);
+  
+  s_lcomm_bytes (needs_align);
+}
+
+#ifdef OBJ_ELF
+static void
+mcore_s_comm (needs_align)
+     int needs_align;
+{
+  dump_literals (0);
+  
+  obj_elf_common (needs_align);
+}
+#endif
+
 /* This function is called once, at assembler startup time.  This should
-  set up all the tables, etc that the MD part of the assembler needs.  */
+   set up all the tables, etc that the MD part of the assembler needs.  */
 void
 md_begin ()
 {
@@ -394,7 +500,7 @@
     }
   else if (   tolower (s[0]) == 's'
 	   && tolower (s[1]) == 'p'
-	   && (isspace (s[2]) || s[2] == ','))
+	   && ! isalnum (s[2]))
     {
       * reg = 0;
       return s + 2;
@@ -490,6 +596,46 @@
 }
 
 static char *
+parse_psrmod (s, reg)
+  char *     s;
+  unsigned * reg;
+{
+  int  i;
+  char buf[10];
+  static struct psrmods
+  {
+    char *       name;
+    unsigned int value;
+  }
+  psrmods[] =
+  {
+    { "ie", 1 },
+    { "fe", 2 },
+    { "ee", 4 },
+    { "af", 8 }	/* Really 0 and non-combinable.  */
+  };
+  
+  for (i = 0; i < 2; i++)
+    buf[i] = isascii (s[i]) ? tolower (s[i]) : 0;
+  
+  for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;)
+    {
+      if (! strncmp (psrmods[i].name, buf, 2))
+	{
+          * reg = psrmods[i].value;
+	  
+          return s + 2;
+	}
+    }
+  
+  as_bad (_("bad/missing psr specifier"));
+  
+  * reg = 0;
+  
+  return s;
+}
+
+static char *
 parse_exp (s, e)
      char * s;
      expressionS * e;
@@ -533,13 +679,16 @@
   s[7] = 0;
 }
 
+#define POOL_END_LABEL   ".LE"
+#define POOL_START_LABEL ".LS"
+
 static void
 dump_literals (isforce)
      int isforce;
 {
   int i;
   struct literal * p;
-  struct symbol * brarsym;
+  symbolS * brarsym;
   
   if (poolsize == 0)
     return;
@@ -550,7 +699,7 @@
       char * output;
       char brarname[8];
       
-      make_name (brarname, ".YP.", poolnumber);
+      make_name (brarname, POOL_END_LABEL, poolnumber);
       
       brarsym = symbol_make (brarname);
       
@@ -642,7 +791,7 @@
       if (++ poolnumber > 0xFFFF)
 	as_fatal (_("more than 65K literal pools"));
       
-      make_name (poolname, ".XP.", poolnumber);
+      make_name (poolname, POOL_START_LABEL, poolnumber);
       poolsym = symbol_make (poolname);
       symbol_table_insert (poolsym);
       poolspan = 0;
@@ -877,8 +1026,8 @@
          fixes problem of an interrupt during a jmp.. */
       if (sifilter_mode)
 	{
-	  output[0] = (inst >> 8);
-	  output[1] = (inst);
+	  output[0] = INST_BYTE0 (inst);
+	  output[1] = INST_BYTE1 (inst);
 	  output = frag_more (2);
 	}
       break;
@@ -896,20 +1045,20 @@
 	{
 	  /* Replace with:  bsr .+2 ; addi r15,6; jmp rx ; jmp rx */
 	  inst = MCORE_INST_BSR;	/* with 0 displacement */
-	  output[0] = (inst >> 8);
-	  output[1] = (inst);
+	  output[0] = INST_BYTE0 (inst);
+	  output[1] = INST_BYTE1 (inst);
 
 	  output = frag_more (2);
 	  inst = MCORE_INST_ADDI;
 	  inst |= 15;			/* addi r15,6 */
 	  inst |= (6 - 1) << 4;		/* over the jmp's */
-	  output[0] = (inst >> 8);
-	  output[1] = (inst);
+	  output[0] = INST_BYTE0 (inst);
+	  output[1] = INST_BYTE1 (inst);
 
 	  output = frag_more (2);
 	  inst = MCORE_INST_JMP | reg;
-	  output[0] = (inst >> 8);
-	  output[1] = (inst);
+	  output[0] = INST_BYTE0 (inst);
+	  output[1] = INST_BYTE1 (inst);
 
 	  output = frag_more (2);		/* 2nd emitted in fallthru */
 	}
@@ -932,6 +1081,13 @@
       output = frag_more (2);
       break;
 
+    case MULSH:
+      if (cpu == M210)
+	{
+	  as_bad (_("M340 specific opcode used when assembling for M210"));
+	  break;
+	}
+      /* drop through... */
     case O2:
       op_end = parse_reg (op_end + 1, & reg);
       inst |= reg;
@@ -1239,8 +1395,11 @@
 	++ op_end;
   
       if (* op_end == ',')
-	/* parse_rt calls frag_more() for us.  */
-	input_line_pointer = parse_rt (op_end + 1, & output, 0, 0);
+	{
+	  /* parse_rt calls frag_more() for us.  */
+	  input_line_pointer = parse_rt (op_end + 1, & output, 0, 0);
+          op_end = input_line_pointer;
+	}
       else
 	{
 	  as_bad (_("second operand missing"));
@@ -1251,6 +1410,7 @@
     case LJ:
       input_line_pointer = parse_rt (op_end + 1, & output, 1, 0);
       /* parse_rt() calls frag_more() for us.  */
+      op_end = input_line_pointer;
       break;
       
     case RM:
@@ -1363,6 +1523,7 @@
       
     case BR:
       input_line_pointer = parse_exp (op_end + 1, & e);
+      op_end = input_line_pointer;
       
       output = frag_more (2);
       
@@ -1395,6 +1556,7 @@
       
     case JC:
       input_line_pointer = parse_exp (op_end + 1, & e);
+      op_end = input_line_pointer;
       
       output = frag_var (rs_machine_dependent,
 			 md_relax_table[C (COND_JUMP, COND32)].rlx_length,
@@ -1405,6 +1567,8 @@
       
     case JU:
       input_line_pointer = parse_exp (op_end + 1, & e);
+      op_end = input_line_pointer;
+
       output = frag_var (rs_machine_dependent,
 			 md_relax_table[C (UNCD_JUMP, UNCD32)].rlx_length,
 			 md_relax_table[C (UNCD_JUMP, UNCD12)].rlx_length,
@@ -1415,7 +1579,8 @@
     case JL:
       inst = MCORE_INST_JSRI;		/* jsri */
       input_line_pointer = parse_rt (op_end + 1, & output, 1, & e);
-      /* parse_rt() calls frag_more for us */
+      /* parse_rt() calls frag_more for us.  */
+      op_end = input_line_pointer;
       
       /* Only do this if we know how to do it ... */
       if (e.X_op != O_absent && do_jsri2bsr)
@@ -1492,12 +1657,49 @@
       output = frag_more (2);
       break;
 
+    case OPSR:
+      if (cpu == M210)
+	{
+	  as_bad (_("M340 specific opcode used when assembling for M210"));
+	  break;
+	}
+      
+      op_end = parse_psrmod (op_end + 1, & reg);
+      
+      /* Look for further selectors.  */
+      while (* op_end == ',')
+	{
+	  unsigned value;
+	    
+	  op_end = parse_psrmod (op_end + 1, & value);
+	  
+	  if (value & reg)
+	    as_bad (_("duplicated psr bit specifier"));
+	  
+	  reg |= value;
+	}
+      
+      if (reg > 8)
+	as_bad (_("`af' must appear alone"));
+	
+      inst |= (reg & 0x7);
+      output = frag_more (2);
+      break;
+ 
     default:
       as_bad (_("unimplemented opcode \"%s\""), name);
     }
+
+  /* Drop whitespace after all the operands have been parsed.  */
+  while (isspace (* op_end))
+    op_end ++;
+
+  /* Give warning message if the insn has more operands than required. */
+  if (strcmp (op_end, opcode->name) && strcmp (op_end, ""))
+    as_warn (_("ignoring operands: %s "), op_end);
   
-  output[0] = inst >> 8;
-  output[1] = inst;
+  output[0] = INST_BYTE0 (inst);
+  output[1] = INST_BYTE1 (inst);
   
   check_literals (opcode->transfer, isize);
 }
@@ -1531,7 +1733,7 @@
 {
   int prec;
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
-  LITTLENUM_TYPE * wordP;
+  int    i;
   char * t;
   char * atof_ieee ();
 
@@ -1573,30 +1775,45 @@
 
   *sizeP = prec * sizeof (LITTLENUM_TYPE);
   
-  for (wordP = words; prec--;)
+  if (! target_big_endian)
     {
-      md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
-      litP += sizeof (LITTLENUM_TYPE);
+      for (i = prec - 1; i >= 0; i--)
+	{
+	  md_number_to_chars (litP, (valueT) words[i],
+			      sizeof (LITTLENUM_TYPE));
+	  litP += sizeof (LITTLENUM_TYPE);
+	}
     }
+  else
+    for (i = 0; i < prec; i++)
+      {
+	md_number_to_chars (litP, (valueT) words[i],
+			    sizeof (LITTLENUM_TYPE));
+	litP += sizeof (LITTLENUM_TYPE);
+      }
   
   return 0;
 }
 
 CONST char * md_shortopts = "";
 
-#define OPTION_RELAX		(OPTION_MD_BASE)
-#define OPTION_JSRI2BSR_ON	(OPTION_MD_BASE + 1)
-#define OPTION_JSRI2BSR_OFF	(OPTION_MD_BASE + 2)
-#define OPTION_SIFILTER_ON	(OPTION_MD_BASE + 3)
-#define OPTION_SIFILTER_OFF	(OPTION_MD_BASE + 4)
+#define OPTION_JSRI2BSR_ON	(OPTION_MD_BASE + 0)
+#define OPTION_JSRI2BSR_OFF	(OPTION_MD_BASE + 1)
+#define OPTION_SIFILTER_ON	(OPTION_MD_BASE + 2)
+#define OPTION_SIFILTER_OFF	(OPTION_MD_BASE + 3)
+#define OPTION_CPU		(OPTION_MD_BASE + 4)
+#define OPTION_EB		(OPTION_MD_BASE + 5)
+#define OPTION_EL		(OPTION_MD_BASE + 6)
 
 struct option md_longopts[] =
 {
-  { "relax",       no_argument, NULL, OPTION_RELAX},
   { "no-jsri2bsr", no_argument, NULL, OPTION_JSRI2BSR_OFF},
   { "jsri2bsr",    no_argument, NULL, OPTION_JSRI2BSR_ON},
   { "sifilter",    no_argument, NULL, OPTION_SIFILTER_ON},
   { "no-sifilter", no_argument, NULL, OPTION_SIFILTER_OFF},
+  { "cpu",         required_argument, NULL, OPTION_CPU},
+  { "EB",          no_argument, NULL, OPTION_EB},
+  { "EL",          no_argument, NULL, OPTION_EL},
   { NULL,          no_argument, NULL, 0}
 };
 
@@ -1612,8 +1829,20 @@
 
   switch (c)
     {
+    case OPTION_CPU:
+      if (streq (arg, "210"))
+	{
+	  cpu = M210;
+	  target_big_endian = 1;
+	}
+      else if (streq (arg, "340"))
+	cpu = M340;
+      else
+        as_warn (_("unrecognised cpu type '%s'"), arg);
+      break;
       
-    case OPTION_RELAX:        relax = 1;         break;
+    case OPTION_EB: target_big_endian = 1; break;
+    case OPTION_EL: target_big_endian = 0; cpu = M340; break;
     case OPTION_JSRI2BSR_ON:  do_jsri2bsr = 1;   break;
     case OPTION_JSRI2BSR_OFF: do_jsri2bsr = 0;   break;
     case OPTION_SIFILTER_ON:  sifilter_mode = 1; break;
@@ -1630,9 +1859,11 @@
 {
   fprintf (stream, _("\
 MCORE specific options:\n\
-  -{no-}jsri2bsr	  {dis}able jsri to bsr transformation (def: off)\n\
-  -{no-}sifilter	  {dis}able silicon filter behavior (def: off)\n\
-  -relax		  alter jump instructions for long displacements\n"));
+  -{no-}jsri2bsr	  {dis}able jsri to bsr transformation (def: dis)\n\
+  -{no-}sifilter	  {dis}able silicon filter behavior (def: dis)\n\
+  -cpu=[210|340]          select CPU type\n\
+  -EB                     assemble for a big endian system (default)\n\
+  -EL                     assemble for a little endian system\n"));
 }
 
 int md_short_jump_size;
@@ -1670,27 +1901,40 @@
   int targ_addr = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
   
   buffer = (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
-  targ_addr += fragP->fr_symbol->sy_frag->fr_address;
+  targ_addr += symbol_get_frag (fragP->fr_symbol)->fr_address;
 
   switch (fragP->fr_subtype)
     {
     case C (COND_JUMP, COND12):
     case C (UNCD_JUMP, UNCD12):
       {
-	/* Get the address of the end of the instruction */
+	/* Get the address of the end of the instruction.  */
 	int next_inst = fragP->fr_fix + fragP->fr_address + 2;
 	unsigned char t0;
 	int disp = targ_addr - next_inst;
 	
 	if (disp & 1)
-	    as_bad (_("odd displacement at %x"), next_inst - 2);
+	  as_bad (_("odd displacement at %x"), next_inst - 2);
 	
 	disp >>= 1;
-	t0 = buffer[0] & 0xF8;
 	
-	md_number_to_chars (buffer, disp, 2);
+	if (! target_big_endian)
+	  {
+	    t0 = buffer[1] & 0xF8;
 	
-	buffer[0] = (buffer[0] & 0x07) | t0;
+	    md_number_to_chars (buffer, disp, 2);
+	
+	    buffer[1] = (buffer[1] & 0x07) | t0;
+	  }
+	else
+	  {
+	    t0 = buffer[0] & 0xF8;
+	
+	    md_number_to_chars (buffer, disp, 2);
+	
+	    buffer[0] = (buffer[0] & 0x07) | t0;
+	  }
+	
 	fragP->fr_fix += 2;
 	fragP->fr_var = 0;
       }
@@ -1712,15 +1956,27 @@
 	int first_inst = fragP->fr_fix + fragP->fr_address;
 	int needpad = (first_inst & 3);
 
-	buffer[0] ^= 0x08;	/* Toggle T/F bit */
+	if (! target_big_endian)
+	  buffer[1] ^= 0x08;
+	else
+	  buffer[0] ^= 0x08;	/* Toggle T/F bit */
 
 	buffer[2] = INST_BYTE0 (MCORE_INST_JMPI);	/* Build jmpi */
 	buffer[3] = INST_BYTE1 (MCORE_INST_JMPI);
  
 	if (needpad)
 	  {
-	    buffer[1] = 4;	/* branch over jmpi, pad, and ptr */
-	    buffer[3] = 1;	/* jmpi offset of 1 gets the pointer */
+	    if (! target_big_endian)
+	      {
+		buffer[0] = 4;	/* branch over jmpi, pad, and ptr */
+		buffer[2] = 1;	/* jmpi offset of 1 gets the pointer */
+	      }
+	    else
+	      {
+		buffer[1] = 4;	/* branch over jmpi, pad, and ptr */
+		buffer[3] = 1;	/* jmpi offset of 1 gets the pointer */
+	      }
+	    
 	    buffer[4] = 0;	/* alignment/pad */
 	    buffer[5] = 0;
 	    buffer[6] = 0;	/* space for 32 bit address */
@@ -1740,8 +1996,17 @@
 	       shrinking the fragment. '3' is the amount of code that
 	       we inserted here, but '4' is right for the space we reserved
 	       for this fragment. */
-	    buffer[1] = 3;	/* branch over jmpi, and ptr */
-	    buffer[3] = 0;	/* jmpi offset of 0 gets the pointer */
+	    if (! target_big_endian)
+	      {
+		buffer[0] = 3;	/* branch over jmpi, and ptr */
+		buffer[2] = 0;	/* jmpi offset of 0 gets the pointer */
+	      }
+	    else
+	      {
+		buffer[1] = 3;	/* branch over jmpi, and ptr */
+		buffer[3] = 0;	/* jmpi offset of 0 gets the pointer */
+	      }
+	    
 	    buffer[4] = 0;	/* space for 32 bit address */
 	    buffer[5] = 0;
 	    buffer[6] = 0;
@@ -1752,12 +2017,15 @@
 		     fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
 	    fragP->fr_fix += C32_LEN;
 
-	    /* frag is actually shorter (see the other side of this ifdef)
-	       but gas isn't prepared for that. We have to re-adjust
+	    /* Frag is actually shorter (see the other side of this ifdef)
+	       but gas isn't prepared for that.  We have to re-adjust
 	       the branch displacement so that it goes beyond the 
 	       full length of the fragment, not just what we actually
 	       filled in.  */
-	    buffer[1] = 4;	/* jmpi, ptr, and the 'tail pad' */
+	    if (! target_big_endian)
+	      buffer[0] = 4;	/* jmpi, ptr, and the 'tail pad' */
+	    else
+	      buffer[1] = 4;	/* jmpi, ptr, and the 'tail pad' */
 	  }
 	
 	fragP->fr_var = 0;
@@ -1782,7 +2050,10 @@
 
 	if (needpad)
 	  {
-	    buffer[1] = 1;	/* jmpi offset of 1 since padded */
+	    if (! target_big_endian)
+	      buffer[0] = 1;	/* jmpi offset of 1 since padded */
+	    else
+	      buffer[1] = 1;	/* jmpi offset of 1 since padded */
 	    buffer[2] = 0;	/* alignment */
 	    buffer[3] = 0;
 	    buffer[4] = 0;	/* space for 32 bit address */
@@ -1790,7 +2061,7 @@
 	    buffer[6] = 0;
 	    buffer[7] = 0;
 	    
-	    /* Make reloc for the long disp */
+	    /* Make reloc for the long disp.  */
 	    fix_new (fragP, fragP->fr_fix + 4, 4,
 		     fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
 	    
@@ -1798,13 +2069,16 @@
 	  }
 	else
 	  {
-	    buffer[1] = 0;	/* jmpi offset of 0 if no pad */
+	    if (! target_big_endian)
+	      buffer[0] = 0;	/* jmpi offset of 0 if no pad */
+	    else
+	      buffer[1] = 0;	/* jmpi offset of 0 if no pad */
 	    buffer[2] = 0;	/* space for 32 bit address */
 	    buffer[3] = 0;
 	    buffer[4] = 0;
 	    buffer[5] = 0;
 	    
-	    /* Make reloc for the long disp */
+	    /* Make reloc for the long disp.  */
 	    fix_new (fragP, fragP->fr_fix + 2, 4,
 		     fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
 	    fragP->fr_fix += U32_LEN;
@@ -1865,9 +2139,17 @@
 	as_bad_where (file, fixP->fx_line,
 		      _("pcrel for branch to %s too far (0x%x)"),
 		      symname, val);
-      buf[0] |= ((val >> 8) & 0x7);
-      buf[1] |= (val & 0xff);
-        break;
+      if (target_big_endian)
+	{
+	  buf[0] |= ((val >> 8) & 0x7);
+	  buf[1] |= (val & 0xff);
+	}
+      else
+	{
+	  buf[0] |= ((val >> 8) & 0x7);
+	  buf[1] |= (val & 0xff);
+	}
+      break;
 
     case BFD_RELOC_MCORE_PCREL_IMM8BY4:	/* lower 8 bits of 2 byte opcode */
       val += 3;
@@ -1876,16 +2158,21 @@
 	as_bad_where (file, fixP->fx_line,
 		      _("pcrel for lrw/jmpi/jsri to %s too far (0x%x)"),
 		      symname, val);
+      else if (! target_big_endian)
+	buf[0] |= (val & 0xff);
       else
 	buf[1] |= (val & 0xff);
-        break;
+      break;
 
     case BFD_RELOC_MCORE_PCREL_IMM4BY2:	/* loopt instruction */
       if ((val < -32) || (val > -2))
 	as_bad_where (file, fixP->fx_line,
 		      _("pcrel for loopt too far (0x%x)"), val);
       val /= 2;
-      buf[1] |= (val & 0xf);
+      if (! target_big_endian)
+	buf[0] |= (val & 0xf);
+      else
+	buf[1] |= (val & 0xf);
       break;
 
     case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2:
@@ -1898,8 +2185,8 @@
 	  nval |= MCORE_INST_BSR;
 	  
 	  /* REPLACE the instruction, don't just modify it.  */
-	  buf[0] = ((nval >> 8) & 0xff);
-	  buf[1] = (nval & 0xff);
+	  buf[0] = INST_BYTE0 (nval);
+	  buf[1] = INST_BYTE1 (nval);
 	}
       else
 	fixP->fx_done = 0;
@@ -1923,21 +2210,14 @@
 #endif
 	{
 	  if (fixP->fx_size == 4)
-	    {
-	      *buf++ = val >> 24;
-	      *buf++ = val >> 16;
-	      *buf++ = val >> 8;
-	      *buf = val;
-	    }
+	    ;
 	  else if (fixP->fx_size == 2 && val >= -32768 && val <= 32767)
-	    {
-	      *buf++ = val >> 8;
-	      *buf = val;
-	    }
+	    ;
 	  else if (fixP->fx_size == 1 && val >= -256 && val <= 255)
-	    *buf = val;
+	    ;
 	  else
 	    abort ();
+	  md_number_to_chars (buf, val, fixP->fx_size);
 	}
       break;
     }
@@ -2021,22 +2301,31 @@
   return fragP->fr_var;
 }
 
-/* Put number into target byte order */
-
+/* Put number into target byte order.  */
 void
 md_number_to_chars (ptr, use, nbytes)
      char * ptr;
      valueT use;
      int nbytes;
 {
-  switch (nbytes)
-    {
-    case 4: *ptr++ = (use >> 24) & 0xff; /* fall through */
-    case 3: *ptr++ = (use >> 16) & 0xff; /* fall through */
-    case 2: *ptr++ = (use >>  8) & 0xff; /* fall through */
-    case 1: *ptr++ = (use >>  0) & 0xff;    break;
-    default: abort ();
-    }
+  if (! target_big_endian)
+    switch (nbytes)
+      {
+      case 4: ptr[3] = (use >> 24) & 0xff; /* fall through */
+      case 3: ptr[2] = (use >> 16) & 0xff; /* fall through */
+      case 2: ptr[1] = (use >>  8) & 0xff; /* fall through */
+      case 1: ptr[0] = (use >>  0) & 0xff;    break;
+      default: abort ();
+      }
+  else
+    switch (nbytes)
+      {
+      case 4: *ptr++ = (use >> 24) & 0xff; /* fall through */
+      case 3: *ptr++ = (use >> 16) & 0xff; /* fall through */
+      case 2: *ptr++ = (use >>  8) & 0xff; /* fall through */
+      case 1: *ptr++ = (use >>  0) & 0xff;    break;
+      default: abort ();
+      }
 }
 
 /* Round up a section size to the appropriate boundary.  */
@@ -2095,6 +2384,7 @@
     case BFD_RELOC_MCORE_PCREL_IMM8BY4:
     case BFD_RELOC_MCORE_PCREL_IMM11BY2:
     case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2:
+    case BFD_RELOC_RVA:      
       code = fixp->fx_r_type;
       break;
     
@@ -2117,7 +2407,8 @@
   }
 
   rel = (arelent *) xmalloc (sizeof (arelent));
-  rel->sym_ptr_ptr = & fixp->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
   /* Always pass the addend along!  */
   rel->addend = fixp->fx_addnumber;
@@ -2147,7 +2438,8 @@
      fixS * fix;
 {
   if (   fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
-      || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+      || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
+      || fix->fx_r_type == BFD_RELOC_RVA)
     return 1;
 
   return 0;
@@ -2169,15 +2461,4 @@
 
   return 1;
 }
-
-/* Handle the .section pseudo-op.  This is like the usual one, but it
-   dumps the literal pool before changing the section.  */
-static void
-mcore_s_section (ignore)
-     int ignore;
-{
-  dump_literals (0);
-
-  obj_elf_section (ignore);
-}
 #endif /* OBJ_ELF */
diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h
index 9e487c9..b0a29ab 100644
--- a/gas/config/tc-mcore.h
+++ b/gas/config/tc-mcore.h
@@ -1,6 +1,6 @@
 /* This file is tc-mcore.h
 
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -15,8 +15,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   along with GAS; see the file COPYING.  If not, write to the
+   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
 
 #ifndef	TC_MCORE
 #define TC_MCORE 1
@@ -26,7 +27,8 @@
 #endif
 
 #define TARGET_ARCH	bfd_arch_mcore
-#define TARGET_BYTES_BIG_ENDIAN 1
+/* Used to initialise target_big_endian.  */
+#define TARGET_BYTES_BIG_ENDIAN 0
 
 /* Don't write out relocs for pcrel stuff.  */
 #define TC_COUNT_RELOC(x) (((x)->fx_addsy || (x)->fx_subsy) && \
@@ -65,7 +67,16 @@
 
 #define TARGET_FORMAT	(target_big_endian ? "pe-mcore-big" : "pe-mcore-little")
 
-#define TARGET_SYMBOL_FIELDS  int sy_flags ;
+struct mcore_tc_sy
+{
+  int sy_flags;
+};
+
+#define TC_SYMFIELD_TYPE struct mcore_tc_sy
+
+# if defined TE_PE
+#  define TC_FORCE_RELOCATION(x) ((x)->fx_r_type == BFD_RELOC_RVA)
+# endif
 
 #endif /* OBJ_COFF */
 
@@ -93,7 +104,6 @@
 # error No target format specified.
 #endif
 
-#include "struc-symbol.h" /* For definition of symbolS */
 #include "write.h"        /* For definition of fixS */
   
 extern void      md_begin            PARAMS ((void));
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 3d865fd..5daf89d 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -1,5 +1,5 @@
 /* tc-mips.c -- assemble code for a MIPS chip.
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc.
    Contributed by the OSF and Ralph Campbell.
    Written by Keith Knowles and Ralph Campbell, working independently.
    Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
@@ -54,7 +54,6 @@
 #undef S_GET_SIZE
 #undef S_SET_ALIGN
 #undef S_SET_SIZE
-#undef TARGET_SYMBOL_FIELDS
 #undef obj_frob_file
 #undef obj_frob_file_after_relocs
 #undef obj_frob_symbol
@@ -119,6 +118,8 @@
       return target_big_endian ? "a.out-mips-big" : "a.out-mips-little";
     case bfd_target_ecoff_flavour:
       return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT;
+    case bfd_target_coff_flavour:
+      return "pe-mips";
     case bfd_target_elf_flavour:
       return (target_big_endian
 	      ? (mips_64 ? "elf64-bigmips" : "elf32-bigmips")
@@ -134,6 +135,8 @@
 			    ? ".data" \
 			    : OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
 			    ? ".rdata" \
+			    : OUTPUT_FLAVOR == bfd_target_coff_flavour \
+			    ? ".rdata" \
 			    : OUTPUT_FLAVOR == bfd_target_elf_flavour \
 			    ? ".rodata" \
 			    : (abort (), ""))
@@ -204,6 +207,29 @@
    mips3 or greater, then mark the object file 32BITMODE. */
 static int mips_32bitmode = 0;
 
+/* True if -mgp32 was passed. */
+static int mips_gp32 = 0;
+
+/* Some ISA's have delay slots for instructions which read or write
+   from a coprocessor (eg. mips1-mips3); some don't (eg mips4).
+   Return true if instructions marked INSN_LOAD_COPROC_DELAY, 
+   INSN_COPROC_MOVE_DELAY, or INSN_WRITE_COND_CODE actually have a
+   delay slot in this ISA.  The uses of this macro assume that any
+   ISA that has delay slots for one of these, has them for all.  They
+   also assume that ISAs which don't have delays for these insns, don't
+   have delays for the INSN_LOAD_MEMORY_DELAY instructions either. */
+#define ISA_HAS_COPROC_DELAYS(ISA) (        \
+   (ISA) == 1                               \
+   || (ISA) == 2                            \
+   || (ISA) == 3                            \
+   )
+
+/*  Return true if ISA supports 64 bit gp register instructions. */
+#define ISA_HAS_64BIT_REGS(ISA) (    \
+   (ISA) == 3                        \
+   || (ISA) == 4                     \
+   )
+
 /* Whether the processor uses hardware interlocks to protect 
    reads from the HI and LO registers, and thus does not
    require nops to be inserted.
@@ -237,7 +263,7 @@
 /* Whether the processor uses hardware interlocks to protect reads
    from the GPRs, and thus does not require nops to be inserted.  */
 #define gpr_interlocks \
-  (mips_opts.isa >= 2  \
+  (mips_opts.isa != 1  \
    || mips_cpu == 3900)
 
 /* As with other "interlocks" this is used by hardware that has FP
@@ -246,6 +272,10 @@
 #define cop_interlocks (mips_cpu == 4300                            \
 			)
 
+/* Is this a mfhi or mflo instruction?  */
+#define MF_HILO_INSN(PINFO) \
+          ((PINFO & INSN_READ_HI) || (PINFO & INSN_READ_LO))
+
 /* MIPS PIC level.  */
 
 enum mips_pic_level
@@ -281,6 +311,10 @@
 
 static int mips_any_noreorder;
 
+/* Non-zero if nops should be inserted when the register referenced in
+   an mfhi/mflo instruction is read in the next two instructions.  */
+static int mips_7000_hilo_fix;
+
 /* The size of the small data section.  */
 static int g_switch_value = 8;
 /* Whether the -G option was used.  */
@@ -295,8 +329,9 @@
    better.
 
    This function can only provide a guess, but it seems to work for
-   gcc output.  If it guesses wrong, the only loss should be in
-   efficiency; it shouldn't introduce any bugs.
+   gcc output.  It needs to guess right for gcc, otherwise gcc
+   will put what it thinks is a GP-relative instruction in a branch
+   delay slot.
 
    I don't know if a fix is needed for the SVR4_PIC mode.  I've only
    fixed it for the non-PIC mode.  KR 95/04/07  */
@@ -817,6 +852,15 @@
   int broken = 0;
   int mips_isa_from_cpu;
 
+  /* GP relative stuff not working for PE */
+  if (strncmp (TARGET_OS, "pe", 2) == 0
+      && g_switch_value != 0)
+    {
+      if (g_switch_seen)
+	as_bad (_("-G not supported in this configuration."));
+      g_switch_value = 0;
+    }
+
   cpu = TARGET_CPU;
   if (strcmp (cpu + (sizeof TARGET_CPU) - 3, "el") == 0)
     {
@@ -834,10 +878,10 @@
 
       if (strcmp (cpu, "mips") == 0)
         {
-          if (mips_opts.isa < 0)
-            mips_cpu = 3000;   
+	  if (mips_opts.isa < 0)
+	    mips_cpu = 3000;   
 
-          else if (mips_opts.isa == 2)
+	  else if (mips_opts.isa == 2)
             mips_cpu = 6000;
 
           else if (mips_opts.isa == 3)
@@ -957,13 +1001,13 @@
     a = NULL;
     }
 
-  if (mips_opts.isa < 2 && mips_trap)
+  if (mips_opts.isa == 1 && mips_trap)
     as_bad (_("trap exception not supported at ISA 1"));
 
   /* Set the EABI kind based on the ISA before the user gets
      to change the ISA with directives.  This isn't really
      the best, but then neither is basing the abi on the isa. */     
-  if (mips_opts.isa > 2 
+  if (ISA_HAS_64BIT_REGS (mips_opts.isa)
       && mips_abi_string
       && 0 == strcmp (mips_abi_string,"eabi"))
     mips_eabi64 = 1;
@@ -971,11 +1015,12 @@
   if (mips_cpu != 0 && mips_cpu != -1)
     {
       ok = bfd_set_arch_mach (stdoutput, bfd_arch_mips, mips_cpu);
-
+      
       /* If they asked for mips1 or mips2 and a cpu that is
 	 mips3 or greater, then mark the object file 32BITMODE. */
       if (mips_isa_from_cpu != -1
-	  && mips_opts.isa <= 2 && mips_isa_from_cpu > 2)
+	  && ! ISA_HAS_64BIT_REGS (mips_opts.isa) 
+	  && ISA_HAS_64BIT_REGS (mips_isa_from_cpu))
 	mips_32bitmode = 1;
     }
   else
@@ -1334,7 +1379,7 @@
 
   prev_pinfo = prev_insn.insn_mo->pinfo;
   if (! mips_opts.noreorder
-      && mips_opts.isa < 4
+      && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
       && ((prev_pinfo & INSN_LOAD_COPROC_DELAY)
 	  || (! gpr_interlocks
 	      && (prev_pinfo & INSN_LOAD_MEMORY_DELAY))))
@@ -1373,8 +1418,8 @@
 	  if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
 	    S_SET_OTHER (l->label, STO_MIPS16);
 #endif
-	  if ((l->label->sy_value.X_add_number & 1) == 0)
-	    ++l->label->sy_value.X_add_number;
+	  if ((S_GET_VALUE (l->label) & 1) == 0)
+	    S_SET_VALUE (l->label, S_GET_VALUE (l->label) + 1);
 	}
     }
 }
@@ -1437,7 +1482,7 @@
       /* The previous insn might require a delay slot, depending upon
 	 the contents of the current insn.  */
       if (! mips_opts.mips16
-	  && mips_opts.isa < 4
+	  && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	  && (((prev_pinfo & INSN_LOAD_COPROC_DELAY)
                && ! cop_interlocks)
 	      || (! gpr_interlocks
@@ -1457,10 +1502,10 @@
 	    ++nops;
 	}
       else if (! mips_opts.mips16
-	       && mips_opts.isa < 4
+	       && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	       && (((prev_pinfo & INSN_COPROC_MOVE_DELAY)
                     && ! cop_interlocks)
-		   || (mips_opts.isa < 2
+		   || (mips_opts.isa == 1
 		       && (prev_pinfo & INSN_COPROC_MEMORY_DELAY))))
 	{
 	  /* A generic coprocessor delay.  The previous instruction
@@ -1516,7 +1561,7 @@
 	    }
 	}
       else if (! mips_opts.mips16
-	       && mips_opts.isa < 4
+	       && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	       && (prev_pinfo & INSN_WRITE_COND_CODE)
                && ! cop_interlocks)
 	{
@@ -1530,6 +1575,37 @@
 	      || (pinfo & INSN_READ_COND_CODE))
 	    ++nops;
 	}
+
+      /* If we're fixing up mfhi/mflo for the r7000 and the
+	 previous insn was an mfhi/mflo and the current insn
+	 reads the register that the mfhi/mflo wrote to, then
+	 insert two nops.  */
+
+      else if (mips_7000_hilo_fix
+	       && MF_HILO_INSN (prev_pinfo)
+	       && insn_uses_reg (ip, ((prev_insn.insn_opcode >> OP_SH_RD)
+                                       & OP_MASK_RD),
+                                    MIPS_GR_REG))
+
+	{
+	  nops += 2;
+	}
+
+      /* If we're fixing up mfhi/mflo for the r7000 and the
+	 2nd previous insn was an mfhi/mflo and the current insn
+	 reads the register that the mfhi/mflo wrote to, then
+	 insert one nop.  */
+
+      else if (mips_7000_hilo_fix
+	       && MF_HILO_INSN (prev_prev_insn.insn_opcode)
+	       && insn_uses_reg (ip, ((prev_prev_insn.insn_opcode >> OP_SH_RD)
+                                       & OP_MASK_RD),
+                                    MIPS_GR_REG))
+     
+	{
+	  nops += 1;
+	}
+ 
       else if (prev_pinfo & INSN_READ_LO)
 	{
 	  /* The previous instruction reads the LO register; if the
@@ -1593,7 +1669,7 @@
 	 instruction, we must check for these cases compared to the
 	 instruction previous to the previous instruction.  */
       if ((! mips_opts.mips16
-	   && mips_opts.isa < 4
+	   && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	   && (prev_prev_insn.insn_mo->pinfo & INSN_COPROC_MOVE_DELAY)
 	   && (prev_prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE)
 	   && (pinfo & INSN_READ_COND_CODE)
@@ -1656,11 +1732,11 @@
 	  for (l = insn_labels; l != NULL; l = l->next)
 	    {
 	      assert (S_GET_SEGMENT (l->label) == now_seg);
-	      l->label->sy_frag = frag_now;
+	      symbol_set_frag (l->label, frag_now);
 	      S_SET_VALUE (l->label, (valueT) frag_now_fix ());
 	      /* mips16 text labels are stored as odd.  */
 	      if (mips_opts.mips16)
-		++l->label->sy_value.X_add_number;
+		S_SET_VALUE (l->label, S_GET_VALUE (l->label) + 1);
 	    }
 
 #ifndef NO_ECOFF_DEBUGGING
@@ -1943,13 +2019,13 @@
 		 we can not swap, and I don't feel like handling that
 		 case.  */
 	      || (! mips_opts.mips16
-		  && mips_opts.isa < 4
+		  && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 		  && (pinfo & INSN_READ_COND_CODE))
 	      /* We can not swap with an instruction that requires a
 		 delay slot, becase the target of the branch might
 		 interfere with that instruction.  */
 	      || (! mips_opts.mips16
-		  && mips_opts.isa < 4
+		  && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 		  && (prev_pinfo
               /* Itbl support may require additional care here. */
 		      & (INSN_LOAD_COPROC_DELAY
@@ -1964,7 +2040,7 @@
 		  && ! gpr_interlocks
 		  && (prev_pinfo & INSN_LOAD_MEMORY_DELAY))
 	      || (! mips_opts.mips16
-		  && mips_opts.isa < 2
+		  && mips_opts.isa == 1
                   /* Itbl support may require additional care here. */
 		  && (prev_pinfo & INSN_COPROC_MEMORY_DELAY))
 	      /* We can not swap with a branch instruction.  */
@@ -2069,7 +2145,7 @@
 		 delay, and sets a register that the branch reads, we
 		 can not swap.  */
 	      || (! mips_opts.mips16
-		  && mips_opts.isa < 4
+		  && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
               /* Itbl support may require additional care here. */
 		  && ((prev_prev_insn.insn_mo->pinfo & INSN_LOAD_COPROC_DELAY)
 		      || (! gpr_interlocks
@@ -2098,7 +2174,7 @@
 	      || (mips_opts.mips16 && prev_insn_fixp)
 	      /* If the previous instruction is a sync, sync.l, or 
 		 sync.p, we can not swap. */
-	      || (prev_pinfo && INSN_SYNC))
+	      || (prev_pinfo & INSN_SYNC))
 	    {
 	      /* We could do even better for unconditional branches to
 		 portions of this object file; we could pick up the
@@ -2285,7 +2361,7 @@
 
       nops = 0;
       if ((! mips_opts.mips16
-	   && mips_opts.isa < 4
+	   && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	   && (! cop_interlocks
                && (prev_insn.insn_mo->pinfo
                    & (INSN_LOAD_COPROC_DELAY
@@ -2300,14 +2376,14 @@
 	      && (prev_insn.insn_mo->pinfo 
                   & INSN_LOAD_MEMORY_DELAY))
 	  || (! mips_opts.mips16
-	      && mips_opts.isa < 2
+	      && mips_opts.isa == 1
 	      && (prev_insn.insn_mo->pinfo
 		  & INSN_COPROC_MEMORY_DELAY)))
 	{
           /* Itbl support may require additional care here. */
 	  ++nops;
 	  if ((! mips_opts.mips16
-	       && mips_opts.isa < 4
+	       && ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 	       && (! cop_interlocks
                    && prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE))
 	      || (! hilo_interlocks
@@ -2319,7 +2395,7 @@
 	    nops = 0;
 	}
       else if ((! mips_opts.mips16
-		&& mips_opts.isa < 4
+		&& ISA_HAS_COPROC_DELAYS (mips_opts.isa)
 		&& (! cop_interlocks
                     && prev_prev_insn.insn_mo->pinfo & INSN_WRITE_COND_CODE))
 	       || (! hilo_interlocks
@@ -2360,11 +2436,11 @@
 	  for (l = insn_labels; l != NULL; l = l->next)
 	    {
 	      assert (S_GET_SEGMENT (l->label) == now_seg);
-	      l->label->sy_frag = frag_now;
+	      symbol_set_frag (l->label, frag_now);
 	      S_SET_VALUE (l->label, (valueT) frag_now_fix ());
 	      /* mips16 text labels are stored as odd.  */
 	      if (mips_opts.mips16)
-		++l->label->sy_value.X_add_number;
+		S_SET_VALUE (l->label, S_GET_VALUE (l->label) + 1);
 	    }
 	}
     }
@@ -2403,7 +2479,6 @@
   struct mips_cl_insn insn;
   bfd_reloc_code_real_type r;
   va_list args;
-  int insn_isa;
 
 #ifdef USE_STDARG
   va_start (args, fmt);
@@ -2437,30 +2512,10 @@
   /* Search until we get a match for NAME.  */
   while (1)
     {
-      if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA1)
-	insn_isa = 1;
-      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA2)
-	insn_isa = 2;
-      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA3)
-	insn_isa = 3;
-      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA4)
-	insn_isa = 4;
-      else
-	insn_isa = 15;
-
       if (strcmp (fmt, insn.insn_mo->args) == 0
 	  && insn.insn_mo->pinfo != INSN_MACRO
-	  && (insn_isa <= mips_opts.isa
-	      || (mips_cpu == 4650
-		  && (insn.insn_mo->membership & INSN_4650) != 0)
-	      || (mips_cpu == 4010
-		  && (insn.insn_mo->membership & INSN_4010) != 0)
-	      || ((mips_cpu == 4100
-		   || mips_cpu == 4111
-		   )
-		  && (insn.insn_mo->membership & INSN_4100) != 0)
-	      || (mips_cpu == 3900
-		  && (insn.insn_mo->membership & INSN_3900) != 0))
+	  && OPCODE_IS_MEMBER (insn.insn_mo, mips_opts.isa, mips_cpu, 
+			       mips_gp32)
 	  && (mips_cpu != 4650 || (insn.insn_mo->pinfo & FP_D) == 0))
 	break;
 
@@ -2542,7 +2597,6 @@
 		  || r == BFD_RELOC_MIPS_GOT_LO16
 		  || r == BFD_RELOC_MIPS_CALL_LO16
 		  || (ep->X_op == O_subtract
-		      && now_seg == text_section
 		      && r == BFD_RELOC_PCREL_LO16));
 	  continue;
 
@@ -2556,7 +2610,6 @@
 			      || r == BFD_RELOC_MIPS_GOT_HI16
 			      || r == BFD_RELOC_MIPS_CALL_HI16))
 		      || (ep->X_op == O_subtract
-			  && now_seg == text_section
 			  && r == BFD_RELOC_PCREL_HI16_S)));
 	  if (ep->X_op == O_constant)
 	    {
@@ -2960,9 +3013,9 @@
 		    || ! ep->X_unsigned
 		    || sizeof (ep->X_add_number) > 4
 		    || (ep->X_add_number & 0x80000000) == 0))
-	       || ((mips_opts.isa < 3 || ! dbl)
+	       || ((! ISA_HAS_64BIT_REGS (mips_opts.isa) || ! dbl)
 		   && (ep->X_add_number &~ (offsetT) 0xffffffff) == 0)
-	       || (mips_opts.isa < 3
+	       || (! ISA_HAS_64BIT_REGS (mips_opts.isa)
 		   && ! dbl
 		   && ((ep->X_add_number &~ (offsetT) 0xffffffff)
 		       == ~ (offsetT) 0xffffffff)))
@@ -2979,7 +3032,7 @@
 
   /* The value is larger than 32 bits.  */
 
-  if (mips_opts.isa < 3)
+  if (! ISA_HAS_64BIT_REGS (mips_opts.isa))
     {
       as_bad (_("Number larger than 32 bits"));
       macro_build ((char *) NULL, counter, ep, "addiu", "t,r,j", reg, 0,
@@ -3220,7 +3273,7 @@
 	  frag_grow (20);
 	  macro_build ((char *) NULL, counter, ep,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", reg, GP, (int) BFD_RELOC_MIPS_GPREL);
 	  p = frag_var (rs_machine_dependent, 8, 0,
@@ -3233,7 +3286,7 @@
 	p += 4;
       macro_build (p, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "addiu" : "daddiu"),
 		   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
     }
@@ -3253,7 +3306,7 @@
       frag_grow (20);
       macro_build ((char *) NULL, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "lw" : "ld"),
 		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP);
       macro_build ((char *) NULL, counter, (expressionS *) NULL, "nop", "");
@@ -3262,7 +3315,7 @@
 		    ep->X_add_symbol, (offsetT) 0, (char *) NULL);
       macro_build (p, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "addiu" : "daddiu"),
 		   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
       if (ex.X_add_number != 0)
@@ -3272,7 +3325,7 @@
 	  ex.X_op = O_constant;
 	  macro_build ((char *) NULL, counter, &ex,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa  < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
 	}
@@ -3303,12 +3356,12 @@
 		   (int) BFD_RELOC_MIPS_GOT_HI16);
       macro_build ((char *) NULL, counter, (expressionS *) NULL,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "addu" : "daddu"),
 		   "d,v,t", reg, reg, GP);
       macro_build ((char *) NULL, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "lw" : "ld"),
 		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT_LO16, reg);
       p = frag_var (rs_machine_dependent, 12 + off, 0,
@@ -3326,7 +3379,7 @@
 	}
       macro_build (p, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "lw" : "ld"),
 		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP);
       p += 4;
@@ -3334,7 +3387,7 @@
       p += 4;
       macro_build (p, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "addiu" : "daddiu"),
 		   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
       if (ex.X_add_number != 0)
@@ -3344,7 +3397,7 @@
 	  ex.X_op = O_constant;
 	  macro_build ((char *) NULL, counter, &ex,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-		         || mips_opts.isa  < 3)
+		         || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
 	}
@@ -3356,7 +3409,7 @@
 	 */
       macro_build ((char *) NULL, counter, ep,
 		   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     || mips_opts.isa  < 3)
+		     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		    ? "addiu" : "daddiu"),
 		   "t,r,j", reg, GP, (int) BFD_RELOC_MIPS_GPREL);
     }
@@ -3564,7 +3617,7 @@
     case M_BGT_I:
       /* check for > max integer */
       maxnum = 0x7fffffff;
-      if (mips_opts.isa >= 3 && sizeof (maxnum) > 4)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa) && sizeof (maxnum) > 4)
 	{
 	  maxnum <<= 16;
 	  maxnum |= 0xffff;
@@ -3573,7 +3626,7 @@
 	}
       if (imm_expr.X_op == O_constant
 	  && imm_expr.X_add_number >= maxnum
-	  && (mips_opts.isa < 3 || sizeof (maxnum) > 4))
+	  && (! ISA_HAS_64BIT_REGS (mips_opts.isa) || sizeof (maxnum) > 4))
 	{
 	do_false:
 	  /* result is always false */
@@ -3613,7 +3666,7 @@
 	  return;
 	}
       maxnum = 0x7fffffff;
-      if (mips_opts.isa >= 3 && sizeof (maxnum) > 4)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa) && sizeof (maxnum) > 4)
 	{
 	  maxnum <<= 16;
 	  maxnum |= 0xffff;
@@ -3623,7 +3676,7 @@
       maxnum = - maxnum - 1;
       if (imm_expr.X_op == O_constant
 	  && imm_expr.X_add_number <= maxnum
-	  && (mips_opts.isa < 3 || sizeof (maxnum) > 4))
+	  && (! ISA_HAS_64BIT_REGS (mips_opts.isa) || sizeof (maxnum) > 4))
 	{
 	do_true:
 	  /* result is always true */
@@ -3660,7 +3713,7 @@
       likely = 1;
     case M_BGTU_I:
       if (sreg == 0
-	  || (mips_opts.isa < 3
+	  || (! ISA_HAS_64BIT_REGS (mips_opts.isa)
 	      && imm_expr.X_op == O_constant
 	      && imm_expr.X_add_number == 0xffffffff))
 	goto do_false;
@@ -3756,7 +3809,7 @@
       likely = 1;
     case M_BLE_I:
       maxnum = 0x7fffffff;
-      if (mips_opts.isa >= 3 && sizeof (maxnum) > 4)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa) && sizeof (maxnum) > 4)
 	{
 	  maxnum <<= 16;
 	  maxnum |= 0xffff;
@@ -3765,7 +3818,7 @@
 	}
       if (imm_expr.X_op == O_constant
 	  && imm_expr.X_add_number >= maxnum
-	  && (mips_opts.isa < 3 || sizeof (maxnum) > 4))
+	  && (! ISA_HAS_64BIT_REGS (mips_opts.isa) || sizeof (maxnum) > 4))
 	goto do_true;
       if (imm_expr.X_op != O_constant)
 	as_bad (_("Unsupported large constant"));
@@ -3818,7 +3871,7 @@
       likely = 1;
     case M_BLEU_I:
       if (sreg == 0
-	  || (mips_opts.isa < 3
+	  || (! ISA_HAS_64BIT_REGS (mips_opts.isa)
 	      && imm_expr.X_op == O_constant
 	      && imm_expr.X_add_number == 0xffffffff))
 	goto do_true;
@@ -4095,28 +4148,29 @@
       /* When generating embedded PIC code, we permit expressions of
 	 the form
 	   la	$4,foo-bar
-	 where bar is an address in the .text section.  These are used
+	 where bar is an address in the current section.  These are used
 	 when getting the addresses of functions.  We don't permit
 	 X_add_number to be non-zero, because if the symbol is
 	 external the relaxing code needs to know that any addend is
 	 purely the offset to X_op_symbol.  */
       if (mips_pic == EMBEDDED_PIC
 	  && offset_expr.X_op == O_subtract
-	  && now_seg == text_section
-	  && (offset_expr.X_op_symbol->sy_value.X_op == O_constant
-	      ? S_GET_SEGMENT (offset_expr.X_op_symbol) == text_section
-	      : (offset_expr.X_op_symbol->sy_value.X_op == O_symbol
-		 && (S_GET_SEGMENT (offset_expr.X_op_symbol
-				    ->sy_value.X_add_symbol)
-		     == text_section)))
+	  && (symbol_constant_p (offset_expr.X_op_symbol)
+	      ? S_GET_SEGMENT (offset_expr.X_op_symbol) == now_seg
+	      : (symbol_equated_p (offset_expr.X_op_symbol)
+		 && (S_GET_SEGMENT
+		     (symbol_get_value_expression (offset_expr.X_op_symbol)
+		      ->X_add_symbol)
+		     == now_seg)))
 	  && breg == 0
-	  && offset_expr.X_add_number == 0)
+	  && (offset_expr.X_add_number == 0
+	      || OUTPUT_FLAVOR == bfd_target_elf_flavour))
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u",
 		       treg, (int) BFD_RELOC_PCREL_HI16_S);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-		         || mips_opts.isa  < 3)
+		         || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", treg, treg, (int) BFD_RELOC_PCREL_LO16);
 	  return;
@@ -4159,7 +4213,7 @@
 	      frag_grow (20);
 	      macro_build ((char *) NULL, &icnt, &offset_expr,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-		     	     || mips_opts.isa  < 3)
+		     	     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", tempreg, GP, (int) BFD_RELOC_MIPS_GPREL);
 	      p = frag_var (rs_machine_dependent, 8, 0,
@@ -4173,7 +4227,7 @@
 	    p += 4;
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa  < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	}
@@ -4240,7 +4294,7 @@
 		}
 	      macro_build (p, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	      /* FIXME: If breg == 0, and the next instruction uses
@@ -4254,7 +4308,7 @@
 			   "nop", "");
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	      (void) frag_var (rs_machine_dependent, 0, 0,
@@ -4281,7 +4335,7 @@
 			       "nop", "");
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       ((bfd_arch_bits_per_address (stdoutput) == 32
-				 || mips_opts.isa < 3)
+				 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 				? "addu" : "daddu"),
 			       "d,v,t", treg, AT, breg);
 		  breg = 0;
@@ -4298,12 +4352,12 @@
 
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", AT, AT, (int) BFD_RELOC_LO16);
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", tempreg, tempreg, AT);
 	      (void) frag_var (rs_machine_dependent, 0, 0,
@@ -4364,7 +4418,7 @@
 		       tempreg, (int) BFD_RELOC_MIPS_GOT_HI16);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addu" : "daddu"),
 		       "d,v,t", tempreg, tempreg, GP);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
@@ -4403,7 +4457,7 @@
 			   "nop", "");
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 
@@ -4438,7 +4492,7 @@
 			       "nop", "");
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       ((bfd_arch_bits_per_address (stdoutput) == 32
-				 || mips_opts.isa < 3)
+				 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 				? "addu" : "daddu"),
 			       "d,v,t", treg, AT, breg);
 		  dreg = treg;
@@ -4454,12 +4508,12 @@
 
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", AT, AT, (int) BFD_RELOC_LO16);
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", dreg, dreg, AT);
 
@@ -4493,7 +4547,7 @@
 	      p += 4;
 	      macro_build (p, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	      /* FIXME: If add_number is 0, and there was no base
@@ -4513,7 +4567,7 @@
 		  p += 4;
 		  macro_build (p, &icnt, (expressionS *) NULL,
 			       ((bfd_arch_bits_per_address (stdoutput) == 32
-				 || mips_opts.isa < 3)
+				 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 				? "addu" : "daddu"),
 			       "d,v,t", treg, AT, breg);
 		  p += 4;
@@ -4527,13 +4581,13 @@
 	      p += 4;
 	      macro_build (p, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addiu" : "daddiu"),
 			   "t,r,j", AT, AT, (int) BFD_RELOC_LO16);
 	      p += 4;
 	      macro_build (p, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", tempreg, tempreg, AT);
 	      p += 4;
@@ -4546,7 +4600,7 @@
 	     */
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", tempreg, GP, (int) BFD_RELOC_MIPS_GPREL);
 	}
@@ -4556,7 +4610,7 @@
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     ((bfd_arch_bits_per_address (stdoutput) == 32
-		       || mips_opts.isa < 3)
+		       || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      ? "addu" : "daddu"),
 		     "d,v,t", treg, tempreg, breg);
 
@@ -4600,7 +4654,7 @@
 	      expr1.X_add_number = mips_cprestore_offset;
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "lw" : "ld"),
 			   "t,o(b)", GP, (int) BFD_RELOC_LO16, mips_frame_reg);
 	    }
@@ -4643,7 +4697,7 @@
 	    {
 	      macro_build ((char *) NULL, &icnt, &offset_expr,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "lw" : "ld"),
 			   "t,o(b)", PIC_CALL_REG,
 			   (int) BFD_RELOC_MIPS_CALL16, GP);
@@ -4666,12 +4720,12 @@
 			   PIC_CALL_REG, (int) BFD_RELOC_MIPS_CALL_HI16);
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", PIC_CALL_REG, PIC_CALL_REG, GP);
 	      macro_build ((char *) NULL, &icnt, &offset_expr,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "lw" : "ld"),
 			   "t,o(b)", PIC_CALL_REG,
 			   (int) BFD_RELOC_MIPS_CALL_LO16, PIC_CALL_REG);
@@ -4689,7 +4743,7 @@
 		}
 	      macro_build (p, &icnt, &offset_expr,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "lw" : "ld"),
 			   "t,o(b)", PIC_CALL_REG,
 			   (int) BFD_RELOC_MIPS_GOT16, GP);
@@ -4699,7 +4753,7 @@
 	    }			   
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			? "addiu" : "daddiu"),
 		       "t,r,j", PIC_CALL_REG, PIC_CALL_REG,
 		       (int) BFD_RELOC_LO16);
@@ -4715,7 +4769,7 @@
 	      expr1.X_add_number = mips_cprestore_offset;
 	      macro_build ((char *) NULL, &icnt, &expr1,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "lw" : "ld"),
 			   "t,o(b)", GP, (int) BFD_RELOC_LO16,
 			   mips_frame_reg);
@@ -4972,7 +5026,7 @@
 		  frag_grow (28);
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       ((bfd_arch_bits_per_address (stdoutput) == 32
-				 || mips_opts.isa < 3)
+				 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 				? "addu" : "daddu"),
 			       "d,v,t", tempreg, breg, GP);
 		  macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
@@ -4987,7 +5041,7 @@
 		p += 4;
 	      macro_build (p, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", tempreg, tempreg, breg);
 	      if (p != NULL)
@@ -5022,7 +5076,7 @@
 	  frag_grow (20);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
@@ -5032,13 +5086,13 @@
 			(char *) NULL);
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	  if (breg != 0)
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			 ((bfd_arch_bits_per_address (stdoutput) == 32
-			   || mips_opts.isa < 3)
+			   || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			  ? "addu" : "daddu"),
 			 "d,v,t", tempreg, tempreg, breg);
 	  macro_build ((char *) NULL, &icnt, &expr1, s, fmt, treg,
@@ -5079,12 +5133,12 @@
 		       tempreg, (int) BFD_RELOC_MIPS_GOT_HI16);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addu" : "daddu"),
 		       "d,v,t", tempreg, tempreg, GP);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT_LO16,
 		       tempreg);
@@ -5098,7 +5152,7 @@
 	    }
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP);
 	  p += 4;
@@ -5106,13 +5160,13 @@
 	  p += 4;
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
 	  if (breg != 0)
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			 ((bfd_arch_bits_per_address (stdoutput) == 32
-			   || mips_opts.isa < 3)
+			   || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			  ? "addu" : "daddu"),
 			 "d,v,t", tempreg, tempreg, breg);
 	  macro_build ((char *) NULL, &icnt, &expr1, s, fmt, treg,
@@ -5137,7 +5191,7 @@
 	    {
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", tempreg, breg, GP);
 	      macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
@@ -5188,7 +5242,7 @@
          or in offset_expr.  */
       if (imm_expr.X_op == O_constant || imm_expr.X_op == O_big)
 	{
-	  if (mips_opts.isa >= 3)
+	  if (ISA_HAS_64BIT_REGS (mips_opts.isa))
 	    load_register (&icnt, treg, &imm_expr, 1);
 	  else
 	    {
@@ -5233,7 +5287,7 @@
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
 	}
@@ -5243,7 +5297,7 @@
 	     a single instruction.  */
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", AT, GP, (int) BFD_RELOC_MIPS_GPREL);
 	  offset_expr.X_op = O_constant;
@@ -5253,7 +5307,7 @@
 	abort ();
 	
       /* Now we load the register(s).  */
-      if (mips_opts.isa >= 3)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa))
 	macro_build ((char *) NULL, &icnt, &offset_expr, "ld", "t,o(b)",
 		     treg, (int) BFD_RELOC_LO16, AT);
       else
@@ -5284,8 +5338,8 @@
          or in offset_expr.  */
       if (imm_expr.X_op == O_constant || imm_expr.X_op == O_big)
 	{
-	  load_register (&icnt, AT, &imm_expr, mips_opts.isa >= 3);
-	  if (mips_opts.isa >= 3)
+	  load_register (&icnt, AT, &imm_expr, ISA_HAS_64BIT_REGS (mips_opts.isa));
+	  if (ISA_HAS_64BIT_REGS (mips_opts.isa))
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			 "dmtc1", "t,S", AT, treg);
 	  else
@@ -5311,7 +5365,7 @@
       s = segment_name (S_GET_SEGMENT (offset_expr.X_add_symbol));
       if (strcmp (s, ".lit8") == 0)
 	{
-	  if (mips_opts.isa >= 2)
+	  if (mips_opts.isa != 1)
 	    {
 	      macro_build ((char *) NULL, &icnt, &offset_expr, "ldc1",
 			   "T,o(b)", treg, (int) BFD_RELOC_MIPS_LITERAL, GP);
@@ -5327,7 +5381,7 @@
 	  if (mips_pic == SVR4_PIC)
 	    macro_build ((char *) NULL, &icnt, &offset_expr,
 			 ((bfd_arch_bits_per_address (stdoutput) == 32
-			   || mips_opts.isa < 3)
+			   || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			  ? "lw" : "ld"),
 			 "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
 	  else
@@ -5336,7 +5390,7 @@
 	      macro_build_lui ((char *) NULL, &icnt, &offset_expr, AT);
 	    }
 	      
-	  if (mips_opts.isa >= 2)
+	  if (mips_opts.isa != 1)
 	    {
 	      macro_build ((char *) NULL, &icnt, &offset_expr, "ldc1",
 			   "T,o(b)", treg, (int) BFD_RELOC_LO16, AT);
@@ -5363,7 +5417,7 @@
 	 to adjust when loading from memory.  */
       r = BFD_RELOC_LO16;
     dob:
-      assert (mips_opts.isa < 2);
+      assert (mips_opts.isa == 1);
       macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)",
 		   target_big_endian ? treg + 1 : treg,
 		   (int) r, breg);
@@ -5402,7 +5456,7 @@
 	}
       /* Itbl support may require additional care here. */
       coproc = 1;
-      if (mips_opts.isa >= 2)
+      if (mips_opts.isa != 1)
 	{
 	  s = "ldc1";
 	  goto ld;
@@ -5419,7 +5473,7 @@
 	  return;
 	}
 
-      if (mips_opts.isa >= 2)
+      if (mips_opts.isa != 1)
 	{
 	  s = "sdc1";
 	  goto st;
@@ -5432,7 +5486,7 @@
       goto ldd_std;
 
     case M_LD_AB:
-      if (mips_opts.isa >= 3)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa))
 	{
 	  s = "ld";
 	  goto ld;
@@ -5443,7 +5497,7 @@
       goto ldd_std;
 
     case M_SD_AB:
-      if (mips_opts.isa >= 3)
+      if (ISA_HAS_64BIT_REGS (mips_opts.isa))
 	{
 	  s = "sd";
 	  goto st;
@@ -5506,7 +5560,7 @@
 		  frag_grow (36);
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       ((bfd_arch_bits_per_address (stdoutput) == 32
-				 || mips_opts.isa < 3)
+				 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 				? "addu" : "daddu"),
 			       "d,v,t", AT, breg, GP);
 		  tempreg = AT;
@@ -5564,7 +5618,7 @@
 	    {
 	      macro_build (p, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", AT, breg, AT);
 	      if (p != NULL)
@@ -5613,14 +5667,14 @@
 	  frag_grow (24 + off);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
 	  if (breg != 0)
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			 ((bfd_arch_bits_per_address (stdoutput) == 32
-			   || mips_opts.isa < 3)
+			   || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			  ? "addu" : "daddu"),
 			 "d,v,t", AT, breg, AT);
           /* Itbl support may require additional care here. */
@@ -5682,19 +5736,19 @@
 		       AT, (int) BFD_RELOC_MIPS_GOT_HI16);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addu" : "daddu"),
 		       "d,v,t", AT, AT, GP);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT_LO16, AT);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
 	  if (breg != 0)
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			 ((bfd_arch_bits_per_address (stdoutput) == 32
-			   || mips_opts.isa < 3)
+			   || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			  ? "addu" : "daddu"),
 			 "d,v,t", AT, breg, AT);
           /* Itbl support may require additional care here. */
@@ -5726,7 +5780,7 @@
 	    }
 	  macro_build (p, &icnt, &offset_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "lw" : "ld"),
 		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
 	  p += 4;
@@ -5736,7 +5790,7 @@
 	    {
 	      macro_build (p, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", AT, breg, AT);
 	      p += 4;
@@ -5777,7 +5831,7 @@
 	    {
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   ((bfd_arch_bits_per_address (stdoutput) == 32
-			     || mips_opts.isa < 3)
+			     || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 			    ? "addu" : "daddu"),
 			   "d,v,t", AT, breg, GP);
 	      tempreg = AT;
@@ -5808,7 +5862,8 @@
     case M_SD_OB:
       s = "sw";
     sd_ob:
-      assert (bfd_arch_bits_per_address (stdoutput) == 32 || mips_opts.isa < 3);
+      assert (bfd_arch_bits_per_address (stdoutput) == 32 
+	      || ! ISA_HAS_64BIT_REGS (mips_opts.isa));
       macro_build ((char *) NULL, &icnt, &offset_expr, s, "t,o(b)", treg,
 		   (int) BFD_RELOC_LO16, breg);
       offset_expr.X_add_number += 4;
@@ -6046,7 +6101,7 @@
 	  as_bad (_("opcode not supported on this processor"));
 	  return;
 	}
-      assert (mips_opts.isa < 2);
+      assert (mips_opts.isa == 1);
       /* Even on a big endian machine $fn comes before $fn+1.  We have
 	 to adjust when storing to memory.  */
       macro_build ((char *) NULL, &icnt, &offset_expr, "swc1", "T,o(b)",
@@ -6103,7 +6158,7 @@
 	  imm_expr.X_add_number = -imm_expr.X_add_number;
 	  macro_build ((char *) NULL, &icnt, &imm_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", dreg, sreg,
 		       (int) BFD_RELOC_LO16);
@@ -6256,7 +6311,7 @@
 		   ip->insn_mo->name);
 	  macro_build ((char *) NULL, &icnt, &expr1,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", dreg, 0, (int) BFD_RELOC_LO16);
 	  return;
@@ -6276,7 +6331,7 @@
 	  imm_expr.X_add_number = -imm_expr.X_add_number;
 	  macro_build ((char *) NULL, &icnt, &imm_expr,
 		       ((bfd_arch_bits_per_address (stdoutput) == 32
-			 || mips_opts.isa < 3)
+			 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		        ? "addiu" : "daddiu"),
 		       "t,r,j", dreg, sreg, (int) BFD_RELOC_LO16);
 	  used_at = 0;
@@ -6355,7 +6410,7 @@
 
     case M_TRUNCWD:
     case M_TRUNCWS:
-      assert (mips_opts.isa < 2);
+      assert (mips_opts.isa == 1);
       sreg = (ip->insn_opcode >> 11) & 0x1f;	/* floating reg */
       dreg = (ip->insn_opcode >> 06) & 0x1f;	/* floating reg */
 
@@ -6445,7 +6500,7 @@
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     ((bfd_arch_bits_per_address (stdoutput) == 32
-		       || mips_opts.isa < 3)
+		       || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      ? "addu" : "daddu"),
 		     "d,v,t", AT, AT, breg);
       if (! target_big_endian)
@@ -6468,7 +6523,7 @@
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     ((bfd_arch_bits_per_address (stdoutput) == 32
-		       || mips_opts.isa < 3)
+		       || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      ? "addu" : "daddu"),
 		     "d,v,t", AT, AT, breg);
       if (target_big_endian)
@@ -6542,7 +6597,7 @@
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     ((bfd_arch_bits_per_address (stdoutput) == 32
-		       || mips_opts.isa < 3)
+		       || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      ? "addu" : "daddu"),
 		     "d,v,t", AT, AT, breg);
       if (! target_big_endian)
@@ -6564,7 +6619,7 @@
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     ((bfd_arch_bits_per_address (stdoutput) == 32
-		       || mips_opts.isa < 3)
+		       || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      ? "addu" : "daddu"),
 		     "d,v,t", AT, AT, breg);
       if (! target_big_endian)
@@ -6956,13 +7011,13 @@
   /* If the instruction contains a '.', we first try to match an instruction
      including the '.'.  Then we try again without the '.'.  */
   insn = NULL;
-  for (s = str; *s != '\0' && !isspace(*s); ++s)
+  for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s)
     continue;
 
   /* If we stopped on whitespace, then replace the whitespace with null for
      the call to hash_find.  Save the character we replaced just in case we
      have to re-parse the instruction.  */
-  if (isspace (*s))
+  if (isspace ((unsigned char) *s))
     {
       save_c = *s;
       *s++ = '\0';
@@ -6980,7 +7035,7 @@
 	*(--s) = save_c;
 
       /* Scan up to the first '.' or whitespace.  */
-      for (s = str; *s != '\0' && *s != '.' && !isspace (*s); ++s)
+      for (s = str; *s != '\0' && *s != '.' && !isspace ((unsigned char) *s); ++s)
 	continue;
 
       /* If we did not find a '.', then we can quit now.  */
@@ -7004,37 +7059,15 @@
   argsStart = s;
   for (;;)
     {
-      int insn_isa;
       boolean ok;
 
       assert (strcmp (insn->name, str) == 0);
 
-      if ((insn->membership & INSN_ISA) == INSN_ISA1)
-	insn_isa = 1;
-      else if ((insn->membership & INSN_ISA) == INSN_ISA2)
-	insn_isa = 2;
-      else if ((insn->membership & INSN_ISA) == INSN_ISA3)
-	insn_isa = 3;
-      else if ((insn->membership & INSN_ISA) == INSN_ISA4)
-	insn_isa = 4;
-      else
-	insn_isa = 15;
-
-      if (insn_isa <= mips_opts.isa)
+      if (OPCODE_IS_MEMBER (insn, mips_opts.isa, mips_cpu, mips_gp32))
 	ok = true;
-      else if (insn->pinfo == INSN_MACRO)
+      else 
 	ok = false;
-      else if ((mips_cpu == 4650 && (insn->membership & INSN_4650) != 0)
-	       || (mips_cpu == 4010 && (insn->membership & INSN_4010) != 0)
-	       || ((mips_cpu == 4100
-		    || mips_cpu == 4111
-		    )
-		   && (insn->membership & INSN_4100) != 0)
-	       || (mips_cpu == 3900 && (insn->membership & INSN_3900) != 0))
-	ok = true;
-      else
-	ok = false;
-
+      
       if (insn->pinfo != INSN_MACRO)
 	{
 	  if (mips_cpu == 4650 && (insn->pinfo & FP_D) != 0)
@@ -7049,17 +7082,16 @@
 	      ++insn;
 	      continue;
 	    }
-	  if (insn_isa == 15 
-              || insn_isa <= mips_opts.isa)
-	    insn_error = _("opcode not supported on this processor");
 	  else
 	    {
 	      static char buf[100];
-
-	      sprintf (buf, _("opcode requires -mips%d or greater"), insn_isa);
+	      sprintf (buf, 
+		       _("opcode not supported on this processor: %d (MIPS%d)"),
+		       mips_cpu, mips_opts.isa);
+		       
 	      insn_error = buf;
+	      return;
 	    }
-	  return;
 	}
 
       ip->insn_mo = insn;
@@ -7246,7 +7278,7 @@
 	      if (s[0] == '$')
 		{
 
-		  if (isdigit (s[1]))
+		  if (isdigit ((unsigned char) s[1]))
 		    {
 		      ++s;
 		      regno = 0;
@@ -7256,7 +7288,7 @@
 			  regno += *s - '0';
 			  ++s;
 			}
-		      while (isdigit (*s));
+		      while (isdigit ((unsigned char) *s));
 		      if (regno > 31)
 			as_bad (_("Invalid register number (%d)"), regno);
 		    }
@@ -7297,23 +7329,22 @@
 		      else if (itbl_have_entries)
 			{
 			  char *p, *n;
-			  int r;
+			  unsigned long r;
 
-			  p = s+1; 	/* advance past '$' */
+			  p = s + 1; 	/* advance past '$' */
 			  n = itbl_get_field (&p);  /* n is name */
 
-			  /* See if this is a register defined in an 
-			     itbl entry */
-			  r = itbl_get_reg_val (n);
-			  if (r)
+			  /* See if this is a register defined in an
+			     itbl entry.  */
+			  if (itbl_get_reg_val (n, &r))
 			    {
 			      /* Get_field advances to the start of
 				 the next field, so we need to back
-				 rack to the end of the last field. */
+				 rack to the end of the last field.  */
 			      if (p) 
 				s = p - 1;
 			      else 
-				s = strchr (s,'\0');
+				s = strchr (s, '\0');
 			      regno = r;
 			    }
 			  else
@@ -7406,7 +7437,7 @@
 	    case 'V':
 	    case 'W':
 	      s_reset = s;
-	      if (s[0] == '$' && s[1] == 'f' && isdigit (s[2]))
+	      if (s[0] == '$' && s[1] == 'f' && isdigit ((unsigned char) s[2]))
 		{
 		  s += 2;
 		  regno = 0;
@@ -7416,13 +7447,13 @@
 		      regno += *s - '0';
 		      ++s;
 		    }
-		  while (isdigit (*s));
+		  while (isdigit ((unsigned char) *s));
 
 		  if (regno > 31)
 		    as_bad (_("Invalid float register number (%d)"), regno);
 
 		  if ((regno & 1) != 0
-		      && mips_opts.isa < 3
+		      && ! ISA_HAS_64BIT_REGS (mips_opts.isa)
 		      && ! (strcmp (str, "mtc1") == 0
 			    || strcmp (str, "mfc1") == 0
 			    || strcmp (str, "lwc1") == 0
@@ -7575,7 +7606,7 @@
                        offset_expr to the low order 32 bits.
                        Otherwise, set imm_expr to the entire 64 bit
                        constant.  */
-		    if (mips_opts.isa < 3)
+		    if (! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		      {
 			imm_expr.X_op = O_constant;
 			offset_expr.X_op = O_constant;
@@ -7633,11 +7664,15 @@
 		      default: /* unused default case avoids warnings.  */
 		      case 'L':
 			newname = RDATA_SECTION_NAME;
-			if (USE_GLOBAL_POINTER_OPT && g_switch_value >= 8)
+			if ((USE_GLOBAL_POINTER_OPT && g_switch_value >= 8)
+			    || mips_pic == EMBEDDED_PIC)
 			  newname = ".lit8";
 			break;
 		      case 'F':
-			newname = RDATA_SECTION_NAME;
+			if (mips_pic == EMBEDDED_PIC)
+			  newname = ".lit8";
+			else
+			  newname = RDATA_SECTION_NAME;
 			break;
 		      case 'l':
 			assert (!USE_GLOBAL_POINTER_OPT
@@ -7744,7 +7779,7 @@
                           && imm_expr.X_op == O_constant)
 		      || (more
 			  && imm_expr.X_add_number < 0
-			  && mips_opts.isa >= 3
+			  && ISA_HAS_64BIT_REGS (mips_opts.isa)
 			  && imm_expr.X_unsigned
 			  && sizeof (imm_expr.X_add_number) <= 4))
 		    {
@@ -7780,9 +7815,8 @@
 		      || offset_expr.X_add_number < -0x8000)
 		  && (mips_pic != EMBEDDED_PIC
 		      || offset_expr.X_op != O_subtract
-		      || now_seg != text_section
 		      || (S_GET_SEGMENT (offset_expr.X_op_symbol)
-			  != text_section)))
+			  != now_seg)))
 		break;
 
 	      if (c == 'h' || c == 'H')
@@ -7848,7 +7882,7 @@
 		  regno += *s - '0';
 		  ++s;
 		}
-	      while (isdigit (*s));
+	      while (isdigit ((unsigned char) *s));
 	      if (regno > 7)
 		as_bad (_("invalid condition code register $fcc%d"), regno);
 	      if (*args == 'N')
@@ -7901,7 +7935,7 @@
   mips16_small = false;
   mips16_ext = false;
 
-  for (s = str; islower (*s); ++s)
+  for (s = str; islower ((unsigned char) *s); ++s)
     ;
   switch (*s)
     {
@@ -8034,7 +8068,7 @@
 	      if (s[0] != '$')
 		break;
 	      s_reset = s;
-	      if (isdigit (s[1]))
+	      if (isdigit ((unsigned char) s[1]))
 		{
 		  ++s;
 		  regno = 0;
@@ -8044,7 +8078,7 @@
 		      regno += *s - '0';
 		      ++s;
 		    }
-		  while (isdigit (*s));
+		  while (isdigit ((unsigned char) *s));
 		  if (regno > 31)
 		    {
 		      as_bad (_("invalid register number (%d)"), regno);
@@ -8315,7 +8349,7 @@
 			++s;
 		      }
 		    reg1 = 0;
-		    while (isdigit (*s))
+		    while (isdigit ((unsigned char) *s))
 		      {
 			reg1 *= 10;
 			reg1 += *s - '0';
@@ -8342,7 +8376,7 @@
 			      }
 			  }
 			reg2 = 0;
-			while (isdigit (*s))
+			while (isdigit ((unsigned char) *s))
 			  {
 			    reg2 *= 10;
 			    reg2 += *s - '0';
@@ -8626,9 +8660,9 @@
 	;
       if (sp - 4 >= str && sp[-1] == RP)
 	{
-	  if (isdigit (sp[-2]))
+	  if (isdigit ((unsigned char) sp[-2]))
 	    {
-	      for (sp -= 3; sp >= str && isdigit (*sp); sp--)
+	      for (sp -= 3; sp >= str && isdigit ((unsigned char) *sp); sp--)
 		;
 	      if (*sp == '$' && sp > str && sp[-1] == LP)
 		{
@@ -8699,10 +8733,10 @@
       && ep->X_op == O_symbol
       && strcmp (S_GET_NAME (ep->X_add_symbol), FAKE_LABEL_NAME) == 0
       && S_GET_SEGMENT (ep->X_add_symbol) == now_seg
-      && ep->X_add_symbol->sy_frag == frag_now
-      && ep->X_add_symbol->sy_value.X_op == O_constant
-      && ep->X_add_symbol->sy_value.X_add_number == frag_now_fix ())
-    ++ep->X_add_symbol->sy_value.X_add_number;
+      && symbol_get_frag (ep->X_add_symbol) == frag_now
+      && symbol_constant_p (ep->X_add_symbol)
+      && S_GET_VALUE (ep->X_add_symbol) == frag_now_fix ())
+    S_SET_VALUE (ep->X_add_symbol, S_GET_VALUE (ep->X_add_symbol) + 1);
 }
 
 /* Turn a string in input_line_pointer into a floating point constant
@@ -8825,6 +8859,11 @@
 #define OPTION_MABI (OPTION_MD_BASE + 38)
   {"mabi", required_argument, NULL, OPTION_MABI},
 
+#define OPTION_M7000_HILO_FIX (OPTION_MD_BASE + 39)
+  {"mfix7000", no_argument, NULL, OPTION_M7000_HILO_FIX},
+#define OPTION_NO_M7000_HILO_FIX (OPTION_MD_BASE + 40)
+  {"no-fix-7000", no_argument, NULL, OPTION_NO_M7000_HILO_FIX},
+
 #define OPTION_CALL_SHARED (OPTION_MD_BASE + 7)
 #define OPTION_NON_SHARED (OPTION_MD_BASE + 8)
 #define OPTION_XGOT (OPTION_MD_BASE + 19)
@@ -8839,6 +8878,11 @@
   {"64", no_argument, NULL, OPTION_64},
 #endif
 
+#define OPTION_GP32 (OPTION_MD_BASE + 41)
+#define OPTION_GP64 (OPTION_MD_BASE + 42)
+  {"mgp32", no_argument, NULL, OPTION_GP32},
+  {"mgp64", no_argument, NULL, OPTION_GP64},
+
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof(md_longopts);
@@ -9139,6 +9183,27 @@
       }
       break;
 
+    case OPTION_GP32:
+      mips_gp32 = 1;
+      mips_64 = 0;
+
+      /* We deliberately don't allow "-gp32" to set the MIPS_32BITMODE
+	 flag in object files because to do so would make it
+	 impossible to link with libraries compiled without "-gp32".
+	 This is unnecessarily restrictive.  
+
+	 We could solve this problem by adding "-gp32" multilibs to
+	 gcc, but to set this flag before gcc is built with such
+	 multilibs will break too many systems. */
+
+/*    mips_32bitmode = 1; */
+      break;
+
+    case OPTION_GP64:
+      mips_gp32 = 0;
+      mips_64 = 1;
+/*    mips_32bitmode = 0; */
+      break;
 
     case OPTION_MABI:
       if (strcmp (arg,"32") == 0
@@ -9149,6 +9214,14 @@
 	mips_abi_string = arg;
       break;
 
+    case OPTION_M7000_HILO_FIX:
+      mips_7000_hilo_fix = true;
+      break;
+
+    case OPTION_NO_M7000_HILO_FIX:
+      mips_7000_hilo_fix = false;
+      break;
+
     default:
       return 0;
     }
@@ -9423,6 +9496,7 @@
    fixup requires the special reloc.  */
 #define SWITCH_TABLE(fixp) \
   ((fixp)->fx_r_type == BFD_RELOC_32 \
+   && OUTPUT_FLAVOR != bfd_target_elf_flavour \
    && (fixp)->fx_addsy != NULL \
    && (fixp)->fx_subsy != NULL \
    && S_GET_SEGMENT ((fixp)->fx_addsy) == text_section \
@@ -9470,15 +9544,16 @@
      symbol, we need to adjust the value.  */
 #ifdef OBJ_ELF
   if (fixP->fx_addsy != NULL && OUTPUT_FLAVOR == bfd_target_elf_flavour)
+    {
     if (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16 
         || S_IS_WEAK (fixP->fx_addsy)
-        || (fixP->fx_addsy->sy_used_in_reloc
-            && (bfd_get_section_flags (stdoutput,
-                                       S_GET_SEGMENT (fixP->fx_addsy))
-                & SEC_LINK_ONCE != 0)
-               || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)),
-                            ".gnu.linkonce",
-                            sizeof (".gnu.linkonce") - 1)))
+        || (symbol_used_in_reloc_p (fixP->fx_addsy)
+            && (((bfd_get_section_flags (stdoutput,
+                                         S_GET_SEGMENT (fixP->fx_addsy))
+                  & SEC_LINK_ONCE) != 0)
+                || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)),
+                             ".gnu.linkonce",
+                             sizeof (".gnu.linkonce") - 1))))
 
       {
         value -= S_GET_VALUE (fixP->fx_addsy);
@@ -9486,12 +9561,29 @@
           {
             /* In this case, the bfd_install_relocation routine will
                incorrectly add the symbol value back in.  We just want
-               the addend to appear in the object file.  */
+               the addend to appear in the object file.  
+	       FIXME: If this makes VALUE zero, we're toast.  */
             value -= S_GET_VALUE (fixP->fx_addsy);
           }
       }
-#endif
 
+      /* This code was generated using trial and error and so is
+	 fragile and not trustworthy.  If you change it, you should
+	 rerun the elf-rel, elf-rel2, and empic testcases and ensure
+	 they still pass.  */
+      if (fixP->fx_pcrel || fixP->fx_subsy != NULL)
+	{
+	  value += fixP->fx_frag->fr_address + fixP->fx_where;
+
+	  /* BFD's REL handling, for MIPS, is _very_ weird.
+	     This gives the right results, but it can't possibly
+	     be the way things are supposed to work.  */
+	  if (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2
+	      || S_GET_SEGMENT (fixP->fx_addsy) != undefined_section)
+	    value += fixP->fx_frag->fr_address + fixP->fx_where;
+	}
+    }
+#endif
 
   fixP->fx_addnumber = value;	/* Remember value for tc_gen_reloc */
 
@@ -9529,7 +9621,12 @@
     case BFD_RELOC_PCREL_HI16_S:
       /* The addend for this is tricky if it is internal, so we just
 	 do everything here rather than in bfd_install_relocation.  */
-      if ((fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0)
+      if (OUTPUT_FLAVOR == bfd_target_elf_flavour 
+	  && !fixP->fx_done
+	  && value != 0)
+	break;
+      if (fixP->fx_addsy
+	  && (symbol_get_bfdsym (fixP->fx_addsy)->flags & BSF_SECTION_SYM) == 0)
 	{
 	  /* For an external symbol adjust by the address to make it
 	     pcrel_offset.  We use the address of the RELLO reloc
@@ -9549,7 +9646,12 @@
     case BFD_RELOC_PCREL_LO16:
       /* The addend for this is tricky if it is internal, so we just
 	 do everything here rather than in bfd_install_relocation.  */
-      if ((fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0)
+      if (OUTPUT_FLAVOR == bfd_target_elf_flavour 
+	  && !fixP->fx_done
+	  && value != 0)
+	break;
+      if (fixP->fx_addsy
+	  && (symbol_get_bfdsym (fixP->fx_addsy)->flags & BSF_SECTION_SYM) == 0)
 	value += fixP->fx_frag->fr_address + fixP->fx_where;
       buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where;
       if (target_big_endian)
@@ -9586,6 +9688,7 @@
 	}
       break;
 
+    case BFD_RELOC_RVA:
     case BFD_RELOC_32:
       /* If we are deleting this reloc entry, we must fill in the
 	 value now.  This can happen if we have a .word which is not
@@ -9631,6 +9734,15 @@
       if ((value & 0x3) != 0)
 	as_bad_where (fixP->fx_file, fixP->fx_line,
 		      _("Branch to odd address (%lx)"), value);
+
+      if (!fixP->fx_done && value != 0)
+	break;
+      /* If 'value' is zero, the remaining reloc code won't actually
+	 do the store, so it must be done here.  This is probably
+	 a bug somewhere.  */
+      if (!fixP->fx_done)
+	value -= fixP->fx_frag->fr_address + fixP->fx_where;
+      
       value >>= 2;
 
       /* update old instruction data */
@@ -9818,7 +9930,7 @@
   if (label != NULL)
     {
       assert (S_GET_SEGMENT (label) == now_seg);
-      label->sy_frag = frag_now;
+      symbol_set_frag (label, frag_now);
       S_SET_VALUE (label, (valueT) frag_now_fix ());
     }
 }
@@ -10002,10 +10114,12 @@
   mips_emit_delays (false);
 
   if (auto_align)
-    if (type == 'd')
-      mips_align (3, 0, label);
-    else
-      mips_align (2, 0, label);
+    {
+      if (type == 'd')
+	mips_align (3, 0, label);
+      else
+	mips_align (2, 0, label);
+    }
 
   mips_clear_insn_labels ();
 
@@ -10053,7 +10167,7 @@
 	flag = BSF_FUNCTION;
     }
 
-  symbolP->bsym->flags |= flag;
+  symbol_get_bfdsym (symbolP)->flags |= flag;
 
   S_SET_EXTERNAL (symbolP);
   demand_empty_rest_of_line ();
@@ -10297,7 +10411,7 @@
   ex.X_add_number = 0;
 
   /* In ELF, this symbol is implicitly an STT_OBJECT symbol.  */
-  ex.X_add_symbol->bsym->flags |= BSF_OBJECT;
+  symbol_get_bfdsym (ex.X_add_symbol)->flags |= BSF_OBJECT;
 
   macro_build_lui ((char *) NULL, &icnt, &ex, GP);
   macro_build ((char *) NULL, &icnt, &ex, "addiu", "t,r,j", GP, GP,
@@ -10336,7 +10450,7 @@
 
   macro_build ((char *) NULL, &icnt, &ex,
 	       ((bfd_arch_bits_per_address (stdoutput) == 32
-		 || mips_opts.isa < 3)
+		 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		? "sw" : "sd"),
 	       "t,o(b)", GP, (int) BFD_RELOC_LO16, SP);
 
@@ -10404,7 +10518,7 @@
   reg = tc_get_register (0);
   macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 	       ((bfd_arch_bits_per_address (stdoutput) == 32
-		 || mips_opts.isa < 3)
+		 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 		? "addu" : "daddu"),
 	       "d,v,t", reg, reg, GP);
 
@@ -10489,7 +10603,7 @@
 	  ignore_rest_of_line();
 	  return;
 	}
-      symbolP->sy_value = exp;
+      symbol_set_value_expression (symbolP, &exp);
     }
 
   demand_empty_rest_of_line ();
@@ -10601,15 +10715,16 @@
       else if ((! S_IS_DEFINED (sym) || S_IS_COMMON (sym))
 	       && (0
 #ifndef NO_ECOFF_DEBUGGING
-		   || (sym->ecoff_extern_size != 0
-		       && sym->ecoff_extern_size <= g_switch_value)
+		   || (symbol_get_obj (sym)->ecoff_extern_size != 0
+		       && (symbol_get_obj (sym)->ecoff_extern_size
+			   <= g_switch_value))
 #endif
 		   /* We must defer this decision until after the whole
 		      file has been read, since there might be a .extern
 		      after the first use of this symbol.  */
 		   || (before_relaxing
 #ifndef NO_ECOFF_DEBUGGING
-		       && sym->ecoff_extern_size == 0
+		       && symbol_get_obj (sym)->ecoff_extern_size == 0
 #endif
 		       && S_GET_VALUE (sym) == 0)
 		   || (S_GET_VALUE (sym) != 0
@@ -10623,7 +10738,9 @@
 	  assert (strcmp (segname, ".lit8") != 0
 		  && strcmp (segname, ".lit4") != 0);
 	  change = (strcmp (segname, ".sdata") != 0
-		    && strcmp (segname, ".sbss") != 0);
+		    && strcmp (segname, ".sbss") != 0
+		    && strncmp (segname, ".sdata.", 7) != 0
+		    && strncmp (segname, ".gnu.linkonce.s.", 16) != 0);
 	}
       return change;
     }
@@ -10679,23 +10796,26 @@
       maxtiny = (1 << (op->nbits - 1)) - 1;
     }
 
-  /* We can't call S_GET_VALUE here, because we don't want to lock in
-     a particular frag address.  */
-  if (fragp->fr_symbol->sy_value.X_op == O_constant)
+  /* We can't always call S_GET_VALUE here, because we don't want to
+     lock in a particular frag address.  */
+  if (symbol_constant_p (fragp->fr_symbol))
     {
-      val = (fragp->fr_symbol->sy_value.X_add_number
-	     + fragp->fr_symbol->sy_frag->fr_address);
+      val = (S_GET_VALUE (fragp->fr_symbol)
+	     + symbol_get_frag (fragp->fr_symbol)->fr_address);
       symsec = S_GET_SEGMENT (fragp->fr_symbol);
     }
-  else if (fragp->fr_symbol->sy_value.X_op == O_symbol
-	   && (fragp->fr_symbol->sy_value.X_add_symbol->sy_value.X_op
-	       == O_constant))
+  else if (symbol_equated_p (fragp->fr_symbol)
+	   && (symbol_constant_p
+	       (symbol_get_value_expression (fragp->fr_symbol)->X_add_symbol)))
     {
-      val = (fragp->fr_symbol->sy_value.X_add_symbol->sy_value.X_add_number
-	     + fragp->fr_symbol->sy_value.X_add_symbol->sy_frag->fr_address
-	     + fragp->fr_symbol->sy_value.X_add_number
-	     + fragp->fr_symbol->sy_frag->fr_address);
-      symsec = S_GET_SEGMENT (fragp->fr_symbol->sy_value.X_add_symbol);
+      symbolS *eqsym;
+
+      eqsym = symbol_get_value_expression (fragp->fr_symbol)->X_add_symbol;
+      val = (S_GET_VALUE (eqsym)
+	     + symbol_get_frag (eqsym)->fr_address
+	     + symbol_get_value_expression (fragp->fr_symbol)->X_add_number
+	     + symbol_get_frag (fragp->fr_symbol)->fr_address);
+      symsec = S_GET_SEGMENT (eqsym);
     }
   else
     return 1;
@@ -10737,7 +10857,8 @@
 	 in STRETCH in order to get a better estimate of the address.
 	 This particularly matters because of the shift bits.  */
       if (stretch != 0
-	  && fragp->fr_symbol->sy_frag->fr_address >= fragp->fr_address)
+	  && (symbol_get_frag (fragp->fr_symbol)->fr_address
+	      >= fragp->fr_address))
 	{
 	  fragS *f;
 
@@ -10748,7 +10869,7 @@
              a maximum number of bytes to skip when doing an
              alignment.  */
 	  for (f = fragp;
-	       f != NULL && f != fragp->fr_symbol->sy_frag;
+	       f != NULL && f != symbol_get_frag (fragp->fr_symbol);
 	       f = f->fr_next)
 	    {
 	      if (f->fr_type == rs_align || f->fr_type == rs_align_code)
@@ -10882,14 +11003,14 @@
       sym = fragp->fr_symbol;
 
       /* Handle the case of a symbol equated to another symbol.  */
-      while (sym->sy_value.X_op == O_symbol
+      while (symbol_equated_p (sym)
 	     && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
 	{
 	  symbolS *n;
 
 	  /* It's possible to get a loop here in a badly written
              program.  */
-	  n = sym->sy_value.X_add_symbol;
+	  n = symbol_get_value_expression (sym)->X_add_symbol;
 	  if (n == sym)
 	    break;
 	  sym = n;
@@ -10967,7 +11088,8 @@
   reloc = retval[0] = (arelent *) xmalloc (sizeof (arelent));
   retval[1] = NULL;
 
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   if (mips_pic == EMBEDDED_PIC
@@ -10981,10 +11103,12 @@
 	as_fatal (_("Double check fx_r_type in tc-mips.c:tc_gen_reloc"));
       fixp->fx_r_type = BFD_RELOC_GPREL32;
     }
+  else if (fixp->fx_pcrel == 0 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
+    reloc->addend = fixp->fx_addnumber;
   else if (fixp->fx_r_type == BFD_RELOC_PCREL_LO16)
     {
       /* We use a special addend for an internal RELLO reloc.  */
-      if (fixp->fx_addsy->bsym->flags & BSF_SECTION_SYM)
+      if (symbol_section_p (fixp->fx_addsy))
 	reloc->addend = reloc->address - S_GET_VALUE (fixp->fx_subsy);
       else
 	reloc->addend = fixp->fx_addnumber + reloc->address;
@@ -10996,7 +11120,7 @@
       /* We use a special addend for an internal RELHI reloc.  The
 	 reloc is relative to the RELLO; adjust the addend
 	 accordingly.  */
-      if (fixp->fx_addsy->bsym->flags & BSF_SECTION_SYM)
+      if (symbol_section_p (fixp->fx_addsy))
 	reloc->addend = (fixp->fx_next->fx_frag->fr_address
 			 + fixp->fx_next->fx_where
 			 - S_GET_VALUE (fixp->fx_subsy));
@@ -11005,8 +11129,6 @@
 			 + fixp->fx_next->fx_frag->fr_address
 			 + fixp->fx_next->fx_where);
     }
-  else if (fixp->fx_pcrel == 0)
-    reloc->addend = fixp->fx_addnumber;
   else
     {
       if (OUTPUT_FLAVOR != bfd_target_aout_flavour)
@@ -11055,7 +11177,8 @@
       reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
       reloc2 = retval[1] = (arelent *) xmalloc (sizeof (arelent));
       retval[2] = NULL;
-      reloc2->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+      reloc2->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+      *reloc2->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       reloc2->address = (reloc->address
 			 + (RELAX_RELOC2 (fixp->fx_frag->fr_subtype)
 			    - RELAX_RELOC1 (fixp->fx_frag->fr_subtype)));
@@ -11144,7 +11267,8 @@
   /* To support a PC relative reloc when generating embedded PIC code
      for ECOFF, we use a Cygnus extension.  We check for that here to
      make sure that we don't let such a reloc escape normally.  */
-  if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
+  if ((OUTPUT_FLAVOR == bfd_target_ecoff_flavour
+       || OUTPUT_FLAVOR == bfd_target_elf_flavour)
       && code == BFD_RELOC_16_PCREL_S2
       && mips_pic != EMBEDDED_PIC)
     reloc->howto = NULL;
@@ -11433,7 +11557,7 @@
 
 typedef struct proc
   {
-    struct symbol *isym;
+    symbolS *isym;
     unsigned long reg_mask;
     unsigned long reg_offset;
     unsigned long fpreg_mask;
@@ -11448,6 +11572,36 @@
 static procS *cur_proc_ptr;
 static int numprocs;
 
+/* When we align code in the .text section of mips16, use the correct two
+   byte nop pattern of 0x6500 (move $0,$0) */
+
+int
+mips_do_align (n, fill, len, max)
+     int n;
+     const char *fill;
+     int len;
+     int max;
+{
+  if (fill == NULL
+      && subseg_text_p (now_seg)
+      && n > 1
+      && mips_opts.mips16)
+    {
+      static const unsigned char be_nop[] = { 0x65, 0x00 };
+      static const unsigned char le_nop[] = { 0x00, 0x65 };
+
+      frag_align (1, 0, 0);
+
+      if (target_big_endian)
+      	frag_align_pattern (n, be_nop, 2, max);      
+      else
+      	frag_align_pattern (n, le_nop, 2, max);      
+      return 1;
+    }
+
+  return 0;
+}
+
 static void
 md_obj_begin ()
 {
@@ -11472,14 +11626,14 @@
       ++input_line_pointer;
       negative = 1;
     }
-  if (!isdigit (*input_line_pointer))
+  if (!isdigit ((unsigned char) *input_line_pointer))
     as_bad (_("Expected simple number."));
   if (input_line_pointer[0] == '0')
     {
       if (input_line_pointer[1] == 'x')
 	{
 	  input_line_pointer += 2;
-	  while (isxdigit (*input_line_pointer))
+	  while (isxdigit ((unsigned char) *input_line_pointer))
 	    {
 	      val <<= 4;
 	      val |= hex_value (*input_line_pointer++);
@@ -11489,7 +11643,7 @@
       else
 	{
 	  ++input_line_pointer;
-	  while (isdigit (*input_line_pointer))
+	  while (isdigit ((unsigned char) *input_line_pointer))
 	    {
 	      val <<= 3;
 	      val |= *input_line_pointer++ - '0';
@@ -11497,14 +11651,14 @@
 	  return negative ? -val : val;
 	}
     }
-  if (!isdigit (*input_line_pointer))
+  if (!isdigit ((unsigned char) *input_line_pointer))
     {
       printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
 	      *input_line_pointer, *input_line_pointer);
       as_warn (_("Invalid number"));
       return -1;
     }
-  while (isdigit (*input_line_pointer))
+  while (isdigit ((unsigned char) *input_line_pointer))
     {
       val *= 10;
       val += *input_line_pointer++ - '0';
@@ -11630,7 +11784,8 @@
   if (*input_line_pointer == ',')
     input_line_pointer++;
   SKIP_WHITESPACE ();
-  if (isdigit (*input_line_pointer) || *input_line_pointer == '-')
+  if (isdigit ((unsigned char) *input_line_pointer)
+      || *input_line_pointer == '-')
     number = get_number ();
 
 #ifdef BFD_ASSEMBLER
@@ -11658,7 +11813,7 @@
 
       cur_proc_ptr->isym = symbolP;
 
-      symbolP->bsym->flags |= BSF_FUNCTION;
+      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
 
       numprocs++;
     }
@@ -11778,6 +11933,3 @@
   symbolP->sy_segment = now_seg;
 }
 #endif
-
-
-  
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index 868aede..1008b75 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -1,5 +1,5 @@
 /* tc-mips.h -- header file for tc-mips.c.
-   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 1999, 2000 Free Software Foundation, Inc.
    Contributed by the OSF and Ralph Campbell.
    Written by Keith Knowles and Ralph Campbell, working independently.
    Modified for ECOFF support by Ian Lance Taylor of Cygnus Support.
@@ -55,6 +55,9 @@
 #define md_undefined_symbol(name)	(0)
 #define md_operand(x)
 
+extern int mips_do_align PARAMS ((int, const char *, int, int));
+#define md_do_align(n,fill,len,max,l) if (mips_do_align (n,fill,len,max)) goto l
+
 /* We permit PC relative difference expressions when generating
    embedded PIC code.  */
 #define DIFF_EXPR_OK
@@ -85,7 +88,7 @@
 extern int mips_parse_long_option PARAMS ((const char *));
 
 #define tc_frob_label(sym) mips_define_label (sym)
-extern void mips_define_label PARAMS ((struct symbol *));
+extern void mips_define_label PARAMS ((symbolS *));
 
 #define tc_frob_file_before_adjust() mips_frob_file_before_adjust ()
 extern void mips_frob_file_before_adjust PARAMS ((void));
@@ -139,6 +142,7 @@
 #define md_end()	md_mips_end()
 
 #define USE_GLOBAL_POINTER_OPT	(OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
+				 || OUTPUT_FLAVOR == bfd_target_coff_flavour \
 				 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
 
 extern void mips_pop_insert PARAMS ((void));
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 2380915..264f7bf 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -1,6 +1,5 @@
 /* tc-mn10200.c -- Assembler code for the Matsushita 10200
-
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1252,7 +1251,8 @@
     }
   else 
     {
-      reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+      reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+      *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       reloc->addend = fixp->fx_offset;
     }
   return reloc;
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 3f9e9ce..e0076f4 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -1,6 +1,5 @@
 /* tc-mn10300.c -- Assembler code for the Matsushita 10300
-
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -120,6 +119,7 @@
 const pseudo_typeS md_pseudo_table[] =
 {
   { "am30",	set_arch_mach,		300 },
+  { "am33",	set_arch_mach,		330 },
   { "mn10300",	set_arch_mach,		300 },
   {NULL, 0, 0}
 };
@@ -146,6 +146,77 @@
 };
 #define ADDRESS_REG_NAME_CNT	(sizeof(address_registers) / sizeof(struct reg_name))
 
+static const struct reg_name r_registers[] =
+{
+  { "a0", 8 },
+  { "a1", 9 },
+  { "a2", 10 },
+  { "a3", 11 },
+  { "d0", 12 },
+  { "d1", 13 },
+  { "d2", 14 },
+  { "d3", 15 },
+  { "e0", 0 },
+  { "e1", 1 },
+  { "e10", 10 },
+  { "e11", 11 },
+  { "e12", 12 },
+  { "e13", 13 },
+  { "e14", 14 },
+  { "e15", 15 },
+  { "e2", 2 },
+  { "e3", 3 },
+  { "e4", 4 },
+  { "e5", 5 },
+  { "e6", 6 },
+  { "e7", 7 },
+  { "e8", 8 },
+  { "e9", 9 },
+  { "r0", 0 },
+  { "r1", 1 },
+  { "r10", 10 },
+  { "r11", 11 },
+  { "r12", 12 },
+  { "r13", 13 },
+  { "r14", 14 },
+  { "r15", 15 },
+  { "r2", 2 },
+  { "r3", 3 },
+  { "r4", 4 },
+  { "r5", 5 },
+  { "r6", 6 },
+  { "r7", 7 },
+  { "r8", 8 },
+  { "r9", 9 },
+};
+#define R_REG_NAME_CNT	(sizeof(r_registers) / sizeof(struct reg_name))
+
+static const struct reg_name xr_registers[] =
+{
+  { "mcrh", 2 },
+  { "mcrl", 3 },
+  { "mcvf", 4 },
+  { "mdrq", 1 },
+  { "sp", 0 },
+  { "xr0", 0 },
+  { "xr1", 1 },
+  { "xr10", 10 },
+  { "xr11", 11 },
+  { "xr12", 12 },
+  { "xr13", 13 },
+  { "xr14", 14 },
+  { "xr15", 15 },
+  { "xr2", 2 },
+  { "xr3", 3 },
+  { "xr4", 4 },
+  { "xr5", 5 },
+  { "xr6", 6 },
+  { "xr7", 7 },
+  { "xr8", 8 },
+  { "xr9", 9 },
+};
+#define XR_REG_NAME_CNT	(sizeof(xr_registers) / sizeof(struct reg_name))
+
 
 static const struct reg_name other_registers[] =
 {
@@ -187,6 +258,97 @@
 }
 
 
+/* Summary of register_name().
+ *
+ * in: Input_line_pointer points to 1st char of operand.
+ *
+ * out: A expressionS.
+ *	The operand may have been a register: in this case, X_op == O_register,
+ *	X_add_number is set to the register number, and truth is returned.
+ *	Input_line_pointer->(next non-blank) char after operand, or is in
+ *	its original state.
+ */
+static boolean
+r_register_name (expressionP)
+     expressionS *expressionP;
+{
+  int reg_number;
+  char *name;
+  char *start;
+  char c;
+
+  /* Find the spelling of the operand */
+  start = name = input_line_pointer;
+
+  c = get_symbol_end ();
+  reg_number = reg_name_search (r_registers, R_REG_NAME_CNT, name);
+
+  /* look to see if it's in the register table */
+  if (reg_number >= 0) 
+    {
+      expressionP->X_op = O_register;
+      expressionP->X_add_number = reg_number;
+
+      /* make the rest nice */
+      expressionP->X_add_symbol = NULL;
+      expressionP->X_op_symbol = NULL;
+      *input_line_pointer = c;	/* put back the delimiting char */
+      return true;
+    }
+  else
+    {
+      /* reset the line as if we had not done anything */
+      *input_line_pointer = c;   /* put back the delimiting char */
+      input_line_pointer = start; /* reset input_line pointer */
+      return false;
+    }
+}
+
+/* Summary of register_name().
+ *
+ * in: Input_line_pointer points to 1st char of operand.
+ *
+ * out: A expressionS.
+ *	The operand may have been a register: in this case, X_op == O_register,
+ *	X_add_number is set to the register number, and truth is returned.
+ *	Input_line_pointer->(next non-blank) char after operand, or is in
+ *	its original state.
+ */
+static boolean
+xr_register_name (expressionP)
+     expressionS *expressionP;
+{
+  int reg_number;
+  char *name;
+  char *start;
+  char c;
+
+  /* Find the spelling of the operand */
+  start = name = input_line_pointer;
+
+  c = get_symbol_end ();
+  reg_number = reg_name_search (xr_registers, XR_REG_NAME_CNT, name);
+
+  /* look to see if it's in the register table */
+  if (reg_number >= 0) 
+    {
+      expressionP->X_op = O_register;
+      expressionP->X_add_number = reg_number;
+
+      /* make the rest nice */
+      expressionP->X_add_symbol = NULL;
+      expressionP->X_op_symbol = NULL;
+      *input_line_pointer = c;	/* put back the delimiting char */
+      return true;
+    }
+  else
+    {
+      /* reset the line as if we had not done anything */
+      *input_line_pointer = c;   /* put back the delimiting char */
+      input_line_pointer = start; /* reset input_line pointer */
+      return false;
+    }
+}
 
 /* Summary of register_name().
  *
@@ -855,6 +1017,110 @@
 	      *input_line_pointer = c;
 	      goto keep_going;
 	    }
+	  else if (operand->flags & MN10300_OPERAND_RREG)
+	    {
+	      if (!r_register_name (&ex))
+		{
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	    }
+	  else if (operand->flags & MN10300_OPERAND_XRREG)
+	    {
+	      if (!xr_register_name (&ex))
+		{
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	    }
+	  else if (operand->flags & MN10300_OPERAND_USP)
+	    {
+	      char *start = input_line_pointer;
+	      char c = get_symbol_end ();
+
+	      if (strcasecmp (start, "usp") != 0)
+		{
+		  *input_line_pointer = c;
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      *input_line_pointer = c;
+	      goto keep_going;
+	    }
+	  else if (operand->flags & MN10300_OPERAND_SSP)
+	    {
+	      char *start = input_line_pointer;
+	      char c = get_symbol_end ();
+
+	      if (strcasecmp (start, "ssp") != 0)
+		{
+		  *input_line_pointer = c;
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      *input_line_pointer = c;
+	      goto keep_going;
+	    }
+	  else if (operand->flags & MN10300_OPERAND_MSP)
+	    {
+	      char *start = input_line_pointer;
+	      char c = get_symbol_end ();
+
+	      if (strcasecmp (start, "msp") != 0)
+		{
+		  *input_line_pointer = c;
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      *input_line_pointer = c;
+	      goto keep_going;
+	    }
+	  else if (operand->flags & MN10300_OPERAND_PC)
+	    {
+	      char *start = input_line_pointer;
+	      char c = get_symbol_end ();
+
+	      if (strcasecmp (start, "pc") != 0)
+		{
+		  *input_line_pointer = c;
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      *input_line_pointer = c;
+	      goto keep_going;
+	    }
+	  else if (operand->flags & MN10300_OPERAND_EPSW)
+	    {
+	      char *start = input_line_pointer;
+	      char c = get_symbol_end ();
+
+	      if (strcasecmp (start, "epsw") != 0)
+		{
+		  *input_line_pointer = c;
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      *input_line_pointer = c;
+	      goto keep_going;
+	    }
+	  else if (operand->flags & MN10300_OPERAND_PLUS)
+	    {
+	      if (*input_line_pointer != '+')
+		{
+		  input_line_pointer = hold;
+		  str = hold;
+		  goto error;
+		}
+	      input_line_pointer++;
+	      goto keep_going;
+	    }
 	  else if (operand->flags & MN10300_OPERAND_PSW)
 	    {
 	      char *start = input_line_pointer;
@@ -941,6 +1207,30 @@
 		      value |= 0x08;
 		      *input_line_pointer = c;
 		    }
+		  else if (current_machine == 330
+			   && strcasecmp (start, "exreg0") == 0)
+		    {
+		      value |= 0x04;
+		      *input_line_pointer = c;
+		    }
+		  else if (current_machine == 330
+			   && strcasecmp (start, "exreg1") == 0)
+		    {
+		      value |= 0x02;
+		      *input_line_pointer = c;
+		    }
+		  else if (current_machine == 330
+			   && strcasecmp (start, "exother") == 0)
+		    {
+		      value |= 0x01;
+		      *input_line_pointer = c;
+		    }
+		  else if (current_machine == 330
+			   && strcasecmp (start, "all") == 0)
+		    {
+		      value |= 0xff;
+		      *input_line_pointer = c;
+		    }
 		  else
 		    {
 		      input_line_pointer = hold;
@@ -972,6 +1262,18 @@
 	      str = hold;
 	      goto error;
 	    }
+	  else if (r_register_name (&ex))
+	    {
+	      input_line_pointer = hold;
+	      str = hold;
+	      goto error;
+	    }
+	  else if (xr_register_name (&ex))
+	    {
+	      input_line_pointer = hold;
+	      str = hold;
+	      goto error;
+	    }
 	  else if (*str == ')' || *str == '(')
 	    {
 	      input_line_pointer = hold;
@@ -996,6 +1298,7 @@
 		int mask;
 
 		mask = MN10300_OPERAND_DREG | MN10300_OPERAND_AREG;
+		mask |= MN10300_OPERAND_RREG | MN10300_OPERAND_XRREG;
 		if ((operand->flags & mask) == 0)
 		  {
 		    input_line_pointer = hold;
@@ -1012,6 +1315,10 @@
 			 || opcode->format == FMT_S6
 			 || opcode->format == FMT_D5)
 		  extra_shift = 16;
+		else if (opcode->format == FMT_D7)
+		  extra_shift = 8;
+		else if (opcode->format == FMT_D8 || opcode->format == FMT_D9)
+		  extra_shift = 8;
 		else
 		  extra_shift = 0;
 	      
@@ -1139,6 +1446,17 @@
   if (opcode->format == FMT_S2 || opcode->format == FMT_D1)
     size = 3;
 
+  if (opcode->format == FMT_D6)
+    size = 3;
+
+  if (opcode->format == FMT_D7 || opcode->format == FMT_D10)
+    size = 4;
+
+  if (opcode->format == FMT_D8)
+    size = 6;
+
+  if (opcode->format == FMT_D9)
+    size = 7;
 
   if (opcode->format == FMT_S4)
     size = 5;
@@ -1223,6 +1541,9 @@
       if (opcode->format == FMT_S0
 	  || opcode->format == FMT_S1
 	  || opcode->format == FMT_D0
+	  || opcode->format == FMT_D6
+	  || opcode->format == FMT_D7
+	  || opcode->format == FMT_D10
 	  || opcode->format == FMT_D1)
 	{
 	  number_to_chars_bigendian (f, insn, size);
@@ -1297,6 +1618,19 @@
 	  number_to_chars_littleendian (f + 2, temp, 4);
 	  number_to_chars_bigendian (f + 6, extension & 0xff, 1);
 	}
+      else if (opcode->format == FMT_D8)
+	{
+          unsigned long temp = ((insn & 0xff) << 16) | (extension & 0xffff);
+          number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
+          number_to_chars_bigendian (f + 3, (temp & 0xff), 1);
+          number_to_chars_littleendian (f + 4, temp >> 8, 2);
+	}
+      else if (opcode->format == FMT_D9)
+	{
+          unsigned long temp = ((insn & 0xff) << 24) | (extension & 0xffffff);
+          number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
+          number_to_chars_littleendian (f + 3, temp, 4);
+	}
 
       /* Create any fixups.  */
       for (i = 0; i < fc; i++)
@@ -1337,6 +1671,8 @@
 		 implicitly 32bits.  */
 	      if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
 		reloc_size = 32;
+	      else if ((operand->flags & MN10300_OPERAND_24BIT) != 0)
+		reloc_size = 24;
 	      else
 		reloc_size = operand->bits;
 
@@ -1445,7 +1781,8 @@
     }
   else 
     {
-      reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+      reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof( asymbol *));
+      *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       reloc->addend = fixp->fx_offset;
     }
   return reloc;
@@ -1544,6 +1881,8 @@
       int bits;
 
       bits = operand->bits;
+      if (operand->flags & MN10300_OPERAND_24BIT)
+	bits = 24;
 
       if ((operand->flags & MN10300_OPERAND_SIGNED) != 0)
 	{
@@ -1579,6 +1918,12 @@
       *extensionp |= ((val & ((1 << (32 - operand->bits)) - 1))
 		      << operand->shift);
     }
+  else if ((operand->flags & MN10300_OPERAND_24BIT) != 0)
+    {
+      *insnp |= (val >> (24 - operand->bits)) & ((1 << operand->bits) - 1);
+      *extensionp |= ((val & ((1 << (24 - operand->bits)) - 1))
+		      << operand->shift);
+    }
   else if ((operand->flags & MN10300_OPERAND_EXTENDED) == 0)
     {
       *insnp |= (((long) val & ((1 << operand->bits) - 1))
@@ -1615,6 +1960,8 @@
       int bits;
 
       bits = operand->bits;
+      if (operand->flags & MN10300_OPERAND_24BIT)
+	bits = 24;
 
       if ((operand->flags & MN10300_OPERAND_SIGNED) != 0)
 	{
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index 42dc528..59f1467 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -1,5 +1,6 @@
 /* ns32k.c  -- Assemble on the National Semiconductor 32k series
-   Copyright (C) 1987, 92, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1970,7 +1971,7 @@
   /* The displacement of the address, from current location.  */
   disp = (S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset) - object_address;
 #ifdef BFD_ASSEMBLER
-  disp += fragP->fr_symbol->sy_frag->fr_address;
+  disp += symbol_get_frag (fragP->fr_symbol)->fr_address;
 #endif
   disp += md_pcrel_adjust(fragP);
 
@@ -2264,7 +2265,8 @@
   code = reloc(fixp->fx_size, fixp->fx_pcrel, fix_im_disp(fixp));
 
   rel = (arelent *) xmalloc (sizeof (arelent));
-  rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
   if (fixp->fx_pcrel)
     rel->addend = fixp->fx_addnumber;
diff --git a/gas/config/tc-ns32k.h b/gas/config/tc-ns32k.h
index 4b038eb..69c86ec 100644
--- a/gas/config/tc-ns32k.h
+++ b/gas/config/tc-ns32k.h
@@ -1,5 +1,5 @@
 /* tc-ns32k.h -- Opcode table for National Semi 32k processor
-   Copyright (C) 1987, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1987, 92, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -76,7 +76,7 @@
 extern void fix_new_ns32k PARAMS ((fragS *frag,
 				   int where,
 				   int size,
-				   struct symbol *add_symbol,
+				   symbolS *add_symbol,
 				   long offset,
 				   int pcrel,
 				   int im_disp,
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
new file mode 100644
index 0000000..4f80309
--- /dev/null
+++ b/gas/config/tc-pj.c
@@ -0,0 +1,594 @@
+/*-
+   tc-pj.c -- Assemble code for Pico Java
+   Copyright (C) 1999 Free Software Foundation.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Contributed by Steve Chamberlain of Transmeta, sac@pobox.com */
+
+#include "as.h"
+#include "opcode/pj.h"
+
+
+extern const pj_opc_info_t pj_opc_info[512];
+
+const char comment_chars[] = "!/";
+const char line_separator_chars[] = ";";
+const char line_comment_chars[] = "/!#";
+
+static int pending_reloc;
+static struct hash_control *opcode_hash_control;
+						
+
+static void
+little (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  target_big_endian = 0;
+}
+
+static void
+big (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  target_big_endian = 1;
+}
+
+
+const pseudo_typeS md_pseudo_table[] = {
+  {"ml",    little, 0},
+  {"mb",    big,    0},
+  {0, 0, 0}
+};
+
+
+const char FLT_CHARS[] = "rRsSfFdDxXpP";
+const char EXP_CHARS[] = "eE";
+
+void
+md_operand (op)
+     expressionS *op;
+{
+  if (strncmp (input_line_pointer, "%hi16", 5) == 0)
+    {
+      if (pending_reloc)
+	as_bad (_ ("confusing relocation expressions"));
+      pending_reloc = BFD_RELOC_PJ_CODE_HI16;
+      input_line_pointer += 5;
+      expression (op);
+    }
+  if (strncmp (input_line_pointer, "%lo16", 5) == 0)
+    {
+      if (pending_reloc)
+	as_bad (_ ("confusing relocation expressions"));
+      pending_reloc = BFD_RELOC_PJ_CODE_LO16;
+      input_line_pointer += 5;
+      expression (op);
+    }
+}
+
+/* Parse an expression and then restore the input line pointer. */
+
+static char *
+parse_exp_save_ilp (s, op)
+     char *s;
+     expressionS *op;
+{
+  char *save = input_line_pointer;
+  input_line_pointer = s;
+  expression (op);
+  s = input_line_pointer;
+  input_line_pointer = save;
+  return s;
+}
+
+/* This is called by emit_expr via TC_CONS_FIX_NEW when creating a
+   reloc for a cons.  We could use the definition there, except that
+   we want to handle magic pending reloc expressions specially.  */
+
+void
+pj_cons_fix_new_pj (frag, where, nbytes, exp)
+     fragS *frag;
+     int where;
+     int nbytes;
+     expressionS *exp;
+{
+  static int rv[5][2] = 
+  { { 0, 0 },
+    { BFD_RELOC_8, BFD_RELOC_8 },
+    { BFD_RELOC_PJ_CODE_DIR16, BFD_RELOC_16 },
+    { 0, 0 },
+    { BFD_RELOC_PJ_CODE_DIR32, BFD_RELOC_32 }};
+
+  fix_new_exp (frag, where, nbytes, exp, 0, 
+	       pending_reloc ? pending_reloc
+	       : rv [nbytes][(now_seg->flags & SEC_CODE) ? 0 : 1]);
+
+  pending_reloc = 0;
+}
+
+
+/* Turn a reloc description character from the pj-opc.h table into
+   code which BFD can handle. */
+
+static int
+c_to_r (x)
+     char x;
+{
+  switch (x)
+    {
+    case O_R8:
+      return BFD_RELOC_8_PCREL;
+    case O_U8:
+    case O_8:
+      return BFD_RELOC_8;
+    case O_R16:
+      return BFD_RELOC_PJ_CODE_REL16;
+    case O_U16:
+    case O_16:
+      return BFD_RELOC_PJ_CODE_DIR16;
+    case O_R32:
+      return BFD_RELOC_PJ_CODE_REL32;
+    case O_32:
+      return BFD_RELOC_PJ_CODE_DIR32;
+    }
+  abort ();
+  return 0;
+}
+
+
+
+
+/* Handler for the ipush fake opcode,
+   turns ipush <foo> into sipush lo16<foo>, sethi hi16<foo>. */
+
+static void
+ipush_code (opcode, str)
+     pj_opc_info_t *opcode ATTRIBUTE_UNUSED; 
+     char *str;
+{
+  int mod = 0;
+  char *b = frag_more (6);
+  expressionS arg;
+  b[0] = 0x11;
+  b[3] = 0xed;
+  parse_exp_save_ilp (str + 1, &arg, &mod);
+  if (mod)
+    as_bad (_ ("can't have relocation for ipush"));
+
+
+  fix_new_exp (frag_now, b - frag_now->fr_literal + 1, 2, 
+	       &arg,  0, BFD_RELOC_PJ_CODE_DIR16);
+  fix_new_exp (frag_now, b - frag_now->fr_literal + 4, 2,
+	       &arg,  0, BFD_RELOC_PJ_CODE_HI16);
+}
+
+/* Insert names into the opcode table which are really mini macros,
+   not opcodes.  The fakeness is inidicated with an opcode of -1. */
+
+static void
+     fake_opcode (name, func) const char *
+       name;
+     void (*func) ();
+{
+  pj_opc_info_t *fake = (pj_opc_info_t *) xmalloc (sizeof (pj_opc_info_t));
+
+  fake->opcode = -1;
+  fake->opcode_next = -1;
+  fake->name = (const char *) func;
+  hash_insert (opcode_hash_control, name, (char *) fake);
+}
+
+
+/* Enter another entry into the opcode hash table so the same opcode
+   can have another name. */
+static void
+     alias (new, old) const char *
+       new;
+     const char *old;
+{
+  hash_insert (opcode_hash_control, new,
+	       (char *) hash_find (opcode_hash_control, old));
+}
+
+
+/* This function is called once, at assembler startup time.  It sets
+   up the hash table with all the opcodes in it, and also initializes
+   some aliases for compatibility with other assemblers. */
+
+void
+md_begin ()
+{
+  const pj_opc_info_t *opcode;
+  opcode_hash_control = hash_new ();
+
+  /* Insert names into hash table */
+  for (opcode = pj_opc_info; opcode->name; opcode++)
+    hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+
+  /* Insert the only fake opcode. */
+  fake_opcode ("ipush", ipush_code);
+
+  /* Add some aliases for opcode names. */
+  alias ("ifeq_s", "ifeq");
+  alias ("ifne_s", "ifne");
+  alias ("if_icmpge_s", "if_icmpge");
+  alias ("if_icmpne_s", "if_icmpne");
+  alias ("if_icmpeq_s", "if_icmpeq");
+  alias ("if_icmpgt_s", "if_icmpgt");
+  alias ("goto_s", "goto");
+
+  bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
+}
+
+/* This is the guts of the machine-dependent assembler.  STR points to a
+   machine dependent instruction.  This function is supposed to emit
+   the frags/bytes it assembles to.
+ */
+
+void
+md_assemble (str)
+     char *str;
+{
+  unsigned char *op_start;
+  unsigned char *op_end;
+
+  //  pj_operan_info operand[3];
+  pj_opc_info_t *opcode;
+  char *output;
+  int idx = 0;
+  char pend;
+
+  int nlen = 0;
+
+  /* Drop leading whitespace */
+  while (*str == ' ')
+    str++;
+
+  /* find the op code end */
+  for (op_start = op_end = (unsigned char *) (str);
+       *op_end && !is_end_of_line[*op_end] && *op_end != ' ';
+       op_end++) 
+    nlen++;
+
+  pend = *op_end;
+  *op_end = 0;
+
+  if (nlen == 0)
+    {
+      as_bad (_ ("can't find opcode "));
+    }
+
+  opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
+  *op_end = pend;
+
+  if (opcode == NULL)
+    {
+      as_bad (_ ("unknown opcode %s"), op_start);
+      return;
+    }
+
+  if (opcode->opcode == -1)
+    {
+      /* It's a fake opcode.. dig out the args and pretend that was
+         what we were passed */
+      ((void (*)()) opcode->name) (opcode, op_end);
+    }
+  else
+    {
+      int an;
+
+      output = frag_more (opcode->len);
+      output[idx++] = opcode->opcode;
+
+      if (opcode->opcode_next != -1)
+	output[idx++] = opcode->opcode_next;
+
+      for (an = 0; opcode->arg[an]; an++)
+	{
+	  expressionS arg;
+
+	  if (*op_end == ',' && an != 0)
+	    op_end++;
+
+	  if (*op_end == 0)
+	    as_bad ("expected expresssion");
+
+	  op_end = parse_exp_save_ilp (op_end, &arg);
+
+	  fix_new_exp (frag_now, 
+		       output - frag_now->fr_literal + idx,
+		       ASIZE (opcode->arg[an]),
+		       &arg,
+		       PCREL (opcode->arg[an]), 
+		       pending_reloc ? pending_reloc : c_to_r (opcode->arg[an]));
+
+	  idx += ASIZE (opcode->arg[an]);
+	  pending_reloc = 0;
+	}
+
+      while (isspace (*op_end))
+	op_end++;
+
+      if (*op_end != 0)
+	as_warn ("extra stuff on line ignored");
+
+    }
+
+  if (pending_reloc)
+    as_bad ("Something forgot to clean up\n");
+
+}
+
+/* Turn a string in input_line_pointer into a floating point constant of type
+   type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
+   emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
+ */
+char *
+md_atof (type, litP, sizeP)
+     int type;
+     char *litP;
+     int *sizeP;
+{
+  int prec;
+  LITTLENUM_TYPE words[4];
+  char *t;
+  int i;
+
+  switch (type)
+    {
+    case 'f':
+      prec = 2;
+      break;
+
+    case 'd':
+      prec = 4;
+      break;
+
+    default:
+      *sizeP = 0;
+      return _ ("bad call to md_atof");
+    }
+
+  t = atof_ieee (input_line_pointer, type, words);
+  if (t)
+    input_line_pointer = t;
+
+  *sizeP = prec * 2;
+
+  if (!target_big_endian)
+    {
+      for (i = prec - 1; i >= 0; i--)
+	{
+	  md_number_to_chars (litP, (valueT) words[i], 2);
+	  litP += 2;
+	}
+    }
+  else
+    {
+      for (i = 0; i < prec; i++)
+	{
+	  md_number_to_chars (litP, (valueT) words[i], 2);
+	  litP += 2;
+	}
+    }
+
+  return NULL;
+}
+
+
+CONST char *md_shortopts = "";
+
+struct option md_longopts[] = {
+
+#define OPTION_LITTLE (OPTION_MD_BASE)
+#define OPTION_BIG    (OPTION_LITTLE + 1)
+
+  {"little", no_argument, NULL, OPTION_LITTLE},
+  {"big", no_argument, NULL, OPTION_BIG},
+  {NULL, no_argument, NULL, 0}
+};
+size_t md_longopts_size = sizeof (md_longopts);
+
+int
+md_parse_option (c, arg)
+     int c;
+     char *arg ATTRIBUTE_UNUSED; 
+{
+  switch (c)
+    {
+    case OPTION_LITTLE:
+      little ();
+      break;
+    case OPTION_BIG:
+      big ();
+      break;
+    default:
+      return 0;
+    }
+  return 1;
+}
+
+void
+md_show_usage (stream)
+     FILE *stream;
+{
+  fprintf (stream, _ ("\
+PJ options:\n\
+-little			generate little endian code\n\
+-big			generate big endian code\n"));
+}
+
+
+
+/* Apply a fixup to the object file.  */
+
+
+int
+md_apply_fix (fixP, valp)
+     fixS *fixP;
+     valueT *valp;
+{
+  char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
+  long val = *valp;
+  long max, min;
+  int shift;
+
+
+  /* adjust_reloc_syms won't convert a reloc against a weak symbol
+     into a reloc against a section, but bfd_install_relocation will
+     screw up if the symbol is defined, so we have to adjust val here
+     to avoid the screw up later.  */
+
+  if (fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy))
+    val -= S_GET_VALUE (fixP->fx_addsy);
+
+  max = min = 0;
+  shift = 0;
+  switch (fixP->fx_r_type)
+    {
+    case BFD_RELOC_VTABLE_INHERIT:
+    case BFD_RELOC_VTABLE_ENTRY:
+      fixP->fx_done = 0;
+      return 0;
+
+    case BFD_RELOC_PJ_CODE_REL16:
+      if (val < -0x8000 || val >= 0x7fff)
+	as_bad_where (fixP->fx_file, fixP->fx_line, _ ("pcrel too far"));
+      buf[0] |= (val >> 8) & 0xff;
+      buf[1] = val & 0xff;
+      break;
+
+    case BFD_RELOC_PJ_CODE_HI16:
+      *buf++ = val >> 24;
+      *buf++ = val >> 16;
+      fixP->fx_addnumber = val & 0xffff;
+      break;
+
+    case BFD_RELOC_PJ_CODE_DIR16:
+    case BFD_RELOC_PJ_CODE_LO16:
+      *buf++ = val >> 8;
+      *buf++ = val >> 0;
+
+      max = 0xffff;
+      min = -0xffff;
+      break;
+
+    case BFD_RELOC_8:
+      max = 0xff;
+      min = -0xff;
+      *buf++ = val;
+      break;
+
+    case BFD_RELOC_PJ_CODE_DIR32:
+      *buf++ = val >> 24;
+      *buf++ = val >> 16;
+      *buf++ = val >> 8;
+      *buf++ = val >> 0;
+      break;
+
+    case BFD_RELOC_32:
+      if (target_big_endian)
+	{
+	  *buf++ = val >> 24;
+	  *buf++ = val >> 16;
+	  *buf++ = val >> 8;
+	  *buf++ = val >> 0;
+	}
+      else 
+	{
+	  *buf++ = val >> 0;
+	  *buf++ = val >> 8;
+	  *buf++ = val >> 16;
+	  *buf++ = val >> 24;
+	}
+      break;
+
+    case BFD_RELOC_16:
+      if (target_big_endian)
+	{
+	  *buf++ = val >> 8;
+	  *buf++ = val >> 0;
+	}
+      else
+	{
+	  *buf++ = val >> 0;
+	  *buf++ = val >> 8;
+	}
+      break;
+
+
+    default:
+      abort ();
+    }
+
+  if (max != 0 && (val < min || val > max))
+    as_bad_where (fixP->fx_file, fixP->fx_line, _ ("offset out of range"));
+
+  return 0;
+}
+
+/* Put number into target byte order.  Always put values in an
+   executable section into big endian order. */
+
+void
+md_number_to_chars (ptr, use, nbytes)
+     char *ptr;
+     valueT use;
+     int nbytes;
+{
+  if (target_big_endian || now_seg->flags & SEC_CODE)
+    number_to_chars_bigendian (ptr, use, nbytes);
+  else
+    number_to_chars_littleendian (ptr, use, nbytes);
+}
+
+
+
+/* Translate internal representation of relocation info to BFD target
+   format. */
+
+arelent *
+tc_gen_reloc (section, fixp)
+     asection *section ATTRIBUTE_UNUSED;
+     fixS *fixp;
+{
+  arelent *rel;
+  bfd_reloc_code_real_type r_type;
+
+  rel = (arelent *) xmalloc (sizeof (arelent));
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+  rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
+
+  r_type = fixp->fx_r_type;
+  rel->addend = fixp->fx_addnumber;
+  rel->howto = bfd_reloc_type_lookup (stdoutput, r_type);
+
+  if (rel->howto == NULL)
+    {
+      as_bad_where (fixp->fx_file, fixp->fx_line,
+		    _ ("Cannot represent relocation type %s"),
+		    bfd_get_reloc_code_name (r_type));
+      /* Set howto to a garbage value so that we can keep going.  */
+      rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
+      assert (rel->howto != NULL);
+    }
+
+  return rel;
+}
diff --git a/gas/config/tc-pj.h b/gas/config/tc-pj.h
new file mode 100644
index 0000000..efbf7b7
--- /dev/null
+++ b/gas/config/tc-pj.h
@@ -0,0 +1,62 @@
+/*-This file is tc-pj.h
+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+   Contributed by Steve Chamberlain of Transmeta, sac@pobox.com
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+
+/* Contributed by Steve Chamberlain, of Transmeta. sac@pobox.com. */
+
+#define WORKING_DOT_WORD
+#define IGNORE_NONSTANDARD_ESCAPES
+#define TARGET_ARCH bfd_arch_pj
+#define TARGET_FORMAT (target_big_endian ? "elf32-pj" : "elf32-pjl")
+#define LISTING_HEADER                    				\
+  (target_big_endian                      				\
+   ? "Pico Java GAS Big Endian"           				\
+   : "Pico Java GAS Little Endian")
+
+
+void pj_cons_fix_new_pj PARAMS ((struct frag *, int, int, expressionS *));
+arelent *tc_gen_reloc PARAMS((asection *section, struct fix *fixp));
+
+#define md_section_align(SEGMENT, SIZE)     (SIZE)
+#define md_convert_frag(B, S, F)            (as_fatal (_("convert_frag\n")), 0)
+#define md_estimate_size_before_relax(A, B) (as_fatal (_("estimate size\n")),0)
+#define md_undefined_symbol(NAME)           0
+
+/* PC relative operands are relative to the start of the opcode, and the operand
+   is always one byte into the opcode. */
+
+#define md_pcrel_from(FIXP) 						\
+	((FIXP)->fx_where + (FIXP)->fx_frag->fr_address - 1)
+
+
+#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \
+	pj_cons_fix_new_pj(FRAG, WHERE, NBYTES, EXP)
+
+/* Always leave vtable relocs untouched in the output. */
+#define TC_FORCE_RELOCATION(FIX)                                  	\
+          ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT           	\
+	   || (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+
+#define obj_fix_adjustable(FIX) 					\
+          (! ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT         	\
+	   || (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY))
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 8c31ba6..365a535 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1,5 +1,6 @@
 /* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000)
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
@@ -588,7 +589,7 @@
 
 /* The size of the processor we are assembling for.  This is either
    PPC_OPCODE_32 or PPC_OPCODE_64.  */
-static int ppc_size = PPC_OPCODE_32;
+static unsigned long ppc_size = PPC_OPCODE_32;
 
 /* Opcode hash table.  */
 static struct hash_control *ppc_hash;
@@ -766,6 +767,11 @@
 	  ppc_cpu = PPC_OPCODE_PPC;
 	  ppc_size = PPC_OPCODE_64;
 	}
+      else if (strcmp (arg, "ppc64bridge") == 0)
+	{
+	  ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_64_BRIDGE;
+	  ppc_size = PPC_OPCODE_64;
+	}
       /* -mcom means assemble for the common intersection between Power
 	 and PowerPC.  At present, we just allow the union, rather
 	 than the intersection.  */
@@ -872,6 +878,7 @@
 -mppc, -mppc32, -m403, -m603, -m604\n\
 			generate code for Motorola PowerPC 603/604\n\
 -mppc64, -m620		generate code for Motorola PowerPC 620\n\
+-mppc64bridge		generate code for PowerPC 64, including bridge insns\n\
 -mcom			generate code Power/PowerPC common instructions\n\
 -many			generate code for any architecture (PWR/PWRX/PPC)\n\
 -mregnames		Allow symbolic names for registers\n\
@@ -972,7 +979,8 @@
 
       if ((op->flags & ppc_cpu) != 0
 	  && ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0
-	      || (op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == ppc_size))
+	      || (op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == ppc_size
+	      || (ppc_cpu & PPC_OPCODE_64_BRIDGE) != 0))
 	{
 	  const char *retval;
 
@@ -1026,9 +1034,9 @@
      text csects to precede the data csects.  These symbols will not
      be output.  */
   ppc_text_csects = symbol_make ("dummy\001");
-  ppc_text_csects->sy_tc.within = ppc_text_csects;
+  symbol_get_tc (ppc_text_csects)->within = ppc_text_csects;
   ppc_data_csects = symbol_make ("dummy\001");
-  ppc_data_csects->sy_tc.within = ppc_data_csects;
+  symbol_get_tc (ppc_data_csects)->within = ppc_data_csects;
 #endif
 
 #ifdef TE_PE
@@ -1056,8 +1064,7 @@
 
       if ((operand->flags & PPC_OPERAND_SIGNED) != 0)
 	{
-	  if ((operand->flags & PPC_OPERAND_SIGNOPT) != 0
-	      && ppc_size == PPC_OPCODE_32)
+	  if ((operand->flags & PPC_OPERAND_SIGNOPT) != 0)
 	    max = (1 << operand->bits) - 1;
 	  else
 	    max = (1 << (operand->bits - 1)) - 1;
@@ -1070,8 +1077,8 @@
 		 valid, but, to permit this code to assemble on a 64
 		 bit host, we sign extend the 32 bit value.  */
 	      if (val > 0
-		  && (val & 0x80000000) != 0
-		  && (val & 0xffffffff) == val)
+		  && (val & (offsetT) 0x80000000) != 0
+		  && (val & (offsetT) 0xffffffff) == val)
 		{
 		  val -= 0x80000000;
 		  val -= 0x80000000;
@@ -1305,7 +1312,7 @@
 /* Pseudo op to make file scope bss items */
 static void
 ppc_elf_lcomm(xxx)
-     int xxx;
+     int xxx ATTRIBUTE_UNUSED;
 {
   register char *name;
   register char c;
@@ -1399,8 +1406,8 @@
   if (align2)
     frag_align (align2, 0, 0);
   if (S_GET_SEGMENT (symbolP) == bss_section)
-    symbolP->sy_frag->fr_symbol = 0;
-  symbolP->sy_frag = frag_now;
+    symbol_get_frag (symbolP)->fr_symbol = 0;
+  symbol_set_frag (symbolP, frag_now);
   pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, size,
 		    (char *) 0);
   *pfrag = 0;
@@ -1777,7 +1784,8 @@
 	      if (ex.X_op == O_symbol) 
 		{		  
 		  assert (ex.X_add_symbol != NULL);
-		  if (ex.X_add_symbol->bsym->section != tocdata_section)
+		  if (symbol_get_bfdsym (ex.X_add_symbol)->section
+		      != tocdata_section)
 		    {
 		      as_bad(_("[tocv] symbol is not a toc symbol"));
 		    }
@@ -1878,8 +1886,9 @@
 		break;
 
 	      case BFD_RELOC_HI16_S:
-		ex.X_add_number = (((ex.X_add_number >> 16) & 0xffff)
-				   + ((ex.X_add_number >> 15) & 1));
+		ex.X_add_number = ((((ex.X_add_number >> 16) & 0xffff)
+				    + ((ex.X_add_number >> 15) & 1))
+				   & 0xffff);
 		break;
 	      }
 #endif
@@ -2120,29 +2129,25 @@
 }
 
 int
-ppc_section_word (ptr_str)
-     char **ptr_str;
+ppc_section_word (str, len)
+     char *str;
+     size_t len;
 {
-  if (strncmp (*ptr_str, "exclude", sizeof ("exclude")-1) == 0)
-    {
-      *ptr_str += sizeof ("exclude")-1;
-      return SHF_EXCLUDE;
-    }
+  if (len == 7 && strncmp (str, "exclude", 7) == 0)
+    return SHF_EXCLUDE;
 
-  return 0;
+  return -1;
 }
 
 int
-ppc_section_type (ptr_str)
-     char **ptr_str;
+ppc_section_type (str, len)
+     char *str;
+     size_t len;
 {
-  if (strncmp (*ptr_str, "ordered", sizeof ("ordered")-1) == 0)
-    {
-      *ptr_str += sizeof ("ordered")-1;
-      return SHT_ORDERED;
-    }
+  if (len == 7 && strncmp (str, "ordered", 7) == 0)
+    return SHT_ORDERED;
 
-  return 0;
+  return -1;
 }
 
 int
@@ -2169,7 +2174,7 @@
 
 static void
 ppc_byte (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (*input_line_pointer != '\"')
     {
@@ -2325,7 +2330,7 @@
 	}
       else
 	{
-	  lcomm_sym->sy_tc.output = 1;
+	  symbol_get_tc (lcomm_sym)->output = 1;
 	  def_sym = lcomm_sym;
 	  def_size = 0;
 	}
@@ -2333,30 +2338,30 @@
       subseg_set (bss_section, 1);
       frag_align (align, 0, 0);
   
-      def_sym->sy_frag = frag_now;
+      symbol_set_frag (def_sym, frag_now);
       pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, def_sym,
 			def_size, (char *) NULL);
       *pfrag = 0;
       S_SET_SEGMENT (def_sym, bss_section);
-      def_sym->sy_tc.align = align;
+      symbol_get_tc (def_sym)->align = align;
     }
   else if (lcomm)
     {
       /* Align the size of lcomm_sym.  */
-      lcomm_sym->sy_frag->fr_offset =
-	((lcomm_sym->sy_frag->fr_offset + (1 << align) - 1)
+      symbol_get_frag (lcomm_sym)->fr_offset =
+	((symbol_get_frag (lcomm_sym)->fr_offset + (1 << align) - 1)
 	 &~ ((1 << align) - 1));
-      if (align > lcomm_sym->sy_tc.align)
-	lcomm_sym->sy_tc.align = align;
+      if (align > symbol_get_tc (lcomm_sym)->align)
+	symbol_get_tc (lcomm_sym)->align = align;
     }
 
   if (lcomm)
     {
       /* Make sym an offset from lcomm_sym.  */
       S_SET_SEGMENT (sym, bss_section);
-      sym->sy_frag = lcomm_sym->sy_frag;
-      S_SET_VALUE (sym, lcomm_sym->sy_frag->fr_offset);
-      lcomm_sym->sy_frag->fr_offset += size;
+      symbol_set_frag (sym, symbol_get_frag (lcomm_sym));
+      S_SET_VALUE (sym, symbol_get_frag (lcomm_sym)->fr_offset);
+      symbol_get_frag (lcomm_sym)->fr_offset += size;
     }
 
   subseg_set (current_seg, current_subseg);
@@ -2388,7 +2393,7 @@
   if (S_GET_NAME (sym)[0] == '\0')
     {
       /* An unnamed csect is assumed to be [PR].  */
-      sym->sy_tc.class = XMC_PR;
+      symbol_get_tc (sym)->class = XMC_PR;
     }
 
   ppc_change_csect (sym);
@@ -2396,7 +2401,7 @@
   if (*input_line_pointer == ',')
     {
       ++input_line_pointer;
-      sym->sy_tc.align = get_absolute_expression ();
+      symbol_get_tc (sym)->align = get_absolute_expression ();
     }
 
   demand_empty_rest_of_line ();
@@ -2409,7 +2414,7 @@
      symbolS *sym;
 {
   if (S_IS_DEFINED (sym))
-    subseg_set (S_GET_SEGMENT (sym), sym->sy_tc.subseg);
+    subseg_set (S_GET_SEGMENT (sym), symbol_get_tc (sym)->subseg);
   else
     {
       symbolS **list_ptr;
@@ -2421,7 +2426,7 @@
 	 figure out whether it should go in the text section or the
 	 data section.  */
       after_toc = 0;
-      switch (sym->sy_tc.class)
+      switch (symbol_get_tc (sym)->class)
 	{
 	case XMC_PR:
 	case XMC_RO:
@@ -2432,7 +2437,7 @@
 	case XMC_TI:
 	case XMC_TB:
 	  S_SET_SEGMENT (sym, text_section);
-	  sym->sy_tc.subseg = ppc_text_subsegment;
+	  symbol_get_tc (sym)->subseg = ppc_text_subsegment;
 	  ++ppc_text_subsegment;
 	  list_ptr = &ppc_text_csects;
 	  break;
@@ -2444,10 +2449,11 @@
 	case XMC_BS:
 	case XMC_UC:
 	  if (ppc_toc_csect != NULL
-	      && ppc_toc_csect->sy_tc.subseg + 1 == ppc_data_subsegment)
+	      && (symbol_get_tc (ppc_toc_csect)->subseg + 1
+		  == ppc_data_subsegment))
 	    after_toc = 1;
 	  S_SET_SEGMENT (sym, data_section);
-	  sym->sy_tc.subseg = ppc_data_subsegment;
+	  symbol_get_tc (sym)->subseg = ppc_data_subsegment;
 	  ++ppc_data_subsegment;
 	  list_ptr = &ppc_data_csects;
 	  break;
@@ -2461,28 +2467,30 @@
       hold_chunksize = chunksize;
       chunksize = 64;
 
-      subseg_new (segment_name (S_GET_SEGMENT (sym)), sym->sy_tc.subseg);
+      subseg_new (segment_name (S_GET_SEGMENT (sym)),
+		  symbol_get_tc (sym)->subseg);
 
       chunksize = hold_chunksize;
 
       if (after_toc)
 	ppc_after_toc_frag = frag_now;
 
-      sym->sy_frag = frag_now;
+      symbol_set_frag (sym, frag_now);
       S_SET_VALUE (sym, (valueT) frag_now_fix ());
 
-      sym->sy_tc.align = 2;
-      sym->sy_tc.output = 1;
-      sym->sy_tc.within = sym;
+      symbol_get_tc (sym)->align = 2;
+      symbol_get_tc (sym)->output = 1;
+      symbol_get_tc (sym)->within = sym;
 	  
       for (list = *list_ptr;
-	   list->sy_tc.next != (symbolS *) NULL;
-	   list = list->sy_tc.next)
+	   symbol_get_tc (list)->next != (symbolS *) NULL;
+	   list = symbol_get_tc (list)->next)
 	;
-      list->sy_tc.next = sym;
+      symbol_get_tc (list)->next = sym;
 	  
       symbol_remove (sym, &symbol_rootP, &symbol_lastP);
-      symbol_append (sym, list->sy_tc.within, &symbol_rootP, &symbol_lastP);
+      symbol_append (sym, symbol_get_tc (list)->within, &symbol_rootP,
+		     &symbol_lastP);
     }
 
   ppc_current_csect = sym;
@@ -2586,7 +2594,7 @@
 
   *input_line_pointer = endc;
 
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   demand_empty_rest_of_line ();
 }
@@ -2618,7 +2626,7 @@
     }
   ++input_line_pointer;
 
-  sym->sy_tc.real_name = demand_copy_C_string (&len);
+  symbol_get_tc (sym)->real_name = demand_copy_C_string (&len);
 
   demand_empty_rest_of_line ();
 }
@@ -2652,7 +2660,7 @@
   sym = symbol_make (name);
   ppc_stab_symbol = false;
 
-  sym->sy_tc.real_name = name;
+  symbol_get_tc (sym)->real_name = name;
 
   (void) expression (&exp);
 
@@ -2666,17 +2674,17 @@
       /* Fall through.  */
     case O_constant:
       S_SET_VALUE (sym, (valueT) exp.X_add_number);
-      sym->sy_frag = &zero_address_frag;
+      symbol_set_frag (sym, &zero_address_frag);
       break;
 
     case O_symbol:
       if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section)
-	sym->sy_value = exp;
+	symbol_set_value_expression (sym, &exp);
       else
 	{
 	  S_SET_VALUE (sym,
 		       exp.X_add_number + S_GET_VALUE (exp.X_add_symbol));
-	  sym->sy_frag = exp.X_add_symbol->sy_frag;
+	  symbol_set_frag (sym, symbol_get_frag (exp.X_add_symbol));
 	}
       break;
 
@@ -2684,12 +2692,12 @@
       /* The value is some complex expression.  This will probably
          fail at some later point, but this is probably the right
          thing to do here.  */
-      sym->sy_value = exp;
+      symbol_set_value_expression (sym, &exp);
       break;
     }
 
   S_SET_SEGMENT (sym, ppc_coff_debug_section);
-  sym->bsym->flags |= BSF_DEBUGGING;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
 
   if (*input_line_pointer != ',')
     {
@@ -2709,10 +2717,10 @@
 
   S_SET_DATA_TYPE (sym, get_absolute_expression ());
 
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
-    sym->sy_tc.within = ppc_current_block;
+    symbol_get_tc (sym)->within = ppc_current_block;
 
   if (exp.X_op != O_symbol
       || ! S_IS_EXTERNAL (exp.X_add_symbol)
@@ -2722,8 +2730,8 @@
     {
       symbol_remove (sym, &symbol_rootP, &symbol_lastP);
       symbol_append (sym, exp.X_add_symbol, &symbol_rootP, &symbol_lastP);
-      if (ppc_current_csect->sy_tc.within == exp.X_add_symbol)
-	ppc_current_csect->sy_tc.within = sym;
+      if (symbol_get_tc (ppc_current_csect)->within == exp.X_add_symbol)
+	symbol_get_tc (ppc_current_csect)->within = sym;
     }
 
   demand_empty_rest_of_line ();
@@ -2778,15 +2786,19 @@
 
   if (ext_sym != lab_sym)
     {
-      ext_sym->sy_value.X_op = O_symbol;
-      ext_sym->sy_value.X_add_symbol = lab_sym;
-      ext_sym->sy_value.X_op_symbol = NULL;
-      ext_sym->sy_value.X_add_number = 0;
+      expressionS exp;
+
+      exp.X_op = O_symbol;
+      exp.X_add_symbol = lab_sym;
+      exp.X_op_symbol = NULL;
+      exp.X_add_number = 0;
+      exp.X_unsigned = 0;
+      symbol_set_value_expression (ext_sym, &exp);
     }
 
-  if (ext_sym->sy_tc.class == -1)
-    ext_sym->sy_tc.class = XMC_PR;
-  ext_sym->sy_tc.output = 1;
+  if (symbol_get_tc (ext_sym)->class == -1)
+    symbol_get_tc (ext_sym)->class = XMC_PR;
+  symbol_get_tc (ext_sym)->output = 1;
 
   if (*input_line_pointer == ',')
     {
@@ -2804,11 +2816,11 @@
 	    {
 	      /* The fifth argument is the function size.  */
 	      ++input_line_pointer;
-	      ext_sym->sy_tc.size = symbol_new ("L0\001",
-						absolute_section,
-						(valueT) 0,
-						&zero_address_frag);
-	      pseudo_set (ext_sym->sy_tc.size);
+	      symbol_get_tc (ext_sym)->size = symbol_new ("L0\001",
+							  absolute_section,
+							  (valueT) 0,
+							  &zero_address_frag);
+	      pseudo_set (symbol_get_tc (ext_sym)->size);
 	    }
 	}
     }
@@ -2832,7 +2844,7 @@
 
   sym = symbol_make (".bf");
   S_SET_SEGMENT (sym, text_section);
-  sym->sy_frag = frag_now;
+  symbol_set_frag (sym, frag_now);
   S_SET_VALUE (sym, frag_now_fix ());
   S_SET_STORAGE_CLASS (sym, C_FCN);
 
@@ -2841,7 +2853,7 @@
   S_SET_NUMBER_AUXILIARY (sym, 1);
   SA_SET_SYM_LNNO (sym, coff_line_base);
 
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   ppc_frob_label (sym);
 
@@ -2860,12 +2872,12 @@
 
   sym = symbol_make (".ef");
   S_SET_SEGMENT (sym, text_section);
-  sym->sy_frag = frag_now;
+  symbol_set_frag (sym, frag_now);
   S_SET_VALUE (sym, frag_now_fix ());
   S_SET_STORAGE_CLASS (sym, C_FCN);
   S_SET_NUMBER_AUXILIARY (sym, 1);
   SA_SET_SYM_LNNO (sym, get_absolute_expression ());
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   ppc_frob_label (sym);
 
@@ -2899,10 +2911,10 @@
      .text section.  */
   S_SET_SEGMENT (sym, text_section);
   S_SET_VALUE (sym, coff_n_line_nos);
-  sym->bsym->flags |= BSF_DEBUGGING;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
 
   S_SET_STORAGE_CLASS (sym, ei ? C_EINCL : C_BINCL);
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
   
   for (look = last_biei ? last_biei : symbol_rootP;
        (look != (symbolS *) NULL
@@ -2947,10 +2959,10 @@
   sym = symbol_make (".bs");
   S_SET_SEGMENT (sym, now_seg);
   S_SET_STORAGE_CLASS (sym, C_BSTAT);
-  sym->bsym->flags |= BSF_DEBUGGING;
-  sym->sy_tc.output = 1;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
+  symbol_get_tc (sym)->output = 1;
 
-  sym->sy_tc.within = csect;
+  symbol_get_tc (sym)->within = csect;
 
   ppc_frob_label (sym);
 
@@ -2973,8 +2985,8 @@
   sym = symbol_make (".es");
   S_SET_SEGMENT (sym, now_seg);
   S_SET_STORAGE_CLASS (sym, C_ESTAT);
-  sym->bsym->flags |= BSF_DEBUGGING;
-  sym->sy_tc.output = 1;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
+  symbol_get_tc (sym)->output = 1;
 
   ppc_frob_label (sym);
 
@@ -2994,14 +3006,14 @@
 
   sym = symbol_make (".bb");
   S_SET_SEGMENT (sym, text_section);
-  sym->sy_frag = frag_now;
+  symbol_set_frag (sym, frag_now);
   S_SET_VALUE (sym, frag_now_fix ());
   S_SET_STORAGE_CLASS (sym, C_BLOCK);
 
   S_SET_NUMBER_AUXILIARY (sym, 1);
   SA_SET_SYM_LNNO (sym, get_absolute_expression ());
 
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   SF_SET_PROCESS (sym);
 
@@ -3021,12 +3033,12 @@
 
   sym = symbol_make (".eb");
   S_SET_SEGMENT (sym, text_section);
-  sym->sy_frag = frag_now;
+  symbol_set_frag (sym, frag_now);
   S_SET_VALUE (sym, frag_now_fix ());
   S_SET_STORAGE_CLASS (sym, C_BLOCK);
   S_SET_NUMBER_AUXILIARY (sym, 1);
   SA_SET_SYM_LNNO (sym, get_absolute_expression ());
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   SF_SET_PROCESS (sym);
 
@@ -3049,10 +3061,10 @@
   name = demand_copy_C_string (&len);
   sym = symbol_make (name);
   S_SET_SEGMENT (sym, ppc_coff_debug_section);
-  sym->bsym->flags |= BSF_DEBUGGING;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
   S_SET_STORAGE_CLASS (sym, C_BCOMM);
   S_SET_VALUE (sym, 0);
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   ppc_frob_label (sym);
 
@@ -3069,10 +3081,10 @@
 
   sym = symbol_make (".ec");
   S_SET_SEGMENT (sym, ppc_coff_debug_section);
-  sym->bsym->flags |= BSF_DEBUGGING;
+  symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
   S_SET_STORAGE_CLASS (sym, C_ECOMM);
   S_SET_VALUE (sym, 0);
-  sym->sy_tc.output = 1;
+  symbol_get_tc (sym)->output = 1;
 
   ppc_frob_label (sym);
 
@@ -3086,7 +3098,7 @@
      int ignore;
 {
   if (ppc_toc_csect != (symbolS *) NULL)
-    subseg_set (data_section, ppc_toc_csect->sy_tc.subseg);
+    subseg_set (data_section, symbol_get_tc (ppc_toc_csect)->subseg);
   else
     {
       subsegT subseg;
@@ -3100,23 +3112,24 @@
       ppc_toc_frag = frag_now;
 
       sym = symbol_find_or_make ("TOC[TC0]");
-      sym->sy_frag = frag_now;
+      symbol_set_frag (sym, frag_now);
       S_SET_SEGMENT (sym, data_section);
       S_SET_VALUE (sym, (valueT) frag_now_fix ());
-      sym->sy_tc.subseg = subseg;
-      sym->sy_tc.output = 1;
-      sym->sy_tc.within = sym;
+      symbol_get_tc (sym)->subseg = subseg;
+      symbol_get_tc (sym)->output = 1;
+      symbol_get_tc (sym)->within = sym;
 
       ppc_toc_csect = sym;
 	  
       for (list = ppc_data_csects;
-	   list->sy_tc.next != (symbolS *) NULL;
-	   list = list->sy_tc.next)
+	   symbol_get_tc (list)->next != (symbolS *) NULL;
+	   list = symbol_get_tc (list)->next)
 	;
-      list->sy_tc.next = sym;
+      symbol_get_tc (list)->next = sym;
 
       symbol_remove (sym, &symbol_rootP, &symbol_lastP);
-      symbol_append (sym, list->sy_tc.within, &symbol_rootP, &symbol_lastP);
+      symbol_append (sym, symbol_get_tc (list)->within, &symbol_rootP,
+		     &symbol_lastP);
     }
 
   ppc_current_csect = ppc_toc_csect;
@@ -3179,7 +3192,7 @@
 
 static void
 ppc_tc (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
 #ifdef OBJ_XCOFF
 
@@ -3208,8 +3221,8 @@
       {
 	symbolS *label;
 
-	label = ppc_current_csect->sy_tc.within;
-	if (label->sy_tc.class != XMC_TC0)
+	label = symbol_get_tc (ppc_current_csect)->within;
+	if (symbol_get_tc (label)->class != XMC_TC0)
 	  {
 	    as_bad (_(".tc with no label"));
 	    ignore_rest_of_line ();
@@ -3217,7 +3230,7 @@
 	  }
 
 	S_SET_SEGMENT (label, S_GET_SEGMENT (sym));
-	label->sy_frag = sym->sy_frag;
+	symbol_set_frag (label, symbol_get_frag (sym));
 	S_SET_VALUE (label, S_GET_VALUE (sym));
 
 	while (! is_end_of_line[(unsigned char) *input_line_pointer])
@@ -3227,10 +3240,10 @@
       }
 
     S_SET_SEGMENT (sym, now_seg);
-    sym->sy_frag = frag_now;
+    symbol_set_frag (sym, frag_now);
     S_SET_VALUE (sym, (valueT) frag_now_fix ());
-    sym->sy_tc.class = XMC_TC;
-    sym->sy_tc.output = 1;
+    symbol_get_tc (sym)->class = XMC_TC;
+    symbol_get_tc (sym)->output = 1;
 
     ppc_frob_label (sym);
   }
@@ -3910,16 +3923,18 @@
 ppc_symbol_new_hook (sym)
      symbolS *sym;
 {
+  struct ppc_tc_sy *tc;
   const char *s;
 
-  sym->sy_tc.next = NULL;
-  sym->sy_tc.output = 0;
-  sym->sy_tc.class = -1;
-  sym->sy_tc.real_name = NULL;
-  sym->sy_tc.subseg = 0;
-  sym->sy_tc.align = 0;
-  sym->sy_tc.size = NULL;
-  sym->sy_tc.within = NULL;
+  tc = symbol_get_tc (sym);
+  tc->next = NULL;
+  tc->output = 0;
+  tc->class = -1;
+  tc->real_name = NULL;
+  tc->subseg = 0;
+  tc->align = 0;
+  tc->size = NULL;
+  tc->within = NULL;
 
   if (ppc_stab_symbol)
     return;
@@ -3937,55 +3952,55 @@
     {
     case 'B':
       if (strcmp (s, "BS]") == 0)
-	sym->sy_tc.class = XMC_BS;
+	tc->class = XMC_BS;
       break;
     case 'D':
       if (strcmp (s, "DB]") == 0)
-	sym->sy_tc.class = XMC_DB;
+	tc->class = XMC_DB;
       else if (strcmp (s, "DS]") == 0)
-	sym->sy_tc.class = XMC_DS;
+	tc->class = XMC_DS;
       break;
     case 'G':
       if (strcmp (s, "GL]") == 0)
-	sym->sy_tc.class = XMC_GL;
+	tc->class = XMC_GL;
       break;
     case 'P':
       if (strcmp (s, "PR]") == 0)
-	sym->sy_tc.class = XMC_PR;
+	tc->class = XMC_PR;
       break;
     case 'R':
       if (strcmp (s, "RO]") == 0)
-	sym->sy_tc.class = XMC_RO;
+	tc->class = XMC_RO;
       else if (strcmp (s, "RW]") == 0)
-	sym->sy_tc.class = XMC_RW;
+	tc->class = XMC_RW;
       break;
     case 'S':
       if (strcmp (s, "SV]") == 0)
-	sym->sy_tc.class = XMC_SV;
+	tc->class = XMC_SV;
       break;
     case 'T':
       if (strcmp (s, "TC]") == 0)
-	sym->sy_tc.class = XMC_TC;
+	tc->class = XMC_TC;
       else if (strcmp (s, "TI]") == 0)
-	sym->sy_tc.class = XMC_TI;
+	tc->class = XMC_TI;
       else if (strcmp (s, "TB]") == 0)
-	sym->sy_tc.class = XMC_TB;
+	tc->class = XMC_TB;
       else if (strcmp (s, "TC0]") == 0 || strcmp (s, "T0]") == 0)
-	sym->sy_tc.class = XMC_TC0;
+	tc->class = XMC_TC0;
       break;
     case 'U':
       if (strcmp (s, "UA]") == 0)
-	sym->sy_tc.class = XMC_UA;
+	tc->class = XMC_UA;
       else if (strcmp (s, "UC]") == 0)
-	sym->sy_tc.class = XMC_UC;
+	tc->class = XMC_UC;
       break;
     case 'X':
       if (strcmp (s, "XO]") == 0)
-	sym->sy_tc.class = XMC_XO;
+	tc->class = XMC_XO;
       break;
     }
 
-  if (sym->sy_tc.class == -1)
+  if (tc->class == -1)
     as_bad (_("Unrecognized symbol suffix"));
 }
 
@@ -3999,13 +4014,13 @@
 {
   if (ppc_current_csect != (symbolS *) NULL)
     {
-      if (sym->sy_tc.class == -1)
-	sym->sy_tc.class = ppc_current_csect->sy_tc.class;
+      if (symbol_get_tc (sym)->class == -1)
+	symbol_get_tc (sym)->class = symbol_get_tc (ppc_current_csect)->class;
 
       symbol_remove (sym, &symbol_rootP, &symbol_lastP);
-      symbol_append (sym, ppc_current_csect->sy_tc.within, &symbol_rootP,
-		     &symbol_lastP);
-      ppc_current_csect->sy_tc.within = sym;
+      symbol_append (sym, symbol_get_tc (ppc_current_csect)->within,
+		     &symbol_rootP, &symbol_lastP);
+      symbol_get_tc (ppc_current_csect)->within = sym;
     }
 }
 
@@ -4029,15 +4044,15 @@
 
   /* Discard symbols that should not be included in the output symbol
      table.  */
-  if (! sym->sy_used_in_reloc
-      && ((sym->bsym->flags & BSF_SECTION_SYM) != 0
+  if (! symbol_used_in_reloc_p (sym)
+      && ((symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) != 0
 	  || (! S_IS_EXTERNAL (sym)
-	      && ! sym->sy_tc.output
+	      && ! symbol_get_tc (sym)->output
 	      && S_GET_STORAGE_CLASS (sym) != C_FILE)))
     return 1;
 
-  if (sym->sy_tc.real_name != (char *) NULL)
-    S_SET_NAME (sym, sym->sy_tc.real_name);
+  if (symbol_get_tc (sym)->real_name != (char *) NULL)
+    S_SET_NAME (sym, symbol_get_tc (sym)->real_name);
   else
     {
       const char *name;
@@ -4070,10 +4085,11 @@
       if (ppc_last_function != (symbolS *) NULL)
 	as_bad (_("two .function pseudo-ops with no intervening .ef"));
       ppc_last_function = sym;
-      if (sym->sy_tc.size != (symbolS *) NULL)
+      if (symbol_get_tc (sym)->size != (symbolS *) NULL)
 	{
-	  resolve_symbol_value (sym->sy_tc.size, 1);
-	  SA_SET_SYM_FSIZE (sym, (long) S_GET_VALUE (sym->sy_tc.size));
+	  resolve_symbol_value (symbol_get_tc (sym)->size, 1);
+	  SA_SET_SYM_FSIZE (sym,
+			    (long) S_GET_VALUE (symbol_get_tc (sym)->size));
 	}
     }
   else if (S_GET_STORAGE_CLASS (sym) == C_FCN
@@ -4093,7 +4109,7 @@
     }
 
   if (! S_IS_EXTERNAL (sym)
-      && (sym->bsym->flags & BSF_SECTION_SYM) == 0
+      && (symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) == 0
       && S_GET_STORAGE_CLASS (sym) != C_FILE
       && S_GET_STORAGE_CLASS (sym) != C_FCN
       && S_GET_STORAGE_CLASS (sym) != C_BLOCK
@@ -4113,39 +4129,39 @@
       /* Create a csect aux.  */
       i = S_GET_NUMBER_AUXILIARY (sym);
       S_SET_NUMBER_AUXILIARY (sym, i + 1);
-      a = &coffsymbol (sym->bsym)->native[i + 1].u.auxent;
-      if (sym->sy_tc.class == XMC_TC0)
+      a = &coffsymbol (symbol_get_bfdsym (sym))->native[i + 1].u.auxent;
+      if (symbol_get_tc (sym)->class == XMC_TC0)
 	{
 	  /* This is the TOC table.  */
 	  know (strcmp (S_GET_NAME (sym), "TOC") == 0);
 	  a->x_csect.x_scnlen.l = 0;
 	  a->x_csect.x_smtyp = (2 << 3) | XTY_SD;
 	}
-      else if (sym->sy_tc.subseg != 0)
+      else if (symbol_get_tc (sym)->subseg != 0)
 	{
 	  /* This is a csect symbol.  x_scnlen is the size of the
 	     csect.  */
-	  if (sym->sy_tc.next == (symbolS *) NULL)
+	  if (symbol_get_tc (sym)->next == (symbolS *) NULL)
 	    a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput,
 						       S_GET_SEGMENT (sym))
 				     - S_GET_VALUE (sym));
 	  else
 	    {
-	      resolve_symbol_value (sym->sy_tc.next, 1);
-	      a->x_csect.x_scnlen.l = (S_GET_VALUE (sym->sy_tc.next)
+	      resolve_symbol_value (symbol_get_tc (sym)->next, 1);
+	      a->x_csect.x_scnlen.l = (S_GET_VALUE (symbol_get_tc (sym)->next)
 				       - S_GET_VALUE (sym));
 	    }
-	  a->x_csect.x_smtyp = (sym->sy_tc.align << 3) | XTY_SD;
+	  a->x_csect.x_smtyp = (symbol_get_tc (sym)->align << 3) | XTY_SD;
 	}
       else if (S_GET_SEGMENT (sym) == bss_section)
 	{
 	  /* This is a common symbol.  */
-	  a->x_csect.x_scnlen.l = sym->sy_frag->fr_offset;
-	  a->x_csect.x_smtyp = (sym->sy_tc.align << 3) | XTY_CM;
+	  a->x_csect.x_scnlen.l = symbol_get_frag (sym)->fr_offset;
+	  a->x_csect.x_smtyp = (symbol_get_tc (sym)->align << 3) | XTY_CM;
 	  if (S_IS_EXTERNAL (sym))
-	    sym->sy_tc.class = XMC_RW;
+	    symbol_get_tc (sym)->class = XMC_RW;
 	  else
-	    sym->sy_tc.class = XMC_BS;
+	    symbol_get_tc (sym)->class = XMC_BS;
 	}
       else if (S_GET_SEGMENT (sym) == absolute_section)
 	{
@@ -4153,8 +4169,8 @@
              ppc_adjust_symtab.  */
 	  ppc_saw_abs = true;
 	  a->x_csect.x_smtyp = XTY_LD;
-	  if (sym->sy_tc.class == -1)
-	    sym->sy_tc.class = XMC_XO;
+	  if (symbol_get_tc (sym)->class == -1)
+	    symbol_get_tc (sym)->class = XMC_XO;
 	}
       else if (! S_IS_DEFINED (sym))
 	{
@@ -4162,17 +4178,17 @@
 	  a->x_csect.x_scnlen.l = 0;
 	  a->x_csect.x_smtyp = XTY_ER;
 	}
-      else if (sym->sy_tc.class == XMC_TC)
+      else if (symbol_get_tc (sym)->class == XMC_TC)
 	{
 	  symbolS *next;
 
 	  /* This is a TOC definition.  x_scnlen is the size of the
 	     TOC entry.  */
 	  next = symbol_next (sym);
-	  while (next->sy_tc.class == XMC_TC0)
+	  while (symbol_get_tc (next)->class == XMC_TC0)
 	    next = symbol_next (next);
 	  if (next == (symbolS *) NULL
-	      || next->sy_tc.class != XMC_TC)
+	      || symbol_get_tc (next)->class != XMC_TC)
 	    {
 	      if (ppc_after_toc_frag == (fragS *) NULL)
 		a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput,
@@ -4204,7 +4220,7 @@
 	    abort ();
 
 	  /* Skip the initial dummy symbol.  */
-	  csect = csect->sy_tc.next;
+	  csect = symbol_get_tc (csect)->next;
 
 	  if (csect == (symbolS *) NULL)
 	    {
@@ -4213,31 +4229,34 @@
 	    }
 	  else
 	    {
-	      while (csect->sy_tc.next != (symbolS *) NULL)
+	      while (symbol_get_tc (csect)->next != (symbolS *) NULL)
 		{
-		  resolve_symbol_value (csect->sy_tc.next, 1);
-		  if (S_GET_VALUE (csect->sy_tc.next) > S_GET_VALUE (sym))
+		  resolve_symbol_value (symbol_get_tc (csect)->next, 1);
+		  if (S_GET_VALUE (symbol_get_tc (csect)->next)
+		      > S_GET_VALUE (sym))
 		    break;
-		  csect = csect->sy_tc.next;
+		  csect = symbol_get_tc (csect)->next;
 		}
 
-	      a->x_csect.x_scnlen.p = coffsymbol (csect->bsym)->native;
-	      coffsymbol (sym->bsym)->native[i + 1].fix_scnlen = 1;
+	      a->x_csect.x_scnlen.p =
+		coffsymbol (symbol_get_bfdsym (csect))->native;
+	      coffsymbol (symbol_get_bfdsym (sym))->native[i + 1].fix_scnlen =
+		1;
 	    }
 	  a->x_csect.x_smtyp = XTY_LD;
 	}
 	
       a->x_csect.x_parmhash = 0;
       a->x_csect.x_snhash = 0;
-      if (sym->sy_tc.class == -1)
+      if (symbol_get_tc (sym)->class == -1)
 	a->x_csect.x_smclas = XMC_PR;
       else
-	a->x_csect.x_smclas = sym->sy_tc.class;
+	a->x_csect.x_smclas = symbol_get_tc (sym)->class;
       a->x_csect.x_stab = 0;
       a->x_csect.x_snstab = 0;
 
       /* Don't let the COFF backend resort these symbols.  */
-      sym->bsym->flags |= BSF_NOT_AT_END;
+      symbol_get_bfdsym (sym)->flags |= BSF_NOT_AT_END;
     }
   else if (S_GET_STORAGE_CLASS (sym) == C_BSTAT)
     {
@@ -4245,8 +4264,10 @@
 	 csect symbol.  BFD will do that for us if we set the right
 	 flags.  */
       S_SET_VALUE (sym,
-		   (valueT) coffsymbol (sym->sy_tc.within->bsym)->native);
-      coffsymbol (sym->bsym)->native->fix_value = 1;
+		   ((valueT)
+		    coffsymbol (symbol_get_bfdsym
+				(symbol_get_tc (sym)->within))->native));
+      coffsymbol (symbol_get_bfdsym (sym))->native->fix_value = 1;
     }
   else if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
     {
@@ -4254,8 +4275,8 @@
       symbolS *csect;
 
       /* The value is the offset from the enclosing csect.  */
-      block = sym->sy_tc.within;
-      csect = block->sy_tc.within;
+      block = symbol_get_tc (sym)->within;
+      csect = symbol_get_tc (block)->within;
       resolve_symbol_value (csect, 1);
       S_SET_VALUE (sym, S_GET_VALUE (sym) - S_GET_VALUE (csect));
     }
@@ -4265,7 +4286,7 @@
       /* We want the value to be a file offset into the line numbers.
          BFD will do that for us if we set the right flags.  We have
          already set the value correctly.  */
-      coffsymbol (sym->bsym)->native->fix_line = 1;
+      coffsymbol (symbol_get_bfdsym (sym))->native->fix_line = 1;
     }
 
   return 0;
@@ -4293,11 +4314,11 @@
 
       csect = symbol_create (".abs[XO]", absolute_section,
 			     S_GET_VALUE (sym), &zero_address_frag);
-      csect->bsym->value = S_GET_VALUE (sym);
+      symbol_get_bfdsym (csect)->value = S_GET_VALUE (sym);
       S_SET_STORAGE_CLASS (csect, C_HIDEXT);
       i = S_GET_NUMBER_AUXILIARY (csect);
       S_SET_NUMBER_AUXILIARY (csect, i + 1);
-      a = &coffsymbol (csect->bsym)->native[i + 1].u.auxent;
+      a = &coffsymbol (symbol_get_bfdsym (csect))->native[i + 1].u.auxent;
       a->x_csect.x_scnlen.l = 0;
       a->x_csect.x_smtyp = XTY_SD;
       a->x_csect.x_parmhash = 0;
@@ -4309,9 +4330,9 @@
       symbol_insert (csect, sym, &symbol_rootP, &symbol_lastP);
 
       i = S_GET_NUMBER_AUXILIARY (sym);
-      a = &coffsymbol (sym->bsym)->native[i].u.auxent;
-      a->x_csect.x_scnlen.p = coffsymbol (csect->bsym)->native;
-      coffsymbol (sym->bsym)->native[i].fix_scnlen = 1;
+      a = &coffsymbol (symbol_get_bfdsym (sym))->native[i].u.auxent;
+      a->x_csect.x_scnlen.p = coffsymbol (symbol_get_bfdsym (csect))->native;
+      coffsymbol (symbol_get_bfdsym (sym))->native[i].fix_scnlen = 1;
     }
 
   ppc_saw_abs = false;
@@ -4420,8 +4441,8 @@
 
 int
 md_estimate_size_before_relax (fragp, seg)
-     fragS *fragp;
-     asection *seg;
+     fragS *fragp ATTRIBUTE_UNUSED;
+     asection *seg ATTRIBUTE_UNUSED;
 {
   abort ();
   return 0;
@@ -4431,9 +4452,9 @@
 
 void
 md_convert_frag (abfd, sec, fragp)
-     bfd *abfd;
-     asection *sec;
-     fragS *fragp;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     fragS *fragp ATTRIBUTE_UNUSED;
 {
   abort ();
 }
@@ -4443,7 +4464,7 @@
 /*ARGSUSED*/
 symbolS *
 md_undefined_symbol (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -4456,7 +4477,7 @@
 long
 md_pcrel_from_section (fixp, sec)
      fixS *fixp;
-     segT sec;
+     segT sec ATTRIBUTE_UNUSED;
 {
   return fixp->fx_frag->fr_address + fixp->fx_where;
 }
@@ -4490,9 +4511,9 @@
 	   sy != (symbolS *) NULL;
 	   sy = symbol_next (sy))
 	{
-	  if (sy->sy_tc.class == XMC_TC0)
+	  if (symbol_get_tc (sy)->class == XMC_TC0)
 	    continue;
-	  if (sy->sy_tc.class != XMC_TC)
+	  if (symbol_get_tc (sy)->class != XMC_TC)
 	    break;
 	  resolve_symbol_value (sy, 1);
 	  if (val == S_GET_VALUE (sy))
@@ -4509,9 +4530,9 @@
 
   /* Possibly adjust the reloc to be against the csect.  */
   if (fix->fx_addsy != (symbolS *) NULL
-      && fix->fx_addsy->sy_tc.subseg == 0
-      && fix->fx_addsy->sy_tc.class != XMC_TC0
-      && fix->fx_addsy->sy_tc.class != XMC_TC
+      && symbol_get_tc (fix->fx_addsy)->subseg == 0
+      && symbol_get_tc (fix->fx_addsy)->class != XMC_TC0
+      && symbol_get_tc (fix->fx_addsy)->class != XMC_TC
       && S_GET_SEGMENT (fix->fx_addsy) != bss_section
       /* Don't adjust if this is a reloc in the toc section.  */
       && (S_GET_SEGMENT (fix->fx_addsy) != data_section
@@ -4530,29 +4551,28 @@
 	abort ();
 
       /* Skip the initial dummy symbol.  */
-      csect = csect->sy_tc.next;
+      csect = symbol_get_tc (csect)->next;
 
       if (csect != (symbolS *) NULL)
 	{
-	  while (csect->sy_tc.next != (symbolS *) NULL
-		 && (csect->sy_tc.next->sy_frag->fr_address
-		     <= fix->fx_addsy->sy_frag->fr_address))
+	  while (symbol_get_tc (csect)->next != (symbolS *) NULL
+		 && (symbol_get_frag (symbol_get_tc (csect)->next)->fr_address
+		     <= val))
 	    {
 	      /* If the csect address equals the symbol value, then we
                  have to look through the full symbol table to see
                  whether this is the csect we want.  Note that we will
                  only get here if the csect has zero length.  */
-	      if ((csect->sy_frag->fr_address
-		   == fix->fx_addsy->sy_frag->fr_address)
+	      if ((symbol_get_frag (csect)->fr_address == val)
 		  && S_GET_VALUE (csect) == S_GET_VALUE (fix->fx_addsy))
 		{
 		  symbolS *scan;
 
-		  for (scan = csect->sy_next;
+		  for (scan = symbol_next (csect);
 		       scan != NULL;
-		       scan = scan->sy_next)
+		       scan = symbol_next (scan))
 		    {
-		      if (scan->sy_tc.subseg != 0)
+		      if (symbol_get_tc (scan)->subseg != 0)
 			break;
 		      if (scan == fix->fx_addsy)
 			break;
@@ -4564,11 +4584,11 @@
 		    break;
 		}
 
-	      csect = csect->sy_tc.next;
+	      csect = symbol_get_tc (csect)->next;
 	    }
 
 	  fix->fx_offset += (S_GET_VALUE (fix->fx_addsy)
-			     - csect->sy_frag->fr_address);
+			     - symbol_get_frag (csect)->fr_address);
 	  fix->fx_addsy = csect;
 	}
     }
@@ -4579,10 +4599,11 @@
       && S_GET_SEGMENT (fix->fx_addsy) == bss_section
       && ! S_IS_EXTERNAL (fix->fx_addsy))
     {
-      resolve_symbol_value (fix->fx_addsy->sy_frag->fr_symbol, 1);
-      fix->fx_offset += (S_GET_VALUE (fix->fx_addsy)
-			 - S_GET_VALUE (fix->fx_addsy->sy_frag->fr_symbol));
-      fix->fx_addsy = fix->fx_addsy->sy_frag->fr_symbol;
+      resolve_symbol_value (symbol_get_frag (fix->fx_addsy)->fr_symbol, 1);
+      fix->fx_offset +=
+	(S_GET_VALUE (fix->fx_addsy)
+	 - S_GET_VALUE (symbol_get_frag (fix->fx_addsy)->fr_symbol));
+      fix->fx_addsy = symbol_get_frag (fix->fx_addsy)->fr_symbol;
     }
 
   return 0;
@@ -4602,10 +4623,11 @@
      we need to force the relocation.  */
   if (fix->fx_pcrel
       && fix->fx_addsy != NULL
-      && fix->fx_addsy->sy_tc.subseg != 0
-      && (fix->fx_addsy->sy_frag->fr_address > fix->fx_frag->fr_address
-	  || (fix->fx_addsy->sy_tc.next != NULL
-	      && (fix->fx_addsy->sy_tc.next->sy_frag->fr_address
+      && symbol_get_tc (fix->fx_addsy)->subseg != 0
+      && ((symbol_get_frag (fix->fx_addsy)->fr_address
+	   > fix->fx_frag->fr_address)
+	  || (symbol_get_tc (fix->fx_addsy)->next != NULL
+	      && (symbol_get_frag (symbol_get_tc (fix->fx_addsy)->next)->fr_address
 		  <= fix->fx_frag->fr_address))))
     return 1;
 
@@ -4621,7 +4643,7 @@
      symbolS *sym;
 {
 #ifdef OBJ_XCOFF
-  return sym->sy_tc.class == XMC_TC;
+  return symbol_get_tc (sym)->class == XMC_TC;
 #else
   return strcmp (segment_name (S_GET_SEGMENT (sym)), ".got") == 0;
 #endif
@@ -4650,7 +4672,7 @@
     {
       /* `*valuep' may contain the value of the symbol on which the reloc
 	 will be based; we have to remove it.  */
-      if (fixp->fx_addsy->sy_used_in_reloc
+      if (symbol_used_in_reloc_p (fixp->fx_addsy)
 	  && S_GET_SEGMENT (fixp->fx_addsy) != absolute_section
 	  && S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
 	  && ! bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy)))
@@ -4725,9 +4747,9 @@
 	  && operand->shift == 0
 	  && operand->insert == NULL
 	  && fixp->fx_addsy != NULL
-	  && fixp->fx_addsy->sy_tc.subseg != 0
-	  && fixp->fx_addsy->sy_tc.class != XMC_TC
-	  && fixp->fx_addsy->sy_tc.class != XMC_TC0
+	  && symbol_get_tc (fixp->fx_addsy)->subseg != 0
+	  && symbol_get_tc (fixp->fx_addsy)->class != XMC_TC
+	  && symbol_get_tc (fixp->fx_addsy)->class != XMC_TC0
 	  && S_GET_SEGMENT (fixp->fx_addsy) != bss_section)
 	{
 	  value = fixp->fx_offset;
@@ -4881,7 +4903,7 @@
 	  if (fixp->fx_pcrel)
 	    abort ();
 	  md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
-			      value + 0x8000 >> 16, 2);
+			      (value + 0x8000) >> 16, 2);
 	  break;
 
 	  /* Because SDA21 modifies the register field, the size is set to 4
@@ -4981,14 +5003,15 @@
 
 arelent *
 tc_gen_reloc (seg, fixp)
-     asection *seg;
+     asection *seg ATTRIBUTE_UNUSED;
      fixS *fixp;
 {
   arelent *reloc;
 
   reloc = (arelent *) xmalloc (sizeof (arelent));
 
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index 0871d13..783a215 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -1,5 +1,6 @@
 /* tc-ppc.h -- Header file for tc-ppc.c.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
@@ -121,7 +122,7 @@
 struct ppc_tc_sy
 {
   /* We keep a few linked lists of symbols.  */
-  struct symbol *next;
+  symbolS *next;
   /* Non-zero if the symbol should be output.  The RS/6000 assembler
      only outputs symbols that are external or are mentioned in a
      .globl or .lglobl statement.  */
@@ -137,11 +138,11 @@
   int align;
   /* For a function symbol, a symbol whose value is the size.  The
      field is NULL if there is no size.  */
-  struct symbol *size;
+  symbolS *size;
   /* For a csect symbol, the last symbol which has been defined in
      this csect, or NULL if none have been defined so far.  For a .bs
      symbol, the referenced csect symbol.  */
-  struct symbol *within;
+  symbolS *within;
 };
 
 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
@@ -158,11 +159,11 @@
 
 /* Get the symbol class from the name.  */
 #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
-extern void ppc_symbol_new_hook PARAMS ((struct symbol *));
+extern void ppc_symbol_new_hook PARAMS ((symbolS *));
 
 /* Set the symbol class of a label based on the csect.  */
 #define tc_frob_label(sym) ppc_frob_label (sym)
-extern void ppc_frob_label PARAMS ((struct symbol *));
+extern void ppc_frob_label PARAMS ((symbolS *));
 
 /* TOC relocs requires special handling.  */
 #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
@@ -178,7 +179,7 @@
 
 /* Finish up the symbol.  */
 #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
-extern int ppc_frob_symbol PARAMS ((struct symbol *));
+extern int ppc_frob_symbol PARAMS ((symbolS *));
 
 /* Finish up the entire symtab.  */
 #define tc_adjust_symtab() ppc_adjust_symtab ()
@@ -187,6 +188,19 @@
 /* Niclas Andersson <nican@ida.liu.se> says this is needed.  */
 #define SUB_SEGMENT_ALIGN(SEG) 2
 
+/* We also need to copy, in particular, the class of the symbol,
+   over what obj-coff would otherwise have copied.  */
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src)			\
+do {								\
+  if (SF_GET_GET_SEGMENT (dest))				\
+    S_SET_SEGMENT (dest, S_GET_SEGMENT (src));			\
+  symbol_get_tc (dest)->size = symbol_get_tc (src)->size;	\
+  symbol_get_tc (dest)->align = symbol_get_tc (src)->align;	\
+  symbol_get_tc (dest)->class = symbol_get_tc (src)->class;	\
+  symbol_get_tc (dest)->within = symbol_get_tc (src)->within;	\
+} while (0)
+
+
 #endif /* OBJ_XCOFF */
 
 #ifdef OBJ_ELF
@@ -203,18 +217,18 @@
 
 #define TC_FORCE_RELOCATION_SECTION(FIXP,SEC)				\
 (TC_FORCE_RELOCATION (FIXP)						\
- || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy && (FIXP)->fx_addsy->bsym	\
-     && (FIXP)->fx_addsy->bsym->section != SEC))
+ || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy				\
+     && S_GET_SEGMENT ((FIXP)->fx_addsy) != SEC))
 
 /* Support for SHF_EXCLUDE and SHT_ORDERED */
 extern int ppc_section_letter PARAMS ((int, char **));
-extern int ppc_section_type PARAMS ((char **));
-extern int ppc_section_word PARAMS ((char **));
+extern int ppc_section_type PARAMS ((char *, size_t));
+extern int ppc_section_word PARAMS ((char *, size_t));
 extern int ppc_section_flags PARAMS ((int, int, int));
 
 #define md_elf_section_letter(LETTER, PTR_MSG)	ppc_section_letter (LETTER, PTR_MSG)
-#define md_elf_section_type(PTR_STR)		ppc_section_type (PTR_STR)
-#define md_elf_section_word(PTR_STR)		ppc_section_word (PTR_STR)
+#define md_elf_section_type(STR, LEN)		ppc_section_type (STR, LEN)
+#define md_elf_section_word(STR, LEN)		ppc_section_word (STR, LEN)
 #define md_elf_section_flags(FLAGS, ATTR, TYPE)	ppc_section_flags (FLAGS, ATTR, TYPE)
 
 /* Add extra PPC sections -- Note, for now, make .sbss2 and .PPC.EMB.sbss0 a
@@ -247,8 +261,7 @@
        || ((FIX)->fx_subsy != NULL					\
 	   && (S_GET_SEGMENT ((FIX)->fx_subsy)				\
 	       == S_GET_SEGMENT ((FIX)->fx_addsy)))			\
-       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL		\
-       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
+       || S_IS_LOCAL ((FIX)->fx_addsy)))
 
 /* We must never ever try to resolve references to externally visible
    symbols in the assembler, because the .o file might go into a shared
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 6d8ca81..4003f5b 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -1,5 +1,5 @@
 /* tc-sh.c -- Assemble code for the Hitachi Super-H
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -30,6 +30,11 @@
 #define DEFINE_TABLE
 #include "opcodes/sh-opc.h"
 #include <ctype.h>
+
+#ifdef OBJ_ELF
+#include "elf/sh.h"
+#endif
+
 const char comment_chars[] = "!";
 const char line_separator_chars[] = ";";
 const char line_comment_chars[] = "!#";
@@ -39,16 +44,11 @@
 static void sh_count_relocs PARAMS ((bfd *, segT, PTR));
 static void sh_frob_section PARAMS ((bfd *, segT, PTR));
 
-/* This table describes all the machine specific pseudo-ops the assembler
-   has to support.  The fields are:
-   pseudo-op name without dot
-   function to call to execute this pseudo-op
-   Integer arg to pass to the function
- */
-
 void cons ();
 void s_align_bytes ();
 static void s_uacons PARAMS ((int));
+static sh_opcode_info *find_cooked_opcode PARAMS ((char **));
+static void assemble_ppi PARAMS ((char *, sh_opcode_info *));
 
 int shl = 0;
 
@@ -60,6 +60,13 @@
   target_big_endian = 0;
 }
 
+/* This table describes all the machine specific pseudo-ops the assembler
+   has to support.  The fields are:
+   pseudo-op name without dot
+   function to call to execute this pseudo-op
+   Integer arg to pass to the function
+ */
+
 const pseudo_typeS md_pseudo_table[] =
 {
   {"int", cons, 4},
@@ -84,6 +91,14 @@
 
 int sh_small;
 
+/* Whether -dsp was seen.  */
+
+static int sh_dsp;
+
+/* The bit mask of architectures that could
+   accomodate the insns seen so far.  */
+static int valid_arch;
+
 const char EXP_CHARS[] = "eE";
 
 /* Chars that mean this number is a floating point constant */
@@ -189,9 +204,18 @@
 {
   sh_opcode_info *opcode;
   char *prev_name = "";
+  int target_arch;
 
+#ifdef TE_PE
+  /* The WinCE OS only supports little endian executables.  */
+  target_big_endian = 0;
+#else
   if (! shl)
     target_big_endian = 1;
+#endif
+
+  target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up);
+  valid_arch = target_arch;
 
   opcode_hash_control = hash_new ();
 
@@ -200,6 +224,8 @@
     {
       if (strcmp (prev_name, opcode->name))
 	{
+	  if (! (opcode->arch & target_arch))
+	    continue;
 	  prev_name = opcode->name;
 	  hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
 	}
@@ -214,6 +240,8 @@
 
 static int reg_m;
 static int reg_n;
+static int reg_x, reg_y;
+static int reg_efg;
 static int reg_b;
 
 static expressionS immediate;	/* absolute expression */
@@ -226,6 +254,8 @@
 
 sh_operand_info;
 
+#define IDENT_CHAR(c) (isalnum (c) || (c) == '_')
+
 /* try and parse a reg name, returns number of chars consumed */
 static int
 parse_reg (src, mode, reg)
@@ -233,27 +263,16 @@
      int *mode;
      int *reg;
 {
-  /* We use !isalnum for the next character after the register name, to
+  /* We use ! IDENT_CHAR for the next character after the register name, to
      make sure that we won't accidentally recognize a symbol name such as
-     'sram' as being a reference to the register 'sr'.  */
-
-  if (src[0] == 'r')
-    {
-      if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0
-	  && ! isalnum ((unsigned char) src[7]))
-	{
-	  *mode = A_REG_B;
-	  *reg  = (src[1] - '0');
-	  return 7;
-	}
-    }
+     'sram' or sr_ram as being a reference to the register 'sr'.  */
 
   if (src[0] == 'r')
     {
       if (src[1] == '1')
 	{
 	  if (src[2] >= '0' && src[2] <= '5'
-	      && ! isalnum ((unsigned char) src[3]))
+	      && ! IDENT_CHAR ((unsigned char) src[3]))
 	    {
 	      *mode = A_REG_N;
 	      *reg = 10 + src[2] - '0';
@@ -261,81 +280,210 @@
 	    }
 	}
       if (src[1] >= '0' && src[1] <= '9'
-	  && ! isalnum ((unsigned char) src[2]))
+	  && ! IDENT_CHAR ((unsigned char) src[2]))
 	{
 	  *mode = A_REG_N;
 	  *reg = (src[1] - '0');
 	  return 2;
 	}
+      if (src[1] >= '0' && src[1] <= '7' && strncmp (&src[2], "_bank", 5) == 0
+	  && ! IDENT_CHAR ((unsigned char) src[7]))
+	{
+	  *mode = A_REG_B;
+	  *reg  = (src[1] - '0');
+	  return 7;
+	}
+
+      if (src[1] == 'e' && ! IDENT_CHAR ((unsigned char) src[2]))
+	{
+	  *mode = A_RE;
+	  return 2;
+	}
+      if (src[1] == 's' && ! IDENT_CHAR ((unsigned char) src[2]))
+	{
+	  *mode = A_RS;
+	  return 2;
+	}
+    }
+
+  if (src[0] == 'a')
+    {
+      if (src[1] == '0')
+	{
+	  if (! IDENT_CHAR ((unsigned char) src[2]))
+	    {
+	      *mode = DSP_REG_N;
+	      *reg = A_A0_NUM;
+	      return 2;
+	    }
+	  if (src[2] == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+	    {
+	      *mode = DSP_REG_N;
+	      *reg = A_A0G_NUM;
+	      return 3;
+	    }
+	}
+      if (src[1] == '1')
+	{
+	  if (! IDENT_CHAR ((unsigned char) src[2]))
+	    {
+	      *mode = DSP_REG_N;
+	      *reg = A_A1_NUM;
+	      return 2;
+	    }
+	  if (src[2] == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+	    {
+	      *mode = DSP_REG_N;
+	      *reg = A_A1G_NUM;
+	      return 3;
+	    }
+	}
+
+      if (src[1] == 'x' && src[2] >= '0' && src[2] <= '1'
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
+	{
+	  *mode = A_REG_N;
+	  *reg = 4 + (src[1] - '0');
+	  return 3;
+	}
+      if (src[1] == 'y' && src[2] >= '0' && src[2] <= '1'
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
+	{
+	  *mode = A_REG_N;
+	  *reg = 6 + (src[1] - '0');
+	  return 3;
+	}
+      if (src[1] == 's' && src[2] >= '0' && src[2] <= '3'
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
+	{
+	  int n = src[1] - '0';
+
+	  *mode = A_REG_N;
+	  *reg = n | ((~n & 2) << 1);
+	  return 3;
+	}
+    }
+
+  if (src[0] == 'i' && src[1] && ! IDENT_CHAR ((unsigned char) src[3]))
+    {
+      if (src[1] == 's')
+	{
+	  *mode = A_REG_N;
+	  *reg = 8;
+	  return 2;
+	}
+      if (src[1] == 'x')
+	{
+	  *mode = A_REG_N;
+	  *reg = 8;
+	  return 2;
+	}
+      if (src[1] == 'y')
+	{
+	  *mode = A_REG_N;
+	  *reg = 9;
+	  return 2;
+	}
+    }
+
+  if (src[0] == 'x' && src[1] >= '0' && src[1] <= '1'
+      && ! IDENT_CHAR ((unsigned char) src[2]))
+    {
+      *mode = DSP_REG_N;
+      *reg = A_X0_NUM + src[1] - '0';
+      return 2;
+    }
+
+  if (src[0] == 'y' && src[1] >= '0' && src[1] <= '1'
+      && ! IDENT_CHAR ((unsigned char) src[2]))
+    {
+      *mode = DSP_REG_N;
+      *reg = A_Y0_NUM + src[1] - '0';
+      return 2;
+    }
+
+  if (src[0] == 'm' && src[1] >= '0' && src[1] <= '1'
+      && ! IDENT_CHAR ((unsigned char) src[2]))
+    {
+      *mode = DSP_REG_N;
+      *reg = src[1] == '0' ? A_M0_NUM : A_M1_NUM;
+      return 2;
     }
 
   if (src[0] == 's'
       && src[1] == 's'
-      && src[2] == 'r' && ! isalnum ((unsigned char) src[3]))
+      && src[2] == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_SSR;
       return 3;
     }
 
   if (src[0] == 's' && src[1] == 'p' && src[2] == 'c'
-      && ! isalnum ((unsigned char) src[3]))
+      && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_SPC;
       return 3;
     }
 
   if (src[0] == 's' && src[1] == 'g' && src[2] == 'r'
-      && ! isalnum ((unsigned char) src[3]))
+      && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_SGR;
       return 3;
     }
 
+  if (src[0] == 'd' && src[1] == 's' && src[2] == 'r'
+      && ! IDENT_CHAR ((unsigned char) src[3]))
+    {
+      *mode = A_DSR;
+      return 3;
+    }
+
   if (src[0] == 'd' && src[1] == 'b' && src[2] == 'r'
-      && ! isalnum ((unsigned char) src[3]))
+      && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_DBR;
       return 3;
     }
 
-  if (src[0] == 's' && src[1] == 'r' && ! isalnum ((unsigned char) src[2]))
+  if (src[0] == 's' && src[1] == 'r' && ! IDENT_CHAR ((unsigned char) src[2]))
     {
       *mode = A_SR;
       return 2;
     }
 
-  if (src[0] == 's' && src[1] == 'p' && ! isalnum ((unsigned char) src[2]))
+  if (src[0] == 's' && src[1] == 'p' && ! IDENT_CHAR ((unsigned char) src[2]))
     {
       *mode = A_REG_N;
       *reg = 15;
       return 2;
     }
 
-  if (src[0] == 'p' && src[1] == 'r' && ! isalnum ((unsigned char) src[2]))
+  if (src[0] == 'p' && src[1] == 'r' && ! IDENT_CHAR ((unsigned char) src[2]))
     {
       *mode = A_PR;
       return 2;
     }
-  if (src[0] == 'p' && src[1] == 'c' && ! isalnum ((unsigned char) src[2]))
+  if (src[0] == 'p' && src[1] == 'c' && ! IDENT_CHAR ((unsigned char) src[2]))
     {
       *mode = A_DISP_PC;
       return 2;
     }
   if (src[0] == 'g' && src[1] == 'b' && src[2] == 'r'
-      && ! isalnum ((unsigned char) src[3]))
+      && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_GBR;
       return 3;
     }
   if (src[0] == 'v' && src[1] == 'b' && src[2] == 'r'
-      && ! isalnum ((unsigned char) src[3]))
+      && ! IDENT_CHAR ((unsigned char) src[3]))
     {
       *mode = A_VBR;
       return 3;
     }
 
   if (src[0] == 'm' && src[1] == 'a' && src[2] == 'c'
-      && ! isalnum ((unsigned char) src[4]))
+      && ! IDENT_CHAR ((unsigned char) src[4]))
     {
       if (src[3] == 'l')
 	{
@@ -348,12 +496,18 @@
 	  return 4;
 	}
     }
+  if (src[0] == 'm' && src[1] == 'o' && src[2] == 'd'
+      && ! IDENT_CHAR ((unsigned char) src[4]))
+    {
+      *mode = A_MOD;
+      return 3;
+    }
   if (src[0] == 'f' && src[1] == 'r')
     {
       if (src[2] == '1')
 	{
 	  if (src[3] >= '0' && src[3] <= '5'
-	      && ! isalnum ((unsigned char) src[4]))
+	      && ! IDENT_CHAR ((unsigned char) src[4]))
 	    {
 	      *mode = F_REG_N;
 	      *reg = 10 + src[3] - '0';
@@ -361,7 +515,7 @@
 	    }
 	}
       if (src[2] >= '0' && src[2] <= '9'
-	  && ! isalnum ((unsigned char) src[3]))
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
 	{
 	  *mode = F_REG_N;
 	  *reg = (src[2] - '0');
@@ -373,7 +527,7 @@
       if (src[2] == '1')
 	{
 	  if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1)
-	      && ! isalnum ((unsigned char) src[4]))
+	      && ! IDENT_CHAR ((unsigned char) src[4]))
 	    {
 	      *mode = D_REG_N;
 	      *reg = 10 + src[3] - '0';
@@ -381,7 +535,7 @@
 	    }
 	}
       if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1)
-	  && ! isalnum ((unsigned char) src[3]))
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
 	{
 	  *mode = D_REG_N;
 	  *reg = (src[2] - '0');
@@ -393,7 +547,7 @@
       if (src[2] == '1')
 	{
 	  if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1)
-	      && ! isalnum ((unsigned char) src[4]))
+	      && ! IDENT_CHAR ((unsigned char) src[4]))
 	    {
 	      *mode = X_REG_N;
 	      *reg = 11 + src[3] - '0';
@@ -401,7 +555,7 @@
 	    }
 	}
       if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1)
-	  && ! isalnum ((unsigned char) src[3]))
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
 	{
 	  *mode = X_REG_N;
 	  *reg = (src[2] - '0') + 1;
@@ -410,14 +564,14 @@
     }
   if (src[0] == 'f' && src[1] == 'v')
     {
-      if (src[2] == '1'&& src[3] == '2' && ! isalnum ((unsigned char) src[4]))
+      if (src[2] == '1'&& src[3] == '2' && ! IDENT_CHAR ((unsigned char) src[4]))
 	{
 	  *mode = V_REG_N;
 	  *reg = 12;
 	  return 4;
 	}
       if ((src[2] == '0' || src[2] == '4' || src[2] == '8')
-	  && ! isalnum ((unsigned char) src[3]))
+	  && ! IDENT_CHAR ((unsigned char) src[3]))
 	{
 	  *mode = V_REG_N;
 	  *reg = (src[2] - '0');
@@ -425,21 +579,21 @@
 	}
     }
   if (src[0] == 'f' && src[1] == 'p' && src[2] == 'u' && src[3] == 'l'
-      && ! isalnum ((unsigned char) src[4]))
+      && ! IDENT_CHAR ((unsigned char) src[4]))
     {
       *mode = FPUL_N;
       return 4;
     }
 
   if (src[0] == 'f' && src[1] == 'p' && src[2] == 's' && src[3] == 'c'
-      && src[4] == 'r' && ! isalnum ((unsigned char) src[5]))
+      && src[4] == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
     {
       *mode = FPSCR_N;
       return 5;
     }
 
   if (src[0] == 'x' && src[1] == 'm' && src[2] == 't' && src[3] == 'r'
-      && src[4] == 'x' && ! isalnum ((unsigned char) src[5]))
+      && src[4] == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
     {
       *mode = XMTRX_M4;
       return 5;
@@ -605,8 +759,21 @@
 	}
       if (src[0] == '+')
 	{
-	  op->type = A_INC_N;
 	  src++;
+	  if ((src[0] == 'r' && src[1] == '8')
+	      || (src[0] == 'i' && (src[1] == 'x' || src[1] == 's')))
+	    {
+	      src += 2;
+	      op->type = A_PMOD_N;
+	    }
+	  if ((src[0] == 'r' && src[1] == '9')
+	      || (src[0] == 'i' && src[1] == 'y'))
+	    {
+	      src += 2;
+	      op->type = A_PMODY_N;
+	    }
+	  else
+	    op->type = A_INC_N;
 	}
       else
 	{
@@ -665,7 +832,11 @@
   char *ptr = args;
   if (info->arg[0])
     {
-      ptr++;
+      /* The pre-processor will eliminate whitespace in front of '@'
+	 after the first argument; we may be called multiple times
+	 from assemble_ppi, so don't insist on finding whitespace here.  */
+      if (*ptr == ' ')
+	ptr++;
 
       get_operand (&ptr, operand + 0);
       if (info->arg[1])
@@ -774,16 +945,14 @@
 	    case V_REG_N:
 	    case FPUL_N:
 	    case FPSCR_N:
+	    case A_PMOD_N:
+	    case A_PMODY_N:
+	    case DSP_REG_N:
 	      /* Opcode needs rn */
 	      if (user->type != arg)
 		goto fail;
 	      reg_n = user->reg;
 	      break;
-	    case FD_REG_N:
-	      if (user->type != F_REG_N && user->type != D_REG_N)
-		goto fail;
-	      reg_n = user->reg;
-	      break;
 	    case DX_REG_N:
 	      if (user->type != D_REG_N && user->type != X_REG_N)
 		goto fail;
@@ -792,6 +961,10 @@
 	    case A_GBR:
 	    case A_SR:
 	    case A_VBR:
+	    case A_DSR:
+	    case A_MOD:
+	    case A_RE:
+	    case A_RS:
 	    case A_SSR:
 	    case A_SPC:
 	    case A_SGR:
@@ -812,12 +985,144 @@
 	    case A_IND_M:
 	    case A_IND_R0_REG_M:
 	    case A_DISP_REG_M:
+	    case DSP_REG_M:
 	      /* Opcode needs rn */
 	      if (user->type != arg - A_REG_M + A_REG_N)
 		goto fail;
 	      reg_m = user->reg;
 	      break;
 
+	    case DSP_REG_X:
+	      if (user->type != DSP_REG_N)
+		goto fail;
+	      switch (user->reg)
+		{
+		case A_X0_NUM:
+		  reg_x = 0;
+		  break;
+		case A_X1_NUM:
+		  reg_x = 1;
+		  break;
+		case A_A0_NUM:
+		  reg_x = 2;
+		  break;
+		case A_A1_NUM:
+		  reg_x = 3;
+		  break;
+		default:
+		  goto fail;
+		}
+	      break;
+
+	    case DSP_REG_Y:
+	      if (user->type != DSP_REG_N)
+		goto fail;
+	      switch (user->reg)
+		{
+		case A_Y0_NUM:
+		  reg_y = 0;
+		  break;
+		case A_Y1_NUM:
+		  reg_y = 1;
+		  break;
+		case A_M0_NUM:
+		  reg_y = 2;
+		  break;
+		case A_M1_NUM:
+		  reg_y = 3;
+		  break;
+		default:
+		  goto fail;
+		}
+	      break;
+
+	    case DSP_REG_E:
+	      if (user->type != DSP_REG_N)
+		goto fail;
+	      switch (user->reg)
+		{
+		case A_X0_NUM:
+		  reg_efg = 0 << 10;
+		  break;
+		case A_X1_NUM:
+		  reg_efg = 1 << 10;
+		  break;
+		case A_Y0_NUM:
+		  reg_efg = 2 << 10;
+		  break;
+		case A_A1_NUM:
+		  reg_efg = 3 << 10;
+		  break;
+		default:
+		  goto fail;
+		}
+	      break;
+
+	    case DSP_REG_F:
+	      if (user->type != DSP_REG_N)
+		goto fail;
+	      switch (user->reg)
+		{
+		case A_Y0_NUM:
+		  reg_efg |= 0 << 8;
+		  break;
+		case A_Y1_NUM:
+		  reg_efg |= 1 << 8;
+		  break;
+		case A_X0_NUM:
+		  reg_efg |= 2 << 8;
+		  break;
+		case A_A1_NUM:
+		  reg_efg |= 3 << 8;
+		  break;
+		default:
+		  goto fail;
+		}
+	      break;
+
+	    case DSP_REG_G:
+	      if (user->type != DSP_REG_N)
+		goto fail;
+	      switch (user->reg)
+		{
+		case A_M0_NUM:
+		  reg_efg |= 0 << 2;
+		  break;
+		case A_M1_NUM:
+		  reg_efg |= 1 << 2;
+		  break;
+		case A_A0_NUM:
+		  reg_efg |= 2 << 2;
+		  break;
+		case A_A1_NUM:
+		  reg_efg |= 3 << 2;
+		  break;
+		default:
+		  goto fail;
+		}
+	      break;
+
+	    case A_A0:
+	      if (user->type != DSP_REG_N || user->reg != A_A0_NUM)
+		goto fail;
+	      break;
+	    case A_X0:
+	      if (user->type != DSP_REG_N || user->reg != A_X0_NUM)
+		goto fail;
+	      break;
+	    case A_X1:
+	      if (user->type != DSP_REG_N || user->reg != A_X1_NUM)
+		goto fail;
+	      break;
+	    case A_Y0:
+	      if (user->type != DSP_REG_N || user->reg != A_Y0_NUM)
+		goto fail;
+	      break;
+	    case A_Y1:
+	      if (user->type != DSP_REG_N || user->reg != A_Y1_NUM)
+		goto fail;
+	      break;
+
 	    case F_REG_M:
 	    case D_REG_M:
 	    case X_REG_M:
@@ -845,6 +1150,9 @@
 	      goto fail;
 	    }
 	}
+      if ( !(valid_arch & this_try->arch))
+	goto fail;
+      valid_arch &= this_try->arch;
       return this_try;
     fail:;
     }
@@ -949,6 +1257,11 @@
 	    case REG_M:
 	      nbuf[index] = reg_m;
 	      break;
+	    case SDT_REG_N:
+	      if (reg_n < 2 || reg_n > 5)
+		as_bad (_("Invalid register: 'r%d'"), reg_n);
+	      nbuf[index] = (reg_n & 3) | 4;
+	      break;
 	    case REG_NM:
 	      nbuf[index] = reg_n | (reg_m >> 2);
 	      break;
@@ -997,6 +1310,259 @@
   }
 }
 
+/* Find an opcode at the start of *STR_P in the hash table, and set
+   *STR_P to the first character after the last one read.  */
+
+static sh_opcode_info *
+find_cooked_opcode (str_p)
+     char **str_p;
+{
+  char *str = *str_p;
+  unsigned char *op_start;
+  unsigned char *op_end;
+  char name[20];
+  int nlen = 0;
+  /* Drop leading whitespace */
+  while (*str == ' ')
+    str++;
+
+  /* Find the op code end.
+     The pre-processor will eliminate whitespace in front of
+     any '@' after the first argument; we may be called from
+     assemble_ppi, so the opcode might be terminated by an '@'.  */
+  for (op_start = op_end = (unsigned char *) (str);
+       *op_end
+       && nlen < 20
+       && !is_end_of_line[*op_end] && *op_end != ' ' && *op_end != '@';
+       op_end++)
+    {
+      unsigned char c = op_start[nlen];
+
+      /* The machine independent code will convert CMP/EQ into cmp/EQ
+	 because it thinks the '/' is the end of the symbol.  Moreover,
+	 all but the first sub-insn is a parallel processing insn won't
+	 be capitailzed.  Instead of hacking up the machine independent
+	 code, we just deal with it here.  */
+      c = isupper (c) ? tolower (c) : c;
+      name[nlen] = c;
+      nlen++;
+    }
+  name[nlen] = 0;
+  *str_p = op_end;
+
+  if (nlen == 0)
+    {
+      as_bad (_("can't find opcode "));
+    }
+
+  return (sh_opcode_info *) hash_find (opcode_hash_control, name);
+}
+
+/* Assemble a parallel processing insn.  */
+#define DDT_BASE 0xf000 /* Base value for double data transfer insns */
+static void
+assemble_ppi (op_end, opcode)
+     char *op_end;
+     sh_opcode_info *opcode;
+{
+  int movx = 0;
+  int movy = 0;
+  int cond = 0;
+  int field_b = 0;
+  char *output;
+  int move_code;
+
+  /* Some insn ignore one or more register fields, e.g. psts machl,a0.
+     Make sure we encode a defined insn pattern.  */
+  reg_x = 0;
+  reg_y = 0;
+
+  for (;;)
+    {
+      sh_operand_info operand[3];
+
+      if (opcode->arg[0] != A_END)
+	op_end = get_operands (opcode, op_end, operand);
+      opcode = get_specific (opcode, operand);
+      if (opcode == 0)
+	{
+	  /* Couldn't find an opcode which matched the operands */
+	  char *where = frag_more (2);
+
+	  where[0] = 0x0;
+	  where[1] = 0x0;
+	  as_bad (_("invalid operands for opcode"));
+	  return;
+	}
+      if (opcode->nibbles[0] != PPI)
+	as_bad (_("insn can't be combined with parallel processing insn"));
+
+      switch (opcode->nibbles[1])
+	{
+
+	case NOPX:
+	  if (movx)
+	    as_bad (_("multiple movx specifications"));
+	  movx = DDT_BASE;
+	  break;
+	case NOPY:
+	  if (movy)
+	    as_bad (_("multiple movy specifications"));
+	  movy = DDT_BASE;
+	  break;
+
+	case MOVX:
+	  if (movx)
+	    as_bad (_("multiple movx specifications"));
+	  if (reg_n < 4 || reg_n > 5)
+	    as_bad (_("invalid movx address register"));
+	  if (opcode->nibbles[2] & 8)
+	    {
+	      if (reg_m == A_A1_NUM)
+		movx = 1 << 7;
+	      else if (reg_m != A_A0_NUM)
+		as_bad (_("invalid movx dsp register"));
+	    }
+	  else
+	    {
+	      if (reg_x > 1)
+		as_bad (_("invalid movx dsp register"));
+	      movx = reg_x << 7;
+	    }
+	  movx += ((reg_n - 4) << 9) + (opcode->nibbles[2] << 2) + DDT_BASE;
+	  break;
+
+	case MOVY:
+	  if (movy)
+	    as_bad (_("multiple movy specifications"));
+	  if (opcode->nibbles[2] & 8)
+	    {
+	      /* Bit 3 in nibbles[2] is intended for bit 4 of the opcode,
+		 so add 8 more.  */
+	      movy = 8;
+	      if (reg_m == A_A1_NUM)
+		movy += 1 << 6;
+	      else if (reg_m != A_A0_NUM)
+		as_bad (_("invalid movy dsp register"));
+	    }
+	  else
+	    {
+	      if (reg_y > 1)
+		as_bad (_("invalid movy dsp register"));
+	      movy = reg_y << 6;
+	    }
+	  if (reg_n < 6 || reg_n > 7)
+	    as_bad (_("invalid movy address register"));
+	  movy += ((reg_n - 6) << 8) + opcode->nibbles[2] + DDT_BASE;
+	  break;
+
+	case PSH:
+	  if (immediate.X_op != O_constant)
+	    as_bad (_("dsp immediate shift value not constant"));
+	  field_b = ((opcode->nibbles[2] << 12)
+		     | (immediate.X_add_number & 127) << 4
+		     | reg_n);
+	  break;
+	case PPI3:
+	  if (field_b)
+	    as_bad (_("multiple parallel processing specifications"));
+	  field_b = ((opcode->nibbles[2] << 12) + (opcode->nibbles[3] << 8)
+		     + (reg_x << 6) + (reg_y << 4) + reg_n);
+	  break;
+	case PDC:
+	  if (cond)
+	    as_bad (_("multiple condition specifications"));
+	  cond = opcode->nibbles[2] << 8;
+	  if (*op_end)
+	    goto skip_cond_check;
+	  break;
+	case PPIC:
+	  if (field_b)
+	    as_bad (_("multiple parallel processing specifications"));
+	  field_b = ((opcode->nibbles[2] << 12) + (opcode->nibbles[3] << 8)
+		     + cond + (reg_x << 6) + (reg_y << 4) + reg_n);
+	  cond = 0;
+	  break;
+	case PMUL:
+	  if (field_b)
+	    {
+	      if ((field_b & 0xef00) != 0xa100)
+		as_bad (_("insn cannot be combined with pmuls"));
+	      field_b -= 0x8100;
+	      switch (field_b & 0xf)
+		{
+		case A_X0_NUM:
+		  field_b += 0 - A_X0_NUM;
+		  break;
+		case A_Y0_NUM:
+		  field_b += 1 - A_Y0_NUM;
+		  break;
+		case A_A0_NUM:
+		  field_b += 2 - A_A0_NUM;
+		  break;
+		case A_A1_NUM:
+		  field_b += 3 - A_A1_NUM;
+		  break;
+		default:
+		  as_bad (_("bad padd / psub pmuls output operand"));
+		}
+	    }
+	  field_b += 0x4000 + reg_efg;
+	  break;
+	default:
+	  abort ();
+	}
+      if (cond)
+	{
+	  as_bad (_("condition not followed by conditionalizable insn"));
+	  cond = 0;
+	}
+      if (! *op_end)
+	break;
+    skip_cond_check:
+      opcode = find_cooked_opcode (&op_end);
+      if (opcode == NULL)
+	{
+	  (as_bad
+	   (_("unrecognized characters at end of parallel processing insn")));
+	  break;
+	}
+    }
+
+  move_code = movx | movy;
+  if (field_b)
+    {
+      /* Parallel processing insn.  */
+      unsigned long ppi_code = (movx | movy | 0xf800) << 16 | field_b;
+
+      output = frag_more (4);
+      if (! target_big_endian)
+	{
+	  output[3] = ppi_code >> 8;
+	  output[2] = ppi_code;
+	}
+      else
+	{
+	  output[2] = ppi_code >> 8;
+	  output[3] = ppi_code;
+	}
+      move_code |= 0xf800;
+    }
+  else
+    /* Just a double data transfer.  */
+    output = frag_more (2);
+  if (! target_big_endian)
+    {
+      output[1] = move_code >> 8;
+      output[0] = move_code;
+    }
+  else
+    {
+      output[0] = move_code >> 8;
+      output[1] = move_code;
+    }
+}
+
 /* This is the guts of the machine-dependent assembler.  STR points to a
    machine dependent instruction.  This function is supposed to emit
    the frags/bytes it assembles to.
@@ -1006,41 +1572,12 @@
 md_assemble (str)
      char *str;
 {
-  unsigned char *op_start;
   unsigned char *op_end;
   sh_operand_info operand[3];
   sh_opcode_info *opcode;
-  char name[20];
-  int nlen = 0;
-  /* Drop leading whitespace */
-  while (*str == ' ')
-    str++;
 
-  /* find the op code end */
-  for (op_start = op_end = (unsigned char *) (str);
-       *op_end
-       && nlen < 20
-       && !is_end_of_line[*op_end] && *op_end != ' ';
-       op_end++)
-    {
-      unsigned char c = op_start[nlen];
-
-      /* The machine independent code will convert CMP/EQ into cmp/EQ
-	 because it thinks the '/' is the end of the symbol.  Instead of
-	 hacking up the machine independent code, we just deal with it
-	 here.  */
-      c = isupper (c) ? tolower (c) : c;
-      name[nlen] = c;
-      nlen++;
-    }
-  name[nlen] = 0;
-
-  if (nlen == 0)
-    {
-      as_bad (_("can't find opcode "));
-    }
-
-  opcode = (sh_opcode_info *) hash_find (opcode_hash_control, name);
+  opcode = find_cooked_opcode (&str);
+  op_end = str;
 
   if (opcode == NULL)
     {
@@ -1058,6 +1595,12 @@
       seg_info (now_seg)->tc_segment_info_data.in_code = 1;
     }
 
+  if (opcode->nibbles[0] == PPI)
+    {
+      assemble_ppi (op_end, opcode);
+      return;
+    }
+
   if (opcode->arg[0] == A_BDISP12
       || opcode->arg[0] == A_BDISP8)
     {
@@ -1066,9 +1609,16 @@
     }
   else
     {
-      if (opcode->arg[0] != A_END)
+      if (opcode->arg[0] == A_END)
 	{
-	  get_operands (opcode, op_end, operand);
+	  /* Ignore trailing whitespace.  If there is any, it has already
+	     been compressed to a single space.  */
+	  if (*op_end == ' ')
+	    op_end++;
+	}
+      else
+	{
+	  op_end = get_operands (opcode, op_end, operand);
 	}
       opcode = get_specific (opcode, operand);
 
@@ -1083,6 +1633,9 @@
 	  return;
 	}
 
+      if (*op_end)
+	as_bad (_("excess operands: '%s'"), op_end);
+
       build_Mytes (opcode, operand);
     }
 
@@ -1136,6 +1689,7 @@
 }
 
 #ifdef OBJ_COFF
+#ifndef BFD_ASSEMBLER
 
 void
 DEFUN (tc_crawl_symbol_chain, (headers),
@@ -1152,6 +1706,7 @@
 }
 
 #endif
+#endif
 
 /* Various routines to kill one day */
 /* Equal to MAX_PRECISION in atof-ieee.c */
@@ -1247,10 +1802,12 @@
 #define OPTION_RELAX  (OPTION_MD_BASE)
 #define OPTION_LITTLE (OPTION_MD_BASE + 1)
 #define OPTION_SMALL (OPTION_LITTLE + 1)
+#define OPTION_DSP (OPTION_SMALL + 1)
 
   {"relax", no_argument, NULL, OPTION_RELAX},
   {"little", no_argument, NULL, OPTION_LITTLE},
   {"small", no_argument, NULL, OPTION_SMALL},
+  {"dsp", no_argument, NULL, OPTION_DSP},
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof(md_longopts);
@@ -1275,6 +1832,10 @@
       sh_small = 1;
       break;
 
+    case OPTION_DSP:
+      sh_dsp = 1;
+      break;
+
     default:
       return 0;
     }
@@ -1290,7 +1851,8 @@
 SH options:\n\
 -little			generate little endian code\n\
 -relax			alter jump instructions for long displacements\n\
--small			align sections to 4 byte boundaries, not 16\n"));
+-small			align sections to 4 byte boundaries, not 16\n\
+-dsp			enable sh-dsp insns, and disable sh3e / sh4 insns.\n"));
 }
 
 void
@@ -1450,7 +2012,8 @@
 	 We have already adjusted the value of sym to include the
 	 fragment address, so we undo that adjustment here.  */
       subseg_change (sec, 0);
-      fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address,
+      fix_new (symbol_get_frag (sym),
+	       S_GET_VALUE (sym) - symbol_get_frag (sym)->fr_address,
 	       4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT);
     }
 }
@@ -1875,6 +2438,33 @@
 
   return 1;
 }
+
+void sh_elf_final_processing()
+{
+  int val;
+
+  /* Set file-specific flags to indicate if this code needs
+     a processor with the sh-dsp / sh3e ISA to execute.  */
+  if (valid_arch & arch_sh1)
+    val = EF_SH1;
+  else if (valid_arch & arch_sh2)
+    val = EF_SH2;
+  else if (valid_arch & arch_sh_dsp)
+    val = EF_SH_DSP;
+  else if (valid_arch & arch_sh3)
+    val = EF_SH3;
+  else if (valid_arch & arch_sh3_dsp)
+    val = EF_SH_DSP;
+  else if (valid_arch & arch_sh3e)
+    val = EF_SH3E;
+  else if (valid_arch & arch_sh4)
+    val = EF_SH4;
+  else
+    abort ();
+
+  elf_elfheader (stdoutput)->e_flags &= ~EF_SH_MACH_MASK;
+  elf_elfheader (stdoutput)->e_flags |= val;
+}
 #endif
 
 /* Apply a fixup to the object file.  */
@@ -2056,7 +2646,11 @@
     case BFD_RELOC_VTABLE_INHERIT:
     case BFD_RELOC_VTABLE_ENTRY:
       fixP->fx_done = 0;
+#ifdef BFD_ASSEMBLER
+      return 0;
+#else
       return;
+#endif
 
     default:
       abort ();
@@ -2187,12 +2781,7 @@
      int max;
 {
   if (fill == NULL
-#ifdef BFD_ASSEMBLER
-      && (now_seg->flags & SEC_CODE) != 0
-#else
-      && now_seg != data_section
-      && now_seg != bss_section
-#endif
+      && subseg_text_p (now_seg)
       && n > 1)
     {
       static const unsigned char big_nop_pattern[] = { 0x00, 0x09 };
@@ -2377,7 +2966,8 @@
   bfd_reloc_code_real_type r_type;
 
   rel = (arelent *) xmalloc (sizeof (arelent));
-  rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   r_type = fixp->fx_r_type;
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index cc02eab..f5ab8a9 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -1,5 +1,5 @@
 /* This file is tc-sh.h
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -56,6 +56,8 @@
 
 #ifdef OBJ_ELF
 #define obj_fix_adjustable(fixP) sh_fix_adjustable(fixP)
+struct fix;
+extern boolean sh_fix_adjustable PARAMS ((struct fix *));
 #endif
 
 #define IGNORE_NONSTANDARD_ESCAPES
@@ -127,14 +129,20 @@
 #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
 extern int tc_coff_sizemachdep PARAMS ((fragS *));
 
+#ifdef BFD_ASSEMBLER
+#define SEG_NAME(SEG) segment_name (SEG)
+#else
+#define SEG_NAME(SEG) obj_segment_name (SEG)
+#endif
+
 /* We align most sections to a 16 byte boundary.  */
-#define SUB_SEGMENT_ALIGN(SEG)					\
-  (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0		\
-   ? 0								\
-   : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0	\
-       || strcmp (obj_segment_name (SEG), ".ctors") == 0	\
-       || strcmp (obj_segment_name (SEG), ".dtors") == 0)	\
-      ? 2							\
+#define SUB_SEGMENT_ALIGN(SEG)				\
+  (strncmp (SEG_NAME (SEG), ".stabstr", 8) == 0		\
+   ? 0							\
+   : ((strncmp (SEG_NAME (SEG), ".stab", 5) == 0	\
+       || strcmp (SEG_NAME (SEG), ".ctors") == 0	\
+       || strcmp (SEG_NAME (SEG), ".dtors") == 0)	\
+      ? 2						\
       : (sh_small ? 2 : 4)))
 
 #endif /* OBJ_COFF */
@@ -147,6 +155,9 @@
 
 #define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh")
 
+#define elf_tc_final_processing sh_elf_final_processing
+extern void sh_elf_final_processing PARAMS ((void));
+
 #endif /* OBJ_ELF */
 
 /* end of tc-sh.h */
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 1518a8a..f7049d6 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -1,5 +1,5 @@
 /* tc-sparc.c -- Assemble for the SPARC
-   Copyright (C) 1989, 90-96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1989, 90-96, 97, 98, 99, 2000 Free Software Foundation, Inc.
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
@@ -31,11 +31,14 @@
 
 static struct sparc_arch *lookup_arch PARAMS ((char *));
 static void init_default_arch PARAMS ((void));
-static void sparc_ip PARAMS ((char *, const struct sparc_opcode **));
+static int sparc_ip PARAMS ((char *, const struct sparc_opcode **));
 static int in_signed_range PARAMS ((bfd_signed_vma, bfd_signed_vma));
 static int in_unsigned_range PARAMS ((bfd_vma, bfd_vma));
 static int in_bitfield_range PARAMS ((bfd_signed_vma, bfd_signed_vma));
 static int sparc_ffs PARAMS ((unsigned int));
+static void synthetize_setuw PARAMS ((const struct sparc_opcode *));
+static void synthetize_setsw PARAMS ((const struct sparc_opcode *));
+static void synthetize_setx PARAMS ((const struct sparc_opcode *));
 static bfd_vma BSR PARAMS ((bfd_vma, int));
 static int cmp_reg_entry PARAMS ((const PTR, const PTR));
 static int parse_keyword_arg PARAMS ((int (*) (const char *), char **, int *));
@@ -84,6 +87,10 @@
    architecture, issue a warning.  */
 static enum sparc_opcode_arch_val warn_after_architecture;
 
+/* Non-zero if as should generate error if an undeclared g[23] register
+   has been used in -64.  */
+static int no_undeclared_regs;
+
 /* Non-zero if we are generating PIC code.  */
 int sparc_pic_code;
 
@@ -94,6 +101,9 @@
 
 static int target_little_endian_data;
 
+/* Symbols for global registers on v9.  */
+static symbolS *globals[8];
+
 /* V9 and 86x have big and little endian data, but instructions are always big
    endian.  The sparclet has bi-endian support but both data and insns have
    the same endianness.  Global `target_big_endian' is used for data.
@@ -115,6 +125,8 @@
 static void s_common PARAMS ((int));
 static void s_empty PARAMS ((int));
 static void s_uacons PARAMS ((int));
+static void s_ncons PARAMS ((int));
+static void s_register PARAMS ((int));
 
 const pseudo_typeS md_pseudo_table[] =
 {
@@ -123,6 +135,7 @@
   {"empty", s_empty, 0},
   {"global", s_globl, 0},
   {"half", cons, 2},
+  {"nword", s_ncons, 0},
   {"optim", s_ignore, 0},
   {"proc", s_proc, 0},
   {"reserve", s_reserve, 0},
@@ -135,11 +148,10 @@
   {"uaxword", s_uacons, 8},
 #ifdef OBJ_ELF
   /* these are specific to sparc/svr4 */
-  {"pushsection", obj_elf_section, 0},
-  {"popsection", obj_elf_previous, 0},
   {"2byte", s_uacons, 2},
   {"4byte", s_uacons, 4},
   {"8byte", s_uacons, 8},
+  {"register", s_register, 0},
 #endif
   {NULL, 0, 0},
 };
@@ -174,9 +186,7 @@
    changed in read.c.  Ideally it shouldn't have to know about it at all,
    but nothing is ideal around here.  */
 
-static unsigned char octal[256];
-#define isoctal(c)  octal[(unsigned char) (c)]
-static unsigned char toHex[256];
+#define isoctal(c)  ((unsigned)((c) - '0') < '8')
 
 struct sparc_it
   {
@@ -184,6 +194,7 @@
     unsigned long opcode;
     struct nlist *nlistp;
     expressionS exp;
+    expressionS exp2;
     int pcrel;
     bfd_reloc_code_real_type reloc;
   };
@@ -398,6 +409,12 @@
   {"enforce-aligned-data", no_argument, NULL, OPTION_ENFORCE_ALIGNED_DATA},
 #define OPTION_LITTLE_ENDIAN_DATA (OPTION_MD_BASE + 11)
   {"little-endian-data", no_argument, NULL, OPTION_LITTLE_ENDIAN_DATA},
+#ifdef OBJ_ELF
+#define OPTION_NO_UNDECLARED_REGS (OPTION_MD_BASE + 12)
+  {"no-undeclared-regs", no_argument, NULL, OPTION_NO_UNDECLARED_REGS},
+#define OPTION_UNDECLARED_REGS (OPTION_MD_BASE + 13)
+  {"undeclared-regs", no_argument, NULL, OPTION_UNDECLARED_REGS},
+#endif
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof(md_longopts);
@@ -547,6 +564,14 @@
       else
 	sparc_pic_code = 1;
       break;
+
+    case OPTION_NO_UNDECLARED_REGS:
+      no_undeclared_regs = 1;
+      break;
+
+    case OPTION_UNDECLARED_REGS:
+      no_undeclared_regs = 0;
+      break;
 #endif
 
     default:
@@ -600,6 +625,10 @@
   fprintf (stream, _("\
 -KPIC			generate PIC\n\
 -V			print assembler version number\n\
+-undeclared-regs	ignore application global register usage without\n\
+			appropriate .register directive (default)\n\
+-no-undeclared-regs	force error on application global register usage\n\
+			without appropriate .register directive\n\
 -q			ignored\n\
 -Qy, -Qn		ignored\n\
 -s			ignored\n"));
@@ -613,6 +642,27 @@
 #endif
 }
 
+/* native operand size opcode translation */
+struct
+  {
+    char *name;
+    char *name32;
+    char *name64;
+  } native_op_table[] =
+{
+  {"ldn", "ld", "ldx"},
+  {"ldna", "lda", "ldxa"},
+  {"stn", "st", "stx"},
+  {"stna", "sta", "stxa"},
+  {"slln", "sll", "sllx"},
+  {"srln", "srl", "srlx"},
+  {"sran", "sra", "srax"},
+  {"casn", "cas", "casx"},
+  {"casna", "casa", "casxa"},
+  {"clrn", "clr", "clrx"},
+  {NULL, NULL, NULL},
+};
+
 /* sparc64 priviledged registers */
 
 struct priv_reg_entry
@@ -693,16 +743,16 @@
       retval = hash_insert (op_hash, name, (PTR) &sparc_opcodes[i]);
       if (retval != NULL)
 	{
-	  fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
-		   sparc_opcodes[i].name, retval);
+	  as_bad (_("Internal error: can't hash `%s': %s\n"),
+		  sparc_opcodes[i].name, retval);
 	  lose = 1;
 	}
       do
 	{
 	  if (sparc_opcodes[i].match & sparc_opcodes[i].lose)
 	    {
-	      fprintf (stderr, _("internal error: losing opcode: `%s' \"%s\"\n"),
-		       sparc_opcodes[i].name, sparc_opcodes[i].args);
+	      as_bad (_("Internal error: losing opcode: `%s' \"%s\"\n"),
+		      sparc_opcodes[i].name, sparc_opcodes[i].args);
 	      lose = 1;
 	    }
 	  ++i;
@@ -711,18 +761,33 @@
 	     && !strcmp (sparc_opcodes[i].name, name));
     }
 
+  for (i = 0; native_op_table[i].name; i++)
+    {
+      const struct sparc_opcode *insn;
+      char *name = sparc_arch_size == 32 ? native_op_table[i].name32 :
+			native_op_table[i].name64;
+      insn = (struct sparc_opcode *)hash_find (op_hash, name);
+      if (insn == NULL)
+        {
+          as_bad (_("Internal error: can't find opcode `%s' for `%s'\n"),
+          	  name, native_op_table[i].name);
+          lose = 1;
+        }
+      else
+	{
+	  retval = hash_insert (op_hash, native_op_table[i].name, (PTR) insn);
+	  if (retval != NULL)
+	    {
+	      as_bad (_("Internal error: can't hash `%s': %s\n"),
+		      sparc_opcodes[i].name, retval);
+	      lose = 1;
+	    }
+	}
+    }
+
   if (lose)
     as_fatal (_("Broken assembler.  No assembly attempted."));
 
-  for (i = '0'; i < '8'; ++i)
-    octal[i] = 1;
-  for (i = '0'; i <= '9'; ++i)
-    toHex[i] = i - '0';
-  for (i = 'a'; i <= 'f'; ++i)
-    toHex[i] = i + 10 - 'a';
-  for (i = 'A'; i <= 'F'; ++i)
-    toHex[i] = i + 10 - 'A';
-
   qsort (priv_reg_table, sizeof (priv_reg_table) / sizeof (priv_reg_table[0]),
 	 sizeof (priv_reg_table[0]), cmp_reg_entry);
 
@@ -860,9 +925,6 @@
 /* For communication between sparc_ip and get_expression.  */
 static char *expr_end;
 
-/* For communication between md_assemble and sparc_ip.  */
-static int special_case;
-
 /* Values for `special_case'.
    Instructions that require wierd handling because they're longer than
    4 bytes.  */
@@ -876,6 +938,7 @@
 /* Bit masks of various insns.  */
 #define NOP_INSN 0x01000000
 #define OR_INSN 0x80100000
+#define XOR_INSN 0x80180000
 #define FMOVS_INSN 0x81A00020
 #define SETHI_INSN 0x01000000
 #define SLLX_INSN 0x81281000
@@ -886,6 +949,281 @@
 /* The assembled opcode of `last_insn'.  */
 static unsigned long last_opcode;
 
+/* Handle the set and setuw synthetic instructions.  */
+static void
+synthetize_setuw (insn)
+     const struct sparc_opcode *insn;
+{
+  int need_hi22_p = 0;
+  int rd = (the_insn.opcode & RD (~0)) >> 25;
+
+  if (the_insn.exp.X_op == O_constant)
+    {
+      if (SPARC_OPCODE_ARCH_V9_P (max_architecture))
+	{
+	  if (sizeof(offsetT) > 4
+	      && (the_insn.exp.X_add_number < 0
+		  || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+	    as_warn (_("set: number not in 0..4294967295 range"));
+	}
+      else
+	{
+	  if (sizeof(offsetT) > 4
+	      && (the_insn.exp.X_add_number < -(offsetT) 0x80000000
+		  || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+	    as_warn (_("set: number not in -2147483648..4294967295 range"));
+	  the_insn.exp.X_add_number = (int)the_insn.exp.X_add_number;
+	}
+    }
+
+  /* See if operand is absolute and small; skip sethi if so.  */
+  if (the_insn.exp.X_op != O_constant
+      || the_insn.exp.X_add_number >= (1 << 12)
+      || the_insn.exp.X_add_number < -(1 << 12))
+    {
+      the_insn.opcode = (SETHI_INSN | RD (rd)
+			 | ((the_insn.exp.X_add_number >> 10)
+			    & (the_insn.exp.X_op == O_constant ? 0x3fffff : 0)));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_HI22
+			: BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+      need_hi22_p = 1;
+    }
+
+  /* See if operand has no low-order bits; skip OR if so.  */
+  if (the_insn.exp.X_op != O_constant
+      || (need_hi22_p && (the_insn.exp.X_add_number & 0x3FF) != 0)
+      || ! need_hi22_p)
+    {
+      the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (rd) : 0)
+			 | RD (rd) | IMMED
+			 | (the_insn.exp.X_add_number
+			    & (the_insn.exp.X_op != O_constant ? 0 :
+			       need_hi22_p ? 0x3ff : 0x1fff)));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_LO10
+			: BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+    }
+}
+    
+/* Handle the setsw synthetic instruction.  */
+static void
+synthetize_setsw (insn)
+     const struct sparc_opcode *insn;
+{
+  int low32, rd, opc;
+
+  rd = (the_insn.opcode & RD (~0)) >> 25;
+
+  if (the_insn.exp.X_op != O_constant)
+    {
+      synthetize_setuw (insn);
+
+      /* Need to sign extend it.  */
+      the_insn.opcode = (SRA_INSN | RS1 (rd) | RD (rd));
+      the_insn.reloc = BFD_RELOC_NONE;
+      output_insn (insn, &the_insn);
+      return;
+    }
+
+  if (sizeof(offsetT) > 4
+      && (the_insn.exp.X_add_number < -(offsetT) 0x80000000
+	  || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+    as_warn (_("setsw: number not in -2147483648..4294967295 range"));
+
+  low32 = the_insn.exp.X_add_number;	
+	      
+  if (low32 >= 0)
+    {
+      synthetize_setuw (insn);
+      return;
+    }
+
+  opc = OR_INSN;
+    
+  the_insn.reloc = BFD_RELOC_NONE;
+  /* See if operand is absolute and small; skip sethi if so.  */
+  if (low32 < -(1 << 12))
+    {
+      the_insn.opcode = (SETHI_INSN | RD (rd)
+			 | (((~the_insn.exp.X_add_number) >> 10) & 0x3fffff));
+      output_insn (insn, &the_insn);
+      low32 = 0x1c00 | (low32 & 0x3ff);
+      opc = RS1 (rd) | XOR_INSN;
+    }
+
+  the_insn.opcode = (opc | RD (rd) | IMMED
+		     | (low32 & 0x1fff));
+  output_insn (insn, &the_insn);
+}
+
+/* Handle the setsw synthetic instruction.  */
+static void
+synthetize_setx (insn)
+     const struct sparc_opcode *insn;
+{
+  int upper32, lower32;
+  int tmpreg = (the_insn.opcode & RS1 (~0)) >> 14;
+  int dstreg = (the_insn.opcode & RD (~0)) >> 25;
+  int upper_dstreg;
+  int need_hh22_p = 0, need_hm10_p = 0, need_hi22_p = 0, need_lo10_p = 0;
+  int need_xor10_p = 0;
+    
+#define SIGNEXT32(x) ((((x) & 0xffffffff) ^ 0x80000000) - 0x80000000)
+  lower32 = SIGNEXT32 (the_insn.exp.X_add_number);
+  upper32 = SIGNEXT32 (BSR (the_insn.exp.X_add_number, 32));
+#undef SIGNEXT32
+
+  upper_dstreg = tmpreg;
+  /* The tmp reg should not be the dst reg.  */
+  if (tmpreg == dstreg)
+    as_warn (_("setx: temporary register same as destination register"));
+
+  /* ??? Obviously there are other optimizations we can do
+     (e.g. sethi+shift for 0x1f0000000) and perhaps we shouldn't be
+     doing some of these.  Later.  If you do change things, try to
+     change all of this to be table driven as well.  */
+  /* What to output depends on the number if it's constant.
+     Compute that first, then output what we've decided upon.  */
+  if (the_insn.exp.X_op != O_constant)
+    {
+      if (sparc_arch_size == 32)
+	{
+	  /* When arch size is 32, we want setx to be equivalent
+	     to setuw for anything but constants.  */
+	  the_insn.exp.X_add_number &= 0xffffffff;
+	  synthetize_setuw (insn);
+	  return;
+	}
+      need_hh22_p = need_hm10_p = need_hi22_p = need_lo10_p = 1;
+      lower32 = 0; upper32 = 0;
+    }
+  else
+    {
+      /* Reset X_add_number, we've extracted it as upper32/lower32.
+	 Otherwise fixup_segment will complain about not being able to
+	 write an 8 byte number in a 4 byte field.  */
+      the_insn.exp.X_add_number = 0;
+    
+      /* Only need hh22 if `or' insn can't handle constant.  */
+      if (upper32 < -(1 << 12) || upper32 >= (1 << 12))
+	need_hh22_p = 1;
+    
+      /* Does bottom part (after sethi) have bits?  */
+      if ((need_hh22_p && (upper32 & 0x3ff) != 0)
+	  /* No hh22, but does upper32 still have bits we can't set
+	     from lower32?  */
+	  || (! need_hh22_p && upper32 != 0 && upper32 != -1))
+	need_hm10_p = 1;
+    
+      /* If the lower half is all zero, we build the upper half directly
+	 into the dst reg.  */
+      if (lower32 != 0
+	  /* Need lower half if number is zero or 0xffffffff00000000.  */
+	  || (! need_hh22_p && ! need_hm10_p))
+	{
+	  /* No need for sethi if `or' insn can handle constant.  */
+	  if (lower32 < -(1 << 12) || lower32 >= (1 << 12)
+	      /* Note that we can't use a negative constant in the `or'
+		 insn unless the upper 32 bits are all ones.  */
+	      || (lower32 < 0 && upper32 != -1)
+	      || (lower32 >= 0 && upper32 == -1))
+	    need_hi22_p = 1;
+		      
+	  if (need_hi22_p && upper32 == -1)
+	    need_xor10_p = 1;
+
+	  /* Does bottom part (after sethi) have bits?  */
+	  else if ((need_hi22_p && (lower32 & 0x3ff) != 0)
+		   /* No sethi.  */
+		   || (! need_hi22_p && (lower32 & 0x1fff) != 0)
+		   /* Need `or' if we didn't set anything else.  */
+		   || (! need_hi22_p && ! need_hh22_p && ! need_hm10_p))
+	    need_lo10_p = 1;
+	}
+      else
+	/* Output directly to dst reg if lower 32 bits are all zero.  */
+	upper_dstreg = dstreg;
+    }
+    
+  if (!upper_dstreg && dstreg)
+    as_warn (_("setx: illegal temporary register g0"));
+
+  if (need_hh22_p)
+    {
+      the_insn.opcode = (SETHI_INSN | RD (upper_dstreg)
+			 | ((upper32 >> 10) & 0x3fffff));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_SPARC_HH22 : BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+    }
+    
+  if (need_hi22_p)
+    {
+      the_insn.opcode = (SETHI_INSN | RD (dstreg)
+			 | (((need_xor10_p ? ~lower32 : lower32)
+			    >> 10) & 0x3fffff));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_SPARC_LM22 : BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+    }
+
+  if (need_hm10_p)
+    {
+      the_insn.opcode = (OR_INSN
+			 | (need_hh22_p ? RS1 (upper_dstreg) : 0)
+			 | RD (upper_dstreg)
+			 | IMMED
+			 | (upper32 & (need_hh22_p ? 0x3ff : 0x1fff)));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_SPARC_HM10 : BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+    }
+    
+  if (need_lo10_p)
+    {
+      /* FIXME: One nice optimization to do here is to OR the low part
+	 with the highpart if hi22 isn't needed and the low part is
+	 positive.  */
+      the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (dstreg) : 0)
+			 | RD (dstreg)
+			 | IMMED
+			 | (lower32 & (need_hi22_p ? 0x3ff : 0x1fff)));
+      the_insn.reloc = (the_insn.exp.X_op != O_constant
+			? BFD_RELOC_LO10 : BFD_RELOC_NONE);
+      output_insn (insn, &the_insn);
+    }
+    
+  /* If we needed to build the upper part, shift it into place.  */
+  if (need_hh22_p || need_hm10_p)
+    {
+      the_insn.opcode = (SLLX_INSN | RS1 (upper_dstreg) | RD (upper_dstreg)
+			 | IMMED | 32);
+      the_insn.reloc = BFD_RELOC_NONE;
+      output_insn (insn, &the_insn);
+    }
+    
+  /* To get -1 in upper32, we do sethi %hi(~x), r; xor r, -0x400 | x, r.  */
+  if (need_xor10_p)
+    {
+      the_insn.opcode = (XOR_INSN | RS1 (dstreg) | RD (dstreg) | IMMED
+			 | 0x1c00 | (lower32 & 0x3ff));
+      the_insn.reloc = BFD_RELOC_NONE;
+      output_insn (insn, &the_insn);
+    }
+
+  /* If we needed to build both upper and lower parts, OR them together.  */
+  else if ((need_hh22_p || need_hm10_p) && (need_hi22_p || need_lo10_p))
+    {
+      the_insn.opcode = (OR_INSN | RS1 (dstreg) | RS2 (upper_dstreg)
+			 | RD (dstreg));
+      the_insn.reloc = BFD_RELOC_NONE;
+      output_insn (insn, &the_insn);
+    }
+}
+
 /* Main entry point to assemble one instruction.  */
 
 void
@@ -893,10 +1231,10 @@
      char *str;
 {
   const struct sparc_opcode *insn;
+  int special_case;
 
   know (str);
-  special_case = SPECIAL_CASE_NONE;
-  sparc_ip (str, &insn);
+  special_case = sparc_ip (str, &insn);
 
   /* We warn about attempts to put a floating point branch in a delay slot,
      unless the delay slot has been annulled.  */
@@ -934,202 +1272,24 @@
       output_insn (insn, &the_insn);
       break;
 
-    case SPECIAL_CASE_SET:
-      {
-	int need_hi22_p = 0;
-
-	/* "set" is not defined for negative numbers in v9: it doesn't yield
-	   what you expect it to.  */
-	if (SPARC_OPCODE_ARCH_V9_P (max_architecture)
-	    && the_insn.exp.X_op == O_constant)
-	  {
-	    if (the_insn.exp.X_add_number < 0)
-	      as_warn (_("set: used with negative number"));
-	    else if (the_insn.exp.X_add_number > (offsetT) 0xffffffff)
-	      as_warn (_("set: number larger than 4294967295"));
-	  }
-
-	/* See if operand is absolute and small; skip sethi if so.  */
-	if (the_insn.exp.X_op != O_constant
-	    || the_insn.exp.X_add_number >= (1 << 12)
-	    || the_insn.exp.X_add_number < -(1 << 12))
-	  {
-	    output_insn (insn, &the_insn);
-	    need_hi22_p = 1;
-	  }
-	/* See if operand has no low-order bits; skip OR if so.  */
-	if (the_insn.exp.X_op != O_constant
-	    || (need_hi22_p && (the_insn.exp.X_add_number & 0x3FF) != 0)
-	    || ! need_hi22_p)
-	  {
-	    int rd = (the_insn.opcode & RD (~0)) >> 25;
-	    the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (rd) : 0)
-			       | RD (rd)
-			       | IMMED
-			       | (the_insn.exp.X_add_number
-				  & (need_hi22_p ? 0x3ff : 0x1fff)));
-	    the_insn.reloc = (the_insn.exp.X_op != O_constant
-			      ? BFD_RELOC_LO10
-			      : BFD_RELOC_NONE);
-	    output_insn (insn, &the_insn);
-	  }
-	break;
-      }
-
     case SPECIAL_CASE_SETSW:
-      {
-	/* FIXME: Not finished.  */
-	break;
-      }
+      synthetize_setsw (insn);
+      break;
+	  
+    case SPECIAL_CASE_SET:
+      synthetize_setuw (insn);
+      break;
 
     case SPECIAL_CASE_SETX:
-      {
-#define SIGNEXT32(x) ((((x) & 0xffffffff) ^ 0x80000000) - 0x80000000)
-	int upper32 = SIGNEXT32 (BSR (the_insn.exp.X_add_number, 32));
-	int lower32 = SIGNEXT32 (the_insn.exp.X_add_number);
-#undef SIGNEXT32
-	int tmpreg = (the_insn.opcode & RS1 (~0)) >> 14;
-	int dstreg = (the_insn.opcode & RD (~0)) >> 25;
-	/* Output directly to dst reg if lower 32 bits are all zero.  */
-	int upper_dstreg = (the_insn.exp.X_op == O_constant
-			    && lower32 == 0) ? dstreg : tmpreg;
-	int need_hh22_p = 0, need_hm10_p = 0, need_hi22_p = 0, need_lo10_p = 0;
-
-	/* The tmp reg should not be the dst reg.  */
-	if (tmpreg == dstreg)
-	  as_warn (_("setx: temporary register same as destination register"));
-
-	/* Reset X_add_number, we've extracted it as upper32/lower32.
-	   Otherwise fixup_segment will complain about not being able to
-	   write an 8 byte number in a 4 byte field.  */
-	the_insn.exp.X_add_number = 0;
-
-	/* ??? Obviously there are other optimizations we can do
-	   (e.g. sethi+shift for 0x1f0000000) and perhaps we shouldn't be
-	   doing some of these.  Later.  If you do change things, try to
-	   change all of this to be table driven as well.  */
-
-	/* What to output depends on the number if it's constant.
-	   Compute that first, then output what we've decided upon.  */
-	if (the_insn.exp.X_op != O_constant)
-	  need_hh22_p = need_hm10_p = need_hi22_p = need_lo10_p = 1;
-	else
-	  {
-	    /* Only need hh22 if `or' insn can't handle constant.  */
-	    if (upper32 < -(1 << 12) || upper32 >= (1 << 12))
-	      need_hh22_p = 1;
-
-	    /* Does bottom part (after sethi) have bits?  */
-	    if ((need_hh22_p && (upper32 & 0x3ff) != 0)
-		/* No hh22, but does upper32 still have bits we can't set
-		   from lower32?  */
-		|| (! need_hh22_p
-		    && upper32 != 0
-		    && (upper32 != -1 || lower32 >= 0)))
-	      need_hm10_p = 1;
-
-	    /* If the lower half is all zero, we build the upper half directly
-	       into the dst reg.  */
-	    if (lower32 != 0
-		/* Need lower half if number is zero.  */
-		|| (! need_hh22_p && ! need_hm10_p))
-	      {
-		/* No need for sethi if `or' insn can handle constant.  */
-		if (lower32 < -(1 << 12) || lower32 >= (1 << 12)
-		    /* Note that we can't use a negative constant in the `or'
-		       insn unless the upper 32 bits are all ones.  */
-		    || (lower32 < 0 && upper32 != -1))
-		  need_hi22_p = 1;
-
-		/* Does bottom part (after sethi) have bits?  */
-		if ((need_hi22_p && (lower32 & 0x3ff) != 0)
-		    /* No sethi.  */
-		    || (! need_hi22_p && (lower32 & 0x1fff) != 0)
-		    /* Need `or' if we didn't set anything else.  */
-		    || (! need_hi22_p && ! need_hh22_p && ! need_hm10_p))
-		  need_lo10_p = 1;
-	      }
-	  }
-
-	if (need_hh22_p)
-	  {
-	    the_insn.opcode = (SETHI_INSN | RD (upper_dstreg)
-			       | ((upper32 >> 10) & 0x3fffff));
-	    the_insn.reloc = (the_insn.exp.X_op != O_constant
-			      ? BFD_RELOC_SPARC_HH22 : BFD_RELOC_NONE);
-	    output_insn (insn, &the_insn);
-	  }
-
-	if (need_hm10_p)
-	  {
-	    the_insn.opcode = (OR_INSN
-			       | (need_hh22_p ? RS1 (upper_dstreg) : 0)
-			       | RD (upper_dstreg)
-			       | IMMED
-			       | (upper32
-				  & (need_hh22_p ? 0x3ff : 0x1fff)));
-	    the_insn.reloc = (the_insn.exp.X_op != O_constant
-			      ? BFD_RELOC_SPARC_HM10 : BFD_RELOC_NONE);
-	    output_insn (insn, &the_insn);
-	  }
-
-	if (need_hi22_p)
-	  {
-	    the_insn.opcode = (SETHI_INSN | RD (dstreg)
-			       | ((lower32 >> 10) & 0x3fffff));
-	    the_insn.reloc = BFD_RELOC_HI22;
-	    output_insn (insn, &the_insn);
-	  }
-
-	if (need_lo10_p)
-	  {
-	    /* FIXME: One nice optimization to do here is to OR the low part
-	       with the highpart if hi22 isn't needed and the low part is
-	       positive.  */
-	    the_insn.opcode = (OR_INSN | (need_hi22_p ? RS1 (dstreg) : 0)
-			       | RD (dstreg)
-			       | IMMED
-			       | (lower32
-				  & (need_hi22_p ? 0x3ff : 0x1fff)));
-	    the_insn.reloc = BFD_RELOC_LO10;
-	    output_insn (insn, &the_insn);
-	  }
-
-	/* If we needed to build the upper part, shift it into place.  */
-	if (need_hh22_p || need_hm10_p)
-	  {
-	    the_insn.opcode = (SLLX_INSN | RS1 (upper_dstreg) | RD (upper_dstreg)
-			       | IMMED | 32);
-	    the_insn.reloc = BFD_RELOC_NONE;
-	    output_insn (insn, &the_insn);
-	  }
-
-	/* If we needed to build both upper and lower parts, OR them together.  */
-	if ((need_hh22_p || need_hm10_p)
-	    && (need_hi22_p || need_lo10_p))
-	  {
-	    the_insn.opcode = (OR_INSN | RS1 (dstreg) | RS2 (upper_dstreg)
-			       | RD (dstreg));
-	    the_insn.reloc = BFD_RELOC_NONE;
-	    output_insn (insn, &the_insn);
-	  }
-	/* We didn't need both regs, but we may have to sign extend lower32.  */
-	else if (need_hi22_p && upper32 == -1)
-	  {
-	    the_insn.opcode = (SRA_INSN | RS1 (dstreg) | RD (dstreg)
-			       | IMMED | 0);
-	    the_insn.reloc = BFD_RELOC_NONE;
-	    output_insn (insn, &the_insn);
-	  }
-	break;
-      }
-
+      synthetize_setx (insn);
+      break;
+      
     case SPECIAL_CASE_FDIV:
       {
 	int rd = (the_insn.opcode >> 25) & 0x1f;
-
+    
 	output_insn (insn, &the_insn);
-
+    
 	/* According to information leaked from Sun, the "fdiv" instructions
 	   on early SPARC machines would produce incorrect results sometimes.
 	   The workaround is to add an fmovs of the destination register to
@@ -1138,9 +1298,9 @@
 	assert (the_insn.reloc == BFD_RELOC_NONE);
 	the_insn.opcode = FMOVS_INSN | rd | RD (rd);
 	output_insn (insn, &the_insn);
-	break;
+	return;
       }
-
+    
     default:
       as_fatal (_("failed special case insn sanity check"));
     }
@@ -1148,7 +1308,7 @@
 
 /* Subroutine of md_assemble to do the actual parsing.  */
 
-static void
+static int
 sparc_ip (str, pinsn)
      char *str;
      const struct sparc_opcode **pinsn;
@@ -1164,6 +1324,7 @@
   int match = 0;
   int comma = 0;
   int v9_arg_p;
+  int special_case = SPECIAL_CASE_NONE;
 
   s = str;
   if (islower ((unsigned char) *s))
@@ -1195,7 +1356,7 @@
   if (insn == NULL)
     {
       as_bad (_("Unknown opcode: `%s'"), str);
-      return;
+      return special_case;
     }
   if (comma)
     {
@@ -1654,7 +1815,8 @@
 		      goto error;
 
 		    case 'g':	/* global register */
-		      if (isoctal (c = *s++))
+		      c = *s++;
+		      if (isoctal (c))
 			{
 			  mask = c - '0';
 			  break;
@@ -1662,7 +1824,8 @@
 		      goto error;
 
 		    case 'i':	/* in register */
-		      if (isoctal (c = *s++))
+		      c = *s++;
+		      if (isoctal (c))
 			{
 			  mask = c - '0' + 24;
 			  break;
@@ -1670,7 +1833,8 @@
 		      goto error;
 
 		    case 'l':	/* local register */
-		      if (isoctal (c = *s++))
+		      c = *s++;
+		      if (isoctal (c))
 			{
 			  mask = (c - '0' + 16);
 			  break;
@@ -1678,7 +1842,8 @@
 		      goto error;
 
 		    case 'o':	/* out register */
-		      if (isoctal (c = *s++))
+		      c = *s++;
+		      if (isoctal (c))
 			{
 			  mask = (c - '0' + 8);
 			  break;
@@ -1727,6 +1892,11 @@
 		      goto error;
 		    }
 
+		  if ((mask & ~1) == 2 && sparc_arch_size == 64
+		      && no_undeclared_regs && ! globals [mask])
+		    as_bad (_("detected global register use not "
+			      "covered by .register pseudo-op"));
+
 		  /* Got the register, now figure out where
 		     it goes in the opcode.  */
 		  switch (*args)
@@ -1854,14 +2024,10 @@
 		}
 	      break;
 
-	    case '0':		/* 64 bit immediate (setx insn) */
+	    case '0':		/* 64 bit immediate (set, setsw, setx insn) */
 	      the_insn.reloc = BFD_RELOC_NONE; /* reloc handled elsewhere */
 	      goto immediate;
 
-	    case 'h':		/* high 22 bits */
-	      the_insn.reloc = BFD_RELOC_HI22;
-	      goto immediate;
-
 	    case 'l':		/* 22 bit PC relative immediate */
 	      the_insn.reloc = BFD_RELOC_SPARC_WDISP22;
 	      the_insn.pcrel = 1;
@@ -1872,6 +2038,7 @@
 	      the_insn.pcrel = 1;
 	      goto immediate;
 
+	    case 'h':
 	    case 'n':		/* 22 bit immediate */
 	      the_insn.reloc = BFD_RELOC_SPARC22;
 	      goto immediate;
@@ -1885,89 +2052,227 @@
 	      if (*s == ' ')
 		s++;
 
-	      /* Check for %hi, etc.  */
-	      if (*s == '%')
-		{
-		  static struct ops {
-		    /* The name as it appears in assembler.  */
-		    char *name;
-		    /* strlen (name), precomputed for speed */
-		    int len;
-		    /* The reloc this pseudo-op translates to.  */
-		    int reloc;
-		    /* Non-zero if for v9 only.  */
-		    int v9_p;
-		    /* Non-zero if can be used in pc-relative contexts.  */
-		    int pcrel_p;/*FIXME:wip*/
-		  } ops[] = {
-		    /* hix/lox must appear before hi/lo so %hix won't be
-		       mistaken for %hi.  */
-		    { "hix", 3, BFD_RELOC_SPARC_HIX22, 1, 0 },
-		    { "lox", 3, BFD_RELOC_SPARC_LOX10, 1, 0 },
-		    { "hi", 2, BFD_RELOC_HI22, 0, 1 },
-		    { "lo", 2, BFD_RELOC_LO10, 0, 1 },
-		    { "hh", 2, BFD_RELOC_SPARC_HH22, 1, 1 },
-		    { "hm", 2, BFD_RELOC_SPARC_HM10, 1, 1 },
-		    { "lm", 2, BFD_RELOC_SPARC_LM22, 1, 1 },
-		    { "h44", 3, BFD_RELOC_SPARC_H44, 1, 0 },
-		    { "m44", 3, BFD_RELOC_SPARC_M44, 1, 0 },
-		    { "l44", 3, BFD_RELOC_SPARC_L44, 1, 0 },
-		    { "uhi", 3, BFD_RELOC_SPARC_HH22, 1, 0 },
-		    { "ulo", 3, BFD_RELOC_SPARC_HM10, 1, 0 },
-		    { NULL }
-		  };
-		  struct ops *o;
-
-		  for (o = ops; o->name; o++)
-		    if (strncmp (s + 1, o->name, o->len) == 0)
-		      break;
-		  if (o->name == NULL)
-		    break;
-
-		  the_insn.reloc = o->reloc;
-		  s += o->len + 1;
-		  v9_arg_p = o->v9_p;
-		}
-
-	      /* Note that if the get_expression() fails, we will still
-		 have created U entries in the symbol table for the
-		 'symbols' in the input string.  Try not to create U
-		 symbols for registers, etc.  */
 	      {
+		char *s1;
+		char *op_arg = NULL;
+		expressionS op_exp;
+		bfd_reloc_code_real_type old_reloc = the_insn.reloc;
+
+		/* Check for %hi, etc.  */
+		if (*s == '%')
+		  {
+		    static const struct ops {
+		      /* The name as it appears in assembler.  */
+		      char *name;
+		      /* strlen (name), precomputed for speed */
+		      int len;
+		      /* The reloc this pseudo-op translates to.  */
+		      int reloc;
+		      /* Non-zero if for v9 only.  */
+		      int v9_p;
+		      /* Non-zero if can be used in pc-relative contexts.  */
+		      int pcrel_p;/*FIXME:wip*/
+		    } ops[] = {
+		      /* hix/lox must appear before hi/lo so %hix won't be
+			 mistaken for %hi.  */
+		      { "hix", 3, BFD_RELOC_SPARC_HIX22, 1, 0 },
+		      { "lox", 3, BFD_RELOC_SPARC_LOX10, 1, 0 },
+		      { "hi", 2, BFD_RELOC_HI22, 0, 1 },
+		      { "lo", 2, BFD_RELOC_LO10, 0, 1 },
+		      { "hh", 2, BFD_RELOC_SPARC_HH22, 1, 1 },
+		      { "hm", 2, BFD_RELOC_SPARC_HM10, 1, 1 },
+		      { "lm", 2, BFD_RELOC_SPARC_LM22, 1, 1 },
+		      { "h44", 3, BFD_RELOC_SPARC_H44, 1, 0 },
+		      { "m44", 3, BFD_RELOC_SPARC_M44, 1, 0 },
+		      { "l44", 3, BFD_RELOC_SPARC_L44, 1, 0 },
+		      { "uhi", 3, BFD_RELOC_SPARC_HH22, 1, 0 },
+		      { "ulo", 3, BFD_RELOC_SPARC_HM10, 1, 0 },
+		      { NULL }
+		    };
+		    const struct ops *o;
+  
+		    for (o = ops; o->name; o++)
+		      if (strncmp (s + 1, o->name, o->len) == 0)
+			break;
+		    if (o->name == NULL)
+		      break;
+		      
+		    if (s[o->len + 1] != '(')
+		      {
+			as_bad (_("Illegal operands: %%%s requires arguments in ()"), o->name);
+			return special_case;
+		      }
+
+		    op_arg = o->name;
+		    the_insn.reloc = o->reloc;
+		    s += o->len + 2;
+		    v9_arg_p = o->v9_p;
+		  }
+
+		/* Note that if the get_expression() fails, we will still
+		   have created U entries in the symbol table for the
+		   'symbols' in the input string.  Try not to create U
+		   symbols for registers, etc.  */
+
 		/* This stuff checks to see if the expression ends in
 		   +%reg.  If it does, it removes the register from
 		   the expression, and re-sets 's' to point to the
 		   right place.  */
 
-		char *s1;
+		if (op_arg)
+		  {
+		    int npar = 0;
+
+		    for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++)
+		      if (*s1 == '(')
+			npar++;
+		      else if (*s1 == ')')
+			{
+			  if (!npar)
+			    break;
+			  npar--;
+			}
+
+		    if (*s1 != ')')
+		      {
+			as_bad (_("Illegal operands: %%%s requires arguments in ()"), op_arg);
+			return special_case;
+		      }
+		    
+		    *s1 = '\0';
+		    (void) get_expression (s);
+		    *s1 = ')';
+		    s = s1 + 1;
+		    if (*s == ',' || *s == ']' || !*s)
+		      continue;
+		    if (*s != '+' && *s != '-')
+		      {
+			as_bad (_("Illegal operands: Can't do arithmetics other than + and - involving %%%s()"), op_arg);
+			return special_case;
+		      }
+		    *s1 = '0';
+		    s = s1;
+		    op_exp = the_insn.exp;
+		    memset (&the_insn.exp, 0, sizeof(the_insn.exp));
+		  }
 
 		for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++) ;
 
 		if (s1 != s && isdigit ((unsigned char) s1[-1]))
 		  {
 		    if (s1[-2] == '%' && s1[-3] == '+')
-		      {
-			s1 -= 3;
-			*s1 = '\0';
-			(void) get_expression (s);
-			*s1 = '+';
-			s = s1;
-			continue;
-		      }
+		      s1 -= 3;
 		    else if (strchr ("goli0123456789", s1[-2]) && s1[-3] == '%' && s1[-4] == '+')
+		      s1 -= 4;
+		    else
+		      s1 = NULL;
+		    if (s1)
 		      {
-			s1 -= 4;
 			*s1 = '\0';
-			(void) get_expression (s);
+			if (op_arg && s1 == s + 1)
+			  the_insn.exp.X_op = O_absent;
+			else
+			  (void) get_expression (s);
 			*s1 = '+';
+			if (op_arg)
+			  *s = ')';
 			s = s1;
-			continue;
+		      }
+		  }
+		else
+		  s1 = NULL;
+
+		if (!s1)
+		  {
+		    (void) get_expression (s);
+		    if (op_arg)
+		      *s = ')';
+		    s = expr_end;
+		  }
+
+		if (op_arg)
+		  {
+		    the_insn.exp2 = the_insn.exp;
+		    the_insn.exp = op_exp;
+		    if (the_insn.exp2.X_op == O_absent)
+		      the_insn.exp2.X_op = O_illegal;
+		    else if (the_insn.exp.X_op == O_absent)
+		      {
+			the_insn.exp = the_insn.exp2;
+			the_insn.exp2.X_op = O_illegal;
+		      }
+		    else if (the_insn.exp.X_op == O_constant)
+		      {
+			valueT val = the_insn.exp.X_add_number;
+			switch (the_insn.reloc)
+			  {
+			  default:
+			    break;
+
+			  case BFD_RELOC_SPARC_HH22:
+			    val = BSR (val, 32);
+			    /* intentional fallthrough */
+
+			  case BFD_RELOC_SPARC_LM22:
+			  case BFD_RELOC_HI22:
+			    val = (val >> 10) & 0x3fffff;
+			    break;
+
+			  case BFD_RELOC_SPARC_HM10:
+			    val = BSR (val, 32);
+			    /* intentional fallthrough */
+
+			  case BFD_RELOC_LO10:
+			    val &= 0x3ff;
+			    break;
+
+			  case BFD_RELOC_SPARC_H44:
+			    val >>= 22;
+			    val &= 0x3fffff;
+			    break;
+
+			  case BFD_RELOC_SPARC_M44:
+			    val >>= 12;
+			    val &= 0x3ff;
+			    break;
+
+			  case BFD_RELOC_SPARC_L44:
+			    val &= 0xfff;
+			    break;
+
+			  case BFD_RELOC_SPARC_HIX22:
+			    val = ~ val;
+			    val = (val >> 10) & 0x3fffff;
+			    break;
+
+			  case BFD_RELOC_SPARC_LOX10:
+			    val = (val & 0x3ff) | 0x1c00;
+			    break;
+			  }
+			the_insn.exp = the_insn.exp2;
+			the_insn.exp.X_add_number += val;
+			the_insn.exp2.X_op = O_illegal;
+			the_insn.reloc = old_reloc;
+		      }
+		    else if (the_insn.exp2.X_op != O_constant)
+		      {
+			as_bad (_("Illegal operands: Can't add non-constant expression to %%%s()"), op_arg);
+			return special_case;
+		      }
+		    else
+		      {
+			if (old_reloc != BFD_RELOC_SPARC13
+			    || the_insn.reloc != BFD_RELOC_LO10
+			    || sparc_arch_size != 64
+			    || sparc_pic_code)
+			  {
+			    as_bad (_("Illegal operands: Can't do arithmetics involving %%%s() of a relocatable symbol"), op_arg);
+			    return special_case;
+			  }
+			the_insn.reloc = BFD_RELOC_SPARC_OLO10;
 		      }
 		  }
 	      }
-	      (void) get_expression (s);
-	      s = expr_end;
-
 	      /* Check for constants that don't require emitting a reloc.  */
 	      if (the_insn.exp.X_op == O_constant
 		  && the_insn.exp.X_add_symbol == 0
@@ -2176,7 +2481,7 @@
 	  else
 	    {
 	      as_bad (_("Illegal operands%s"), error_message);
-	      return;
+	      return special_case;
 	    }
 	}
       else
@@ -2244,7 +2549,7 @@
 	      as_tsktsk (_(" (Requires %s; requested architecture is %s.)"),
 			 required_archs,
 			 sparc_opcode_archs[max_architecture].name);
-	      return;
+	      return special_case;
 	    }
 	} /* if no match */
 
@@ -2252,6 +2557,7 @@
     } /* forever looking for a match */
 
   the_insn.opcode = opcode;
+  return special_case;
 }
 
 /* Parse an argument that can be expressed as a keyword.
@@ -2374,6 +2680,8 @@
 	 the insn size is 4 and fixup_segment will signal an overflow for
 	 large 8 byte quantities.  */
       fixP->fx_no_overflow = 1;
+      if (the_insn->reloc == BFD_RELOC_SPARC_OLO10)
+	fixP->tc_fix_data = the_insn->exp2.X_add_number;
     }
 
   last_insn = insn;
@@ -2504,7 +2812,7 @@
      don't want to include the value of an externally visible symbol.  */
   if (fixP->fx_addsy != NULL)
     {
-      if (fixP->fx_addsy->sy_used_in_reloc
+      if (symbol_used_in_reloc_p (fixP->fx_addsy)
 	  && (S_IS_EXTERNAL (fixP->fx_addsy)
 	      || S_IS_WEAK (fixP->fx_addsy)
 	      || (sparc_pic_code && ! fixP->fx_pcrel)
@@ -2549,7 +2857,7 @@
       && fixP->fx_r_type != BFD_RELOC_32_PCREL_S2
       && fixP->fx_addsy != NULL
       && ! S_IS_COMMON (fixP->fx_addsy)
-      && (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) == 0)
+      && symbol_section_p (fixP->fx_addsy))
     fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy);
 
   /* When generating PIC code, we need to fiddle to get
@@ -2606,7 +2914,7 @@
 	     being done!  */
 	  if (! sparc_pic_code
 	      || fixP->fx_addsy == NULL
-	      || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)
+	      || symbol_section_p (fixP->fx_addsy))
 	    ++val;
 	  insn |= val & 0x3fffffff;
 	  break;
@@ -2708,6 +3016,11 @@
 	    }
 	  break;
 
+	case BFD_RELOC_SPARC_OLO10:
+	  val &= 0x3ff;
+	  val += fixP->tc_fix_data;
+	  /* intentional fallthrough */
+
 	case BFD_RELOC_SPARC13:
 	  if (! in_signed_range (val, 0x1fff))
 	    as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -2777,17 +3090,20 @@
 
 /* Translate internal representation of relocation info to BFD target
    format.  */
-arelent *
+arelent **
 tc_gen_reloc (section, fixp)
      asection *section;
      fixS *fixp;
 {
+  static arelent *relocs[3];
   arelent *reloc;
   bfd_reloc_code_real_type code;
 
-  reloc = (arelent *) xmalloc (sizeof (arelent));
+  relocs[0] = reloc = (arelent *) xmalloc (sizeof (arelent));
+  relocs[1] = NULL;
 
-  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   switch (fixp->fx_r_type)
@@ -2798,6 +3114,7 @@
     case BFD_RELOC_LO10:
     case BFD_RELOC_32_PCREL_S2:
     case BFD_RELOC_SPARC13:
+    case BFD_RELOC_SPARC22:
     case BFD_RELOC_SPARC_BASE13:
     case BFD_RELOC_SPARC_WDISP16:
     case BFD_RELOC_SPARC_WDISP19:
@@ -2820,6 +3137,7 @@
     case BFD_RELOC_SPARC_HIX22:
     case BFD_RELOC_SPARC_LOX10:
     case BFD_RELOC_SPARC_REV32:
+    case BFD_RELOC_SPARC_OLO10:
     case BFD_RELOC_VTABLE_ENTRY:
     case BFD_RELOC_VTABLE_INHERIT:
       code = fixp->fx_r_type;
@@ -2839,6 +3157,8 @@
 #define GOT_NAME "__GLOBAL_OFFSET_TABLE_"
 #endif
 
+  /* This code must be parallel to the OBJ_ELF tc_fix_adjustable.  */
+
   if (sparc_pic_code)
     {
       switch (code)
@@ -2873,13 +3193,18 @@
     }
 #endif /* defined (OBJ_ELF) || defined (OBJ_AOUT) */
 
-  reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
+  if (code == BFD_RELOC_SPARC_OLO10)
+    reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO10);
+  else
+    reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
   if (reloc->howto == 0)
     {
       as_bad_where (fixp->fx_file, fixp->fx_line,
 		    _("internal error: can't export reloc type %d (`%s')"),
 		    fixp->fx_r_type, bfd_get_reloc_code_name (code));
-      return 0;
+      xfree (reloc);
+      relocs[0] = NULL;
+      return relocs;
     }
 
   /* @@ Why fx_addnumber sometimes and fx_offset other times?  */
@@ -2906,7 +3231,7 @@
       || code == BFD_RELOC_SPARC_PC10
       || code == BFD_RELOC_SPARC_PC22)
     reloc->addend = fixp->fx_addnumber;
-  else if ((fixp->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)
+  else if (symbol_section_p (fixp->fx_addsy))
     reloc->addend = (section->vma
 		     + fixp->fx_addnumber
 		     + md_pcrel_from (fixp));
@@ -2914,7 +3239,21 @@
     reloc->addend = fixp->fx_offset;
 #endif
 
-  return reloc;
+  /* We expand R_SPARC_OLO10 to R_SPARC_LO10 and R_SPARC_13
+     on the same location.  */
+  if (code == BFD_RELOC_SPARC_OLO10)
+    {
+      relocs[1] = reloc = (arelent *) xmalloc (sizeof (arelent));
+      relocs[2] = NULL;
+
+      reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+      *reloc->sym_ptr_ptr = symbol_get_bfdsym (section_symbol (absolute_section));
+      reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+      reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_SPARC13);
+      reloc->addend = fixp->tc_fix_data;
+    }
+
+  return relocs;
 }
 
 /* We have no need to default values of symbols. */
@@ -2961,7 +3300,7 @@
   ret = fixP->fx_where + fixP->fx_frag->fr_address;
   if (! sparc_pic_code
       || fixP->fx_addsy == NULL
-      || (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)
+      || symbol_section_p (fixP->fx_addsy))
     ret += fixP->fx_size;
   return ret;
 }
@@ -3110,9 +3449,9 @@
 
 	  /* detach from old frag */
 	  if (S_GET_SEGMENT(symbolP) == bss_section)
-	    symbolP->sy_frag->fr_symbol = NULL;
+	    symbol_get_frag (symbolP)->fr_symbol = NULL;
 
-	  symbolP->sy_frag = frag_now;
+	  symbol_set_frag (symbolP, frag_now);
 	  pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
 			    (offsetT) size, (char *)0);
 	  *pfrag = 0;
@@ -3189,7 +3528,7 @@
       S_SET_EXTERNAL (symbolP);
 #endif
     }
-  know (symbolP->sy_frag == &zero_address_frag);
+  know (symbol_get_frag (symbolP) == &zero_address_frag);
   if (*input_line_pointer != ',')
     {
       as_bad (_("Expected comma after common length"));
@@ -3218,7 +3557,7 @@
 	}
 
 #ifdef OBJ_ELF
-      if (symbolP->local)
+      if (symbol_get_obj (symbolP)->local)
 	{
 	  segT old_sec;
 	  int old_subsec;
@@ -3245,8 +3584,8 @@
 	  if (align)
 	    frag_align (align, 0, 0);
 	  if (S_GET_SEGMENT (symbolP) == bss_section)
-	    symbolP->sy_frag->fr_symbol = 0;
-	  symbolP->sy_frag = frag_now;
+	    symbol_get_frag (symbolP)->fr_symbol = 0;
+	  symbol_set_frag (symbolP, frag_now);
 	  p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
 			(offsetT) size, (char *) 0);
 	  *p = 0;
@@ -3289,7 +3628,7 @@
     }
 
 #ifdef BFD_ASSEMBLER
-  symbolP->bsym->flags |= BSF_OBJECT;
+  symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
 #endif
 
   demand_empty_rest_of_line ();
@@ -3394,6 +3733,134 @@
   cons (bytes);
 }
 
+/* This handles the native word allocation pseudo-op .nword.
+   For sparc_arch_size 32 it is equivalent to .word,  for
+   sparc_arch_size 64 it is equivalent to .xword.  */
+
+static void
+s_ncons (bytes)
+     int bytes;
+{
+  cons (sparc_arch_size == 32 ? 4 : 8);
+}
+
+#ifdef OBJ_ELF
+/* Handle the SPARC ELF .register pseudo-op.  This sets the binding of a
+   global register.
+   The syntax is:
+   
+   .register %g[2367],{#scratch|symbolname|#ignore}
+   */
+
+static void
+s_register (ignore)
+     int ignore;
+{
+  char c;
+  int reg;
+  int flags;
+  const char *regname;
+
+  if (input_line_pointer[0] != '%'
+      || input_line_pointer[1] != 'g'
+      || ((input_line_pointer[2] & ~1) != '2'
+	  && (input_line_pointer[2] & ~1) != '6')
+      || input_line_pointer[3] != ',')
+    as_bad (_("register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}"));
+  reg = input_line_pointer[2] - '0';
+  input_line_pointer += 4;
+
+  if (*input_line_pointer == '#')
+    {
+      ++input_line_pointer;
+      regname = input_line_pointer;
+      c = get_symbol_end ();
+      if (strcmp (regname, "scratch") && strcmp (regname, "ignore"))
+	as_bad (_("register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}"));
+      if (regname [0] == 'i')
+	regname = NULL;
+      else
+	regname = "";
+    }
+  else
+    {
+      regname = input_line_pointer;
+      c = get_symbol_end ();
+    }
+  if (sparc_arch_size == 64)
+    {
+      if (globals [reg])
+	{
+	  if ((regname && globals [reg] != (symbolS *)1
+	       && strcmp (S_GET_NAME (globals [reg]), regname))
+	      || ((regname != NULL) ^ (globals [reg] != (symbolS *)1)))
+	    as_bad (_("redefinition of global register"));
+	}
+      else
+	{
+	  if (regname == NULL)
+	    globals [reg] = (symbolS *)1;
+	  else
+	    {
+	      if (*regname)
+		{
+		  if (symbol_find (regname))
+		    as_bad (_("Register symbol %s already defined."),
+			    regname);
+		}
+	      globals [reg] = symbol_make (regname);
+	      flags = symbol_get_bfdsym (globals [reg])->flags;
+	      if (! *regname)
+		flags = flags & ~(BSF_GLOBAL|BSF_LOCAL|BSF_WEAK);
+	      if (! (flags & (BSF_GLOBAL|BSF_LOCAL|BSF_WEAK)))
+		flags |= BSF_GLOBAL;
+	      symbol_get_bfdsym (globals [reg])->flags = flags;
+	      S_SET_VALUE (globals [reg], (valueT)reg);
+	      S_SET_ALIGN (globals [reg], reg);
+	      S_SET_SIZE (globals [reg], 0);
+	      /* Although we actually want undefined_section here,
+		 we have to use absolute_section, because otherwise
+		 generic as code will make it a COM section.
+		 We fix this up in sparc_adjust_symtab.  */
+	      S_SET_SEGMENT (globals [reg], absolute_section);
+	      S_SET_OTHER (globals [reg], 0);
+	      elf_symbol (symbol_get_bfdsym (globals [reg]))
+		->internal_elf_sym.st_info =
+		  ELF_ST_INFO(STB_GLOBAL, STT_REGISTER);
+	      elf_symbol (symbol_get_bfdsym (globals [reg]))
+		->internal_elf_sym.st_shndx = SHN_UNDEF;
+	    }
+	}
+    }
+
+  *input_line_pointer = c;
+
+  demand_empty_rest_of_line ();
+}
+
+/* Adjust the symbol table.  We set undefined sections for STT_REGISTER
+   symbols which need it.  */
+   
+void
+sparc_adjust_symtab ()
+{
+  symbolS *sym;
+     
+  for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
+    {
+      if (ELF_ST_TYPE (elf_symbol (symbol_get_bfdsym (sym))
+		       ->internal_elf_sym.st_info) != STT_REGISTER)
+	continue;
+
+      if (ELF_ST_TYPE (elf_symbol (symbol_get_bfdsym (sym))
+		       ->internal_elf_sym.st_shndx != SHN_UNDEF))
+	continue;
+
+      S_SET_SEGMENT (sym, undefined_section);
+    }
+}
+#endif
+
 /* If the --enforce-aligned-data option is used, we require .word,
    et. al., to be aligned correctly.  We do it by setting up an
    rs_align_code frag, and checking in HANDLE_ALIGN to make sure that
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index 2a05764..91fda22 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -35,6 +35,9 @@
 extern const char *sparc_target_format PARAMS ((void));
 #define TARGET_FORMAT sparc_target_format ()
 
+#define RELOC_EXPANSION_POSSIBLE
+#define MAX_RELOC_EXPANSION 2
+
 #if 0
 #ifdef TE_SPARCAOUT
 /* Bi-endian support may eventually be unconditional, but until things are
@@ -57,7 +60,7 @@
 
 #define md_do_align(n, fill, len, max, around)				\
 if ((n) && (n) <= 10 && !need_pass_2 && !(fill)				\
-    && now_seg != data_section && now_seg != bss_section)		\
+    && subseg_text_p (now_seg))						\
   {									\
     char *p;								\
     p = frag_var (rs_align_code, 1 << n, 1, (relax_substateT) 1024,	\
@@ -120,17 +123,32 @@
 /* Keep relocations against global symbols.  Don't turn them into
    relocations against sections.  This is required for the dynamic
    linker to operate properly.  When generating PIC, we need to keep
-   any non PC relative reloc.  */
+   any non PC relative reloc.  The PIC part of this test must be
+   parallel to the code in tc_gen_reloc which converts relocations to
+   GOT relocations.  */
 #define tc_fix_adjustable(FIX)						\
   (! S_IS_EXTERNAL ((FIX)->fx_addsy)					\
    && ! S_IS_WEAK ((FIX)->fx_addsy)					\
+   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT			\
+   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY			\
    && (! sparc_pic_code							\
-       || (FIX)->fx_pcrel						\
-       || ((FIX)->fx_subsy != NULL					\
-	   && (S_GET_SEGMENT ((FIX)->fx_subsy)				\
-	       == S_GET_SEGMENT ((FIX)->fx_addsy)))			\
-       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL		\
-       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
+       || ((FIX)->fx_r_type != BFD_RELOC_HI22				\
+	   && (FIX)->fx_r_type != BFD_RELOC_LO10			\
+	   && (FIX)->fx_r_type != BFD_RELOC_SPARC13			\
+	   && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2		\
+	       || (S_IS_DEFINED ((FIX)->fx_addsy)			\
+		   && ! S_IS_COMMON ((FIX)->fx_addsy)			\
+		   && ! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
+		   && ! S_IS_WEAK ((FIX)->fx_addsy)))			\
+	   && ((FIX)->fx_pcrel						\
+	       || ((FIX)->fx_subsy != NULL				\
+		   && (S_GET_SEGMENT ((FIX)->fx_subsy)			\
+		       == S_GET_SEGMENT ((FIX)->fx_addsy)))		\
+	       || S_IS_LOCAL ((FIX)->fx_addsy)))))
+
+/* Finish up the entire symtab.  */
+#define tc_adjust_symtab() sparc_adjust_symtab ()
+extern void sparc_adjust_symtab PARAMS ((void));
 #endif
 
 #ifdef OBJ_AOUT
@@ -161,4 +179,21 @@
 extern void cons_fix_new_sparc
   PARAMS ((struct frag *, int, unsigned int, struct expressionS *));
 
+#define TC_FIX_TYPE	valueT
+
+#define TC_INIT_FIX_DATA(X)			\
+  do						\
+     {						\
+       (X)->tc_fix_data = 0;			\
+     }						\
+  while(0)
+
+#define TC_FIX_DATA_PRINT(FILE, FIXP)					\
+  do									\
+    {									\
+      fprintf((FILE), "addend2=%ld\n",   				\
+	      (unsigned long) (FIXP)->tc_fix_data);			\
+    }									\
+  while(0)
+
 /* end of tc-sparc.h */
diff --git a/gas/config/tc-tahoe.c b/gas/config/tc-tahoe.c
index 2bd63ca..26a7524 100644
--- a/gas/config/tc-tahoe.c
+++ b/gas/config/tc-tahoe.c
@@ -1611,7 +1611,7 @@
   segT to_seg;			/* Target segment of the address.	 */
 
   register valueT this_add_number;
-  register struct symbol *this_add_symbol;	/* +ve (minuend) symbol. */
+  register symbolS *this_add_symbol;	/* +ve (minuend) symbol. */
 
   /*  tahoe_opcodeT opcode_as_number; fixme: remove this line *//* The opcode as a number. */
   char *opcodeP;		/* Where it is in a frag. */
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 61ed905..255c06a 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1,5 +1,5 @@
 /* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
-   Copyright (C) 1998 Free Software Foundation.
+   Copyright (C) 1998, 1999 Free Software Foundation.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    This file is part of GAS, the GNU Assembler.
@@ -1842,7 +1842,8 @@
 
   rel = (arelent *) xmalloc (sizeof (arelent));
   assert (rel != 0);
-  rel->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   rel->address = fixP->fx_frag->fr_address + fixP->fx_where;
   if (fixP->fx_pcrel)
     rel->addend = fixP->fx_addnumber;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index c8ab145..e53054d 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1,5 +1,5 @@
 /* tc-v850.c -- Assembler code for the NEC V850
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -297,7 +297,7 @@
 	}
     }
   
-  know (symbolP->sy_frag == & zero_address_frag);
+  know (symbol_get_frag (symbolP) == & zero_address_frag);
   
   if (*input_line_pointer != ',')
     have_align = 0;
@@ -323,7 +323,7 @@
 	    }
 	}
       
-      if (symbolP->local)
+      if (symbol_get_obj (symbolP)->local)
 	{
 	  segT   old_sec;
 	  int    old_subsec;
@@ -421,24 +421,24 @@
 	    {
 	    case AREA_SDA:
 	      if (S_GET_SEGMENT (symbolP) == sbss_section)
-		symbolP->sy_frag->fr_symbol = 0;
+		symbol_get_frag (symbolP)->fr_symbol = 0;
 	      break;
 
 	    case AREA_ZDA:
 	      if (S_GET_SEGMENT (symbolP) == zbss_section)
-		symbolP->sy_frag->fr_symbol = 0;
+		symbol_get_frag (symbolP)->fr_symbol = 0;
 	      break;
 
 	    case AREA_TDA:
 	      if (S_GET_SEGMENT (symbolP) == tbss_section)
-		symbolP->sy_frag->fr_symbol = 0;
+		symbol_get_frag (symbolP)->fr_symbol = 0;
 	      break;
 
 	    default:
-	      abort();
+	      abort ();
 	    }
 	  
-	  symbolP->sy_frag = frag_now;
+	  symbol_set_frag (symbolP, frag_now);
 	  pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
 			    (offsetT) size, (char *) 0);
 	  *pfrag = 0;
@@ -548,7 +548,7 @@
       goto allocate_common;
     }
 
-  symbolP->bsym->flags |= BSF_OBJECT;
+  symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
 
   demand_empty_rest_of_line ();
   return;
@@ -726,9 +726,9 @@
     {
       /* If the symbol is an alias for another name then use that.
 	 If the symbol is an alias for a number, then return the number.  */
-      if (symbolP->sy_value.X_op == O_symbol)
+      if (symbol_equated_p (symbolP))
 	{
-	  name = S_GET_NAME (symbolP->sy_value.X_add_symbol);
+	  name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
 	}
       else if (accept_numbers)
 	{
@@ -2243,7 +2243,8 @@
   arelent * reloc;
   
   reloc              = (arelent *) xmalloc (sizeof (arelent));
-  reloc->sym_ptr_ptr = & fixp->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address     = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto       = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
 
@@ -2259,7 +2260,7 @@
       return NULL;
     }
   
-  if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
+  if (   fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
       || fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
     reloc->addend = fixp->fx_offset;
   else
@@ -2289,16 +2290,14 @@
      segT   section;
 {
   /* If the symbol is undefined, or in a section other than our own,
+     or it is weak (in which case it may well be in another section,
      then let the linker figure it out.  */
   if (fixp->fx_addsy != (symbolS *) NULL
       && (! S_IS_DEFINED (fixp->fx_addsy)
+	  || S_IS_WEAK (fixp->fx_addsy)
 	  || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
-    {
-      /* The symbol is undefined/not in our section.
-	 Let the linker figure it out.  */
-      return 0;
-    }
-
+    return 0;
+  
   return fixp->fx_frag->fr_address + fixp->fx_where;
 }
 
@@ -2311,7 +2310,7 @@
   valueT value;
   char * where;
 
-  if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+  if (   fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
     {
       fixp->fx_done = 0;
@@ -2407,7 +2406,7 @@
    on the v850.  */
 void
 parse_cons_expression_v850 (exp)
-  expressionS *exp;
+  expressionS * exp;
 {
   /* See if there's a reloc prefix like hi() we have to handle.  */
   hold_cons_reloc = v850_reloc_prefix (NULL);
@@ -2421,7 +2420,7 @@
    appropriate one based on the size of the expression.  */
 void
 cons_fix_new_v850 (frag, where, size, exp)
-     fragS *frag;
+     fragS * frag;
      int where;
      int size;
      expressionS *exp;
@@ -2441,37 +2440,42 @@
   else
     fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
 }
+
 boolean
 v850_fix_adjustable (fixP)
-    fixS *fixP;
+    fixS * fixP;
 {
- 
   if (fixP->fx_addsy == NULL)
     return 1;
  
   /* Prevent all adjustments to global symbols. */
   if (S_IS_EXTERN (fixP->fx_addsy))
     return 0;
+  
   if (S_IS_WEAK (fixP->fx_addsy))
     return 0;
+  
   /* Don't adjust function names */
   if (S_IS_FUNCTION (fixP->fx_addsy))
     return 0;
 
   /* We need the symbol name for the VTABLE entries */
-  if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+  if (   fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
     return 0;
- 
+  
   return 1;
 }
  
 int
-v850_force_relocation (fixp)
-      struct fix *fixp;
+v850_force_relocation (fixP)
+      struct fix * fixP;
 {
-  if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
-      || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+  if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
+    return 1;
+  
+  if (   fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+      || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
     return 1;
  
   return 0;
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index 24e4a9b..f425ccc 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -1,5 +1,6 @@
 /* tc-vax.c - vax-specific -
-   Copyright (C) 1987, 91, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 91, 92, 93, 94, 95, 98, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -335,7 +336,7 @@
   segT to_seg;
   valueT this_add_number;
   /* Positive (minuend) symbol. */
-  struct symbol *this_add_symbol;
+  symbolS *this_add_symbol;
   /* As a number. */
   long opcode_as_number;
   /* Least significant byte 1st. */
diff --git a/gas/config/tc-w65.c b/gas/config/tc-w65.c
index 72201e7..e57eb0f 100644
--- a/gas/config/tc-w65.c
+++ b/gas/config/tc-w65.c
@@ -1081,7 +1081,7 @@
 
 void
 tc_coff_symbol_emit_hook (x)
-    struct symbol *x;
+    symbolS *x;
 {
 }
 
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 1611341..f89b14b 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1,5 +1,5 @@
 /* tc-z8k.c -- Assemble code for the Zilog Z800n
-   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1520,7 +1520,7 @@
 
 void
 tc_coff_symbol_emit_hook (s)
-     struct symbol *s;
+     symbolS *s;
 {
 }
 
diff --git a/gas/config/te-go32.h b/gas/config/te-go32.h
index 49fbd2e..085c958 100644
--- a/gas/config/te-go32.h
+++ b/gas/config/te-go32.h
@@ -12,5 +12,7 @@
 /* GAS should treat '.align value' as an alignment of 2**value */
 #define USE_ALIGN_PTWO
 
+#define COFF_LONG_SECTION_NAMES
+
 /* these define interfaces */
 #include "obj-format.h"
diff --git a/gas/config/te-interix.h b/gas/config/te-interix.h
new file mode 100644
index 0000000..073ad24
--- /dev/null
+++ b/gas/config/te-interix.h
@@ -0,0 +1,16 @@
+#define TE_PE_DYN /* PE with dynamic linking (UNIX shared lib) support */
+#define TE_PE
+#define LEX_AT 1 /* can have @'s inside labels */
+#define LEX_QM 3 /* can have ?'s in or begin labels */
+
+/* The PE format supports long section names.  */
+#define COFF_LONG_SECTION_NAMES
+
+#define GLOBAL_OFFSET_TABLE_NAME "__GLOBAL_OFFSET_TABLE_"
+
+/* Both architectures use these */
+#ifndef LOCAL_LABELS_FB
+#define LOCAL_LABELS_FB 1
+#endif
+
+#include "obj-format.h"
diff --git a/gas/config/te-multi.h b/gas/config/te-multi.h
deleted file mode 100644
index b8eda45..0000000
--- a/gas/config/te-multi.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is te-generic.h and is intended to be a template for
- * target environment specific header files.
- *
- * It is my intent that this file will evolve into a file suitable for config,
- * compile, and copying as an aid for testing and porting.  xoxorich.
- */
-
-/* Added these, because if we don't know what we're targetting we may
-   need an assembler version of libgcc, and that will use local
-   labels.  */
-#define LOCAL_LABELS_DOLLAR 1
-#define LOCAL_LABELS_FB 1
-
-/* these define interfaces */
-#ifdef OBJ_HEADER
-#include OBJ_HEADER
-#else
-#include "obj-format.h"
-#endif
-
-/* end of te-generic.h */
diff --git a/gas/config/te-wince-pe.h b/gas/config/te-wince-pe.h
new file mode 100644
index 0000000..d1193b8
--- /dev/null
+++ b/gas/config/te-wince-pe.h
@@ -0,0 +1,2 @@
+#define TE_WINCE
+#include "te-pe.h"
diff --git a/gas/configure b/gas/configure
index b8eefe4..665f8ac 100755
--- a/gas/configure
+++ b/gas/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
+# Generated automatically using autoconf version 2.13.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -16,8 +16,12 @@
 ac_help="$ac_help
   --enable-static[=PKGS]  build static libraries [default=yes]"
 ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
 ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+ac_help="$ac_help
   --enable-bfd-assembler  use BFD back end for writing object files"
 ac_help="$ac_help
     targets            alternative target configurations besides the primary"
@@ -352,7 +356,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
+    echo "configure generated by autoconf version 2.13.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -512,7 +516,7 @@
 
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -556,9 +560,130 @@
 if test -z "$ac_aux_dir"; then
   { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:570: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_host_alias=$host
+  case "$ac_cv_host_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      if ac_cv_host_alias=`$ac_config_guess`; then :
+      else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+      fi ;;
+    *) ac_cv_host_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+  ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:611: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_target_alias=$target
+  case "$ac_cv_target_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_target_alias=$host_alias ;;
+
+    *) ac_cv_target_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+  ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:651: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_build_alias=$build
+  case "$ac_cv_build_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_build_alias=$host_alias ;;
+
+    *) ac_cv_build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+  ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
 
 
 # Do some error checking and defaulting for the host and target type.
@@ -581,69 +706,6 @@
 *) { 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:592: 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:613: 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:631: 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, &&
@@ -662,9 +724,9 @@
 # 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:666: checking for a BSD compatible install" >&5
+echo "configure:728: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -682,6 +744,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -710,12 +776,12 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:719: checking whether build environment is sane" >&5
+echo "configure:785: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -763,18 +829,18 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:776: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:842: 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
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
@@ -801,7 +867,7 @@
 
 PACKAGE=gas
 
-VERSION=2.9.4
+VERSION=2.9.5
 
 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; }
@@ -818,7 +884,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:822: checking for working aclocal" >&5
+echo "configure:888: 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.
@@ -831,7 +897,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:835: checking for working autoconf" >&5
+echo "configure:901: 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.
@@ -844,7 +910,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:848: checking for working automake" >&5
+echo "configure:914: 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.
@@ -857,7 +923,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:861: checking for working autoheader" >&5
+echo "configure:927: 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.
@@ -870,7 +936,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:874: checking for working makeinfo" >&5
+echo "configure:940: 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.
@@ -930,11 +996,34 @@
   enable_static=yes
 fi
 
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  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
+else
+  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
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:937: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1026: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -963,8 +1052,8 @@
 # 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:967: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1056: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -993,8 +1082,8 @@
   # 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:997: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1086: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1040,12 +1129,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:1048: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1137: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1075,8 +1164,8 @@
   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:1080: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1169: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1087,12 +1176,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1091 "configure"
+#line 1180 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1185: \"$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
@@ -1117,14 +1206,14 @@
 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:1122: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1211: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:1127: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:1216: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -1132,7 +1221,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1136: \"$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:1225: \"$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
@@ -1151,8 +1240,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1155: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:1244: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -1190,18 +1279,23 @@
   with_gnu_ld=no
 fi
 
-
 ac_prog=ld
 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:1199: checking for ld used by GCC" >&5
+echo "configure:1287: 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]:\\*)
-    test -z "$LD" && LD="$ac_prog"
-    ;;
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
   "")
     # If it fails, then pretend we aren't using GCC.
     ac_prog=ld
@@ -1213,19 +1307,19 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1217: checking for GNU ld" >&5
+echo "configure:1311: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1220: checking for non-GNU ld" >&5
+echo "configure:1314: checking for non-GNU ld" >&5
 fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -1233,7 +1327,7 @@
       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
+	test "$with_gnu_ld" != yes && break
       fi
     fi
   done
@@ -1250,10 +1344,9 @@
   echo "$ac_t""no" 1>&6
 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:1256: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+echo "configure:1349: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
@@ -1268,29 +1361,31 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1272: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+echo "configure:1365: checking for BSD-compatible nm" >&5
+if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   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}:"
-  for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+  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; then
+    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"
+	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"
+	ac_cv_path_NM="$ac_dir/nm -p"
+	break
       else
-        ac_cv_path_NM="$ac_dir/nm"
+	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
-      break
     fi
   done
   IFS="$ac_save_ifs"
@@ -1301,10 +1396,9 @@
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1307: checking whether ln -s works" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+echo "configure:1401: checking whether ln -s works" >&5
+if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftestdata
@@ -1323,30 +1417,37 @@
   echo "$ac_t""no" 1>&6
 fi
 
-if test $host != $build; then
-  ac_tool_prefix=${host_alias}-
-else
-  ac_tool_prefix=
-fi
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
 
 # Check for any special flags to pass to ltconfig.
-libtool_flags=
+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 "$silent" = yes && libtool_flags="$libtool_flags --silent"
+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"
 
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1349 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1450 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1364,157 +1465,118 @@
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1472: checking whether the C compiler needs -belf" >&5
+if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1477 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1484: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  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
   ;;
 
-*-*-cygwin*)
-  # 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:1375: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1407: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  DLLTOOL="false"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1442: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1474: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  AS="false"
-fi
-fi
-
-
-  ;;
 
 esac
 
+
+# Save cache, so that ltconfig can load it
+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
+
+
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+      test -f "$cache_file" && . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+
+# 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'
+
 # Redirect the config.log output again, so that the ltconfig log is not
 # clobbered by the next message.
 exec 5>>./config.log
@@ -1557,15 +1619,30 @@
 
 
 
+# If we are on a DOS filesystem, we must use gdb.ini rather than
+# .gdbinit.
+GDBINIT=".gdbinit"
+case "${host}" in
+  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+    GDBINIT="gdb.ini"
+    ;;
+esac
+
+
 te_file=generic
 
 # Makefile target for installing gas in $(tooldir)/bin.
 install_tooldir=install-exec-tooldir
 
 canon_targets=""
+all_targets=no
 if test -n "$enable_targets" ; then
   for t in `echo $enable_targets | sed 's/,/ /g'`; do
-    result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
+    if test $t = "all"; then
+      all_targets=yes
+      continue
+    fi
+    result=`$ac_config_sub $t 2>/dev/null`
     if test -n "$result" ; then
       canon_targets="$canon_targets $result"
 #    else
@@ -1615,6 +1692,8 @@
       m8*)		cpu_type=m88k ;;
       mips*el)		cpu_type=mips endian=little ;;
       mips*)		cpu_type=mips endian=big ;;
+      pjl*)		cpu_type=pj endian=little ;;
+      pj*)		cpu_type=pj endian=big ;;
       powerpcle*)	cpu_type=ppc endian=little ;;
       powerpc*)		cpu_type=ppc endian=big ;;
       rs6000*)		cpu_type=ppc ;;
@@ -1659,14 +1738,18 @@
       arm-*-aout)	                fmt=aout ;;
       arm-*-coff | thumb-*-coff)        fmt=coff ;;
       arm-*-elf | thumb-*-elf)          fmt=elf ;;
+      arm*-*-conix*)			fmt=elf ;;
       arm-*-linux*aout*)	        fmt=aout em=linux ;;
-      arm-*-linux* | armv*-*-linux-gnu)	fmt=elf  em=linux ;;
+      arm*-*-linux-gnu*)		fmt=elf  em=linux ;;
       arm-*-netbsd*)	                fmt=aout em=nbsd bfd_gas=yes ;;
       arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
       arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
+      arm-*-wince)          fmt=coff em=wince-pe bfd_gas=yes;;
       arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
       arm-*-riscix*)	                fmt=aout em=riscix ;;
 
+      avr-*-*)		    fmt=elf bfd_gas=yes ;;
+
       d10v-*-*)		    fmt=elf bfd_gas=yes ;;
       d30v-*-*)		    fmt=elf bfd_gas=yes ;;
 
@@ -1674,6 +1757,7 @@
       fr30-*-*)		    fmt=elf bfd_gas=yes ;;
 
       hppa-*-*elf*)         fmt=elf em=hppa ;;
+      hppa-*-linux-gnu*)    fmt=elf em=hppa ;;
       hppa-*-lites*)        fmt=elf em=hppa ;;
       hppa-*-osf*)          fmt=som em=hppa ;;
       hppa-*-rtems*)        fmt=elf em=hppa ;;
@@ -1684,6 +1768,7 @@
 
       h8300-*-coff)         fmt=coff ;;
 
+      i370-*-elf* | i370-*-linux*) fmt=elf ;;
       i386-ibm-aix*)        fmt=coff em=i386aix ;;
       i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
       i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
@@ -1698,8 +1783,9 @@
       i386-*-lynxos*)       fmt=coff em=lynx ;;
       i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
 			    fmt=elf bfd_gas=yes ;;
-      i386-*-freebsdelf*)   fmt=elf bfd_gas=yes ;;
-      i386-*-freebsd*)      fmt=aout em=386bsd ;;
+      i386-*-freebsdaout* | i386-*-freebsd12.* | i386-*-freebsd12)
+                            fmt=aout em=386bsd ;;
+      i386-*-freebsd*)	    fmt=elf bfd_gas=yes ;;
       i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
                           fmt=coff ;;
       i386-*-sco3.2v5*)      fmt=elf
@@ -1714,6 +1800,7 @@
       i386-*-vsta)          fmt=aout ;;
       i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
 			    fmt=coff em=go32;;
+      i386-*-rtemself*)     fmt=elf ;;
       i386-*-rtems*)        fmt=coff ;;
       i386-*-gnu*)          fmt=elf ;;
       i386-*-mach*)
@@ -1722,8 +1809,10 @@
       i386-*-moss*)	    fmt=elf ;;
       i386-*-pe)            fmt=coff em=pe ;;
       i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
+      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
       i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
       i386-*-*nt*)          fmt=coff em=pe ;;
+      i386-*-vxworks*)      fmt=aout ;;
       i960-*-bout)          fmt=bout ;;
       i960-*-coff)          fmt=coff em=ic960 ;;
       i960-*-rtems*)        fmt=coff em=ic960 ;;
@@ -1732,6 +1821,7 @@
       i960-*-vxworks5.0)    fmt=bout ;;
       i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
       i960-*-vxworks*)      fmt=bout ;;
+      i960-*-elf*)	    fmt=elf ;;
 
       m32r-*-*)		    fmt=elf bfd_gas=yes ;;
 
@@ -1771,6 +1861,7 @@
       mips-*-osf*)          fmt=ecoff endian=little ;;
       mips-*-ecoff*)        fmt=ecoff ;;
       mips-*-ecoff*)        fmt=ecoff ;;
+      mips-*-pe*)           fmt=coff endian=little em=pe ;;
       mips-*-irix6*)	    fmt=elf ;;
       mips-*-irix5*)        fmt=elf ;;
       mips-*-irix*)         fmt=ecoff ;;
@@ -1787,6 +1878,7 @@
 			    ;;
       mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
       mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
+      pj*)		    fmt=elf ;;
       ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
 		            fmt=coff em=pe ;;
       ppc-*-aix*)           fmt=coff ;;
@@ -1814,9 +1906,12 @@
       ppc-*-macos* | ppc-*-mpw*)
 			    fmt=coff em=macos ;;
       ppc-*-netware*)       fmt=elf em=ppcnw ;;
+      ppc-*-vxworks*)       fmt=elf ;;
 
       sh-*-elf*)	    fmt=elf ;;
       sh-*-coff*)           fmt=coff ;;
+      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
+      sh-*-rtemself*)       fmt=elf ;;
       sh-*-rtems*)	    fmt=coff ;;
 
       ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
@@ -1902,6 +1997,10 @@
       *-elf)	bfd_gas=yes ;;
       *-ecoff)	bfd_gas=yes ;;
       *-som)	bfd_gas=yes ;;
+    #enable bfd for coff and aout to allow testing if a bfd target is
+    #the primary target, but not for coff or aout as the primary target
+      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
+      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
       *)		;;
     esac
 
@@ -2008,17 +2107,39 @@
       mips-*-*-elf)	case "$endian" in
 			big)	emulation="mipsbelf mipslelf mipself" ;;
 			*)	emulation="mipslelf mipsbelf mipself" ;;
-      # Uncommenting the next line will turn on support for i386 COFF
-      # in any i386 ELF configuration.  This probably doesn't work
-      # correctly.
-      # i386-*-*-elf)	emulation="i386coff i386elf" ;;
 			esac ;;
+      # Uncommenting the next line will turn on support for i386 AOUT
+      # for the default linux configuration
+      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
+      #
+      i386-*-aout)	emulation="i386aout" ;;
+      i386-*-coff)	emulation="i386coff" ;;
+      i386-*-elf)	emulation="i386elf" ;;
     esac
 
     emulations="$emulations $emulation"
 
 done
 
+# Turn on all targets if possible
+if test ${all_targets} = "yes"; then
+  case ${target_cpu_type} in
+  i386)
+    case ${obj_format} in
+    aout)
+      emulations="$emulations i386coff i386elf"
+      ;;
+    coff)
+      emulations="$emulations i386aout i386elf"
+    ;;
+    elf)
+      emulations="$emulations i386aout i386coff"
+      ;;
+    esac
+  ;;
+  esac
+fi
+
 # Assign floating point type.  Most processors with FP support
 # IEEE FP.  On those that don't support FP at all, usually IEEE
 # is emulated.
@@ -2129,6 +2250,8 @@
 	fmt=elf   file=mipself ;;
     mipsbecoff | mipslecoff)
 	fmt=ecoff file=mipsecoff ;;
+    i386aout)
+	fmt=aout  file=i386aout ;;
     i386coff)
 	fmt=coff  file=i386coff ;;
     i386elf)
@@ -2213,13 +2336,18 @@
   obj_format=multi
 fi
 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
-  te_file=multi
-  extra_objects="$extra_objects $emfiles"
   DEFAULT_EMULATION=`set . $emulations ; echo $2`
-  cat >> confdefs.h <<\EOF
+  # e-mips* has more than one emulation per file, e-i386* has just one at the
+  # moment.  If only one emulation is specified, then don't define
+  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
+  case "${obj_format}${emfiles}" in
+    multi* | *mips*)
+      extra_objects="$extra_objects $emfiles"
+      cat >> confdefs.h <<\EOF
 #define USE_EMULATIONS 1
 EOF
-
+ ;;
+  esac
 fi
 
 cat >> confdefs.h <<EOF
@@ -2305,8 +2433,8 @@
 # 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:2323: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:2437: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2335,8 +2463,8 @@
   # 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:2353: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:2467: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2382,12 +2510,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:2404: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:2518: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2417,8 +2545,8 @@
   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:2436: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:2550: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2429,12 +2557,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2447 "configure"
+#line 2561 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2566: \"$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
@@ -2459,14 +2587,14 @@
 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:2478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:2592: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:2483: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:2597: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -2474,7 +2602,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2492: \"$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:2606: \"$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
@@ -2493,8 +2621,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2511: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:2625: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -2530,8 +2658,8 @@
 # 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:2548: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+echo "configure:2662: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_YACC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$YACC"; then
@@ -2561,13 +2689,13 @@
 test -n "$YACC" || YACC="yacc"
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2579: checking how to run the C preprocessor" >&5
+echo "configure:2693: 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
+if eval "test \"\${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
@@ -2576,13 +2704,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2594 "configure"
+#line 2708 "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:2600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2714: \"$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
   :
@@ -2593,13 +2721,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2611 "configure"
+#line 2725 "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:2617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2731: \"$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
   :
@@ -2610,13 +2738,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2628 "configure"
+#line 2742 "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:2634: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2748: \"$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
   :
@@ -2646,8 +2774,8 @@
 # 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:2664: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+echo "configure:2778: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_LEX+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LEX"; then
@@ -2679,8 +2807,8 @@
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2697: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+echo "configure:2811: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_LEX+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LEX"; then
@@ -2713,15 +2841,15 @@
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:2731: checking for yywrap in -l$ac_lib" >&5
-ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo "configure:2845: checking for yywrap in -l$ac_lib" >&5
+ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2739 "configure"
+#line 2853 "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
@@ -2732,7 +2860,7 @@
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:2750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2864: \"$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
@@ -2755,8 +2883,8 @@
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:2773: checking lex output file root" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
+echo "configure:2887: checking lex output file root" >&5
+if eval "test \"\${ac_cv_prog_lex_root+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # The minimal lex program is just a single line: %%.  But some broken lexes
@@ -2776,8 +2904,8 @@
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:2794: checking whether yytext is a pointer" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
+echo "configure:2908: checking whether yytext is a pointer" >&5
+if eval "test \"\${ac_cv_prog_lex_yytext_pointer+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
@@ -2788,14 +2916,14 @@
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 2806 "configure"
+#line 2920 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
@@ -2819,7 +2947,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:2837: checking for POSIXized ISC" >&5
+echo "configure:2951: 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
@@ -2840,12 +2968,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2858: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+echo "configure:2972: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2863 "configure"
+#line 2977 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2853,7 +2981,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2985: \"$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*
@@ -2870,7 +2998,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 2888 "configure"
+#line 3002 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2888,7 +3016,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 2906 "configure"
+#line 3020 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2909,7 +3037,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2927 "configure"
+#line 3041 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2920,7 +3048,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2944,12 +3072,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2962: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+echo "configure:3076: checking for working const" >&5
+if eval "test \"\${ac_cv_c_const+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2967 "configure"
+#line 3081 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2998,7 +3126,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3019,21 +3147,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3037: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+echo "configure:3151: checking for inline" >&5
+if eval "test \"\${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 3044 "configure"
+#line 3158 "configure"
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:3051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -3059,12 +3187,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3077: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+echo "configure:3191: checking for off_t" >&5
+if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3082 "configure"
+#line 3196 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3075,29 +3203,31 @@
 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
+  eval "ac_cv_type_off_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_off_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'off_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define off_t long
 EOF
 
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3110: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+echo "configure:3226: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3115 "configure"
+#line 3231 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3108,17 +3238,19 @@
 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
+  eval "ac_cv_type_size_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_size_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define size_t unsigned
 EOF
 
@@ -3127,19 +3259,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:3145: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+echo "configure:3263: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3150 "configure"
+#line 3268 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:3157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3275: \"$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
@@ -3160,12 +3292,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3178: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+echo "configure:3296: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3183 "configure"
+#line 3301 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -3193,7 +3325,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:3211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3329: \"$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
@@ -3225,12 +3357,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3243: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+echo "configure:3361: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3248 "configure"
+#line 3366 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -3255,12 +3387,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:3273: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3391: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3278 "configure"
+#line 3396 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3269,6 +3401,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3278,12 +3411,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3420: \"$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
@@ -3310,15 +3443,15 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3328: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo "configure:3447: checking stack direction for C alloca" >&5
+if eval "test \"\${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 3336 "configure"
+#line 3455 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -3337,7 +3470,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:3355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3474: \"$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
@@ -3362,17 +3495,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3380: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3499: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3385 "configure"
+#line 3504 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3390: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3509: \"$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*
@@ -3401,12 +3534,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3419: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3538: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3424 "configure"
+#line 3543 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3415,6 +3548,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3424,12 +3558,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3567: \"$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
@@ -3454,15 +3588,15 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3472: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+echo "configure:3592: checking for working mmap" >&5
+if eval "test \"\${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 3480 "configure"
+#line 3600 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3602,7 +3736,7 @@
 }
 
 EOF
-if { (eval echo configure:3620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3740: \"$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
@@ -3630,17 +3764,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3648: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3768: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3653 "configure"
+#line 3773 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3778: \"$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*
@@ -3670,12 +3804,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3688: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3808: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3693 "configure"
+#line 3813 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3684,6 +3818,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3693,12 +3828,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3837: \"$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
@@ -3727,12 +3862,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3745: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3866: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3750 "configure"
+#line 3871 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3741,6 +3876,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3750,12 +3886,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3895: \"$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
@@ -3789,19 +3925,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3807: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+echo "configure:3929: checking for LC_MESSAGES" >&5
+if eval "test \"\${am_cv_val_LC_MESSAGES+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3812 "configure"
+#line 3934 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3941: \"$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
@@ -3822,7 +3958,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3840: checking whether NLS is requested" >&5
+echo "configure:3962: 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"
@@ -3842,7 +3978,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3860: checking whether included gettext is requested" >&5
+echo "configure:3982: 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"
@@ -3861,17 +3997,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3879: checking for libintl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4001: checking for libintl.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3884 "configure"
+#line 4006 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4011: \"$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*
@@ -3888,19 +4024,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:3906: checking for gettext in libc" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+echo "configure:4028: checking for gettext in libc" >&5
+if eval "test \"\${gt_cv_func_gettext_libc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3911 "configure"
+#line 4033 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4040: \"$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
@@ -3916,15 +4052,15 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3934: 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 "configure:4056: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 3942 "configure"
+#line 4064 "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
@@ -3935,7 +4071,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4075: \"$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
@@ -3951,19 +4087,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:3969: checking for gettext in libintl" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+echo "configure:4091: checking for gettext in libintl" >&5
+if eval "test \"\${gt_cv_func_gettext_libintl+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3974 "configure"
+#line 4096 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4103: \"$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
@@ -3991,8 +4127,8 @@
 	      # 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:4009: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:4131: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -4025,12 +4161,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4043: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:4165: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4048 "configure"
+#line 4170 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4039,6 +4175,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4048,12 +4185,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4194: \"$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
@@ -4080,8 +4217,8 @@
 		# 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:4098: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:4221: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -4116,8 +4253,8 @@
 		# 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:4134: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:4257: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -4148,7 +4285,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 4166 "configure"
+#line 4289 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4156,7 +4293,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -4188,8 +4325,8 @@
         # 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:4206: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:4329: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -4222,8 +4359,8 @@
         # 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:4240: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:4363: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -4258,8 +4395,8 @@
         # 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:4276: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:4399: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -4348,7 +4485,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4366: checking for catalogs to be installed" >&5
+echo "configure:4489: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -4376,17 +4513,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:4394: checking for linux/version.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4517: checking for linux/version.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4399 "configure"
+#line 4522 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4527: \"$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*
@@ -4449,7 +4586,7 @@
   
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4467: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:4590: 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"
@@ -4472,12 +4609,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:4490: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+echo "configure:4613: checking for Cygwin environment" >&5
+if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4495 "configure"
+#line 4618 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4488,7 +4625,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:4506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -4498,26 +4635,25 @@
   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:4523: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+echo "configure:4645: checking for mingw32 environment" >&5
+if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4528 "configure"
+#line 4650 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:4535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -4527,29 +4663,57 @@
   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 EMX OS/2 environment""... $ac_c" 1>&6
+echo "configure:4673: checking for EMX OS/2 environment" >&5
+if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4678 "configure"
+#include "confdefs.h"
+
+int main() {
+return __EMX__;
+; return 0; }
+EOF
+if { (eval echo configure:4685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_emxos2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_emxos2=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_emxos2" 1>&6
+EMXOS2=
+test "$ac_cv_emxos2" = yes && EMXOS2=yes
+
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4554: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+echo "configure:4704: checking for executable suffix" >&5
+if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = 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:4564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:4714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.C | *.o | *.obj | *.xcoff) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -4571,17 +4735,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4589: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4739: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4594 "configure"
+#line 4744 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4749: \"$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*
@@ -4611,7 +4775,7 @@
 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
 # people who are not cross-compiling but are compiling cross-assemblers.
 echo $ac_n "checking whether compiling a cross-assembler""... $ac_c" 1>&6
-echo "configure:4629: checking whether compiling a cross-assembler" >&5
+echo "configure:4779: checking whether compiling a cross-assembler" >&5
 if test "${host}" = "${target}"; then
   cross_gas=no
 else
@@ -4626,19 +4790,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:4644: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+echo "configure:4794: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4649 "configure"
+#line 4799 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:4656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4806: \"$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
@@ -4659,12 +4823,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4677: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+echo "configure:4827: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4682 "configure"
+#line 4832 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -4692,7 +4856,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:4710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4860: \"$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
@@ -4724,12 +4888,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4742: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+echo "configure:4892: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4747 "configure"
+#line 4897 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -4754,12 +4918,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:4772: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:4922: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4777 "configure"
+#line 4927 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4768,6 +4932,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4777,12 +4942,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4951: \"$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
@@ -4809,15 +4974,15 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:4827: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo "configure:4978: checking stack direction for C alloca" >&5
+if eval "test \"\${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 4835 "configure"
+#line 4986 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -4836,7 +5001,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:4854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5005: \"$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
@@ -4858,21 +5023,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:4876: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+echo "configure:5027: checking for inline" >&5
+if eval "test \"\${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 4883 "configure"
+#line 5034 "configure"
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:4890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -4902,12 +5067,12 @@
 for ac_func in unlink remove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4920: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:5071: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4925 "configure"
+#line 5076 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4916,6 +5081,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4925,12 +5091,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5100: \"$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
@@ -4959,12 +5125,12 @@
 for ac_func in sbrk
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4977: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:5129: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4982 "configure"
+#line 5134 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4973,6 +5139,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4982,12 +5149,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5158: \"$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
@@ -5016,12 +5183,12 @@
 # enough, but on some of those systems, the assert macro relies on requoting
 # working properly!
 echo $ac_n "checking for working assert macro""... $ac_c" 1>&6
-echo "configure:5034: checking for working assert macro" >&5
-if eval "test \"`echo '$''{'gas_cv_assert_ok'+set}'`\" = set"; then
+echo "configure:5187: checking for working assert macro" >&5
+if eval "test \"\${gas_cv_assert_ok+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5039 "configure"
+#line 5192 "configure"
 #include "confdefs.h"
 #include <assert.h>
 #include <stdio.h>
@@ -5037,7 +5204,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_assert_ok=yes
 else
@@ -5078,12 +5245,12 @@
 "
 
 echo $ac_n "checking whether declaration is required for strstr""... $ac_c" 1>&6
-echo "configure:5096: checking whether declaration is required for strstr" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_strstr'+set}'`\" = set"; then
+echo "configure:5249: checking whether declaration is required for strstr" >&5
+if eval "test \"\${gas_cv_decl_needed_strstr+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5101 "configure"
+#line 5254 "configure"
 #include "confdefs.h"
 $gas_test_headers
 int main() {
@@ -5094,7 +5261,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_strstr=no
 else
@@ -5115,12 +5282,12 @@
 
 
 echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&6
-echo "configure:5133: checking whether declaration is required for malloc" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then
+echo "configure:5286: checking whether declaration is required for malloc" >&5
+if eval "test \"\${gas_cv_decl_needed_malloc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5138 "configure"
+#line 5291 "configure"
 #include "confdefs.h"
 $gas_test_headers
 int main() {
@@ -5131,7 +5298,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_malloc=no
 else
@@ -5152,12 +5319,12 @@
 
 
 echo $ac_n "checking whether declaration is required for free""... $ac_c" 1>&6
-echo "configure:5170: checking whether declaration is required for free" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_free'+set}'`\" = set"; then
+echo "configure:5323: checking whether declaration is required for free" >&5
+if eval "test \"\${gas_cv_decl_needed_free+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5175 "configure"
+#line 5328 "configure"
 #include "confdefs.h"
 $gas_test_headers
 int main() {
@@ -5168,7 +5335,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_free=no
 else
@@ -5189,12 +5356,12 @@
 
 
 echo $ac_n "checking whether declaration is required for sbrk""... $ac_c" 1>&6
-echo "configure:5207: checking whether declaration is required for sbrk" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_sbrk'+set}'`\" = set"; then
+echo "configure:5360: checking whether declaration is required for sbrk" >&5
+if eval "test \"\${gas_cv_decl_needed_sbrk+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5212 "configure"
+#line 5365 "configure"
 #include "confdefs.h"
 $gas_test_headers
 int main() {
@@ -5205,7 +5372,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_sbrk=no
 else
@@ -5226,12 +5393,12 @@
 
 
 echo $ac_n "checking whether declaration is required for environ""... $ac_c" 1>&6
-echo "configure:5244: checking whether declaration is required for environ" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_environ'+set}'`\" = set"; then
+echo "configure:5397: checking whether declaration is required for environ" >&5
+if eval "test \"\${gas_cv_decl_needed_environ+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5249 "configure"
+#line 5402 "configure"
 #include "confdefs.h"
 $gas_test_headers
 int main() {
@@ -5242,7 +5409,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_environ=no
 else
@@ -5266,12 +5433,12 @@
 # for it?
 
 echo $ac_n "checking whether declaration is required for errno""... $ac_c" 1>&6
-echo "configure:5284: checking whether declaration is required for errno" >&5
-if eval "test \"`echo '$''{'gas_cv_decl_needed_errno'+set}'`\" = set"; then
+echo "configure:5437: checking whether declaration is required for errno" >&5
+if eval "test \"\${gas_cv_decl_needed_errno+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5289 "configure"
+#line 5442 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_ERRNO_H
@@ -5286,7 +5453,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gas_cv_decl_needed_errno=no
 else
@@ -5398,7 +5565,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.13"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -5409,7 +5576,7 @@
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile doc/Makefile .gdbinit:gdbinit.in po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -5469,12 +5636,9 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
 s%@LN_S@%$LN_S%g
 s%@LIBTOOL@%$LIBTOOL%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@AS@%$AS%g
+s%@GDBINIT@%$GDBINIT%g
 s%@cgen_cpu_prefix@%$cgen_cpu_prefix%g
 s%@extra_objects@%$extra_objects%g
 s%@target_cpu_type@%$target_cpu_type%g
@@ -5556,7 +5720,7 @@
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile .gdbinit:gdbinit.in po/Makefile.in:po/Make-in"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -5746,5 +5910,5 @@
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
 
diff --git a/gas/configure.bat b/gas/configure.bat
deleted file mode 100644
index 1fd269f..0000000
--- a/gas/configure.bat
+++ /dev/null
@@ -1,57 +0,0 @@
-@echo off

-if "%1" == "h8/300" goto h8300

-

-echo Configuring gas for go32

-update config/tc-i386.c targ-cpu.c

-update config/tc-i386.h targ-cpu.h

-update config/te-go32.h targ-env.h

-update config/obj-coff.h obj-format.h

-update config/obj-coff.c obj-format.c

-update config/atof-ieee.c atof-targ.c

-goto common

-

-:h8300

-echo Configuring gas for H8/300

-copy config\ho-go32.h host.h

-copy config\tc-h8300.c targ-cpu.c

-copy config\tc-h8300.h targ-cpu.h

-copy config\te-generic.h targ-env.h

-copy config\objcoffbfd.h obj-format.h

-copy config\objcoffbfd.c obj-format.c

-copy config\atof-ieee.c atof-targ.c

-

-:common

-

-echo # Makefile generated by "configure.bat"> Makefile.2

-echo all.dos : as.new gasp.new>> Makefile.2

-

-if exist config.sed del config.sed

-

-echo "s/@srcdir@/./g					">> config.sed

-echo "s/@target_alias@/go32/				">> config.sed

-echo "s/@prefix@//					">> config.sed

-echo "s/@CC@/gcc/g					">> config.sed

-echo "s/@OPCODES_LIB@/..\/opcodes\/libopcodes.a/g	">> config.sed

-echo "s/@BFDLIB@/..\/bfd\/libbfd.a/g			">> config.sed

-echo "s/@ALL_OBJ_DEPS@/..\/bfd\/bfd.h/g			">> config.sed

-

-echo "/^all[ 	]*:/ a\					">> config.sed

-echo "dummy:						">> config.sed

-

-echo "s/\/usr[^ ]*.h//g					">> config.sed

-

-echo "/^config.h[ 	]*:/ d				">> config.sed

-echo "s/^Makefile/not-Makefile/				">> config.sed

-

-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ 	]*$//" config.sed > config2.sed

-sed -f config2.sed Makefile.in >> Makefile.2

-update Makefile.2 Makefile

-del Makefile.2

-del config.sed

-del config2.sed

-

-echo #ifndef GAS_VERSION> config.new

-sed -n "/^VERSION=/p" Makefile.in | sed -e "s/VERSION=/#define GAS_VERSION \"/" -e "s/$/\"/">> config.new

-type config\go32.cfg >> config.new

-echo #endif>> config.new

-update config.new config.h

diff --git a/gas/configure.in b/gas/configure.in
index 4d847ba..8ee42a6 100644
--- a/gas/configure.in
+++ b/gas/configure.in
@@ -10,7 +10,7 @@
 
 AC_CANONICAL_SYSTEM
 
-AM_INIT_AUTOMAKE(gas, 2.9.4)
+AM_INIT_AUTOMAKE(gas, 2.9.5)
 
 AM_PROG_LIBTOOL
 
@@ -43,15 +43,30 @@
 # Generate a header file
 AM_CONFIG_HEADER(config.h:config.in)
 
+# If we are on a DOS filesystem, we must use gdb.ini rather than
+# .gdbinit.
+GDBINIT=".gdbinit"
+case "${host}" in
+  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+    GDBINIT="gdb.ini"
+    ;;
+esac
+AC_SUBST(GDBINIT)
+
 te_file=generic
 
 # Makefile target for installing gas in $(tooldir)/bin.
 install_tooldir=install-exec-tooldir
 
 canon_targets=""
+all_targets=no
 if test -n "$enable_targets" ; then
   for t in `echo $enable_targets | sed 's/,/ /g'`; do
-    result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
+    if test $t = "all"; then
+      all_targets=yes
+      continue
+    fi
+    result=`$ac_config_sub $t 2>/dev/null`
     if test -n "$result" ; then
       canon_targets="$canon_targets $result"
 #    else
@@ -93,6 +108,8 @@
       m8*)		cpu_type=m88k ;;
       mips*el)		cpu_type=mips endian=little ;;
       mips*)		cpu_type=mips endian=big ;;
+      pjl*)		cpu_type=pj endian=little ;;
+      pj*)		cpu_type=pj endian=big ;;
       powerpcle*)	cpu_type=ppc endian=little ;;
       powerpc*)		cpu_type=ppc endian=big ;;
       rs6000*)		cpu_type=ppc ;;
@@ -137,14 +154,18 @@
       arm-*-aout)	                fmt=aout ;;
       arm-*-coff | thumb-*-coff)        fmt=coff ;;
       arm-*-elf | thumb-*-elf)          fmt=elf ;;
+      arm*-*-conix*)			fmt=elf ;;
       arm-*-linux*aout*)	        fmt=aout em=linux ;;
-      arm-*-linux* | armv*-*-linux-gnu)	fmt=elf  em=linux ;;
+      arm*-*-linux-gnu*)		fmt=elf  em=linux ;;
       arm-*-netbsd*)	                fmt=aout em=nbsd bfd_gas=yes ;;
       arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
       arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
+      arm-*-wince)          fmt=coff em=wince-pe bfd_gas=yes;;
       arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
       arm-*-riscix*)	                fmt=aout em=riscix ;;
 
+      avr-*-*)		    fmt=elf bfd_gas=yes ;;
+
       d10v-*-*)		    fmt=elf bfd_gas=yes ;;
       d30v-*-*)		    fmt=elf bfd_gas=yes ;;
 
@@ -152,6 +173,7 @@
       fr30-*-*)		    fmt=elf bfd_gas=yes ;;
 
       hppa-*-*elf*)         fmt=elf em=hppa ;;
+      hppa-*-linux-gnu*)    fmt=elf em=hppa ;;
       hppa-*-lites*)        fmt=elf em=hppa ;;
       hppa-*-osf*)          fmt=som em=hppa ;;
       hppa-*-rtems*)        fmt=elf em=hppa ;;
@@ -162,6 +184,7 @@
 
       h8300-*-coff)         fmt=coff ;;
 
+      i370-*-elf* | i370-*-linux*) fmt=elf ;;
       i386-ibm-aix*)        fmt=coff em=i386aix ;;
       i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
       i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
@@ -176,8 +199,9 @@
       i386-*-lynxos*)       fmt=coff em=lynx ;;
       i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
 			    fmt=elf bfd_gas=yes ;;
-      i386-*-freebsdelf*)   fmt=elf bfd_gas=yes ;;
-      i386-*-freebsd*)      fmt=aout em=386bsd ;;
+      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
+                            fmt=aout em=386bsd ;;
+      i386-*-freebsd*)	    fmt=elf bfd_gas=yes ;;
       i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
                           fmt=coff ;;
       i386-*-sco3.2v5*)      fmt=elf
@@ -190,6 +214,7 @@
       i386-*-vsta)          fmt=aout ;;
       i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
 			    fmt=coff em=go32;;
+      i386-*-rtemself*)     fmt=elf ;;
       i386-*-rtems*)        fmt=coff ;;
       i386-*-gnu*)          fmt=elf ;;
       i386-*-mach*)
@@ -198,8 +223,10 @@
       i386-*-moss*)	    fmt=elf ;;
       i386-*-pe)            fmt=coff em=pe ;;
       i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
+      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
       i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
       i386-*-*nt*)          fmt=coff em=pe ;;
+      i386-*-vxworks*)      fmt=aout ;;
       i960-*-bout)          fmt=bout ;;
       i960-*-coff)          fmt=coff em=ic960 ;;
       i960-*-rtems*)        fmt=coff em=ic960 ;;
@@ -208,6 +235,7 @@
       i960-*-vxworks5.0)    fmt=bout ;;
       i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
       i960-*-vxworks*)      fmt=bout ;;
+      i960-*-elf*)	    fmt=elf ;;
 
       m32r-*-*)		    fmt=elf bfd_gas=yes ;;
 
@@ -247,6 +275,7 @@
       mips-*-osf*)          fmt=ecoff endian=little ;;
       mips-*-ecoff*)        fmt=ecoff ;;
       mips-*-ecoff*)        fmt=ecoff ;;
+      mips-*-pe*)           fmt=coff endian=little em=pe ;;
       mips-*-irix6*)	    fmt=elf ;;
       mips-*-irix5*)        fmt=elf ;;
       mips-*-irix*)         fmt=ecoff ;;
@@ -261,6 +290,7 @@
 			    ;;
       mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
       mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
+      pj*)		    fmt=elf ;;
       ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
 		            fmt=coff em=pe ;;
       ppc-*-aix*)           fmt=coff ;;
@@ -286,9 +316,12 @@
       ppc-*-macos* | ppc-*-mpw*)
 			    fmt=coff em=macos ;;
       ppc-*-netware*)       fmt=elf em=ppcnw ;;
+      ppc-*-vxworks*)       fmt=elf ;;
 
       sh-*-elf*)	    fmt=elf ;;
       sh-*-coff*)           fmt=coff ;;
+      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
+      sh-*-rtemself*)       fmt=elf ;;
       sh-*-rtems*)	    fmt=coff ;;
 
       ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
@@ -372,6 +405,10 @@
       *-elf)	bfd_gas=yes ;;
       *-ecoff)	bfd_gas=yes ;;
       *-som)	bfd_gas=yes ;;
+    #enable bfd for coff and aout to allow testing if a bfd target is
+    #the primary target, but not for coff or aout as the primary target
+      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
+      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
       *)		;;
     esac
 
@@ -475,17 +512,39 @@
       mips-*-*-elf)	case "$endian" in
 			big)	emulation="mipsbelf mipslelf mipself" ;;
 			*)	emulation="mipslelf mipsbelf mipself" ;;
-      # Uncommenting the next line will turn on support for i386 COFF
-      # in any i386 ELF configuration.  This probably doesn't work
-      # correctly.
-      # i386-*-*-elf)	emulation="i386coff i386elf" ;;
 			esac ;;
+      # Uncommenting the next line will turn on support for i386 AOUT
+      # for the default linux configuration
+      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
+      #
+      i386-*-aout)	emulation="i386aout" ;;
+      i386-*-coff)	emulation="i386coff" ;;
+      i386-*-elf)	emulation="i386elf" ;;
     esac
 
     emulations="$emulations $emulation"
 
 done
 
+# Turn on all targets if possible
+if test ${all_targets} = "yes"; then
+  case ${target_cpu_type} in
+  i386)
+    case ${obj_format} in
+    aout)
+      emulations="$emulations i386coff i386elf"
+      ;;
+    coff)
+      emulations="$emulations i386aout i386elf"
+    ;;
+    elf)
+      emulations="$emulations i386aout i386coff"
+      ;;
+    esac
+  ;;
+  esac
+fi
+
 # Assign floating point type.  Most processors with FP support
 # IEEE FP.  On those that don't support FP at all, usually IEEE
 # is emulated.
@@ -575,6 +634,8 @@
 	fmt=elf   file=mipself ;;
     mipsbecoff | mipslecoff)
 	fmt=ecoff file=mipsecoff ;;
+    i386aout)
+	fmt=aout  file=i386aout ;;
     i386coff)
 	fmt=coff  file=i386coff ;;
     i386elf)
@@ -605,10 +666,15 @@
   obj_format=multi
 fi
 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
-  te_file=multi
-  extra_objects="$extra_objects $emfiles"
   DEFAULT_EMULATION=`set . $emulations ; echo $2`
-  AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?])
+  # e-mips* has more than one emulation per file, e-i386* has just one at the
+  # moment.  If only one emulation is specified, then don't define
+  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
+  case "${obj_format}${emfiles}" in
+    multi* | *mips*)
+      extra_objects="$extra_objects $emfiles"
+      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
+  esac
 fi
 AC_SUBST(extra_objects)
 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
@@ -749,7 +815,7 @@
 dnl the old symlinks don't exist, so that a reconfigure in an existing
 dnl directory behaves reasonably.
 
-AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in po/Makefile.in:po/Make-in,
+AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
  echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
  echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
diff --git a/gas/dep-in.sed b/gas/dep-in.sed
index c07f969..8771f0f 100644
--- a/gas/dep-in.sed
+++ b/gas/dep-in.sed
@@ -18,7 +18,6 @@
 s! targ-cpu.h!!g
 s! flonum.h!!g
 s! expr.h!!g
-s! struc-symbol.h!!g
 s! write.h!!g
 s! frags.h!!g
 s! hash.h!!g
diff --git a/gas/doc/Makefile.am b/gas/doc/Makefile.am
index eaf5a4a..c6eaf77 100644
--- a/gas/doc/Makefile.am
+++ b/gas/doc/Makefile.am
@@ -22,11 +22,14 @@
 	c-h8300.texi \
 	c-h8500.texi \
 	c-hppa.texi \
+	c-i370.texi \
 	c-i386.texi \
 	c-i960.texi \
+	c-m32r.texi \
 	c-m68k.texi \
 	c-mips.texi \
 	c-ns32k.texi \
+	c-pj.texi \
 	c-sh.texi \
 	c-sparc.texi \
 	c-vax.texi \
diff --git a/gas/doc/Makefile.in b/gas/doc/Makefile.in
index 5f4d1a5..f9fed15 100644
--- a/gas/doc/Makefile.in
+++ b/gas/doc/Makefile.in
@@ -72,6 +72,7 @@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
 EXEEXT = @EXEEXT@
+GDBINIT = @GDBINIT@
 GMOFILES = @GMOFILES@
 GMSGFMT = @GMSGFMT@
 GT_NO = @GT_NO@
@@ -81,7 +82,6 @@
 INTLDEPS = @INTLDEPS@
 INTLLIBS = @INTLLIBS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LEX = @LEX@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
@@ -89,7 +89,7 @@
 MAKEINFO = @MAKEINFO@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 OPCODES_LIB = @OPCODES_LIB@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
@@ -97,7 +97,6 @@
 RANLIB = @RANLIB@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 YACC = @YACC@
 atof = @atof@
@@ -125,11 +124,14 @@
 	c-h8300.texi \
 	c-h8500.texi \
 	c-hppa.texi \
+	c-i370.texi \
 	c-i386.texi \
 	c-i960.texi \
+	c-m32r.texi \
 	c-m68k.texi \
 	c-mips.texi \
 	c-ns32k.texi \
+	c-pj.texi \
 	c-sh.texi \
 	c-sparc.texi \
 	c-vax.texi \
@@ -161,7 +163,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
 .SUFFIXES:
@@ -342,7 +344,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff --git a/gas/doc/all.texi b/gas/doc/all.texi
index 9b90c5b..d1058fb 100644
--- a/gas/doc/all.texi
+++ b/gas/doc/all.texi
@@ -1,4 +1,4 @@
-@c Copyright 1992, 1993 Free Software Foundation, Inc.
+@c Copyright 1992, 1993, 2000 Free Software Foundation, Inc.
 @c This file is part of the documentation for the GAS manual
 
 @c Configuration settings for all-inclusive version of manual
@@ -32,19 +32,21 @@
 @set D30V
 @set H8/300
 @set H8/500
-@set SH
+@set HPPA
+@set I370
 @set I80386
 @set I960
-@set MCORE
-@set MIPS
 @set M32R
 @set M680X0
-@set Z8000
+@set MCORE
+@set MIPS
+@set PJ
+@set SH
 @set SPARC
+@set V850
 @set VAX
 @set VXWORKS
-@set HPPA
-@set V850
+@set Z8000
 
 @c Does this version of the assembler use the difference-table kluge?
 @set DIFF-TBL-KLUGE
diff --git a/gas/doc/as.1 b/gas/doc/as.1
index adf2886..08d5805 100644
--- a/gas/doc/as.1
+++ b/gas/doc/as.1
@@ -195,8 +195,14 @@
 .B as\c
 \& version
 .TP
-.B \-W
-Suppress warning messages
+.B \-W, \-\-no-warn
+Suppress warning messages.
+.TP
+.B \-\-fatal\-warnings
+Consider warnings to be fatal.
+.TP
+.B \-\-warn
+Just warn on warnings.
 .TP
 .IR "\-\^\-" "\ |\ " "files\|.\|.\|."
 Source files to assemble, or standard input (\c
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index afe362a..5917a00 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -1,5 +1,5 @@
 \input texinfo @c                               -*-Texinfo-*-
-@c  Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998
+@c  Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 2000
 @c  Free Software Foundation, Inc.
 @c UPDATE!!  On future updates--
 @c   (1)   check for new machine-dep cmdline options in
@@ -202,9 +202,10 @@
 @c to be limited to one line for the header.
 @smallexample
 @value{AS} [ -a[cdhlns][=file] ] [ -D ]  [ --defsym @var{sym}=@var{val} ]
- [ -f ] [ --gstabs ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ]
+ [ -f ] [ --gstabs ] [ --gdwarf2 ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ]
  [ --keep-locals ] [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ]
- [ -version ] [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ]
+ [ -version ] [ --version ] [ -W ] [ --warn ] [ --fatal-warnings ] 
+ [ -w ] [ -x ] [ -Z ]
 @ifset A29K
 @c am29k has no machine-dependent assembler options
 @end ifset
@@ -212,12 +213,20 @@
  [ -mbig-endian | -mlittle-endian ]
 @end ifset
 @ifset ARM
- [ -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]7[t][[d]m[i]] ]
- [ -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t ]
+ [ -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]60 |
+   -m[arm]600 | -m[arm]610 | -m[arm]620 | -m[arm]7[t][[d]m[i]][fe] | -m[arm]70 |
+   -m[arm]700 | -m[arm]710[c] | -m[arm]7100 | -m[arm]7500 | -m[arm]8 |
+   -m[arm]810 | -m[arm]9 | -m[arm]920 | -m[arm]920t | -m[arm]9tdmi |
+   -mstrongarm | -mstrongarm110 | -mstrongarm1100 ]
+ [ -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t |
+   -m[arm]v5 | -[arm]v5t ]
  [ -mthumb | -mall ]
  [ -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu ]
  [ -EB | -EL ]
- [ -mapcs-32 | -mapcs-26 ]
+ [ -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant ]
+ [ -mthumb-interwork ]
+ [ -moabi ]
+ [ -k ]
 @end ifset
 @ifset D10V
  [ -O ]
@@ -231,6 +240,9 @@
 @ifset HPPA
 @c HPPA has no machine-dependent assembler options (yet).
 @end ifset
+@ifset PJ
+ [ -mb | -me ]
+@end ifset
 @ifset SPARC
 @c The order here is important.  See c-sparc.texi.
  [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
@@ -311,6 +323,10 @@
 Generate stabs debugging information for each assembler line.  This
 may help debugging assembler code, if the debugger can handle it.
 
+@item --gdwarf2
+Generate DWARF2 debugging information for each assembler line.  This
+may help debugging assembler code, if the debugger can handle it.
+
 @item --help
 Print a summary of the command line options and exit.
 
@@ -355,8 +371,15 @@
 Print the @code{as} version and exit.
 
 @item -W
+@itemx --no-warn
 Suppress warning messages.
 
+@item --fatal-warnings
+Treat warnings as errors.
+
+@item --warn
+Don't suppress warning messages or treat them as errors.
+
 @item -w
 Ignored.
 
@@ -395,16 +418,23 @@
 processor family.
 
 @table @code
-@item -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]7[t][[d]m] | -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t 
-Specify which variant of the ARM architecture is the target.
+@item -m[arm][1|2|3|6|7|8|9][...] 
+Specify which ARM processor variant is the target.
+@item -m[arm]v[2|2a|3|3m|4|4t|5|5t]
+Specify which ARM architecture variant is used by the target.
 @item -mthumb | -mall
 Enable or disable Thumb only instruction decoding.
 @item -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu
 Select which Floating Point architcture is the target.
-@item -mapcs-32 | -mapcs-26
+@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi
 Select which procedure calling convention is in use.
 @item -EB | -EL
 Select either big-endian (-EB) or little-endian (-EL) output.
+@item -mthumb-interwork
+Specify that the code has been generated with interworking between Thumb and
+ARM code in mind.
+@item -k
+Specify that PIC code has been generated.
 @end table
 @end ifset
 
@@ -485,6 +515,26 @@
 @end table
 @end ifset
 
+@ifset PJ
+The following options are available when @value{AS} is configured for
+a picoJava processor.
+
+@table @code
+
+@cindex PJ endianness
+@cindex endianness, PJ
+@cindex big endian output, PJ
+@item -mb
+Generate ``big endian'' format output.
+
+@cindex little endian output, PJ
+@item -ml
+Generate ``little endian'' format output.
+
+@end table
+@end ifset
+
+
 @ifset SPARC
 The following options are available when @code{@value{AS}} is configured
 for the SPARC architecture:
@@ -982,7 +1032,7 @@
 * statistics::    --statistics to see statistics about assembly
 * traditional-format:: --traditional-format for compatible output
 * v::             -v to announce version
-* W::             -W to suppress warnings
+* W::             -W, --no-warn, --warn, --fatal-warnings to control warnings
 * Z::             -Z to make object file even after errors
 @end menu
 
@@ -1358,19 +1408,32 @@
 command line.
 
 @node W
-@section Suppress Warnings: @code{-W}
+@section Control Warnings: @code{-W}, @code{--warn}, @code{--no-warn}, @code{--fatal-warnings}
 
-@kindex -W
-@cindex suppressing warnings
-@cindex warnings, suppressing
 @code{@value{AS}} should never give a warning or error message when
 assembling compiler output.  But programs written by people often
 cause @code{@value{AS}} to give a warning that a particular assumption was
 made.  All such warnings are directed to the standard error file.
-If you use this option, no warnings are issued.  This option only
-affects the warning messages: it does not change any particular of how
-@code{@value{AS}} assembles your file.  Errors, which stop the assembly, are
-still reported.
+
+@kindex @samp{-W}
+@kindex @samp{--no-warn}
+@cindex suppressing warnings
+@cindex warnings, suppressing
+If you use the @code{-W} and @code{--no-warn} options, no warnings are issued.
+This only affects the warning messages: it does not change any particular of
+how @code{@value{AS}} assembles your file.  Errors, which stop the assembly,
+are still reported.
+
+@kindex @samp{--fatal-warnings}
+@cindex errors, caused by warnings
+@cindex warnings, causing error
+If you use the @code{--fatal-warnings} option, @code{@value{AS}} considers
+files that generate warnings to be in error.
+
+@kindex @samp{--warn}
+@cindex warnings, switching on
+You can switch these options off again by specifying @code{--warn}, which
+causes warnings to be output as usual.
 
 @node Z
 @section Generate Object File in Spite of Errors: @code{-Z}
@@ -1492,6 +1555,9 @@
 @ifset ARC
 @samp{;} on the ARC;
 @end ifset
+@ifset ARM
+@samp{@@} on the ARM;
+@end ifset
 @ifset H8/300
 @samp{;} for the H8/300 family;
 @end ifset
@@ -1504,6 +1570,9 @@
 @ifset I960
 @samp{#} on the i960;
 @end ifset
+@ifset PJ
+@samp{;} for picoJava;
+@end ifset
 @ifset SH
 @samp{!} for the Hitachi SH;
 @end ifset
@@ -3040,6 +3109,7 @@
 * Double::                      @code{.double @var{flonums}}
 * Eject::                       @code{.eject}
 * Else::                        @code{.else}
+* Elseif::                      @code{.elseif}
 * End::				@code{.end}
 @ifset COFF
 * Endef::                       @code{.endef}
@@ -3129,6 +3199,9 @@
 * Type::                        @code{.type @var{int}}
 * Val::                         @code{.val @var{addr}}
 @end ifset
+@ifset ELF
+* Visibility::                  @code{.internal @var{name}, .hidden @var{name}, .protected @var{name}}
+@end ifset
 
 * Uleb128::                     @code{.uleb128 @var{expressions}}
 * Word::                        @code{.word @var{expressions}}
@@ -3394,6 +3467,14 @@
 of code to be assembled if the condition for the preceding @code{.if}
 was false.
 
+@node Elseif
+@section @code{.elseif}
+
+@cindex @code{elseif} directive
+@code{.elseif} is part of the @code{@value{AS}} support for conditional
+assembly; @pxref{If,,@code{.if}}.  It is shorthand for beginning a new
+@code{.if} block that would otherwise fill the entire @code{.else} section.
+
 @node End
 @section @code{.end}
 
@@ -3622,6 +3703,8 @@
 the conditional section of code must be marked by @code{.endif}
 (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
 alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}).
+If you have several conditions to check, @code{.elseif} may be used to avoid
+nesting blocks if/else within each subsequent @code{.else} block.
 
 The following variants of @code{.if} are also supported:
 @table @code
@@ -4291,6 +4374,8 @@
 read-only section
 @item x
 executable section
+@item s
+shared section (meaningful for PE targets)
 @end table
 
 If no flags are specified, the default flags depend upon the section name.  If
@@ -4688,6 +4773,40 @@
 compact, variable length representation of numbers used by the DWARF
 symbolic debugging format.  @xref{Sleb128,@code{.sleb128}}.
 
+@ifset ELF
+@node Visibility
+@section @code{.internal}, @code{.hidden}, @code{.protected}
+@cindex @code{internal} directive
+@cindex @code{hidden} directive
+@cindex @code{protected} directive
+@cindex symbol visibility
+
+These directives can be used to set the visibility of a specified symbol.  By
+default a symbol's visibility is set by its binding (local, global or weak),
+but these directives can be used to override that.
+
+A visibility of @code{protected} means that any references to the symbol from
+within the component that defines the symbol must be resolved to the definition
+in that component, even if a definition in another component would normally
+preempt this.
+
+A visibility of @code{hidden} means that the symbol is not visible to other 
+components.  Such a symbol is always considered to be protected as well.
+
+A visibility of @code{internal} is the same as a visibility of @code{hidden},
+except that some extra, processor specific processing must also be performed
+upon the symbol. 
+
+For ELF targets, the directives are used like this:
+
+@smallexample
+.internal @var{name}
+.hidden @var{name}
+.protected @var{name}
+@end smallexample
+
+@end ifset
+
 @node Word
 @section @code{.word @var{expressions}}
 
@@ -4808,6 +4927,9 @@
 @ifset HPPA
 * HPPA-Dependent::              HPPA Dependent Features
 @end ifset
+@ifset I370
+* ESA/390-Dependent::           IBM ESA/390 Dependent Features
+@end ifset
 @ifset I80386
 * i386-Dependent::              Intel 80386 Dependent Features
 @end ifset
@@ -4823,6 +4945,9 @@
 @ifset SH
 * SH-Dependent::                Hitachi SH Dependent Features
 @end ifset
+@ifset PJ
+* PJ-Dependent::                picoJava Dependent Features
+@end ifset
 @ifset SPARC
 * Sparc-Dependent::             SPARC Dependent Features
 @end ifset
@@ -4972,6 +5097,10 @@
 @include c-hppa.texi
 @end ifset
 
+@ifset I370
+@include c-i370.texi
+@end ifset
+
 @ifset I80386
 @include c-i386.texi
 @end ifset
@@ -4993,6 +5122,10 @@
 @include c-ns32k.texi
 @end ifset
 
+@ifset PJ
+@include c-pj.texi
+@end ifset
+
 @ifset SH
 @include c-sh.texi
 @end ifset
@@ -5299,6 +5432,8 @@
 Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc,
 and some initial 64-bit support).
 
+Linas Vepstas added GAS support for the ESA/390 "IBM 370" architecture.
+
 Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD
 support for openVMS/Alpha.
 
diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi
index b94fb2a..ff98d7f 100644
--- a/gas/doc/c-arm.texi
+++ b/gas/doc/c-arm.texi
@@ -29,12 +29,12 @@
 @cindex options for ARM (none)
 @table @code
 @cindex @code{-marm} command line option, ARM
-@item -marm @var{[2|250|3|6|60|600|610|620|7|7m|7d|7dm|7di|7dmi|70|700|700i|710|710c|7100|7500|7500fe|7tdmi|8|810|9|9tdmistrongarm|strongarm110|strongarm1100]}
+@item -marm [@var{2}|@var{250}|@var{3}|@var{6}|@var{60}|@var{600}|@var{610}|@var{620}|@var{7}|@var{7m}|@var{7d}|@var{7dm}|@var{7di}|@var{7dmi}|@var{70}|@var{700}|@var{700i}|@var{710}|@var{710c}|@var{7100}|@var{7500}|@var{7500fe}|@var{7tdmi}|@var{8}|@var{810}|@var{9}|@var{9tdmi}|@var{920}|@var{strongarm}|@var{strongarm110}|@var{strongarm1100}]
 This option specifies the target processor.  The assembler will issue an
 error message if an attempt is made to assemble an instruction which
 will not execute on the target processor.
 @cindex @code{-marmv} command line option, ARM
-@item -marmv @var{[2|2a|3|3m|4|4t]}
+@item -marmv [@var{2}|@var{2a}|@var{3}|@var{3m}|@var{4}|@var{4t}|@var{5}|@var{5t}]
 This option specifies the target architecture.  The assembler will issue
 an error message if an attempt is made to assemble an instruction which
 will not execute on the target architecture.
@@ -45,7 +45,7 @@
 @item -mall
 This option specifies that any Arm or Thumb instruction should be assembled.
 @cindex @code{-mfpa} command line option, ARM
-@item -mfpa @var{[10|11]}
+@item -mfpa [@var{10}|@var{11}]
 This option specifies the floating point architecture in use on the
 target processor. 
 @cindex @code{-mfpe-old} command line option, ARM
@@ -59,14 +59,14 @@
 This option specifies that the output generated by the assembler should
 be marked as supporting interworking.
 @cindex @code{-mapcs} command line option, ARM
-@item -mapcs @var{[26|32]}
+@item -mapcs [@var{26}|@var{32}]
 This option specifies that the output generated by the assembler should
 be marked as supporting the indicated version of the Arm Procedure.
 Calling Standard.
 @item -mapcs-float
 This indicates the the floating point variant of the APCS should be
 used.  In this variant floating point arguments are passed in FP
-registers ratehr than integer registers.
+registers rather than integer registers.
 @item -mapcs-reentrant
 This indicates that the reentrant variant of the APCS should be used.
 This variant supports position independent code.
@@ -102,8 +102,19 @@
 
 @cindex line comment character, ARM
 @cindex ARM line comment character
-The presence of a @samp{#} and @samp{@@} on a line indicates the start of
-a comment that extends to the end of the current line.
+The presence of a @samp{@@} on a line indicates the start of a comment
+that extends to the end of the current line.  If a @samp{#} appears as
+the first character of a line, the whole line is treated as a comment.
+
+@cindex line separator, ARM
+@cindex statement separator, ARM
+@cindex ARM line separator
+On ARM systems running the GNU/Linux operating system, @samp{;} can be
+used instead of a newline to separate statements.
+
+@cindex immediate character, ARM
+@cindex ARM immediate character
+Either @samp{#} or @samp{$} can be used to indicate immediate operands.
 
 @cindex identifiers, ARM
 @cindex ARM identifiers
@@ -142,7 +153,7 @@
 @end smallexample
 
 @cindex @code{code} directive, ARM
-@item .code @var{[16|32]}
+@item .code [@var{16}|@var{32}]
 This directive selects the instruction set being generated. The value 16
 selects Thumb, with the value 32 selecting ARM.
 
@@ -167,6 +178,14 @@
 between Arm and Thumb instructions and should be used even if
 interworking is not going to be performed.
 
+@cindex @code{thumb_set} directive, ARM
+@item .thumb_set
+This performs the equivalent of a @code{.set} directive in that it
+creates a symbol which is an alias for another symbol (possibly not yet
+defined).  This directive also has the added property in that it marks
+the aliased symbol as being a thumb function entry point, in the same
+way that the @code{.thumb_func} directive does.
+
 @cindex @code{.ltorg} directive, ARM
 @item .ltorg
 This directive causes the current contents of the literal pool to be
@@ -184,13 +203,23 @@
 
 @cindex ARM opcodes
 @cindex opcodes for ARM
-@code{@value{AS}} implements all the standard ARM opcodes.
+@code{@value{AS}} implements all the standard ARM opcodes.  It also
+implements several pseudo opcodes, including several synthetic load
+instructions. 
 
-*TODO* Document the pseudo-ops (adr, nop)
+@table @code
 
-GAS for the ARM supports a synthetic register load instruction whoes
-syntax is: 
+@cindex @code{NOP} pseudo op, ARM
+@item NOP
+@smallexample
+  nop
+@end smallexample
 
+This pseudo op will always evaluate to a legal ARM instruction that does
+nothing.  Currently it will evaluate to MOV r0, r0.
+
+@cindex @code{LDR reg,=<label>} pseudo op, ARM
+@item LDR 
 @smallexample
   ldr <register> , = <expression>
 @end smallexample
@@ -201,6 +230,37 @@
 the constant will be placed into the nearest literal pool (if it not
 already there) and a PC relative LDR instruction will be generated.
 
+@cindex @code{ADR reg,<label>} pseudo op, ARM
+@item ADR
+@smallexample
+  adr <register> <label>
+@end smallexample
+
+This instruction will load the address of @var{label} into the indicated
+register.  The instruction will evaluate to a PC relative ADD or SUB
+instruction depending upon where the label is located.  If the label is
+out of range, or if it is not defined in the same file (and section) as
+the ADR instruction, then an error will be generated.  This instruction
+will not make use of the literal pool.
+
+@cindex @code{ADRL reg,<label>} pseudo op, ARM
+@item ADRL 
+@smallexample
+  adrl <register> <label>
+@end smallexample
+
+This instruction will load the address of @var{label} into the indicated
+register.  The instruction will evaluate to one or two a PC relative ADD
+or SUB instructions depending upon where the label is located.  If a
+second instruction is not needed a NOP instruction will be generated in
+its place, so that this instruction is always 8 bytes long.
+
+If the label is out of range, or if it is not defined in the same file
+(and section) as the ADRL instruction, then an error will be generated.
+This instruction will not make use of the literal pool.
+
+@end table
+
 For information on the ARM or Thumb instruction sets, see @cite{ARM
 Software Development Toolkit Reference Manual}, Advanced RISC Machines
 Ltd.
diff --git a/gas/doc/c-i370.texi b/gas/doc/c-i370.texi
new file mode 100644
index 0000000..18b41b2
--- /dev/null
+++ b/gas/doc/c-i370.texi
@@ -0,0 +1,200 @@
+@c Copyright (C) 2000 Free Software Foundation, Inc.
+@c This is part of the GAS manual.
+@c For copying conditions, see the file as.texinfo.
+@ifset GENERIC
+@page
+@node ESA/390-Dependent
+@chapter ESA/390 Dependent Features
+@end ifset
+@ifclear GENERIC
+@node Machine Dependencies
+@chapter ESA/390 Dependent Features
+@end ifclear
+
+@cindex i370 support
+@cindex ESA/390 support
+
+@menu
+* ESA/390 Notes::                Notes
+* ESA/390 Options::              Options
+* ESA/390 Syntax::               Syntax
+* ESA/390 Floating Point::       Floating Point
+* ESA/390 Directives::           ESA/390 Machine Directives
+* ESA/390 Opcodes::              Opcodes
+@end menu
+
+@node ESA/390 Notes
+@section Notes
+The ESA/390 @code{@value{AS}} port is currently intended to be a back-end
+for the @sc{gnu} @sc{cc} compiler.  It is not HLASM compatible, although
+it does support a subset of some of the HLASM directives.  The only 
+supported binary file format is ELF; none of the usual MVS/VM/OE/USS 
+object file formats, such as ESD or XSD, are supported.
+
+When used with the @sc{gnu} @sc{cc} compiler, the ESA/390 @code{@value{AS}}
+will produce correct, fully relocated, functional binaries, and has been 
+used to compile and execute large projects.  However, many aspects should 
+still be considered experimental; these include shared library support, 
+dynamically loadable objects, and any relocation other than the 31-bit 
+relocation.
+
+@node ESA/390 Options
+@section Options
+@code{@value{AS}} has no machine-dependent command-line options for the ESA/390.
+
+@cindex ESA/390 Syntax
+@node ESA/390 Syntax
+@section Syntax
+The opcode/operand syntax follows the ESA/390 Principles of Operation
+manual; assembler directives and general syntax are loosely based on the 
+prevailing AT&T/SVR4/ELF/Solaris style notation.  HLASM-style directives
+are @emph{not} supported for the most part, with the exception of those 
+described herein.
+
+A leading dot in front of directives is optional, and the case of
+directives is ignored; thus for example, .using and USING have the same
+effect.
+
+A colon may immediately follow a label definition.  This is
+simply for compatibility with how most assembly language programmers
+write code.
+
+@samp{#} is the line comment character.
+
+@samp{;} can be used instead of a newline to separate statements.
+
+Since @samp{$} has no special meaning, you may use it in symbol names.
+
+Registers can be given the symbolic names r0..r15, fp0, fp2, fp4, fp6.
+By using thesse symbolic names, @code{@value{AS}} can detect simple 
+syntax errors. The name rarg or r.arg is a synonym for r11, rtca or r.tca
+for r12, sp, r.sp, dsa r.dsa for r13, lr or r.lr for r14, rbase or r.base 
+for r3 and rpgt or r.pgt for r4.
+
+@samp{*} is the current location counter.  Unlike @samp{.} it is always
+relative to the last USING directive.  Note that this means that 
+expressions cannot use multiplication, as any occurence of @samp{*}
+will be interpreted as a location counter.
+
+All labels are relative to the last USING.  Thus, branches to a label 
+always imply the use of base+displacement.
+
+Many of the usual forms of address constants / address literals 
+are supported.  Thus,
+@example
+	.using	*,r3
+	L	r15,=A(some_routine)
+	LM	r6,r7,=V(some_longlong_extern)
+	A	r1,=F'12'
+	AH	r0,=H'42'
+	ME	r6,=E'3.1416'
+	MD	r6,=D'3.14159265358979'
+	O	r6,=XL4'cacad0d0'
+	.ltorg
+@end example
+should all behave as expected: that is, an entry in the literal
+pool will be created (or reused if it already exists), and the 
+instruction operands will be the displacement into the literal pool
+using the current base register (as last declared with the @code{.using}
+directive).
+
+@node ESA/390 Floating Point
+@section Floating Point
+@cindex floating point, ESA/390 (@sc{ieee})
+@cindex ESA/390 floating point (@sc{ieee})
+The assembler generates only @sc{ieee} floating-point numbers.  The older
+floiating point formats are not supported.
+
+
+@node ESA/390 Directives
+@section ESA/390 Assembler Directives
+
+@code{@value{AS}} for the ESA/390 supports all of the standard ELF/SVR4 
+assembler directives that are documented in the main part of this
+documentation.  Several additional directives are supported in order
+to implement the ESA/390 addressing model.  The most important of these
+are @code{.using} and @code{.ltorg}
+
+@cindex ESA/390-only directives
+These are the additional directives in @code{@value{AS}} for the ESA/390:
+
+@table @code
+@item .dc 
+A small subset of the usual DC directive is supported.
+
+@item .drop @var{regno}
+Stop using @var{regno} as the base register.  The @var{regno} must
+have been previously declared with a @code{.using} directive in the
+same section as the current section.
+
+@item .ebcdic @var{string}
+Emit the EBCDIC equivalent of the indicated string.  The emitted string
+will be null terminated.  Note that the directives @code{.string} etc. emit
+ascii strings by default.
+
+@item EQU 
+The standard HLASM-style EQU directive is not supported; however, the 
+standard @code{@value{AS}} directive .equ can be used to the same effect.
+
+@item .ltorg 
+Dump the literal pool accumulated so far; begin a new literal pool.
+The literal pool will be written in the current section; in order to
+generate correct assembly, a @code{.using} must have been previously
+specified in the same section.
+
+@item .using @var{expr},@var{regno}
+Use @var{regno} as the base register for all subsequent RX, RS, and SS form
+instructions. The @var{expr} will be evaluated to obtain the base address;
+usually, @var{expr} will merely be @samp{*}.
+
+This assembler allows two @code{.using} directives to be simultaneously
+outstanding, one in the @code{.text} section, and one in another section 
+(typically, the @code{.data} section).  This feature allows 
+dynamically loaded objects to be implemented in a relatively 
+straightforward way.  A @code{.using} directive must always be specified 
+in the @code{.text} section; this will specify the base register that
+will be used for branches in the @code{.text} section.  A second
+@code{.using} may be specified in another section; this will specify
+the base register that is used for non-label address literals.
+When a second @code{.using} is specified, then the subsequent
+@code{.ltorg} must be put in the same section; otherwise an error will 
+result.
+
+Thus, for example, the following code uses @code{r3} to address branch 
+targets and @code{r4} to address the literal pool, which has been written 
+to the @code{.data} section.  The is, the constants @code{=A(some_routine)},
+@code{=H'42'} and @code{=E'3.1416'} will all appear in the @code{.data}
+section.
+
+@example
+.data
+	.using  LITPOOL,r4
+.text
+	BASR	r3,0
+	.using	*,r3
+        B       START
+	.long	LITPOOL
+START:
+	L	r4,4(,r3)
+	L	r15,=A(some_routine)
+	LTR	r15,r15
+	BNE	LABEL
+	AH	r0,=H'42'
+LABEL:
+	ME	r6,=E'3.1416'
+.data
+LITPOOL:
+	.ltorg
+@end example
+
+
+Note that this dual-@code{.using} directive semantics extends 
+and is not compatible with HLASM semantics.  Note that this assembler 
+directive does not support the full range of HLASM semantics.
+
+@end table
+
+@node ESA/390 Opcodes
+@section Opcodes
+For detailed information on the ESA/390 machine instruction set, see
+@cite{ESA/390 Principles of Operation} (IBM Publication Number DZ9AR004).
diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi
index e27893b..8a9c85a 100644
--- a/gas/doc/c-i386.texi
+++ b/gas/doc/c-i386.texi
@@ -443,14 +443,25 @@
 @cindex i386 16-bit code
 @cindex 16-bit code, i386
 @cindex real-mode code, i386
+@cindex @code{code16gcc} directive, i386
 @cindex @code{code16} directive, i386
 @cindex @code{code32} directive, i386
 While @code{@value{AS}} normally writes only ``pure'' 32-bit i386 code,
 it also supports writing code to run in real mode or in 16-bit protected
-mode code segments.  To do this, put a @samp{.code16} directive before
-the assembly language instructions to be run in 16-bit mode.  You can
-switch @code{@value{AS}} back to writing normal 32-bit code with the
-@samp{.code32} directive.
+mode code segments.  To do this, put a @samp{.code16} or
+@samp{.code16gcc} directive before the assembly language instructions to
+be run in 16-bit mode.  You can switch @code{@value{AS}} back to writing
+normal 32-bit code with the @samp{.code32} directive.
+
+@samp{.code16gcc} provides experimental support for generating 16-bit
+code from gcc, and differs from @samp{.code16} in that @samp{call},
+@samp{ret}, @samp{enter}, @samp{leave}, @samp{push}, @samp{pop},
+@samp{pusha}, @samp{popa}, @samp{pushf}, and @samp{popf} instructions
+default to 32-bit size.  This is so that the stack pointer is
+manipulated in the same way over function calls, allowing access to
+function parameters at the same stack offsets as in 32-bit mode.
+@samp{.code16gcc} also automatically adds address size prefixes where
+necessary to use the 32-bit addressing modes that gcc generates.
 
 The code which @code{@value{AS}} generates in 16-bit mode will not
 necessarily run on a 16-bit pre-80386 processor.  To write code that
diff --git a/gas/doc/c-m32r.texi b/gas/doc/c-m32r.texi
index f121ede..b733fb3 100644
--- a/gas/doc/c-m32r.texi
+++ b/gas/doc/c-m32r.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1991, 92-98, 1999 Free Software Foundation, Inc.
 @c This is part of the GAS manual.
 @c For copying conditions, see the file as.texinfo.
 @ifset GENERIC
@@ -11,3 +11,132 @@
 @chapter M32R Dependent Features
 @end ifclear
 
+@cindex M32R support
+@menu
+* M32R-Opts::                   M32R Options
+* M32R-Warnings::               M32R Warnings
+@end menu
+
+@node M32R-Opts
+@section M32R Options
+
+@cindex options, M32R
+@cindex M32R options
+
+The Mitsubishi M32R version of @code{@value{AS}} has a few machine
+dependent options:
+
+@table @code
+@item -m32rx
+@cindex @samp{-m32rx} option, M32RX
+@cindex architecture options, M32RX
+@cindex M32R architecture options
+@code{@value{AS}} can assemble code for several different members of the
+Mitsubishi M32R family.  Normally the default is to assemble code for
+the M32R microprocessor.  This option may be used to change the default
+to the M32RX microprocessor, which adds some more instructions to the
+basic M32R instruction set, and some additional parameters to some of
+the original instructions.
+
+@item -m32r
+@cindex @samp{-m32r} option, M32R
+@cindex architecture options, M32R
+@cindex M32R architecture options
+This option can be used to restore the assembler's default behaviour of
+assembling for the M32R microprocessor.  This can be useful if the
+default has been changed by a previous command line option.
+
+@item -warn-explicit-parallel-conflicts
+@cindex @samp{-warn-explicit-parallel-conflicts} option, M32RX
+Instructs @code{@value{AS}} to produce warning messages when
+questionable parallel instructions are encountered.  This option is
+enabled by default, but @code{@value{GCC}} disables it when it invokes
+@code{@value{AS}} directly.  Questionable instructions are those whoes
+behaviour would be different if they were executed sequentially.  For
+example the code fragment @samp{mv r1, r2 || mv r3, r1} produces a
+different result from @samp{mv r1, r2 \n mv r3, r1} since the former
+moves r1 into r3 and then r2 into r1, whereas the later moves r2 into r1
+and r3.
+
+@item -Wp
+@cindex @samp{-Wp} option, M32RX
+This is a shorter synonym for the @emph{-warn-explicit-parallel-conflicts}
+option.
+
+@item -no-warn-explicit-parallel-conflicts
+@cindex @samp{-no-warn-explicit-parallel-conflicts} option, M32RX
+Instructs @code{@value{AS}} not to produce warning messages when
+questionable parallel instructions are encountered.
+
+@item -Wnp
+@cindex @samp{-Wnp} option, M32RX
+This is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts}
+option.
+
+@end table
+
+@node M32R-Warnings
+@section M32R Warnings
+
+@cindex warnings, M32R
+@cindex M32R warnings
+
+There are several warning and error messages that can be produced by
+@code{@value{AS}} which are specific to the M32R:
+
+@table @code
+
+@item output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?
+This message is only produced if warnings for explicit parallel
+conflicts have been enabled.  It indicates that the assembler has
+encountered a parallel instruction in which the destination register of
+the left hand instruction is used as an input register in the right hand
+instruction.  For example in this code fragment
+@samp{mv r1, r2 || neg r3, r1} register r1 is the destination of the
+move instruction and the input to the neg instruction.
+
+@item output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?
+This message is only produced if warnings for explicit parallel
+conflicts have been enabled.  It indicates that the assembler has
+encountered a parallel instruction in which the destination register of
+the right hand instruction is used as an input register in the left hand
+instruction.  For example in this code fragment
+@samp{mv r1, r2 || neg r2, r3} register r2 is the destination of the
+neg instruction and the input to the move instruction.
+
+@item instruction @samp{...} is for the M32RX only
+This message is produced when the assembler encounters an instruction
+which is only supported by the M32Rx processor, and the @samp{-m32rx}
+command line flag has not been specified to allow assembly of such
+instructions. 
+
+@item unknown instruction @samp{...}
+This message is produced when the assembler encounters an instruction
+which it doe snot recognise.
+
+@item only the NOP instruction can be issued in parallel on the m32r
+This message is produced when the assembler encounters a parallel
+instruction which does not involve a NOP instruction and the
+@samp{-m32rx} command line flag has not been specified.  Only the M32Rx
+processor is able to execute two instructions in parallel.
+
+@item instruction @samp{...} cannot be executed in parallel.
+This message is produced when the assembler encounters a parallel
+instruction which is made up of one or two instructions which cannot be
+executed in parallel.
+
+@item Instructions share the same execution pipeline
+This message is produced when the assembler encounters a parallel
+instruction whoes components both use the same execution pipeline.
+
+@item Instructions write to the same destination register.
+This message is produced when the assembler encounters a parallel
+instruction where both components attempt to modify the same register.
+For example these code fragments will produce this message:
+@samp{mv r1, r2 || neg r1, r3}
+@samp{jl r0 || mv r14, r1}
+@samp{st r2, @@-r1 || mv r1, r3} 
+@samp{mv r1, r2 || ld r0, @@r1+} 
+@samp{cmp r1, r2 || addx r3, r4} (Both write to the condition bit)
+
+@end table
diff --git a/gas/doc/c-mips.texi b/gas/doc/c-mips.texi
index 523dda3..26940de 100644
--- a/gas/doc/c-mips.texi
+++ b/gas/doc/c-mips.texi
@@ -67,12 +67,30 @@
 @sc{r10000} processors.  You can also switch instruction sets during the
 assembly; see @ref{MIPS ISA,, Directives to override the ISA level}.
 
+@item -mgp32
+Assume that 32-bit general purpose registers are available.  This
+affects synthetic instructions such as @code{move}, which will assemble
+to a 32-bit or a 64-bit instruction depending on this flag.  On some
+MIPS variants there is a 32-bit mode flag; when this flag is set,
+64-bit instructions generate a trap.  Also, some 32-bit OSes only save
+the 32-bit registers on a context switch, so it is essential never to
+use the 64-bit registers.
+
+@item -mgp64
+Assume that 64-bit general purpose registers are available.  This is
+provided in the interests of symmetry with -gp32.
+
 @item -mips16
 @itemx -no-mips16
 Generate code for the MIPS 16 processor.  This is equivalent to putting
 @samp{.set mips16} at the start of the assembly file.  @samp{-no-mips16}
 turns off this option.
 
+@item -mfix7000
+@itemx -no-mfix7000
+Cause nops to be inserted if the read of the destination register
+of an mfhi or mflo instruction occurs in the following two instructions.
+
 @item -m4010
 @itemx -no-m4010
 Generate code for the LSI @sc{r4010} chip.  This tells the assembler to
diff --git a/gas/doc/c-pj.texi b/gas/doc/c-pj.texi
new file mode 100644
index 0000000..7060015
--- /dev/null
+++ b/gas/doc/c-pj.texi
@@ -0,0 +1,28 @@
+@c Copyright (C) 1999 Free Software Foundation, Inc.
+@c This is part of the GAS manual.
+@c For copying conditions, see the file as.texinfo.
+@page
+@node PJ-Dependent
+@chapter picoJava Dependent Features
+
+@cindex PJ support
+@menu
+* PJ Options::              Options
+@end menu
+
+@node PJ Options
+@section Options
+
+@cindex PJ options
+@cindex options, PJ
+@code{@value{AS}} has two addiitional command-line options for the picoJava
+architecture.
+@table @code
+@item -ml
+This option selects little endian data output.
+
+@item -mb
+This option selects big endian data output.
+@end table
+
+
diff --git a/gas/doc/c-sparc.texi b/gas/doc/c-sparc.texi
index f871c82..ab54eb2 100644
--- a/gas/doc/c-sparc.texi
+++ b/gas/doc/c-sparc.texi
@@ -145,11 +145,27 @@
 @item .half
 This is functionally identical to @code{.short}.
 
+@cindex @code{nword} directive, SPARC
+@item .nword
+On the Sparc, the @code{.nword} directive produces native word sized value,
+ie. if assembling with -32 it is equivalent to @code{.word}, if assembling
+with -64 it is equivalent to @code{.xword}.
+
 @cindex @code{proc} directive, SPARC
 @item .proc
 This directive is ignored.  Any text following it on the same
 line is also ignored.
 
+@cindex @code{register} directive, SPARC
+@item .register
+This directive declares use of a global application or system register.
+It must be followed by a register name %g2, %g3, %g6 or %g7, comma and
+the symbol name for that register.  If symbol name is @code{#scratch},
+it is a scratch register, if it is @code{#ignore}, it just surpresses any
+errors about using undeclared global register, but does not emit any
+information about it into the object file.  This can be useful e.g. if you
+save the register before use and restore it after.
+
 @cindex @code{reserve} directive, SPARC
 @item .reserve
 This must be followed by a symbol name, a positive number, and
@@ -176,4 +192,3 @@
 On the Sparc V9 processor, the @code{.xword} directive produces
 64 bit values.
 @end table
-
diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index dd3b4ab..3be8b81 100644
--- a/gas/doc/internals.texi
+++ b/gas/doc/internals.texi
@@ -115,9 +115,14 @@
 @cindex symbols, internal
 @cindex symbolS structure
 
-The definition for @code{struct symbol}, also known as @code{symbolS}, is
-located in @file{struc-symbol.h}.  Symbol structures contain the following
-fields:
+The definition for the symbol structure, @code{symbolS}, is located in
+@file{struc-symbol.h}.
+
+In general, the fields of this structure may not be referred to directly.
+Instead, you must use one of the accessor functions defined in @file{symbol.h}.
+These accessor functions should work for any GAS version.
+
+Symbol structures contain the following fields:
 
 @table @code
 @item sy_value
@@ -188,16 +193,10 @@
 This processor-specific data is of type @code{TC_SYMFIELD_TYPE}.  If no macro
 by that name is defined in @file{targ-cpu.h}, this field is not defined.
 
-@item TARGET_SYMBOL_FIELDS
-If this macro is defined, it defines additional fields in the symbol structure.
-This macro is obsolete, and should be replaced when possible by uses of
-@code{OBJ_SYMFIELD_TYPE} and @code{TC_SYMFIELD_TYPE}.
 @end table
 
-There are a number of access routines used to extract the fields of a
-@code{symbolS} structure.  When possible, these routines should be used rather
-than referring to the fields directly.  These routines will work for any GAS
-version.
+Here is a description of the accessor functions.  These should be used rather
+than referring to the fields of @code{symbolS} directly.
 
 @table @code
 @item S_SET_VALUE
@@ -302,8 +301,136 @@
 @cindex S_SET_SIZE
 Set the size of a symbol.  This is only defined for object file formats for
 which it makes sense (primarily ELF).
+
+@item symbol_get_value_expression
+@cindex symbol_get_value_expression
+Get a pointer to an @code{expressionS} structure which represents the value of
+the symbol as an expression.
+
+@item symbol_set_value_expression
+@cindex symbol_set_value_expression
+Set the value of a symbol to an expression.
+
+@item symbol_set_frag
+@cindex symbol_set_frag
+Set the frag where a symbol is defined.
+
+@item symbol_get_frag
+@cindex symbol_get_frag
+Get the frag where a symbol is defined.
+
+@item symbol_mark_used
+@cindex symbol_mark_used
+Mark a symbol as having been used in an expression.
+
+@item symbol_clear_used
+@cindex symbol_clear_used
+Clear the mark indicating that a symbol was used in an expression.
+
+@item symbol_used_p
+@cindex symbol_used_p
+Return whether a symbol was used in an expression.
+
+@item symbol_mark_used_in_reloc
+@cindex symbol_mark_used_in_reloc
+Mark a symbol as having been used by a relocation.
+
+@item symbol_clear_used_in_reloc
+@cindex symbol_clear_used_in_reloc
+Clear the mark indicating that a symbol was used in a relocation.
+
+@item symbol_used_in_reloc_p
+@cindex symbol_used_in_reloc_p
+Return whether a symbol was used in a relocation.
+
+@item symbol_mark_mri_common
+@cindex symbol_mark_mri_common
+Mark a symbol as an MRI common symbol.
+
+@item symbol_clear_mri_common
+@cindex symbol_clear_mri_common
+Clear the mark indicating that a symbol is an MRI common symbol.
+
+@item symbol_mri_common_p
+@cindex symbol_mri_common_p
+Return whether a symbol is an MRI common symbol.
+
+@item symbol_mark_written
+@cindex symbol_mark_written
+Mark a symbol as having been written.
+
+@item symbol_clear_written
+@cindex symbol_clear_written
+Clear the mark indicating that a symbol was written.
+
+@item symbol_written_p
+@cindex symbol_written_p
+Return whether a symbol was written.
+
+@item symbol_mark_resolved
+@cindex symbol_mark_resolved
+Mark a symbol as having been resolved.
+
+@item symbol_resolved_p
+@cindex symbol_resolved_p
+Return whether a symbol has been resolved.
+
+@item symbol_section_p
+@cindex symbol_section_p
+Return whether a symbol is a section symbol.
+
+@item symbol_equated_p
+@cindex symbol_equated_p
+Return whether a symbol is equated to another symbol.
+
+@item symbol_constant_p
+@cindex symbol_constant_p
+Return whether a symbol has a constant value, including being an offset within
+some frag.
+
+@item symbol_get_bfdsym
+@cindex symbol_get_bfdsym
+Return the BFD symbol associated with a symbol.
+
+@item symbol_set_bfdsym
+@cindex symbol_set_bfdsym
+Set the BFD symbol associated with a symbol.
+
+@item symbol_get_obj
+@cindex symbol_get_obj
+Return a pointer to the @code{OBJ_SYMFIELD_TYPE} field of a symbol.
+
+@item symbol_set_obj
+@cindex symbol_set_obj
+Set the @code{OBJ_SYMFIELD_TYPE} field of a symbol.
+
+@item symbol_get_tc
+@cindex symbol_get_tc
+Return a pointer to the @code{TC_SYMFIELD_TYPE} field of a symbol.
+
+@item symbol_set_tc
+@cindex symbol_set_tc
+Set the @code{TC_SYMFIELD_TYPE} field of a symbol.
+
 @end table
 
+When @code{BFD_ASSEMBLER} is defined, GAS attempts to store local
+symbols--symbols which will not be written to the output file--using a
+different structure, @code{struct local_symbol}.  This structure can only
+represent symbols whose value is an offset within a frag.
+
+Code outside of the symbol handler will always deal with @code{symbolS}
+structures and use the accessor functions.  The accessor functions correctly
+deal with local symbols.  @code{struct local_symbol} is much smaller than
+@code{symbolS} (which also automatically creates a bfd @code{asymbol}
+structure), so this saves space when assembling large files.
+
+The first field of @code{symbolS} is @code{bsym}, the pointer to the BFD
+symbol.  The first field of @code{struct local_symbol} is a pointer which is
+always set to NULL.  This is how the symbol accessor functions can distinguish
+local symbols from ordinary symbols.  The symbol accessor functions
+automatically convert a local symbol into an ordinary symbol when necessary.
+
 @node Expressions
 @subsection Expressions
 @cindex internals, expressions
@@ -787,7 +914,9 @@
 @cindex line_separator_chars
 This is a null terminated @code{const char} array of characters which separate
 lines (semicolon and newline are such characters by default, and need not be
-listed in this array).
+listed in this array).  Note that line_separator_chars do not separate lines
+if found in a comment, such as after a character in line_comment_chars or
+comment_chars.
 
 @item EXP_CHARS
 @cindex EXP_CHARS
@@ -805,13 +934,13 @@
 
 @item LEX_AT
 @cindex LEX_AT
-You may define this macro to the lexical type of the @kbd{@}} character.  The
+You may define this macro to the lexical type of the @kbd{@@} character.  The
 default is zero.
 
 Lexical types are a combination of @code{LEX_NAME} and @code{LEX_BEGIN_NAME},
 both defined in @file{read.h}.  @code{LEX_NAME} indicates that the character
 may appear in a name.  @code{LEX_BEGIN_NAME} indicates that the character may
-appear at the beginning of a nem.
+appear at the beginning of a name.
 
 @item LEX_BR
 @cindex LEX_BR
@@ -833,6 +962,12 @@
 You may define this macro to the lexical type of the @kbd{$} character.  The
 default value is @code{LEX_NAME | LEX_BEGIN_NAME}.
 
+@item NUMBERS_WITH_SUFFIX
+@cindex NUMBERS_WITH_SUFFIX
+When this macro is defined to be non-zero, the parser allows the radix of a
+constant to be indicated with a suffix.  Valid suffixes are binary (B), 
+octal (Q), and hexadecimal (H).  Case is not significant.
+
 @item SINGLE_QUOTE_STRINGS
 @cindex SINGLE_QUOTE_STRINGS
 If you define this macro, GAS will treat single quotes as string delimiters.
@@ -861,6 +996,11 @@
 You may define this macro to control what GAS considers to be a label.  The
 default definition is to accept any name followed by a colon character.
 
+@item TC_START_LABEL_WITHOUT_COLON
+@cindex TC_START_LABEL_WITHOUT_COLON
+Same as TC_START_LABEL, but should be used instead of TC_START_LABEL when
+LABELS_WITHOUT_COLONS is defined. 
+
 @item NO_PSEUDO_DOT
 @cindex NO_PSEUDO_DOT
 If you define this macro, GAS will not require pseudo-ops to start with a
@@ -869,7 +1009,9 @@
 @item TC_EQUAL_IN_INSN
 @cindex TC_EQUAL_IN_INSN
 If you define this macro, it should return nonzero if the instruction is
-permitted to contain an @kbd{=} character.  GAS will use this to decide if a
+permitted to contain an @kbd{=} character.  GAS will call it with two
+arguments, the character before the @kbd{=} character, and the value of
+@code{input_line_pointer} at that point.  GAS uses this macro to decide if a
 @kbd{=} is an assignment or an instruction.
 
 @item TC_EOL_IN_INSN
@@ -891,13 +1033,14 @@
 name or value changes dynamically, possibly in a context sensitive way.
 Predefined symbols with fixed values, such as register names or condition
 codes, are typically entered directly into the symbol table when @code{md_begin}
-is called.
+is called.  One argument is passed, a @code{char *} for the symbol.
 
 @item md_operand
 @cindex md_operand
-GAS will call this function for any expression that can not be recognized.
-When the function is called, @code{input_line_pointer} will point to the start
-of the expression.
+GAS will call this function with one argument, an @code{expressionS}
+pointer, for any expression that can not be recognized.  When the function
+is called, @code{input_line_pointer} will point to the start of the
+expression.
 
 @item tc_unrecognized_line
 @cindex tc_unrecognized_line
@@ -916,6 +1059,16 @@
 You may define this macro to do special handling for an alignment directive.
 GAS will call it at the end of the assembly.
 
+@item TC_IMPLICIT_LCOMM_ALIGNMENT (@var{size}, @var{p2var})
+@cindex TC_IMPLICIT_LCOMM_ALIGNMENT
+An @code{.lcomm} directive with no explicit alignment parameter will use this
+macro to set @var{p2var} to the alignment that a request for @var{size} bytes
+will have.  The alignment is expressed as a power of two.  If no alignment
+should take place, the macro definition should do nothing.  Some targets define
+a @code{.bss} directive that is also affected by this macro.  The default
+definition will set @var{p2var} to the truncated power of two of sizes up to
+eight bytes.
+
 @item md_flush_pending_output
 @cindex md_flush_pending_output
 If you define this macro, GAS will call it each time it skips any space because of a
@@ -987,11 +1140,11 @@
 @cindex md_create_long_jump
 If @code{WORKING_DOT_WORD} is defined, GAS will not do broken word processing
 (@pxref{Broken words}).  Otherwise, you should set @code{md_short_jump_size} to
-the size of a short jump (a jump that is just long enough to jump around a long
-jmp) and @code{md_long_jump_size} to the size of a long jump (a jump that can
-go anywhere in the function), You should define @code{md_create_short_jump} to
-create a short jump around a long jump, and define @code{md_create_long_jump}
-to create a long jump.
+the size of a short jump (a jump that is just long enough to jump around a
+number of long jumps) and @code{md_long_jump_size} to the size of a long jump
+(a jump that can go anywhere in the function).  You should define
+@code{md_create_short_jump} to create a short jump around a number of long
+jumps, and define @code{md_create_long_jump} to create a long jump.
 
 @item md_estimate_size_before_relax
 @cindex md_estimate_size_before_relax
@@ -1034,7 +1187,10 @@
 @item md_apply_fix
 @cindex md_apply_fix
 GAS will call this for each fixup.  It should store the correct value in the
-object file.
+object file.  @code{fixup_segment} performs a generic overflow check on the
+@code{valueT *val} argument after @code{md_apply_fix} returns.  If the overflow
+check is relevant for the target machine, then @code{md_apply_fix} should
+modify @code{valueT *val}, typically to the value stored in the object file.
 
 @item TC_HANDLES_FX_DONE
 @cindex TC_HANDLES_FX_DONE
@@ -1086,7 +1242,43 @@
 @item md_section_align
 @cindex md_section_align
 GAS will call this function for each section at the end of the assembly, to
-permit the CPU backend to adjust the alignment of a section.
+permit the CPU backend to adjust the alignment of a section.  The function
+must take two arguments, a @code{segT} for the section and a @code{valueT}
+for the size of the section, and return a @code{valueT} for the rounded
+size.
+
+@item md_macro_start
+@cindex md_macro_start
+If defined, GAS will call this macro when it starts to include a macro
+expansion.  @code{macro_nest} indicates the current macro nesting level, which
+includes the one being expanded. 
+
+@item md_macro_info
+@cindex md_macro_info
+If defined, GAS will call this macro after the macro expansion has been
+included in the input and after parsing the macro arguments.  The single
+argument is a pointer to the macro processing's internal representation of the
+macro (macro_entry *), which includes expansion of the formal arguments.
+
+@item md_macro_end
+@cindex md_macro_end
+Complement to md_macro_start.  If defined, it is called when finished
+processing an inserted macro expansion, just before decrementing macro_nest. 
+
+@item DOUBLEBAR_PARALLEL
+@cindex DOUBLEBAR_PARALLEL
+Affects the preprocessor so that lines containing '||' don't have their
+whitespace stripped following the double bar.  This is useful for targets that
+implement parallel instructions.
+
+@item KEEP_WHITE_AROUND_COLON
+@cindex KEEP_WHITE_AROUND_COLON
+Normally, whitespace is compressed and removed when, in the presence of the
+colon, the adjoining tokens can be distinguished.  This option affects the
+preprocessor so that whitespace around colons is preserved.  This is useful
+when colons might be removed from the input after preprocessing but before
+assembling, so that adjoining tokens can still be distinguished if there is
+whitespace, or concatentated if there is not.
 
 @item tc_frob_section
 @cindex tc_frob_section
@@ -1244,6 +1436,13 @@
 @item obj_frob_file_after_relocs
 If you define this macro, GAS will call it after the relocs have been
 generated.
+
+@item SET_SECTION_RELOCS (@var{sec}, @var{relocs}, @var{n})
+@cindex SET_SECTION_RELOCS
+If you define this, it will be called after the relocations have been set for
+the section @var{sec}.  The list of relocations is in @var{relocs}, and the
+number of relocations is in @var{n}.  This is only used with
+@code{BFD_ASSEMBLER}.
 @end table
 
 @node Emulations
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
new file mode 100644
index 0000000..b83175a
--- /dev/null
+++ b/gas/dwarf2dbg.c
@@ -0,0 +1,770 @@
+/* dwarf2dbg.c - DWARF2 debug support
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+/* Logical line numbers can be controlled by the compiler via the
+   following two directives:
+
+	.file FILENO "file.c"
+	.loc  FILENO LINENO [COLUMN]
+
+   FILENO is the filenumber.  */
+
+#include "ansidecl.h"
+
+#include "as.h"
+#include "dwarf2dbg.h"
+#include "subsegs.h"
+
+#include "elf/dwarf2.h"
+
+/* Since we can't generate the prolog until the body is complete, we
+   use three different subsegments for .debug_line: one holding the
+   prolog, one for the directory and filename info, and one for the
+   body ("statement program").  */
+#define DL_PROLOG	0
+#define DL_FILES	1
+#define DL_BODY		2
+
+/* First special line opcde - leave room for the standard opcodes.
+   Note: If you want to change this, you'll have to update the
+   "standard_opcode_lengths" table that is emitted below in
+   dwarf2_finish().  */
+#define DWARF2_LINE_OPCODE_BASE		10
+
+#ifndef DWARF2_LINE_BASE
+  /* Minimum line offset in a special line info. opcode.  This value
+     was chosen to give a reasonable range of values.  */
+# define DWARF2_LINE_BASE		-5
+#endif
+
+/* Range of line offsets in a special line info. opcode.  */
+#ifndef DWARF2_LINE_RANGE
+# define DWARF2_LINE_RANGE		14
+#endif
+
+#ifndef DWARF2_LINE_MIN_INSN_LENGTH
+  /* Define the architecture-dependent minimum instruction length (in
+     bytes).  This value should be rather too small than too big.  */
+# define DWARF2_LINE_MIN_INSN_LENGTH	4
+#endif
+
+/* Flag that indicates the initial value of the is_stmt_start flag.
+   In the present implementation, we do not mark any lines as
+   the beginning of a source statement, because that information
+   is not made available by the GCC front-end.  */
+#define	DWARF2_LINE_DEFAULT_IS_STMT	1
+
+/* Flag that indicates the initial value of the is_stmt_start flag.
+   In the present implementation, we do not mark any lines as
+   the beginning of a source statement, because that information
+   is not made available by the GCC front-end.  */
+#define	DWARF2_LINE_DEFAULT_IS_STMT	1
+
+/* Given a special op, return the line skip amount.  */
+#define SPECIAL_LINE(op) \
+	(((op) - DWARF2_LINE_OPCODE_BASE)%DWARF2_LINE_RANGE + DWARF2_LINE_BASE)
+
+/* Given a special op, return the address skip amount (in units of
+   DWARF2_LINE_MIN_INSN_LENGTH.  */
+#define SPECIAL_ADDR(op) (((op) - DWARF2_LINE_OPCODE_BASE)/DWARF2_LINE_RANGE)
+
+/* The maximum address skip amount that can be encoded with a special op.  */
+#define MAX_SPECIAL_ADDR_DELTA		SPECIAL_ADDR(255)
+
+#define INITIAL_STATE						\
+  /* Initialize as per DWARF2.0 standard.  */			\
+  0,					/* address */		\
+  1,					/* file */		\
+  1,					/* line */		\
+  0,					/* column */		\
+  DWARF2_LINE_DEFAULT_IS_STMT,		/* is_stmt */		\
+  0,					/* basic_block */	\
+  1					/* empty_sequence */
+
+static struct
+  {
+    /* state machine state as per DWARF2 manual: */
+    struct dwarf2_sm
+      {
+	addressT addr;
+	unsigned int filenum;
+	unsigned int line;
+	unsigned int column;
+	unsigned int
+	  is_stmt : 1,
+	  basic_block : 1,
+	  empty_sequence : 1;		/* current code sequence has no DWARF2 directives? */
+      }
+    sm;
+
+    unsigned int
+      any_dwarf2_directives : 1;	/* did we emit any DWARF2 line debug directives? */
+
+    fragS * frag;	/* frag that "addr" is relative to */
+    segT text_seg;	/* text segment "addr" is relative to */
+    subsegT text_subseg;
+    segT line_seg;	/* ".debug_line" segment */
+    int last_filename;	/* index of last filename that was used */
+    int num_filenames;	/* index of last filename in use */
+    int filename_len;	/* length of the filename array */
+    struct
+      {
+	int dir;	/* valid after gen_dir_list() only */
+	char *name; /* full path before gen_dir_list(), filename afterwards */
+      }
+    *file;
+
+    struct dwarf2_line_info current;	/* current source info: */
+
+    /* counters for statistical purposes: */
+    unsigned int num_line_entries;
+    unsigned int opcode_hist[256];	/* histogram of opcode frequencies */
+  }
+ls =
+  {
+    {
+      INITIAL_STATE
+    },
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    NULL,
+    { NULL, 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, 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, 0, 0, 0, 0, 0
+    }
+  };
+
+
+/* Function prototypes: */
+static void out_uleb128 PARAMS ((addressT));
+static void out_sleb128 PARAMS ((offsetT));
+static void gen_addr_line PARAMS ((int, addressT));
+static void reset_state_machine PARAMS ((void));
+static void out_set_addr PARAMS ((addressT));
+static void out_end_sequence PARAMS ((void));
+static int get_filenum PARAMS ((int, char *));
+static void gen_dir_list PARAMS ((void));
+static void gen_file_list PARAMS ((void));
+static void print_stats PARAMS ((unsigned long));
+
+
+#define out_byte(byte)	FRAG_APPEND_1_CHAR(byte)
+#define out_opcode(opc)	(out_byte ((opc)), ++ls.opcode_hist[(opc) & 0xff])
+
+/* Output an unsigned "little-endian base 128" number.  */
+static void
+out_uleb128 (value)
+     addressT value;
+{
+  unsigned char byte, more = 0x80;
+
+  do
+    {
+      byte = value & 0x7f;
+      value >>= 7;
+      if (value == 0)
+	more = 0;
+      out_byte (more | byte);
+    }
+  while (more);
+}
+
+/* Output a signed "little-endian base 128" number.  */
+static void
+out_sleb128 (value)
+     offsetT value;
+{
+  unsigned char byte, more = 0x80;
+
+  do
+    {
+      byte = value & 0x7f;
+      value >>= 7;
+      if (((value == 0) && ((byte & 0x40) == 0))
+	  || ((value == -1) && ((byte & 0x40) != 0)))
+	more = 0;
+      out_byte (more | byte);
+    }
+  while (more);
+}
+
+/* Encode a pair of line and address skips as efficiently as possible.
+   Note that the line skip is signed, whereas the address skip is
+   unsigned.  */
+static void
+gen_addr_line (line_delta, addr_delta)
+     int line_delta;
+     addressT addr_delta;
+{
+  unsigned int tmp, opcode;
+
+  tmp = line_delta - DWARF2_LINE_BASE;
+
+  if (tmp >= DWARF2_LINE_RANGE)
+    {
+      out_opcode (DW_LNS_advance_line);
+      out_sleb128 (line_delta);
+      tmp = 0 - DWARF2_LINE_BASE;
+      line_delta = 0;
+    }
+
+  tmp += DWARF2_LINE_OPCODE_BASE;
+
+  /* try using a special opcode: */
+  opcode = tmp + addr_delta*DWARF2_LINE_RANGE;
+  if (opcode <= 255)
+    {
+      out_opcode (opcode);
+      return;
+    }
+
+  /* try using DW_LNS_const_add_pc followed by special op: */
+  opcode = tmp + (addr_delta - MAX_SPECIAL_ADDR_DELTA)*DWARF2_LINE_RANGE;
+  if (opcode <= 255)
+    {
+      out_opcode (DW_LNS_const_add_pc);
+      out_opcode (opcode);
+      return;
+    }
+
+  out_opcode (DW_LNS_advance_pc);
+  out_uleb128 (addr_delta);
+
+  if (line_delta)
+    out_opcode (tmp);		/* output line-delta */
+  else
+    out_opcode (DW_LNS_copy);	/* append new row with current info */
+}
+
+static void
+reset_state_machine ()
+{
+  static const struct dwarf2_sm initial_state = { INITIAL_STATE };
+
+  ls.sm = initial_state;
+}
+
+/* Set an absolute address (may results in a relocation entry): */
+static void
+out_set_addr (addr)
+     addressT addr;
+{
+  subsegT saved_subseg;
+  segT saved_seg;
+  expressionS expr;
+  symbolS *sym;
+  int bytes_per_address;
+
+  saved_seg = now_seg;
+  saved_subseg = now_subseg;
+
+  subseg_set (ls.text_seg, ls.text_subseg);
+  sym = symbol_new (".L0\001", now_seg, addr, frag_now);
+
+  subseg_set (saved_seg, saved_subseg);
+
+#ifdef BFD_ASSEMBLER
+  bytes_per_address = bfd_arch_bits_per_address (stdoutput) / 8;
+#else
+  /* FIXME.  */
+  bytes_per_address = 4;
+#endif
+
+  out_opcode (DW_LNS_extended_op);
+  out_uleb128 (bytes_per_address + 1);
+
+  out_opcode (DW_LNE_set_address);
+  expr.X_op = O_symbol;
+  expr.X_add_symbol = sym;
+  expr.X_add_number = 0;
+  emit_expr (&expr, bytes_per_address);
+}
+
+/* Emit DW_LNS_end_sequence and reset state machine.  Does not
+   preserve the current segment/sub-segment!  */
+static void
+out_end_sequence ()
+{
+  addressT addr, delta;
+  fragS *text_frag;
+
+  if (ls.text_seg)
+    {
+      subseg_set (ls.text_seg, ls.text_subseg);
+#ifdef md_current_text_addr
+      addr = md_current_text_addr ();
+#else
+      addr = frag_now_fix ();
+#endif
+      text_frag = frag_now;
+      subseg_set (ls.line_seg, DL_BODY);
+      if (text_frag != ls.frag)
+	{
+	  out_set_addr (addr);
+	  ls.sm.addr = addr;
+	  ls.frag = text_frag;
+	}
+      else
+	{
+	  delta = (addr - ls.sm.addr) / DWARF2_LINE_MIN_INSN_LENGTH;
+	  if (delta > 0)
+	    {
+	      /* Advance address without updating the line-debug
+		 matrix---the end_sequence entry is used only to tell
+		 the debugger the end of the sequence.*/
+	      out_opcode (DW_LNS_advance_pc);
+	      out_uleb128 (delta);
+	    }
+	}
+    }
+  else
+    subseg_set (ls.line_seg, DL_BODY);
+
+  out_opcode (DW_LNS_extended_op);
+  out_uleb128 (1);
+  out_byte (DW_LNE_end_sequence);
+
+  reset_state_machine ();
+}
+
+/* Look up a filenumber either by filename or by filenumber.  If both
+   a filenumber and a filename are specified, lookup by filename takes
+   precedence.  If the filename cannot be found, it is added to the
+   filetable and the filenumber for the new entry is returned.  */
+static int
+get_filenum (filenum, file)
+     int filenum;
+     char *file;
+{
+  int i, last = filenum - 1;
+  char char0 = file[0];
+
+  /* If filenum is out of range of the filename table, then try using the
+     table entry returned from the previous call.  */
+  if (last >= ls.num_filenames || last < 0)
+    last = ls.last_filename;
+
+  /* Do a quick check against the specified or previously used filenum.  */
+  if (ls.num_filenames > 0 && ls.file[last].name[0] == char0
+      && strcmp (ls.file[last].name + 1, file + 1) == 0)
+    return last + 1;
+
+  /* no match, fall back to simple linear scan: */
+  for (i = 0; i < ls.num_filenames; ++i)
+    {
+      if (ls.file[i].name[0] == char0
+	  && strcmp (ls.file[i].name + 1, file + 1) == 0)
+	{
+	  ls.last_filename = i;
+	  return i + 1;
+	}
+    }
+
+  /* no match: enter new filename */
+  if (ls.num_filenames >= ls.filename_len)
+    {
+      ls.filename_len += 13;
+      ls.file = xrealloc (ls.file, ls.filename_len * sizeof (ls.file[0]));
+    }
+  ls.file[ls.num_filenames].dir = 0;
+  ls.file[ls.num_filenames].name = file;
+  ls.last_filename = ls.num_filenames;
+  return ++ls.num_filenames;
+}
+
+/* Emit an entry in the line number table if the address or line has changed.
+   ADDR is relative to the current frag in the text section.  */
+
+void
+dwarf2_gen_line_info (addr, l)
+     addressT addr;
+     struct dwarf2_line_info *l;
+{
+  unsigned int filenum = l->filenum;
+  unsigned int any_output = 0;
+  subsegT saved_subseg;
+  segT saved_seg;
+  fragS *saved_frag;
+
+  if (flag_debug)
+    fprintf (stderr, "line: addr %lx file `%s' line %u col %u flags %x\n",
+	     (unsigned long) addr, l->filename, l->line, l->column, l->flags);
+
+  if (filenum > 0 && !l->filename)
+    {
+      if (filenum >= (unsigned int) ls.num_filenames)
+	{
+	  as_warn ("Encountered bad file number in line number debug info!");
+	  return;
+	}
+    }
+  else if (l->filename)
+    filenum = get_filenum (filenum, l->filename);
+  else
+    return;	/* no filename, no filnum => no play */
+
+  /* Must save these before the subseg_new call, as that call will change
+     them.  */
+  saved_seg = now_seg;
+  saved_subseg = now_subseg;
+  saved_frag = frag_now;
+
+  if (!ls.line_seg)
+    {
+#ifdef BFD_ASSEMBLER
+      symbolS *secsym;
+#endif
+
+      ls.line_seg = subseg_new (".debug_line", 0);
+
+#ifdef BFD_ASSEMBLER
+      bfd_set_section_flags (stdoutput, ls.line_seg, SEC_READONLY);
+
+      /* We're going to need this symbol.  */
+      secsym = symbol_find (".debug_line");
+      if (secsym != NULL)
+        symbol_set_bfdsym (secsym, ls.line_seg->symbol);
+      else
+        symbol_table_insert (section_symbol (ls.line_seg));
+#endif
+    }
+
+  subseg_set (ls.line_seg, DL_BODY);
+
+  if (ls.text_seg != saved_seg || ls.text_subseg != saved_subseg)
+    {
+      if (!ls.sm.empty_sequence)
+	{
+	  out_end_sequence ();		/* terminate previous sequence */
+	  ls.sm.empty_sequence = 1;
+	}
+      any_output = 1;
+      ls.text_seg = saved_seg;
+      ls.text_subseg = saved_subseg;
+      out_set_addr (addr);
+      ls.sm.addr = addr;
+      ls.frag = saved_frag;
+    }
+
+  if (ls.sm.filenum != filenum)
+    {
+      any_output = 1;
+      out_opcode (DW_LNS_set_file);
+      out_uleb128 (filenum);
+      ls.sm.filenum = filenum;
+    }
+
+  if (ls.sm.column != l->column)
+    {
+      any_output = 1;
+      out_opcode (DW_LNS_set_column);
+      out_uleb128 (l->column);
+      ls.sm.column = l->column;
+    }
+
+  if (((l->flags & DWARF2_FLAG_BEGIN_STMT) != 0) != ls.sm.is_stmt)
+    {
+      any_output = 1;
+      out_opcode (DW_LNS_negate_stmt);
+    }
+
+  if (l->flags & DWARF2_FLAG_BEGIN_BLOCK)
+    {
+      any_output = 1;
+      out_opcode (DW_LNS_set_basic_block);
+    }
+
+  if (ls.sm.line != l->line)
+    {
+      any_output = 1;
+      if (saved_frag != ls.frag)
+	{
+	  /* If a new frag got allocated (for whatever reason), then
+	     deal with it by generating a reference symbol.  Note: no
+	     end_sequence needs to be generated because the address did
+	     not really decrease (only the reference point changed).  */
+	  out_set_addr (addr);
+	  ls.sm.addr = addr;
+	  ls.frag = saved_frag;
+	}
+      gen_addr_line (l->line - ls.sm.line,
+		     (addr - ls.sm.addr) / DWARF2_LINE_MIN_INSN_LENGTH);
+      ls.sm.basic_block = 0;
+      ls.sm.line = l->line;
+      ls.sm.addr = addr;
+    }
+
+  subseg_set (saved_seg, saved_subseg);
+
+  ls.num_line_entries += any_output;
+  if (any_output)
+    ls.sm.empty_sequence = 0;
+}
+
+static void
+gen_dir_list ()
+{
+  char *str, *slash, *dir_list, *dp, *cp;
+  int i, j, num_dirs;
+
+  dir_list = frag_more (0);
+  num_dirs = 0;
+
+  for (i = 0; i < ls.num_filenames; ++i)
+    {
+      str = ls.file[i].name;
+      slash = strrchr (str, '/');
+      if (slash)
+	{
+	  *slash = '\0';
+	  for (j = 0, dp = dir_list; j < num_dirs; ++j)
+	    {
+	      if (strcmp (str, dp) == 0)
+		{
+		  ls.file[i].dir = j + 1;
+		  break;
+		}
+	      dp += strlen (dp);
+	    }
+	  if (j >= num_dirs)
+	    {
+	      /* didn't find this directory: append it to the list */
+	      size_t size = strlen (str) + 1;
+	      cp = frag_more (size);
+	      memcpy (cp, str, size);
+	      ls.file[i].dir = ++num_dirs;
+	    }
+	  *slash = '/';
+	  ls.file[i].name = slash + 1;
+	}
+    }
+  out_byte ('\0');	/* terminate directory list */
+}
+
+static void
+gen_file_list ()
+{
+  size_t size;
+  char *cp;
+  int i;
+
+  for (i = 0; i < ls.num_filenames; ++i)
+    {
+      size = strlen (ls.file[i].name) + 1;
+      cp = frag_more (size);
+      memcpy (cp, ls.file[i].name, size);
+
+      out_uleb128 (ls.file[i].dir);	/* directory number */
+      out_uleb128 (0);			/* last modification timestamp */
+      out_uleb128 (0);			/* filesize */
+    }
+  out_byte (0);		/* terminate filename list */
+}
+
+static void
+print_stats (total_size)
+     unsigned long total_size;
+{
+  static const char *opc_name[] =
+    {
+      "extended", "copy", "advance_pc", "advance_line", "set_file",
+      "set_column", "negate_stmt", "set_basic_block", "const_add_pc",
+      "fixed_advance_pc"
+    };
+  size_t i;
+  int j;
+
+  fprintf (stderr, "Average size: %g bytes/line\n",
+	   total_size / (double) ls.num_line_entries);
+
+  fprintf (stderr, "\nStandard opcode histogram:\n");
+
+  for (i = 0; i < sizeof (opc_name)/sizeof (opc_name[0]); ++i)
+    {
+      fprintf (stderr, "%s", opc_name[i]);
+      for (j = strlen (opc_name[i]); j < 16; ++j)
+	fprintf (stderr, " ");
+      fprintf (stderr, ": %u\n", ls.opcode_hist[i]);
+    }
+
+  fprintf (stderr, "\nSpecial opcodes:\naddr\t\t\t\tline skip\n");
+
+  fprintf (stderr, "skip: ");
+  for (j = DWARF2_LINE_BASE; j < DWARF2_LINE_BASE + DWARF2_LINE_RANGE; ++j)
+    fprintf (stderr, "%3d", j);
+  fprintf (stderr, "\n-----");
+
+  for (; i < 256; ++i)
+    {
+      j = SPECIAL_LINE (i);
+      if (j == DWARF2_LINE_BASE)
+	fprintf (stderr, "\n%4u: ",
+		 ((unsigned int)
+		  DWARF2_LINE_MIN_INSN_LENGTH * SPECIAL_ADDR (i)));
+      fprintf (stderr, " %2u", ls.opcode_hist[i]);
+    }
+  fprintf (stderr, "\n");
+}
+
+void
+dwarf2_finish ()
+{
+  addressT body_size, total_size, prolog_size;
+  subsegT saved_subseg;
+  segT saved_seg;
+  char *cp;
+
+  if (!ls.line_seg)
+    /* no .debug_line segment, no work to do... */
+    return;
+
+  saved_seg = now_seg;
+  saved_subseg = now_subseg;
+
+  if (!ls.sm.empty_sequence)
+    out_end_sequence ();
+  total_size = body_size = frag_now_fix ();
+
+  /* now generate the directory and file lists: */
+  subseg_set (ls.line_seg, DL_FILES);
+  gen_dir_list ();
+  gen_file_list ();
+  total_size += frag_now_fix ();
+
+  /* and now the header ("statement program prolog", in DWARF2 lingo...) */
+  subseg_set (ls.line_seg, DL_PROLOG);
+
+  cp = frag_more (15 + DWARF2_LINE_OPCODE_BASE - 1);
+
+  total_size += frag_now_fix ();
+  prolog_size = total_size - body_size - 10;
+
+# define STUFF(val,size)	md_number_to_chars (cp, val, size); cp += size;
+  STUFF (total_size - 4, 4);	/* length */
+  STUFF (2, 2);			/* version */
+  STUFF (prolog_size, 4);	/* prologue_length */
+  STUFF (DWARF2_LINE_MIN_INSN_LENGTH, 1);
+  STUFF (DWARF2_LINE_DEFAULT_IS_STMT, 1);
+  STUFF (DWARF2_LINE_BASE, 1);
+  STUFF (DWARF2_LINE_RANGE, 1);
+  STUFF (DWARF2_LINE_OPCODE_BASE, 1);
+
+  /* standard_opcode_lengths: */
+  STUFF (0, 1);			/* DW_LNS_copy */
+  STUFF (1, 1);			/* DW_LNS_advance_pc */
+  STUFF (1, 1);			/* DW_LNS_advance_line */
+  STUFF (1, 1);			/* DW_LNS_set_file */
+  STUFF (1, 1);			/* DW_LNS_set_column */
+  STUFF (0, 1);			/* DW_LNS_negate_stmt */
+  STUFF (0, 1);			/* DW_LNS_set_basic_block */
+  STUFF (0, 1);			/* DW_LNS_const_add_pc */
+  STUFF (1, 1);			/* DW_LNS_fixed_advance_pc */
+
+  subseg_set (saved_seg, saved_subseg);
+
+  if (flag_debug)
+    print_stats (total_size);
+}
+
+void
+dwarf2_directive_file (dummy)
+     int dummy ATTRIBUTE_UNUSED;
+{
+  int len;
+
+  /* Continue to accept a bare string and pass it off.  */
+  SKIP_WHITESPACE ();
+  if (*input_line_pointer == '"')
+    {
+      s_app_file (0);
+      return;
+    }
+
+  ls.any_dwarf2_directives = 1;
+
+  if (debug_type == DEBUG_NONE)
+    /* Automatically turn on DWARF2 debug info unless something else
+       has been selected.  */
+    debug_type = DEBUG_DWARF2;
+
+  ls.current.filenum = get_absolute_expression ();
+  ls.current.filename = demand_copy_C_string (&len);
+
+  demand_empty_rest_of_line ();
+}
+
+void
+dwarf2_directive_loc (dummy)
+     int dummy ATTRIBUTE_UNUSED;
+{
+  ls.any_dwarf2_directives = 1;
+
+  ls.current.filenum = get_absolute_expression ();
+  SKIP_WHITESPACE ();
+  ls.current.line = get_absolute_expression ();
+  SKIP_WHITESPACE ();
+  ls.current.column = get_absolute_expression ();
+  demand_empty_rest_of_line ();
+
+  ls.current.flags = DWARF2_FLAG_BEGIN_STMT;
+
+#ifndef NO_LISTING
+  if (listing)
+    listing_source_line (ls.current.line);
+#endif
+}
+
+void
+dwarf2_where (line)
+     struct dwarf2_line_info *line;
+{
+  if (ls.any_dwarf2_directives)
+    *line = ls.current;
+  else
+    {
+      as_where (&line->filename, &line->line);
+      line->filenum = 0;
+      line->column = 0;
+      line->flags = DWARF2_FLAG_BEGIN_STMT;
+    }
+}
diff --git a/gas/dwarf2dbg.h b/gas/dwarf2dbg.h
new file mode 100644
index 0000000..a3eec1c
--- /dev/null
+++ b/gas/dwarf2dbg.h
@@ -0,0 +1,69 @@
+/* dwarf2dbg.h - DWARF2 debug support
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS 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 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 GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+#ifndef AS_DWARF2DBG_H
+#define AS_DWARF2DBG_H
+
+#include "as.h"
+
+#define DWARF2_FLAG_BEGIN_STMT	(1 << 0)	/* beginning of statement */
+#define DWARF2_FLAG_BEGIN_BLOCK	(1 << 1)	/* beginning of basic block */
+
+struct dwarf2_line_info
+  {
+    char *filename;
+    unsigned int filenum;
+    unsigned int line;
+    unsigned int column;
+    unsigned int flags;
+  };
+
+/* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
+   to indicate that no file number has been assigned.  All real file
+   number must be >0.  */
+extern void dwarf2_directive_file PARAMS ((int dummy));
+
+/* Implements the .loc FILENO LINENO [COLUMN] directive.  FILENO is
+   the file number, LINENO the line number and the (optional) COLUMN
+   the column of the source code that the following instruction
+   corresponds to.  FILENO can be 0 to indicate that the filename
+   specified by the textually most recent .file directive should be
+   used.  */
+extern void dwarf2_directive_loc PARAMS ((int dummy));
+
+/* Returns the current source information.  If .file directives have
+   been encountered, the info for the corresponding source file is
+   returned.  Otherwise, the info for the assembly source file is
+   returned.  */
+extern void dwarf2_where PARAMS ((struct dwarf2_line_info *l));
+
+/* This function generates .debug_line info based on the address and
+   source information passed in the arguments.  ADDR should be the
+   frag-relative offset of the instruction the information is for and
+   L is the source information that should be associated with that
+   address. */
+extern void dwarf2_gen_line_info PARAMS ((addressT addr,
+					  struct dwarf2_line_info *l));
+
+/* Must be called after all other input is processed to finish up the
+   .debug_line section.  */
+extern void dwarf2_finish PARAMS ((void));
+
+#endif /* AS_DWARF2DBG_H */
diff --git a/gas/ecoff.c b/gas/ecoff.c
index c3c9375..436c8c4 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -1,5 +1,5 @@
 /* ECOFF debugging support.
-   Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.  A
    good deal of it comes directly from mips-tfile.c, by Michael
@@ -28,11 +28,12 @@
    ECOFF debugging information (e.g., MIPS ECOFF, MIPS ELF, Alpha
    ECOFF).  */
 
+#include "ecoff.h"
+
 #ifdef ECOFF_DEBUGGING
 
 #include "coff/internal.h"
 #include "coff/symconst.h"
-#include "ecoff.h"
 #include "aout/stab_gnu.h"
 
 #include <ctype.h>
@@ -1513,6 +1514,8 @@
 ecoff_symbol_new_hook (symbolP)
      symbolS *symbolP;
 {
+  OBJ_SYMFIELD_TYPE *obj;
+
   /* Make sure that we have a file pointer, but only if we have seen a
      file.  If we haven't seen a file, then this is a probably special
      symbol created by md_begin which may required special handling at
@@ -1521,9 +1524,10 @@
   if (cur_file_ptr == (efdr_t *) NULL
       && seen_at_least_1_file ())
     add_file ((const char *) NULL, 0, 1);
-  symbolP->ecoff_file = cur_file_ptr;
-  symbolP->ecoff_symbol = NULL;
-  symbolP->ecoff_extern_size = 0;
+  obj = symbol_get_obj (symbolP);
+  obj->ecoff_file = cur_file_ptr;
+  obj->ecoff_symbol = NULL;
+  obj->ecoff_extern_size = 0;
 }
 
 /* Add a page to a varray object.  */
@@ -1643,7 +1647,7 @@
     psym->name = str;
   psym->as_sym = sym_value;
   if (sym_value != (symbolS *) NULL)
-    sym_value->ecoff_symbol = psym;
+    symbol_get_obj (sym_value)->ecoff_symbol = psym;
   psym->addend = addend;
   psym->file_ptr = cur_file_ptr;
   psym->proc_ptr = cur_proc_ptr;
@@ -2170,7 +2174,7 @@
 
   /* Set the BSF_FUNCTION flag for the symbol.  */
   sym = symbol_find_or_make (func);
-  sym->bsym->flags |= BSF_FUNCTION;
+  symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
 
   /* Push the start of the function.  */
   new_proc_ptr->sym = add_ecoff_symbol ((const char *) NULL, st_Proc, sc_Text,
@@ -3122,7 +3126,8 @@
       ++input_line_pointer;
       SKIP_WHITESPACE ();
     }
-  if (isdigit (*input_line_pointer) || *input_line_pointer == '-')
+  if (isdigit ((unsigned char) *input_line_pointer)
+      || *input_line_pointer == '-')
     (void) get_absolute_expression ();
 
   demand_empty_rest_of_line ();
@@ -3150,7 +3155,7 @@
     ++input_line_pointer;
   size = get_absolute_expression ();
 
-  symbolp->ecoff_extern_size = size;
+  symbol_get_obj (symbolp)->ecoff_extern_size = size;
 }
 
 /* Parse .file directives.  */
@@ -3432,7 +3437,7 @@
 	      ignore_rest_of_line();
 	      return;
 	    }
-	  symbolP->sy_value = exp;
+	  symbol_set_value_expression (symbolP, &exp);
 	}
     }
 
@@ -3565,7 +3570,7 @@
 	listing_source_file (string);
 #endif
 
-      if (isdigit (*input_line_pointer)
+      if (isdigit ((unsigned char) *input_line_pointer)
 	  || *input_line_pointer == '-'
 	  || *input_line_pointer == '+')
 	{
@@ -3615,12 +3620,12 @@
      ECOFF symbol.  We want to compute the type of the ECOFF symbol
      independently.  */
   if (sym != (symbolS *) NULL)
-    hold = sym->ecoff_symbol;
+    hold = symbol_get_obj (sym)->ecoff_symbol;
 
   (void) add_ecoff_symbol (string, st, sc, sym, addend, value, indx);
 
   if (sym != (symbolS *) NULL)
-    sym->ecoff_symbol = hold;
+    symbol_get_obj (sym)->ecoff_symbol = hold;
 
   /* Restore normal file type.  */
   cur_file_ptr = save_file_ptr;
@@ -3657,7 +3662,7 @@
     }
 
   /* Double check weak symbols.  */
-  if (sym->bsym->flags & BSF_WEAK)
+  if (S_IS_WEAK (sym))
     {
       if (S_IS_COMMON (sym))
 	as_bad (_("Symbol `%s' can not be both weak and common"),
@@ -4083,7 +4088,8 @@
 				  || S_IS_WEAK (as_sym)
 				  || ! S_IS_DEFINED (as_sym)))
 			    {
-			      if ((as_sym->bsym->flags & BSF_FUNCTION) != 0)
+			      if ((symbol_get_bfdsym (as_sym)->flags
+				   & BSF_FUNCTION) != 0)
 				st = st_Proc;
 			      else
 				st = st_Global;
@@ -4095,18 +4101,19 @@
 
 			  if (! S_IS_DEFINED (as_sym))
 			    {
-			      if (as_sym->ecoff_extern_size == 0
-				  || (as_sym->ecoff_extern_size
-				      > bfd_get_gp_size (stdoutput)))
+			      valueT s;
+
+			      s = symbol_get_obj (as_sym)->ecoff_extern_size;
+			      if (s == 0
+				  || s > bfd_get_gp_size (stdoutput))
 				sc = sc_Undefined;
 			      else
 				{
 				  sc = sc_SUndefined;
-				  sym_ptr->ecoff_sym.asym.value =
-				    as_sym->ecoff_extern_size;
+				  sym_ptr->ecoff_sym.asym.value = s;
 				}
 #ifdef S_SET_SIZE
-			      S_SET_SIZE (as_sym, as_sym->ecoff_extern_size);
+			      S_SET_SIZE (as_sym, s);
 #endif
 			    }
 			  else if (S_IS_COMMON (as_sym))
@@ -4289,7 +4296,7 @@
 		     case this is an external symbol.  Note that this
 		     destroys the asym.index field.  */
 		  if (as_sym != (symbolS *) NULL
-		      && as_sym->ecoff_symbol == sym_ptr)
+		      && symbol_get_obj (as_sym)->ecoff_symbol == sym_ptr)
 		    {
 		      if ((sym_ptr->ecoff_sym.asym.st == st_Proc
 			   || sym_ptr->ecoff_sym.asym.st == st_StaticProc)
@@ -4658,7 +4665,7 @@
 
   for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym))
     {
-      if (sym->ecoff_symbol == NULL)
+      if (symbol_get_obj (sym)->ecoff_symbol == NULL)
 	continue;
 
       /* If this is a local symbol, then force the fields to zero.  */
@@ -4666,13 +4673,16 @@
 	  && ! S_IS_WEAK (sym)
 	  && S_IS_DEFINED (sym))
 	{
-	  sym->ecoff_symbol->ecoff_sym.asym.value = 0;
-	  sym->ecoff_symbol->ecoff_sym.asym.st = (int) st_Nil;
-	  sym->ecoff_symbol->ecoff_sym.asym.sc = (int) sc_Nil;
-	  sym->ecoff_symbol->ecoff_sym.asym.index = indexNil;
+	  struct localsym *lsym;
+
+	  lsym = symbol_get_obj (sym)->ecoff_symbol;
+	  lsym->ecoff_sym.asym.value = 0;
+	  lsym->ecoff_sym.asym.st = (int) st_Nil;
+	  lsym->ecoff_sym.asym.sc = (int) sc_Nil;
+	  lsym->ecoff_sym.asym.index = indexNil;
 	}
 
-      obj_ecoff_set_ext (sym, &sym->ecoff_symbol->ecoff_sym);
+      obj_ecoff_set_ext (sym, &symbol_get_obj (sym)->ecoff_symbol->ecoff_sym);
     }
 }
 
@@ -4722,12 +4732,12 @@
   cur_proc_ptr = (proc_t *) NULL;
   for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym))
     {
-      if (sym->ecoff_symbol != NULL
-	  || sym->ecoff_file == (efdr_t *) NULL
-	  || (sym->bsym->flags & BSF_SECTION_SYM) != 0)
+      if (symbol_get_obj (sym)->ecoff_symbol != NULL
+	  || symbol_get_obj (sym)->ecoff_file == (efdr_t *) NULL
+	  || (symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) != 0)
 	continue;
 
-      cur_file_ptr = sym->ecoff_file;
+      cur_file_ptr = symbol_get_obj (sym)->ecoff_file;
       add_ecoff_symbol ((const char *) NULL, st_Nil, sc_Nil, sym,
 			(bfd_vma) 0, S_GET_VALUE (sym), indexNil);
     }
diff --git a/gas/ecoff.h b/gas/ecoff.h
index 1a9b6fc..8ac65f8 100644
--- a/gas/ecoff.h
+++ b/gas/ecoff.h
@@ -1,5 +1,5 @@
 /* ecoff.h -- header file for ECOFF debugging support
-   Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    Put together by Ian Lance Taylor <ian@cygnus.com>.
 
@@ -41,10 +41,10 @@
 
 /* This function should be called when a new symbol is created, by
    obj_symbol_new_hook.  */
-extern void ecoff_symbol_new_hook PARAMS ((struct symbol *));
+extern void ecoff_symbol_new_hook PARAMS ((symbolS *));
 
 /* This function should be called by the obj_frob_symbol hook.  */
-extern void ecoff_frob_symbol PARAMS ((struct symbol *));
+extern void ecoff_frob_symbol PARAMS ((symbolS *));
 
 /* Build the ECOFF debugging information.  This should be called by
    obj_frob_file.  This fills in the counts in *HDR; the offsets are
@@ -89,7 +89,7 @@
 /* This routine is called from the ECOFF code to set the external
    information for a symbol.  */
 #ifndef obj_ecoff_set_ext
-extern void obj_ecoff_set_ext PARAMS ((struct symbol *, EXTR *));
+extern void obj_ecoff_set_ext PARAMS ((symbolS *, EXTR *));
 #endif
 
 /* This routine is used to patch up a line number directive when
@@ -100,7 +100,7 @@
 extern int ecoff_no_current_file PARAMS ((void));
 
 /* This function returns the symbol associated with the current proc.  */
-extern struct symbol *ecoff_get_cur_proc_sym PARAMS ((void));
+extern symbolS *ecoff_get_cur_proc_sym PARAMS ((void));
 
 #endif /* ECOFF_DEBUGGING */
 
diff --git a/gas/expr.c b/gas/expr.c
index d5d55fd..7cca437 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -1,5 +1,5 @@
 /* expr.c -operands, expressions-
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -34,6 +34,10 @@
 #include "obstack.h"
 
 static void floating_constant PARAMS ((expressionS * expressionP));
+static valueT generic_bignum_to_int32 PARAMS ((void));
+#ifdef BFD64
+static valueT generic_bignum_to_int64 PARAMS ((void));
+#endif
 static void integer_constant PARAMS ((int radix, expressionS * expressionP));
 static void mri_char_constant PARAMS ((expressionS *));
 static void current_location PARAMS ((expressionS *));
@@ -100,7 +104,7 @@
 			    ? absolute_section
 			    : expr_section),
 			   0, &zero_address_frag);
-  symbolP->sy_value = *expressionP;
+  symbol_set_value_expression (symbolP, expressionP);
 
   if (expressionP->X_op == O_constant)
     resolve_symbol_value (symbolP, 1);
@@ -323,7 +327,7 @@
 #define valuesize 32
 #endif
 
-  if (flag_m68k_mri && radix == 0)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0)
     {
       int flt = 0;
 
@@ -385,7 +389,7 @@
       break;
     case 10:
       maxdig = radix = 10;
-      too_many_digits = (valuesize + 12) / 4; /* very rough */
+      too_many_digits = (valuesize + 11) / 4; /* very rough */
     }
 #undef valuesize
   start = input_line_pointer;
@@ -537,7 +541,9 @@
 	}
     }
 
-  if (flag_m68k_mri && suffix != NULL && input_line_pointer - 1 == suffix)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+      && suffix != NULL 
+      && input_line_pointer - 1 == suffix)
     c = *input_line_pointer++;
 
   if (small)
@@ -806,13 +812,15 @@
     case '9':
       input_line_pointer--;
 
-      integer_constant (flag_m68k_mri ? 0 : 10, expressionP);
+      integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+                        ? 0 : 10,
+                        expressionP);
       break;
 
     case '0':
       /* non-decimal radix */
 
-      if (flag_m68k_mri)
+      if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
 	{
 	  char *s;
 
@@ -825,8 +833,7 @@
 	      integer_constant (0, expressionP);
 	      break;
 	    }
-	}
-
+        }
       c = *input_line_pointer;
       switch (c)
 	{
@@ -836,7 +843,7 @@
 	case 'Q':
 	case '8':
 	case '9':
-	  if (flag_m68k_mri)
+	  if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
 	    {
 	      integer_constant (0, expressionP);
 	      break;
@@ -869,7 +876,7 @@
 	  break;
 
 	case 'b':
-	  if (LOCAL_LABELS_FB && ! flag_m68k_mri)
+	  if (LOCAL_LABELS_FB && ! (flag_m68k_mri || NUMBERS_WITH_SUFFIX))
 	    {
 	      /* This code used to check for '+' and '-' here, and, in
 		 some conditions, fall through to call
@@ -891,7 +898,7 @@
 	  /* Fall through.  */
 	case 'B':
 	  input_line_pointer++;
-	  if (flag_m68k_mri)
+	  if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
 	    goto default_case;
 	  integer_constant (2, expressionP);
 	  break;
@@ -904,7 +911,9 @@
 	case '5':
 	case '6':
 	case '7':
-	  integer_constant (flag_m68k_mri ? 0 : 8, expressionP);
+	  integer_constant ((flag_m68k_mri || NUMBERS_WITH_SUFFIX)
+                            ? 0 : 8, 
+                            expressionP);
 	  break;
 
 	case 'f':
@@ -914,7 +923,8 @@
 		 number, make it one.  Otherwise, make it a local label,
 		 and try to deal with parsing the rest later.  */
 	      if (!input_line_pointer[1]
-		  || (is_end_of_line[0xff & input_line_pointer[1]]))
+		  || (is_end_of_line[0xff & input_line_pointer[1]])
+		  || strchr (FLT_CHARS, 'f') == NULL)
 		goto is_0f_label;
 	      {
 		char *cp = input_line_pointer + 1;
@@ -954,7 +964,7 @@
 
 	case 'd':
 	case 'D':
-	  if (flag_m68k_mri)
+	  if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
 	    {
 	      integer_constant (0, expressionP);
 	      break;
@@ -985,7 +995,9 @@
       break;
 
     case '(':
+#ifndef NEED_INDEX_OPERATOR
     case '[':
+#endif
       /* didn't begin with digit & not a name */
       segment = expression (expressionP);
       /* Expression() will pass trailing whitespace */
@@ -999,6 +1011,7 @@
       /* here with input_line_pointer->char after "(...)" */
       return segment;
 
+#ifdef TC_M68K
     case 'E':
       if (! flag_m68k_mri || *input_line_pointer != '\'')
 	goto de_fault;
@@ -1009,6 +1022,7 @@
 	goto de_fault;
       ++input_line_pointer;
       /* Fall through.  */
+#endif
     case '\'':
       if (! flag_m68k_mri)
 	{
@@ -1028,11 +1042,13 @@
       (void) operand (expressionP);
       break;
 
+#ifdef TC_M68K
     case '"':
       /* Double quote is the bitwise not operator in MRI mode.  */
       if (! flag_m68k_mri)
 	goto de_fault;
       /* Fall through.  */
+#endif
     case '~':
       /* ~ is permitted to start a label on the Delta.  */
       if (is_name_beginner (c))
@@ -1074,6 +1090,7 @@
       }
       break;
 
+#if defined (DOLLAR_DOT) || defined (TC_M68K)
     case '$':
       /* $ is the program counter when in MRI mode, or when DOLLAR_DOT
          is defined.  */
@@ -1094,6 +1111,7 @@
 
       current_location (expressionP);
       break;
+#endif
 
     case '.':
       if (!is_part_of_name (*input_line_pointer))
@@ -1157,6 +1175,7 @@
       input_line_pointer--;
       break;
 
+#ifdef TC_M68K
     case '%':
       if (! flag_m68k_mri)
 	goto de_fault;
@@ -1186,9 +1205,12 @@
 
       current_location (expressionP);
       break;
+#endif
 
     default:
+#ifdef TC_M68K
     de_fault:
+#endif
       if (is_end_of_line[(unsigned char) c])
 	goto eol;
       if (is_name_beginner (c))	/* here if did not begin with a digit */
@@ -1305,7 +1327,7 @@
 
   /* The PA port needs this information.  */
   if (expressionP->X_add_symbol)
-    expressionP->X_add_symbol->sy_used = 1;
+    symbol_mark_used (expressionP->X_add_symbol);
 
   switch (expressionP->X_op)
     {
@@ -1352,8 +1374,8 @@
       break;
     case O_subtract:
       if (expressionP->X_op_symbol == expressionP->X_add_symbol
-	  || ((expressionP->X_op_symbol->sy_frag
-	       == expressionP->X_add_symbol->sy_frag)
+	  || ((symbol_get_frag (expressionP->X_op_symbol)
+	       == symbol_get_frag (expressionP->X_add_symbol))
 	      && SEG_NORMAL (S_GET_SEGMENT (expressionP->X_add_symbol))
 	      && (S_GET_VALUE (expressionP->X_op_symbol)
 		  == S_GET_VALUE (expressionP->X_add_symbol))))
@@ -1411,7 +1433,13 @@
   __, __, __, __, __, __, __, __,
   __, __, __, __, __, __, __, __,
   __, __, __, __, __, __, __, __,
-  __, __, __, __, __, __, O_bit_exclusive_or, __,
+  __, __, __,
+#ifdef NEED_INDEX_OPERATOR
+  O_index,
+#else
+  __,
+#endif
+  __, __, O_bit_exclusive_or, __,
   __, __, __, __, __, __, __, __,
   __, __, __, __, __, __, __, __,
   __, __, __, __, __, __, __, __,
@@ -1449,28 +1477,45 @@
   0,	/* O_symbol_rva */
   0,	/* O_register */
   0,	/* O_bit */
-  8,	/* O_uminus */
-  8,	/* O_bit_not */
-  8,	/* O_logical_not */
-  7,	/* O_multiply */
-  7,	/* O_divide */
-  7,	/* O_modulus */
-  7,	/* O_left_shift */
-  7,	/* O_right_shift */
-  6,	/* O_bit_inclusive_or */
-  6,	/* O_bit_or_not */
-  6,	/* O_bit_exclusive_or */
-  6,	/* O_bit_and */
-  4,	/* O_add */
-  4,	/* O_subtract */
-  3,	/* O_eq */
-  3,	/* O_ne */
-  3,	/* O_lt */
-  3,	/* O_le */
-  3,	/* O_ge */
-  3,	/* O_gt */
-  2,	/* O_logical_and */
-  1	/* O_logical_or */
+  9,	/* O_uminus */
+  9,	/* O_bit_not */
+  9,	/* O_logical_not */
+  8,	/* O_multiply */
+  8,	/* O_divide */
+  8,	/* O_modulus */
+  8,	/* O_left_shift */
+  8,	/* O_right_shift */
+  7,	/* O_bit_inclusive_or */
+  7,	/* O_bit_or_not */
+  7,	/* O_bit_exclusive_or */
+  7,	/* O_bit_and */
+  5,	/* O_add */
+  5,	/* O_subtract */
+  4,	/* O_eq */
+  4,	/* O_ne */
+  4,	/* O_lt */
+  4,	/* O_le */
+  4,	/* O_ge */
+  4,	/* O_gt */
+  3,	/* O_logical_and */
+  2,	/* O_logical_or */
+  1,	/* O_index */
+  0,	/* O_md1 */
+  0,	/* O_md2 */
+  0,	/* O_md3 */
+  0,	/* O_md4 */
+  0,	/* O_md5 */
+  0,	/* O_md6 */
+  0,	/* O_md7 */
+  0,	/* O_md8 */
+  0,	/* O_md9 */
+  0,	/* O_md10 */
+  0,	/* O_md11 */
+  0,	/* O_md12 */
+  0,	/* O_md13 */
+  0,	/* O_md14 */
+  0,	/* O_md15 */
+  0,	/* O_md16 */
 };
 
 /* Unfortunately, in MRI mode for the m68k, multiplication and
@@ -1603,10 +1648,11 @@
 /* Parse an expression.  */
 
 segT
-expr (rank, resultP)
-     operator_rankT rank;	/* Larger # is higher rank. */
+expr (rankarg, resultP)
+     int rankarg;	/* Larger # is higher rank. */
      expressionS *resultP;	/* Deliver result here. */
 {
+  operator_rankT rank = (operator_rankT) rankarg;
   segT retval;
   expressionS right;
   operatorT op_left;
@@ -1637,6 +1683,17 @@
 
       know (*input_line_pointer != ' ');
 
+      if (op_left == O_index)
+	{
+	  if (*input_line_pointer != ']')
+	    as_bad ("missing right bracket");
+	  else
+	    {
+	      ++input_line_pointer;
+	      SKIP_WHITESPACE ();
+	    }
+	}
+
       if (retval == undefined_section)
 	{
 	  if (SEG_NORMAL (rightseg))
@@ -1696,8 +1753,8 @@
       else if (op_left == O_subtract
 	       && right.X_op == O_symbol
 	       && resultP->X_op == O_symbol
-	       && (right.X_add_symbol->sy_frag
-		   == resultP->X_add_symbol->sy_frag)
+	       && (symbol_get_frag (right.X_add_symbol)
+		   == symbol_get_frag (resultP->X_add_symbol))
 	       && SEG_NORMAL (S_GET_SEGMENT (right.X_add_symbol)))
 
 	{
@@ -1811,7 +1868,7 @@
 
   /* The PA port needs this information.  */
   if (resultP->X_add_symbol)
-    resultP->X_add_symbol->sy_used = 1;
+    symbol_mark_used (resultP->X_add_symbol);
 
   return resultP->X_op == O_constant ? absolute_section : retval;
 }
@@ -1839,9 +1896,13 @@
   /* We accept \001 in a name in case this is being called with a
      constructed string.  */
   if (is_name_beginner (c = *input_line_pointer++) || c == '\001')
-    while (is_part_of_name (c = *input_line_pointer++)
-	   || c == '\001')
-      ;
+    {
+      while (is_part_of_name (c = *input_line_pointer++)
+	     || c == '\001')
+	;
+      if (is_name_ender (c))
+	c = *input_line_pointer++;
+    }
   *--input_line_pointer = 0;
   return (c);
 }
diff --git a/gas/expr.h b/gas/expr.h
index da90743..0ed6af6 100644
--- a/gas/expr.h
+++ b/gas/expr.h
@@ -1,5 +1,5 @@
 /* expr.h -> header file for expr.c
-   Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 92-98, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -102,6 +102,11 @@
   O_logical_and,
   /* (X_add_symbol || X_op_symbol) + X_add_number.  */
   O_logical_or,
+  /* X_op_symbol [ X_add_symbol ] */
+  O_index,
+  /* machine dependent operators */
+  O_md1,  O_md2,  O_md3,  O_md4,  O_md5,  O_md6,  O_md7,  O_md8,
+  O_md9,  O_md10, O_md11, O_md12, O_md13, O_md14, O_md15, O_md16,
   /* this must be the largest value */
   O_max
 } operatorT;
@@ -109,25 +114,32 @@
 typedef struct expressionS
 {
   /* The main symbol.  */
-  struct symbol *X_add_symbol;
+  symbolS *X_add_symbol;
   /* The second symbol, if needed.  */
-  struct symbol *X_op_symbol;
+  symbolS *X_op_symbol;
   /* A number to add.  */
   offsetT X_add_number;
+
   /* The type of the expression.  We can't assume that an arbitrary
      compiler can handle a bitfield of enum type.  FIXME: We could
      check this using autoconf.  */
 #ifdef __GNUC__
-  operatorT X_op : 5;
+  operatorT X_op : 8;
 #else
-  unsigned X_op : 5;
+  unsigned char X_op;
 #endif
+
   /* Non-zero if X_add_number should be regarded as unsigned.  This is
      only valid for O_constant expressions.  It is only used when an
      O_constant must be extended into a bignum (i.e., it is not used
      when performing arithmetic on these values).
      FIXME: This field is not set very reliably.  */
   unsigned int X_unsigned : 1;
+
+  /* 7 additional bits can be defined if needed.  */
+
+  /* Machine dependent field */
+  unsigned short X_md;
 } expressionS;
 
 /* "result" should be type (expressionS *). */
@@ -149,14 +161,13 @@
 extern void expr_set_precedence PARAMS ((void));
 extern segT expr PARAMS ((int rank, expressionS * resultP));
 extern unsigned int get_single_number PARAMS ((void));
-extern struct symbol *make_expr_symbol PARAMS ((expressionS * expressionP));
+extern symbolS *make_expr_symbol PARAMS ((expressionS * expressionP));
 extern int expr_symbol_where
-  PARAMS ((struct symbol *, char **, unsigned int *));
+  PARAMS ((symbolS *, char **, unsigned int *));
 
-extern struct symbol * expr_build_uconstant PARAMS ((offsetT));
-extern struct symbol * expr_build_unary PARAMS ((operatorT, struct symbol *));
-extern struct symbol * expr_build_binary
-  PARAMS ((operatorT, struct symbol *, struct symbol *));
-extern struct symbol * expr_build_dot PARAMS ((void));
+extern symbolS *expr_build_uconstant PARAMS ((offsetT));
+extern symbolS *expr_build_unary PARAMS ((operatorT, symbolS *));
+extern symbolS *expr_build_binary PARAMS ((operatorT, symbolS *, symbolS *));
+extern symbolS *expr_build_dot PARAMS ((void));
 
 /* end of expr.h */
diff --git a/gas/frags.c b/gas/frags.c
index 240b2ee..882cb12 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -114,7 +114,7 @@
   assert (frchain_now->frch_last == frag_now);
 
   /* Fix up old frag's fr_fix.  */
-  frag_now->fr_fix = frag_now_fix () - old_frags_var_max_size;
+  frag_now->fr_fix = frag_now_fix_octets () - old_frags_var_max_size;
   /* Make sure its type is valid.  */
   assert (frag_now->fr_type != 0);
 
@@ -336,12 +336,19 @@
 }
 
 addressT
-frag_now_fix ()
+frag_now_fix_octets ()
 {
   if (now_seg == absolute_section)
     return abs_section_offset;
-  return (addressT) ((char*) obstack_next_free (&frchain_now->frch_obstack)
-		     - frag_now->fr_literal);
+
+  return ((char*) obstack_next_free (&frchain_now->frch_obstack)
+          - frag_now->fr_literal);
+}
+
+addressT
+frag_now_fix ()
+{
+  return frag_now_fix_octets() / OCTETS_PER_BYTE;
 }
 
 void
diff --git a/gas/frags.h b/gas/frags.h
index 9590292..b4c6e38 100644
--- a/gas/frags.h
+++ b/gas/frags.h
@@ -1,5 +1,5 @@
 /* frags.h - Header file for the frag concept.
-   Copyright (C) 1987, 92, 93, 94, 95, 97, 1998
+   Copyright (C) 1987, 92, 93, 94, 95, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -44,17 +44,17 @@
 
 struct frag
 {
-  /* Object file address. */
+  /* Object file address (as an octet offset). */
   addressT fr_address;
   /* Chain forward; ascending address order.  Rooted in frch_root. */
   struct frag *fr_next;
 
-  /* (Fixed) number of chars we know we have.  May be 0. */
+  /* (Fixed) number of octets we know we have.  May be 0. */
   offsetT fr_fix;
-  /* (Variable) number of chars after above.  May be 0. */
+  /* (Variable) number of octets after above.  May be 0. */
   offsetT fr_var;
   /* For variable-length tail. */
-  struct symbol *fr_symbol;
+  symbolS *fr_symbol;
   /* For variable-length tail. */
   offsetT fr_offset;
   /* Points to opcode low addr byte, for relaxation.  */
@@ -101,6 +101,7 @@
    instead, use frag_now_fix ().  */
 COMMON fragS *frag_now;
 extern addressT frag_now_fix PARAMS ((void));
+extern addressT frag_now_fix_octets PARAMS ((void));
 
 /* For foreign-segment symbol fixups. */
 COMMON fragS zero_address_frag;
diff --git a/gas/gasp.c b/gas/gasp.c
index fbb65e3..b35a4ae 100644
--- a/gas/gasp.c
+++ b/gas/gasp.c
@@ -1,5 +1,6 @@
 /* gasp.c - Gnu assembler preprocessor main program.
-   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.
 
    Written by Steve and Judy Chamberlain of Cygnus Support,
       sac@cygnus.com
@@ -76,6 +77,11 @@
    it.  */
 extern void as_abort PARAMS ((const char *, int, const char *));
 
+/* The default obstack chunk size.  If we set this to zero, the
+   obstack code will use whatever will fit in a 4096 byte block.  This
+   is used by the hash table code used by macro.c.  */
+int chunksize = 0;
+
 #define MAX_INCLUDES 30		/* Maximum include depth */
 #define MAX_REASONABLE 1000	/* Maximum number of expansions */
 
@@ -187,37 +193,6 @@
   } hash_table;
 
 
-/* Structures used to store macros. 
-
-   Each macro knows its name and included text.  It gets built with a
-   list of formal arguments, and also keeps a hash table which points
-   into the list to speed up formal search.  Each formal knows its
-   name and its default value.  Each time the macro is expanded, the
-   formals get the actual values attatched to them. */
-
-/* describe the formal arguments to a macro */
-
-typedef struct formal_struct
-  {
-    struct formal_struct *next;	/* next formal in list */
-    sb name;			/* name of the formal */
-    sb def;			/* the default value */
-    sb actual;			/* the actual argument (changed on each expansion) */
-    int index;			/* the index of the formal 0..formal_count-1 */
-  }
-formal_entry;
-
-/* describe the macro. */
-
-typedef struct macro_struct
-  {
-    sb sub;			/* substitution text. */
-    int formal_count;		/* number of formal args. */
-    formal_entry *formals;	/* pointer to list of formal_structs */
-    hash_table formal_hash;	/* hash table of formals. */
-  }
-macro_entry;
-
 /* how we nest files and expand macros etc.
 
    we keep a stack of of include_stack structs.  each include file
@@ -888,7 +863,7 @@
   exp_t res;
   idx = exp_parse (idx, in, &res);
   if (res.add_symbol.len || res.sub_symbol.len)
-    ERROR ((stderr, emsg));
+    ERROR ((stderr, "%s", emsg));
   *val = res.value;
   return idx;
 }
@@ -1379,7 +1354,7 @@
 	  idx = exp_parse (idx, in, &e);
 	  exp_string (&e, &acc);
 	  sb_add_char (&acc, 0);
-	  fprintf (outfile, acc.ptr);
+	  fprintf (outfile, "%s", acc.ptr);
 	  if (idx < in->len && in->ptr[idx] == ',')
 	    {
 	      fprintf (outfile, ",");
@@ -1433,11 +1408,6 @@
       have_fill = 1;
     }
 
-  if (al != 1
-      && al != 2
-      && al != 4)
-    WARNING ((stderr, _("alignment must be one of 1, 2 or 4.\n")));
-
   fprintf (outfile, ".align	%d", al);
   if (have_fill)
     fprintf (outfile, ",%d", fill);
@@ -1917,7 +1887,7 @@
 		   || line.ptr[0] == '!'))
 	{
 	  /* MRI line comment.  */
-	  fprintf (outfile, sb_name (&line));
+	  fprintf (outfile, "%s", sb_name (&line));
 	}
       else
 	{
@@ -2654,8 +2624,8 @@
 static
 void 
 do_local (idx, line)
-     int idx;
-     sb *line;
+     int idx ATTRIBUTE_UNUSED;
+     sb *line ATTRIBUTE_UNUSED;
 {
   ERROR ((stderr, _("LOCAL outside of MACRO")));
 }
@@ -2686,7 +2656,7 @@
     return 0;
 
   sb_terminate (in);
-  if (! check_macro (in->ptr + idx, &out, comment_char, &err))
+  if (! check_macro (in->ptr + idx, &out, comment_char, &err, NULL))
     return 0;
 
   if (err != NULL)
diff --git a/gas/hash.c b/gas/hash.c
index dccd660..0f129fb 100644
--- a/gas/hash.c
+++ b/gas/hash.c
@@ -1,5 +1,5 @@
-/* hash.c - hash table lookup strings -
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1998
+/* hash.c -- gas hash table code
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -15,835 +15,408 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
 
-/*
- * BUGS, GRIPES, APOLOGIA etc.
- *
- * A typical user doesn't need ALL this: I intend to make a library out
- * of it one day - Dean Elsner.
- * Also, I want to change the definition of a symbol to (address,length)
- * so I can put arbitrary binary in the names stored. [see hsh.c for that]
- *
- * This slime is common coupled inside the module. Com-coupling (and other
- * vandalism) was done to speed running time. The interfaces at the
- * module's edges are adequately clean.
- *
- * There is no way to (a) run a test script through this heap and (b)
- * compare results with previous scripts, to see if we have broken any
- * code. Use GNU (f)utilities to do this. A few commands assist test.
- * The testing is awkward: it tries to be both batch & interactive.
- * For now, interactive rules!
- */
-
-/*
- *  The idea is to implement a symbol table. A test jig is here.
- *  Symbols are arbitrary strings; they can't contain '\0'.
- *	[See hsh.c for a more general symbol flavour.]
- *  Each symbol is associated with a char*, which can point to anything
- *  you want, allowing an arbitrary property list for each symbol.
- *
- *  The basic operations are:
- *
- *    new                     creates symbol table, returns handle
- *    find (symbol)           returns char*
- *    insert (symbol,char*)   error if symbol already in table
- *    delete (symbol)         returns char* if symbol was in table
- *    apply                   so you can delete all symbols before die()
- *    die                     destroy symbol table (free up memory)
- *
- *  Supplementary functions include:
- *
- *    say                     how big? what % full?
- *    replace (symbol,newval) report previous value
- *    jam (symbol,value)      assert symbol:=value
- *
- *  You, the caller, have control over errors: this just reports them.
- *
- *  This package requires malloc(), free().
- *  Malloc(size) returns NULL or address of char[size].
- *  Free(address) frees same.
- */
-
-/*
- *  The code and its structures are re-enterent.
- *
- *  Before you do anything else, you must call hash_new() which will
- *  return the address of a hash-table-control-block.  You then use
- *  this address as a handle of the symbol table by passing it to all
- *  the other hash_...() functions.  The only approved way to recover
- *  the memory used by the symbol table is to call hash_die() with the
- *  handle of the symbol table.
- *
- *  Before you call hash_die() you normally delete anything pointed to
- *  by individual symbols. After hash_die() you can't use that symbol
- *  table again.
- *
- *  The char* you associate with a symbol may not be NULL (0) because
- *  NULL is returned whenever a symbol is not in the table. Any other
- *  value is OK, except DELETED, #defined below.
- *
- *  When you supply a symbol string for insertion, YOU MUST PRESERVE THE
- *  STRING until that symbol is deleted from the table. The reason is that
- *  only the address you supply, NOT the symbol string itself, is stored
- *  in the symbol table.
- *
- *  You may delete and add symbols arbitrarily.
- *  Any or all symbols may have the same 'value' (char *). In fact, these
- *  routines don't do anything with your symbol values.
- *
- *  You have no right to know where the symbol:char* mapping is stored,
- *  because it moves around in memory; also because we may change how it
- *  works and we don't want to break your code do we? However the handle
- *  (address of struct hash_control) is never changed in
- *  the life of the symbol table.
- *
- *  What you CAN find out about a symbol table is:
- *    how many slots are in the hash table?
- *    how many slots are filled with symbols?
- *    (total hashes,collisions) for (reads,writes) (*)
- *  All of the above values vary in time.
- *  (*) some of these numbers will not be meaningful if we change the
- *  internals. */
-
-/*
- *  I N T E R N A L
- *
- *  Hash table is an array of hash_entries; each entry is a pointer to a
- *  a string and a user-supplied value 1 char* wide.
- *
- *  The array always has 2 ** n elements, n>0, n integer.
- *  There is also a 'wall' entry after the array, which is always empty
- *  and acts as a sentinel to stop running off the end of the array.
- *  When the array gets too full, we create a new array twice as large
- *  and re-hash the symbols into the new array, then forget the old array.
- *  (Of course, we copy the values into the new array before we junk the
- *  old array!)
- *
- */
-
-#include <stdio.h>
-
-#ifndef FALSE
-#define FALSE	(0)
-#define TRUE	(!FALSE)
-#endif /* no FALSE yet */
-
-#include <ctype.h>
-#define min(a, b)	((a) < (b) ? (a) : (b))
+/* This version of the hash table code is a wholescale replacement of
+   the old hash table code, which was fairly bad.  This is based on
+   the hash table code in BFD, but optimized slightly for the
+   asssembler.  The assembler does not need to derive structures that
+   are stored in the hash table.  Instead, it always stores a pointer.
+   The assembler uses the hash table mostly to store symbols, and we
+   don't need to confuse the symbol structure with a hash table
+   structure.  */
 
 #include "as.h"
+#include "obstack.h"
 
-#define error	as_fatal
+/* The default number of entries to use when creating a hash table.  */
 
-static char _deleted_[1];
-#define DELETED     ((PTR)_deleted_)	/* guarenteed unique address */
-#define START_POWER    (10)	/* power of two: size of new hash table */
+#define DEFAULT_SIZE (4051)
 
-/* TRUE if a symbol is in entry @ ptr.  */
-#define islive(ptr) (ptr->hash_string && ptr->hash_string!=DELETED)
+/* An entry in a hash table.  */
 
-enum stat_enum {
-  /* Number of slots in hash table.  The wall does not count here.
-     We expect this is always a power of 2.  */
-  STAT_SIZE = 0,
-  /* Number of hash_ask calls.  */
-  STAT_ACCESS,
-  STAT_ACCESS_w,
-  /* Number of collisions (total).  This may exceed STAT_ACCESS if we
-     have lots of collisions/access.  */
-  STAT_COLLIDE,
-  STAT_COLLIDE_w,
-  /* Slots used right now.  */
-  STAT_USED,
-  /* How many string compares?  */
-  STAT_STRCMP,
-  STAT_STRCMP_w,
-  /* Size of statistics block... this must be last.  */
-  STATLENGTH
-};
-#define STAT__READ     (0)	/* reading */
-#define STAT__WRITE    (1)	/* writing */
-
-/* When we grow a hash table, by what power of two do we increase it?  */
-#define GROW_FACTOR 1
-/* When should we grow it?  */
-#define FULL_VALUE(N)	((N) / 2)
-
-/* #define SUSPECT to do runtime checks */
-/* #define TEST to be a test jig for hash...() */
-
-#ifdef TEST
-/* TEST: use smaller hash table */
-#undef  START_POWER
-#define START_POWER (3)
-#undef  START_SIZE
-#define START_SIZE  (8)
-#undef  START_FULL
-#define START_FULL  (4)
-#endif
-
 struct hash_entry
 {
-  const char *hash_string;	/* points to where the symbol string is */
-  /* NULL means slot is not used */
-  /* DELETED means slot was deleted */
-  PTR hash_value;		/* user's datum, associated with symbol */
-  unsigned long h;
+  /* Next entry for this hash code.  */
+  struct hash_entry *next;
+  /* String being hashed.  */
+  const char *string;
+  /* Hash code.  This is the full hash code, not the index into the
+     table.  */
+  unsigned long hash;
+  /* Pointer being stored in the hash table.  */
+  PTR data;
 };
 
-struct hash_control {
-  struct hash_entry *hash_where;/* address of hash table */
-  int hash_sizelog;		/* Log of ( hash_mask + 1 ) */
-  int hash_mask;		/* masks a hash into index into table */
-  int hash_full;		/* when hash_stat[STAT_USED] exceeds this, */
-  /* grow table */
-  struct hash_entry *hash_wall;	/* point just after last (usable) entry */
-  /* here we have some statistics */
-  int hash_stat[STATLENGTH];	/* lies & statistics */
+/* A hash table.  */
+
+struct hash_control
+{
+  /* The hash array.  */
+  struct hash_entry **table;
+  /* The number of slots in the hash table.  */
+  unsigned int size;
+  /* An obstack for this hash table.  */
+  struct obstack memory;
+
+#ifdef HASH_STATISTICS
+  /* Statistics.  */
+  unsigned long lookups;
+  unsigned long hash_compares;
+  unsigned long string_compares;
+  unsigned long insertions;
+  unsigned long replacements;
+  unsigned long deletions;
+#endif /* HASH_STATISTICS */
 };
-
-/*------------------ plan ---------------------------------- i = internal
 
-  struct hash_control * c;
-  struct hash_entry   * e;                                                    i
-  int                   b[z];     buffer for statistics
-  z         size of b
-  char                * s;        symbol string (address) [ key ]
-  char                * v;        value string (address)  [datum]
-  boolean               f;        TRUE if we found s in hash table            i
-  char                * t;        error string; 0 means OK
-  int                   a;        access type [0...n)                         i
+/* Create a hash table.  This return a control block.  */
 
-  c=hash_new       ()             create new hash_control
-
-  hash_die         (c)            destroy hash_control (and hash table)
-  table should be empty.
-  doesn't check if table is empty.
-  c has no meaning after this.
-
-  hash_say         (c,b,z)        report statistics of hash_control.
-  also report number of available statistics.
-
-  v=hash_delete    (c,s)          delete symbol, return old value if any.
-  ask()                       NULL means no old value.
-  f
-
-  v=hash_replace   (c,s,v)        replace old value of s with v.
-  ask()                       NULL means no old value: no table change.
-  f
-
-  t=hash_insert    (c,s,v)        insert (s,v) in c.
-  ask()                       return error string.
-  f                           it is an error to insert if s is already
-  in table.
-  if any error, c is unchanged.
-
-  t=hash_jam       (c,s,v)        assert that new value of s will be v.       i
-  ask()                       it may decide to GROW the table.            i
-  f                                                                       i
-  grow()                                                                  i
-  t=hash_grow      (c)            grow the hash table.                        i
-  jam()                       will invoke JAM.                            i
-
-  ?=hash_apply     (c,y)          apply y() to every symbol in c.
-  y                           evtries visited in 'unspecified' order.
-
-  v=hash_find      (c,s)          return value of s, or NULL if s not in c.
-  ask()
-  f
-
-  f,e=hash_ask()   (c,s,a)        return slot where s SHOULD live.            i
-  code()                      maintain collision stats in c.              i
-
-  .=hash_code      (c,s)          compute hash-code for s,                    i
-  from parameters of c.                       i
-
-  */
-
-/* Returned by hash_ask() to stop extra testing. hash_ask() wants to
-   return both a slot and a status. This is the status.  TRUE: found
-   symbol FALSE: absent: empty or deleted slot Also returned by
-   hash_jam().  TRUE: we replaced a value FALSE: we inserted a value.  */
-static char hash_found;
-
-static struct hash_entry *hash_ask PARAMS ((struct hash_control *,
-					    const char *, int));
-static int hash_code PARAMS ((struct hash_control *, const char *));
-static const char *hash_grow PARAMS ((struct hash_control *));
-
-/* Create a new hash table.  Return NULL if failed; otherwise return handle
-   (address of struct hash).  */
 struct hash_control *
 hash_new ()
 {
-  struct hash_control *retval;
-  struct hash_entry *room;	/* points to hash table */
-  struct hash_entry *wall;
-  struct hash_entry *entry;
-  int *ip;		/* scan stats block of struct hash_control */
-  int *nd;		/* limit of stats block */
+  unsigned int size;
+  struct hash_control *ret;
+  unsigned int alloc;
 
-  room = (struct hash_entry *) xmalloc (sizeof (struct hash_entry)
-					/* +1 for the wall entry */
-					* ((1 << START_POWER) + 1));
-  retval = (struct hash_control *) xmalloc (sizeof (struct hash_control));
+  size = DEFAULT_SIZE;
 
-  nd = retval->hash_stat + STATLENGTH;
-  for (ip = retval->hash_stat; ip < nd; ip++)
-    *ip = 0;
+  ret = (struct hash_control *) xmalloc (sizeof *ret);
+  obstack_begin (&ret->memory, chunksize);
+  alloc = size * sizeof (struct hash_entry *);
+  ret->table = (struct hash_entry **) obstack_alloc (&ret->memory, alloc);
+  memset (ret->table, 0, alloc);
+  ret->size = size;
 
-  retval->hash_stat[STAT_SIZE] = 1 << START_POWER;
-  retval->hash_mask = (1 << START_POWER) - 1;
-  retval->hash_sizelog = START_POWER;
-  /* works for 1's compl ok */
-  retval->hash_where = room;
-  retval->hash_wall =
-    wall = room + (1 << START_POWER);
-  retval->hash_full = FULL_VALUE (1 << START_POWER);
-  for (entry = room; entry <= wall; entry++)
-    entry->hash_string = NULL;
-  return retval;
+#ifdef HASH_STATISTICS
+  ret->lookups = 0;
+  ret->hash_compares = 0;
+  ret->string_compares = 0;
+  ret->insertions = 0;
+  ret->replacements = 0;
+  ret->deletions = 0;
+#endif
+
+  return ret;  
 }
 
-/*
- *           h a s h _ d i e ( )
- *
- * Table should be empty, but this is not checked.
- * To empty the table, try hash_apply()ing a symbol deleter.
- * Return to free memory both the hash table and it's control
- * block.
- * 'handle' has no meaning after this function.
- * No errors are recoverable.
- */
+/* Delete a hash table, freeing all allocated memory.  */
+
 void
-hash_die (handle)
-     struct hash_control *handle;
+hash_die (table)
+     struct hash_control *table;
 {
-  free ((char *) handle->hash_where);
-  free ((char *) handle);
-}
-
-#ifdef TEST
-/*
- *           h a s h _ s a y ( )
- *
- * Return the size of the statistics table, and as many statistics as
- * we can until either (a) we have run out of statistics or (b) caller
- * has run out of buffer.
- * NOTE: hash_say treats all statistics alike.
- * These numbers may change with time, due to insertions, deletions
- * and expansions of the table.
- * The first "statistic" returned is the length of hash_stat[].
- * Then contents of hash_stat[] are read out (in ascending order)
- * until your buffer or hash_stat[] is exausted.
- */
-static void
-hash_say (handle, buffer, bufsiz)
-     struct hash_control *handle;
-     int buffer[ /*bufsiz*/ ];
-     int bufsiz;
-{
-  int *nd;		/* limit of statistics block */
-  int *ip;		/* scan statistics */
-
-  ip = handle->hash_stat;
-  nd = ip + min (bufsiz - 1, STATLENGTH);
-  if (bufsiz > 0)		/* trust nothing! bufsiz<=0 is dangerous */
-    {
-      *buffer++ = STATLENGTH;
-      for (; ip < nd; ip++, buffer++)
-	{
-	  *buffer = *ip;
-	}
-    }
-}
-#endif
-
-/*
- *           h a s h _ d e l e t e ( )
- *
- * Try to delete a symbol from the table.
- * If it was there, return its value (and adjust STAT_USED).
- * Otherwise, return NULL.
- * Anyway, the symbol is not present after this function.
- *
- */
-PTR				/* NULL if string not in table, else */
-/* returns value of deleted symbol */
-hash_delete (handle, string)
-     struct hash_control *handle;
-     const char *string;
-{
-  PTR retval;
-  struct hash_entry *entry;
-
-  entry = hash_ask (handle, string, STAT__WRITE);
-  if (hash_found)
-    {
-      retval = entry->hash_value;
-      entry->hash_string = DELETED;
-      handle->hash_stat[STAT_USED] -= 1;
-#ifdef SUSPECT
-      if (handle->hash_stat[STAT_USED] < 0)
-	{
-	  error ("hash_delete");
-	}
-#endif /* def SUSPECT */
-    }
-  else
-    {
-      retval = NULL;
-    }
-  return (retval);
-}
-
-/*
- *                   h a s h _ r e p l a c e ( )
- *
- * Try to replace the old value of a symbol with a new value.
- * Normally return the old value.
- * Return NULL and don't change the table if the symbol is not already
- * in the table.
- */
-PTR
-hash_replace (handle, string, value)
-     struct hash_control *handle;
-     const char *string;
-     PTR value;
-{
-  struct hash_entry *entry;
-  char *retval;
-
-  entry = hash_ask (handle, string, STAT__WRITE);
-  if (hash_found)
-    {
-      retval = entry->hash_value;
-      entry->hash_value = value;
-    }
-  else
-    {
-      retval = NULL;
-    }
-  ;
-  return retval;
-}
-
-/*
- *                   h a s h _ i n s e r t ( )
- *
- * Insert a (symbol-string, value) into the hash table.
- * Return an error string, 0 means OK.
- * It is an 'error' to insert an existing symbol.
- */
-
-const char *			/* return error string */
-hash_insert (handle, string, value)
-     struct hash_control *handle;
-     const char *string;
-     PTR value;
-{
-  struct hash_entry *entry;
-  const char *retval;
-
-  retval = 0;
-  if (handle->hash_stat[STAT_USED] > handle->hash_full)
-    {
-      retval = hash_grow (handle);
-    }
-  if (!retval)
-    {
-      entry = hash_ask (handle, string, STAT__WRITE);
-      if (hash_found)
-	{
-	  retval = "exists";
-	}
-      else
-	{
-	  entry->hash_value = value;
-	  entry->hash_string = string;
-	  handle->hash_stat[STAT_USED] += 1;
-	}
-    }
-  return retval;
-}
-
-/*
- *               h a s h _ j a m ( )
- *
- * Regardless of what was in the symbol table before, after hash_jam()
- * the named symbol has the given value. The symbol is either inserted or
- * (its value is) replaced.
- * An error message string is returned, 0 means OK.
- *
- * WARNING: this may decide to grow the hashed symbol table.
- * To do this, we call hash_grow(), WHICH WILL recursively CALL US.
- *
- * We report status internally: hash_found is TRUE if we replaced, but
- * false if we inserted.
- */
-const char *
-hash_jam (handle, string, value)
-     struct hash_control *handle;
-     const char *string;
-     PTR value;
-{
-  const char *retval;
-  struct hash_entry *entry;
-
-  retval = 0;
-  if (handle->hash_stat[STAT_USED] > handle->hash_full)
-    {
-      retval = hash_grow (handle);
-    }
-  if (!retval)
-    {
-      entry = hash_ask (handle, string, STAT__WRITE);
-      if (!hash_found)
-	{
-	  entry->hash_string = string;
-	  handle->hash_stat[STAT_USED] += 1;
-	}
-      entry->hash_value = value;
-    }
-  return retval;
+  obstack_free (&table->memory, 0);
+  free (table);
 }
 
-/*
- *               h a s h _ g r o w ( )
- *
- * Grow a new (bigger) hash table from the old one.
- * We choose to double the hash table's size.
- * Return a human-scrutible error string: 0 if OK.
- * Warning! This uses hash_jam(), which had better not recurse
- * back here! Hash_jam() conditionally calls us, but we ALWAYS
- * call hash_jam()!
- * Internal.
- */
-static const char *
-hash_grow (handle)		/* make a hash table grow */
-     struct hash_control *handle;
+/* Look up a string in a hash table.  This returns a pointer to the
+   hash_entry, or NULL if the string is not in the table.  If PLIST is
+   not NULL, this sets *PLIST to point to the start of the list which
+   would hold this hash entry.  If PHASH is not NULL, this sets *PHASH
+   to the hash code for KEY.
+
+   Each time we look up a string, we move it to the start of the list
+   for its hash code, to take advantage of referential locality.  */
+
+static struct hash_entry *hash_lookup PARAMS ((struct hash_control *,
+					       const char *,
+					       struct hash_entry ***,
+					       unsigned long *));
+
+static struct hash_entry *
+hash_lookup (table, key, plist, phash)
+     struct hash_control *table;
+     const char *key;
+     struct hash_entry ***plist;
+     unsigned long *phash;
 {
-  struct hash_entry *newwall;
-  struct hash_entry *newwhere;
-  struct hash_entry *newtrack;
-  struct hash_entry *oldtrack;
-  struct hash_entry *oldwhere;
-  struct hash_entry *oldwall;
-  int temp;
-  int newsize;
-  const char *string;
-  const char *retval;
-#ifdef SUSPECT
-  int oldused;
+  register unsigned long hash;
+  unsigned int len;
+  register const unsigned char *s;
+  register unsigned int c;
+  unsigned int index;
+  struct hash_entry **list;
+  struct hash_entry *p;
+  struct hash_entry *prev;
+
+#ifdef HASH_STATISTICS
+  ++table->lookups;
 #endif
 
-  /*
-   * capture info about old hash table
-   */
-  oldwhere = handle->hash_where;
-  oldwall = handle->hash_wall;
-#ifdef SUSPECT
-  oldused = handle->hash_stat[STAT_USED];
-#endif
-  /*
-   * attempt to get enough room for a hash table twice as big
-   */
-  temp = handle->hash_stat[STAT_SIZE];
-  newwhere = ((struct hash_entry *)
-	      xmalloc ((unsigned long) ((temp << (GROW_FACTOR + 1))
-					/* +1 for wall slot */
-					* sizeof (struct hash_entry))));
-  if (newwhere == NULL)
-    return "no_room";
-
-  /*
-   * have enough room: now we do all the work.
-   * double the size of everything in handle.
-   */
-  handle->hash_mask = ((handle->hash_mask + 1) << GROW_FACTOR) - 1;
-  handle->hash_stat[STAT_SIZE] <<= GROW_FACTOR;
-  newsize = handle->hash_stat[STAT_SIZE];
-  handle->hash_where = newwhere;
-  handle->hash_full <<= GROW_FACTOR;
-  handle->hash_sizelog += GROW_FACTOR;
-  handle->hash_wall = newwall = newwhere + newsize;
-  /* Set all those pesky new slots to vacant.  */
-  for (newtrack = newwhere; newtrack <= newwall; newtrack++)
-    newtrack->hash_string = NULL;
-  /* We will do a scan of the old table, the hard way, using the
-   * new control block to re-insert the data into new hash table.  */
-  handle->hash_stat[STAT_USED] = 0;
-  for (oldtrack = oldwhere; oldtrack < oldwall; oldtrack++)
-    if (((string = oldtrack->hash_string) != NULL) && string != DELETED)
-      if ((retval = hash_jam (handle, string, oldtrack->hash_value)))
-	return retval;
-
-#ifdef SUSPECT
-  if (handle->hash_stat[STAT_USED] != oldused)
-    return "hash_used";
-#endif
-
-  /* We have a completely faked up control block.
-     Return the old hash table.  */
-  free ((char *) oldwhere);
-
-  return 0;
-}
-
-#ifdef TEST
-/*
- *          h a s h _ a p p l y ( )
- *
- * Use this to scan each entry in symbol table.
- * For each symbol, this calls (applys) a nominated function supplying the
- * symbol's value (and the symbol's name).
- * The idea is you use this to destroy whatever is associted with
- * any values in the table BEFORE you destroy the table with hash_die.
- * Of course, you can use it for other jobs; whenever you need to
- * visit all extant symbols in the table.
- *
- * We choose to have a call-you-back idea for two reasons:
- *  asthetic: it is a neater idea to use apply than an explicit loop
- *  sensible: if we ever had to grow the symbol table (due to insertions)
- *            then we would lose our place in the table when we re-hashed
- *            symbols into the new table in a different order.
- *
- * The order symbols are visited depends entirely on the hashing function.
- * Whenever you insert a (symbol, value) you risk expanding the table. If
- * you do expand the table, then the hashing function WILL change, so you
- * MIGHT get a different order of symbols visited. In other words, if you
- * want the same order of visiting symbols as the last time you used
- * hash_apply() then you better not have done any hash_insert()s or
- * hash_jam()s since the last time you used hash_apply().
- *
- * In future we may use the value returned by your nominated function.
- * One idea is to abort the scan if, after applying the function to a
- * certain node, the function returns a certain code.
- *
- * The function you supply should be of the form:
- *      void myfunct(string,value)
- *              char * string;        |* the symbol's name *|
- *              char * value;         |* the symbol's value *|
- *      {
- *        |* ... *|
- *      }
- *
- */
-void
-hash_apply (handle, function)
-     struct hash_control *handle;
-     void (*function) ();
-{
-  struct hash_entry *entry;
-  struct hash_entry *wall;
-
-  wall = handle->hash_wall;
-  for (entry = handle->hash_where; entry < wall; entry++)
+  hash = 0;
+  len = 0;
+  s = (const unsigned char *) key;
+  while ((c = *s++) != '\0')
     {
-      if (islive (entry))	/* silly code: tests entry->string twice! */
-	{
-	  (*function) (entry->hash_string, entry->hash_value);
-	}
-    }
-}
-#endif
-
-/*
- *          h a s h _ f i n d ( )
- *
- * Given symbol string, find value (if any).
- * Return found value or NULL.
- */
-PTR
-hash_find (handle, string)
-     struct hash_control *handle;
-     const char *string;
-{
-  struct hash_entry *entry;
-
-  entry = hash_ask (handle, string, STAT__READ);
-  if (hash_found)
-    return entry->hash_value;
-  else
-    return NULL;
-}
-
-/*
- *          h a s h _ a s k ( )
- *
- * Searches for given symbol string.
- * Return the slot where it OUGHT to live. It may be there.
- * Return hash_found: TRUE only if symbol is in that slot.
- * Access argument is to help keep statistics in control block.
- * Internal.
- */
-static struct hash_entry *	/* string slot, may be empty or deleted */
-hash_ask (handle, string, access_type)
-     struct hash_control *handle;
-     const char *string;
-     int access_type;
-{
-  const char *s;
-  struct hash_entry *slot;
-  int collision;	/* count collisions */
-  int strcmps;
-  int hcode;
-
-  /* start looking here */
-  hcode = hash_code (handle, string);
-  slot = handle->hash_where + (hcode & handle->hash_mask);
-
-  handle->hash_stat[STAT_ACCESS + access_type] += 1;
-  collision = strcmps = 0;
-  hash_found = FALSE;
-  while (((s = slot->hash_string) != NULL) && s != DELETED)
-    {
-      if (string == s)
-	{
-	  hash_found = TRUE;
-	  break;
-	}
-      if (slot->h == (unsigned long) hcode)
-	{
-	  if (!strcmp (string, s))
-	    {
-	      hash_found = TRUE;
-	      break;
-	    }
-	  strcmps++;
-	}
-      collision++;
-      slot++;
-    }
-  /*
-   * slot:                                                      return:
-   *       in use:     we found string                           slot
-   *       at empty:
-   *                   at wall:        we fell off: wrap round   ????
-   *                   in table:       dig here                  slot
-   *       at DELETED: dig here                                  slot
-   */
-  if (slot == handle->hash_wall)
-    {
-      slot = handle->hash_where;/* now look again */
-      while (((s = slot->hash_string) != NULL) && s != DELETED)
-	{
-	  if (string == s)
-	    {
-	      hash_found = TRUE;
-	      break;
-	    }
-	  if (slot->h == (unsigned long) hcode)
-	    {
-	      if (!strcmp (string, s))
-		{
-		  hash_found = TRUE;
-		  break;
-		}
-	      strcmps++;
-	    }
-	  collision++;
-	  slot++;
-	}
-      /*
-       * slot:                                                   return:
-       *       in use: we found it                                slot
-       *       empty:  wall:         ERROR IMPOSSIBLE             !!!!
-       *               in table:     dig here                     slot
-       *       DELETED:dig here                                   slot
-       */
-    }
-  handle->hash_stat[STAT_COLLIDE + access_type] += collision;
-  handle->hash_stat[STAT_STRCMP + access_type] += strcmps;
-  if (!hash_found)
-    slot->h = hcode;
-  return slot;			/* also return hash_found */
-}
-
-/*
- *           h a s h _ c o d e
- *
- * Does hashing of symbol string to hash number.
- * Internal.
- */
-static int
-hash_code (handle, string)
-     struct hash_control *handle;
-     const char *string;
-{
-#if 1 /* There seems to be some interesting property of this function
-	 that prevents the bfd version below from being an adequate
-	 substitute.  @@ Figure out what this property is!  */
-  long h;		/* hash code built here */
-  long c;		/* each character lands here */
-  int n;		/* Amount to shift h by */
-
-  n = (handle->hash_sizelog - 3);
-  h = 0;
-  while ((c = *string++) != 0)
-    {
-      h += c;
-      h = (h << 3) + (h >> n) + c;
-    }
-  return h;
-#else
-  /* from bfd */
-  unsigned long h = 0;
-  unsigned int len = 0;
-  unsigned int c;
-
-  while ((c = *string++) != 0)
-    {
-      h += c + (c << 17);
-      h ^= h >> 2;
+      hash += c + (c << 17);
+      hash ^= hash >> 2;
       ++len;
     }
-  h += len + (len << 17);
-  h ^= h >> 2;
-  return h;
+  hash += len + (len << 17);
+  hash ^= hash >> 2;
+
+  if (phash != NULL)
+    *phash = hash;
+
+  index = hash % table->size;
+  list = table->table + index;
+
+  if (plist != NULL)
+    *plist = list;
+
+  prev = NULL;
+  for (p = *list; p != NULL; p = p->next)
+    {
+#ifdef HASH_STATISTICS
+      ++table->hash_compares;
+#endif
+
+      if (p->hash == hash)
+	{
+#ifdef HASH_STATISTICS
+	  ++table->string_compares;
+#endif
+
+	  if (strcmp (p->string, key) == 0)
+	    {
+	      if (prev != NULL)
+		{
+		  prev->next = p->next;
+		  p->next = *list;
+		  *list = p;
+		}
+
+	      return p;
+	    }
+	}
+
+      prev = p;
+    }
+
+  return NULL;
+}
+
+/* Insert an entry into a hash table.  This returns NULL on success.
+   On error, it returns a printable string indicating the error.  It
+   is considered to be an error if the entry already exists in the
+   hash table.  */
+
+const char *
+hash_insert (table, key, value)
+     struct hash_control *table;
+     const char *key;
+     PTR value;
+{
+  struct hash_entry *p;
+  struct hash_entry **list;
+  unsigned long hash;
+
+  p = hash_lookup (table, key, &list, &hash);
+  if (p != NULL)
+    return "exists";
+
+#ifdef HASH_STATISTICS
+  ++table->insertions;
+#endif
+
+  p = obstack_alloc (&table->memory, sizeof *p);
+  p->string = key;
+  p->hash = hash;
+  p->data = value;
+
+  p->next = *list;
+  *list = p;
+
+  return NULL;
+}
+
+/* Insert or replace an entry in a hash table.  This returns NULL on
+   success.  On error, it returns a printable string indicating the
+   error.  If an entry already exists, its value is replaced.  */
+
+const char *
+hash_jam (table, key, value)
+     struct hash_control *table;
+     const char *key;
+     PTR value;
+{
+  struct hash_entry *p;
+  struct hash_entry **list;
+  unsigned long hash;
+
+  p = hash_lookup (table, key, &list, &hash);
+  if (p != NULL)
+    {
+#ifdef HASH_STATISTICS
+      ++table->replacements;
+#endif
+
+      p->data = value;
+    }
+  else
+    {
+#ifdef HASH_STATISTICS
+      ++table->insertions;
+#endif
+
+      p = obstack_alloc (&table->memory, sizeof *p);
+      p->string = key;
+      p->hash = hash;
+      p->data = value;
+
+      p->next = *list;
+      *list = p;
+    }
+
+  return NULL;
+}
+
+/* Replace an existing entry in a hash table.  This returns the old
+   value stored for the entry.  If the entry is not found in the hash
+   table, this does nothing and returns NULL.  */
+
+PTR
+hash_replace (table, key, value)
+     struct hash_control *table;
+     const char *key;
+     PTR value;
+{
+  struct hash_entry *p;
+  PTR ret;
+
+  p = hash_lookup (table, key, NULL, NULL);
+  if (p == NULL)
+    return NULL;
+
+#ifdef HASH_STATISTICS
+  ++table->replacements;
+#endif
+
+  ret = p->data;
+
+  p->data = value;
+
+  return ret;
+}
+
+/* Find an entry in a hash table, returning its value.  Returns NULL
+   if the entry is not found.  */
+
+PTR
+hash_find (table, key)
+     struct hash_control *table;
+     const char *key;
+{
+  struct hash_entry *p;
+
+  p = hash_lookup (table, key, NULL, NULL);
+  if (p == NULL)
+    return NULL;
+
+  return p->data;
+}
+
+/* Delete an entry from a hash table.  This returns the value stored
+   for that entry, or NULL if there is no such entry.  */
+
+PTR
+hash_delete (table, key)
+     struct hash_control *table;
+     const char *key;
+{
+  struct hash_entry *p;
+  struct hash_entry **list;
+
+  p = hash_lookup (table, key, &list, NULL);
+  if (p == NULL)
+    return NULL;
+
+  if (p != *list)
+    abort ();
+
+#ifdef HASH_STATISTICS
+  ++table->deletions;
+#endif
+
+  *list = p->next;
+
+  /* Note that we never reclaim the memory for this entry.  If gas
+     ever starts deleting hash table entries in a big way, this will
+     have to change.  */
+
+  return p->data;
+}
+
+/* Traverse a hash table.  Call the function on every entry in the
+   hash table.  */
+
+void
+hash_traverse (table, pfn)
+     struct hash_control *table;
+     void (*pfn) PARAMS ((const char *key, PTR value));
+{
+  unsigned int i;
+
+  for (i = 0; i < table->size; ++i)
+    {
+      struct hash_entry *p;
+
+      for (p = table->table[i]; p != NULL; p = p->next)
+	(*pfn) (p->string, p->data);
+    }
+}
+
+/* Print hash table statistics on the specified file.  NAME is the
+   name of the hash table, used for printing a header.  */
+
+void
+hash_print_statistics (f, name, table)
+     FILE *f ATTRIBUTE_UNUSED;
+     const char *name ATTRIBUTE_UNUSED;
+     struct hash_control *table ATTRIBUTE_UNUSED;
+{
+#ifdef HASH_STATISTICS
+  unsigned int i;
+  unsigned long total;
+  unsigned long empty;
+
+  fprintf (f, "%s hash statistics:\n", name);
+  fprintf (f, "\t%lu lookups\n", table->lookups);
+  fprintf (f, "\t%lu hash comparisons\n", table->hash_compares);
+  fprintf (f, "\t%lu string comparisons\n", table->string_compares);
+  fprintf (f, "\t%lu insertions\n", table->insertions);
+  fprintf (f, "\t%lu replacements\n", table->replacements);
+  fprintf (f, "\t%lu deletions\n", table->deletions);
+
+  total = 0;
+  empty = 0;
+  for (i = 0; i < table->size; ++i)
+    {
+      struct hash_entry *p;
+
+      if (table->table[i] == NULL)
+	++empty;
+      else
+	{
+	  for (p = table->table[i]; p != NULL; p = p->next)
+	    ++total;
+	}
+    }
+
+  fprintf (f, "\t%g average chain length\n", (double) total / table->size);
+  fprintf (f, "\t%lu empty slots\n", empty);
 #endif
 }
 
-void
-hash_print_statistics (file, name, h)
-     FILE *file;
-     const char *name;
-     struct hash_control *h;
-{
-  unsigned long sz, used, pct;
-
-  if (h == 0)
-    return;
-
-  sz = h->hash_stat[STAT_SIZE];
-  used = h->hash_stat[STAT_USED];
-  pct = (used * 100 + sz / 2) / sz;
-
-  fprintf (file, "%s hash statistics:\n\t%lu/%lu slots used (%lu%%)\n",
-	   name, used, sz, pct);
-
-#define P(name, off)							\
-  fprintf (file, "\t%-16s %6dr + %6dw = %7d\n", name,			\
-	   h->hash_stat[off+STAT__READ],				\
-	   h->hash_stat[off+STAT__WRITE],				\
-	   h->hash_stat[off+STAT__READ] + h->hash_stat[off+STAT__WRITE])
-
-  P ("accesses:", STAT_ACCESS);
-  P ("collisions:", STAT_COLLIDE);
-  P ("string compares:", STAT_STRCMP);
-
-#undef P
-}
-
-/*
- * Here is a test program to exercise above.
- */
 #ifdef TEST
 
+/* This test program is left over from the old hash table code.  */
+
 #define TABLES (6)		/* number of hash tables to maintain */
-/* (at once) in any testing */
+				/* (at once) in any testing */
 #define STATBUFSIZE (12)	/* we can have 12 statistics */
 
 int statbuf[STATBUFSIZE];	/* display statistics here */
@@ -858,8 +431,9 @@
 int used;
 char command;
 int number;			/* number 0:TABLES-1 of current hashed */
-/* symbol table */
+				/* symbol table */
 
+int
 main ()
 {
   void applicatee ();
@@ -891,10 +465,10 @@
 	    }
 	  break;
 	case 'a':
-	  hash_apply (h, applicatee);
+	  hash_traverse (h, applicatee);
 	  break;
 	case 'd':
-	  hash_apply (h, destroy);
+	  hash_traverse (h, destroy);
 	  hash_die (h);
 	  break;
 	case 'f':
@@ -996,8 +570,9 @@
   printf ("%.20s-%.20s\n", string, value);
 }
 
+void
 whattable ()			/* determine number: what hash table to use */
-     /* also determine h: points to hash_control */
+			        /* also determine h: points to hash_control */
 {
 
   for (;;)
@@ -1021,8 +596,6 @@
     }
 }
 
-
-
 #endif /* #ifdef TEST */
 
 /* end of hash.c */
diff --git a/gas/hash.h b/gas/hash.h
index fb229c8..df59d9f 100644
--- a/gas/hash.h
+++ b/gas/hash.h
@@ -1,5 +1,5 @@
-/* hash.h - for hash.c
-   Copyright (C) 1987, 1992 Free Software Foundation, Inc.
+/* hash.h -- header file for gas hash table routines
+   Copyright (C) 1987, 92, 93, 95, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -14,32 +14,65 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
 
-#ifndef hashH
-#define hashH
+#ifndef HASH_H
+#define HASH_H
 
 struct hash_control;
 
-/* returns control block */
-struct hash_control *hash_new PARAMS ((void));
-void hash_die PARAMS ((struct hash_control *));
-/* returns previous value */
-PTR hash_delete PARAMS ((struct hash_control *, const char *str));
-/* returns previous value */
-PTR hash_replace PARAMS ((struct hash_control *, const char *str, PTR val));
-/* returns error string or null */
-const char *hash_insert PARAMS ((struct hash_control *, const char *str,
-				 PTR val));
-/* returns value */
-PTR hash_find PARAMS ((struct hash_control *, const char *str));
-/* returns error text or null (internal) */
-const char *hash_jam PARAMS ((struct hash_control *, const char *str,
-			      PTR val));
+/* Create a hash table.  This return a control block.  */
 
-void hash_print_statistics PARAMS ((FILE *, const char *,
-				    struct hash_control *));
-#endif /* #ifdef hashH */
+extern struct hash_control *hash_new PARAMS ((void));
 
-/* end of hash.c */
+/* Delete a hash table, freeing all allocated memory.  */
+
+extern void hash_die PARAMS ((struct hash_control *));
+
+/* Insert an entry into a hash table.  This returns NULL on success.
+   On error, it returns a printable string indicating the error.  It
+   is considered to be an error if the entry already exists in the
+   hash table.  */
+
+extern const char *hash_insert PARAMS ((struct hash_control *,
+					const char *key, PTR value));
+
+/* Insert or replace an entry in a hash table.  This returns NULL on
+   success.  On error, it returns a printable string indicating the
+   error.  If an entry already exists, its value is replaced.  */
+
+extern const char *hash_jam PARAMS ((struct hash_control *,
+				     const char *key, PTR value));
+
+/* Replace an existing entry in a hash table.  This returns the old
+   value stored for the entry.  If the entry is not found in the hash
+   table, this does nothing and returns NULL.  */
+
+extern PTR hash_replace PARAMS ((struct hash_control *, const char *key,
+				 PTR value));
+
+/* Find an entry in a hash table, returning its value.  Returns NULL
+   if the entry is not found.  */
+
+extern PTR hash_find PARAMS ((struct hash_control *, const char *key));
+
+/* Delete an entry from a hash table.  This returns the value stored
+   for that entry, or NULL if there is no such entry.  */
+
+extern PTR hash_delete PARAMS ((struct hash_control *, const char *key));
+
+/* Traverse a hash table.  Call the function on every entry in the
+   hash table.  */
+
+extern void hash_traverse PARAMS ((struct hash_control *,
+				   void (*pfn) (const char *key, PTR value)));
+
+/* Print hash table statistics on the specified file.  NAME is the
+   name of the hash table, used for printing a header.  */
+
+extern void hash_print_statistics PARAMS ((FILE *, const char *name,
+					   struct hash_control *));
+
+#endif /* HASH_H */
diff --git a/gas/input-file.c b/gas/input-file.c
index c63f7c9..634f6f7 100644
--- a/gas/input-file.c
+++ b/gas/input-file.c
@@ -1,5 +1,6 @@
 /* input_file.c - Deal with Input Files -
-   Copyright (C) 1987, 1990, 1991, 1992, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 98, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -14,8 +15,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
 
 /*
  * Confines all details of reading source bytes to this module.
@@ -30,7 +32,7 @@
 #include "as.h"
 #include "input-file.h"
 
-static int input_file_get PARAMS ((char **));
+static int input_file_get PARAMS ((char *, int));
 
 /* This variable is non-zero if the file currently being read should be
    preprocessed by app.  It is zero if the file can be read straight in.
@@ -191,19 +193,18 @@
 /* This function is passed to do_scrub_chars.  */
 
 static int
-input_file_get (from)
-     char **from;
+input_file_get (buf, buflen)
+     char *buf;
+     int buflen;
 {
-  static char buf[BUFFER_SIZE];
   int size;
 
-  size = fread (buf, sizeof (char), sizeof buf, f_in);
+  size = fread (buf, sizeof (char), buflen, f_in);
   if (size < 0)
     {
       as_perror (_("Can't read from %s"), file_name);
       size = 0;
     }
-  *from = buf;
   return size;
 }
 
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index 46a3bb3..ecbdaef 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -74,6 +74,9 @@
 /* If we are reading from an sb structure, this is it.  */
 static sb from_sb;
 
+/* Should we do a conditional check on from_sb? */
+static int from_sb_is_expansion = 1;
+
 /* The number of nested sb structures we have included.  */
 int macro_nest;
 
@@ -111,6 +114,7 @@
     int logical_input_line;
     int sb_index;
     sb from_sb;
+    int from_sb_is_expansion;       /* Should we do a conditional check? */
     struct input_save *next_saved_file;	/* Chain of input_saves */
     char *input_file_save;	/* Saved state of input routines */
     char *saved_position;	/* Caller's saved position in buf */
@@ -147,6 +151,7 @@
   saved->logical_input_line = logical_input_line;
   saved->sb_index = sb_index;
   saved->from_sb = from_sb;
+  saved->from_sb_is_expansion = from_sb_is_expansion;
   memcpy (saved->save_source, save_source, sizeof (save_source));
   saved->next_saved_file = next_saved_file;
   saved->input_file_save = input_file_push ();
@@ -181,6 +186,7 @@
   logical_input_line = saved->logical_input_line;
   sb_index = saved->sb_index;
   from_sb = saved->from_sb;
+  from_sb_is_expansion = saved->from_sb_is_expansion;
   partial_where = saved->partial_where;
   partial_size = saved->partial_size;
   next_saved_file = saved->next_saved_file;
@@ -255,17 +261,26 @@
    expanding a macro.  */
 
 void
-input_scrub_include_sb (from, position)
+input_scrub_include_sb (from, position, is_expansion)
      sb *from;
      char *position;
+     int is_expansion;
 {
   if (macro_nest > max_macro_nest)
-    as_fatal (_("macros nested too deeply"));
+    as_fatal (_("buffers nested too deeply"));
   ++macro_nest;
 
+#ifdef md_macro_start
+  if (is_expansion)
+    {
+      md_macro_start ();
+    }
+#endif
+
   next_saved_file = input_scrub_push (position);
 
   sb_new (&from_sb);
+  from_sb_is_expansion = is_expansion;
   if (from->len >= 1 && from->ptr[0] != '\n')
     {
       /* Add the sentinel required by read.c.  */
@@ -297,8 +312,15 @@
       if (sb_index >= from_sb.len)
 	{
 	  sb_kill (&from_sb);
-	  cond_finish_check (macro_nest);
-	  --macro_nest;
+          if (from_sb_is_expansion)
+            {
+              cond_finish_check (macro_nest);
+#ifdef md_macro_end
+              /* allow the target to clean up per-macro expansion data */
+              md_macro_end ();
+#endif
+            }
+          --macro_nest;
 	  partial_where = NULL;
 	  if (next_saved_file != NULL)
 	    *bufp = input_scrub_pop (next_saved_file);
diff --git a/gas/itbl-ops.c b/gas/itbl-ops.c
index f008dca..27cca60 100644
--- a/gas/itbl-ops.c
+++ b/gas/itbl-ops.c
@@ -1,5 +1,5 @@
 /* itbl-ops.c
-   Copyright (C) 1997, 1998  Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -457,18 +457,20 @@
 
 /* Get processor's register name from val */
 
-unsigned long 
-itbl_get_reg_val (char *name)
+int
+itbl_get_reg_val (char *name, unsigned long *pval)
 {
   e_type t;
   e_processor p;
-  int r = 0;
+
   for (p = e_p0; p < e_nprocs; p++)
-    for (t = e_regtype0; t < e_nregtypes; t++)
-      {
-	if (r = itbl_get_val (p, t, name), r)
-	  return r;
-      }
+    {
+      for (t = e_regtype0; t < e_nregtypes; t++)
+	{
+	  if (itbl_get_val (p, t, name, pval))
+	    return 1;
+	}
+    }
   return 0;
 }
 
@@ -486,16 +488,17 @@
 
 /* Get processor's register value from name */
 
-unsigned long 
-itbl_get_val (e_processor processor, e_type type, char *name)
+int
+itbl_get_val (e_processor processor, e_type type, char *name,
+	      unsigned long *pval)
 {
   struct itbl_entry *r;
   /* type depends on instruction passed */
   r = find_entry_byname (processor, type, name);
-  if (r)
-    return r->value;
-  else
-    return 0;			/* error; invalid operand */
+  if (r == NULL)
+    return 0;
+  *pval = r->value;
+  return 1;
 }
 
 
@@ -640,7 +643,7 @@
 	  if (r)
 	    strcat (s, r->name);
 	  else
-	    sprintf (s, "%s$%d", s, value);
+	    sprintf (s, "%s$%lu", s, value);
 	  break;
 	case e_addr:
 	  /* use assembler's symbol table to find symbol */
@@ -649,7 +652,7 @@
 			*/
 	  /* If not a symbol, fall thru to IMMED */
 	case e_immed:
-	  sprintf (s, "%s0x%x", s, value);
+	  sprintf (s, "%s0x%lx", s, value);
 	  break;
 	default:
 	  return 0;		/* error; invalid field spec */
@@ -732,28 +735,20 @@
 /* Extract processor's assembly instruction field name from s;
  * forms are "n args" "n,args" or "n" */
 /* Return next argument from string pointer "s" and advance s.
- * delimiters are " ,\0" */
+ * delimiters are " ,()" */
 
 char *
 itbl_get_field (char **S)
 {
   static char n[128];
-  char *p, *ps, *s;
+  char *s;
   int len;
 
   s = *S;
   if (!s || !*s)
     return 0;
-  p = s + strlen (s);
-  if (ps = strchr (s, ','), ps)
-    p = ps;
-  if (ps = strchr (s, ' '), ps)
-    p = min (p, ps);
-  if (ps = strchr (s, '\0'), ps)
-    p = min (p, ps);
-  if (p == 0)
-    return 0;			/* error! */
-  len = p - s;
+  /* FIXME: This is a weird set of delimiters.  */
+  len = strcspn (s, " \t,()");
   ASSERT (128 > len + 1);
   strncpy (n, s, len);
   n[len] = 0;
@@ -816,8 +811,8 @@
 	  eval = apply_range (e->value, e->range);
 	  val &= apply_range (0xffffffff, e->range);
 	}
-      else if (r->sbit == e->range.sbit && r->ebit == e->range.ebit
-	       || e->range.sbit == 0 && e->range.ebit == 0)
+      else if ((r->sbit == e->range.sbit && r->ebit == e->range.ebit)
+	       || (e->range.sbit == 0 && e->range.ebit == 0))
 	{
 	  eval = apply_range (e->value, *r);
 	  val = apply_range (val, *r);
diff --git a/gas/itbl-ops.h b/gas/itbl-ops.h
index 2946eff..d69ea7f 100644
--- a/gas/itbl-ops.h
+++ b/gas/itbl-ops.h
@@ -1,5 +1,5 @@
 /* itbl-ops.h
-   Copyright (C) 1997  Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -92,9 +92,9 @@
 unsigned long itbl_assemble PARAMS ((char *name, char *operands));
 int itbl_disassemble PARAMS ((char *str, unsigned long insn));
 int itbl_parse PARAMS ((char *tbl));	/* parses insn tbl */
-unsigned long itbl_get_reg_val PARAMS ((char *name));
-unsigned long itbl_get_val PARAMS ((e_processor processor, e_type type,
-				    char *name));
+int itbl_get_reg_val PARAMS ((char *name, unsigned long *pval));
+int itbl_get_val PARAMS ((e_processor processor, e_type type, char *name,
+			  unsigned long *pval));
 char *itbl_get_name PARAMS ((e_processor processor, e_type type,
 			     unsigned long val));
 
diff --git a/gas/listing.c b/gas/listing.c
index e2b173b..cecf245 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -109,10 +109,10 @@
 #define LISTING_WORD_SIZE 4
 #endif
 #ifndef LISTING_LHS_WIDTH
-#define LISTING_LHS_WIDTH 1
+#define LISTING_LHS_WIDTH ((LISTING_WORD_SIZE) > 4 ? 1 : 4 / (LISTING_WORD_SIZE))
 #endif
 #ifndef LISTING_LHS_WIDTH_SECOND
-#define LISTING_LHS_WIDTH_SECOND 1
+#define LISTING_LHS_WIDTH_SECOND LISTING_LHS_WIDTH
 #endif
 #ifndef LISTING_RHS_WIDTH
 #define LISTING_RHS_WIDTH 100
@@ -375,7 +375,7 @@
 	      
 	      while (--len)
 		{
-		  char c = * src ++;
+		  unsigned char c = * src ++;
 
 		  /* Omit control characters in the listing.  */
 		  if (isascii (c) && ! iscntrl (c))
@@ -596,7 +596,7 @@
   unsigned int address = ~ (unsigned int) 0;
   fragS *frag;
   fragS *frag_ptr;
-  unsigned int byte_in_frag;
+  unsigned int octet_in_frag;
 
   /* Find first frag which says it belongs to this line */
   frag = list->frag;
@@ -611,33 +611,33 @@
   while (frag_ptr != (fragS *) NULL && frag_ptr->line == first)
     {
       /* Print as many bytes from the fixed part as is sensible */
-      byte_in_frag = 0;
-      while ((offsetT) byte_in_frag < frag_ptr->fr_fix
+      octet_in_frag = 0;
+      while ((offsetT) octet_in_frag < frag_ptr->fr_fix
 	     && data_buffer_size < MAX_BYTES - 3)
 	{
 	  if (address == ~ (unsigned int) 0)
 	    {
-	      address = frag_ptr->fr_address;
+	      address = frag_ptr->fr_address / OCTETS_PER_BYTE;
 	    }
 
 	  sprintf (data_buffer + data_buffer_size,
 		   "%02X",
-		   (frag_ptr->fr_literal[byte_in_frag]) & 0xff);
+		   (frag_ptr->fr_literal[octet_in_frag]) & 0xff);
 	  data_buffer_size += 2;
-	  byte_in_frag++;
+	  octet_in_frag++;
 	}
       {
-	unsigned int var_rep_max = byte_in_frag;
-	unsigned int var_rep_idx = byte_in_frag;
+	unsigned int var_rep_max = octet_in_frag;
+	unsigned int var_rep_idx = octet_in_frag;
 
 	/* Print as many bytes from the variable part as is sensible */
-	while (((offsetT) byte_in_frag
-		< frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)
+	while (((offsetT) octet_in_frag
+		< (frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset))
 	       && data_buffer_size < MAX_BYTES - 3)
 	  {
 	    if (address == ~ (unsigned int) 0)
 	      {
-		address = frag_ptr->fr_address;
+		address = frag_ptr->fr_address / OCTETS_PER_BYTE;
 	      }
 	    sprintf (data_buffer + data_buffer_size,
 		     "%02X",
@@ -649,7 +649,7 @@
 	    data_buffer_size += 2;
 
 	    var_rep_idx++;
-	    byte_in_frag++;
+	    octet_in_frag++;
 
 	    if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var)
 	      var_rep_idx = var_rep_max;
@@ -677,8 +677,9 @@
   unsigned int idx;
   unsigned int nchars;
   unsigned int lines;
-  unsigned int byte_in_word = 0;
+  unsigned int octet_in_word = 0;
   char *src = data_buffer;
+  int cur;
 
   /* Print the stuff on the first line */
   listing_page (list);
@@ -707,18 +708,20 @@
 
   /* And the data to go along with it */
   idx = 0;
-  
-  while (*src && idx < nchars)
+  cur = 0;
+  while (src[cur] && idx < nchars)
     {
-      fprintf (list_file, "%c%c", src[0], src[1]);
-      src += 2;
-      byte_in_word++;
+      int offset;
+      offset = cur;
+      fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+      cur += 2;
+      octet_in_word++;
       
-      if (byte_in_word == LISTING_WORD_SIZE)
+      if (octet_in_word == LISTING_WORD_SIZE)
 	{
 	  fprintf (list_file, " ");
 	  idx++;
-	  byte_in_word = 0;
+	  octet_in_word = 0;
 	}
       
       idx += 2;
@@ -740,7 +743,7 @@
   
   for (lines = 0;
        lines < (unsigned int) listing_lhs_cont_lines
-	 && *src;
+	 && src[cur];
        lines ++)
     {
       nchars = ((LISTING_WORD_SIZE * 2) + 1)
@@ -750,18 +753,20 @@
       /* Print any more lines of data, but more compactly */
       fprintf (list_file, "% 4d      ", lineno);
       
-      while (*src && idx < nchars)
+      while (src[cur] && idx < nchars)
 	{
-	  fprintf (list_file, "%c%c", src[0], src[1]);
-	  src += 2;
+          int offset;
+          offset = cur;
+          fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+	  cur += 2;
 	  idx += 2;
-	  byte_in_word++;
+	  octet_in_word++;
 	  
-	  if (byte_in_word == LISTING_WORD_SIZE)
+	  if (octet_in_word == LISTING_WORD_SIZE)
 	    {
 	      fprintf (list_file, " ");
 	      idx++;
-	      byte_in_word = 0;
+	      octet_in_word = 0;
 	    }
 	}
       
@@ -789,7 +794,7 @@
 	{
 #ifdef BFD_ASSEMBLER
 	  /* Don't report section symbols.  They are not interesting.  */
-	  if (ptr->bsym->flags & BSF_SECTION_SYM)
+	  if (symbol_section_p (ptr))
 	    continue;
 #endif
 	  if (S_GET_NAME (ptr))
@@ -821,11 +826,11 @@
 		  got_some = 1;
 		}
 
-	      if (ptr->sy_frag && ptr->sy_frag->line)
+	      if (symbol_get_frag (ptr) && symbol_get_frag (ptr)->line)
 		{
 		  fprintf (list_file, "%20s:%-5d  %s:%s %s\n",
-			   ptr->sy_frag->line->file->filename,
-			   ptr->sy_frag->line->line,
+			   symbol_get_frag (ptr)->line->file->filename,
+			   symbol_get_frag (ptr)->line->line,
 			   segment_name (S_GET_SEGMENT (ptr)),
 			   buf, S_GET_NAME (ptr));
 		}
@@ -978,7 +983,7 @@
 
 static void
 listing_listing (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   list_info_type *list = head;
   file_info_type *current_hll_file = (file_info_type *) NULL;
@@ -1006,7 +1011,7 @@
 
   while (list)
     {
-      int list_line;
+      unsigned int list_line;
 
       width = listing_rhs_width > paper_width ? paper_width :
 	listing_rhs_width;
@@ -1180,7 +1185,7 @@
 
 void
 listing_eject (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (listing)
     listing_tail->edict = EDICT_EJECT;
@@ -1188,7 +1193,7 @@
 
 void
 listing_flags (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   while ((*input_line_pointer++) && (*input_line_pointer != '\n'))
     input_line_pointer++;
@@ -1261,7 +1266,7 @@
 
 void
 listing_nopage (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   paper_height = 0;
 }
diff --git a/gas/macro.c b/gas/macro.c
index 9d92ff4..12a757e 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1,5 +1,5 @@
 /* macro.c - macro support for gas and gasp
-   Copyright (C) 1994, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
 
    Written by Steve and Judy Chamberlain of Cygnus Support,
       sac@cygnus.com
@@ -70,42 +70,6 @@
 /* The routines in this file handle macro definition and expansion.
    They are called by both gasp and gas.  */
 
-/* Structures used to store macros. 
-
-   Each macro knows its name and included text.  It gets built with a
-   list of formal arguments, and also keeps a hash table which points
-   into the list to speed up formal search.  Each formal knows its
-   name and its default value.  Each time the macro is expanded, the
-   formals get the actual values attatched to them. */
-
-/* describe the formal arguments to a macro */
-
-typedef struct formal_struct
-  {
-    struct formal_struct *next;	/* next formal in list */
-    sb name;			/* name of the formal */
-    sb def;			/* the default value */
-    sb actual;			/* the actual argument (changed on each expansion) */
-    int index;			/* the index of the formal 0..formal_count-1 */
-  }
-formal_entry;
-
-/* Other values found in the index field of a formal_entry.  */
-#define QUAL_INDEX (-1)
-#define NARG_INDEX (-2)
-#define LOCAL_INDEX (-3)
-
-/* describe the macro. */
-
-typedef struct macro_struct
-  {
-    sb sub;			/* substitution text. */
-    int formal_count;		/* number of formal args. */
-    formal_entry *formals;	/* pointer to list of formal_structs */
-    struct hash_control *formal_hash; /* hash table of formals. */
-  }
-macro_entry;
-
 /* Internal functions.  */
 
 static int get_token PARAMS ((int, sb *, sb *));
@@ -245,9 +209,11 @@
 	{
 	  if (ptr->ptr[i] == '.')
 	      i++;
-	  if (strncasecmp (ptr->ptr + i, from, from_len) == 0)
+	  if (strncasecmp (ptr->ptr + i, from, from_len) == 0
+	      && (ptr->len == (i + from_len) || ! isalnum (ptr->ptr[i + from_len])))
 	    depth++;
-	  if (strncasecmp (ptr->ptr + i, to, to_len) == 0)
+	  if (strncasecmp (ptr->ptr + i, to, to_len) == 0
+	      && (ptr->len == (i + to_len) || ! isalnum (ptr->ptr[i + to_len])))
 	    {
 	      depth--;
 	      if (depth == 0)
@@ -902,7 +868,9 @@
       formal_entry *f;
 
       f = loclist->next;
-      hash_delete (formal_hash, sb_terminate (&loclist->name));
+      /* Setting the value to NULL effectively deletes the entry.  We
+         avoid calling hash_delete because it doesn't reclaim memory.  */
+      hash_jam (formal_hash, sb_terminate (&loclist->name), NULL);
       sb_kill (&loclist->name);
       sb_kill (&loclist->def);
       sb_kill (&loclist->actual);
@@ -1104,11 +1072,12 @@
    gasp.  Return 1 if a macro is found, 0 otherwise.  */
 
 int
-check_macro (line, expand, comment_char, error)
+check_macro (line, expand, comment_char, error, info)
      const char *line;
      sb *expand;
      int comment_char;
      const char **error;
+     macro_entry **info;
 {
   const char *s;
   char *copy, *cs;
@@ -1149,6 +1118,10 @@
 
   sb_kill (&line_sb);
 
+  /* export the macro information if requested */
+  if (info)
+    *info = macro;
+
   return 1;
 }
 
diff --git a/gas/macro.h b/gas/macro.h
index cdeea4a..9c61acd 100644
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -28,6 +28,42 @@
 #include "ansidecl.h"
 #include "sb.h"
 
+/* Structures used to store macros. 
+
+   Each macro knows its name and included text.  It gets built with a
+   list of formal arguments, and also keeps a hash table which points
+   into the list to speed up formal search.  Each formal knows its
+   name and its default value.  Each time the macro is expanded, the
+   formals get the actual values attatched to them. */
+
+/* describe the formal arguments to a macro */
+
+typedef struct formal_struct
+  {
+    struct formal_struct *next;	/* next formal in list */
+    sb name;			/* name of the formal */
+    sb def;			/* the default value */
+    sb actual;			/* the actual argument (changed on each expansion) */
+    int index;			/* the index of the formal 0..formal_count-1 */
+  }
+formal_entry;
+
+/* Other values found in the index field of a formal_entry.  */
+#define QUAL_INDEX (-1)
+#define NARG_INDEX (-2)
+#define LOCAL_INDEX (-3)
+
+/* describe the macro. */
+
+typedef struct macro_struct
+  {
+    sb sub;			/* substitution text. */
+    int formal_count;		/* number of formal args. */
+    formal_entry *formals;	/* pointer to list of formal_structs */
+    struct hash_control *formal_hash; /* hash table of formals. */
+  }
+macro_entry;
+
 /* Whether any macros have been defined.  */
 
 extern int macro_defined;
@@ -45,7 +81,8 @@
 extern const char *define_macro
   PARAMS ((int idx, sb *in, sb *label, int (*get_line) PARAMS ((sb *)),
 	   const char **namep));
-extern int check_macro PARAMS ((const char *, sb *, int, const char **));
+extern int check_macro PARAMS ((const char *, sb *, int, const char **, 
+                                macro_entry **));
 extern void delete_macro PARAMS ((const char *));
 extern const char *expand_irp
   PARAMS ((int, int, sb *, sb *, int (*) PARAMS ((sb *)), int));
diff --git a/gas/obj.h b/gas/obj.h
index b95e75c..7fe5551 100644
--- a/gas/obj.h
+++ b/gas/obj.h
@@ -1,7 +1,7 @@
 /* obj.h - defines the object dependent hooks for all object
    format backends.
 
-   Copyright (C) 1987, 90, 91, 92, 93, 95, 96, 97, 1999
+   Copyright (C) 1987, 90, 91, 92, 93, 95, 96, 97, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -57,6 +57,8 @@
   void (*s_set_size) PARAMS ((symbolS *, bfd_vma));
   bfd_vma (*s_get_align) PARAMS ((symbolS *));
   void (*s_set_align) PARAMS ((symbolS *, bfd_vma));
+  int (*s_get_other) PARAMS ((symbolS *));
+  int (*s_get_desc) PARAMS ((symbolS *));
   void (*copy_symbol_attributes) PARAMS ((symbolS *, symbolS *));
   void (*generate_asm_lineno) PARAMS ((void));
   void (*process_stab) PARAMS ((segT, int, const char *, int, int, int));
@@ -72,6 +74,7 @@
 extern const struct format_ops elf_format_ops;
 extern const struct format_ops ecoff_format_ops;
 extern const struct format_ops coff_format_ops;
+extern const struct format_ops aout_format_ops;
 
 #ifndef this_format
 COMMON const struct format_ops *this_format;
diff --git a/gas/output-file.c b/gas/output-file.c
index b05af48..a7df72f 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -86,9 +86,9 @@
 #ifndef BFD_ASSEMBLER
 void
 output_file_append (where, length, filename)
-     char *where;
-     long length;
-     char *filename;
+     char *where ATTRIBUTE_UNUSED;
+     long length ATTRIBUTE_UNUSED;
+     char *filename ATTRIBUTE_UNUSED;
 {
   abort ();
 }
diff --git a/gas/po/POTFILES.in b/gas/po/POTFILES.in
index 0023b7a..0e420b3 100644
--- a/gas/po/POTFILES.in
+++ b/gas/po/POTFILES.in
@@ -1,16 +1,23 @@
-config/tc-hppa.c
-config/tc-m32r.c
-config/aout_gnu.h
-config/atof-ieee.c
-config/atof-tahoe.c
-config/atof-vax.c
+app.c
+app.c
+as.c
+as.c
+as.h
+asintl.h
+atof-generic.c
+atof-generic.c
+bignum-copy.c
+bignum-copy.c
+bignum.h
+bit_fix.h
+cgen.h
+cond.c
+cond.c
+config/e-i386aout.c
 config/e-i386coff.c
 config/e-i386elf.c
 config/e-mipsecoff.c
 config/e-mipself.c
-config/itbl-mips.h
-config/m68k-parse.h
-config/m88k-opcode.h
 config/obj-aout.c
 config/obj-aout.h
 config/obj-bout.c
@@ -23,14 +30,10 @@
 config/obj-elf.h
 config/obj-evax.c
 config/obj-evax.h
-config/obj-generic.c
-config/obj-generic.h
 config/obj-hp300.c
 config/obj-hp300.h
 config/obj-ieee.c
 config/obj-ieee.h
-config/obj-multi.c
-config/obj-multi.h
 config/obj-som.c
 config/obj-som.h
 config/obj-vms.c
@@ -47,37 +50,40 @@
 config/tc-d10v.h
 config/tc-d30v.c
 config/tc-d30v.h
-config/tc-mcore.c
 config/tc-fr30.c
 config/tc-fr30.h
-config/tc-generic.c
-config/tc-generic.h
 config/tc-h8300.c
 config/tc-h8300.h
 config/tc-h8500.c
 config/tc-h8500.h
-config/tc-mips.c
+config/tc-hppa.c
 config/tc-hppa.h
+config/tc-i370.c
+config/tc-i370.h
 config/tc-i386.c
 config/tc-i386.h
 config/tc-i860.c
 config/tc-i860.h
 config/tc-i960.c
 config/tc-i960.h
-config/tc-mn10300.c
+config/tc-m32r.c
 config/tc-m32r.h
-config/tc-m68851.h
 config/tc-m68k.c
 config/tc-m68k.h
 config/tc-m88k.c
 config/tc-m88k.h
+config/tc-mcore.c
 config/tc-mcore.h
+config/tc-mips.c
 config/tc-mips.h
 config/tc-mn10200.c
 config/tc-mn10200.h
+config/tc-mn10300.c
 config/tc-mn10300.h
 config/tc-ns32k.c
 config/tc-ns32k.h
+config/tc-pj.c
+config/tc-pj.h
 config/tc-ppc.c
 config/tc-ppc.h
 config/tc-sh.c
@@ -98,96 +104,72 @@
 config/tc-w65.h
 config/tc-z8k.c
 config/tc-z8k.h
-config/te-386bsd.h
-config/te-aux.h
-config/te-delt88.h
-config/te-delta.h
-config/te-dpx2.h
-config/te-dynix.h
-config/te-epoc-pe.h
-config/te-generic.h
-config/te-go32.h
-config/te-hp300.h
-config/te-hppa.h
-config/te-i386aix.h
-config/te-ic960.h
-config/te-linux.h
-config/te-lnews.h
-config/te-lynx.h
-config/te-mach.h
-config/te-macos.h
-config/te-multi.h
-config/te-nbsd.h
-config/te-nbsd532.h
-config/te-pc532mach.h
-config/te-pe.h
-config/te-ppcnw.h
-config/te-psos.h
-config/te-riscix.h
-config/te-sparcaout.h
-config/te-sun3.h
-config/te-svr4.h
-config/te-sysv32.h
-config/vax-inst.h
-config/vms-a-conf.h
-config/vms-conf.h
-app.c
-as.c
-as.h
-asintl.h
-atof-generic.c
-bignum-copy.c
-bignum.h
-bit_fix.h
-cgen.c
-cgen.h
-cond.c
-debug.c
 depend.c
+depend.c
+dwarf2dbg.c
+dwarf2dbg.c
+dwarf2dbg.h
+ecoff.c
 ecoff.c
 ecoff.h
 ehopt.c
+ehopt.c
 emul-target.h
 emul.h
 expr.c
+expr.c
 expr.h
 flonum-copy.c
+flonum-copy.c
+flonum-konst.c
 flonum-konst.c
 flonum-mult.c
+flonum-mult.c
 flonum.h
 frags.c
+frags.c
 frags.h
 gasp.c
 hash.c
+hash.c
 hash.h
 input-file.c
+input-file.c
 input-file.h
 input-scrub.c
+input-scrub.c
 itbl-ops.c
 itbl-ops.h
 listing.c
+listing.c
 listing.h
 literal.c
+literal.c
+macro.c
 macro.c
 macro.h
 messages.c
+messages.c
 obj.h
 output-file.c
+output-file.c
 output-file.h
 read.c
+read.c
 read.h
 sb.c
+sb.c
 sb.h
 stabs.c
+stabs.c
 struc-symbol.h
 subsegs.c
+subsegs.c
 subsegs.h
 symbols.c
+symbols.c
 symbols.h
 tc.h
 write.c
+write.c
 write.h
-testsuite/gas/all/itbl-test.c
-testsuite/gas/mips/elf_e_flags.c
-testsuite/gas/tic80/relocs1.c
-testsuite/gas/tic80/relocs2.c
diff --git a/gas/po/gas.pot b/gas/po/gas.pot
index cd9abba..4d04cea 100644
--- a/gas/po/gas.pot
+++ b/gas/po/gas.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-04-18 18:31-0400\n"
+"POT-Creation-Date: 2000-02-27 11:37-0500\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,220 +14,329 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: app.c:435 app.c:449
+#: app.c:466 app.c:480
 msgid "end of file in comment"
 msgstr ""
 
-#: app.c:528
+#: app.c:559
 msgid "end of file in string: inserted '\"'"
 msgstr ""
 
-#: app.c:594
+#: app.c:625
 #, c-format
 msgid "Unknown escape '\\%c' in string: Ignored"
 msgstr ""
 
-#: app.c:603
+#: app.c:634
 msgid "End of file in string: '\"' inserted"
 msgstr ""
 
-#: app.c:723
+#: app.c:754
 msgid "end of file not at end of a line; newline inserted"
 msgstr ""
 
-#: app.c:869
+#: app.c:911
 msgid "end of file in multiline comment"
 msgstr ""
 
-#: app.c:918
+#: app.c:960
 msgid "end of file after a one-character quote; \\0 inserted"
 msgstr ""
 
-#: app.c:926
+#: app.c:968
 msgid "end of file in escape character"
 msgstr ""
 
-#: app.c:938
+#: app.c:980
 msgid "Missing close quote: (assumed)"
 msgstr ""
 
-#: app.c:997 app.c:1051 app.c:1120
+#: app.c:1043 app.c:1097 app.c:1166
 msgid "end of file in comment; newline inserted"
 msgstr ""
 
-#: app.c:1061
+#: app.c:1107
 msgid "EOF in Comment: Newline inserted"
 msgstr ""
 
-#: as.c:121
+#: as.c:148
+msgid "missing emulation mode name"
+msgstr ""
+
+#: as.c:163
+#, c-format
+msgid "unrecognized emulation name `%s'"
+msgstr ""
+
+#: as.c:210
 #, c-format
 msgid "GNU assembler version %s (%s) using BFD version %s"
 msgstr ""
 
-#: as.c:124
+#: as.c:213
 #, c-format
 msgid "GNU assembler version %s (%s)"
 msgstr ""
 
-#: as.c:133
+#: as.c:222
 #, c-format
 msgid "Usage: %s [option...] [asmfile...]\n"
 msgstr ""
 
-#: as.c:135
+#: as.c:224
 msgid ""
 "Options:\n"
-"  -a[sub-option...]\tturn on listings\n"
-"    Sub-options [default hls]:\n"
-"    c   omit false conditionals\n"
-"    d   omit debugging directives\n"
-"    h   include high-level source\n"
-"    l   include assembly\n"
-"    m   include macro expansions\n"
-"    n   omit forms processing\n"
-"    s   include symbols\n"
-"    =file set listing file name (must be last sub-option)\n"
+"  -a[sub-option...]\t  turn on listings\n"
+"                      \t  Sub-options [default hls]:\n"
+"                      \t  c      omit false conditionals\n"
+"                      \t  d      omit debugging directives\n"
+"                      \t  h      include high-level source\n"
+"                      \t  l      include assembly\n"
+"                      \t  m      include macro expansions\n"
+"                      \t  n      omit forms processing\n"
+"                      \t  s      include symbols\n"
+"                      \t  L      include line debug statistics (if "
+"applicable)\n"
+"                      \t  =FILE  list to FILE (must be last sub-option)\n"
 msgstr ""
 
-#: as.c:148
-msgid ""
-"  -D\t\t          produce assembler debugging messages\n"
-"  --defsym SYM=VAL        define symbol SYM to given value\n"
-"  -f\t\t          skip whitespace and comment preprocessing\n"
-"  --gstabs\t          generate stabs debugging information\n"
-"  --help\t\t  show this message and exit\n"
-"  -I DIR\t\t  add DIR to search list for .include directives\n"
-"  -J\t\t          don't warn about signed overflow\n"
-"  -K\t\t          warn when differences altered for long displacements\n"
-"  -L,--keep-locals        keep local symbols (e.g. starting with `L')\n"
+#: as.c:238
+msgid "  -D                      produce assembler debugging messages\n"
 msgstr ""
 
-#: as.c:159
-msgid ""
-"  -M,--mri\t          assemble in MRI compatibility mode\n"
-"  --MD FILE\t          write dependency information in FILE (default none)\n"
-"  -nocpp\t\t  ignored\n"
-"  -o OBJFILE\t          name the object-file output OBJFILE (default a.out)\n"
-"  -R\t\t          fold data section into text section\n"
-"  --statistics\t          print various measured statistics from execution\n"
-"  --strip-local-absolute  strip local absolute symbols\n"
-"  --traditional-format\t  Use same format as native assembler when possible\n"
-"  --version\t\t  print assembler version number and exit\n"
-"  -W\t\t\t  suppress warnings\n"
-"  --itbl INSTTBL\t  extend instruction set to include instructions\n"
-"\t\t\t  matching the specifications defined in file INSTTBL\n"
-"  -w\t\t\t  ignored\n"
-"  -X\t\t\t  ignored\n"
-"  -Z\t\t\t  generate object file even after errors\n"
+#: as.c:240
+msgid "  --defsym SYM=VAL        define symbol SYM to given value\n"
 msgstr ""
 
-#: as.c:176
+#: as.c:256
+#, c-format
+msgid "                          emulate output (default %s)\n"
+msgstr ""
+
+#: as.c:260
+msgid "  -f                      skip whitespace and comment preprocessing\n"
+msgstr ""
+
+#: as.c:262
+msgid "  --gstabs                generate stabs debugging information\n"
+msgstr ""
+
+#: as.c:264
+msgid "  --gdwarf2               generate DWARF2 debugging information\n"
+msgstr ""
+
+#: as.c:266
+msgid "  --help                  show this message and exit\n"
+msgstr ""
+
+#: as.c:268
 msgid ""
-"  --listing-lhs-width\t  set the width in words of the output data column "
+"  -I DIR                  add DIR to search list for .include directives\n"
+msgstr ""
+
+#: as.c:270
+msgid "  -J                      don't warn about signed overflow\n"
+msgstr ""
+
+#: as.c:272
+msgid ""
+"  -K                      warn when differences altered for long "
+"displacements\n"
+msgstr ""
+
+#: as.c:274
+msgid "  -L,--keep-locals        keep local symbols (e.g. starting with `L')\n"
+msgstr ""
+
+#: as.c:276
+msgid "  -M,--mri                assemble in MRI compatibility mode\n"
+msgstr ""
+
+#: as.c:278
+msgid ""
+"  --MD FILE               write dependency information in FILE (default "
+"none)\n"
+msgstr ""
+
+#: as.c:280
+msgid "  -nocpp                  ignored\n"
+msgstr ""
+
+#: as.c:282
+msgid ""
+"  -o OBJFILE              name the object-file output OBJFILE (default "
+"a.out)\n"
+msgstr ""
+
+#: as.c:284
+msgid "  -R                      fold data section into text section\n"
+msgstr ""
+
+#: as.c:286
+msgid ""
+"  --statistics            print various measured statistics from execution\n"
+msgstr ""
+
+#: as.c:288
+msgid "  --strip-local-absolute  strip local absolute symbols\n"
+msgstr ""
+
+#: as.c:290
+msgid ""
+"  --traditional-format    Use same format as native assembler when possible\n"
+msgstr ""
+
+#: as.c:292
+msgid "  --version               print assembler version number and exit\n"
+msgstr ""
+
+#: as.c:294
+msgid "  -W  --no-warn           suppress warnings\n"
+msgstr ""
+
+#: as.c:296
+msgid "  --warn                  don't suppress warnings\n"
+msgstr ""
+
+#: as.c:298
+msgid "  --fatal-warnings        treat warnings as errors\n"
+msgstr ""
+
+#: as.c:300
+msgid ""
+"  --itbl INSTTBL          extend instruction set to include instructions\n"
+"                          matching the specifications defined in file "
+"INSTTBL\n"
+msgstr ""
+
+#: as.c:303
+msgid "  -w                      ignored\n"
+msgstr ""
+
+#: as.c:305
+msgid "  -X                      ignored\n"
+msgstr ""
+
+#: as.c:307
+msgid "  -Z                      generate object file even after errors\n"
+msgstr ""
+
+#: as.c:309
+msgid ""
+"  --listing-lhs-width     set the width in words of the output data column "
 "of\n"
-"\t\t\t  the listing\n"
-"  --listing-lhs-width2\t  set the width in words of the continuation lines\n"
-"\t\t\t  of the output data column; ignored if smaller than\n"
-"\t\t\t  the width of the first line\n"
-"  --listing-rhs-width\t  set the max width in characters of the lines from\n"
-"\t\t\t  the source file\n"
-"  --listing-cont-lines\t  set the maximum number of continuation lines used\n"
-"\t\t\t  for the output data column of the listing\n"
+"                          the listing\n"
 msgstr ""
 
-#: as.c:189 gasp.c:3583
+#: as.c:312
+msgid ""
+"  --listing-lhs-width2    set the width in words of the continuation lines\n"
+"                          of the output data column; ignored if smaller "
+"than\n"
+"                          the width of the first line\n"
+msgstr ""
+
+#: as.c:316
+msgid ""
+"  --listing-rhs-width     set the max width in characters of the lines from\n"
+"                          the source file\n"
+msgstr ""
+
+#: as.c:319
+msgid ""
+"  --listing-cont-lines    set the maximum number of continuation lines used\n"
+"                          for the output data column of the listing\n"
+msgstr ""
+
+#: as.c:325 gasp.c:3589
 msgid ""
 "\n"
 "Report bugs to bug-gnu-utils@gnu.org\n"
 msgstr ""
 
-#: as.c:226
-msgid "missing emulation mode name"
-msgstr ""
-
-#: as.c:241
-#, c-format
-msgid "unrecognized emulation name `%s'"
-msgstr ""
-
 #. This output is intended to follow the GNU standards document.
-#: as.c:459
+#: as.c:515
 #, c-format
 msgid "GNU assembler %s\n"
 msgstr ""
 
-#: as.c:460
+#: as.c:516
 msgid "Copyright 1997 Free Software Foundation, Inc.\n"
 msgstr ""
 
-#: as.c:461 gasp.c:3677
+#: as.c:517 gasp.c:3683
 msgid ""
 "This program is free software; you may redistribute it under the terms of\n"
 "the GNU General Public License.  This program has absolutely no warranty.\n"
 msgstr ""
 
-#: as.c:464
+#: as.c:520
 #, c-format
 msgid "This assembler was configured for a target of `%s'.\n"
 msgstr ""
 
-#: as.c:471
+#: as.c:527
 msgid "multiple emulation names specified"
 msgstr ""
 
-#: as.c:473
+#: as.c:529
 msgid "emulations not handled in this configuration"
 msgstr ""
 
-#: as.c:478
-#, c-format
-msgid "alias = %s\n"
-msgstr ""
-
-#: as.c:479
-#, c-format
-msgid "canonical = %s\n"
-msgstr ""
-
-#: as.c:480
-#, c-format
-msgid "cpu-type = %s\n"
-msgstr ""
-
-#: as.c:482
-#, c-format
-msgid "format = %s\n"
-msgstr ""
-
-#: as.c:485
-#, c-format
-msgid "bfd-target = %s\n"
-msgstr ""
-
-#: as.c:498
-msgid "bad defsym; format is --defsym name=value"
-msgstr ""
-
-#: as.c:518
-msgid "No file name following -t option\n"
-msgstr ""
-
 #: as.c:534
 #, c-format
+msgid "alias = %s\n"
+msgstr ""
+
+#: as.c:535
+#, c-format
+msgid "canonical = %s\n"
+msgstr ""
+
+#: as.c:536
+#, c-format
+msgid "cpu-type = %s\n"
+msgstr ""
+
+#: as.c:538
+#, c-format
+msgid "format = %s\n"
+msgstr ""
+
+#: as.c:541
+#, c-format
+msgid "bfd-target = %s\n"
+msgstr ""
+
+#: as.c:554
+msgid "bad defsym; format is --defsym name=value"
+msgstr ""
+
+#: as.c:574
+msgid "No file name following -t option\n"
+msgstr ""
+
+#: as.c:590
+#, c-format
 msgid "Failed to read instruction table %s\n"
 msgstr ""
 
-#: as.c:634
+#: as.c:704
 #, c-format
 msgid "invalid listing option `%c'"
 msgstr ""
 
-#: as.c:856
+#: as.c:898
+#, c-format
+msgid "%d warnings, treating warnings as errors"
+msgstr ""
+
+#: as.c:929
 #, c-format
 msgid "%s: total time in assembly: %ld.%06ld\n"
 msgstr ""
 
-#: as.c:859
+#: as.c:932
 #, c-format
 msgid "%s: data size %ld\n"
 msgstr ""
@@ -237,8 +346,8 @@
 #. * This should never happen.
 #.
 #: atof-generic.c:438 config/tc-a29k.c:544 config/tc-i860.c:335
-#: config/tc-i860.c:708 config/tc-m68k.c:3045 config/tc-m68k.c:3074
-#: config/tc-sparc.c:2157
+#: config/tc-i860.c:708 config/tc-m68k.c:3124 config/tc-m68k.c:3153
+#: config/tc-sparc.c:2452
 msgid "failed sanity check."
 msgstr ""
 
@@ -254,246 +363,272 @@
 msgid "bad format for ifc or ifnc"
 msgstr ""
 
-#: cond.c:257
-msgid "\".endif\" without \".if\""
+#: cond.c:258
+msgid "\".elseif\" without matching \".if\" - ignored"
 msgstr ""
 
-#: cond.c:287
-msgid ".else without matching .if - ignored"
+#: cond.c:263
+msgid "\".elseif\" after \".else\" - ignored"
 msgstr ""
 
-#: cond.c:292
-msgid "duplicate \"else\" - ignored"
-msgstr ""
-
-#: cond.c:295
+#: cond.c:266 cond.c:375
 msgid "here is the previous \"else\""
 msgstr ""
 
-#: cond.c:298
+#: cond.c:269 cond.c:378
 msgid "here is the previous \"if\""
 msgstr ""
 
-#: cond.c:343
+#: cond.c:302
+msgid "non-constant expression in \".elseif\" statement"
+msgstr ""
+
+#: cond.c:337
+msgid "\".endif\" without \".if\""
+msgstr ""
+
+#: cond.c:367
+msgid ".else without matching .if - ignored"
+msgstr ""
+
+#: cond.c:372
+msgid "duplicate \"else\" - ignored"
+msgstr ""
+
+#: cond.c:423
 msgid ".ifeqs syntax error"
 msgstr ""
 
-#: cond.c:430
+#: cond.c:506
 msgid "end of macro inside conditional"
 msgstr ""
 
-#: cond.c:432
+#: cond.c:508
 msgid "end of file inside conditional"
 msgstr ""
 
-#: cond.c:435
+#: cond.c:511
 msgid "here is the start of the unterminated conditional"
 msgstr ""
 
-#: cond.c:439
+#: cond.c:515
 msgid "here is the \"else\" of the unterminated conditional"
 msgstr ""
 
-#: config/obj-aout.c:157
+#: config/obj-aout.c:163
 #, c-format
 msgid "Attempt to put a common symbol into set %s"
 msgstr ""
 
-#: config/obj-aout.c:161
+#: config/obj-aout.c:167
 #, c-format
 msgid "Attempt to put an undefined symbol into set %s"
 msgstr ""
 
-#: config/obj-aout.c:192 config/obj-elf.c:1527 ecoff.c:3663
+#: config/obj-aout.c:198 config/obj-coff.c:1204 config/obj-elf.c:1675
+#: ecoff.c:3668
 #, c-format
 msgid "Symbol `%s' can not be both weak and common"
 msgstr ""
 
-#: config/obj-aout.c:250 config/obj-coff.c:1766
+#: config/obj-aout.c:256 config/obj-coff.c:1916
 msgid "unresolved relocation"
 msgstr ""
 
-#: config/obj-aout.c:252 config/obj-coff.c:1768
+#: config/obj-aout.c:258 config/obj-coff.c:1918
 #, c-format
 msgid "bad relocation: symbol `%s' not in symbol table"
 msgstr ""
 
-#: config/obj-aout.c:339
+#: config/obj-aout.c:345
 #, c-format
 msgid "%s: bad type for weak symbol"
 msgstr ""
 
-#: config/obj-aout.c:453 config/obj-coff.c:2700 write.c:1796
+#: config/obj-aout.c:462 config/obj-coff.c:2849 write.c:1805
 #, c-format
 msgid "%s: global symbols not supported in common sections"
 msgstr ""
 
-#: config/obj-aout.c:520
+#: config/obj-aout.c:529
 #, c-format
 msgid "Local symbol %s never defined."
 msgstr ""
 
-#: config/obj-aout.c:608
+#: config/obj-aout.c:617
 msgid "subsegment index too high"
 msgstr ""
 
-#: config/obj-bout.c:312 config/obj-vms.c:566
+#: config/obj-bout.c:313 config/obj-vms.c:566
 #, c-format
 msgid "Local symbol %s never defined"
 msgstr ""
 
-#: config/obj-coff.c:133
+#: config/obj-coff.c:149
 #, c-format
 msgid "Inserting \"%s\" into structure table failed: %s"
 msgstr ""
 
-#: config/obj-coff.c:452 config/obj-coff.c:2113
+#. Zero is used as an end marker in the file.
+#: config/obj-coff.c:444
+msgid "Line numbers must be positive integers\n"
+msgstr ""
+
+#: config/obj-coff.c:477 config/obj-coff.c:2263
 msgid ".ln pseudo-op inside .def/.endef: ignored."
 msgstr ""
 
-#: config/obj-coff.c:512 config/obj-coff.c:2170
+#: config/obj-coff.c:520 ecoff.c:3304
+msgid ".loc outside of .text"
+msgstr ""
+
+#: config/obj-coff.c:527
+msgid ".loc pseudo-op inside .def/.endef: ignored."
+msgstr ""
+
+#: config/obj-coff.c:615 config/obj-coff.c:2320
 msgid ".def pseudo-op used inside of .def/.endef: ignored."
 msgstr ""
 
-#: config/obj-coff.c:558 config/obj-coff.c:2223
+#: config/obj-coff.c:661 config/obj-coff.c:2373
 msgid ".endef pseudo-op used outside of .def/.endef: ignored."
 msgstr ""
 
-#: config/obj-coff.c:592
+#: config/obj-coff.c:699
 #, c-format
 msgid "`%s' symbol without preceding function"
 msgstr ""
 
-#: config/obj-coff.c:634 config/obj-coff.c:2298
+#: config/obj-coff.c:753 config/obj-coff.c:2448
 #, c-format
 msgid "unexpected storage class %d"
 msgstr ""
 
-#: config/obj-coff.c:736 config/obj-coff.c:2405
+#: config/obj-coff.c:866 config/obj-coff.c:2555
 msgid ".dim pseudo-op used outside of .def/.endef: ignored."
 msgstr ""
 
-#: config/obj-coff.c:756 config/obj-coff.c:2425
+#: config/obj-coff.c:886 config/obj-coff.c:2575
 msgid "badly formed .dim directive ignored"
 msgstr ""
 
-#: config/obj-coff.c:807 config/obj-coff.c:2488
+#: config/obj-coff.c:937 config/obj-coff.c:2638
 msgid ".size pseudo-op used outside of .def/.endef ignored."
 msgstr ""
 
-#: config/obj-coff.c:823 config/obj-coff.c:2504
+#: config/obj-coff.c:953 config/obj-coff.c:2654
 msgid ".scl pseudo-op used outside of .def/.endef ignored."
 msgstr ""
 
-#: config/obj-coff.c:841 config/obj-coff.c:2522
+#: config/obj-coff.c:971 config/obj-coff.c:2672
 msgid ".tag pseudo-op used outside of .def/.endef ignored."
 msgstr ""
 
-#: config/obj-coff.c:860 config/obj-coff.c:2540
+#: config/obj-coff.c:990 config/obj-coff.c:2690
 #, c-format
 msgid "tag not found for .tag %s"
 msgstr ""
 
-#: config/obj-coff.c:875 config/obj-coff.c:2555
+#: config/obj-coff.c:1005 config/obj-coff.c:2705
 msgid ".type pseudo-op used outside of .def/.endef ignored."
 msgstr ""
 
-#: config/obj-coff.c:897 config/obj-coff.c:2577
+#: config/obj-coff.c:1027 config/obj-coff.c:2727
 msgid ".val pseudo-op used outside of .def/.endef ignored."
 msgstr ""
 
-#: config/obj-coff.c:1026 config/obj-coff.c:2773
+#: config/obj-coff.c:1165 config/obj-coff.c:2922
 msgid "mismatched .eb"
 msgstr ""
 
-#: config/obj-coff.c:1044 config/obj-coff.c:2813
+#: config/obj-coff.c:1183 config/obj-coff.c:2962
 msgid "C_EFCN symbol out of scope"
 msgstr ""
 
 #. STYP_INFO
 #. STYP_LIB
 #. STYP_OVER
-#: config/obj-coff.c:1253
+#: config/obj-coff.c:1405
 #, c-format
 msgid "unsupported section attribute '%c'"
 msgstr ""
 
-#: config/obj-coff.c:1258 config/obj-coff.c:3516 config/tc-ppc.c:3778
+#: config/obj-coff.c:1410 config/obj-coff.c:3668 config/tc-ppc.c:3791
 #, c-format
 msgid "unknown section attribute '%c'"
 msgstr ""
 
-#: config/obj-coff.c:1280 config/tc-ppc.c:3796 read.c:2478
+#: config/obj-coff.c:1432 config/tc-ppc.c:3809 read.c:2495
 #, c-format
 msgid "error setting flags for \"%s\": %s"
 msgstr ""
 
-#: config/obj-coff.c:1399
+#: config/obj-coff.c:1558
 #, c-format
 msgid "0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n"
 msgstr ""
 
-#: config/obj-coff.c:1593 config/obj-ieee.c:69
+#: config/obj-coff.c:1743 config/obj-ieee.c:69
 msgid "Out of step\n"
 msgstr ""
 
-#: config/obj-coff.c:2028
+#: config/obj-coff.c:2178
 msgid "bfd_coff_swap_scnhdr_out failed"
 msgstr ""
 
-#: config/obj-coff.c:2255
+#: config/obj-coff.c:2405
 msgid "`.bf' symbol without preceding function\n"
 msgstr ""
 
-#: config/obj-coff.c:3216 config/obj-ieee.c:522 output-file.c:52
+#: config/obj-coff.c:3365 config/obj-ieee.c:522 output-file.c:52
 #: output-file.c:119
 #, c-format
 msgid "FATAL: Can't create %s"
 msgstr ""
 
-#: config/obj-coff.c:3390
+#: config/obj-coff.c:3542
 #, c-format
 msgid "Can't close %s: %s"
 msgstr ""
 
-#: config/obj-coff.c:3424
+#: config/obj-coff.c:3576
 #, c-format
 msgid "Too many new sections; can't add \"%s\""
 msgstr ""
 
-#: config/obj-coff.c:3834 config/tc-m88k.c:1260 config/tc-sparc.c:3015
+#: config/obj-coff.c:3986 config/tc-m88k.c:1260 config/tc-sparc.c:3344
 msgid "Expected comma after name"
 msgstr ""
 
-#: config/obj-coff.c:3840 read.c:1934
+#: config/obj-coff.c:3992 read.c:1948
 msgid "Missing size expression"
 msgstr ""
 
-#: config/obj-coff.c:3846
+#: config/obj-coff.c:3998
 #, c-format
 msgid "lcomm length (%d.) <0! Ignored."
 msgstr ""
 
-#: config/obj-coff.c:3874 read.c:2160
+#: config/obj-coff.c:4026 read.c:2179
 #, c-format
 msgid "Symbol %s already defined"
 msgstr ""
 
-#: config/obj-coff.c:3968 config/tc-i960.c:3201
+#: config/obj-coff.c:4120 config/tc-i960.c:3255
 #, c-format
 msgid "No 'bal' entry point for leafproc %s"
 msgstr ""
 
-#: config/obj-coff.c:4047 write.c:2501
+#: config/obj-coff.c:4199 write.c:2507
 #, c-format
 msgid "Negative of non-absolute symbol %s"
 msgstr ""
 
-#: config/obj-coff.c:4068 write.c:2515
+#: config/obj-coff.c:4220 write.c:2521
 msgid "callj to difference of 2 symbols"
 msgstr ""
 
-#: config/obj-coff.c:4114
+#: config/obj-coff.c:4266
 #, c-format
 msgid "Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld."
 msgstr ""
@@ -501,150 +636,154 @@
 #. This is a COBR instruction.  They have only a 13-bit
 #. displacement and are only to be used for local branches:
 #. flag as error, don't generate relocation.
-#: config/obj-coff.c:4204 config/tc-i960.c:3221 write.c:2659
+#: config/obj-coff.c:4356 config/tc-i960.c:3275 write.c:2665
 msgid "can't use COBR format with external label"
 msgstr ""
 
-#: config/obj-coff.c:4278
+#: config/obj-coff.c:4436
 #, c-format
 msgid "Value of %ld too large for field of %d bytes at 0x%lx"
 msgstr ""
 
-#: config/obj-coff.c:4292 write.c:2747
+#: config/obj-coff.c:4450 write.c:2764
 #, c-format
 msgid "Signed .word overflow; switch may be too large; %ld at 0x%lx"
 msgstr ""
 
-#: config/obj-ecoff.c:239
+#: config/obj-ecoff.c:240
 msgid "Can't set GP value"
 msgstr ""
 
-#: config/obj-ecoff.c:246
+#: config/obj-ecoff.c:247
 msgid "Can't set register masks"
 msgstr ""
 
-#: config/obj-elf.c:274 config/tc-sparc.c:3156 config/tc-v850.c:263
+#: config/obj-elf.c:299 config/tc-sparc.c:3485 config/tc-v850.c:263
 msgid "Expected comma after symbol-name"
 msgstr ""
 
-#: config/obj-elf.c:281 config/tc-arc.c:778 config/tc-sparc.c:3163
+#: config/obj-elf.c:306 config/tc-arc.c:779 config/tc-sparc.c:3492
 #, c-format
 msgid ".COMMon length (%d.) <0! Ignored."
 msgstr ""
 
-#: config/obj-elf.c:291 config/tc-alpha.c:3429 config/tc-sparc.c:3173
+#: config/obj-elf.c:316 config/tc-alpha.c:4320 config/tc-sparc.c:3502
 #: config/tc-v850.c:285
 msgid "Ignoring attempt to re-define symbol"
 msgstr ""
 
-#: config/obj-elf.c:299 config/tc-arc.c:796 config/tc-sparc.c:3181
+#: config/obj-elf.c:324 config/tc-arc.c:797 config/tc-sparc.c:3510
 #: config/tc-v850.c:295
 #, c-format
 msgid "Length of .comm \"%s\" is already %ld. Not changed to %d."
 msgstr ""
 
-#: config/obj-elf.c:322 config/tc-arc.c:815 config/tc-v850.c:322
+#: config/obj-elf.c:347 config/tc-arc.c:816 config/tc-v850.c:322
 msgid "Common alignment negative; 0 assumed"
 msgstr ""
 
-#: config/obj-elf.c:341 config/tc-m32r.c:1298 config/tc-ppc.c:1389
+#: config/obj-elf.c:366 config/tc-m32r.c:1262 config/tc-ppc.c:1396
 #: config/tc-v850.c:385
 msgid "Common alignment not a power of 2"
 msgstr ""
 
-#: config/obj-elf.c:404 config/tc-arc.c:875 config/tc-sparc.c:3305
+#: config/obj-elf.c:429 config/tc-arc.c:876 config/tc-sparc.c:3634
 #: config/tc-v850.c:563
 #, c-format
 msgid "bad .common segment %s"
 msgstr ""
 
-#: config/obj-elf.c:589
-msgid "Missing section name"
-msgstr ""
-
-#: config/obj-elf.c:654
-msgid "Bad .section directive: want a,w,x in string"
-msgstr ""
-
-#: config/obj-elf.c:703
-msgid "Unrecognized section type"
-msgstr ""
-
-#: config/obj-elf.c:717
-msgid "Bad .section directive - character following name is not '#'"
-msgstr ""
-
-#: config/obj-elf.c:749
-msgid "Unrecognized section attribute"
-msgstr ""
-
-#: config/obj-elf.c:770
+#: config/obj-elf.c:658
 #, c-format
 msgid "Setting incorrect section type for %s"
 msgstr ""
 
-#: config/obj-elf.c:780
+#: config/obj-elf.c:668
 #, c-format
 msgid "Setting incorrect section attributes for %s"
 msgstr ""
 
+#: config/obj-elf.c:726
+msgid "Unrecognized .section attribute: want a,w,x"
+msgstr ""
+
+#: config/obj-elf.c:766
+msgid "Unrecognized section attribute"
+msgstr ""
+
+#: config/obj-elf.c:788
+msgid "Unrecognized section type"
+msgstr ""
+
+#: config/obj-elf.c:839
+msgid "Missing section name"
+msgstr ""
+
 #: config/obj-elf.c:905
+msgid "Bad .section directive - character following name is not '#'"
+msgstr ""
+
+#: config/obj-elf.c:1006
 msgid ".previous without corresponding .section; ignored"
 msgstr ""
 
-#: config/obj-elf.c:954
+#: config/obj-elf.c:1033
+msgid ".popsection without corresponding .pushsection; ignored"
+msgstr ""
+
+#: config/obj-elf.c:1085
 #, c-format
 msgid "multiple .symver directives for symbol `%s'"
 msgstr ""
 
-#: config/obj-elf.c:963
+#: config/obj-elf.c:1094
 msgid "expected comma after name in .symver"
 msgstr ""
 
-#: config/obj-elf.c:984
+#: config/obj-elf.c:1115
 #, c-format
 msgid "missing version name in `%s' for symbol `%s'"
 msgstr ""
 
-#: config/obj-elf.c:1187 config/obj-som.c:148 config/obj-som.c:193
+#: config/obj-elf.c:1324 config/obj-som.c:148 config/obj-som.c:193
 msgid "Expected quoted string"
 msgstr ""
 
-#: config/obj-elf.c:1208
+#: config/obj-elf.c:1345
 #, c-format
 msgid "expected comma after name `%s' in .size directive"
 msgstr ""
 
-#: config/obj-elf.c:1217
+#: config/obj-elf.c:1354
 msgid "missing expression in .size directive"
 msgstr ""
 
-#: config/obj-elf.c:1283
+#: config/obj-elf.c:1421
 #, c-format
 msgid "ignoring unrecognized symbol type \"%s\""
 msgstr ""
 
-#: config/obj-elf.c:1453
+#: config/obj-elf.c:1599
 msgid ".size expression too complicated to fix up"
 msgstr ""
 
-#: config/obj-elf.c:1484
+#: config/obj-elf.c:1630
 #, c-format
 msgid ""
 "invalid attempt to declare external version name as default in symbol `%s'"
 msgstr ""
 
-#: config/obj-elf.c:1610
+#: config/obj-elf.c:1760
 #, c-format
 msgid "Failed to set up debugging information: %s"
 msgstr ""
 
-#: config/obj-elf.c:1626
+#: config/obj-elf.c:1780
 #, c-format
 msgid "Can't start writing .mdebug section: %s"
 msgstr ""
 
-#: config/obj-elf.c:1634
+#: config/obj-elf.c:1788
 #, c-format
 msgid "Could not write .mdebug section: %s"
 msgstr ""
@@ -817,26 +956,26 @@
 msgid "unhandled stab type %d"
 msgstr ""
 
-#: config/tc-a29k.c:160 config/tc-sparc.c:3357
+#: config/tc-a29k.c:160 config/tc-sparc.c:3686
 msgid "Unknown segment type"
 msgstr ""
 
 #. Probably a memory allocation problem?  Give up now.
-#: config/tc-a29k.c:330 config/tc-hppa.c:1354 config/tc-i860.c:202
-#: config/tc-mips.c:1102 config/tc-mips.c:1144 config/tc-sparc.c:715
+#: config/tc-a29k.c:330 config/tc-hppa.c:1387 config/tc-i860.c:202
+#: config/tc-mips.c:1062 config/tc-mips.c:1104 config/tc-sparc.c:779
 msgid "Broken assembler.  No assembly attempted."
 msgstr ""
 
-#: config/tc-a29k.c:375 config/tc-arc.c:534 config/tc-d10v.c:481
-#: config/tc-d30v.c:540 config/tc-h8300.c:305 config/tc-h8500.c:297
-#: config/tc-mcore.c:380 config/tc-mn10200.c:936 config/tc-mn10300.c:1307
-#: config/tc-ppc.c:1844 config/tc-sh.c:478 config/tc-tic80.c:291
+#: config/tc-a29k.c:375 config/tc-arc.c:535 config/tc-d10v.c:507
+#: config/tc-d30v.c:553 config/tc-h8300.c:305 config/tc-h8500.c:297
+#: config/tc-mcore.c:656 config/tc-mn10200.c:935 config/tc-mn10300.c:1294
+#: config/tc-ppc.c:1852 config/tc-sh.c:628 config/tc-tic80.c:291
 #: config/tc-v850.c:2033 config/tc-w65.c:257 config/tc-z8k.c:341
 msgid "missing operand"
 msgstr ""
 
-#: config/tc-a29k.c:415 config/tc-hppa.c:1471 config/tc-i860.c:407
-#: config/tc-i860.c:423 config/tc-sparc.c:1191 config/tc-sparc.c:1197
+#: config/tc-a29k.c:415 config/tc-hppa.c:1533 config/tc-i860.c:407
+#: config/tc-i860.c:423 config/tc-sparc.c:1342 config/tc-sparc.c:1348
 #, c-format
 msgid "Unknown opcode: `%s'"
 msgstr ""
@@ -887,33 +1026,33 @@
 msgid "Invalid register in & expression"
 msgstr ""
 
-#: config/tc-alpha.c:722
+#: config/tc-alpha.c:834
 #, c-format
 msgid "internal error: can't hash opcode `%s': %s"
 msgstr ""
 
-#: config/tc-alpha.c:756
+#: config/tc-alpha.c:868
 #, c-format
 msgid "internal error: can't hash macro `%s': %s"
 msgstr ""
 
-#: config/tc-alpha.c:832 config/tc-i960.c:2711
+#: config/tc-alpha.c:951 config/tc-i960.c:2738
 msgid "syntax error"
 msgstr ""
 
-#: config/tc-alpha.c:905 config/tc-arm.c:4982 config/tc-h8300.c:1413
-#: config/tc-h8500.c:1222 config/tc-hppa.c:3651 config/tc-i860.c:813
-#: config/tc-m68k.c:4003 config/tc-m88k.c:1106 config/tc-ns32k.c:1588
-#: config/tc-sparc.c:2433 config/tc-z8k.c:1355
+#: config/tc-alpha.c:1025 config/tc-arm.c:5169 config/tc-h8300.c:1413
+#: config/tc-h8500.c:1222 config/tc-hppa.c:3904 config/tc-i860.c:813
+#: config/tc-m68k.c:4125 config/tc-m88k.c:1106 config/tc-ns32k.c:1589
+#: config/tc-sparc.c:2731 config/tc-z8k.c:1355
 msgid "Bad call to MD_ATOF()"
 msgstr ""
 
-#: config/tc-alpha.c:955
+#: config/tc-alpha.c:1075
 #, c-format
 msgid "Unknown CPU identifier `%s'"
 msgstr ""
 
-#: config/tc-alpha.c:999
+#: config/tc-alpha.c:1119
 msgid ""
 "Alpha options:\n"
 "-32addr\t\t\ttreat addresses as 32-bit values\n"
@@ -924,886 +1063,970 @@
 "\t\t\tthese variants include PALcode opcodes\n"
 msgstr ""
 
-#: config/tc-alpha.c:1009
+#: config/tc-alpha.c:1129
 msgid ""
 "VMS options:\n"
 "-+\t\t\thash encode (don't truncate) names longer than 64 characters\n"
 "-H\t\t\tshow new symbol after hash truncation\n"
 msgstr ""
 
-#: config/tc-alpha.c:1165
+#: config/tc-alpha.c:1298
 #, c-format
 msgid "unhandled relocation type %s"
 msgstr ""
 
-#: config/tc-alpha.c:1178
+#: config/tc-alpha.c:1311
 msgid "non-absolute expression in constant field"
 msgstr ""
 
-#: config/tc-alpha.c:1192
+#: config/tc-alpha.c:1325
 #, c-format
 msgid "type %d reloc done?\n"
 msgstr ""
 
-#: config/tc-alpha.c:1243 config/tc-alpha.c:1250 config/tc-mips.c:7777
+#: config/tc-alpha.c:1376 config/tc-alpha.c:1383 config/tc-mips.c:7362
 msgid "Used $at without \".set noat\""
 msgstr ""
 
-#: config/tc-alpha.c:1407
+#: config/tc-alpha.c:1561
 #, c-format
 msgid "cannot represent `%s' relocation in object file"
 msgstr ""
 
-#: config/tc-alpha.c:1414
+#: config/tc-alpha.c:1568
 #, c-format
 msgid "internal error? cannot generate `%s' relocation"
 msgstr ""
 
-#: config/tc-alpha.c:1468
+#: config/tc-alpha.c:1622
 #, c-format
 msgid "frame reg expected, using $%d."
 msgstr ""
 
-#: config/tc-alpha.c:1793
+#: config/tc-alpha.c:1747
+#, c-format
+msgid "No !literal!%d was found"
+msgstr ""
+
+#. only support one relocation op per insn
+#: config/tc-alpha.c:1935
+msgid "More than one relocation op per insn"
+msgstr ""
+
+#: config/tc-alpha.c:1952
+msgid "No relocation operand"
+msgstr ""
+
+#: config/tc-alpha.c:1958
+#, c-format
+msgid "No !sequence-number after !%s"
+msgstr ""
+
+#: config/tc-alpha.c:1971
+#, c-format
+msgid "Unknown relocation operand: !%s"
+msgstr ""
+
+#: config/tc-alpha.c:1984
+#, c-format
+msgid "Bad sequence number: !%s!%s"
+msgstr ""
+
+#: config/tc-alpha.c:2335
 #, c-format
 msgid "operand out of range (%s not between %d and %d)"
 msgstr ""
 
-#: config/tc-alpha.c:1890 config/tc-arc.c:547 config/tc-d10v.c:570
-#: config/tc-d30v.c:623 config/tc-mn10200.c:991 config/tc-mn10300.c:1382
-#: config/tc-ppc.c:1810 config/tc-ppc.c:1917 config/tc-ppc.c:1929
+#: config/tc-alpha.c:2434 config/tc-arc.c:548 config/tc-d10v.c:596
+#: config/tc-d30v.c:636 config/tc-mn10200.c:990 config/tc-mn10300.c:1365
+#: config/tc-ppc.c:1818 config/tc-ppc.c:1926 config/tc-ppc.c:1938
 #: config/tc-v850.c:1819 config/tc-v850.c:1842 config/tc-v850.c:2055
 msgid "too many fixups"
 msgstr ""
 
-#: config/tc-alpha.c:2015 config/tc-alpha.c:2073
+#: config/tc-alpha.c:2645 config/tc-alpha.c:2714
 #, c-format
 msgid "inappropriate arguments for opcode `%s'"
 msgstr ""
 
-#: config/tc-alpha.c:2017 config/tc-alpha.c:2075
+#: config/tc-alpha.c:2647 config/tc-alpha.c:2716
 #, c-format
 msgid "opcode `%s' not supported for target %s"
 msgstr ""
 
-#: config/tc-alpha.c:2021 config/tc-alpha.c:2078
+#: config/tc-alpha.c:2651 config/tc-alpha.c:2719
 #, c-format
 msgid "unknown opcode `%s'"
 msgstr ""
 
-#: config/tc-alpha.c:2130
+#: config/tc-alpha.c:2691 config/tc-alpha.c:2758 config/tc-alpha.c:3269
+#: config/tc-alpha.c:3329 config/tc-alpha.c:3381 config/tc-alpha.c:3456
+#: config/tc-alpha.c:3541 config/tc-alpha.c:3667 config/tc-alpha.c:3844
+#: config/tc-alpha.c:3901 config/tc-alpha.c:4011 config/tc-alpha.c:4118
+#: config/tc-alpha.c:4195
+#, c-format
+msgid "Cannot use !%s!%d with %s"
+msgstr ""
+
+#: config/tc-alpha.c:2779
 msgid "can not resolve expression"
 msgstr ""
 
-#: config/tc-alpha.c:2268 config/tc-alpha.c:2445
+#: config/tc-alpha.c:2921 config/tc-alpha.c:3113
 msgid "overflow in literal (.lita) table"
 msgstr ""
 
-#: config/tc-alpha.c:2275 config/tc-alpha.c:2297 config/tc-alpha.c:2458
-#: config/tc-alpha.c:2680 config/tc-alpha.c:2727 config/tc-alpha.c:2775
-#: config/tc-alpha.c:2864 config/tc-alpha.c:3065 config/tc-alpha.c:3166
+#: config/tc-alpha.c:2928 config/tc-alpha.c:2951 config/tc-alpha.c:3126
+#: config/tc-alpha.c:3470 config/tc-alpha.c:3548 config/tc-alpha.c:3596
+#: config/tc-alpha.c:3696 config/tc-alpha.c:3921 config/tc-alpha.c:4033
 msgid "macro requires $at register while noat in effect"
 msgstr ""
 
-#: config/tc-alpha.c:2277 config/tc-alpha.c:2299 config/tc-alpha.c:2460
+#: config/tc-alpha.c:2930 config/tc-alpha.c:2953 config/tc-alpha.c:3128
 msgid "macro requires $at while $at in use"
 msgstr ""
 
-#: config/tc-alpha.c:2407 expr.c:82 read.c:3101
+#: config/tc-alpha.c:3075 expr.c:86 read.c:3151
 msgid "bignum invalid; zero assumed"
 msgstr ""
 
-#: config/tc-alpha.c:2409 expr.c:84 read.c:3103 read.c:3432 read.c:4328
+#: config/tc-alpha.c:3077 expr.c:88 read.c:3153 read.c:3489 read.c:4387
 msgid "floating point number invalid; zero assumed"
 msgstr ""
 
-#: config/tc-alpha.c:2414
+#: config/tc-alpha.c:3082
 msgid "can't handle expression"
 msgstr ""
 
-#: config/tc-alpha.c:2451
+#: config/tc-alpha.c:3119
 msgid "overflow in literal (.lit8) table"
 msgstr ""
 
-#: config/tc-alpha.c:3400 config/tc-ppc.c:1338 config/tc-ppc.c:3542
-#: read.c:1358
+#: config/tc-alpha.c:3291
+#, c-format
+msgid "bad instruction format for lda !%s!%d"
+msgstr ""
+
+#: config/tc-alpha.c:4291 config/tc-ppc.c:1345 config/tc-ppc.c:3555
+#: read.c:1368
 #, c-format
 msgid ".COMMon length (%ld.) <0! Ignored."
 msgstr ""
 
-#: config/tc-alpha.c:3438 config/tc-alpha.c:3447 config/tc-ppc.c:3579
-#: read.c:1379
+#: config/tc-alpha.c:4329 config/tc-alpha.c:4338 config/tc-ppc.c:3592
+#: read.c:1389
 #, c-format
 msgid "Length of .comm \"%s\" is already %ld. Not changed to %ld."
 msgstr ""
 
-#: config/tc-alpha.c:3549 ecoff.c:3105
+#: config/tc-alpha.c:4440 ecoff.c:3109
 msgid ".ent directive has no name"
 msgstr ""
 
-#: config/tc-alpha.c:3557
+#: config/tc-alpha.c:4448
 msgid "nested .ent directives"
 msgstr ""
 
-#: config/tc-alpha.c:3593 ecoff.c:3053
+#: config/tc-alpha.c:4484 ecoff.c:3057
 msgid ".end directive has no name"
 msgstr ""
 
-#: config/tc-alpha.c:3602
+#: config/tc-alpha.c:4493
 msgid ".end directive names different symbol than .ent"
 msgstr ""
 
-#: config/tc-alpha.c:3676
+#: config/tc-alpha.c:4568
 #, c-format
 msgid "Invalid argument %d to .prologue."
 msgstr ""
 
-#: config/tc-alpha.c:3704
+#: config/tc-alpha.c:4596
 msgid "ECOFF debugging is disabled."
 msgstr ""
 
-#: config/tc-alpha.c:3725
+#: config/tc-alpha.c:4617
 msgid "Unknown section directive"
 msgstr ""
 
-#: config/tc-alpha.c:3762
+#: config/tc-alpha.c:4654
 msgid ".ent directive has no symbol"
 msgstr ""
 
-#: config/tc-alpha.c:3790
+#: config/tc-alpha.c:4682
 msgid "Bad .frame directive 1./2. param"
 msgstr ""
 
-#: config/tc-alpha.c:3802
+#: config/tc-alpha.c:4694
 msgid "Bad .frame directive 3./4. param"
 msgstr ""
 
-#: config/tc-alpha.c:3827
+#: config/tc-alpha.c:4719
 msgid ".pdesc directive not in link (.link) section"
 msgstr ""
 
-#: config/tc-alpha.c:3835
+#: config/tc-alpha.c:4727
 msgid ".pdesc has no matching .ent"
 msgstr ""
 
-#: config/tc-alpha.c:3845
+#: config/tc-alpha.c:4738
 msgid ".pdesc directive has no entry symbol"
 msgstr ""
 
-#: config/tc-alpha.c:3857
+#: config/tc-alpha.c:4751
 msgid "No comma after .pdesc <entryname>"
 msgstr ""
 
-#: config/tc-alpha.c:3880
+#: config/tc-alpha.c:4774
 msgid "unknown procedure kind"
 msgstr ""
 
-#: config/tc-alpha.c:3975
+#: config/tc-alpha.c:4869
 msgid ".name directive not in link (.link) section"
 msgstr ""
 
-#: config/tc-alpha.c:3983
+#: config/tc-alpha.c:4877
 msgid ".name directive has no symbol"
 msgstr ""
 
-#: config/tc-alpha.c:4018
+#: config/tc-alpha.c:4912
 msgid "No symbol after .linkage"
 msgstr ""
 
-#: config/tc-alpha.c:4047
+#: config/tc-alpha.c:4941
 msgid "No symbol after .code_address"
 msgstr ""
 
-#: config/tc-alpha.c:4082 ecoff.c:3269
+#: config/tc-alpha.c:4976 ecoff.c:3274
 msgid "Bad .mask directive"
 msgstr ""
 
-#: config/tc-alpha.c:4104 ecoff.c:3200
+#: config/tc-alpha.c:4998 ecoff.c:3205
 msgid "Bad .fmask directive"
 msgstr ""
 
-#: config/tc-alpha.c:4275 read.c:2123 read.c:2675 stabs.c:460
+#: config/tc-alpha.c:5169 config/tc-arm.c:1328 read.c:2142 read.c:2722
+#: stabs.c:460
 #, c-format
 msgid "Expected comma after name \"%s\""
 msgstr ""
 
-#. symbolP->sy_other = (signed char) temp;
-#: config/tc-alpha.c:4286
+#. *symbol_get_obj (symbolP) = (signed char) temp;
+#: config/tc-alpha.c:5180
 #, c-format
 msgid "unhandled: .proc %s,%d"
 msgstr ""
 
-#: config/tc-alpha.c:4321
+#: config/tc-alpha.c:5215
 #, c-format
 msgid "Tried to .set unrecognized mode `%s'"
 msgstr ""
 
 #. not fatal, but it might not work in the end
-#: config/tc-alpha.c:4338
+#: config/tc-alpha.c:5232
 msgid "File overrides no-base-register option."
 msgstr ""
 
-#: config/tc-alpha.c:4355
+#: config/tc-alpha.c:5249
 #, c-format
 msgid "Bad base register, using $%d."
 msgstr ""
 
-#: config/tc-alpha.c:4377
+#: config/tc-alpha.c:5271
 #, c-format
 msgid "Alignment too large: %d. assumed"
 msgstr ""
 
-#: config/tc-alpha.c:4381 config/tc-d30v.c:2163
+#: config/tc-alpha.c:5275 config/tc-d30v.c:2182
 msgid "Alignment negative: 0 assumed"
 msgstr ""
 
-#: config/tc-alpha.c:4694
+#: config/tc-alpha.c:5588
 #, c-format
 msgid "Chose GP value of %lx\n"
 msgstr ""
 
-#: config/tc-arc.c:136
+#: config/tc-arc.c:137
 msgid ""
 "ARC options:\n"
 "-EB\t\t\tgenerate big endian output\n"
 "-EL\t\t\tgenerate little endian output\n"
 msgstr ""
 
-#: config/tc-arc.c:154 config/tc-arc.c:177 config/tc-arc.c:921
-#: config/tc-hppa.c:1316 config/tc-hppa.c:6410 config/tc-hppa.c:6416
-#: config/tc-hppa.c:6422 config/tc-mn10300.c:890 config/tc-mn10300.c:2023
+#: config/tc-arc.c:155 config/tc-arc.c:178 config/tc-arc.c:922
+#: config/tc-hppa.c:1347 config/tc-hppa.c:6734 config/tc-hppa.c:6740
+#: config/tc-hppa.c:6746 config/tc-hppa.c:6752 config/tc-mn10300.c:883
+#: config/tc-mn10300.c:1993
 msgid "could not set architecture and machine"
 msgstr ""
 
-#: config/tc-arc.c:174
+#: config/tc-arc.c:175
 msgid "virtual memory exhausted"
 msgstr ""
 
-#: config/tc-arc.c:253 config/tc-mn10200.c:1354 config/tc-mn10300.c:1930
-#: config/tc-ppc.c:1095 config/tc-v850.c:1618
+#: config/tc-arc.c:254 config/tc-mn10200.c:1354 config/tc-mn10300.c:1904
+#: config/tc-ppc.c:1102 config/tc-v850.c:1618
 #, c-format
 msgid "operand out of range (%s not between %ld and %ld)"
 msgstr ""
 
-#: config/tc-arc.c:388
+#: config/tc-arc.c:389
 #, c-format
 msgid "unknown syntax format character `%c'"
 msgstr ""
 
-#: config/tc-arc.c:487
+#: config/tc-arc.c:488
 msgid "too many suffixes"
 msgstr ""
 
-#: config/tc-arc.c:532 config/tc-d10v.c:479 config/tc-d30v.c:538
-#: config/tc-mn10200.c:933 config/tc-mn10300.c:1304 config/tc-ppc.c:1842
+#: config/tc-arc.c:533 config/tc-d10v.c:505 config/tc-d30v.c:551
+#: config/tc-mn10200.c:932 config/tc-mn10300.c:1291 config/tc-ppc.c:1850
 #: config/tc-tic80.c:287 config/tc-v850.c:2030
 msgid "illegal operand"
 msgstr ""
 
-#: config/tc-arc.c:619 config/tc-mn10200.c:1032 config/tc-mn10300.c:1452
-#: config/tc-ppc.c:1966 config/tc-v850.c:2108
+#: config/tc-arc.c:620 config/tc-mn10200.c:1031 config/tc-mn10300.c:1435
+#: config/tc-ppc.c:1975 config/tc-v850.c:2108
 #, c-format
 msgid "junk at end of line: `%s'"
 msgstr ""
 
-#: config/tc-arc.c:659
+#: config/tc-arc.c:660
 msgid "8 byte instruction in delay slot"
 msgstr ""
 
-#: config/tc-arc.c:661
+#: config/tc-arc.c:662
 msgid "8 byte jump instruction with delay slot"
 msgstr ""
 
-#: config/tc-arc.c:669
+#: config/tc-arc.c:670
 msgid "conditional branch follows set of flags"
 msgstr ""
 
-#: config/tc-arc.c:748 config/tc-arm.c:6041
+#: config/tc-arc.c:749 config/tc-arm.c:6329
 #, c-format
 msgid "bad instruction `%s'"
 msgstr ""
 
-#: config/tc-arc.c:771
+#: config/tc-arc.c:772
 msgid "expected comma after symbol-name"
 msgstr ""
 
-#: config/tc-arc.c:788
+#: config/tc-arc.c:789
 msgid "ignoring attempt to re-define symbol"
 msgstr ""
 
-#: config/tc-arc.c:803
+#: config/tc-arc.c:804
 msgid "expected comma after common length"
 msgstr ""
 
-#: config/tc-arc.c:896
+#: config/tc-arc.c:897
 msgid ".cpu command must appear before any instructions"
 msgstr ""
 
-#: config/tc-arc.c:915
+#: config/tc-arc.c:916
 msgid ".cpu conflicts with previous value"
 msgstr ""
 
-#: config/tc-arc.c:926
+#: config/tc-arc.c:927
 msgid "bad .cpu op"
 msgstr ""
 
-#: config/tc-arc.c:950 config/tc-ppc.c:2615
+#: config/tc-arc.c:951 config/tc-ppc.c:2623
 msgid "missing rename string"
 msgstr ""
 
-#: config/tc-arc.c:962
+#: config/tc-arc.c:963
 msgid "invalid symbol to rename to"
 msgstr ""
 
-#: config/tc-arc.c:1009 config/tc-d10v.c:274 config/tc-d30v.c:353
-#: config/tc-mips.c:9317 config/tc-mn10200.c:356 config/tc-ppc.c:4363
-#: config/tc-sh.c:1187 config/tc-v850.c:1276
+#: config/tc-arc.c:1010 config/tc-d10v.c:284 config/tc-d30v.c:366
+#: config/tc-mips.c:8769 config/tc-mn10200.c:355 config/tc-pj.c:365
+#: config/tc-ppc.c:4384 config/tc-sh.c:1736 config/tc-v850.c:1276
 msgid "bad call to md_atof"
 msgstr ""
 
-#: config/tc-arc.c:1096
+#: config/tc-arc.c:1097
 #, c-format
 msgid "missing ')' in %-op"
 msgstr ""
 
-#: config/tc-arc.c:1130
+#: config/tc-arc.c:1131
 msgid "expression too complex for %%st"
 msgstr ""
 
-#: config/tc-arc.c:1324 config/tc-arm.c:2937 config/tc-d10v.c:1448
-#: config/tc-d30v.c:1810 config/tc-mips.c:3361 config/tc-mips.c:4317
-#: config/tc-mips.c:5102 config/tc-mips.c:5648 config/tc-ppc.c:4698
-#: config/tc-v850.c:2339
+#: config/tc-arc.c:1326 config/tc-arm.c:3146 config/tc-d10v.c:1475
+#: config/tc-d30v.c:1828 config/tc-mips.c:3252 config/tc-mips.c:4184
+#: config/tc-mips.c:4969 config/tc-mips.c:5515 config/tc-ppc.c:4720
+#: config/tc-v850.c:2338
 msgid "expression too complex"
 msgstr ""
 
-#: config/tc-arc.c:1390 config/tc-ppc.c:4801 config/tc-v850.c:2383
+#: config/tc-arc.c:1392 config/tc-ppc.c:4823 config/tc-v850.c:2382
 msgid "unresolved expression that must be resolved"
 msgstr ""
 
-#: config/tc-arc.c:1454 config/tc-sparc.c:2880
+#: config/tc-arc.c:1457 config/tc-sparc.c:3193
 #, c-format
 msgid "internal error: can't export reloc type %d (`%s')"
 msgstr ""
 
-#: config/tc-arm.c:983
+#: config/tc-arm.c:1025
 msgid "Literal Pool Overflow"
 msgstr ""
 
-#: config/tc-arm.c:1103
+#: config/tc-arm.c:1168
 msgid "Invalid syntax for .req directive."
 msgstr ""
 
-#: config/tc-arm.c:1139
-msgid "Nothing to put in the pool\n"
-msgstr ""
-
-#: config/tc-arm.c:1151
-msgid "Inserting implicit pool at change of section"
-msgstr ""
-
-#: config/tc-arm.c:1183 config/tc-mips.c:10603 read.c:2017
+#: config/tc-arm.c:1240 config/tc-mips.c:9924 read.c:2031
 #, c-format
 msgid "Alignment too large: %d. assumed."
 msgstr ""
 
-#: config/tc-arm.c:1186 read.c:2022
+#: config/tc-arm.c:1243 read.c:2036
 msgid "Alignment negative. 0 assumed."
 msgstr ""
 
-#: config/tc-arm.c:1251
+#: config/tc-arm.c:1377 config/tc-m32r.c:411 read.c:2781 read.c:4858
+#, c-format
+msgid "symbol `%s' already defined"
+msgstr ""
+
+#: config/tc-arm.c:1447
 msgid "selected processor does not support THUMB opcodes"
 msgstr ""
 
-#: config/tc-arm.c:1263
+#: config/tc-arm.c:1459
 msgid "selected processor does not support ARM opcodes"
 msgstr ""
 
-#: config/tc-arm.c:1272
+#: config/tc-arm.c:1468
 #, c-format
 msgid "invalid instruction size selected (%d)"
 msgstr ""
 
-#: config/tc-arm.c:1307
+#: config/tc-arm.c:1503
 #, c-format
 msgid "invalid operand to .code directive (%d) (expecting 16 or 32)"
 msgstr ""
 
-#: config/tc-arm.c:1319
+#: config/tc-arm.c:1514
 msgid "Garbage following instruction"
 msgstr ""
 
 #. In the few cases where we might be able to accept something else
-#. this error can be overridden
-#: config/tc-arm.c:1367
+#. this error can be overridden.
+#: config/tc-arm.c:1564
 #, c-format
 msgid "Register expected, not '%.100s'"
 msgstr ""
 
 #. In the few cases where we might be able to accept something else
-#. this error can be overridden
-#: config/tc-arm.c:1393
+#. this error can be overridden.
+#: config/tc-arm.c:1590
 msgid "<psr(f)> expected"
 msgstr ""
 
-#: config/tc-arm.c:1424
+#: config/tc-arm.c:1620
 msgid "Illegal co-processor number"
 msgstr ""
 
-#: config/tc-arm.c:1431
+#: config/tc-arm.c:1627
 msgid "Bad or missing co-processor number"
 msgstr ""
 
-#: config/tc-arm.c:1456
+#: config/tc-arm.c:1651
 msgid "bad or missing expression"
 msgstr ""
 
-#: config/tc-arm.c:1462
+#: config/tc-arm.c:1657
 msgid "immediate co-processor expression too large"
 msgstr ""
 
 #. In the few cases where we might be able to accept something else
-#. this error can be overridden
-#: config/tc-arm.c:1487
+#. this error can be overridden.
+#: config/tc-arm.c:1682
 msgid "Co-processor register expected"
 msgstr ""
 
 #. In the few cases where we might be able to accept something else
-#. this error can be overridden
-#: config/tc-arm.c:1511
+#. this error can be overridden.
+#: config/tc-arm.c:1706
 msgid "Floating point register expected"
 msgstr ""
 
-#: config/tc-arm.c:1529
+#: config/tc-arm.c:1723
 msgid "immediate expression expected"
 msgstr ""
 
-#: config/tc-arm.c:1544
+#: config/tc-arm.c:1738
 msgid "co-processor address must be word aligned"
 msgstr ""
 
-#: config/tc-arm.c:1550
+#: config/tc-arm.c:1744
 msgid "offset too large"
 msgstr ""
 
-#: config/tc-arm.c:1600
+#: config/tc-arm.c:1792
 msgid "pc may not be used in post-increment"
 msgstr ""
 
-#: config/tc-arm.c:1616 config/tc-arm.c:2727
+#: config/tc-arm.c:1808 config/tc-arm.c:2938
 msgid "pre-indexed expression expected"
 msgstr ""
 
-#: config/tc-arm.c:1630 config/tc-arm.c:2740 config/tc-arm.c:3089
+#: config/tc-arm.c:1821 config/tc-arm.c:2950 config/tc-arm.c:3292
 msgid "missing ]"
 msgstr ""
 
-#: config/tc-arm.c:1641
+#: config/tc-arm.c:1831
 msgid "pc may not be used with write-back"
 msgstr ""
 
-#: config/tc-arm.c:1696
+#: config/tc-arm.c:1885
 msgid "<psr> expected"
 msgstr ""
 
-#: config/tc-arm.c:1758 config/tc-arm.c:2378
+#: config/tc-arm.c:1946 config/tc-arm.c:2560
 msgid "Register or shift expression expected"
 msgstr ""
 
-#: config/tc-arm.c:1772 config/tc-arm.c:2090 config/tc-arm.c:2345
-#: config/tc-arm.c:2365
+#: config/tc-arm.c:1960 config/tc-arm.c:2275 config/tc-arm.c:2527
+#: config/tc-arm.c:2547
 msgid "Invalid constant"
 msgstr ""
 
-#: config/tc-arm.c:1783
+#: config/tc-arm.c:1971
 msgid "Error: unrecognised syntax for second argument to msr instruction"
 msgstr ""
 
-#: config/tc-arm.c:1833
+#: config/tc-arm.c:2020
 msgid "rdhi, rdlo and rm must all be different"
 msgstr ""
 
-#: config/tc-arm.c:1890
+#: config/tc-arm.c:2076
 msgid "rd and rm should be different in mul"
 msgstr ""
 
-#: config/tc-arm.c:1947
+#: config/tc-arm.c:2132
 msgid "rd and rm should be different in mla"
 msgstr ""
 
-#: config/tc-arm.c:2074
+#: config/tc-arm.c:2259
 msgid "bad_segment"
 msgstr ""
 
-#: config/tc-arm.c:2121 config/tc-arm.c:2199
+#: config/tc-arm.c:2305 config/tc-arm.c:2382
 msgid "Shift expression expected"
 msgstr ""
 
-#: config/tc-arm.c:2163
+#: config/tc-arm.c:2346
 msgid "Invalid immediate shift"
 msgstr ""
 
-#: config/tc-arm.c:2192
+#: config/tc-arm.c:2375
 msgid "shift requires register or #expression"
 msgstr ""
 
-#: config/tc-arm.c:2193
+#: config/tc-arm.c:2376
 msgid "shift requires #expression"
 msgstr ""
 
-#: config/tc-arm.c:2336 config/tc-arm.c:2770
+#: config/tc-arm.c:2518 config/tc-arm.c:2979
 msgid "Constant expression expected"
 msgstr ""
 
-#: config/tc-arm.c:2432
+#: config/tc-arm.c:2613
 msgid "Invalid floating point immediate expression"
 msgstr ""
 
-#: config/tc-arm.c:2435
+#: config/tc-arm.c:2616
 msgid "Floating point register or immediate expression expected"
 msgstr ""
 
-#: config/tc-arm.c:2574
+#: config/tc-arm.c:2785
 msgid "address offset too large"
 msgstr ""
 
-#: config/tc-arm.c:2645
+#: config/tc-arm.c:2857
 msgid "Processor does not support halfwords or signed bytes"
 msgstr ""
 
-#: config/tc-arm.c:2667
+#: config/tc-arm.c:2878
 msgid "Address expected"
 msgstr ""
 
-#: config/tc-arm.c:2698 config/tc-arm.c:2712 config/tc-arm.c:2750
-msgid "destination register same as write-back base\n"
+#: config/tc-arm.c:2908 config/tc-arm.c:2922 config/tc-arm.c:2959
+#, c-format
+msgid "%s register same as write-back base"
 msgstr ""
 
-#: config/tc-arm.c:2790
+#: config/tc-arm.c:2909 config/tc-arm.c:2923 config/tc-arm.c:2960
+msgid "destination"
+msgstr ""
+
+#: config/tc-arm.c:2909 config/tc-arm.c:2923 config/tc-arm.c:2960
+msgid "source"
+msgstr ""
+
+#: config/tc-arm.c:2999
 msgid "literal pool insertion failed"
 msgstr ""
 
-#: config/tc-arm.c:2826
+#: config/tc-arm.c:3037
 msgid "Pre-increment instruction with translate"
 msgstr ""
 
-#: config/tc-arm.c:2868
+#: config/tc-arm.c:3078
 msgid "Bad range in register list"
 msgstr ""
 
-#: config/tc-arm.c:2876 config/tc-arm.c:2885 config/tc-arm.c:2927
+#: config/tc-arm.c:3086 config/tc-arm.c:3095 config/tc-arm.c:3136
 #, c-format
 msgid "Warning: Duplicated register (r%d) in register list"
 msgstr ""
 
-#: config/tc-arm.c:2888
+#: config/tc-arm.c:3098
 msgid "Warning: Register range not in ascending order"
 msgstr ""
 
-#: config/tc-arm.c:2900
+#: config/tc-arm.c:3109
 msgid "Missing `}'"
 msgstr ""
 
-#: config/tc-arm.c:2916
+#: config/tc-arm.c:3125
 msgid "invalid register mask"
 msgstr ""
 
-#: config/tc-arm.c:2977
+#: config/tc-arm.c:3184
 msgid "r15 not allowed as base register"
 msgstr ""
 
-#: config/tc-arm.c:3047 config/tc-arm.c:3061
+#: config/tc-arm.c:3252 config/tc-arm.c:3266
 msgid "r15 not allowed in swap"
 msgstr ""
 
-#: config/tc-arm.c:3158
-msgid "Use of r15 in bx has undefined behaviour"
-msgstr ""
-
-#: config/tc-arm.c:3417 config/tc-v850.c:1921 config/tc-v850.c:1942
+#: config/tc-arm.c:3619 config/tc-v850.c:1921 config/tc-v850.c:1942
 msgid "constant expression expected"
 msgstr ""
 
-#: config/tc-arm.c:3423
+#: config/tc-arm.c:3625
 msgid "Constant value required for number of registers"
 msgstr ""
 
-#: config/tc-arm.c:3431
+#: config/tc-arm.c:3633
 msgid "number of registers must be in the range [1:4]"
 msgstr ""
 
-#: config/tc-arm.c:3493
+#: config/tc-arm.c:3693
 msgid "R15 not allowed as base register with write-back"
 msgstr ""
 
-#: config/tc-arm.c:3745
+#: config/tc-arm.c:3940
 msgid "lo register required"
 msgstr ""
 
-#: config/tc-arm.c:3753
+#: config/tc-arm.c:3948
 msgid "hi register required"
 msgstr ""
 
-#: config/tc-arm.c:3823
+#: config/tc-arm.c:4017
 msgid "dest and source1 must be the same register"
 msgstr ""
 
-#: config/tc-arm.c:3830
+#: config/tc-arm.c:4024
 msgid "subtract valid only on lo regs"
 msgstr ""
 
-#: config/tc-arm.c:3854
+#: config/tc-arm.c:4048
 msgid "invalid Hi register with immediate"
 msgstr ""
 
-#: config/tc-arm.c:3881 config/tc-arm.c:3914 config/tc-arm.c:3924
+#: config/tc-arm.c:4075 config/tc-arm.c:4108 config/tc-arm.c:4118
 msgid "immediate value out of range"
 msgstr ""
 
-#: config/tc-arm.c:3892
+#: config/tc-arm.c:4086
 msgid "invalid immediate value for stack adjust"
 msgstr ""
 
-#: config/tc-arm.c:3903
+#: config/tc-arm.c:4097
 msgid "invalid immediate for address calculation"
 msgstr ""
 
-#: config/tc-arm.c:3990
+#: config/tc-arm.c:4184
 msgid "source1 and dest must be same register"
 msgstr ""
 
-#: config/tc-arm.c:4025
+#: config/tc-arm.c:4219
 msgid "Invalid immediate for shift"
 msgstr ""
 
-#: config/tc-arm.c:4104
+#: config/tc-arm.c:4298
 msgid "only lo regs allowed with immediate"
 msgstr ""
 
-#: config/tc-arm.c:4123
+#: config/tc-arm.c:4317
 msgid "invalid immediate"
 msgstr ""
 
-#: config/tc-arm.c:4178
+#: config/tc-arm.c:4371
 msgid "expected ']'"
 msgstr ""
 
-#: config/tc-arm.c:4245
+#: config/tc-arm.c:4437
 msgid "byte or halfword not valid for base register"
 msgstr ""
 
-#: config/tc-arm.c:4250
+#: config/tc-arm.c:4442
 msgid "R15 based store not allowed"
 msgstr ""
 
-#: config/tc-arm.c:4255
+#: config/tc-arm.c:4447
 msgid "Invalid base register for register offset"
 msgstr ""
 
-#: config/tc-arm.c:4273
+#: config/tc-arm.c:4465
 msgid "invalid offset"
 msgstr ""
 
-#: config/tc-arm.c:4284
+#: config/tc-arm.c:4476
 msgid "invalid base register in load/store"
 msgstr ""
 
-#: config/tc-arm.c:4308 config/tc-arm.c:5471 config/tc-arm.c:5480
-#: config/tc-arm.c:5487 config/tc-arm.c:5494 config/tc-arm.c:5501
+#: config/tc-arm.c:4500
 msgid "Invalid offset"
 msgstr ""
 
-#: config/tc-arm.c:4386
+#: config/tc-arm.c:4574
 msgid "dest and source1 one must be the same register"
 msgstr ""
 
-#: config/tc-arm.c:4394
+#: config/tc-arm.c:4582
 msgid "Rs and Rd must be different in MUL"
 msgstr ""
 
-#: config/tc-arm.c:4539
+#: config/tc-arm.c:4726
 msgid ""
 "Inserted missing '!': load/store multiple always writes back base register"
 msgstr ""
 
-#: config/tc-arm.c:4555 config/tc-arm.c:4657
+#: config/tc-arm.c:4742 config/tc-arm.c:4842
 msgid "Expression too complex"
 msgstr ""
 
-#: config/tc-arm.c:4561
+#: config/tc-arm.c:4748
 msgid "only lo-regs valid in load/store multiple"
 msgstr ""
 
-#: config/tc-arm.c:4608
+#: config/tc-arm.c:4794
 msgid "Syntax: ldrs[b] Rd, [Rb, Ro]"
 msgstr ""
 
-#: config/tc-arm.c:4673
+#: config/tc-arm.c:4858
 msgid "invalid register list to push/pop instruction"
 msgstr ""
 
-#: config/tc-arm.c:4811
+#: config/tc-arm.c:4994
 msgid "Virtual memory exhausted"
 msgstr ""
 
-#: config/tc-arm.c:5203
+#: config/tc-arm.c:5396
 #, c-format
-msgid "invalid constant (%x) after fixup\n"
+msgid "invalid constant (%lx) after fixup"
 msgstr ""
 
-#: config/tc-arm.c:5215 config/tc-arm.c:5236
+#: config/tc-arm.c:5430
 #, c-format
-msgid "bad immediate value for offset (%d)"
+msgid "Unable to compute ADRL instructions for PC offset of 0x%x"
 msgstr ""
 
-#: config/tc-arm.c:5234 config/tc-arm.c:5257
-msgid "invalid literal constant: pool needs to be closer\n"
+#: config/tc-arm.c:5458
+#, c-format
+msgid "bad immediate value for offset (%ld)"
 msgstr ""
 
-#: config/tc-arm.c:5274
+#: config/tc-arm.c:5479 config/tc-arm.c:5501
+msgid "invalid literal constant: pool needs to be closer"
+msgstr ""
+
+#: config/tc-arm.c:5481
+#, c-format
+msgid "bad immediate value for half-word offset (%ld)"
+msgstr ""
+
+#: config/tc-arm.c:5518
 msgid "shift expression is too large"
 msgstr ""
 
-#: config/tc-arm.c:5292 config/tc-arm.c:5301
+#: config/tc-arm.c:5536 config/tc-arm.c:5545
 msgid "Invalid swi expression"
 msgstr ""
 
-#: config/tc-arm.c:5311
+#: config/tc-arm.c:5555
 msgid "Invalid expression in load/store multiple"
 msgstr ""
 
-#: config/tc-arm.c:5341 config/tc-arm.c:5357 config/tc-mips.c:10430
+#: config/tc-arm.c:5584 config/tc-arm.c:5600 config/tc-mips.c:9751
 msgid "Branch out of range"
 msgstr ""
 
-#: config/tc-arm.c:5376
+#: config/tc-arm.c:5622
 msgid "Branch with link out of range"
 msgstr ""
 
-#: config/tc-arm.c:5443
+#: config/tc-arm.c:5689
 msgid "Illegal value for co-processor offset"
 msgstr ""
 
-#: config/tc-arm.c:5466
+#: config/tc-arm.c:5712
 #, c-format
 msgid "Invalid offset, target not word aligned (0x%08X)"
 msgstr ""
 
-#: config/tc-arm.c:5537
+#: config/tc-arm.c:5717 config/tc-arm.c:5726 config/tc-arm.c:5733
+#: config/tc-arm.c:5740 config/tc-arm.c:5747
+#, c-format
+msgid "Invalid offset, value too big (0x%08X)"
+msgstr ""
+
+#: config/tc-arm.c:5784
 msgid "Invalid immediate for stack address calculation"
 msgstr ""
 
-#: config/tc-arm.c:5546
+#: config/tc-arm.c:5793
 #, c-format
-msgid "Invalid immediate for address calculation (value = 0x%08X)"
+msgid "Invalid immediate for address calculation (value = 0x%08lX)"
 msgstr ""
 
-#: config/tc-arm.c:5555
+#: config/tc-arm.c:5803
 msgid "Invalid 8bit immediate"
 msgstr ""
 
-#: config/tc-arm.c:5563
+#: config/tc-arm.c:5811
 msgid "Invalid 3bit immediate"
 msgstr ""
 
-#: config/tc-arm.c:5579
+#: config/tc-arm.c:5827
 #, c-format
-msgid "Invalid immediate: %d is too large"
+msgid "Invalid immediate: %ld is too large"
 msgstr ""
 
-#: config/tc-arm.c:5593
+#: config/tc-arm.c:5842
 #, c-format
-msgid "Illegal Thumb shift value: %d"
+msgid "Illegal Thumb shift value: %ld"
 msgstr ""
 
-#: config/tc-arm.c:5607
+#: config/tc-arm.c:5856
 #, c-format
-msgid "Bad relocation fixup type (%d)\n"
+msgid "Bad relocation fixup type (%d)"
 msgstr ""
 
-#: config/tc-arm.c:5676
-msgid "Literal referenced across section boundry (Implicit dump?)"
+#: config/tc-arm.c:5926
+msgid "Literal referenced across section boundary (Implicit dump?)"
 msgstr ""
 
-#: config/tc-arm.c:5695
+#: config/tc-arm.c:5939
 #, c-format
 msgid "Internal_relocation (type %d) not fixed up (IMMEDIATE)"
 msgstr ""
 
-#: config/tc-arm.c:5701
+#: config/tc-arm.c:5945
+msgid "ADRL used for a symbol not defined in the same file"
+msgstr ""
+
+#: config/tc-arm.c:5951
 #, c-format
 msgid "Internal_relocation (type %d) not fixed up (OFFSET_IMM)"
 msgstr ""
 
-#: config/tc-arm.c:5724
+#: config/tc-arm.c:5971 config/tc-mcore.c:2110 config/tc-ns32k.c:2283
+msgid "<unknown>"
+msgstr ""
+
+#: config/tc-arm.c:5974
 #, c-format
 msgid "Can not represent %s relocation in this object file format (%d)"
 msgstr ""
 
-#: config/tc-arm.c:5742 config/tc-mips.c:11909 config/tc-sh.c:2277
+#: config/tc-arm.c:5995 config/tc-mips.c:11241 config/tc-sh.c:2859
 #, c-format
 msgid "Can not represent %s relocation in this object file format"
 msgstr ""
 
-#: config/tc-arm.c:5755
+#: config/tc-arm.c:6013
 msgid "md_estimate_size_before_relax\n"
 msgstr ""
 
-#: config/tc-arm.c:5825
+#: config/tc-arm.c:6088
 #, c-format
 msgid "No operator -- statement `%s'\n"
 msgstr ""
 
-#: config/tc-arm.c:5875 config/tc-arm.c:5927
+#: config/tc-arm.c:6106
+msgid "selected processor does not support this opcode"
+msgstr ""
+
+#: config/tc-arm.c:6150
+#, c-format
+msgid "Opcode `%s' must have suffix from list: <%s>"
+msgstr ""
+
+#: config/tc-arm.c:6180
+msgid "Warning: Use of the 'nv' conditional is deprecated\n"
+msgstr ""
+
+#: config/tc-arm.c:6197
+#, c-format
+msgid "Opcode `%s' is unconditional\n"
+msgstr ""
+
+#: config/tc-arm.c:6222
 #, c-format
 msgid "Opcode `%s' must have suffix from <%s>\n"
 msgstr ""
 
-#: config/tc-arm.c:5900
-msgid "Warning: Use of the 'nv' conditional is deprecated\n"
-msgstr ""
-
-#: config/tc-arm.c:6019
+#: config/tc-arm.c:6308
 #, c-format
 msgid "register '%s' does not exist\n"
 msgstr ""
 
-#: config/tc-arm.c:6025
+#: config/tc-arm.c:6313
 #, c-format
 msgid "ignoring redefinition of register alias '%s'"
 msgstr ""
 
-#: config/tc-arm.c:6030
+#: config/tc-arm.c:6318
 #, c-format
 msgid ""
 "ignoring redefinition of register alias '%s' to non-existant register '%s'"
 msgstr ""
 
-#: config/tc-arm.c:6034
+#: config/tc-arm.c:6322
 msgid "ignoring incomplete .req pseuso op"
 msgstr ""
 
-#: config/tc-arm.c:6210
+#: config/tc-arm.c:6502
 #, c-format
 msgid "Unrecognised APCS switch -m%s"
 msgstr ""
 
-#: config/tc-arm.c:6336 config/tc-arm.c:6347 config/tc-arm.c:6358
-#: config/tc-arm.c:6363
+#: config/tc-arm.c:6634 config/tc-arm.c:6645 config/tc-arm.c:6656
+#: config/tc-arm.c:6667 config/tc-arm.c:6672
 #, c-format
 msgid "Invalid architecture variant -m%s"
 msgstr ""
 
-#: config/tc-arm.c:6370
+#: config/tc-arm.c:6679
 #, c-format
 msgid "Invalid processor variant -m%s"
 msgstr ""
 
-#: config/tc-arm.c:6392
+#: config/tc-arm.c:6703
 msgid ""
 " ARM Specific Assembler Options:\n"
 "  -m[arm][<processor name>] select processor variant\n"
-"  -m[arm]v[2|2a|3|3m|4|4t]  select architecture variant\n"
+"  -m[arm]v[2|2a|3|3m|4|4t|5[t][e]] select architecture variant\n"
 "  -mthumb                   only allow Thumb instructions\n"
 "  -mthumb-interwork         mark the assembled code as supporting "
 "interworking\n"
@@ -1814,145 +2037,145 @@
 "  -mno-fpu                  don't allow any floating-point instructions.\n"
 msgstr ""
 
-#: config/tc-arm.c:6403
+#: config/tc-arm.c:6714
 msgid "  -k                        generate PIC code.\n"
 msgstr ""
 
-#: config/tc-arm.c:6407
+#: config/tc-arm.c:6718
 msgid ""
 "  -mapcs-32, -mapcs-26      specify which ARM Procedure Calling Standard to "
 "use\n"
 msgstr ""
 
-#: config/tc-arm.c:6410
+#: config/tc-arm.c:6721
 msgid "  -mapcs-float              floating point args are passed in FP regs\n"
 msgstr ""
 
-#: config/tc-arm.c:6413
+#: config/tc-arm.c:6724
 msgid ""
 "  -mapcs-reentrant          the code is position independent/reentrant\n"
 msgstr ""
 
-#: config/tc-arm.c:6418
+#: config/tc-arm.c:6729
 msgid "  -moabi                    support the old ELF ABI\n"
 msgstr ""
 
-#: config/tc-arm.c:6423
+#: config/tc-arm.c:6734
 msgid ""
 "  -EB                       assemble code for a big endian cpu\n"
 "  -EL                       assemble code for a little endian cpu\n"
 msgstr ""
 
-#: config/tc-arm.c:6596
+#: config/tc-arm.c:6883
 #, c-format
 msgid "%s: unexpected function type: %d"
 msgstr ""
 
-#: config/tc-d10v.c:218
+#: config/tc-d10v.c:228
 msgid ""
 "D10V options:\n"
 "-O                      optimize.  Will do some operations in parallel.\n"
 msgstr ""
 
-#: config/tc-d10v.c:521 config/tc-d10v.c:603 config/tc-d30v.c:639
+#: config/tc-d10v.c:547 config/tc-d10v.c:629 config/tc-d30v.c:652
 #, c-format
 msgid "operand out of range: %d"
 msgstr ""
 
-#: config/tc-d10v.c:664
+#: config/tc-d10v.c:690
 msgid "Instruction must be executed in parallel with another instruction."
 msgstr ""
 
-#: config/tc-d10v.c:716
+#: config/tc-d10v.c:742
 msgid "Instruction must be executed in parallel"
 msgstr ""
 
-#: config/tc-d10v.c:719
+#: config/tc-d10v.c:745
 msgid "Long instructions may not be combined."
 msgstr ""
 
-#: config/tc-d10v.c:759
+#: config/tc-d10v.c:785
 msgid "One of these instructions may not be executed in parallel."
 msgstr ""
 
-#: config/tc-d10v.c:764 config/tc-d30v.c:843
+#: config/tc-d10v.c:790 config/tc-d30v.c:860
 msgid "Two IU instructions may not be executed in parallel"
 msgstr ""
 
-#: config/tc-d10v.c:766 config/tc-d10v.c:774 config/tc-d10v.c:789
-#: config/tc-d10v.c:802 config/tc-d30v.c:844 config/tc-d30v.c:853
+#: config/tc-d10v.c:792 config/tc-d10v.c:800 config/tc-d10v.c:815
+#: config/tc-d10v.c:828 config/tc-d30v.c:861 config/tc-d30v.c:870
 msgid "Swapping instruction order"
 msgstr ""
 
-#: config/tc-d10v.c:772 config/tc-d30v.c:850
+#: config/tc-d10v.c:798 config/tc-d30v.c:867
 msgid "Two MU instructions may not be executed in parallel"
 msgstr ""
 
-#: config/tc-d10v.c:793 config/tc-d30v.c:869
+#: config/tc-d10v.c:819 config/tc-d30v.c:886
 msgid "IU instruction may not be in the left container"
 msgstr ""
 
-#: config/tc-d10v.c:806 config/tc-d30v.c:882
+#: config/tc-d10v.c:832 config/tc-d30v.c:899
 msgid "MU instruction may not be in the right container"
 msgstr ""
 
-#: config/tc-d10v.c:810 config/tc-d30v.c:890
+#: config/tc-d10v.c:836 config/tc-d30v.c:907
 msgid "unknown execution type passed to write_2_short()"
 msgstr ""
 
-#: config/tc-d10v.c:1023 config/tc-d10v.c:1037 config/tc-h8300.c:1279
-#: config/tc-h8500.c:1122 config/tc-mcore.c:709 config/tc-sh.c:1040
-#: config/tc-z8k.c:1223
+#: config/tc-d10v.c:1049 config/tc-d10v.c:1063 config/tc-h8300.c:1279
+#: config/tc-h8500.c:1122 config/tc-mcore.c:989 config/tc-pj.c:274
+#: config/tc-sh.c:1349 config/tc-z8k.c:1223
 msgid "can't find opcode "
 msgstr ""
 
-#: config/tc-d10v.c:1050 config/tc-d10v.c:1068 config/tc-d30v.c:1368
+#: config/tc-d10v.c:1076 config/tc-d10v.c:1094 config/tc-d30v.c:1385
 msgid "Unable to mix instructions as specified"
 msgstr ""
 
-#: config/tc-d10v.c:1116 config/tc-d30v.c:1503
+#: config/tc-d10v.c:1142 config/tc-d30v.c:1520
 #, c-format
 msgid "unknown opcode: %s"
 msgstr ""
 
-#: config/tc-d10v.c:1197 config/tc-d10v.c:1343 config/tc-tic80.c:537
+#: config/tc-d10v.c:1223 config/tc-d10v.c:1369 config/tc-tic80.c:537
 msgid "bad opcode or operands"
 msgstr ""
 
-#: config/tc-d10v.c:1246 config/tc-m68k.c:4110
+#: config/tc-d10v.c:1272 config/tc-m68k.c:4232
 msgid "value out of range"
 msgstr ""
 
-#: config/tc-d10v.c:1318
+#: config/tc-d10v.c:1344
 msgid "illegal operand - register name found where none expected"
 msgstr ""
 
-#: config/tc-d10v.c:1354 config/tc-tic80.c:548
+#: config/tc-d10v.c:1380 config/tc-tic80.c:548
 msgid "Register number must be EVEN"
 msgstr ""
 
-#: config/tc-d10v.c:1385 config/tc-d30v.c:1754 config/tc-mn10200.c:1234
-#: config/tc-mn10300.c:1786 config/tc-ppc.c:4997 config/tc-v850.c:2254
+#: config/tc-d10v.c:1412 config/tc-d30v.c:1772 config/tc-mn10200.c:1233
+#: config/tc-mn10300.c:1761 config/tc-ppc.c:5020 config/tc-v850.c:2255
 #, c-format
 msgid "reloc %d not supported by object file format"
 msgstr ""
 
-#: config/tc-d10v.c:1498
+#: config/tc-d10v.c:1525
 #, c-format
 msgid "line %d: rep or repi must include at least 4 instructions"
 msgstr ""
 
-#: config/tc-d10v.c:1517 config/tc-d30v.c:1935
+#: config/tc-d10v.c:1544 config/tc-d30v.c:1953
 #, c-format
 msgid "line %d: unknown relocation type: 0x%x"
 msgstr ""
 
-#: config/tc-d30v.c:184
+#: config/tc-d30v.c:191
 #, c-format
 msgid "Register name %s conflicts with symbol of the same name"
 msgstr ""
 
-#: config/tc-d30v.c:276
+#: config/tc-d30v.c:289
 msgid ""
 "\n"
 "D30V options:\n"
@@ -1965,116 +2188,133 @@
 "-C                      Opposite of -C.  -c is the default.\n"
 msgstr ""
 
-#: config/tc-d30v.c:450
+#: config/tc-d30v.c:463
 msgid "unexpected 12-bit reloc type"
 msgstr ""
 
-#: config/tc-d30v.c:457
+#: config/tc-d30v.c:470
 msgid "unexpected 18-bit reloc type"
 msgstr ""
 
-#: config/tc-d30v.c:701
+#: config/tc-d30v.c:714
 #, c-format
 msgid "%s NOP inserted"
 msgstr ""
 
-#: config/tc-d30v.c:702
+#: config/tc-d30v.c:715
 msgid "sequential"
 msgstr ""
 
-#: config/tc-d30v.c:702
+#: config/tc-d30v.c:715
 msgid "parallel"
 msgstr ""
 
-#: config/tc-d30v.c:839
+#: config/tc-d30v.c:856
 msgid "Instructions may not be executed in parallel"
 msgstr ""
 
-#: config/tc-d30v.c:852 config/tc-d30v.c:859 config/tc-d30v.c:875
-#: config/tc-d30v.c:884
+#: config/tc-d30v.c:869 config/tc-d30v.c:876 config/tc-d30v.c:892
+#: config/tc-d30v.c:901
 #, c-format
 msgid "Executing %s in IU may not work"
 msgstr ""
 
-#: config/tc-d30v.c:871
+#: config/tc-d30v.c:888
 #, c-format
 msgid "special left instruction `%s' kills instruction `%s' in right container"
 msgstr ""
 
-#: config/tc-d30v.c:1250 config/tc-d30v.c:1267
+#: config/tc-d30v.c:1267 config/tc-d30v.c:1284
 msgid "Cannot assemble instruction"
 msgstr ""
 
-#: config/tc-d30v.c:1252
+#: config/tc-d30v.c:1269
 msgid "First opcode is long.  Unable to mix instructions as specified."
 msgstr ""
 
-#: config/tc-d30v.c:1320
+#: config/tc-d30v.c:1337
 msgid "word of NOPs added between word multiply and load"
 msgstr ""
 
-#: config/tc-d30v.c:1322
+#: config/tc-d30v.c:1339
 msgid "word of NOPs added between word multiply and 16-bit multiply"
 msgstr ""
 
-#: config/tc-d30v.c:1352
+#: config/tc-d30v.c:1369
 msgid "Instruction uses long version, so it cannot be mixed as specified"
 msgstr ""
 
-#: config/tc-d30v.c:1436 config/tc-d30v.c:1473
+#: config/tc-d30v.c:1453 config/tc-d30v.c:1490
 #, c-format
 msgid "unknown condition code: %s"
 msgstr ""
 
-#: config/tc-d30v.c:1466
+#: config/tc-d30v.c:1483
 #, c-format
 msgid "cmpu doesn't support condition code %s"
 msgstr ""
 
-#: config/tc-d30v.c:1514
+#: config/tc-d30v.c:1531
 #, c-format
 msgid "operands for opcode `%s' do not match any valid format"
 msgstr ""
 
-#: config/tc-d30v.c:1727
+#: config/tc-d30v.c:1744
 msgid "Odd numbered register used as target of multi-register instruction"
 msgstr ""
 
-#: config/tc-d30v.c:1824
+#: config/tc-d30v.c:1842
 #, c-format
 msgid "line %d: unable to place address of symbol '%s' into a byte"
 msgstr ""
 
-#: config/tc-d30v.c:1827
+#: config/tc-d30v.c:1845
 #, c-format
 msgid "line %d: unable to place value %x into a byte"
 msgstr ""
 
-#: config/tc-d30v.c:1835
+#: config/tc-d30v.c:1853
 #, c-format
 msgid "line %d: unable to place address of symbol '%s' into a short"
 msgstr ""
 
-#: config/tc-d30v.c:1838
+#: config/tc-d30v.c:1856
 #, c-format
 msgid "line %d: unable to place value %x into a short"
 msgstr ""
 
-#: config/tc-d30v.c:1846
+#: config/tc-d30v.c:1864
 #, c-format
 msgid "line %d: unable to place address of symbol '%s' into a quad"
 msgstr ""
 
-#: config/tc-d30v.c:2016
+#: config/tc-d30v.c:2034
 #, c-format
 msgid "value too large to fit in %d bits"
 msgstr ""
 
-#: config/tc-d30v.c:2159
+#: config/tc-d30v.c:2178
 #, c-format
 msgid "Alignment too large: %d assumed"
 msgstr ""
 
+#: config/tc-fr30.c:84
+msgid " FR30 specific command line options:\n"
+msgstr ""
+
+#: config/tc-fr30.c:143
+#, c-format
+msgid "Instruction %s not allowed in a delay slot."
+msgstr ""
+
+#: config/tc-fr30.c:380 config/tc-m32r.c:1530
+msgid "Addend to unresolved symbol not on word boundary."
+msgstr ""
+
+#: config/tc-fr30.c:538 config/tc-i960.c:786 config/tc-m32r.c:1837
+msgid "Bad call to md_atof()"
+msgstr ""
+
 #: config/tc-h8300.c:254 config/tc-h8300.c:262
 msgid "Reg not valid for H8/300"
 msgstr ""
@@ -2147,8 +2387,8 @@
 msgid "invalid operands"
 msgstr ""
 
-#: config/tc-h8300.c:1290 config/tc-h8500.c:1129 config/tc-mips.c:8513
-#: config/tc-sh.c:1047 config/tc-w65.c:759 config/tc-z8k.c:1235
+#: config/tc-h8300.c:1290 config/tc-h8500.c:1129 config/tc-mips.c:7965
+#: config/tc-sh.c:1578 config/tc-w65.c:759 config/tc-z8k.c:1235
 msgid "unknown opcode"
 msgstr ""
 
@@ -2156,12 +2396,12 @@
 msgid "mismatch between opcode size and operand size"
 msgstr ""
 
-#: config/tc-h8300.c:1348 config/tc-h8500.c:1157 config/tc-sh.c:1144
+#: config/tc-h8300.c:1348 config/tc-h8500.c:1157 config/tc-sh.c:1692
 #: config/tc-w65.c:791 config/tc-z8k.c:1290
 msgid "call to tc_crawl_symbol_chain \n"
 msgstr ""
 
-#: config/tc-h8300.c:1362 config/tc-h8500.c:1171 config/tc-sh.c:1151
+#: config/tc-h8300.c:1362 config/tc-h8500.c:1171 config/tc-sh.c:1699
 #: config/tc-w65.c:805 config/tc-z8k.c:1304
 msgid "call to tc_headers_hook \n"
 msgstr ""
@@ -2206,664 +2446,714 @@
 msgid "@Rn needs word register"
 msgstr ""
 
-#: config/tc-h8500.c:845 config/tc-sh.c:844
+#: config/tc-h8500.c:845 config/tc-sh.c:1145
 #, c-format
 msgid "unhandled %d\n"
 msgstr ""
 
-#: config/tc-h8500.c:873 config/tc-sh.c:865
+#: config/tc-h8500.c:873 config/tc-sh.c:1167
 #, c-format
 msgid "operand must be absolute in range %d..%d"
 msgstr ""
 
-#: config/tc-h8500.c:963 config/tc-sh.c:986
+#: config/tc-h8500.c:963 config/tc-sh.c:1293
 #, c-format
 msgid "failed for %d\n"
 msgstr ""
 
-#: config/tc-h8500.c:1145 config/tc-sh.c:1082 config/tc-w65.c:779
+#: config/tc-h8500.c:1145 config/tc-sh.c:1388 config/tc-sh.c:1626
+#: config/tc-w65.c:779
 msgid "invalid operands for opcode"
 msgstr ""
 
-#: config/tc-hppa.c:1114
+#: config/tc-hppa.c:1140
 msgid "Missing .exit\n"
 msgstr ""
 
-#: config/tc-hppa.c:1117
+#: config/tc-hppa.c:1143
 msgid "Missing .procend\n"
 msgstr ""
 
-#: config/tc-hppa.c:1126
-msgid "Not in a space.\n"
-msgstr ""
-
-#: config/tc-hppa.c:1129
-msgid "Not in a subspace.\n"
-msgstr ""
-
-#: config/tc-hppa.c:1291
+#: config/tc-hppa.c:1322
 msgid "Invalid field selector.  Assuming F%%."
 msgstr ""
 
-#: config/tc-hppa.c:1322
+#: config/tc-hppa.c:1353
 msgid "-R option not supported on this target."
 msgstr ""
 
-#: config/tc-hppa.c:1336
+#: config/tc-hppa.c:1369 config/tc-sparc.c:736 config/tc-sparc.c:771
 #, c-format
 msgid "Internal error: can't hash `%s': %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:1344 config/tc-i860.c:191 config/tc-sparc.c:704
+#: config/tc-hppa.c:1377 config/tc-i860.c:191
 #, c-format
 msgid "internal error: losing opcode: `%s' \"%s\"\n"
 msgstr ""
 
-#: config/tc-hppa.c:1406 config/tc-hppa.c:6539 config/tc-hppa.c:6591
+#: config/tc-hppa.c:1446 config/tc-hppa.c:6873 config/tc-hppa.c:6928
 msgid "Missing function name for .PROC (corrupted label chain)"
 msgstr ""
 
-#: config/tc-hppa.c:1409 config/tc-hppa.c:6594
+#: config/tc-hppa.c:1449 config/tc-hppa.c:6931
 msgid "Missing function name for .PROC"
 msgstr ""
 
-#: config/tc-hppa.c:1518 config/tc-hppa.c:4430
+#: config/tc-hppa.c:1570 config/tc-hppa.c:4715
 msgid "could not update architecture and machine"
 msgstr ""
 
-#: config/tc-hppa.c:1714
+#: config/tc-hppa.c:1783
 msgid "Invalid Indexed Load Completer."
 msgstr ""
 
-#: config/tc-hppa.c:1723
+#: config/tc-hppa.c:1788
 msgid "Invalid Indexed Load Completer Syntax."
 msgstr ""
 
-#: config/tc-hppa.c:1756
+#: config/tc-hppa.c:1824
 msgid "Invalid Short Load/Store Completer."
 msgstr ""
 
-#: config/tc-hppa.c:1807 config/tc-hppa.c:1812
+#: config/tc-hppa.c:1883 config/tc-hppa.c:1888
 msgid "Invalid Store Bytes Short Completer"
 msgstr ""
 
-#: config/tc-hppa.c:1822 config/tc-hppa.c:1866
-#, c-format
-msgid "Invalid Compare/Subtract Condition: %c"
+#: config/tc-hppa.c:2199 config/tc-hppa.c:2205
+msgid "Invalid left/right combination completer"
 msgstr ""
 
-#: config/tc-hppa.c:1840 config/tc-hppa.c:2375
-msgid "Invalid Compare/Subtract Condition."
+#: config/tc-hppa.c:2254 config/tc-hppa.c:2261
+msgid "Invalid permutation completer"
 msgstr ""
 
-#: config/tc-hppa.c:1881
-msgid "Invalid Compare/Subtract Condition"
-msgstr ""
-
-#: config/tc-hppa.c:1970 config/tc-hppa.c:2062
+#: config/tc-hppa.c:2362
 #, c-format
 msgid "Invalid Add Condition: %s"
 msgstr ""
 
-#: config/tc-hppa.c:2132 config/tc-hppa.c:2245
-msgid "Invalid Logical Instruction Condition."
+#: config/tc-hppa.c:2373 config/tc-hppa.c:2383
+#, c-format
+msgid "Invalid Add and Branch Condition: %c"
 msgstr ""
 
-#: config/tc-hppa.c:2301
-msgid "Invalid Shift/Extract/Deposit Condition."
+#: config/tc-hppa.c:2404
+msgid "Invalid Compare/Subtract Condition"
 msgstr ""
 
-#: config/tc-hppa.c:2337
+#: config/tc-hppa.c:2444
 #, c-format
 msgid "Invalid Bit Branch Condition: %c"
 msgstr ""
 
-#: config/tc-hppa.c:2776 config/tc-hppa.c:2791
+#: config/tc-hppa.c:2530
 #, c-format
-msgid "Invalid CBit Specification: %s"
+msgid "Invalid Compare/Subtract Condition: %s"
 msgstr ""
 
-#: config/tc-hppa.c:2977 config/tc-hppa.c:3010 config/tc-hppa.c:3047
+#: config/tc-hppa.c:2542
+#, c-format
+msgid "Invalid Compare/Subtract Condition: %c"
+msgstr ""
+
+#: config/tc-hppa.c:2557
+msgid "Invalid Compare and Branch Condition."
+msgstr ""
+
+#: config/tc-hppa.c:2655
+msgid "Invalid Logical Instruction Condition."
+msgstr ""
+
+#: config/tc-hppa.c:2711
+msgid "Invalid Shift/Extract/Deposit Condition."
+msgstr ""
+
+#: config/tc-hppa.c:2823
+msgid "Invalid Unit Instruction Condition."
+msgstr ""
+
+#: config/tc-hppa.c:3096 config/tc-hppa.c:3129 config/tc-hppa.c:3166
+#: config/tc-hppa.c:3205
 msgid "Branch to unaligned address"
 msgstr ""
 
-#: config/tc-hppa.c:3147
+#: config/tc-hppa.c:3389
 msgid "Invalid SFU identifier"
 msgstr ""
 
-#: config/tc-hppa.c:3207
+#: config/tc-hppa.c:3439
 msgid "Invalid COPR identifier"
 msgstr ""
 
-#: config/tc-hppa.c:3447 config/tc-hppa.c:3473 config/tc-hppa.c:3498
-#: config/tc-hppa.c:3523 config/tc-hppa.c:3548
-msgid "Invalid register for single precision fmpyadd or fmpysub"
-msgstr ""
-
-#: config/tc-hppa.c:3572
+#: config/tc-hppa.c:3568
 msgid "Invalid Floating Point Operand Format."
 msgstr ""
 
-#: config/tc-hppa.c:3595
+#: config/tc-hppa.c:3706 config/tc-hppa.c:3730 config/tc-hppa.c:3753
+#: config/tc-hppa.c:3776 config/tc-hppa.c:3799
+msgid "Invalid register for single precision fmpyadd or fmpysub"
+msgstr ""
+
+#: config/tc-hppa.c:3848
 #, c-format
 msgid "Invalid operands %s"
 msgstr ""
 
-#: config/tc-hppa.c:4130
+#: config/tc-hppa.c:4415
 msgid "Unknown relocation encountered in md_apply_fix."
 msgstr ""
 
-#: config/tc-hppa.c:4140
+#: config/tc-hppa.c:4425
 #, c-format
 msgid "no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n"
 msgstr ""
 
-#: config/tc-hppa.c:4282 config/tc-hppa.c:4307
+#: config/tc-hppa.c:4567 config/tc-hppa.c:4592
 #, c-format
 msgid "Undefined register: '%s'."
 msgstr ""
 
-#: config/tc-hppa.c:4345
+#: config/tc-hppa.c:4630
 #, c-format
 msgid "Non-absolute symbol: '%s'."
 msgstr ""
 
-#: config/tc-hppa.c:4360
+#: config/tc-hppa.c:4645
 #, c-format
 msgid "Undefined absolute constant: '%s'."
 msgstr ""
 
-#: config/tc-hppa.c:4469
+#: config/tc-hppa.c:4754
 #, c-format
 msgid "Invalid FP Compare Condition: %s"
 msgstr ""
 
-#: config/tc-hppa.c:4526
+#: config/tc-hppa.c:4810
 #, c-format
 msgid "Invalid FTEST completer: %s"
 msgstr ""
 
-#: config/tc-hppa.c:4593 config/tc-hppa.c:4632
+#: config/tc-hppa.c:4877 config/tc-hppa.c:4915
 #, c-format
 msgid "Invalid FP Operand Format: %3s"
 msgstr ""
 
-#: config/tc-hppa.c:4713
+#: config/tc-hppa.c:4994
 msgid "Bad segment in expression."
 msgstr ""
 
-#: config/tc-hppa.c:4772
+#: config/tc-hppa.c:5053
 msgid "Bad segment (should be absolute)."
 msgstr ""
 
-#: config/tc-hppa.c:4871
+#: config/tc-hppa.c:5152
 #, c-format
 msgid "Invalid argument location: %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:4902
+#: config/tc-hppa.c:5183
 #, c-format
 msgid "Invalid argument description: %d"
 msgstr ""
 
-#: config/tc-hppa.c:4925
+#: config/tc-hppa.c:5206
 #, c-format
 msgid "Invalid Nullification: (%c)"
 msgstr ""
 
-#: config/tc-hppa.c:5657
+#: config/tc-hppa.c:5950
 #, c-format
 msgid "Invalid .CALL argument: %s"
 msgstr ""
 
-#: config/tc-hppa.c:5776
+#: config/tc-hppa.c:6082
 msgid ".callinfo is not within a procedure definition"
 msgstr ""
 
-#: config/tc-hppa.c:5796
+#: config/tc-hppa.c:6102
 #, c-format
 msgid "FRAME parameter must be a multiple of 8: %d\n"
 msgstr ""
 
-#: config/tc-hppa.c:5815
+#: config/tc-hppa.c:6121
 msgid "Value for ENTRY_GR must be in the range 3..18\n"
 msgstr ""
 
-#: config/tc-hppa.c:5827
+#: config/tc-hppa.c:6133
 msgid "Value for ENTRY_FR must be in the range 12..21\n"
 msgstr ""
 
-#: config/tc-hppa.c:5837
+#: config/tc-hppa.c:6143
 msgid "Value for ENTRY_SR must be 3\n"
 msgstr ""
 
-#: config/tc-hppa.c:5893
+#: config/tc-hppa.c:6199
 #, c-format
 msgid "Invalid .CALLINFO argument: %s"
 msgstr ""
 
-#: config/tc-hppa.c:5983
+#: config/tc-hppa.c:6293
 msgid "The .ENTER pseudo-op is not supported"
 msgstr ""
 
-#: config/tc-hppa.c:5997
+#: config/tc-hppa.c:6309
 msgid "Misplaced .entry. Ignored."
 msgstr ""
 
-#: config/tc-hppa.c:6001
+#: config/tc-hppa.c:6313
 msgid "Missing .callinfo."
 msgstr ""
 
-#: config/tc-hppa.c:6049
+#: config/tc-hppa.c:6361
 msgid ".REG must use a label"
 msgstr ""
 
-#: config/tc-hppa.c:6051
+#: config/tc-hppa.c:6363
 msgid ".EQU must use a label"
 msgstr ""
 
-#: config/tc-hppa.c:6102
+#: config/tc-hppa.c:6416
 msgid ".EXIT must appear within a procedure"
 msgstr ""
 
-#: config/tc-hppa.c:6106
+#: config/tc-hppa.c:6420
 msgid "Missing .callinfo"
 msgstr ""
 
-#: config/tc-hppa.c:6110
+#: config/tc-hppa.c:6424
 msgid "No .ENTRY for this .EXIT"
 msgstr ""
 
-#: config/tc-hppa.c:6137
+#: config/tc-hppa.c:6451
 #, c-format
 msgid "Cannot define export symbol: %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:6190
+#: config/tc-hppa.c:6504
 #, c-format
 msgid "Using ENTRY rather than CODE in export directive for %s"
 msgstr ""
 
-#: config/tc-hppa.c:6291
+#: config/tc-hppa.c:6613
 #, c-format
 msgid "Undefined .EXPORT/.IMPORT argument (ignored): %s"
 msgstr ""
 
-#: config/tc-hppa.c:6373
+#: config/tc-hppa.c:6695
 msgid "Missing label name on .LABEL"
 msgstr ""
 
-#: config/tc-hppa.c:6378
+#: config/tc-hppa.c:6700
 msgid "extra .LABEL arguments ignored."
 msgstr ""
 
-#: config/tc-hppa.c:6393
+#: config/tc-hppa.c:6717
 msgid "The .LEAVE pseudo-op is not supported"
 msgstr ""
 
-#: config/tc-hppa.c:6426
+#: config/tc-hppa.c:6756
 msgid "Unrecognized .LEVEL argument\n"
 msgstr ""
 
-#: config/tc-hppa.c:6460
+#: config/tc-hppa.c:6792
 #, c-format
 msgid "Cannot define static symbol: %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:6493
+#: config/tc-hppa.c:6827
 msgid "Nested procedures"
 msgstr ""
 
-#: config/tc-hppa.c:6503
+#: config/tc-hppa.c:6837
 msgid "Cannot allocate unwind descriptor\n"
 msgstr ""
 
-#: config/tc-hppa.c:6598
+#: config/tc-hppa.c:6935
 msgid "misplaced .procend"
 msgstr ""
 
-#: config/tc-hppa.c:6601
+#: config/tc-hppa.c:6938
 msgid "Missing .callinfo for this procedure"
 msgstr ""
 
-#: config/tc-hppa.c:6604
+#: config/tc-hppa.c:6941
 msgid "Missing .EXIT for a .ENTRY"
 msgstr ""
 
-#: config/tc-hppa.c:6704
+#: config/tc-hppa.c:6980
+msgid "Not in a space.\n"
+msgstr ""
+
+#: config/tc-hppa.c:6983
+msgid "Not in a subspace.\n"
+msgstr ""
+
+#: config/tc-hppa.c:7073
 msgid "Invalid .SPACE argument"
 msgstr ""
 
-#: config/tc-hppa.c:6752
+#: config/tc-hppa.c:7121
 msgid "Can't change spaces within a procedure definition. Ignored"
 msgstr ""
 
-#: config/tc-hppa.c:6879
+#: config/tc-hppa.c:7248
 #, c-format
 msgid "Undefined space: '%s' Assuming space number = 0."
 msgstr ""
 
-#: config/tc-hppa.c:6921
+#: config/tc-hppa.c:7272
 msgid "Must be in a space before changing or declaring subspaces.\n"
 msgstr ""
 
-#: config/tc-hppa.c:6925
+#: config/tc-hppa.c:7276
 msgid "Can't change subspaces within a procedure definition. Ignored"
 msgstr ""
 
-#: config/tc-hppa.c:6961
+#: config/tc-hppa.c:7311
 msgid "Parameters of an existing subspace can't be modified"
 msgstr ""
 
-#: config/tc-hppa.c:7014
+#: config/tc-hppa.c:7362
 msgid "Alignment must be a power of 2"
 msgstr ""
 
-#: config/tc-hppa.c:7056
+#: config/tc-hppa.c:7404
 msgid "FIRST not supported as a .SUBSPACE argument"
 msgstr ""
 
-#: config/tc-hppa.c:7058
+#: config/tc-hppa.c:7406
 msgid "Invalid .SUBSPACE argument"
 msgstr ""
 
-#: config/tc-hppa.c:7098
-msgid "Ignoring subspace decl due to ELF BFD bugs."
-msgstr ""
-
-#: config/tc-hppa.c:7261
+#: config/tc-hppa.c:7589
 #, c-format
 msgid "Internal error: Unable to find containing space for %s."
 msgstr ""
 
-#: config/tc-hppa.c:7302
+#: config/tc-hppa.c:7630
 #, c-format
 msgid "Out of memory: could not allocate new space chain entry: %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:7388
+#: config/tc-hppa.c:7716
 #, c-format
 msgid "Out of memory: could not allocate new subspace chain entry: %s\n"
 msgstr ""
 
-#: config/tc-hppa.c:8044
+#: config/tc-hppa.c:8383
 #, c-format
 msgid "Symbol '%s' could not be created."
 msgstr ""
 
-#: config/tc-hppa.c:8048
+#: config/tc-hppa.c:8387
 msgid "No memory for symbol name."
 msgstr ""
 
-#: config/tc-i386.c:502
+#: config/tc-i386.c:509
 msgid "same type of prefix used twice"
 msgstr ""
 
-#: config/tc-i386.c:536
+#: config/tc-i386.c:552
 msgid "Bad argument to syntax directive."
 msgstr ""
 
-#: config/tc-i386.c:619 config/tc-m68k.c:3630
+#: config/tc-i386.c:636 config/tc-m68k.c:3750
 #, c-format
 msgid "Internal Error:  Can't hash %s: %s"
 msgstr ""
 
-#: config/tc-i386.c:850
+#: config/tc-i386.c:866
 msgid "Unknown"
 msgstr ""
 
-#: config/tc-i386.c:898 config/tc-i386.c:4360 config/tc-m68k.c:762
+#: config/tc-i386.c:914 config/tc-i386.c:4407 config/tc-m68k.c:772
 #, c-format
 msgid "Can not do %d byte pc-relative relocation"
 msgstr ""
 
-#: config/tc-i386.c:908 config/tc-i386.c:4363 config/tc-m68k.c:769
+#: config/tc-i386.c:924 config/tc-i386.c:4421 config/tc-m68k.c:779
 #, c-format
 msgid "Can not do %d byte relocation"
 msgstr ""
 
-#: config/tc-i386.c:1009 config/tc-i386.c:1095
+#: config/tc-i386.c:1030 config/tc-i386.c:1113
 #, c-format
 msgid "no such 386 instruction: `%s'"
 msgstr ""
 
-#: config/tc-i386.c:1018
+#: config/tc-i386.c:1039
 #, c-format
 msgid "invalid character %s in mnemonic"
 msgstr ""
 
-#: config/tc-i386.c:1025
+#: config/tc-i386.c:1046
 msgid "expecting prefix; got nothing"
 msgstr ""
 
-#: config/tc-i386.c:1027
+#: config/tc-i386.c:1048
 msgid "expecting mnemonic; got nothing"
 msgstr ""
 
-#: config/tc-i386.c:1045
+#: config/tc-i386.c:1066
 #, c-format
 msgid "redundant %s prefix"
 msgstr ""
 
-#: config/tc-i386.c:1104
+#: config/tc-i386.c:1122
 #, c-format
 msgid "expecting string instruction after `%s'"
 msgstr ""
 
-#: config/tc-i386.c:1127
+#: config/tc-i386.c:1145
 #, c-format
 msgid "invalid character %s before operand %d"
 msgstr ""
 
-#: config/tc-i386.c:1141
+#: config/tc-i386.c:1159
 #, c-format
 msgid "unbalanced parenthesis in operand %d."
 msgstr ""
 
-#: config/tc-i386.c:1144
+#: config/tc-i386.c:1162
 #, c-format
 msgid "unbalanced brackets in operand %d."
 msgstr ""
 
-#: config/tc-i386.c:1153
+#: config/tc-i386.c:1171
 #, c-format
 msgid "invalid character %s in operand %d"
 msgstr ""
 
-#: config/tc-i386.c:1180
+#: config/tc-i386.c:1198
 #, c-format
 msgid "spurious operands; (%d operands/instruction max)"
 msgstr ""
 
-#: config/tc-i386.c:1201
+#: config/tc-i386.c:1219
 msgid "expecting operand after ','; got nothing"
 msgstr ""
 
-#: config/tc-i386.c:1206
+#: config/tc-i386.c:1224
 msgid "expecting operand before ','; got nothing"
 msgstr ""
 
 #. we found no match
-#: config/tc-i386.c:1433
+#: config/tc-i386.c:1461
 #, c-format
 msgid "suffix or operands invalid for `%s'"
 msgstr ""
 
+#: config/tc-i386.c:1469
+#, c-format
+msgid "Indirect %s without `*'"
+msgstr ""
+
 #. Warn them that a data or address size prefix doesn't affect
 #. assembly of the next line of code.
-#: config/tc-i386.c:1442
+#: config/tc-i386.c:1476
 #, c-format
 msgid "stand-alone `%s' prefix"
 msgstr ""
 
-#: config/tc-i386.c:1466 config/tc-i386.c:1481
+#: config/tc-i386.c:1511 config/tc-i386.c:1526
 msgid "`%s' operand %d must use `%%es' segment"
 msgstr ""
 
-#: config/tc-i386.c:1547 config/tc-i386.c:1586 config/tc-i386.c:1613
+#: config/tc-i386.c:1593 config/tc-i386.c:1634 config/tc-i386.c:1661
 msgid "using `%%%s' instead of `%%%s' due to `%c' suffix"
 msgstr ""
 
-#: config/tc-i386.c:1558 config/tc-i386.c:1575 config/tc-i386.c:1602
+#: config/tc-i386.c:1606 config/tc-i386.c:1623 config/tc-i386.c:1650
 msgid "`%%%s' not allowed with `%s%c'"
 msgstr ""
 
-#: config/tc-i386.c:1642 config/tc-i386.c:1662
+#: config/tc-i386.c:1694 config/tc-i386.c:1714
 msgid "no instruction mnemonic suffix given; can't determine immediate size"
 msgstr ""
 
-#: config/tc-i386.c:1687
+#: config/tc-i386.c:1739
 msgid ""
 "no instruction mnemonic suffix given and no register operands; can't size "
 "instruction"
 msgstr ""
 
 #. reversed arguments on faddp, fsubp, etc.
-#: config/tc-i386.c:1800
+#: config/tc-i386.c:1841
 msgid "translating to `%s %%%s,%%%s'"
 msgstr ""
 
 #. extraneous `l' suffix on fp insn
-#: config/tc-i386.c:1807
+#: config/tc-i386.c:1848
 msgid "translating to `%s %%%s'"
 msgstr ""
 
-#: config/tc-i386.c:2033
+#: config/tc-i386.c:2063
 msgid "you can't `pop %%cs'"
 msgstr ""
 
-#. UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc
-#: config/tc-i386.c:2064
+#. UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc.
+#: config/tc-i386.c:2094
 #, c-format
 msgid "translating to `%sp'"
 msgstr ""
 
-#: config/tc-i386.c:2095 config/tc-i386.c:2198 config/tc-i386.c:2258
+#: config/tc-i386.c:2143 config/tc-i386.c:2205 config/tc-i386.c:2247
 msgid "skipping prefixes on this instruction"
 msgstr ""
 
-#: config/tc-i386.c:2115 config/tc-i386.c:2222 config/tc-i386.c:2271
+#: config/tc-i386.c:2262
 msgid "16-bit jump out of range"
 msgstr ""
 
-#: config/tc-i386.c:2217
-#, c-format
-msgid "`%s' only takes byte displacement; %ld shortened to %d"
-msgstr ""
-
-#: config/tc-i386.c:2280
+#: config/tc-i386.c:2271
 #, c-format
 msgid "can't handle non absolute segment in `%s'"
 msgstr ""
 
-#: config/tc-i386.c:2537
+#: config/tc-i386.c:2379 config/tc-i386.c:2429
+#, c-format
+msgid "%ld shortened to %ld"
+msgstr ""
+
+#: config/tc-i386.c:2499
 msgid "Only 1 or 2 immediate operands are allowed"
 msgstr ""
 
-#: config/tc-i386.c:2568 config/tc-i386.c:2797
+#: config/tc-i386.c:2531 config/tc-i386.c:2755
 msgid "GOT relocations not supported in 16 bit mode"
 msgstr ""
 
-#: config/tc-i386.c:2589 config/tc-i386.c:2818
+#: config/tc-i386.c:2552 config/tc-i386.c:2776
 msgid "Bad reloc specifier in expression"
 msgstr ""
 
-#: config/tc-i386.c:2606 config/tc-i386.c:2851
+#: config/tc-i386.c:2570 config/tc-i386.c:2810
 #, c-format
 msgid "Ignoring junk `%s' after expression"
 msgstr ""
 
 #. missing or bad expr becomes absolute 0
-#: config/tc-i386.c:2613
+#: config/tc-i386.c:2577
 #, c-format
 msgid "Missing or invalid immediate expression `%s' taken as 0"
 msgstr ""
 
-#: config/tc-i386.c:2648 config/tc-i386.c:2870
+#: config/tc-i386.c:2607 config/tc-i386.c:2853
+#, c-format
+msgid "Unimplemented segment %s in operand"
+msgstr ""
+
+#: config/tc-i386.c:2609 config/tc-i386.c:2855
 #, c-format
 msgid "Unimplemented segment type %d in operand"
 msgstr ""
 
-#: config/tc-i386.c:2691
+#: config/tc-i386.c:2653
 #, c-format
 msgid "expecting scale factor of 1, 2, 4, or 8: got `%s'"
 msgstr ""
 
-#: config/tc-i386.c:2697
+#: config/tc-i386.c:2659
 #, c-format
 msgid "scale factor of %d without an index register"
 msgstr ""
 
-#: config/tc-i386.c:3045 config/tc-i386.c:3051 config/tc-i386.c:3060
+#. missing or bad expr becomes absolute 0
+#: config/tc-i386.c:2821
+#, c-format
+msgid "Missing or invalid displacement expression `%s' taken as 0"
+msgstr ""
+
+#: config/tc-i386.c:3035 config/tc-i386.c:3041 config/tc-i386.c:3050
 #, c-format
 msgid "bad segment name `%s'"
 msgstr ""
 
-#: config/tc-i386.c:3226 config/tc-i386.c:3481
+#: config/tc-i386.c:3108
 #, c-format
-msgid "too many memory references for `%s'"
+msgid "`%s' is not a valid base/index expression"
 msgstr ""
 
-#: config/tc-i386.c:3337 config/tc-i386.c:3350 config/tc-i386.c:3662
-#: config/tc-i386.c:3675
+#: config/tc-i386.c:3112
 #, c-format
 msgid "`%s' is not a valid %s bit base/index expression"
 msgstr ""
 
-#: config/tc-i386.c:3434
+#: config/tc-i386.c:3133 config/tc-i386.c:3487
+#, c-format
+msgid "too many memory references for `%s'"
+msgstr ""
+
+#: config/tc-i386.c:3219 config/tc-i386.c:3354 config/tc-i386.c:3457
+#: config/tc-i386.c:3572 config/tc-i386.c:3608
+#, c-format
+msgid "bad register name `%s'"
+msgstr ""
+
+#: config/tc-i386.c:3433
 #, c-format
 msgid "bad memory operand `%s'"
 msgstr ""
 
-#: config/tc-i386.c:3449
+#: config/tc-i386.c:3448
 #, c-format
 msgid "Junk `%s' after register"
 msgstr ""
 
-#: config/tc-i386.c:3590
+#: config/tc-i386.c:3465
+msgid "Immediate operand illegal with absolute jump"
+msgstr ""
+
+#: config/tc-i386.c:3565
 #, c-format
 msgid "expecting `,' or `)' after index register in `%s'"
 msgstr ""
 
-#: config/tc-i386.c:3607
+#: config/tc-i386.c:3587
 #, c-format
 msgid "expecting `)' after scale factor in `%s'"
 msgstr ""
 
-#: config/tc-i386.c:3614
+#: config/tc-i386.c:3594
 #, c-format
 msgid "expecting index register or scale factor after `,'; got '%c'"
 msgstr ""
 
-#: config/tc-i386.c:3621
+#: config/tc-i386.c:3601
 #, c-format
 msgid "expecting `,' or `)' after base register in `%s'"
 msgstr ""
 
 #. it's not a memory operand; argh!
-#: config/tc-i386.c:3684
+#: config/tc-i386.c:3641
 #, c-format
 msgid "invalid char %s beginning operand %d `%s'"
 msgstr ""
 
-#: config/tc-i386.c:4087
+#: config/tc-i386.c:4099
 msgid "Bad call to md_atof ()"
 msgstr ""
 
-#: config/tc-i386.c:4148 config/tc-i386.c:4161
-#, c-format
-msgid "bad register name `%s'"
+#: config/tc-i386.c:4250
+msgid "  -m\t\t\t  do long jump\n"
 msgstr ""
 
-#: config/tc-i386.c:4215
-msgid "-m\t\t\tdo long jump\n"
+#: config/tc-i386.c:4253
+msgid ""
+"  -V\t\t\t  print assembler version number\n"
+"  -k\t\t\t  ignored\n"
+"  -Qy, -Qn\t\t  ignored\n"
+"  -q\t\t\t  ignored\n"
+"  -s\t\t\t  ignored\n"
 msgstr ""
 
-#: config/tc-i386.c:4255
+#: config/tc-i386.c:4307
 msgid "GOT already in symbol table"
 msgstr ""
 
-#: config/tc-i386.c:4395 config/tc-mcore.c:2017 config/tc-sh.c:2415
+#: config/tc-i386.c:4456 config/tc-mcore.c:2421 config/tc-pj.c:586
+#: config/tc-sh.c:2998
 #, c-format
 msgid "Cannot represent relocation type %s"
 msgstr ""
@@ -2872,7 +3162,7 @@
 msgid "Unknown temporary pseudo register"
 msgstr ""
 
-#: config/tc-i860.c:183 config/tc-mips.c:1099 config/tc-sparc.c:696
+#: config/tc-i860.c:183 config/tc-mips.c:1059
 #, c-format
 msgid "internal error: can't hash `%s': %s\n"
 msgstr ""
@@ -2899,7 +3189,7 @@
 msgid "Illegal operands"
 msgstr ""
 
-#: config/tc-i860.c:749 config/tc-sparc.c:2338
+#: config/tc-i860.c:749 config/tc-sparc.c:2634
 msgid "bad segment"
 msgstr ""
 
@@ -2961,45 +3251,41 @@
 msgid "i860_estimate_size_before_relax\n"
 msgstr ""
 
-#: config/tc-i960.c:544
+#: config/tc-i960.c:559
 #, c-format
 msgid "Hashing returned \"%s\"."
 msgstr ""
 
 #. Offset of last character in opcode mnemonic
-#: config/tc-i960.c:578
+#: config/tc-i960.c:593
 msgid "branch prediction invalid on this opcode"
 msgstr ""
 
-#: config/tc-i960.c:621
+#: config/tc-i960.c:636
 #, c-format
 msgid "invalid opcode, \"%s\"."
 msgstr ""
 
-#: config/tc-i960.c:626
+#: config/tc-i960.c:641
 #, c-format
 msgid "improper number of operands.  expecting %d, got %d"
 msgstr ""
 
-#: config/tc-i960.c:771 config/tc-m32r.c:1873
-msgid "Bad call to md_atof()"
-msgstr ""
-
-#: config/tc-i960.c:861
+#: config/tc-i960.c:876
 #, c-format
 msgid "Fixup of %ld too large for field width of %d"
 msgstr ""
 
-#: config/tc-i960.c:979
+#: config/tc-i960.c:994
 #, c-format
 msgid "invalid architecture %s"
 msgstr ""
 
-#: config/tc-i960.c:999
+#: config/tc-i960.c:1014
 msgid "I960 options:\n"
 msgstr ""
 
-#: config/tc-i960.c:1002
+#: config/tc-i960.c:1017
 msgid ""
 "\n"
 "\t\t\tspecify variant of 960 architecture\n"
@@ -3010,591 +3296,621 @@
 "\t\t\tlong displacements\n"
 msgstr ""
 
-#: config/tc-i960.c:1400
+#: config/tc-i960.c:1425
 msgid "too many operands"
 msgstr ""
 
-#: config/tc-i960.c:1460 config/tc-i960.c:1690
+#: config/tc-i960.c:1485 config/tc-i960.c:1715
 msgid "expression syntax error"
 msgstr ""
 
-#: config/tc-i960.c:1498
+#: config/tc-i960.c:1523
 msgid "attempt to branch into different segment"
 msgstr ""
 
-#: config/tc-i960.c:1502
+#: config/tc-i960.c:1527
 #, c-format
 msgid "target of %s instruction must be a label"
 msgstr ""
 
-#: config/tc-i960.c:1542
+#: config/tc-i960.c:1567
 msgid "unmatched '['"
 msgstr ""
 
-#: config/tc-i960.c:1553
+#: config/tc-i960.c:1578
 msgid "garbage after index spec ignored"
 msgstr ""
 
 #. We never moved: there was no opcode either!
-#: config/tc-i960.c:1620
+#: config/tc-i960.c:1645
 msgid "missing opcode"
 msgstr ""
 
-#: config/tc-i960.c:1928
+#: config/tc-i960.c:1953
 msgid "invalid constant"
 msgstr ""
 
-#: config/tc-i960.c:2041
+#: config/tc-i960.c:2066
 msgid "invalid index register"
 msgstr ""
 
-#: config/tc-i960.c:2064
+#: config/tc-i960.c:2089
 msgid "invalid scale factor"
 msgstr ""
 
-#: config/tc-i960.c:2247
+#: config/tc-i960.c:2272
 msgid "unaligned register"
 msgstr ""
 
-#: config/tc-i960.c:2270
+#: config/tc-i960.c:2295
 msgid "no such sfr in this architecture"
 msgstr ""
 
-#: config/tc-i960.c:2308
+#: config/tc-i960.c:2333
 msgid "illegal literal"
 msgstr ""
 
 #. Should not happen: see block comment above
-#: config/tc-i960.c:2541
+#: config/tc-i960.c:2566
 #, c-format
 msgid "Trying to 'bal' to %s"
 msgstr ""
 
-#: config/tc-i960.c:2552
+#: config/tc-i960.c:2577
 msgid "Looks like a proc, but can't tell what kind.\n"
 msgstr ""
 
-#: config/tc-i960.c:2584
+#: config/tc-i960.c:2609
 msgid "should have 1 or 2 operands"
 msgstr ""
 
-#: config/tc-i960.c:2593 config/tc-i960.c:2612
+#: config/tc-i960.c:2618 config/tc-i960.c:2637
 #, c-format
 msgid "Redefining leafproc %s"
 msgstr ""
 
-#: config/tc-i960.c:2642
+#: config/tc-i960.c:2669
 msgid "should have two operands"
 msgstr ""
 
-#: config/tc-i960.c:2652
+#: config/tc-i960.c:2679
 msgid "'entry_num' must be absolute number in [0,31]"
 msgstr ""
 
-#: config/tc-i960.c:2661
+#: config/tc-i960.c:2688
 #, c-format
 msgid "Redefining entrynum for sysproc %s"
 msgstr ""
 
-#: config/tc-i960.c:2772
+#: config/tc-i960.c:2799
 msgid "architecture of opcode conflicts with that of earlier instruction(s)"
 msgstr ""
 
-#: config/tc-i960.c:2793
+#: config/tc-i960.c:2820
 msgid "big endian mode is not supported"
 msgstr ""
 
-#: config/tc-i960.c:2795
+#: config/tc-i960.c:2822
 #, c-format
 msgid "ignoring unrecognized .endian type `%s'"
 msgstr ""
 
-#: config/tc-i960.c:3052
+#: config/tc-i960.c:3104
 #, c-format
 msgid "leafproc symbol '%s' undefined"
 msgstr ""
 
-#: config/tc-i960.c:3062
+#: config/tc-i960.c:3114
 #, c-format
 msgid "Warning: making leafproc entries %s and %s both global\n"
 msgstr ""
 
-#: config/tc-i960.c:3169
+#: config/tc-i960.c:3223
 msgid "option --link-relax is only supported in b.out format"
 msgstr ""
 
-#: config/tc-i960.c:3212
+#: config/tc-i960.c:3266
 msgid "callj to difference of two symbols"
 msgstr ""
 
 #. Pretend that we do not recognise this option.
-#: config/tc-m32r.c:232
-#, c-format
-msgid "%s: unrecognised option: -hidden\n"
+#: config/tc-m32r.c:218
+msgid "Unrecognised option: -hidden"
 msgstr ""
 
-#: config/tc-m32r.c:265
+#: config/tc-m32r.c:251
 msgid " M32R specific command line options:\n"
 msgstr ""
 
-#: config/tc-m32r.c:287
+#: config/tc-m32r.c:253
+msgid "  -m32rx                  support the extended m32rx instruction set\n"
+msgstr ""
+
+#: config/tc-m32r.c:255
+msgid "  -O                      try to combine instructions in parallel\n"
+msgstr ""
+
+#: config/tc-m32r.c:258
+msgid ""
+"  -warn-explicit-parallel-conflicts     warn when parallel instructions\n"
+msgstr ""
+
+#: config/tc-m32r.c:260
+msgid "                                         violate contraints\n"
+msgstr ""
+
+#: config/tc-m32r.c:262
+msgid "  -no-warn-explicit-parallel-conflicts  do not warn when parallel\n"
+msgstr ""
+
+#: config/tc-m32r.c:264
+msgid ""
+"                                         instructions violate contraints\n"
+msgstr ""
+
+#: config/tc-m32r.c:266
+msgid ""
+"  -Wp                     synonym for -warn-explicit-parallel-conflicts\n"
+msgstr ""
+
+#: config/tc-m32r.c:268
+msgid ""
+"  -Wnp                    synonym for -no-warn-explicit-parallel-conflicts\n"
+msgstr ""
+
+#: config/tc-m32r.c:271
 msgid ""
 "  -warn-unmatched-high    warn when an (s)high reloc has no matching low "
 "reloc\n"
 msgstr ""
 
-#: config/tc-m32r.c:289
+#: config/tc-m32r.c:273
 msgid "  -no-warn-unmatched-high do not warn about missing low relocs\n"
 msgstr ""
 
-#: config/tc-m32r.c:291
+#: config/tc-m32r.c:275
 msgid "  -Wuh                    synonym for -warn-unmatched-high\n"
 msgstr ""
 
-#: config/tc-m32r.c:293
+#: config/tc-m32r.c:277
 msgid "  -Wnuh                   synonym for -no-warn-unmatched-high\n"
 msgstr ""
 
-#: config/tc-m32r.c:297
+#: config/tc-m32r.c:281
 msgid "  -relax                 create linker relaxable code\n"
 msgstr ""
 
-#: config/tc-m32r.c:299
+#: config/tc-m32r.c:283
 msgid "  -cpu-desc              provide runtime cpu description file\n"
 msgstr ""
 
-#: config/tc-m32r.c:429 read.c:2734 read.c:4799
-#, c-format
-msgid "symbol `%s' already defined"
-msgstr ""
-
-#: config/tc-m32r.c:700
+#: config/tc-m32r.c:678
 msgid "Instructions write to the same destination register."
 msgstr ""
 
-#: config/tc-m32r.c:708
+#: config/tc-m32r.c:686
 msgid "Instructions do not use parallel execution pipelines."
 msgstr ""
 
-#: config/tc-m32r.c:715
+#: config/tc-m32r.c:693
 msgid "Instructions share the same execution pipeline"
 msgstr ""
 
-#: config/tc-m32r.c:784 config/tc-m32r.c:870
+#: config/tc-m32r.c:762 config/tc-m32r.c:848
 #, c-format
 msgid "not a 16 bit instruction '%s'"
 msgstr ""
 
-#: config/tc-m32r.c:791 config/tc-m32r.c:877 config/tc-m32r.c:1038
+#: config/tc-m32r.c:769 config/tc-m32r.c:855 config/tc-m32r.c:1010
 #, c-format
 msgid "unknown instruction '%s'"
 msgstr ""
 
-#: config/tc-m32r.c:799 config/tc-m32r.c:884 config/tc-m32r.c:1045
+#: config/tc-m32r.c:777 config/tc-m32r.c:862 config/tc-m32r.c:1017
 #, c-format
 msgid "instruction '%s' is for the M32RX only"
 msgstr ""
 
-#: config/tc-m32r.c:807 config/tc-m32r.c:892
+#: config/tc-m32r.c:785 config/tc-m32r.c:870
 #, c-format
 msgid "instruction '%s' cannot be executed in parallel."
 msgstr ""
 
-#: config/tc-m32r.c:854 config/tc-m32r.c:917 config/tc-m32r.c:1098
+#: config/tc-m32r.c:832 config/tc-m32r.c:895 config/tc-m32r.c:1067
 msgid "internal error: lookup/get operands failed"
 msgstr ""
 
-#: config/tc-m32r.c:902
+#: config/tc-m32r.c:880
 #, c-format
 msgid "'%s': only the NOP instruction can be issued in parallel on the m32r"
 msgstr ""
 
-#: config/tc-m32r.c:931
+#: config/tc-m32r.c:909
 #, c-format
 msgid ""
 "%s: output of 1st instruction is the same as an input to 2nd instruction - "
 "is this intentional ?"
 msgstr ""
 
-#: config/tc-m32r.c:935
+#: config/tc-m32r.c:913
 #, c-format
 msgid ""
 "%s: output of 2nd instruction is the same as an input to 1st instruction - "
 "is this intentional ?"
 msgstr ""
 
-#: config/tc-m32r.c:1264 config/tc-ppc.c:1330 config/tc-ppc.c:3534 read.c:1349
+#: config/tc-m32r.c:1228 config/tc-ppc.c:1337 config/tc-ppc.c:3547 read.c:1359
 msgid "Expected comma after symbol-name: rest of line ignored."
 msgstr ""
 
-#: config/tc-m32r.c:1273
+#: config/tc-m32r.c:1237
 #, c-format
 msgid ".SCOMMon length (%ld.) <0! Ignored."
 msgstr ""
 
-#: config/tc-m32r.c:1287 config/tc-ppc.c:1352 config/tc-ppc.c:2261
-#: config/tc-ppc.c:3558
+#: config/tc-m32r.c:1251 config/tc-ppc.c:1359 config/tc-ppc.c:2266
+#: config/tc-ppc.c:3571
 msgid "ignoring bad alignment"
 msgstr ""
 
-#: config/tc-m32r.c:1313 config/tc-ppc.c:1363 config/tc-ppc.c:3570 read.c:1369
-#: read.c:2083
+#: config/tc-m32r.c:1277 config/tc-ppc.c:1370 config/tc-ppc.c:3583 read.c:1379
+#: read.c:2102
 #, c-format
 msgid "Ignoring attempt to re-define symbol `%s'."
 msgstr ""
 
-#: config/tc-m32r.c:1322
+#: config/tc-m32r.c:1286
 #, c-format
 msgid "Length of .scomm \"%s\" is already %ld. Not changed to %ld."
 msgstr ""
 
-#: config/tc-m32r.c:1566
-msgid "Addend to unresolved symbol not on word boundary."
-msgstr ""
-
-#: config/tc-m32r.c:1795
+#: config/tc-m32r.c:1759
 msgid "Unmatched high/shigh reloc"
 msgstr ""
 
-#: config/tc-m68k.c:636
+#: config/tc-m68k.c:646
 msgid "Unknown PC relative instruction"
 msgstr ""
 
-#: config/tc-m68k.c:764
+#: config/tc-m68k.c:774
 #, c-format
 msgid "Can not do %d byte pc-relative pic relocation"
 msgstr ""
 
-#: config/tc-m68k.c:771
+#: config/tc-m68k.c:781
 #, c-format
 msgid "Can not do %d byte pic relocation"
 msgstr ""
 
-#: config/tc-m68k.c:875 config/tc-mips.c:11891
+#: config/tc-m68k.c:885 config/tc-mips.c:11223
 #, c-format
 msgid "Cannot make %s relocation PC relative"
 msgstr ""
 
-#: config/tc-m68k.c:987 config/tc-tahoe.c:1505 config/tc-vax.c:1773
+#: config/tc-m68k.c:998 config/tc-tahoe.c:1505 config/tc-vax.c:1774
 msgid "No operator"
 msgstr ""
 
-#: config/tc-m68k.c:1017 config/tc-tahoe.c:1522 config/tc-vax.c:1790
+#: config/tc-m68k.c:1028 config/tc-tahoe.c:1522 config/tc-vax.c:1791
 msgid "Unknown operator"
 msgstr ""
 
-#: config/tc-m68k.c:1764
+#: config/tc-m68k.c:1803
 msgid "invalid instruction for this architecture; needs "
 msgstr ""
 
-#: config/tc-m68k.c:1769
+#: config/tc-m68k.c:1808
 msgid "fpu (68040, 68060 or 68881/68882)"
 msgstr ""
 
-#: config/tc-m68k.c:1772
+#: config/tc-m68k.c:1811
 msgid "mmu (68030 or 68851)"
 msgstr ""
 
-#: config/tc-m68k.c:1775
+#: config/tc-m68k.c:1814
 msgid "68020 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:1778
+#: config/tc-m68k.c:1817
 msgid "68000 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:1781
+#: config/tc-m68k.c:1820
 msgid "68010 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:1809
+#: config/tc-m68k.c:1848
 msgid "operands mismatch"
 msgstr ""
 
-#: config/tc-m68k.c:1866 config/tc-m68k.c:1872 config/tc-m68k.c:1878
+#: config/tc-m68k.c:1905 config/tc-m68k.c:1911 config/tc-m68k.c:1917
 msgid "operand out of range"
 msgstr ""
 
-#: config/tc-m68k.c:1935
+#: config/tc-m68k.c:1974
 #, c-format
 msgid "Bignum too big for %c format; truncated"
 msgstr ""
 
-#: config/tc-m68k.c:2003
+#: config/tc-m68k.c:2042
 msgid "displacement too large for this architecture; needs 68020 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:2113
+#: config/tc-m68k.c:2152
 msgid ""
 "scale factor invalid on this architecture; needs cpu32 or 68020 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:2167
+#: config/tc-m68k.c:2157
+msgid "invalid index size for coldfire"
+msgstr ""
+
+#: config/tc-m68k.c:2210
 msgid "Forcing byte displacement"
 msgstr ""
 
-#: config/tc-m68k.c:2169
+#: config/tc-m68k.c:2212
 msgid "byte displacement out of range"
 msgstr ""
 
-#: config/tc-m68k.c:2216 config/tc-m68k.c:2254
+#: config/tc-m68k.c:2259 config/tc-m68k.c:2297
 msgid "invalid operand mode for this architecture; needs 68020 or higher"
 msgstr ""
 
-#: config/tc-m68k.c:2240 config/tc-m68k.c:2274
+#: config/tc-m68k.c:2283 config/tc-m68k.c:2317
 msgid ":b not permitted; defaulting to :w"
 msgstr ""
 
-#: config/tc-m68k.c:2356
+#: config/tc-m68k.c:2399
 msgid "unsupported byte value; use a different suffix"
 msgstr ""
 
-#: config/tc-m68k.c:2370
+#: config/tc-m68k.c:2413
 msgid "unknown/incorrect operand"
 msgstr ""
 
-#: config/tc-m68k.c:2403 config/tc-m68k.c:2411 config/tc-m68k.c:2418
-#: config/tc-m68k.c:2425
+#: config/tc-m68k.c:2446 config/tc-m68k.c:2454 config/tc-m68k.c:2461
+#: config/tc-m68k.c:2468
 msgid "out of range"
 msgstr ""
 
-#: config/tc-m68k.c:2475
+#: config/tc-m68k.c:2518
 msgid "Can't use long branches on 68000/68010/5200"
 msgstr ""
 
-#: config/tc-m68k.c:2563
+#: config/tc-m68k.c:2606
 msgid "Expression out of range, using 0"
 msgstr ""
 
-#: config/tc-m68k.c:2668 config/tc-m68k.c:2684
+#: config/tc-m68k.c:2718 config/tc-m68k.c:2734
 msgid "Floating point register in register list"
 msgstr ""
 
-#: config/tc-m68k.c:2674
+#: config/tc-m68k.c:2724
 msgid "Wrong register in floating-point reglist"
 msgstr ""
 
-#: config/tc-m68k.c:2690
+#: config/tc-m68k.c:2740
 msgid "incorrect register in reglist"
 msgstr ""
 
-#: config/tc-m68k.c:2696
+#: config/tc-m68k.c:2746
 msgid "wrong register in floating-point reglist"
 msgstr ""
 
-#: config/tc-m68k.c:2772
+#: config/tc-m68k.c:2822
 msgid "failed sanity check"
 msgstr ""
 
 #. ERROR
-#: config/tc-m68k.c:3108
+#: config/tc-m68k.c:3187
 msgid "Extra )"
 msgstr ""
 
 #. ERROR
-#: config/tc-m68k.c:3119
+#: config/tc-m68k.c:3198
 msgid "Missing )"
 msgstr ""
 
-#: config/tc-m68k.c:3136
+#: config/tc-m68k.c:3215
 msgid "Missing operand"
 msgstr ""
 
-#: config/tc-m68k.c:3427
+#: config/tc-m68k.c:3547
 #, c-format
 msgid "%s -- statement `%s' ignored"
 msgstr ""
 
-#: config/tc-m68k.c:3471
+#: config/tc-m68k.c:3591
 #, c-format
 msgid "Don't know how to figure width of %c in md_assemble()"
 msgstr ""
 
-#: config/tc-m68k.c:3639 config/tc-m68k.c:3675
+#: config/tc-m68k.c:3759 config/tc-m68k.c:3795
 #, c-format
 msgid "Internal Error: Can't find %s in hash table"
 msgstr ""
 
-#: config/tc-m68k.c:3642 config/tc-m68k.c:3678
+#: config/tc-m68k.c:3762 config/tc-m68k.c:3798
 #, c-format
 msgid "Internal Error: Can't hash %s: %s"
 msgstr ""
 
-#: config/tc-m68k.c:3804
+#: config/tc-m68k.c:3926
 #, c-format
 msgid "unrecognized default cpu `%s' ???"
 msgstr ""
 
-#: config/tc-m68k.c:3816
+#: config/tc-m68k.c:3938
 msgid "68040 and 68851 specified; mmu instructions may assemble incorrectly"
 msgstr ""
 
-#: config/tc-m68k.c:3836
+#: config/tc-m68k.c:3958
 msgid "options for 68881 and no-68881 both given"
 msgstr ""
 
-#: config/tc-m68k.c:3838
+#: config/tc-m68k.c:3960
 msgid "options for 68851 and no-68851 both given"
 msgstr ""
 
-#: config/tc-m68k.c:3909
+#: config/tc-m68k.c:4031
 #, c-format
 msgid "text label `%s' aligned to odd boundary"
 msgstr ""
 
-#: config/tc-m68k.c:4126
+#: config/tc-m68k.c:4248
 msgid "invalid byte branch offset"
 msgstr ""
 
-#: config/tc-m68k.c:4183
+#: config/tc-m68k.c:4305
 msgid "short branch with zero offset: use :w"
 msgstr ""
 
-#: config/tc-m68k.c:4229
+#: config/tc-m68k.c:4351
 msgid "Long branch offset not supported."
 msgstr ""
 
-#: config/tc-m68k.c:4290
+#: config/tc-m68k.c:4412
 #, c-format
 msgid "Internal error (long PC-relative operand) for insn 0x%04x at 0x%lx"
 msgstr ""
 
-#: config/tc-m68k.c:4321
+#: config/tc-m68k.c:4443
 msgid "displacement doesn't fit in one byte"
 msgstr ""
 
-#: config/tc-m68k.c:4434
+#: config/tc-m68k.c:4556
 msgid "Long branch offset to extern symbol not supported."
 msgstr ""
 
-#: config/tc-m68k.c:4783 config/tc-m68k.c:4794
+#: config/tc-m68k.c:4905 config/tc-m68k.c:4916
 msgid "expression out of range: defaulting to 1"
 msgstr ""
 
-#: config/tc-m68k.c:4826
+#: config/tc-m68k.c:4948
 msgid "expression out of range: defaulting to 0"
 msgstr ""
 
-#: config/tc-m68k.c:4859 config/tc-m68k.c:4871
+#: config/tc-m68k.c:4981 config/tc-m68k.c:4993
 #, c-format
 msgid "Can't deal with expression; defaulting to %ld"
 msgstr ""
 
-#: config/tc-m68k.c:4885
+#: config/tc-m68k.c:5007
 msgid "expression doesn't fit in BYTE"
 msgstr ""
 
-#: config/tc-m68k.c:4889
+#: config/tc-m68k.c:5011
 msgid "expression doesn't fit in WORD"
 msgstr ""
 
-#: config/tc-m68k.c:4982
+#: config/tc-m68k.c:5104
 #, c-format
 msgid "%s: unrecognized processor name"
 msgstr ""
 
-#: config/tc-m68k.c:5047
+#: config/tc-m68k.c:5169
 msgid "bad coprocessor id"
 msgstr ""
 
-#: config/tc-m68k.c:5053
+#: config/tc-m68k.c:5175
 msgid "unrecognized fopt option"
 msgstr ""
 
-#: config/tc-m68k.c:5187
+#: config/tc-m68k.c:5309
 #, c-format
 msgid "option `%s' may not be negated"
 msgstr ""
 
-#: config/tc-m68k.c:5198
+#: config/tc-m68k.c:5320
 #, c-format
 msgid "option `%s' not recognized"
 msgstr ""
 
-#: config/tc-m68k.c:5231
+#: config/tc-m68k.c:5353
 msgid "bad format of OPT NEST=depth"
 msgstr ""
 
-#: config/tc-m68k.c:5294
+#: config/tc-m68k.c:5416
 msgid "missing label"
 msgstr ""
 
-#: config/tc-m68k.c:5318 config/tc-m68k.c:5347
+#: config/tc-m68k.c:5440 config/tc-m68k.c:5469
 msgid "bad register list"
 msgstr ""
 
-#: config/tc-m68k.c:5320
+#: config/tc-m68k.c:5442
 #, c-format
 msgid "bad register list: %s"
 msgstr ""
 
-#: config/tc-m68k.c:5418
+#: config/tc-m68k.c:5540
 msgid "restore without save"
 msgstr ""
 
-#: config/tc-m68k.c:5595 config/tc-m68k.c:5944
+#: config/tc-m68k.c:5717 config/tc-m68k.c:6066
 msgid "syntax error in structured control directive"
 msgstr ""
 
-#: config/tc-m68k.c:5646
+#: config/tc-m68k.c:5768
 msgid "missing condition code in structured control directive"
 msgstr ""
 
-#: config/tc-m68k.c:5978
+#: config/tc-m68k.c:6100
 msgid "missing then"
 msgstr ""
 
-#: config/tc-m68k.c:6060
+#: config/tc-m68k.c:6182
 msgid "else without matching if"
 msgstr ""
 
-#: config/tc-m68k.c:6094
+#: config/tc-m68k.c:6216
 msgid "endi without matching if"
 msgstr ""
 
-#: config/tc-m68k.c:6135
+#: config/tc-m68k.c:6257
 msgid "break outside of structured loop"
 msgstr ""
 
-#: config/tc-m68k.c:6174
+#: config/tc-m68k.c:6296
 msgid "next outside of structured loop"
 msgstr ""
 
-#: config/tc-m68k.c:6226
+#: config/tc-m68k.c:6348
 msgid "missing ="
 msgstr ""
 
-#: config/tc-m68k.c:6264
+#: config/tc-m68k.c:6386
 msgid "missing to or downto"
 msgstr ""
 
-#: config/tc-m68k.c:6300 config/tc-m68k.c:6334 config/tc-m68k.c:6544
+#: config/tc-m68k.c:6422 config/tc-m68k.c:6456 config/tc-m68k.c:6666
 msgid "missing do"
 msgstr ""
 
-#: config/tc-m68k.c:6437
+#: config/tc-m68k.c:6559
 msgid "endf without for"
 msgstr ""
 
-#: config/tc-m68k.c:6493
+#: config/tc-m68k.c:6615
 msgid "until without repeat"
 msgstr ""
 
-#: config/tc-m68k.c:6580
+#: config/tc-m68k.c:6702
 msgid "endw without while"
 msgstr ""
 
-#: config/tc-m68k.c:6696
+#: config/tc-m68k.c:6818
 #, c-format
 msgid "unrecognized option `%s'"
 msgstr ""
 
-#: config/tc-m68k.c:6741
+#: config/tc-m68k.c:6863
 #, c-format
 msgid "unrecognized architecture specification `%s'"
 msgstr ""
 
-#: config/tc-m68k.c:6811
+#: config/tc-m68k.c:6933
 msgid ""
 "680X0 options:\n"
 "-l\t\t\tuse 1 word for refs to undefined symbols [default 2]\n"
@@ -3607,7 +3923,7 @@
 "\t\t\t[default yes for 68020, 68030, and cpu32]\n"
 msgstr ""
 
-#: config/tc-m68k.c:6821
+#: config/tc-m68k.c:6943
 msgid ""
 "-m68851 | -mno-68851\n"
 "\t\t\ttarget has/lacks memory-management unit coprocessor\n"
@@ -3619,7 +3935,7 @@
 "--bitwise-or\t\tdo not treat `|' as a comment character\n"
 msgstr ""
 
-#: config/tc-m68k.c:6830
+#: config/tc-m68k.c:6952
 msgid ""
 "--base-size-default-16\tbase reg without size is 16 bits\n"
 "--base-size-default-32\tbase reg without size is 32 bits (default)\n"
@@ -3627,12 +3943,12 @@
 "--disp-size-default-32\tdisplacement with unknown size is 32 bits (default)\n"
 msgstr ""
 
-#: config/tc-m68k.c:6865
+#: config/tc-m68k.c:6987
 #, c-format
 msgid "Error %s in %s\n"
 msgstr ""
 
-#: config/tc-m68k.c:6869
+#: config/tc-m68k.c:6991
 #, c-format
 msgid "Opcode(%d.%s): "
 msgstr ""
@@ -3693,7 +4009,7 @@
 msgid "Relaxation should never occur"
 msgstr ""
 
-#: config/tc-m88k.c:1267 config/tc-sparc.c:3024 read.c:1940
+#: config/tc-m88k.c:1267 config/tc-sparc.c:3353 read.c:1954
 #, c-format
 msgid "BSS length (%d.) <0! Ignored."
 msgstr ""
@@ -3703,151 +4019,3687 @@
 msgid "Ignoring attempt to re-define symbol %s."
 msgstr ""
 
-#: config/tc-mcore.c:273
+#: config/tc-mcore.c:509
 #, c-format
 msgid "register expected, but saw '%.6s'"
 msgstr ""
 
-#: config/tc-mcore.c:357
+#: config/tc-mcore.c:593
 #, c-format
 msgid "control register expected, but saw '%.6s'"
 msgstr ""
 
-#: config/tc-mcore.c:513
+#: config/tc-mcore.c:631
+msgid "bad/missing psr specifier"
+msgstr ""
+
+#: config/tc-mcore.c:792
 msgid "more than 65K literal pools"
 msgstr ""
 
-#: config/tc-mcore.c:567
+#: config/tc-mcore.c:846
 msgid "missing ']'"
 msgstr ""
 
-#: config/tc-mcore.c:607
+#: config/tc-mcore.c:886
 msgid "operand must be a constant"
 msgstr ""
 
-#: config/tc-mcore.c:609
+#: config/tc-mcore.c:888
 #, c-format
 msgid "operand must be absolute in range %d..%d, not %d"
 msgstr ""
 
-#: config/tc-mcore.c:646
+#: config/tc-mcore.c:926
 msgid "operand must be a multiple of 4"
 msgstr ""
 
-#: config/tc-mcore.c:653
+#: config/tc-mcore.c:933
 msgid "operand must be a multiple of 2"
 msgstr ""
 
-#: config/tc-mcore.c:667 config/tc-mcore.c:1177 config/tc-mcore.c:1231
+#: config/tc-mcore.c:947 config/tc-mcore.c:1459 config/tc-mcore.c:1513
 msgid "base register expected"
 msgstr ""
 
-#: config/tc-mcore.c:716
+#: config/tc-mcore.c:996
 #, c-format
 msgid "unknown opcode \"%s\""
 msgstr ""
 
-#: config/tc-mcore.c:759
+#: config/tc-mcore.c:1039
 msgid "invalid register: r15 illegal"
 msgstr ""
 
-#: config/tc-mcore.c:808
+#: config/tc-mcore.c:1087 config/tc-mcore.c:1663
 msgid "M340 specific opcode used when assembling for M210"
 msgstr ""
 
-#: config/tc-mcore.c:827 config/tc-mcore.c:866 config/tc-mcore.c:885
-#: config/tc-mcore.c:904 config/tc-mcore.c:931 config/tc-mcore.c:960
-#: config/tc-mcore.c:997 config/tc-mcore.c:1032 config/tc-mcore.c:1051
-#: config/tc-mcore.c:1070 config/tc-mcore.c:1102 config/tc-mcore.c:1124
-#: config/tc-mcore.c:1180 config/tc-mcore.c:1234 config/tc-mcore.c:1269
-#: config/tc-mcore.c:1323 config/tc-mcore.c:1345 config/tc-mcore.c:1368
+#: config/tc-mcore.c:1105 config/tc-mcore.c:1144 config/tc-mcore.c:1163
+#: config/tc-mcore.c:1182 config/tc-mcore.c:1209 config/tc-mcore.c:1238
+#: config/tc-mcore.c:1275 config/tc-mcore.c:1310 config/tc-mcore.c:1329
+#: config/tc-mcore.c:1348 config/tc-mcore.c:1380 config/tc-mcore.c:1405
+#: config/tc-mcore.c:1462 config/tc-mcore.c:1516 config/tc-mcore.c:1552
+#: config/tc-mcore.c:1610 config/tc-mcore.c:1632 config/tc-mcore.c:1655
 msgid "second operand missing"
 msgstr ""
 
-#: config/tc-mcore.c:842
+#: config/tc-mcore.c:1120
 msgid "destination register must be r1"
 msgstr ""
 
-#: config/tc-mcore.c:863
+#: config/tc-mcore.c:1141
 msgid "source register must be r1"
 msgstr ""
 
-#: config/tc-mcore.c:926 config/tc-mcore.c:983
+#: config/tc-mcore.c:1204 config/tc-mcore.c:1261
 msgid "immediate is not a power of two"
 msgstr ""
 
-#: config/tc-mcore.c:954
+#: config/tc-mcore.c:1232
 msgid "translating bgeni to movi"
 msgstr ""
 
-#: config/tc-mcore.c:991
+#: config/tc-mcore.c:1269
 msgid "translating mgeni to movi"
 msgstr ""
 
-#: config/tc-mcore.c:1023
+#: config/tc-mcore.c:1301
 msgid "translating bmaski to movi"
 msgstr ""
 
-#: config/tc-mcore.c:1097
+#: config/tc-mcore.c:1375
 #, c-format
 msgid "displacement too large (%d)"
 msgstr ""
 
-#: config/tc-mcore.c:1111
+#: config/tc-mcore.c:1389
 msgid "Invalid register: r0 and r15 illegal"
 msgstr ""
 
-#: config/tc-mcore.c:1138
+#: config/tc-mcore.c:1420
 msgid "bad starting register: r0 and r15 invalid"
 msgstr ""
 
-#: config/tc-mcore.c:1151
+#: config/tc-mcore.c:1433
 msgid "ending register must be r15"
 msgstr ""
 
-#: config/tc-mcore.c:1171
+#: config/tc-mcore.c:1453
 msgid "bad base register: must be r0"
 msgstr ""
 
-#: config/tc-mcore.c:1189
+#: config/tc-mcore.c:1471
 msgid "first register must be r4"
 msgstr ""
 
-#: config/tc-mcore.c:1200
+#: config/tc-mcore.c:1482
 msgid "last register must be r7"
 msgstr ""
 
-#: config/tc-mcore.c:1237
+#: config/tc-mcore.c:1519
 msgid "reg-reg expected"
 msgstr ""
 
-#: config/tc-mcore.c:1342
+#: config/tc-mcore.c:1629
 msgid "second operand must be 1"
 msgstr ""
 
-#: config/tc-mcore.c:1363
+#: config/tc-mcore.c:1650
 msgid "zero used as immediate value"
 msgstr ""
 
-#: config/tc-mcore.c:1374
+#: config/tc-mcore.c:1677
+msgid "duplicated psr bit specifier"
+msgstr ""
+
+#: config/tc-mcore.c:1683
+msgid "`af' must appear alone"
+msgstr ""
+
+#: config/tc-mcore.c:1690
 #, c-format
 msgid "unimplemented opcode \"%s\""
 msgstr ""
 
-#: config/tc-mcore.c:1444 config/tc-w65.c:856
+#: config/tc-mcore.c:1699
+#, c-format
+msgid "ignoring operands: %s "
+msgstr ""
+
+#: config/tc-mcore.c:1768 config/tc-w65.c:856
 msgid "Bad call to MD_NTOF()"
 msgstr ""
 
-#: config/tc-mcore.c:1513
+#: config/tc-mcore.c:1841
 #, c-format
 msgid "unrecognised cpu type '%s'"
 msgstr ""
 
-#: config/tc-mcore.c:1535
+#: config/tc-mcore.c:1860
 msgid ""
 "MCORE specific options:\n"
-"  -{no-}jsri2bsr\t  disable/enable jsri to bsr transformation (def: on)\n"
-"  -{no-}sifilter\t  disable/enable silicon filter behavior (def: off)\n"
-"  -relax\t\t  alter jump instructions for long displacements\n"
+"  -{no-}jsri2bsr\t  {dis}able jsri to bsr transformation (def: dis)\n"
+"  -{no-}sifilter\t  {dis}able silicon filter behavior (def: dis)\n"
+"  -cpu=[210|340]          select CPU type\n"
+"  -EB                     assemble for a big endian system (default)\n"
+"  -EL                     assemble for a little endian system\n"
 msgstr ""
 
+#: config/tc-mcore.c:1879
+msgid "failed sanity check: short_jump"
+msgstr ""
+
+#: config/tc-mcore.c:1890
+msgid "failed sanity check: long_jump"
+msgstr ""
+
+#: config/tc-mcore.c:1917
+#, c-format
+msgid "odd displacement at %x"
+msgstr ""
+
+#: config/tc-mcore.c:2105
+msgid "unknown"
+msgstr ""
+
+#: config/tc-mcore.c:2136
+#, c-format
+msgid "odd distance branch (0x%x bytes)"
+msgstr ""
+
+#: config/tc-mcore.c:2140
+#, c-format
+msgid "pcrel for branch to %s too far (0x%x)"
+msgstr ""
+
+#: config/tc-mcore.c:2159
+#, c-format
+msgid "pcrel for lrw/jmpi/jsri to %s too far (0x%x)"
+msgstr ""
+
+#: config/tc-mcore.c:2170
+#, c-format
+msgid "pcrel for loopt too far (0x%x)"
+msgstr ""
+
+#: config/tc-mcore.c:2402
+#, c-format
+msgid "Can not do %d byte %srelocation"
+msgstr ""
+
+#: config/tc-mcore.c:2404
+msgid "pc-relative"
+msgstr ""
+
+#: config/tc-mips.c:860
+msgid "-G not supported in this configuration."
+msgstr ""
+
+#: config/tc-mips.c:1005
+msgid "trap exception not supported at ISA 1"
+msgstr ""
+
+#: config/tc-mips.c:1046
+msgid "Could not set architecture and machine"
+msgstr ""
+
+#: config/tc-mips.c:1085
+#, c-format
+msgid "internal: can't hash `%s': %s"
+msgstr ""
+
+#: config/tc-mips.c:1093
+#, c-format
+msgid "internal error: bad mips16 opcode: %s %s\n"
+msgstr ""
+
+#: config/tc-mips.c:1262
+#, c-format
+msgid "returned from mips_ip(%s) insn_opcode = 0x%x\n"
+msgstr ""
+
+#: config/tc-mips.c:1816 config/tc-mips.c:11354
+msgid "extended instruction in delay slot"
+msgstr ""
+
+#: config/tc-mips.c:1838 config/tc-mips.c:1845
+#, c-format
+msgid "jump to misaligned address (0x%lx)"
+msgstr ""
+
+#: config/tc-mips.c:2495 config/tc-mips.c:2838
+msgid "Macro instruction expanded into multiple instructions"
+msgstr ""
+
+#: config/tc-mips.c:2891
+msgid "unsupported large constant"
+msgstr ""
+
+#: config/tc-mips.c:2893
+#, c-format
+msgid "Instruction %s requires absolute expression"
+msgstr ""
+
+#: config/tc-mips.c:3039
+msgid "Number larger than 32 bits"
+msgstr ""
+
+#: config/tc-mips.c:3060
+msgid "Number larger than 64 bits"
+msgstr ""
+
+#: config/tc-mips.c:3326 config/tc-mips.c:3398 config/tc-mips.c:5077
+#: config/tc-mips.c:5128 config/tc-mips.c:5664 config/tc-mips.c:5727
+msgid "PIC code offset overflow (max 16 signed bits)"
+msgstr ""
+
+#: config/tc-mips.c:3637
+#, c-format
+msgid "Branch %s is always false (nop)"
+msgstr ""
+
+#: config/tc-mips.c:3642
+#, c-format
+msgid "Branch likely %s is always false"
+msgstr ""
+
+#: config/tc-mips.c:3649 config/tc-mips.c:3723 config/tc-mips.c:3826
+#: config/tc-mips.c:3881 config/tc-mips.c:6764 config/tc-mips.c:6773
+#: config/tc-mips.c:6781 config/tc-mips.c:6890
+msgid "Unsupported large constant"
+msgstr ""
+
+#. result is always true
+#: config/tc-mips.c:3685
+#, c-format
+msgid "Branch %s is always true"
+msgstr ""
+
+#: config/tc-mips.c:3957 config/tc-mips.c:4064
+msgid "Divide by zero."
+msgstr ""
+
+#: config/tc-mips.c:4648
+msgid "MIPS PIC call to register other than $25"
+msgstr ""
+
+#: config/tc-mips.c:4653 config/tc-mips.c:4765
+msgid "No .cprestore pseudo-op used in PIC code"
+msgstr ""
+
+#: config/tc-mips.c:4838 config/tc-mips.c:4927 config/tc-mips.c:5415
+#: config/tc-mips.c:5456 config/tc-mips.c:5474 config/tc-mips.c:6103
+msgid "opcode not supported on this processor"
+msgstr ""
+
+#: config/tc-mips.c:5934 config/tc-mips.c:6658
+msgid "Macro used $at after \".set noat\""
+msgstr ""
+
+#: config/tc-mips.c:6074 config/tc-mips.c:6092
+msgid "rotate count too large"
+msgstr ""
+
+#: config/tc-mips.c:6143
+#, c-format
+msgid "Instruction %s: result is always false"
+msgstr ""
+
+#: config/tc-mips.c:6312
+#, c-format
+msgid "Instruction %s: result is always true"
+msgstr ""
+
+#: config/tc-mips.c:6451 config/tc-mips.c:6478 config/tc-mips.c:6550
+#: config/tc-mips.c:6575
+msgid "operand overflow"
+msgstr ""
+
+#. FIXME: Check if this is one of the itbl macros, since they
+#. are added dynamically.
+#: config/tc-mips.c:6654
+#, c-format
+msgid "Macro %s not implemented yet"
+msgstr ""
+
+#: config/tc-mips.c:6924
+#, c-format
+msgid "internal: bad mips opcode (mask error): %s %s"
+msgstr ""
+
+#: config/tc-mips.c:6976
+#, c-format
+msgid "internal: bad mips opcode (unknown operand type `%c'): %s %s"
+msgstr ""
+
+#: config/tc-mips.c:6983
+#, c-format
+msgid "internal: bad mips opcode (bits 0x%lx undefined): %s %s"
+msgstr ""
+
+#: config/tc-mips.c:7091
+#, c-format
+msgid "opcode not supported on this processor: %d (MIPS%d)"
+msgstr ""
+
+#: config/tc-mips.c:7161
+#, c-format
+msgid "Improper shift amount (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7188 config/tc-mips.c:8305 config/tc-mips.c:8420
+#, c-format
+msgid "Invalid value for `%s' (%lu)"
+msgstr ""
+
+#: config/tc-mips.c:7206
+#, c-format
+msgid "Illegal break code (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7220
+#, c-format
+msgid "Illegal lower break code (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7233
+#, c-format
+msgid "Illegal syscall code (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7245
+#, c-format
+msgid "Coproccesor code > 25 bits (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7259
+#, c-format
+msgid "Invalidate performance regster (%ld)"
+msgstr ""
+
+#: config/tc-mips.c:7295
+#, c-format
+msgid "Invalid register number (%d)"
+msgstr ""
+
+#: config/tc-mips.c:7455
+#, c-format
+msgid "Invalid float register number (%d)"
+msgstr ""
+
+#: config/tc-mips.c:7465
+#, c-format
+msgid "Float register should be even, was %d"
+msgstr ""
+
+#: config/tc-mips.c:7517 config/tc-mips.c:7749 config/tc-mips.c:7788
+msgid "absolute expression required"
+msgstr ""
+
+#: config/tc-mips.c:7578
+#, c-format
+msgid "Bad floating point constant: %s"
+msgstr ""
+
+#: config/tc-mips.c:7695
+msgid "Can't use floating point insn in this section"
+msgstr ""
+
+#: config/tc-mips.c:7751
+msgid "16 bit expression not in range 0..65535"
+msgstr ""
+
+#: config/tc-mips.c:7790
+msgid "16 bit expression not in range -32768..32767"
+msgstr ""
+
+#: config/tc-mips.c:7862
+msgid "lui expression not in range 0..65535"
+msgstr ""
+
+#: config/tc-mips.c:7886
+#, c-format
+msgid "invalid condition code register $fcc%d"
+msgstr ""
+
+#: config/tc-mips.c:7894
+#, c-format
+msgid "bad char = '%c'\n"
+msgstr ""
+
+#: config/tc-mips.c:7907 config/tc-mips.c:8445
+msgid "illegal operands"
+msgstr ""
+
+#: config/tc-mips.c:7974
+msgid "unrecognized opcode"
+msgstr ""
+
+#: config/tc-mips.c:8083
+#, c-format
+msgid "invalid register number (%d)"
+msgstr ""
+
+#: config/tc-mips.c:8164
+msgid "used $at without \".set noat\""
+msgstr ""
+
+#: config/tc-mips.c:8339
+msgid "can't parse register list"
+msgstr ""
+
+#: config/tc-mips.c:8373 config/tc-mips.c:8403
+msgid "invalid register list"
+msgstr ""
+
+#: config/tc-mips.c:8570
+msgid "extended operand requested but not required"
+msgstr ""
+
+#: config/tc-mips.c:8572
+msgid "invalid unextended operand value"
+msgstr ""
+
+#: config/tc-mips.c:8600
+msgid "operand value out of range for instruction"
+msgstr ""
+
+#: config/tc-mips.c:9051
+#, c-format
+msgid "ignoring invalid leading 'v' in -mcpu=%s switch"
+msgstr ""
+
+#: config/tc-mips.c:9057
+#, c-format
+msgid "invalid architecture -mcpu=%s"
+msgstr ""
+
+#: config/tc-mips.c:9107
+msgid "-G may not be used with embedded PIC code"
+msgstr ""
+
+#: config/tc-mips.c:9119
+msgid "-call_shared is supported only for ELF format"
+msgstr ""
+
+#: config/tc-mips.c:9125 config/tc-mips.c:10166 config/tc-mips.c:10334
+msgid "-G may not be used with SVR4 PIC code"
+msgstr ""
+
+#: config/tc-mips.c:9134
+msgid "-non_shared is supported only for ELF format"
+msgstr ""
+
+#: config/tc-mips.c:9150
+msgid "-G is not supported for this configuration"
+msgstr ""
+
+#: config/tc-mips.c:9155
+msgid "-G may not be used with SVR4 or embedded PIC code"
+msgstr ""
+
+#: config/tc-mips.c:9179
+msgid "No compiled in support for 64 bit object file format"
+msgstr ""
+
+#: config/tc-mips.c:9269
+msgid ""
+"MIPS options:\n"
+"-membedded-pic\t\tgenerate embedded position independent code\n"
+"-EB\t\t\tgenerate big endian output\n"
+"-EL\t\t\tgenerate little endian output\n"
+"-g, -g2\t\t\tdo not remove uneeded NOPs or swap branches\n"
+"-G NUM\t\t\tallow referencing objects up to NUM bytes\n"
+"\t\t\timplicitly with the gp register [default 8]\n"
+msgstr ""
+
+#: config/tc-mips.c:9277
+msgid ""
+"-mips1\t\t\tgenerate MIPS ISA I instructions\n"
+"-mips2\t\t\tgenerate MIPS ISA II instructions\n"
+"-mips3\t\t\tgenerate MIPS ISA III instructions\n"
+"-mips4\t\t\tgenerate MIPS ISA IV instructions\n"
+"-mcpu=CPU\t\tgenerate code for CPU, where CPU is one of:\n"
+msgstr ""
+
+#: config/tc-mips.c:9303
+msgid ""
+"-mCPU\t\t\tequivalent to -mcpu=CPU.\n"
+"-no-mCPU\t\tdon't generate code specific to CPU.\n"
+"\t\t\tFor -mCPU and -no-mCPU, CPU must be one of:\n"
+msgstr ""
+
+#: config/tc-mips.c:9316
+msgid ""
+"-mips16\t\t\tgenerate mips16 instructions\n"
+"-no-mips16\t\tdo not generate mips16 instructions\n"
+msgstr ""
+
+#: config/tc-mips.c:9319
+msgid ""
+"-O0\t\t\tremove unneeded NOPs, do not swap branches\n"
+"-O\t\t\tremove unneeded NOPs and swap branches\n"
+"--trap, --no-break\ttrap exception on div by 0 and mult overflow\n"
+"--break, --no-trap\tbreak exception on div by 0 and mult overflow\n"
+msgstr ""
+
+#: config/tc-mips.c:9325
+msgid ""
+"-KPIC, -call_shared\tgenerate SVR4 position independent code\n"
+"-non_shared\t\tdo not generate position independent code\n"
+"-xgot\t\t\tassume a 32 bit GOT\n"
+"-32\t\t\tcreate 32 bit object file (default)\n"
+"-64\t\t\tcreate 64 bit object file\n"
+msgstr ""
+
+#: config/tc-mips.c:9382
+#, c-format
+msgid "Unsupported reloc size %d"
+msgstr ""
+
+#: config/tc-mips.c:9485
+msgid "Unmatched %%hi reloc"
+msgstr ""
+
+#: config/tc-mips.c:9590
+msgid "Invalid PC relative reloc"
+msgstr ""
+
+#: config/tc-mips.c:9690 config/tc-sparc.c:2915 config/tc-sparc.c:2922
+#: config/tc-sparc.c:2929 config/tc-sparc.c:2936 config/tc-sparc.c:2943
+#: config/tc-sparc.c:2952 config/tc-sparc.c:2963 config/tc-sparc.c:2989
+#: config/tc-sparc.c:3017 write.c:971 write.c:1035
+msgid "relocation overflow"
+msgstr ""
+
+#: config/tc-mips.c:9706
+#, c-format
+msgid "Branch to odd address (%lx)"
+msgstr ""
+
+#: config/tc-mips.c:9861
+#, c-format
+msgid "%08lx  UNDEFINED\n"
+msgstr ""
+
+#: config/tc-mips.c:9927
+msgid "Alignment negative: 0 assumed."
+msgstr ""
+
+#: config/tc-mips.c:10015
+msgid "No read only data section in this object file format"
+msgstr ""
+
+#: config/tc-mips.c:10038
+msgid "Global pointers not supported; recompile -G 0"
+msgstr ""
+
+#: config/tc-mips.c:10124
+#, c-format
+msgid "%s: no such section"
+msgstr ""
+
+#: config/tc-mips.c:10161
+#, c-format
+msgid ".option pic%d not supported"
+msgstr ""
+
+#: config/tc-mips.c:10172
+#, c-format
+msgid "Unrecognized option \"%s\""
+msgstr ""
+
+#: config/tc-mips.c:10235
+msgid "`noreorder' must be set before `nomacro'"
+msgstr ""
+
+#: config/tc-mips.c:10270
+msgid "unknown ISA level"
+msgstr ""
+
+#: config/tc-mips.c:10293
+msgid ".set pop with no .set push"
+msgstr ""
+
+#: config/tc-mips.c:10317
+#, c-format
+msgid "Tried to set unrecognized symbol: %s\n"
+msgstr ""
+
+#: config/tc-mips.c:10367
+msgid ".cpload not in noreorder section"
+msgstr ""
+
+#: config/tc-mips.c:10449
+msgid "Unsupported use of .gpword"
+msgstr ""
+
+#: config/tc-mips.c:10586
+msgid "expected `$'"
+msgstr ""
+
+#: config/tc-mips.c:10594
+msgid "Bad register number"
+msgstr ""
+
+#: config/tc-mips.c:10610
+msgid "Unrecognized register name"
+msgstr ""
+
+#: config/tc-mips.c:10809
+msgid "unsupported PC relative reference to different section"
+msgstr ""
+
+#: config/tc-mips.c:10918
+msgid "unsupported relocation"
+msgstr ""
+
+#: config/tc-mips.c:11001
+msgid "AT used after \".set noat\" or macro used after \".set nomacro\""
+msgstr ""
+
+#: config/tc-mips.c:11064
+msgid "Double check fx_r_type in tc-mips.c:tc_gen_reloc"
+msgstr ""
+
+#: config/tc-mips.c:11575
+msgid "missing `.end' at end of assembly"
+msgstr ""
+
+#: config/tc-mips.c:11590
+msgid "Expected simple number."
+msgstr ""
+
+#: config/tc-mips.c:11616
+#, c-format
+msgid " *input_line_pointer == '%c' 0x%02x\n"
+msgstr ""
+
+#: config/tc-mips.c:11618
+msgid "Invalid number"
+msgstr ""
+
+#: config/tc-mips.c:11673
+msgid ".end not in text section"
+msgstr ""
+
+#: config/tc-mips.c:11677
+msgid ".end directive without a preceding .ent directive."
+msgstr ""
+
+#: config/tc-mips.c:11686
+msgid ".end symbol does not match .ent symbol."
+msgstr ""
+
+#: config/tc-mips.c:11689
+msgid ".end directive missing or unknown symbol"
+msgstr ""
+
+#: config/tc-mips.c:11764
+msgid ".ent or .aent not in text section."
+msgstr ""
+
+#: config/tc-mips.c:11767
+msgid "missing `.end'"
+msgstr ""
+
+#: config/tc-mips.c:11800 ecoff.c:3227
+msgid ".frame outside of .ent"
+msgstr ""
+
+#: config/tc-mips.c:11811 ecoff.c:3238
+msgid "Bad .frame directive"
+msgstr ""
+
+#: config/tc-mips.c:11841
+msgid ".mask/.fmask outside of .ent"
+msgstr ""
+
+#: config/tc-mips.c:11848
+msgid "Bad .mask/.fmask directive"
+msgstr ""
+
+#: config/tc-mn10200.c:313
+msgid ""
+"MN10200 options:\n"
+"none yet\n"
+msgstr ""
+
+#: config/tc-mn10200.c:788 config/tc-mn10300.c:912 config/tc-ppc.c:1614
+#: config/tc-v850.c:1691
+#, c-format
+msgid "Unrecognized opcode: `%s'"
+msgstr ""
+
+#: config/tc-mn10300.c:495
+msgid ""
+"MN10300 options:\n"
+"none yet\n"
+msgstr ""
+
+#: config/tc-mn10300.c:930
+msgid "Invalid opcode/operands"
+msgstr ""
+
+#: config/tc-mn10300.c:1406
+msgid "Invalid register specification."
+msgstr ""
+
+#: config/tc-ns32k.c:444
+msgid "Invalid syntax in PC-relative addressing mode"
+msgstr ""
+
+#: config/tc-ns32k.c:468
+msgid "Invalid syntax in External addressing mode"
+msgstr ""
+
+#: config/tc-ns32k.c:537
+msgid "Invalid syntax in Memory Relative addressing mode"
+msgstr ""
+
+#: config/tc-ns32k.c:604
+msgid "Invalid scaled-indexed mode, use (b,w,d,q)"
+msgstr ""
+
+#: config/tc-ns32k.c:609
+msgid "Syntax in scaled-indexed mode, use [Rn:m] where n=[0..7] m={b,w,d,q}"
+msgstr ""
+
+#: config/tc-ns32k.c:615
+msgid "Scaled-indexed addressing mode combined with scaled-index"
+msgstr ""
+
+#: config/tc-ns32k.c:624
+msgid "Invalid or illegal addressing mode combined with scaled-index"
+msgstr ""
+
+#: config/tc-ns32k.c:731
+msgid "Premature end of suffix -- Defaulting to d"
+msgstr ""
+
+#: config/tc-ns32k.c:744
+msgid "Bad suffix after ':' use {b|w|d} Defaulting to d"
+msgstr ""
+
+#: config/tc-ns32k.c:785
+msgid "Very short instr to option, ie you can't do it on a NULLstr"
+msgstr ""
+
+#: config/tc-ns32k.c:829
+msgid "No such entry in list. (cpu/mmu register)"
+msgstr ""
+
+#: config/tc-ns32k.c:870
+msgid "Internal consistency error.  check ns32k-opcode.h"
+msgstr ""
+
+#: config/tc-ns32k.c:891
+msgid "Address of immediate operand"
+msgstr ""
+
+#: config/tc-ns32k.c:892
+msgid "Invalid immediate write operand."
+msgstr ""
+
+#: config/tc-ns32k.c:1019
+msgid "Bad opcode-table-option, check in file ns32k-opcode.h"
+msgstr ""
+
+#: config/tc-ns32k.c:1048
+msgid "No such opcode"
+msgstr ""
+
+#: config/tc-ns32k.c:1116
+msgid "Bad suffix, defaulting to d"
+msgstr ""
+
+#: config/tc-ns32k.c:1138
+msgid "Too many operands passed to instruction"
+msgstr ""
+
+#. check error in default
+#: config/tc-ns32k.c:1149
+msgid "Wrong numbers of operands in default, check ns32k-opcodes.h"
+msgstr ""
+
+#: config/tc-ns32k.c:1154
+msgid "Wrong number of operands"
+msgstr ""
+
+#: config/tc-ns32k.c:1273
+msgid "iif convert internal pcrel/binary"
+msgstr ""
+
+#: config/tc-ns32k.c:1289
+msgid "Bignum too big for long"
+msgstr ""
+
+#: config/tc-ns32k.c:1364
+msgid "iif convert internal pcrel/pointer"
+msgstr ""
+
+#: config/tc-ns32k.c:1369
+msgid "Internal logic error in iif.iifP[n].type"
+msgstr ""
+
+#. We cant relax this case
+#: config/tc-ns32k.c:1403
+msgid "Can't relax difference"
+msgstr ""
+
+#: config/tc-ns32k.c:1452
+msgid "Displacement to large for :d"
+msgstr ""
+
+#: config/tc-ns32k.c:1463
+msgid "Internal logic error in iif.iifP[].type"
+msgstr ""
+
+#: config/tc-ns32k.c:1518
+#, c-format
+msgid "Can not do %d byte pc-relative relocation for storage type %d"
+msgstr ""
+
+#: config/tc-ns32k.c:1521
+#, c-format
+msgid "Can not do %d byte relocation for storage type %d"
+msgstr ""
+
+#: config/tc-ns32k.c:1553
+#, c-format
+msgid "Can't hash %s: %s"
+msgstr ""
+
+#: config/tc-ns32k.c:1637
+msgid "Byte displacement out of range.  line number not valid"
+msgstr ""
+
+#: config/tc-ns32k.c:1646
+msgid "Word displacement out of range.  line number not valid"
+msgstr ""
+
+#: config/tc-ns32k.c:1660
+msgid "Double word displacement out of range"
+msgstr ""
+
+#: config/tc-ns32k.c:1680
+#, c-format
+msgid "Internal logic error.  line %s, file \"%s\""
+msgstr ""
+
+#: config/tc-ns32k.c:1728
+#, c-format
+msgid "Internal logic error. line %s, file \"%s\""
+msgstr ""
+
+#: config/tc-ns32k.c:1839
+msgid "Bit field out of range"
+msgstr ""
+
+#: config/tc-ns32k.c:2088
+#, c-format
+msgid "invalid architecture option -m%s"
+msgstr ""
+
+#: config/tc-ns32k.c:2104
+msgid ""
+"NS32K options:\n"
+"-m32032 | -m32532\tselect variant of NS32K architecture\n"
+msgstr ""
+
+#: config/tc-ns32k.c:2284
+#, c-format
+msgid "Cannot find relocation type for symbol %s, code %d"
+msgstr ""
+
+#: config/tc-pj.c:70 config/tc-pj.c:78
+msgid "confusing relocation expressions"
+msgstr ""
+
+#: config/tc-pj.c:172
+msgid "can't have relocation for ipush"
+msgstr ""
+
+#: config/tc-pj.c:282
+#, c-format
+msgid "unknown opcode %s"
+msgstr ""
+
+#: config/tc-pj.c:431
+msgid ""
+"PJ options:\n"
+"-little\t\t\tgenerate little endian code\n"
+"-big\t\t\tgenerate big endian code\n"
+msgstr ""
+
+#: config/tc-pj.c:472 config/tc-sh.c:2570 config/tc-sh.c:2577
+#: config/tc-sh.c:2584 config/tc-sh.c:2591
+msgid "pcrel too far"
+msgstr ""
+
+#: config/tc-pj.c:541 config/tc-sh.c:2663
+msgid "offset out of range"
+msgstr ""
+
+#: config/tc-ppc.c:835
+#, c-format
+msgid "invalid switch -m%s"
+msgstr ""
+
+#: config/tc-ppc.c:872
+msgid ""
+"PowerPC options:\n"
+"-u\t\t\tignored\n"
+"-mpwrx, -mpwr2\t\tgenerate code for IBM POWER/2 (RIOS2)\n"
+"-mpwr\t\t\tgenerate code for IBM POWER (RIOS1)\n"
+"-m601\t\t\tgenerate code for Motorola PowerPC 601\n"
+"-mppc, -mppc32, -m403, -m603, -m604\n"
+"\t\t\tgenerate code for Motorola PowerPC 603/604\n"
+"-mppc64, -m620\t\tgenerate code for Motorola PowerPC 620\n"
+"-mppc64bridge\t\tgenerate code for PowerPC 64, including bridge insns\n"
+"-mcom\t\t\tgenerate code Power/PowerPC common instructions\n"
+"-many\t\t\tgenerate code for any architecture (PWR/PWRX/PPC)\n"
+"-mregnames\t\tAllow symbolic names for registers\n"
+"-mno-regnames\t\tDo not allow symbolic names for registers\n"
+msgstr ""
+
+#: config/tc-ppc.c:887
+msgid ""
+"-mrelocatable\t\tsupport for GCC's -mrelocatble option\n"
+"-mrelocatable-lib\tsupport for GCC's -mrelocatble-lib option\n"
+"-memb\t\t\tset PPC_EMB bit in ELF flags\n"
+"-mlittle, -mlittle-endian\n"
+"\t\t\tgenerate code for a little endian machine\n"
+"-mbig, -mbig-endian\tgenerate code for a big endian machine\n"
+"-msolaris\t\tgenerate code for Solaris\n"
+"-mno-solaris\t\tdo not generate code for Solaris\n"
+"-V\t\t\tprint assembler version number\n"
+"-Qy, -Qn\t\tignored\n"
+msgstr ""
+
+#: config/tc-ppc.c:922
+#, c-format
+msgid "Unknown default cpu = %s, os = %s"
+msgstr ""
+
+#: config/tc-ppc.c:947
+msgid "Neither Power nor PowerPC opcodes were selected."
+msgstr ""
+
+#: config/tc-ppc.c:995
+#, c-format
+msgid "Internal assembler error for instruction %s"
+msgstr ""
+
+#: config/tc-ppc.c:1014
+#, c-format
+msgid "Internal assembler error for macro %s"
+msgstr ""
+
+#: config/tc-ppc.c:1224
+msgid "identifier+constant@got means identifier@got+constant"
+msgstr ""
+
+#: config/tc-ppc.c:1278
+#, c-format
+msgid "%s relocations do not fit in %d bytes\n"
+msgstr ""
+
+#: config/tc-ppc.c:1378
+#, c-format
+msgid "Length of .lcomm \"%s\" is already %ld. Not changed to %ld."
+msgstr ""
+
+#: config/tc-ppc.c:1460
+msgid "Relocation cannot be done when using -mrelocatable"
+msgstr ""
+
+#: config/tc-ppc.c:1541
+#, c-format
+msgid "syntax error: invalid toc specifier `%s'"
+msgstr ""
+
+#: config/tc-ppc.c:1555
+#, c-format
+msgid "syntax error: expected `]', found  `%c'"
+msgstr ""
+
+#: config/tc-ppc.c:1790
+msgid "[tocv] symbol is not a toc symbol"
+msgstr ""
+
+#: config/tc-ppc.c:1801
+msgid "Unimplemented toc32 expression modifier"
+msgstr ""
+
+#: config/tc-ppc.c:1806
+msgid "Unimplemented toc64 expression modifier"
+msgstr ""
+
+#: config/tc-ppc.c:1810
+#, c-format
+msgid "Unexpected return value [%d] from parse_toc_entry!\n"
+msgstr ""
+
+#: config/tc-ppc.c:1963
+#, c-format
+msgid "syntax error; found `%c' but expected `%c'"
+msgstr ""
+
+#: config/tc-ppc.c:2071
+msgid "wrong number of operands"
+msgstr ""
+
+#: config/tc-ppc.c:2127
+msgid "Bad .section directive: want a,w,x,e in string"
+msgstr ""
+
+#: config/tc-ppc.c:2241
+msgid "missing size"
+msgstr ""
+
+#: config/tc-ppc.c:2250
+msgid "negative size"
+msgstr ""
+
+#: config/tc-ppc.c:2291
+msgid "missing real symbol name"
+msgstr ""
+
+#: config/tc-ppc.c:2312
+msgid "attempt to redefine symbol"
+msgstr ""
+
+#: config/tc-ppc.c:2546
+msgid "The XCOFF file format does not support arbitrary sections"
+msgstr ""
+
+#: config/tc-ppc.c:2654 config/tc-ppc.c:3171 read.c:2976
+msgid "missing value"
+msgstr ""
+
+#: config/tc-ppc.c:2672
+msgid "illegal .stabx expression; zero assumed"
+msgstr ""
+
+#: config/tc-ppc.c:2704
+msgid "missing class"
+msgstr ""
+
+#: config/tc-ppc.c:2713
+msgid "missing type"
+msgstr ""
+
+#: config/tc-ppc.c:2774
+msgid "missing symbol name"
+msgstr ""
+
+#: config/tc-ppc.c:2950
+msgid "nested .bs blocks"
+msgstr ""
+
+#: config/tc-ppc.c:2983
+msgid ".es without preceding .bs"
+msgstr ""
+
+#: config/tc-ppc.c:3163
+msgid "non-constant byte count"
+msgstr ""
+
+#: config/tc-ppc.c:3208
+msgid ".tc not in .toc section"
+msgstr ""
+
+#: config/tc-ppc.c:3227
+msgid ".tc with no label"
+msgstr ""
+
+#: config/tc-ppc.c:3302
+msgid "No previous section to return to. Directive ignored."
+msgstr ""
+
+#. Section Contents
+#. unknown
+#: config/tc-ppc.c:3721
+msgid "Unsupported section attribute -- 'a'"
+msgstr ""
+
+#: config/tc-ppc.c:3911
+msgid "bad symbol suffix"
+msgstr ""
+
+#: config/tc-ppc.c:4004
+msgid "Unrecognized symbol suffix"
+msgstr ""
+
+#: config/tc-ppc.c:4086
+msgid "two .function pseudo-ops with no intervening .ef"
+msgstr ""
+
+#: config/tc-ppc.c:4099
+msgid ".ef with no preceding .function"
+msgstr ""
+
+#: config/tc-ppc.c:4227
+#, c-format
+msgid "warning: symbol %s has no csect"
+msgstr ""
+
+#: config/tc-ppc.c:4528
+msgid "symbol in .toc does not match any .tc"
+msgstr ""
+
+#: config/tc-ppc.c:4826
+msgid "unsupported relocation type"
+msgstr ""
+
+#: config/tc-ppc.c:4880
+#, c-format
+msgid "cannot emit PC relative %s relocation against %s"
+msgstr ""
+
+#: config/tc-ppc.c:4885
+#, c-format
+msgid "cannot emit PC relative %s relocation"
+msgstr ""
+
+#: config/tc-ppc.c:4947
+msgid "must branch to an address a multiple of 4"
+msgstr ""
+
+#: config/tc-ppc.c:4951
+#, c-format
+msgid "@local or @plt branch destination is too far away, %ld bytes"
+msgstr ""
+
+#: config/tc-ppc.c:4975
+#, c-format
+msgid "Gas failure, reloc value %d\n"
+msgstr ""
+
+#: config/tc-sh.c:671
+msgid "illegal register after @-"
+msgstr ""
+
+#: config/tc-sh.c:687
+msgid "must be @(r0,...)"
+msgstr ""
+
+#: config/tc-sh.c:703
+msgid "syntax error in @(r0,...)"
+msgstr ""
+
+#: config/tc-sh.c:735 config/tc-sh.c:740
+msgid "syntax error in @(disp,[Rn, gbr, pc])"
+msgstr ""
+
+#: config/tc-sh.c:745
+msgid "expecting )"
+msgstr ""
+
+#: config/tc-sh.c:754
+msgid "illegal register after @"
+msgstr ""
+
+#: config/tc-sh.c:1256
+#, c-format
+msgid "Invalid register: 'r%d'"
+msgstr ""
+
+#: config/tc-sh.c:1392
+msgid "insn can't be combined with parallel processing insn"
+msgstr ""
+
+#: config/tc-sh.c:1399 config/tc-sh.c:1410
+msgid "multiple movx specifications"
+msgstr ""
+
+#: config/tc-sh.c:1404 config/tc-sh.c:1431
+msgid "multiple movy specifications"
+msgstr ""
+
+#: config/tc-sh.c:1412
+msgid "invalid movx address register"
+msgstr ""
+
+#: config/tc-sh.c:1418 config/tc-sh.c:1423
+msgid "invalid movx dsp register"
+msgstr ""
+
+#: config/tc-sh.c:1440 config/tc-sh.c:1445
+msgid "invalid movy dsp register"
+msgstr ""
+
+#: config/tc-sh.c:1449
+msgid "invalid movy address register"
+msgstr ""
+
+#: config/tc-sh.c:1455
+msgid "dsp immediate shift value not constant"
+msgstr ""
+
+#: config/tc-sh.c:1462 config/tc-sh.c:1475
+msgid "multiple parallel processing specifications"
+msgstr ""
+
+#: config/tc-sh.c:1468
+msgid "multiple condition specifications"
+msgstr ""
+
+#: config/tc-sh.c:1484
+msgid "insn cannot be combined with pmuls"
+msgstr ""
+
+#: config/tc-sh.c:1501
+msgid "bad padd / psub pmuls output operand"
+msgstr ""
+
+#: config/tc-sh.c:1511
+msgid "condition not followed by conditionalizable insn"
+msgstr ""
+
+#: config/tc-sh.c:1521
+msgid "unrecognized characters at end of parallel processing insn"
+msgstr ""
+
+#: config/tc-sh.c:1631
+#, c-format
+msgid "excess operands: '%s'"
+msgstr ""
+
+#: config/tc-sh.c:1777
+msgid ".uses pseudo-op seen when not relaxing"
+msgstr ""
+
+#: config/tc-sh.c:1783
+msgid "bad .uses format"
+msgstr ""
+
+#: config/tc-sh.c:1844
+msgid ""
+"SH options:\n"
+"-little\t\t\tgenerate little endian code\n"
+"-relax\t\t\talter jump instructions for long displacements\n"
+"-small\t\t\talign sections to 4 byte boundaries, not 16\n"
+msgstr ""
+
+#: config/tc-sh.c:1854 config/tc-w65.c:883
+msgid "call to tc_Nout_fix_to_chars \n"
+msgstr ""
+
+#: config/tc-sh.c:1940
+msgid ".uses does not refer to a local symbol in the same section"
+msgstr ""
+
+#: config/tc-sh.c:1959
+msgid "can't find fixup pointed to by .uses"
+msgstr ""
+
+#: config/tc-sh.c:1982
+msgid ".uses target does not refer to a local symbol in the same section"
+msgstr ""
+
+#: config/tc-sh.c:2079
+#, c-format
+msgid "at 0x%lx, displacement overflows 12-bit field"
+msgstr ""
+
+#: config/tc-sh.c:2082
+#, c-format
+msgid "at 0x%lx, displacement to defined symbol %s overflows 12-bit field"
+msgstr ""
+
+#: config/tc-sh.c:2086
+#, c-format
+msgid "at 0x%lx, displacement to undefined symbol %s overflows 12-bit field"
+msgstr ""
+
+#: config/tc-sh.c:2202
+#, c-format
+msgid "at 0x%lx, displacement overflows 8-bit field"
+msgstr ""
+
+#: config/tc-sh.c:2205
+#, c-format
+msgid "at 0x%lx, displacement to defined symbol %s overflows 8-bit field "
+msgstr ""
+
+#: config/tc-sh.c:2209
+#, c-format
+msgid "at 0x%lx, displacement to undefined symbol %s overflows 8-bit field "
+msgstr ""
+
+#: config/tc-sh.c:2262
+#, c-format
+msgid "overflow in branch to %s; converted into longer instruction sequence"
+msgstr ""
+
+#: config/tc-sh.c:2337 config/tc-sh.c:2365 config/tc-sparc.c:3892
+#: config/tc-sparc.c:3911
+msgid "misaligned data"
+msgstr ""
+
+#: config/tc-sh.c:2655
+msgid "misaligned offset"
+msgstr ""
+
+#: config/tc-sparc.c:268
+msgid "Invalid default architecture, broken assembler."
+msgstr ""
+
+#: config/tc-sparc.c:272 config/tc-sparc.c:463
+msgid "Bad opcode table, broken assembler."
+msgstr ""
+
+#: config/tc-sparc.c:442
+#, c-format
+msgid "invalid architecture -xarch=%s"
+msgstr ""
+
+#: config/tc-sparc.c:457
+#, c-format
+msgid "invalid architecture -A%s"
+msgstr ""
+
+#: config/tc-sparc.c:524
+#, c-format
+msgid "No compiled in support for %d bit object file format"
+msgstr ""
+
+#: config/tc-sparc.c:561
+msgid "Unrecognized option following -K"
+msgstr ""
+
+#: config/tc-sparc.c:589
+msgid "SPARC options:\n"
+msgstr ""
+
+#: config/tc-sparc.c:597
+msgid ""
+"\n"
+"-xarch=v8plus | -xarch=v8plusa\n"
+msgstr ""
+
+#: config/tc-sparc.c:598
+msgid ""
+"\t\t\tspecify variant of SPARC architecture\n"
+"-bump\t\t\twarn when assembler switches architectures\n"
+"-sparc\t\t\tignored\n"
+"--enforce-aligned-data\tforce .long, etc., to be aligned correctly\n"
+msgstr ""
+
+#: config/tc-sparc.c:604
+msgid "-k\t\t\tgenerate PIC\n"
+msgstr ""
+
+#: config/tc-sparc.c:608
+msgid ""
+"-32\t\t\tcreate 32 bit object file\n"
+"-64\t\t\tcreate 64 bit object file\n"
+msgstr ""
+
+#: config/tc-sparc.c:611
+#, c-format
+msgid "\t\t\t[default is %d]\n"
+msgstr ""
+
+#: config/tc-sparc.c:613
+msgid ""
+"-TSO\t\t\tuse Total Store Ordering\n"
+"-PSO\t\t\tuse Partial Store Ordering\n"
+"-RMO\t\t\tuse Relaxed Memory Ordering\n"
+msgstr ""
+
+#: config/tc-sparc.c:617
+#, c-format
+msgid "\t\t\t[default is %s]\n"
+msgstr ""
+
+#: config/tc-sparc.c:619
+msgid ""
+"-KPIC\t\t\tgenerate PIC\n"
+"-V\t\t\tprint assembler version number\n"
+"-q\t\t\tignored\n"
+"-Qy, -Qn\t\tignored\n"
+"-s\t\t\tignored\n"
+msgstr ""
+
+#: config/tc-sparc.c:627
+msgid ""
+"-EL\t\t\tgenerate code for a little endian machine\n"
+"-EB\t\t\tgenerate code for a big endian machine\n"
+"--little-endian-data\tgenerate code for a machine having big endian\n"
+"                        instructions and little endian data."
+msgstr ""
+
+#: config/tc-sparc.c:744
+#, c-format
+msgid "Internal error: losing opcode: `%s' \"%s\"\n"
+msgstr ""
+
+#: config/tc-sparc.c:762
+#, c-format
+msgid "Internal error: can't find opcode `%s' for `%s'\n"
+msgstr ""
+
+#: config/tc-sparc.c:911
+msgid "Support for 64-bit arithmetic not compiled in."
+msgstr ""
+
+#: config/tc-sparc.c:957
+msgid "set: number not in 0..4294967295 range"
+msgstr ""
+
+#: config/tc-sparc.c:964
+msgid "set: number not in -2147483648..4294967295 range"
+msgstr ""
+
+#: config/tc-sparc.c:1024
+msgid "setsw: number not in -2147483648..4294967295 range"
+msgstr ""
+
+#: config/tc-sparc.c:1072
+msgid "setx: temporary register same as destination register"
+msgstr ""
+
+#: config/tc-sparc.c:1142
+msgid "setx: illegal temporary register g0"
+msgstr ""
+
+#: config/tc-sparc.c:1239
+msgid "FP branch in delay slot"
+msgstr ""
+
+#: config/tc-sparc.c:1255
+msgid "FP branch preceded by FP instruction; NOP inserted"
+msgstr ""
+
+#: config/tc-sparc.c:1295
+msgid "failed special case insn sanity check"
+msgstr ""
+
+#: config/tc-sparc.c:1386
+msgid ": invalid membar mask name"
+msgstr ""
+
+#: config/tc-sparc.c:1400
+msgid ": invalid membar mask expression"
+msgstr ""
+
+#: config/tc-sparc.c:1405
+msgid ": invalid membar mask number"
+msgstr ""
+
+#: config/tc-sparc.c:1423
+msgid ": invalid prefetch function name"
+msgstr ""
+
+#: config/tc-sparc.c:1431
+msgid ": invalid prefetch function expression"
+msgstr ""
+
+#: config/tc-sparc.c:1436
+msgid ": invalid prefetch function number"
+msgstr ""
+
+#: config/tc-sparc.c:1464 config/tc-sparc.c:1476
+msgid ": unrecognizable privileged register"
+msgstr ""
+
+#: config/tc-sparc.c:1500 config/tc-sparc.c:1517
+msgid ": unrecognizable v9a ancillary state register"
+msgstr ""
+
+#: config/tc-sparc.c:1505
+msgid ": rd on write only ancillary state register"
+msgstr ""
+
+#: config/tc-sparc.c:1541
+msgid ": asr number must be between 16 and 31"
+msgstr ""
+
+#: config/tc-sparc.c:1549
+msgid ": asr number must be between 0 and 31"
+msgstr ""
+
+#: config/tc-sparc.c:1559
+msgid ": expecting %asrN"
+msgstr ""
+
+#: config/tc-sparc.c:1887
+msgid "detected global register use not covered by .register pseudo-op"
+msgstr ""
+
+#: config/tc-sparc.c:1959
+msgid ": There are only 64 f registers; [0-63]"
+msgstr ""
+
+#: config/tc-sparc.c:1961 config/tc-sparc.c:1973
+msgid ": There are only 32 f registers; [0-31]"
+msgstr ""
+
+#: config/tc-sparc.c:2092 config/tc-sparc.c:2128
+msgid "Illegal operands: %%%s requires arguments in ()"
+msgstr ""
+
+#: config/tc-sparc.c:2140
+msgid ""
+"Illegal operands: Can't do arithmetics other than + and - involving %%%s()"
+msgstr ""
+
+#: config/tc-sparc.c:2249
+msgid "Illegal operands: Can't add non-constant expression to %%%s()"
+msgstr ""
+
+#: config/tc-sparc.c:2259
+msgid ""
+"Illegal operands: Can't do arithmetics involving %%%s() of a relocatable "
+"symbol"
+msgstr ""
+
+#: config/tc-sparc.c:2277
+msgid ": PC-relative operand can't be a constant"
+msgstr ""
+
+#: config/tc-sparc.c:2310
+msgid ": invalid ASI name"
+msgstr ""
+
+#: config/tc-sparc.c:2318
+msgid ": invalid ASI expression"
+msgstr ""
+
+#: config/tc-sparc.c:2323
+msgid ": invalid ASI number"
+msgstr ""
+
+#: config/tc-sparc.c:2420
+msgid "OPF immediate operand out of range (0-0x1ff)"
+msgstr ""
+
+#: config/tc-sparc.c:2425
+msgid "non-immediate OPF operand, ignored"
+msgstr ""
+
+#: config/tc-sparc.c:2444
+msgid ": invalid cpreg name"
+msgstr ""
+
+#: config/tc-sparc.c:2473
+#, c-format
+msgid "Illegal operands%s"
+msgstr ""
+
+#: config/tc-sparc.c:2502
+#, c-format
+msgid "architecture bumped from \"%s\" to \"%s\" on \"%s\""
+msgstr ""
+
+#: config/tc-sparc.c:2538
+#, c-format
+msgid "Architecture mismatch on \"%s\"."
+msgstr ""
+
+#: config/tc-sparc.c:2539
+#, c-format
+msgid " (Requires %s; requested architecture is %s.)"
+msgstr ""
+
+#: config/tc-sparc.c:3063
+#, c-format
+msgid "bad or unhandled relocation type: 0x%02x"
+msgstr ""
+
+#: config/tc-sparc.c:3365
+msgid "bad .reserve segment -- expected BSS segment"
+msgstr ""
+
+#: config/tc-sparc.c:3382
+msgid "missing alignment"
+msgstr ""
+
+#: config/tc-sparc.c:3393 config/tc-sparc.c:3538
+#, c-format
+msgid "alignment too large; assuming %d"
+msgstr ""
+
+#: config/tc-sparc.c:3399 config/tc-sparc.c:3544
+msgid "negative alignment"
+msgstr ""
+
+#: config/tc-sparc.c:3409 config/tc-sparc.c:3567
+msgid "alignment not a power of 2"
+msgstr ""
+
+#: config/tc-sparc.c:3524
+msgid "Expected comma after common length"
+msgstr ""
+
+#: config/tc-sparc.c:3759 config/tc-sparc.c:3769
+msgid "register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}"
+msgstr ""
+
+#: config/tc-sparc.c:3787
+msgid "redefinition of global register"
+msgstr ""
+
+#: config/tc-sparc.c:3798
+#, c-format
+msgid "Register symbol %s already defined."
+msgstr ""
+
+#: config/tc-tahoe.c:387
+msgid "The -a option doesn't exist. (Despite what the man page says!"
+msgstr ""
+
+#: config/tc-tahoe.c:391 config/tc-vax.c:3141
+#, c-format
+msgid "Displacement length %s ignored!"
+msgstr ""
+
+#: config/tc-tahoe.c:395 config/tc-vax.c:3133
+msgid "SYMBOL TABLE not implemented"
+msgstr ""
+
+#: config/tc-tahoe.c:399 config/tc-vax.c:3137
+msgid "TOKEN TRACE not implemented"
+msgstr ""
+
+#: config/tc-tahoe.c:403 config/tc-vax.c:3145
+#, c-format
+msgid "I don't need or use temp. file \"%s\"."
+msgstr ""
+
+#: config/tc-tahoe.c:407 config/tc-vax.c:3149
+msgid "I don't use an interpass file! -V ignored"
+msgstr ""
+
+#: config/tc-tahoe.c:421
+msgid ""
+"Tahoe options:\n"
+"-a\t\t\tignored\n"
+"-d LENGTH\t\tignored\n"
+"-J\t\t\tignored\n"
+"-S\t\t\tignored\n"
+"-t FILE\t\t\tignored\n"
+"-T\t\t\tignored\n"
+"-V\t\t\tignored\n"
+msgstr ""
+
+#: config/tc-tahoe.c:1075
+msgid "Casting a branch displacement is bad form, and is ignored."
+msgstr ""
+
+#: config/tc-tahoe.c:1131
+msgid "Couldn't parse the [index] in this operand."
+msgstr ""
+
+#: config/tc-tahoe.c:1137
+msgid "Couldn't find the opening '[' for the index of this operand."
+msgstr ""
+
+#: config/tc-tahoe.c:1177
+msgid "Couldn't find the opening '(' for the deref of this operand."
+msgstr ""
+
+#: config/tc-tahoe.c:1187
+msgid "Operand can't be both pre-inc and post-dec."
+msgstr ""
+
+#: config/tc-tahoe.c:1217
+msgid "I parsed 2 registers in this operand."
+msgstr ""
+
+#: config/tc-tahoe.c:1267
+msgid "Can't relocate expression error."
+msgstr ""
+
+#. This is an error. Tahoe doesn't allow any expressions
+#. bigger that a 32 bit long word. Any bigger has to be referenced
+#. by address.
+#: config/tc-tahoe.c:1274
+msgid "Expression is too large for a 32 bits."
+msgstr ""
+
+#: config/tc-tahoe.c:1279
+msgid "Junk at end of expression."
+msgstr ""
+
+#: config/tc-tahoe.c:1319
+msgid "Syntax error in direct register mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1321
+msgid "You can't index a register in direct register mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1324
+msgid "SP can't be the source operand with direct register addressing."
+msgstr ""
+
+#: config/tc-tahoe.c:1326
+msgid "Can't take the address of a register."
+msgstr ""
+
+#: config/tc-tahoe.c:1328
+msgid "Direct Register can't be used in a branch."
+msgstr ""
+
+#: config/tc-tahoe.c:1330
+msgid "For quad access, the register must be even and < 14."
+msgstr ""
+
+#: config/tc-tahoe.c:1332
+msgid "You can't cast a direct register."
+msgstr ""
+
+#: config/tc-tahoe.c:1338
+msgid "Using reg 14 for quadwords can tromp the FP register."
+msgstr ""
+
+#: config/tc-tahoe.c:1350
+msgid "Syntax error in auto-dec mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1352
+msgid "You can't have an index auto dec mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1354
+msgid "Auto dec mode cant be used for reading."
+msgstr ""
+
+#: config/tc-tahoe.c:1356
+msgid "Auto dec only works of the SP register."
+msgstr ""
+
+#: config/tc-tahoe.c:1358
+msgid "Auto dec can't be used in a branch."
+msgstr ""
+
+#: config/tc-tahoe.c:1360
+msgid "Auto dec won't work with quadwords."
+msgstr ""
+
+#: config/tc-tahoe.c:1367
+msgid "Syntax error in one of the auto-inc modes."
+msgstr ""
+
+#: config/tc-tahoe.c:1373
+msgid "Auto inc deferred only works of the SP register."
+msgstr ""
+
+#: config/tc-tahoe.c:1375
+msgid "You can't have an index auto inc deferred mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1377 config/tc-tahoe.c:1388
+msgid "Auto inc can't be used in a branch."
+msgstr ""
+
+#: config/tc-tahoe.c:1384
+msgid "You can't write to an auto inc register."
+msgstr ""
+
+#: config/tc-tahoe.c:1386
+msgid "Auto inc only works of the SP register."
+msgstr ""
+
+#: config/tc-tahoe.c:1390
+msgid "Auto inc won't work with quadwords."
+msgstr ""
+
+#: config/tc-tahoe.c:1392
+msgid "You can't have an index in auto inc mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1400
+msgid "You can't index the sp register."
+msgstr ""
+
+#: config/tc-tahoe.c:1406
+msgid "Syntax error in register displaced mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1425
+msgid "An offest is needed for this operand."
+msgstr ""
+
+#: config/tc-tahoe.c:1437
+msgid "You can't index a register in immediate mode."
+msgstr ""
+
+#: config/tc-tahoe.c:1439
+msgid "Immediate access can't be used as an address."
+msgstr ""
+
+#: config/tc-tahoe.c:1550
+#, c-format
+msgid "Compiler bug: ODD number of bytes in arg structure %s."
+msgstr ""
+
+#: config/tc-tahoe.c:1577 config/tc-vax.c:1847
+msgid "Not enough operands"
+msgstr ""
+
+#: config/tc-tahoe.c:1587 config/tc-vax.c:1854
+msgid "Too many operands"
+msgstr ""
+
+#: config/tc-tahoe.c:1638 config/tc-vax.c:368
+#, c-format
+msgid "Ignoring statement due to \"%s\""
+msgstr ""
+
+#: config/tc-tahoe.c:1733
+#, c-format
+msgid "Compliler bug: Got a case (%d) I wasn't expecting."
+msgstr ""
+
+#: config/tc-tahoe.c:1827
+msgid "Real branch displacements must be expressions."
+msgstr ""
+
+#: config/tc-tahoe.c:1830
+#, c-format
+msgid "Complier error: I got an unknown synthetic branch :%c"
+msgstr ""
+
+#: config/tc-tahoe.c:1971
+#, c-format
+msgid "Barf, bad mode %x\n"
+msgstr ""
+
+#: config/tc-tic80.c:90
+msgid "Relaxation is a luxury we can't afford"
+msgstr ""
+
+#: config/tc-tic80.c:141
+msgid "bad call to md_atof ()"
+msgstr ""
+
+#: config/tc-tic80.c:245
+msgid "':' not followed by 'm' or 's'"
+msgstr ""
+
+#: config/tc-tic80.c:259
+msgid "paren nesting"
+msgstr ""
+
+#: config/tc-tic80.c:274
+msgid "mismatched parenthesis"
+msgstr ""
+
+#: config/tc-tic80.c:467
+msgid "unhandled expression type"
+msgstr ""
+
+#: config/tc-tic80.c:682
+msgid "symbol reloc that is not PC relative or 32 bits"
+msgstr ""
+
+#: config/tc-tic80.c:705
+msgid "unhandled operand modifier"
+msgstr ""
+
+#: config/tc-tic80.c:746
+msgid "unhandled expression"
+msgstr ""
+
+#: config/tc-tic80.c:797
+#, c-format
+msgid "Invalid mnemonic: '%s'"
+msgstr ""
+
+#: config/tc-tic80.c:813
+#, c-format
+msgid "Invalid operands: '%s'"
+msgstr ""
+
+#: config/tc-tic80.c:890
+msgid "unhandled predefined symbol bits"
+msgstr ""
+
+#: config/tc-tic80.c:986
+#, c-format
+msgid "PC offset 0x%lx outside range 0x%lx-0x%lx"
+msgstr ""
+
+#: config/tc-tic80.c:1001
+msgid "unhandled relocation type in fixup"
+msgstr ""
+
+#: config/tc-tic80.c:1038
+msgid "md_convert_frag() not implemented yet"
+msgstr ""
+
+#: config/tc-v850.c:273
+#, c-format
+msgid ".COMMon length (%d.) < 0! Ignored."
+msgstr ""
+
+#: config/tc-v850.c:1000
+#, c-format
+msgid "unknown operand shift: %x\n"
+msgstr ""
+
+#: config/tc-v850.c:1001
+msgid "internal failure in parse_register_list"
+msgstr ""
+
+#: config/tc-v850.c:1019
+msgid "constant expression or register list expected"
+msgstr ""
+
+#: config/tc-v850.c:1024 config/tc-v850.c:1037 config/tc-v850.c:1056
+msgid "high bits set in register list expression"
+msgstr ""
+
+#: config/tc-v850.c:1096 config/tc-v850.c:1160
+msgid "illegal register included in list"
+msgstr ""
+
+#: config/tc-v850.c:1103
+msgid "system registers cannot be included in list"
+msgstr ""
+
+#: config/tc-v850.c:1108
+msgid "PSW cannot be included in list"
+msgstr ""
+
+#: config/tc-v850.c:1115
+msgid "High value system registers cannot be included in list"
+msgstr ""
+
+#: config/tc-v850.c:1139
+msgid "second register should follow dash in register list"
+msgstr ""
+
+#: config/tc-v850.c:1187
+msgid " V850 options:\n"
+msgstr ""
+
+#: config/tc-v850.c:1188
+msgid "  -mwarn-signed-overflow    Warn if signed immediate values overflow\n"
+msgstr ""
+
+#: config/tc-v850.c:1189
+msgid ""
+"  -mwarn-unsigned-overflow  Warn if unsigned immediate values overflow\n"
+msgstr ""
+
+#: config/tc-v850.c:1190
+msgid "  -mv850                    The code is targeted at the v850\n"
+msgstr ""
+
+#: config/tc-v850.c:1191
+msgid "  -mv850e                   The code is targeted at the v850e\n"
+msgstr ""
+
+#: config/tc-v850.c:1192
+msgid "  -mv850ea                  The code is targeted at the v850ea\n"
+msgstr ""
+
+#: config/tc-v850.c:1193
+msgid ""
+"  -mv850any                 The code is generic, despite any processor "
+"specific instructions\n"
+msgstr ""
+
+#: config/tc-v850.c:1204 config/tc-v850.c:1239
+#, c-format
+msgid "unknown command line option: -%c%s\n"
+msgstr ""
+
+#: config/tc-v850.c:1393
+#, c-format
+msgid "Unable to determine default target processor from string: %s"
+msgstr ""
+
+#: config/tc-v850.c:1442
+msgid "ctoff() relocation used on an instruction which does not support it"
+msgstr ""
+
+#: config/tc-v850.c:1459
+msgid "sdaoff() relocation used on an instruction which does not support it"
+msgstr ""
+
+#: config/tc-v850.c:1476
+msgid "zdaoff() relocation used on an instruction which does not support it"
+msgstr ""
+
+#: config/tc-v850.c:1494
+msgid "tdaoff() relocation used on an instruction which does not support it"
+msgstr ""
+
+#: config/tc-v850.c:1712
+msgid "Target processor does not support this instruction."
+msgstr ""
+
+#: config/tc-v850.c:1802 config/tc-v850.c:1832 config/tc-v850.c:2018
+msgid "immediate operand is too large"
+msgstr ""
+
+#: config/tc-v850.c:1814
+msgid "AAARG -> unhandled constant reloc"
+msgstr ""
+
+#: config/tc-v850.c:1858
+msgid "invalid register name"
+msgstr ""
+
+#: config/tc-v850.c:1863
+msgid "register r0 cannot be used here"
+msgstr ""
+
+#: config/tc-v850.c:1875
+msgid "invalid system register name"
+msgstr ""
+
+#: config/tc-v850.c:1888
+msgid "expected EP register"
+msgstr ""
+
+#: config/tc-v850.c:1904
+msgid "invalid condition code name"
+msgstr ""
+
+#: config/tc-v850.c:1925 config/tc-v850.c:1929
+msgid "constant too big to fit into instruction"
+msgstr ""
+
+#: config/tc-v850.c:1981
+msgid "syntax error: value is missing before the register name"
+msgstr ""
+
+#: config/tc-v850.c:1983
+msgid "syntax error: register not expected"
+msgstr ""
+
+#: config/tc-v850.c:1997
+msgid "syntax error: system register not expected"
+msgstr ""
+
+#: config/tc-v850.c:2002
+msgid "syntax error: condition code not expected"
+msgstr ""
+
+#: config/tc-v850.c:2038
+msgid "invalid operand"
+msgstr ""
+
+#: config/tc-vax.c:263
+#, c-format
+msgid "VIP_BEGIN error:%s"
+msgstr ""
+
+#: config/tc-vax.c:387
+#, c-format
+msgid "Ignoring statement because \"%s\""
+msgstr ""
+
+#: config/tc-vax.c:434
+msgid "Can't relocate expression"
+msgstr ""
+
+#: config/tc-vax.c:537
+msgid "Bignum not permitted in short literal. Immediate mode assumed."
+msgstr ""
+
+#: config/tc-vax.c:546
+msgid "Can't do flonum short literal: immediate mode used."
+msgstr ""
+
+#: config/tc-vax.c:591
+#, c-format
+msgid "A bignum/flonum may not be a displacement: 0x%lx used"
+msgstr ""
+
+#: config/tc-vax.c:913
+#, c-format
+msgid "Short literal overflow(%ld.), immediate mode assumed."
+msgstr ""
+
+#: config/tc-vax.c:922
+#, c-format
+msgid "Forced short literal to immediate mode. now_seg=%s to_seg=%s"
+msgstr ""
+
+#: config/tc-vax.c:981
+msgid "Length specification ignored. Address mode 9F used"
+msgstr ""
+
+#: config/tc-vax.c:1030
+msgid "Invalid operand:  immediate value used as base address."
+msgstr ""
+
+#: config/tc-vax.c:1032
+msgid "Invalid operand:  immediate value used as address."
+msgstr ""
+
+#: config/tc-vax.c:1826
+msgid "odd number of bytes in operand description"
+msgstr ""
+
+#: config/tc-vax.c:1842
+msgid "Bad operand"
+msgstr ""
+
+#: config/tc-vax.c:2399
+msgid "no '[' to match ']'"
+msgstr ""
+
+#: config/tc-vax.c:2417
+msgid "bad register in []"
+msgstr ""
+
+#: config/tc-vax.c:2419
+msgid "[PC] index banned"
+msgstr ""
+
+#: config/tc-vax.c:2454
+msgid "no '(' to match ')'"
+msgstr ""
+
+#: config/tc-vax.c:2589
+msgid "invalid branch operand"
+msgstr ""
+
+#: config/tc-vax.c:2618
+msgid "address prohibits @"
+msgstr ""
+
+#: config/tc-vax.c:2620
+msgid "address prohibits #"
+msgstr ""
+
+#: config/tc-vax.c:2624
+msgid "address prohibits -()"
+msgstr ""
+
+#: config/tc-vax.c:2626
+msgid "address prohibits ()+"
+msgstr ""
+
+#: config/tc-vax.c:2629
+msgid "address prohibits ()"
+msgstr ""
+
+#: config/tc-vax.c:2631
+msgid "address prohibits []"
+msgstr ""
+
+#: config/tc-vax.c:2633
+msgid "address prohibits register"
+msgstr ""
+
+#: config/tc-vax.c:2635
+msgid "address prohibits displacement length specifier"
+msgstr ""
+
+#: config/tc-vax.c:2665
+msgid "invalid operand of S^#"
+msgstr ""
+
+#: config/tc-vax.c:2682
+msgid "S^# needs expression"
+msgstr ""
+
+#: config/tc-vax.c:2689
+msgid "S^# may only read-access"
+msgstr ""
+
+#: config/tc-vax.c:2714
+msgid "invalid operand of -()"
+msgstr ""
+
+#: config/tc-vax.c:2720
+msgid "-(PC) unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:2722
+msgid "[]index same as -()register: unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:2758
+msgid "invalid operand of ()+"
+msgstr ""
+
+#: config/tc-vax.c:2764
+msgid "(PC)+ unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:2766
+msgid "[]index same as ()+register: unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:2791
+msgid "# conflicts length"
+msgstr ""
+
+#: config/tc-vax.c:2793
+msgid "# bars register"
+msgstr ""
+
+#: config/tc-vax.c:2815
+msgid "writing or modifying # is unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:2845
+msgid "length not needed"
+msgstr ""
+
+#: config/tc-vax.c:2852
+msgid "can't []index a register, because it has no address"
+msgstr ""
+
+#: config/tc-vax.c:2854
+msgid "a register has no address"
+msgstr ""
+
+#: config/tc-vax.c:2865
+msgid "PC part of operand unpredictable"
+msgstr ""
+
+#: config/tc-vax.c:3194
+msgid ""
+"VAX options:\n"
+"-d LENGTH\t\tignored\n"
+"-J\t\t\tignored\n"
+"-S\t\t\tignored\n"
+"-t FILE\t\t\tignored\n"
+"-T\t\t\tignored\n"
+"-V\t\t\tignored\n"
+msgstr ""
+
+#: config/tc-vax.c:3203
+msgid ""
+"VMS options:\n"
+"-+\t\t\thash encode names longer than 31 characters\n"
+"-1\t\t\t`const' handling compatible with gcc 1.x\n"
+"-H\t\t\tshow new symbol after hash truncation\n"
+"-h NUM\t\t\tdon't hash mixed-case names, and adjust case:\n"
+"\t\t\t0 = upper, 2 = lower, 3 = preserve case\n"
+"-v\"VERSION\"\t\tcode being assembled was produced by compiler \"VERSION\"\n"
+msgstr ""
+
+#: config/tc-w65.c:136
+msgid "need on or off."
+msgstr ""
+
+#: config/tc-w65.c:321 config/tc-w65.c:364
+msgid "syntax error after <exp"
+msgstr ""
+
+#: config/tc-z8k.c:290
+#, c-format
+msgid "register rr%d, out of range."
+msgstr ""
+
+#: config/tc-z8k.c:298
+#, c-format
+msgid "register rh%d, out of range."
+msgstr ""
+
+#: config/tc-z8k.c:306
+#, c-format
+msgid "register rl%d, out of range."
+msgstr ""
+
+#: config/tc-z8k.c:315
+#, c-format
+msgid "register rq%d, out of range."
+msgstr ""
+
+#: config/tc-z8k.c:323
+#, c-format
+msgid "register r%d, out of range."
+msgstr ""
+
+#: config/tc-z8k.c:374
+#, c-format
+msgid "expected %c"
+msgstr ""
+
+#: config/tc-z8k.c:390
+#, c-format
+msgid "register is wrong size for a word %s"
+msgstr ""
+
+#: config/tc-z8k.c:405
+#, c-format
+msgid "register is wrong size for address %s"
+msgstr ""
+
+#: config/tc-z8k.c:680
+msgid "Missing ) in ra(rb)"
+msgstr ""
+
+#: config/tc-z8k.c:947
+#, c-format
+msgid "operand %s0x%x out of range."
+msgstr ""
+
+#: config/tc-z8k.c:1086
+msgid "immediate must be 1 or 2"
+msgstr ""
+
+#: config/tc-z8k.c:1091
+msgid "immediate 1 or 2 expected"
+msgstr ""
+
+#: config/tc-z8k.c:1119
+msgid "can't use R0 here"
+msgstr ""
+
+#: config/tc-z8k.c:1278
+msgid "Can't find opcode to match operands"
+msgstr ""
+
+#: config/tc-z8k.c:1390
+#, c-format
+msgid "invalid architecture -z%s"
+msgstr ""
+
+#: config/tc-z8k.c:1406
+msgid ""
+"Z8K options:\n"
+"-z8001\t\t\tgenerate segmented code\n"
+"-z8002\t\t\tgenerate unsegmented code\n"
+msgstr ""
+
+#: config/tc-z8k.c:1543
+#, c-format
+msgid "Can't subtract symbols in different sections %s %s"
+msgstr ""
+
+#: depend.c:195
+#, c-format
+msgid "Can't open `%s' for writing"
+msgstr ""
+
+#: depend.c:207
+#, c-format
+msgid "Can't close `%s'"
+msgstr ""
+
+#: ecoff.c:1577
+#, c-format
+msgid "String too big (%lu bytes)"
+msgstr ""
+
+#: ecoff.c:1603
+#, c-format
+msgid "Inserting \"%s\" into string hash table: %s"
+msgstr ""
+
+#: ecoff.c:1635 ecoff.c:1828 ecoff.c:1854 ecoff.c:1886 ecoff.c:2042
+#: ecoff.c:2156
+msgid "no current file pointer"
+msgstr ""
+
+#: ecoff.c:1722
+msgid "too many st_End's"
+msgstr ""
+
+#: ecoff.c:2068
+#, c-format
+msgid "Inserting \"%s\" into tag hash table: %s"
+msgstr ""
+
+#: ecoff.c:2234
+msgid "fake .file after real one"
+msgstr ""
+
+#: ecoff.c:2322
+msgid "Filename goes over one page boundary."
+msgstr ""
+
+#: ecoff.c:2457
+msgid ".begin directive without a preceding .file directive"
+msgstr ""
+
+#: ecoff.c:2464
+msgid ".begin directive without a preceding .ent directive"
+msgstr ""
+
+#: ecoff.c:2496
+msgid ".bend directive without a preceding .file directive"
+msgstr ""
+
+#: ecoff.c:2503
+msgid ".bend directive without a preceding .ent directive"
+msgstr ""
+
+#: ecoff.c:2516
+msgid ".bend directive names unknown symbol"
+msgstr ""
+
+#: ecoff.c:2560
+msgid ".def pseudo-op used inside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2562
+msgid "Empty symbol name in .def; ignored"
+msgstr ""
+
+#: ecoff.c:2600
+msgid ".dim pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2615
+msgid "Badly formed .dim directive"
+msgstr ""
+
+#: ecoff.c:2628
+msgid "Too many .dim entries"
+msgstr ""
+
+#: ecoff.c:2649
+msgid ".scl pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2675
+msgid ".size pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2690
+msgid "Badly formed .size directive"
+msgstr ""
+
+#: ecoff.c:2703
+msgid "Too many .size entries"
+msgstr ""
+
+#: ecoff.c:2726
+msgid ".type pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#. FIXME: We could handle this by setting the continued bit.
+#. There would still be a limit: the .type argument can not
+#. be infinite.
+#: ecoff.c:2744
+#, c-format
+msgid "The type of %s is too complex; it will be simplified"
+msgstr ""
+
+#: ecoff.c:2755
+msgid "Unrecognized .type argument"
+msgstr ""
+
+#: ecoff.c:2794
+msgid ".tag pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2821
+msgid ".val pseudo-op used outside of .def/.endef; ignored"
+msgstr ""
+
+#: ecoff.c:2829
+msgid ".val expression is too copmlex"
+msgstr ""
+
+#: ecoff.c:2860
+msgid ".endef pseudo-op used before .def; ignored"
+msgstr ""
+
+#: ecoff.c:2886
+msgid "Bad COFF debugging info"
+msgstr ""
+
+#: ecoff.c:2935
+#, c-format
+msgid "No tag specified for %s"
+msgstr ""
+
+#: ecoff.c:2967
+msgid "Bad COFF debugging information"
+msgstr ""
+
+#: ecoff.c:3039
+msgid ".end directive without a preceding .file directive"
+msgstr ""
+
+#: ecoff.c:3046
+msgid ".end directive without a preceding .ent directive"
+msgstr ""
+
+#: ecoff.c:3069
+msgid ".end directive names unknown symbol"
+msgstr ""
+
+#: ecoff.c:3098
+msgid "second .ent directive found before .end directive"
+msgstr ""
+
+#: ecoff.c:3173
+msgid "No way to handle .file within .ent/.end section"
+msgstr ""
+
+#: ecoff.c:3198
+msgid ".fmask outside of .ent"
+msgstr ""
+
+#: ecoff.c:3267
+msgid ".mask outside of .ent"
+msgstr ""
+
+#: ecoff.c:3297
+msgid ".loc before .file"
+msgstr ""
+
+#: ecoff.c:3423
+#, c-format
+msgid "Ignoring attempt to redefine symbol `%s'."
+msgstr ""
+
+#: ecoff.c:3436
+msgid "bad .weakext directive"
+msgstr ""
+
+#: ecoff.c:3505
+#, c-format
+msgid ".stab%c is not supported"
+msgstr ""
+
+#: ecoff.c:3515
+#, c-format
+msgid ".stab%c: ignoring non-zero other field"
+msgstr ""
+
+#: ecoff.c:3549
+#, c-format
+msgid ""
+"Line number (%d) for .stab%c directive cannot fit in index field (20 bits)"
+msgstr ""
+
+#: ecoff.c:3585
+#, c-format
+msgid "Illegal .stab%c directive, bad character"
+msgstr ""
+
+#: ecoff.c:4047 ecoff.c:4236 ecoff.c:4261
+msgid ".begin/.bend in different segments"
+msgstr ""
+
+#: ecoff.c:4762
+msgid "Missing .end or .bend at end of file"
+msgstr ""
+
+#: ecoff.c:5253
+msgid "GP prologue size exceeds field size, using 0 instead"
+msgstr ""
+
+#: expr.c:250
+msgid ""
+"bad floating-point constant: exponent overflow, probably assembling junk"
+msgstr ""
+
+#: expr.c:254
+#, c-format
+msgid "bad floating-point constant: unknown error code=%d."
+msgstr ""
+
+#: expr.c:434
+msgid ""
+"A bignum with underscores may not have more than 8 hex digits in any word."
+msgstr ""
+
+#: expr.c:454
+msgid "A bignum with underscores must have exactly 4 words."
+msgstr ""
+
+#. either not seen or not defined.
+#. @@ Should print out the original string instead of
+#. the parsed number.
+#: expr.c:583
+#, c-format
+msgid "backw. ref to unknown label \"%d:\", 0 assumed."
+msgstr ""
+
+#: expr.c:707
+msgid "Character constant too large"
+msgstr ""
+
+#: expr.c:946
+#, c-format
+msgid "expr.c(operand): bad atof_generic return val %d"
+msgstr ""
+
+#: expr.c:1006
+msgid "Missing ')' assumed"
+msgstr ""
+
+#: expr.c:1017 read.c:3857
+msgid "EBCDIC constants are not supported"
+msgstr ""
+
+#: expr.c:1087
+#, c-format
+msgid "Unary operator %c ignored because bad operand follows"
+msgstr ""
+
+#: expr.c:1133 expr.c:1158
+msgid "syntax error in .startof. or .sizeof."
+msgstr ""
+
+#: expr.c:1311
+msgid "Bad expression"
+msgstr ""
+
+#: expr.c:1676
+msgid "missing operand; zero assumed"
+msgstr ""
+
+#: expr.c:1709
+msgid "operation combines symbols in different segments"
+msgstr ""
+
+#: expr.c:1725
+msgid "left operand is a bignum; integer 0 assumed"
+msgstr ""
+
+#: expr.c:1727
+msgid "left operand is a float; integer 0 assumed"
+msgstr ""
+
+#: expr.c:1736
+msgid "right operand is a bignum; integer 0 assumed"
+msgstr ""
+
+#: expr.c:1738
+msgid "right operand is a float; integer 0 assumed"
+msgstr ""
+
+#: expr.c:1786 symbols.c:1109
+msgid "division by zero"
+msgstr ""
+
+#: frags.c:85
+#, c-format
+msgid "Can't extend frag %d. chars"
+msgstr ""
+
+#: frags.c:170
+msgid "attempt to allocate data in absolute section"
+msgstr ""
+
+#: frags.c:176
+msgid "attempt to allocate data in common section"
+msgstr ""
+
+#: gasp.c:485
+msgid "redefinition not allowed\n"
+msgstr ""
+
+#: gasp.c:559
+#, c-format
+msgid "the %c operator cannot take non-absolute arguments.\n"
+msgstr ""
+
+#: gasp.c:636
+msgid "string where expression expected.\n"
+msgstr ""
+
+#: gasp.c:642
+msgid "can't find primary in expression.\n"
+msgstr ""
+
+#: gasp.c:682
+msgid "misplaced closing parens.\n"
+msgstr ""
+
+#: gasp.c:719
+msgid "attempt to divide by zero.\n"
+msgstr ""
+
+#: gasp.c:751
+msgid "can't add two relocatable expressions\n"
+msgstr ""
+
+#: gasp.c:956
+msgid "unreasonable nesting.\n"
+msgstr ""
+
+#: gasp.c:1034
+msgid "End of file not at start of line.\n"
+msgstr ""
+
+#: gasp.c:1155
+#, c-format
+msgid "Illegal base character %c.\n"
+msgstr ""
+
+#: gasp.c:1270
+#, c-format
+msgid "radix is %c must be one of b, q, d or h"
+msgstr ""
+
+#: gasp.c:1306
+#, c-format
+msgid "size must be one of b, w or l, is %c.\n"
+msgstr ""
+
+#: gasp.c:1414
+msgid "datab repeat must be constant.\n"
+msgstr ""
+
+#: gasp.c:1416
+msgid "datab data must be absolute.\n"
+msgstr ""
+
+#: gasp.c:1430
+msgid "align needs absolute expression.\n"
+msgstr ""
+
+#: gasp.c:1437
+msgid ".align needs absolute fill value.\n"
+msgstr ""
+
+#: gasp.c:1445
+msgid "alignment must be one of 1, 2 or 4.\n"
+msgstr ""
+
+#: gasp.c:1470
+msgid "res needs absolute expression for fill count.\n"
+msgstr ""
+
+#: gasp.c:1550
+msgid "form LIN= needs absolute expresssion.\n"
+msgstr ""
+
+#: gasp.c:1553
+msgid "COL="
+msgstr ""
+
+#: gasp.c:1556
+msgid "form COL= needs absolute expresssion.\n"
+msgstr ""
+
+#. Turns the next expression into a string
+#: gasp.c:1598 macro.c:402
+#, c-format
+msgid "% operator needs absolute expression"
+msgstr ""
+
+#: gasp.c:1660
+msgid "misplaced ( .\n"
+msgstr ""
+
+#: gasp.c:1675
+msgid "misplaced ).\n"
+msgstr ""
+
+#: gasp.c:1729
+msgid ".instr needs absolute expresson.\n"
+msgstr ""
+
+#: gasp.c:1767
+msgid "need absolute position.\n"
+msgstr ""
+
+#: gasp.c:1769
+msgid "need absolute length.\n"
+msgstr ""
+
+#: gasp.c:2018
+msgid "END missing from end of file.\n"
+msgstr ""
+
+#: gasp.c:2048
+msgid ".ASSIGNA needs constant expression argument.\n"
+msgstr ""
+
+#: gasp.c:2052
+msgid ".ASSIGNA without label.\n"
+msgstr ""
+
+#: gasp.c:2077
+msgid ".ASSIGNS without label.\n"
+msgstr ""
+
+#: gasp.c:2144
+#, c-format
+msgid "Can't find preprocessor variable %s.\n"
+msgstr ""
+
+#: gasp.c:2209
+msgid "Comparison operator must be one of EQ, NE, LT, LE, GT or GE.\n"
+msgstr ""
+
+#: gasp.c:2243
+msgid "Comparison operator for strings must be EQ or NE\n"
+msgstr ""
+
+#: gasp.c:2255 gasp.c:2265 gasp.c:2367
+msgid "Conditional operator must have absolute operands.\n"
+msgstr ""
+
+#: gasp.c:2260
+msgid "String compared against expression.\n"
+msgstr ""
+
+#: gasp.c:2310
+msgid "AIF nesting unreasonable.\n"
+msgstr ""
+
+#: gasp.c:2325
+msgid "Multiple AELSEs in AIF.\n"
+msgstr ""
+
+#: gasp.c:2341
+msgid "AENDI without AIF.\n"
+msgstr ""
+
+#: gasp.c:2364 gasp.c:2446
+msgid "IF nesting unreasonable.\n"
+msgstr ""
+
+#: gasp.c:2456
+msgid "Bad format for IF or IFNC.\n"
+msgstr ""
+
+#: gasp.c:2476
+msgid "AENDR without a AREPEAT.\n"
+msgstr ""
+
+#: gasp.c:2478
+msgid "ENDR without a REPT.\n"
+msgstr ""
+
+#: gasp.c:2501
+#, c-format
+msgid "AWHILE without a AENDW at %d.\n"
+msgstr ""
+
+#: gasp.c:2539
+msgid "AENDW without a AENDW.\n"
+msgstr ""
+
+#: gasp.c:2584
+msgid "AREPEAT must have absolute operand.\n"
+msgstr ""
+
+#: gasp.c:2590
+#, c-format
+msgid "AREPEAT without a AENDR at %d.\n"
+msgstr ""
+
+#: gasp.c:2632
+msgid ".ENDM without a matching .MACRO.\n"
+msgstr ""
+
+#: gasp.c:2666
+msgid "LOCAL outside of MACRO"
+msgstr ""
+
+#: gasp.c:2679
+#, c-format
+msgid "macro at line %d: %s\n"
+msgstr ""
+
+#: gasp.c:2702
+msgid "macro expansion"
+msgstr ""
+
+#: gasp.c:2754
+msgid "Character code in string must be absolute expression.\n"
+msgstr ""
+
+#: gasp.c:2759
+msgid "Missing > for character code.\n"
+msgstr ""
+
+#: gasp.c:2818
+#, c-format
+msgid "string for SDATAC longer than 255 characters (%d).\n"
+msgstr ""
+
+#: gasp.c:2846
+#, c-format
+msgid "illegal character in SDATA line (0x%x).\n"
+msgstr ""
+
+#: gasp.c:2867
+msgid "Must have absolute SDATAB repeat count.\n"
+msgstr ""
+
+#: gasp.c:2870
+#, c-format
+msgid "Must have positive SDATAB repeat count (%d).\n"
+msgstr ""
+
+#: gasp.c:2898
+#, c-format
+msgid "Unreasonable include depth (%ld).\n"
+msgstr ""
+
+#: gasp.c:2952
+#, c-format
+msgid "Can't open include file `%s'.\n"
+msgstr ""
+
+#: gasp.c:3026
+msgid "Unreasonable expansion (-u turns off check).\n"
+msgstr ""
+
+#. This one causes lots of pain when trying to preprocess
+#. ordinary code
+#: gasp.c:3247
+#, c-format
+msgid "Unrecognised pseudo op `%s'.\n"
+msgstr ""
+
+#: gasp.c:3314
+msgid "ORG command not allowed.\n"
+msgstr ""
+
+#: gasp.c:3531
+msgid "Invalid expression on command line.\n"
+msgstr ""
+
+#: gasp.c:3572
+#, c-format
+msgid ""
+"Usage: %s \n"
+"  [-a]      [--alternate]         enter alternate macro mode\n"
+"  [-c char] [--commentchar char]  change the comment character from !\n"
+"  [-d]      [--debug]             print some debugging info\n"
+"  [-h]      [--help]              print this message\n"
+"  [-M]      [--mri]               enter MRI compatibility mode\n"
+"  [-o out]  [--output out]        set the output file\n"
+"  [-p]      [--print]             print line numbers\n"
+msgstr ""
+
+#: gasp.c:3581
+msgid ""
+"  [-s]      [--copysource]        copy source through as comments \n"
+"  [-u]      [--unreasonable]      allow unreasonable nesting\n"
+"  [-v]      [--version]           print the program version\n"
+"  [-Dname=value]                  create preprocessor variable called name, "
+"with value\n"
+"  [-Ipath]                        add to include path list\n"
+"  [in-file]\n"
+msgstr ""
+
+#: gasp.c:3597
+#, c-format
+msgid "%s: Gnu Assembler Macro Preprocessor\n"
+msgstr ""
+
+#. This output is intended to follow the GNU standards document.
+#: gasp.c:3681
+#, c-format
+msgid "GNU assembler pre-processor %s\n"
+msgstr ""
+
+#: gasp.c:3682
+msgid "Copyright 1996 Free Software Foundation, Inc.\n"
+msgstr ""
+
+#: gasp.c:3704
+#, c-format
+msgid "%s: Can't open output file `%s'.\n"
+msgstr ""
+
+#: gasp.c:3727
+#, c-format
+msgid "%s: Can't open input file `%s'.\n"
+msgstr ""
+
+#: gasp.c:3746
+#, c-format
+msgid "Internal error, aborting at %s line %d"
+msgstr ""
+
+#: gasp.c:3749
+msgid ""
+"\n"
+"Please report this bug.\n"
+msgstr ""
+
+#. Detect if we are reading from stdin by examining the file
+#. name returned by as_where().
+#.
+#. [FIXME: We rely upon the name in the strcmp below being the
+#. same as the one used by input_scrub_new_file(), if that is
+#. not true, then this code will fail].
+#.
+#. If we are reading from stdin, then we need to save each input line
+#. here (assuming of course that we actually have a line of input to read),
+#. so that it can be displayed in the listing that is produced at the end
+#. of the assembly.
+#: input-file.c:150 input-scrub.c:233 listing.c:353
+msgid "{standard input}"
+msgstr ""
+
+#: input-file.c:154
+#, c-format
+msgid "Can't open %s for reading."
+msgstr ""
+
+#: input-file.c:205 input-file.c:234
+#, c-format
+msgid "Can't read from %s"
+msgstr ""
+
+#: input-file.c:242
+#, c-format
+msgid "Can't close %s"
+msgstr ""
+
+#: input-scrub.c:263
+msgid "macros nested too deeply"
+msgstr ""
+
+#: input-scrub.c:349
+msgid "partial line at end of file ignored"
+msgstr ""
+
+#: input-scrub.c:371
+msgid "Partial line at end of file ignored"
+msgstr ""
+
+#: itbl-ops.c:359
+msgid "Unable to allocate memory for new instructions\n"
+msgstr ""
+
+#: listing.c:252
+msgid "Warning:"
+msgstr ""
+
+#: listing.c:259
+msgid "Error:"
+msgstr ""
+
+#: listing.c:1145
+#, c-format
+msgid "can't open list file: %s"
+msgstr ""
+
+#: listing.c:1169
+#, c-format
+msgid "error closing list file: %s"
+msgstr ""
+
+#: listing.c:1250
+msgid "strange paper height, set to no form"
+msgstr ""
+
+#: listing.c:1316
+msgid "New line in title"
+msgstr ""
+
+#: macro.c:565
+msgid "unexpected end of file in macro definition"
+msgstr ""
+
+#: macro.c:574
+msgid "missing ) after formals"
+msgstr ""
+
+#: macro.c:731
+msgid "missplaced )"
+msgstr ""
+
+#: macro.c:993
+msgid "confusion in formal parameters"
+msgstr ""
+
+#: macro.c:998
+msgid "macro formal argument does not exist"
+msgstr ""
+
+#: macro.c:1013
+msgid "can't mix positional and keyword arguments"
+msgstr ""
+
+#: macro.c:1021
+msgid "too many positional arguments"
+msgstr ""
+
+#: macro.c:1196
+msgid "unexpected end of file in irp or irpc"
+msgstr ""
+
+#: macro.c:1204
+msgid "missing model parameter"
+msgstr ""
+
+#: messages.c:105
+msgid "Assembler messages:\n"
+msgstr ""
+
+#: messages.c:222
+msgid "Warning: "
+msgstr ""
+
+#: messages.c:331
+msgid "Error: "
+msgstr ""
+
+#: messages.c:435 messages.c:452
+msgid "Fatal error: "
+msgstr ""
+
+#: messages.c:471
+msgid "Internal error!\n"
+msgstr ""
+
+#: messages.c:473
+#, c-format
+msgid "Assertion failure in %s at %s line %d.\n"
+msgstr ""
+
+#: messages.c:476
+#, c-format
+msgid "Assertion failure at %s line %d.\n"
+msgstr ""
+
+#: messages.c:477 messages.c:495
+msgid "Please report this bug.\n"
+msgstr ""
+
+#: messages.c:490
+#, c-format
+msgid "Internal error, aborting at %s line %d in %s\n"
+msgstr ""
+
+#: messages.c:493
+#, c-format
+msgid "Internal error, aborting at %s line %d\n"
+msgstr ""
+
+#: output-file.c:48
+#, c-format
+msgid "Can't open a bfd on stdout %s "
+msgstr ""
+
+#: output-file.c:72 output-file.c:79
+#, c-format
+msgid "FATAL: Can't close %s\n"
+msgstr ""
+
+#: output-file.c:130
+#, c-format
+msgid "FATAL: Can't close %s"
+msgstr ""
+
+#: output-file.c:148
+msgid "Failed to emit an object byte"
+msgstr ""
+
+#: output-file.c:149
+msgid "Can't continue"
+msgstr ""
+
+#: read.c:439
+#, c-format
+msgid "error constructing %s pseudo-op table: %s"
+msgstr ""
+
+#: read.c:804
+#, c-format
+msgid "Unknown pseudo-op:  `%s'"
+msgstr ""
+
+#: read.c:933
+#, c-format
+msgid "label \"%d$\" redefined"
+msgstr ""
+
+#: read.c:1150
+msgid ".abort detected.  Abandoning ship."
+msgstr ""
+
+#: read.c:1241 read.c:2024
+msgid "Alignment not a power of 2"
+msgstr ""
+
+#: read.c:1249
+#, c-format
+msgid "Alignment too large: %u assumed"
+msgstr ""
+
+#: read.c:1281
+msgid "expected fill pattern missing"
+msgstr ""
+
+#: read.c:1478
+#, c-format
+msgid "attempt to re-define symbol `%s'"
+msgstr ""
+
+#. Some of the back ends can't deal with non-positive line numbers.
+#. Besides, it's silly.
+#: read.c:1602
+#, c-format
+msgid "Line numbers must be positive; line number %d rejected."
+msgstr ""
+
+#: read.c:1629
+msgid "start address not supported"
+msgstr ""
+
+#: read.c:1639
+msgid ".err encountered"
+msgstr ""
+
+#: read.c:1658 read.c:1660
+#, c-format
+msgid ".fail %ld encountered"
+msgstr ""
+
+#: read.c:1697
+#, c-format
+msgid ".fill size clamped to %d."
+msgstr ""
+
+#: read.c:1702
+msgid "Size negative: .fill ignored."
+msgstr ""
+
+#: read.c:1708
+msgid "Repeat < 0, .fill ignored"
+msgstr ""
+
+#: read.c:1866
+#, c-format
+msgid "unrecognized .linkonce type `%s'"
+msgstr ""
+
+#: read.c:1879 read.c:1905
+msgid ".linkonce is not supported for this object file format"
+msgstr ""
+
+#: read.c:1901
+#, c-format
+msgid "bfd_set_section_flags: %s"
+msgstr ""
+
+#: read.c:1970
+#, c-format
+msgid "error setting flags for \".sbss\": %s"
+msgstr ""
+
+#: read.c:2002
+msgid "Expected comma after size"
+msgstr ""
+
+#: read.c:2010
+msgid "Missing alignment"
+msgstr ""
+
+#: read.c:2152
+msgid "bad expression"
+msgstr ""
+
+#: read.c:2283
+#, c-format
+msgid "attempt to redefine pseudo-op `%s' ignored"
+msgstr ""
+
+#: read.c:2349
+#, c-format
+msgid "invalid segment \"%s\"; segment \"%s\" assumed"
+msgstr ""
+
+#: read.c:2355
+msgid "ignoring fill value in absolute section"
+msgstr ""
+
+#: read.c:2358
+msgid "only constant offsets supported in absolute section"
+msgstr ""
+
+#: read.c:2390
+msgid "MRI style ORG pseudo-op not supported"
+msgstr ""
+
+#: read.c:2478
+msgid "unrecognized section type"
+msgstr ""
+
+#: read.c:2546
+#, c-format
+msgid "unrecognized section type `%s'"
+msgstr ""
+
+#: read.c:2560
+msgid "absolute sections are not supported"
+msgstr ""
+
+#: read.c:2575
+#, c-format
+msgid "unrecognized section command `%s'"
+msgstr ""
+
+#: read.c:2663
+#, c-format
+msgid "%s without %s"
+msgstr ""
+
+#: read.c:2867
+msgid "Unsupported variable size or fill value"
+msgstr ""
+
+#: read.c:2892
+msgid ".space repeat count is zero, ignored"
+msgstr ""
+
+#: read.c:2894
+msgid ".space repeat count is negative, ignored"
+msgstr ""
+
+#: read.c:2923
+msgid "space allocation too complex in absolute section"
+msgstr ""
+
+#: read.c:2928
+msgid "space allocation too complex in common section"
+msgstr ""
+
+#: read.c:3015 read.c:4104
+#, c-format
+msgid "Bad floating literal: %s"
+msgstr ""
+
+#: read.c:3091
+#, c-format
+msgid "Rest of line ignored. First ignored character is `%c'."
+msgstr ""
+
+#: read.c:3094
+#, c-format
+msgid "Rest of line ignored. First ignored character valued 0x%x."
+msgstr ""
+
+#: read.c:3145
+msgid "illegal expression; zero assumed"
+msgstr ""
+
+#: read.c:3147
+msgid "missing expression; zero assumed"
+msgstr ""
+
+#: read.c:3320
+msgid "rva without symbol"
+msgstr ""
+
+#: read.c:3445
+msgid "attempt to store value in absolute section"
+msgstr ""
+
+#: read.c:3483 read.c:4381
+msgid "zero assumed for missing expression"
+msgstr ""
+
+#: read.c:3495 read.c:4393
+msgid "register value used as expression"
+msgstr ""
+
+#. Leading bits contain both 0s & 1s.
+#: read.c:3585
+#, c-format
+msgid "Value 0x%lx truncated to 0x%lx."
+msgstr ""
+
+#: read.c:3601
+#, c-format
+msgid "Bignum truncated to %d bytes"
+msgstr ""
+
+#: read.c:3678
+#, c-format
+msgid "unsupported BFD relocation size %u"
+msgstr ""
+
+#: read.c:3767
+msgid "using a bit field width of zero"
+msgstr ""
+
+#: read.c:3775
+#, c-format
+msgid "field width \"%s\" too complex for a bitfield"
+msgstr ""
+
+#: read.c:3783
+#, c-format
+msgid "field width %lu too big to fit in %d bytes: truncated to %d bits"
+msgstr ""
+
+#: read.c:3804
+#, c-format
+msgid "field value \"%s\" too complex for a bitfield"
+msgstr ""
+
+#: read.c:3928
+msgid "Unresolvable or nonpositive repeat count; using 1"
+msgstr ""
+
+#: read.c:3979
+#, c-format
+msgid "Unknown floating type type '%c'"
+msgstr ""
+
+#: read.c:4001
+msgid "Floating point constant too large"
+msgstr ""
+
+#: read.c:4126
+msgid "unresolvable or nonpositive repeat count; using 1"
+msgstr ""
+
+#: read.c:4530
+msgid "Expected <nn>"
+msgstr ""
+
+#. To be compatible with BSD 4.2 as: give the luser a linefeed!!
+#: read.c:4563 read.c:4646
+msgid "Unterminated string: Newline inserted."
+msgstr ""
+
+#: read.c:4654
+msgid "Bad escaped character in string, '?' assumed"
+msgstr ""
+
+#: read.c:4680
+msgid "expected address expression; zero assumed"
+msgstr ""
+
+#: read.c:4700
+#, c-format
+msgid "symbol \"%s\" undefined; zero assumed"
+msgstr ""
+
+#: read.c:4703
+msgid "some symbol undefined; zero assumed"
+msgstr ""
+
+#: read.c:4721
+msgid "bad or irreducible absolute expression; zero assumed"
+msgstr ""
+
+#: read.c:4759
+msgid "This string may not contain '\\0'"
+msgstr ""
+
+#: read.c:4798
+msgid "Missing string"
+msgstr ""
+
+#: read.c:5029
+msgid "missing .func"
+msgstr ""
+
+#: read.c:5046
+msgid ".endfunc missing for previous .func"
+msgstr ""
+
+#: stabs.c:209
+msgid ".stabs: Missing comma"
+msgstr ""
+
+#: stabs.c:217 stabs.c:225 stabs.c:236
+#, c-format
+msgid ".stab%c: Missing comma"
+msgstr ""
+
+#: stabs.c:415
+msgid "comma missing in .xstabs"
+msgstr ""
+
+#: subsegs.c:379
+#, c-format
+msgid "Attempt to switch to nonexistent segment \"%s\""
+msgstr ""
+
+#: symbols.c:365 symbols.c:467
+#, c-format
+msgid "Symbol %s already defined."
+msgstr ""
+
+#: symbols.c:453
+#, c-format
+msgid "Symbol \"%s\" is already defined as \"%s\"/%s%ld."
+msgstr ""
+
+#: symbols.c:536 symbols.c:543
+#, c-format
+msgid "Inserting \"%s\" into symbol table failed: %s"
+msgstr ""
+
+#: symbols.c:894
+#, c-format
+msgid "Symbol definition loop encountered at %s"
+msgstr ""
+
+#: symbols.c:1071 symbols.c:1075
+#, c-format
+msgid "undefined symbol %s in operation"
+msgstr ""
+
+#: symbols.c:1079
+msgid "invalid section for operation"
+msgstr ""
+
+#: symbols.c:1084 symbols.c:1088
+#, c-format
+msgid "undefined symbol %s in operation setting %s"
+msgstr ""
+
+#: symbols.c:1093
+#, c-format
+msgid "invalid section for operation setting %s"
+msgstr ""
+
+#: symbols.c:1111
+#, c-format
+msgid "division by zero when setting %s"
+msgstr ""
+
+#: symbols.c:1183 write.c:1881
+#, c-format
+msgid "can't resolve value for symbol \"%s\""
+msgstr ""
+
+#: symbols.c:1556
+#, c-format
+msgid "\"%d\" (instance number %d of a %s label)"
+msgstr ""
+
+#: symbols.c:1606
+#, c-format
+msgid "Attempt to get value of unresolved symbol %s"
+msgstr ""
+
+#: write.c:169
+#, c-format
+msgid "field fx_size too small to hold %d"
+msgstr ""
+
+#: write.c:306
+msgid "rva not supported"
+msgstr ""
+
+#: write.c:502
+#, c-format
+msgid "attempt to .org/.space backwards? (%ld)"
+msgstr ""
+
+#: write.c:974
+msgid "relocation out of range"
+msgstr ""
+
+#: write.c:977
+#, c-format
+msgid "%s:%u: bad return from bfd_install_relocation: %x"
+msgstr ""
+
+#: write.c:1022
+msgid "internal error: fixup not contained within frag"
+msgstr ""
+
+#: write.c:1038
+#, c-format
+msgid "%s:%u: bad return from bfd_install_relocation"
+msgstr ""
+
+#: write.c:1125 write.c:1149
+#, c-format
+msgid "FATAL: Can't write %s"
+msgstr ""
+
+#: write.c:1180
+msgid "Cannot write to output file."
+msgstr ""
+
+#: write.c:1412
+#, c-format
+msgid "%d error%s, %d warning%s, generating bad object file.\n"
+msgstr ""
+
+#: write.c:1419
+#, c-format
+msgid "%d error%s, %d warning%s, no object file generated.\n"
+msgstr ""
+
+#: write.c:1818
+#, c-format
+msgid "local label %s is not defined"
+msgstr ""
+
+#: write.c:2123
+#, c-format
+msgid "alignment padding (%lu bytes) not a multiple of %ld"
+msgstr ""
+
+#: write.c:2229
+#, c-format
+msgid ".word %s-%s+%s didn't fit"
+msgstr ""
+
+#: write.c:2309
+msgid "attempt to .org backwards ignored"
+msgstr ""
+
+#: write.c:2332
+msgid ".space specifies non-absolute value"
+msgstr ""
+
+#: write.c:2336
+msgid ".space or .fill with negative value, ignored"
+msgstr ""
+
+#: write.c:2587
+#, c-format
+msgid ""
+"Subtraction of two symbols in different sections \"%s\" {%s section} - "
+"\"%s\" {%s section} at file address %s."
+msgstr ""
+
+#: write.c:2752
+#, c-format
+msgid "Value of %s too large for field of %d bytes at %s"
+msgstr ""
diff --git a/gas/read.c b/gas/read.c
index 7fee241..1522842 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1,6 +1,6 @@
 /* read.c - read a source file -
-   Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
-   Free Software Foundation, Inc.
+   Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+   2000 Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
 
@@ -53,6 +53,21 @@
 #define TC_START_LABEL(x,y) (x==':')
 #endif
 
+/* Set by the object-format or the target.  */
+#ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
+#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR)        \
+ do {                                                   \
+  if ((SIZE) >= 8)                                      \
+    (P2VAR) = 3;                                        \
+  else if ((SIZE) >= 4)                                 \
+    (P2VAR) = 2;                                        \
+  else if ((SIZE) >= 2)                                 \
+    (P2VAR) = 1;                                        \
+  else                                                  \
+    (P2VAR) = 0;                                        \
+ } while (0)
+#endif
+
 /* The NOP_OPCODE is for the alignment fill value.
  * fill it a nop instruction so that the disassembler does not choke
  * on it
@@ -89,6 +104,10 @@
 #define LEX_QM 0
 #endif
 
+#ifndef LEX_HASH
+#define LEX_HASH 0
+#endif
+
 #ifndef LEX_DOLLAR
 /* The a29k assembler does not permits labels to start with $.  */
 #define LEX_DOLLAR 3
@@ -104,7 +123,7 @@
 {
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* @ABCDEFGHIJKLMNO */
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* PQRSTUVWXYZ[\]^_ */
-  0, 0, 0, 0, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
+  0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM,	/* 0123456789:;<=>? */
   LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,	/* @ABCDEFGHIJKLMNO */
   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
@@ -208,10 +227,18 @@
 #endif
 
 static void cons_worker PARAMS ((int, int));
-static int scrub_from_string PARAMS ((char **));
+static int scrub_from_string PARAMS ((char *, int));
 static void do_align PARAMS ((int, char *, int, int));
 static void s_align PARAMS ((int, int));
+static void s_lcomm_internal PARAMS ((int, int));
 static int hex_float PARAMS ((int, char *));
+static inline int sizeof_sleb128 PARAMS ((offsetT));
+static inline int sizeof_uleb128 PARAMS ((valueT));
+static inline int output_sleb128 PARAMS ((char *, offsetT));
+static inline int output_uleb128 PARAMS ((char *, valueT));
+static inline int output_big_sleb128 PARAMS ((char *, LITTLENUM_TYPE *, int));
+static inline int output_big_uleb128 PARAMS ((char *, LITTLENUM_TYPE *, int));
+static int output_big_leb128 PARAMS ((char *, LITTLENUM_TYPE *, int, int));
 static void do_org PARAMS ((segT, expressionS *, int));
 char *demand_copy_string PARAMS ((int *lenP));
 static segT get_segmented_expression PARAMS ((expressionS *expP));
@@ -294,6 +321,7 @@
   {"eject", listing_eject, 0},	/* Formfeed listing */
   {"else", s_else, 0},
   {"elsec", s_else, 0},
+  {"elseif", s_elseif, (int) O_ne},
   {"end", s_end, 0},
   {"endc", s_endif, 0},
   {"endfunc", s_func, 1},
@@ -407,7 +435,7 @@
   {"xstabs", s_xstab, 's'},
   {"word", cons, 2},
   {"zero", s_space, 0},
-  {NULL}			/* end sentinel */
+  {NULL, NULL, 0}			/* end sentinel */
 };
 
 static int pop_override_ok = 0;
@@ -472,15 +500,18 @@
 static char *scrub_string_end;
 
 static int
-scrub_from_string (from)
-     char **from;
+scrub_from_string (buf, buflen)
+     char *buf;
+     int buflen;
 {
-  int size;
+  int copy;
 
-  *from = scrub_string;
-  size = scrub_string_end - scrub_string;
-  scrub_string = scrub_string_end;
-  return size;
+  copy = scrub_string_end - scrub_string;
+  if (copy > buflen)
+    copy = buflen;
+  memcpy (buf, scrub_string, copy);
+  scrub_string += copy;
+  return copy;
 }
 
 /*	read_a_source_file()
@@ -534,11 +565,7 @@
 
 	      line_label = NULL;
 
-	      if (flag_m68k_mri
-#ifdef LABELS_WITHOUT_COLONS
-		  || 1
-#endif
-		  )
+	      if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
 		{
 		  /* Text at the start of a line must be a label, we
 		     run down and stick a colon in.  */
@@ -583,7 +610,12 @@
 		      /* In MRI mode, we need to handle the MACRO
                          pseudo-op specially: we don't want to put the
                          symbol in the symbol table.  */
-		      if (! mri_line_macro)
+		      if (! mri_line_macro 
+#ifdef TC_START_LABEL_WITHOUT_COLON
+                          && TC_START_LABEL_WITHOUT_COLON(c, 
+                                                          input_line_pointer)
+#endif
+                          )
 			line_label = colon (line_start);
 		      else
 			line_label = symbol_create (line_start,
@@ -728,11 +760,7 @@
 		  }
 #endif
 
-		  if (flag_m68k_mri
-#ifdef NO_PSEUDO_DOT
-		      || 1
-#endif
-		      )
+		  if (NO_PSEUDO_DOT || flag_m68k_mri)
 		    {
 		      /* The MRI assembler and the m88k use pseudo-ops
                          without a period.  */
@@ -780,7 +808,7 @@
 			  mri_pending_align = 0;
 			  if (line_label != NULL)
 			    {
-			      line_label->sy_frag = frag_now;
+			      symbol_set_frag (line_label, frag_now);
 			      S_SET_VALUE (line_label, frag_now_fix ());
 			    }
 			}
@@ -815,6 +843,9 @@
 		  else
 		    {
 		      int inquote = 0;
+#ifdef QUOTES_IN_INSN
+		      int inescape = 0;
+#endif
 
 		      /* WARNING: c has char, which may be end-of-line. */
 		      /* Also: input_line_pointer->`\0` where c was. */
@@ -828,6 +859,14 @@
 			{
 			  if (flag_m68k_mri && *input_line_pointer == '\'')
 			    inquote = ! inquote;
+#ifdef QUOTES_IN_INSN
+			  if (inescape)
+			    inescape = 0;
+			  else if (*input_line_pointer == '"')
+			    inquote = ! inquote;
+			  else if (*input_line_pointer == '\\')
+			    inescape = 1;
+#endif
 			  input_line_pointer++;
 			}
 
@@ -840,17 +879,21 @@
 			{
 			  sb out;
 			  const char *err;
+                          macro_entry *macro;
 
-			  if (check_macro (s, &out, '\0', &err))
+			  if (check_macro (s, &out, '\0', &err, &macro))
 			    {
 			      if (err != NULL)
-				as_bad (err);
+				as_bad ("%s", err);
 			      *input_line_pointer++ = c;
 			      input_scrub_include_sb (&out,
-						      input_line_pointer);
+						      input_line_pointer, 1);
 			      sb_kill (&out);
 			      buffer_limit =
 				input_scrub_next_buffer (&input_line_pointer);
+#ifdef md_macro_info
+                              md_macro_info (macro);
+#endif
 			      continue;
 			    }
 			}
@@ -861,7 +904,7 @@
 			  mri_pending_align = 0;
 			  if (line_label != NULL)
 			    {
-			      line_label->sy_frag = frag_now;
+			      symbol_set_frag (line_label, frag_now);
 			      S_SET_VALUE (line_label, frag_now_fix ());
 			    }
 			}
@@ -1121,7 +1164,7 @@
 
 void 
 s_abort (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   as_fatal (_(".abort detected.  Abandoning ship."));
 }
@@ -1147,21 +1190,7 @@
 
   if (fill == NULL)
     {
-      int maybe_text;
-
-#ifdef BFD_ASSEMBLER
-      if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
-	maybe_text = 1;
-      else
-	maybe_text = 0;
-#else
-      if (now_seg != data_section && now_seg != bss_section)
-	maybe_text = 1;
-      else
-	maybe_text = 0;
-#endif
-
-      if (maybe_text)
+      if (subseg_text_p (now_seg))
 	default_fill = NOP_OPCODE;
       else
 	default_fill = 0;
@@ -1182,7 +1211,7 @@
  just_record_alignment:
 #endif
 
-  record_alignment (now_seg, n);
+  record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
 }
 
 /* Handle the .align pseudo-op.  A positive ARG is a default alignment
@@ -1325,7 +1354,7 @@
 
 void 
 s_comm (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register char *name;
   register char c;
@@ -1407,7 +1436,7 @@
 
 void
 s_mri_common (small)
-     int small;
+     int small ATTRIBUTE_UNUSED;
 {
   char *name;
   char c;
@@ -1481,10 +1510,12 @@
 
   if (line_label != NULL)
     {
-      line_label->sy_value.X_op = O_symbol;
-      line_label->sy_value.X_add_symbol = sym;
-      line_label->sy_value.X_add_number = S_GET_VALUE (sym);
-      line_label->sy_frag = &zero_address_frag;
+      expressionS exp;
+      exp.X_op = O_symbol;
+      exp.X_add_symbol = sym;
+      exp.X_add_number = 0;
+      symbol_set_value_expression (line_label, &exp);
+      symbol_set_frag (line_label, &zero_address_frag);
       S_SET_SEGMENT (line_label, expr_section);
     }
 
@@ -1504,7 +1535,7 @@
 
 void
 s_data (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   segT section;
   register int temp;
@@ -1578,7 +1609,7 @@
 
 void
 s_app_line (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int l;
 
@@ -1604,7 +1635,7 @@
 
 void
 s_end (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (flag_mri)
     {
@@ -1622,7 +1653,7 @@
 
 void
 s_err (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   as_bad (_(".err encountered"));
   demand_empty_rest_of_line ();
@@ -1632,7 +1663,7 @@
 
 void
 s_fail (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   offsetT temp;
   char *stop = NULL;
@@ -1655,7 +1686,7 @@
 
 void 
 s_fill (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   expressionS rep_exp;
   long size = 1;
@@ -1752,7 +1783,7 @@
 
 void 
 s_globl (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   int c;
@@ -1768,9 +1799,11 @@
       name = input_line_pointer;
       c = get_symbol_end ();
       symbolP = symbol_find_or_make (name);
+      S_SET_EXTERNAL (symbolP);
+
       *input_line_pointer = c;
       SKIP_WHITESPACE ();
-      S_SET_EXTERNAL (symbolP);
+      c = *input_line_pointer;
       if (c == ',')
 	{
 	  input_line_pointer++;
@@ -1813,7 +1846,7 @@
 
   sb_kill (&s);
 
-  input_scrub_include_sb (&out, input_line_pointer);
+  input_scrub_include_sb (&out, input_line_pointer, 1);
   sb_kill (&out);
   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
 }
@@ -1825,7 +1858,7 @@
 
 void
 s_linkonce (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   enum linkonce_type type;
 
@@ -1959,24 +1992,14 @@
 	}
     }
 #endif
+
    if (!needs_align)
      {
-       /* FIXME. This needs to be machine independent. */
-       if (temp >= 8)
-	 align = 3;
-       else if (temp >= 4)
-	 align = 2;
-       else if (temp >= 2)
-	 align = 1;
-       else
-	 align = 0;
+       TC_IMPLICIT_LCOMM_ALIGNMENT (temp, align);
 
-#ifdef OBJ_EVAX
-       /* FIXME: This needs to be done in a more general fashion.  */
-       align = 3;
-#endif
-
-       record_alignment(bss_seg, align);
+       /* Still zero unless TC_IMPLICIT_LCOMM_ALIGNMENT set it.  */
+       if (align)
+         record_alignment(bss_seg, align);
      }
 
   if (needs_align)
@@ -2041,12 +2064,17 @@
   *p = c;
 
   if (
-#if defined(OBJ_AOUT) | defined(OBJ_BOUT)
-       S_GET_OTHER (symbolP) == 0 &&
-       S_GET_DESC (symbolP) == 0 &&
-#endif /* OBJ_AOUT or OBJ_BOUT */
-       (S_GET_SEGMENT (symbolP) == bss_seg
-	|| (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
+#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT) \
+     || defined (OBJ_BOUT) || defined (OBJ_MAYBE_BOUT))
+#ifdef BFD_ASSEMBLER
+      (OUTPUT_FLAVOR != bfd_target_aout_flavour
+       || (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0)) &&
+#else
+      (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0) &&
+#endif
+#endif
+      (S_GET_SEGMENT (symbolP) == bss_seg
+       || (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
     {
       char *pfrag;
 
@@ -2056,9 +2084,9 @@
 	frag_align (align, 0, 0);
 					/* detach from old frag	*/
       if (S_GET_SEGMENT (symbolP) == bss_seg)
-	symbolP->sy_frag->fr_symbol = NULL;
+	symbol_get_frag (symbolP)->fr_symbol = NULL;
 
-      symbolP->sy_frag = frag_now;
+      symbol_set_frag (symbolP, frag_now);
       pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
 			(offsetT) temp, (char *) 0);
       *pfrag = 0;
@@ -2103,7 +2131,7 @@
 
 void 
 s_lsym (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register char *name;
   register char c;
@@ -2225,7 +2253,7 @@
 
 void
 s_macro (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *file;
   unsigned int line;
@@ -2253,14 +2281,10 @@
 	{
 	  S_SET_SEGMENT (line_label, undefined_section);
 	  S_SET_VALUE (line_label, 0);
-	  line_label->sy_frag = &zero_address_frag;
+	  symbol_set_frag (line_label, &zero_address_frag);
 	}
 
-      if (((flag_m68k_mri
-#ifdef NO_PSEUDO_DOT
-	    || 1
-#endif
-	    )
+      if (((NO_PSEUDO_DOT || flag_m68k_mri)
 	   && hash_find (po_hash, name) != NULL)
 	  || (! flag_m68k_mri
 	      && *name == '.'
@@ -2277,7 +2301,7 @@
 
 void
 s_mexit (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   cond_exit_macro (macro_nest);
   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
@@ -2287,7 +2311,7 @@
 
 void
 s_mri (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int on, old_flag;
 
@@ -2304,7 +2328,9 @@
   else
     {
       flag_mri = 0;
+#ifdef TC_M68K
       flag_m68k_mri = 0;
+#endif
       macro_mri_mode (0);
     }
 
@@ -2348,14 +2374,14 @@
       char *p;
 
       p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
-		    exp->X_add_number, (char *) NULL);
+		    exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
       *p = fill;
     }
 }
 
 void 
 s_org (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register segT segment;
   expressionS exp;
@@ -2411,7 +2437,7 @@
 
 void
 s_mri_sect (type)
-     char *type;
+     char *type ATTRIBUTE_UNUSED;
 {
 #ifdef TC_M68K
 
@@ -2575,7 +2601,7 @@
 
 void
 s_print (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *s;
   int len;
@@ -2589,7 +2615,7 @@
 
 void
 s_purgem (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (is_it_end_of_statement ())
     {
@@ -2619,18 +2645,31 @@
 
 void
 s_rept (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int count;
-  sb one;
-  sb many;
 
   count = get_absolute_expression ();
 
+  do_repeat(count, "REPT", "ENDR");
+}
+
+/* This function provides a generic repeat block implementation.   It allows
+   different directives to be used as the start/end keys. */
+
+void
+do_repeat (count, start, end)
+      int count;
+      const char *start;
+      const char *end;
+{
+  sb one;
+  sb many;
+
   sb_new (&one);
-  if (! buffer_and_nest ("REPT", "ENDR", &one, get_line_sb))
+  if (! buffer_and_nest (start, end, &one, get_line_sb))
     {
-      as_bad (_("rept without endr"));
+      as_bad (_("%s without %s"), start, end);
       return;
     }
 
@@ -2640,11 +2679,28 @@
 
   sb_kill (&one);
 
-  input_scrub_include_sb (&many, input_line_pointer);
+  input_scrub_include_sb (&many, input_line_pointer, 1);
   sb_kill (&many);
   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
 }
 
+/* Skip to end of current repeat loop; EXTRA indicates how many additional
+   input buffers to skip.  Assumes that conditionals preceding the loop end
+   are properly nested. 
+
+   This function makes it easier to implement a premature "break" out of the
+   loop.  The EXTRA arg accounts for other buffers we might have inserted,
+   such as line substitutions. */
+
+void
+end_repeat (extra)
+  int extra;
+{
+  cond_exit_macro (macro_nest);
+  while (extra-- >= 0)
+    buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+}
+
 /* Handle the .equ, .equiv and .set directives.  If EQUIV is 1, then
    this is .equiv, and it is an error if the symbol is already
    defined.  */
@@ -2775,9 +2831,12 @@
 	      S_SET_VALUE (mri_common_symbol, val + 1);
 	      if (line_label != NULL)
 		{
-		  know (line_label->sy_value.X_op == O_symbol);
-		  know (line_label->sy_value.X_add_symbol == mri_common_symbol);
-		  line_label->sy_value.X_add_number += 1;
+		  expressionS *symexp;
+
+		  symexp = symbol_get_value_expression (line_label);
+		  know (symexp->X_op == O_symbol);
+		  know (symexp->X_add_symbol == mri_common_symbol);
+		  symexp->X_add_number += 1;
 		}
 	    }
 	}
@@ -2786,7 +2845,7 @@
 	  do_align (1, (char *) NULL, 0, 0);
 	  if (line_label != NULL)
 	    {
-	      line_label->sy_frag = frag_now;
+	      symbol_set_frag (line_label, frag_now);
 	      S_SET_VALUE (line_label, frag_now_fix ());
 	    }
 	}
@@ -2988,7 +3047,7 @@
 
 void
 s_struct (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *stop = NULL;
   char stopc;
@@ -3004,7 +3063,7 @@
 
 void
 s_text (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   register int temp;
 
@@ -3106,7 +3165,8 @@
 	   && (S_GET_SEGMENT (exp.X_add_symbol)
 	       == S_GET_SEGMENT (exp.X_op_symbol))
 	   && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
-	   && exp.X_add_symbol->sy_frag == exp.X_op_symbol->sy_frag)
+	   && (symbol_get_frag (exp.X_add_symbol)
+	       == symbol_get_frag (exp.X_op_symbol)))
     {
       exp.X_op = O_constant;
       exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
@@ -3130,19 +3190,21 @@
 #endif /* OBJ_AOUT or OBJ_BOUT */
       S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
       if (exp.X_op != O_constant)
-        symbolP->sy_frag = &zero_address_frag;
+        symbol_set_frag (symbolP, &zero_address_frag);
       break;
 
     case O_register:
       S_SET_SEGMENT (symbolP, reg_section);
       S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
-      symbolP->sy_frag = &zero_address_frag;
+      symbol_set_frag (symbolP, &zero_address_frag);
       break;
 
     case O_symbol:
       if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section
 	  || exp.X_add_number != 0)
-	symbolP->sy_value = exp;
+	symbol_set_value_expression (symbolP, &exp);
+      else if (symbol_section_p (symbolP))
+	as_bad ("invalid attempt to set value of section symbol");
       else
 	{
 	  symbolS *s = exp.X_add_symbol;
@@ -3156,7 +3218,7 @@
 #endif /* OBJ_AOUT or OBJ_BOUT */
 	  S_SET_VALUE (symbolP,
 		       exp.X_add_number + S_GET_VALUE (s));
-	  symbolP->sy_frag = s->sy_frag;
+	  symbol_set_frag (symbolP, symbol_get_frag (s));
 	  copy_symbol_attributes (symbolP, s);
 	}
       break;
@@ -3164,7 +3226,7 @@
     default:
       /* The value is some complex expression.
 	 FIXME: Should we set the segment to anything?  */
-      symbolP->sy_value = exp;
+      symbol_set_value_expression (symbolP, &exp);
       break;
     }
 }
@@ -3194,8 +3256,10 @@
    are defined, which is the normal case, then only simple expressions
    are permitted.  */
 
+#ifdef TC_M68K
 static void
 parse_mri_cons PARAMS ((expressionS *exp, unsigned int nbytes));
+#endif
 
 #ifndef TC_PARSE_CONS_EXPRESSION
 #ifdef BITFIELD_CONS_EXPRESSIONS
@@ -3250,9 +3314,11 @@
   c = 0;
   do
     {
+#ifdef TC_M68K
       if (flag_m68k_mri)
 	parse_mri_cons (&exp, (unsigned int) nbytes);
       else
+#endif
 	TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
 
       if (rva)
@@ -3393,13 +3459,13 @@
   /* Handle a negative bignum.  */
   if (op == O_uminus
       && exp->X_add_number == 0
-      && exp->X_add_symbol->sy_value.X_op == O_big
-      && exp->X_add_symbol->sy_value.X_add_number > 0)
+      && symbol_get_value_expression (exp->X_add_symbol)->X_op == O_big
+      && symbol_get_value_expression (exp->X_add_symbol)->X_add_number > 0)
     {
       int i;
       unsigned long carry;
 
-      exp = &exp->X_add_symbol->sy_value;
+      exp = symbol_get_value_expression (exp->X_add_symbol);
 
       /* Negate the bignum: one's complement each digit and add 1.  */
       carry = 1;
@@ -3774,6 +3840,7 @@
 
 /* Handle an MRI style string expression.  */
 
+#ifdef TC_M68K
 static void
 parse_mri_cons (exp, nbytes)
      expressionS *exp;
@@ -3836,6 +3903,7 @@
 	input_line_pointer++;
     }
 }
+#endif /* TC_M68K */
 
 #ifdef REPEAT_CONS_EXPRESSIONS
 
@@ -4207,7 +4275,7 @@
    we don't output for NULL values of P.  It isn't really as critical as
    for "normal" values that this be streamlined.  */
 
-static int
+static inline int
 output_big_sleb128 (p, bignum, size)
      char *p;
      LITTLENUM_TYPE *bignum;
@@ -4253,7 +4321,7 @@
   return p - orig;
 }
 
-static int
+static inline int
 output_big_uleb128 (p, bignum, size)
      char *p;
      LITTLENUM_TYPE *bignum;
@@ -4295,7 +4363,7 @@
   return p - orig;
 }
 
-static inline int
+static int
 output_big_leb128 (p, bignum, size, sign)
      char *p;
      LITTLENUM_TYPE *bignum;
@@ -4388,7 +4456,7 @@
 /*
  *			stringer()
  *
- * We read 0 or more ',' seperated, double-quoted strings.
+ * We read 0 or more ',' separated, double-quoted strings.
  *
  * Caller should have checked need_pass_2 is FALSE because we don't check it.
  */
@@ -4812,9 +4880,8 @@
 /* ARGSUSED */
 void 
 s_include (arg)
-     int arg;
+     int arg ATTRIBUTE_UNUSED;
 {
-  char *newbuf;
   char *filename;
   int i;
   FILE *try;
@@ -4865,8 +4932,7 @@
 gotit:
   /* malloc Storage leak when file is found on path.  FIXME-SOMEDAY. */
   register_dependency (path);
-  newbuf = input_scrub_include_file (path, input_line_pointer);
-  buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+  input_scrub_insert_file (path);
 }				/* s_include() */
 
 void 
@@ -5034,7 +5100,7 @@
 
 void 
 s_ignore (arg)
-     int arg;
+     int arg ATTRIBUTE_UNUSED;
 {
   while (!is_end_of_line[(unsigned char) *input_line_pointer])
     {
@@ -5051,4 +5117,36 @@
   hash_print_statistics (file, "pseudo-op table", po_hash);
 }
 
+/* Inserts the given line into the input stream.  
+   
+   This call avoids macro/conditionals nesting checking, since the contents of
+   the line are assumed to replace the contents of a line already scanned.
+
+   An appropriate use of this function would be substition of input lines when
+   called by md_start_line_hook().  The given line is assumed to already be
+   properly scrubbed.  */
+
+void
+input_scrub_insert_line (line)
+  const char *line;
+{
+  sb newline;
+  sb_new (&newline);
+  sb_add_string (&newline, line);
+  input_scrub_include_sb (&newline, input_line_pointer, 0);
+  sb_kill (&newline);
+  buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+}
+
+/* Insert a file into the input stream; the path must resolve to an actual
+   file; no include path searching or dependency registering is performed.  */ 
+
+void
+input_scrub_insert_file (path)
+  char *path;
+{
+  input_scrub_include_file (path, input_line_pointer);
+  buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+}
+
 /* end of read.c */
diff --git a/gas/read.h b/gas/read.h
index 61e2017..571b59b 100644
--- a/gas/read.h
+++ b/gas/read.h
@@ -35,11 +35,14 @@
 
 #define	LEX_NAME	(1)	/* may continue a name */
 #define LEX_BEGIN_NAME	(2)	/* may begin a name */
+#define LEX_END_NAME	(4)	/* ends a name */
 
 #define is_name_beginner(c) \
   ( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME )
 #define is_part_of_name(c) \
   ( lex_type[(unsigned char) (c)] & LEX_NAME       )
+#define is_name_ender(c) \
+  ( lex_type[(unsigned char) (c)] & LEX_END_NAME   )
 
 #ifndef is_a_char
 #define CHAR_MASK	(0xff)
@@ -113,6 +116,8 @@
 extern void stabs_generate_asm_lineno PARAMS ((void));
 extern void stabs_generate_asm_func PARAMS ((const char *, const char *));
 extern void stabs_generate_asm_endfunc PARAMS ((const char *, const char *));
+extern void do_repeat PARAMS((int,const char *,const char *));
+extern void end_repeat PARAMS((int));
 
 extern void generate_lineno_debug PARAMS ((void));
 
@@ -125,6 +130,7 @@
 extern void s_data PARAMS ((int));
 extern void s_desc PARAMS ((int));
 extern void s_else PARAMS ((int arg));
+extern void s_elseif PARAMS ((int arg));
 extern void s_end PARAMS ((int arg));
 extern void s_endif PARAMS ((int arg));
 extern void s_err PARAMS ((int));
diff --git a/gas/sb.h b/gas/sb.h
index 7e6daf1..7eaed25 100644
--- a/gas/sb.h
+++ b/gas/sb.h
@@ -94,6 +94,6 @@
 extern int sb_skip_comma PARAMS ((int, sb *));
 
 /* Actually in input-scrub.c.  */
-extern void input_scrub_include_sb PARAMS ((sb *, char *));
+extern void input_scrub_include_sb PARAMS ((sb *, char *, int));
 
 #endif /* SB_H */
diff --git a/gas/stabs.c b/gas/stabs.c
index db7e1bf..7c13c2f 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -1,5 +1,5 @@
 /* Generic stabs parsing for gas.
-   Copyright (C) 1989, 90, 91, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1989, 90, 91, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -152,14 +152,14 @@
   if (what == 's' || what == 'n')
     {
       /* Pick up the value from the input line.  */
-      symbol->sy_frag = &zero_address_frag;
+      symbol_set_frag (symbol, &zero_address_frag);
       pseudo_set (symbol);
     }
   else
     {
       /* .stabd sets the name to NULL.  Why?  */
       S_SET_NAME (symbol, NULL);
-      symbol->sy_frag = frag_now;
+      symbol_set_frag (symbol, frag_now);
       S_SET_VALUE (symbol, (valueT) frag_now_fix ());
     }
 
@@ -498,7 +498,7 @@
   static char *last_file;
   static int label_count;
   char *hold;
-  char buf[100];
+  char *buf = xmalloc (2 * strlen (file) + 10);
   char sym[30];
 
   /* Rather than try to do this in some efficient fashion, we just
@@ -511,10 +511,28 @@
   if (last_file == NULL
       || strcmp (last_file, file) != 0)
     {
+      char *tmp = file;
+      char *endp = file + strlen(file);
+      char *bufp = buf;
+
       sprintf (sym, "%sF%d", FAKE_LABEL_NAME, label_count);
       ++label_count;
 
-      sprintf (buf, "\"%s\",%d,0,0,%s\n", file, type, sym);
+      *bufp++ = '"';
+      while (tmp < endp)
+        {
+          char *bslash = strchr (tmp, '\\');
+          int len = (bslash ? (bslash - tmp + 1) : strlen (tmp));
+          /* double all backslashes, since demand_copy_C_string (used by
+             s_stab to extract the part in quotes) will try to replace them as
+             escape sequences.  backslash may appear in a filespec. */
+          strncpy (bufp, tmp, len);
+          tmp += len;
+          bufp += len;
+          if (bslash != NULL)
+            *bufp++ = '\\';
+        } 
+      sprintf (bufp, "\",%d,0,0,%s\n", type, sym);
       input_line_pointer = buf;
       s_stab ('s');
       colon (sym);
@@ -525,6 +543,7 @@
     }
 
   input_line_pointer = hold;
+  free (buf);
 }
 
 /* Generate stabs debugging information for the current line.  This is
@@ -609,7 +628,7 @@
 
 void
 stabs_generate_asm_endfunc (funcname, startlabname)
-     const char *funcname;
+     const char *funcname ATTRIBUTE_UNUSED;
      const char *startlabname;
 {
   static int label_count;
diff --git a/gas/struc-symbol.h b/gas/struc-symbol.h
index aeb0405..7573566 100644
--- a/gas/struc-symbol.h
+++ b/gas/struc-symbol.h
@@ -1,5 +1,5 @@
 /* struct_symbol.h - Internal symbol structure
-   Copyright (C) 1987, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 92, 93, 94, 95, 98, 1999 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -21,16 +21,16 @@
 #ifndef __struc_symbol_h__
 #define __struc_symbol_h__
 
-#ifdef BFD_ASSEMBLER
-/* The BFD code wants to walk the list in both directions.  */
-#undef  SYMBOLS_NEED_BACKPOINTERS
-#define SYMBOLS_NEED_BACKPOINTERS
-#endif
+/* The information we keep for a symbol.  Note that the symbol table
+   holds pointers both to this and to local_symbol structures.  See
+   below.  */
 
-/* our version of an nlist node */
 struct symbol
 {
-#ifndef BFD_ASSEMBLER
+#ifdef BFD_ASSEMBLER
+  /* BFD symbol */
+  asymbol *bsym;
+#else
   /* The (4-origin) position of sy_name in the symbol table of the object
      file.  This will be 0 for (nameless) .stabd symbols.
 
@@ -42,9 +42,6 @@
 
   /* The 24 bit symbol number.  Symbol numbers start at 0 and are unsigned. */
   long sy_number;
-#else
-  /* BFD symbol */
-  asymbol *bsym;
 #endif
 
   /* The value of the symbol.  */
@@ -91,75 +88,58 @@
 #ifdef TC_SYMFIELD_TYPE
   TC_SYMFIELD_TYPE sy_tc;
 #endif
-
-#ifdef TARGET_SYMBOL_FIELDS
-  TARGET_SYMBOL_FIELDS
-#endif
 };
 
-typedef struct symbol symbolS;
+#ifdef BFD_ASSEMBLER
 
-#ifndef WORKING_DOT_WORD
-struct broken_word
+/* A pointer in the symbol may point to either a complete symbol
+   (struct symbol above) or to a local symbol (struct local_symbol
+   defined here).  The symbol code can detect the case by examining
+   the first field.  It is always NULL for a local symbol.
+
+   We do this because we ordinarily only need a small amount of
+   information for a local symbol.  The symbol table takes up a lot of
+   space, and storing less information for a local symbol can make a
+   big difference in assembler memory usage when assembling a large
+   file.  */
+
+struct local_symbol
+{
+  /* This pointer is always NULL to indicate that this is a local
+     symbol.  */
+  asymbol *lsy_marker;
+
+  /* The symbol section.  This also serves as a flag.  If this is
+     reg_section, then this symbol has been converted into a regular
+     symbol, and sy_sym points to it.  */
+  segT lsy_section;
+
+  /* The symbol name.  */
+  const char *lsy_name;
+
+  /* The symbol frag or the real symbol, depending upon the value in
+     sy_section.  If the symbol has been fully resolved, lsy_frag is
+     set to NULL.  */
+  union
   {
-    /* Linked list -- one of these structures per ".word x-y+C"
-       expression.  */
-    struct broken_word *next_broken_word;
-    /* Segment and subsegment for broken word.  */
-    segT seg;
-    subsegT subseg;
-    /* Which frag is this broken word in?  */
-    fragS *frag;
-    /* Where in the frag is it?  */
-    char *word_goes_here;
-    /* Where to add the break.  */
-    fragS *dispfrag;		/* where to add the break */
-    /* Operands of expression.  */
-    symbolS *add;
-    symbolS *sub;
-    offsetT addnum;
+    fragS *lsy_frag;
+    symbolS *lsy_sym;
+  } u;
 
-    int added;			/* nasty thing happend yet? */
-    /* 1: added and has a long-jump */
-    /* 2: added but uses someone elses long-jump */
+  /* The offset within the frag.  */
+  valueT lsy_offset;
+};
 
-    /* Pointer to broken_word with a similar long-jump.  */
-    struct broken_word *use_jump;
-  };
-extern struct broken_word *broken_words;
-#endif /* ndef WORKING_DOT_WORD */
+#define local_symbol_converted_p(l) ((l)->lsy_section == reg_section)
+#define local_symbol_mark_converted(l) ((l)->lsy_section = reg_section)
+#define local_symbol_resolved_p(l) ((l)->u.lsy_frag == NULL)
+#define local_symbol_mark_resolved(l) ((l)->u.lsy_frag = NULL)
+#define local_symbol_get_frag(l) ((l)->u.lsy_frag)
+#define local_symbol_set_frag(l, f) ((l)->u.lsy_frag = (f))
+#define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym)
+#define local_symbol_set_real_symbol(l, s) ((l)->u.lsy_sym = (s))
 
-/*
- * Current means for getting from symbols to segments and vice verse.
- * This will change for infinite-segments support (e.g. COFF).
- */
-extern const segT N_TYPE_seg[];	/* subseg.c */
-
-#define	SEGMENT_TO_SYMBOL_TYPE(seg)  ( seg_N_TYPE [(int) (seg)] )
-extern const short seg_N_TYPE[];/* subseg.c */
-
-#define	N_REGISTER	30	/* Fake N_TYPE value for SEG_REGISTER */
-
-void symbol_clear_list_pointers PARAMS ((symbolS * symbolP));
-
-#ifdef SYMBOLS_NEED_BACKPOINTERS
-
-void symbol_insert PARAMS ((symbolS * addme, symbolS * target,
-			    symbolS ** rootP, symbolS ** lastP));
-void symbol_remove PARAMS ((symbolS * symbolP, symbolS ** rootP,
-			    symbolS ** lastP));
-
-#define symbol_previous(s) ((s)->sy_previous)
-
-#endif /* SYMBOLS_NEED_BACKPOINTERS */
-
-void verify_symbol_chain PARAMS ((symbolS * rootP, symbolS * lastP));
-void verify_symbol_chain_2 PARAMS ((symbolS * symP));
-
-void symbol_append PARAMS ((symbolS * addme, symbolS * target,
-			    symbolS ** rootP, symbolS ** lastP));
-
-#define symbol_next(s)	((s)->sy_next)
+#endif /* BFD_ASSEMBLER */
 
 #endif /* __struc_symbol_h__ */
 
diff --git a/gas/subsegs.c b/gas/subsegs.c
index bdf2868..b2bf70d 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -1,5 +1,5 @@
 /* subsegs.c - subsegments -
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -547,7 +547,7 @@
 	  if (S_GET_SEGMENT (s) == undefined_section)
 	    {
 	      S_SET_SEGMENT (s, sec);
-	      s->sy_frag = &zero_address_frag;
+	      symbol_set_frag (s, &zero_address_frag);
 	    }
 	}
     }
@@ -556,7 +556,7 @@
 
   /* Use the BFD section symbol, if possible.  */
   if (obj_sec_sym_ok_for_reloc (sec))
-    s->bsym = sec->symbol;
+    symbol_set_bfdsym (s, sec->symbol);
 
   seginfo->sym = s;
   return s;
@@ -564,6 +564,51 @@
 
 #endif /* BFD_ASSEMBLER */
 
+/* Return whether the specified segment is thought to hold text.  */
+
+#ifndef BFD_ASSEMBLER
+const char * const nontext_section_names[] =
+{
+  ".eh_frame",
+  ".gcc_except_table",
+#ifdef OBJ_COFF
+#ifndef COFF_LONG_SECTION_NAMES
+  ".eh_fram",
+  ".gcc_exc",
+#endif
+#endif
+  NULL
+};
+#endif /* ! BFD_ASSEMBLER */
+
+int
+subseg_text_p (sec)
+     segT sec;
+{
+#ifdef BFD_ASSEMBLER
+  return (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) != 0;
+#else /* ! BFD_ASSEMBLER */
+  const char * const *p;
+
+  if (sec == data_section || sec == bss_section)
+    return 0;
+
+  for (p = nontext_section_names; *p != NULL; ++p)
+    {
+      if (strcmp (segment_name (sec), *p) == 0)
+	return 0;
+
+#ifdef obj_segment_name
+      if (strcmp (obj_segment_name (sec), *p) == 0)
+	return 0;
+#endif
+    }
+
+  return 1;
+
+#endif /* ! BFD_ASSEMBLER */
+}
+
 void
 subsegs_print_statistics (file)
      FILE *file;
diff --git a/gas/symbols.c b/gas/symbols.c
index a1cde6a..b54a2fd 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1,5 +1,5 @@
 /* symbols.c -symbol table-
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -28,6 +28,8 @@
 #include "obstack.h"		/* For "symbols.h" */
 #include "subsegs.h"
 
+#include "struc-symbol.h"
+
 /* This is non-zero if symbols are case sensitive, which is the
    default.  */
 int symbols_case_sensitive = 1;
@@ -39,6 +41,9 @@
 /* symbol-name => struct symbol pointer */
 static struct hash_control *sy_hash;
 
+/* Table of local symbols.  */
+static struct hash_control *local_hash;
+
 /* Below are commented in "symbols.h". */
 symbolS *symbol_rootP;
 symbolS *symbol_lastP;
@@ -93,6 +98,41 @@
   return symbolP;
 }
 
+/* Save a symbol name on a permanent obstack, and convert it according
+   to the object file format.  */
+
+static char *
+save_symbol_name (name)
+     const char *name;
+{
+  unsigned int name_length;
+  char *ret;
+
+  name_length = strlen (name) + 1;	/* +1 for \0 */
+  obstack_grow (&notes, name, name_length);
+  ret = obstack_finish (&notes);
+
+#ifdef STRIP_UNDERSCORE
+  if (ret[0] == '_')
+    ++ret;
+#endif
+
+#ifdef tc_canonicalize_symbol_name
+  ret = tc_canonicalize_symbol_name (ret);
+#endif
+
+  if (! symbols_case_sensitive)
+    {
+      unsigned char *s;
+
+      for (s = (unsigned char *) ret; *s != '\0'; s++)
+	if (islower (*s))
+	  *s = toupper (*s);
+    }
+
+  return ret;
+}
+
 symbolS *
 symbol_create (name, segment, valu, frag)
      const char *name;		/* It is copied, the caller can destroy/modify */
@@ -100,31 +140,10 @@
      valueT valu;		/* Symbol value */
      fragS *frag;		/* Associated fragment */
 {
-  unsigned int name_length;
   char *preserved_copy_of_name;
   symbolS *symbolP;
 
-  name_length = strlen (name) + 1;	/* +1 for \0 */
-  obstack_grow (&notes, name, name_length);
-  preserved_copy_of_name = obstack_finish (&notes);
-#ifdef STRIP_UNDERSCORE
-  if (preserved_copy_of_name[0] == '_')
-    preserved_copy_of_name++;
-#endif
-
-#ifdef tc_canonicalize_symbol_name
-  preserved_copy_of_name =
-    tc_canonicalize_symbol_name (preserved_copy_of_name);
-#endif
-
-  if (! symbols_case_sensitive)
-    {
-      unsigned char *s;
-
-      for (s = (unsigned char *) preserved_copy_of_name; *s != '\0'; s++)
-	if (islower (*s))
-	  *s = toupper (*s);
-    }
+  preserved_copy_of_name = save_symbol_name (name);
 
   symbolP = (symbolS *) obstack_alloc (&notes, sizeof (symbolS));
 
@@ -158,6 +177,101 @@
   return symbolP;
 }
 
+#ifdef BFD_ASSEMBLER
+
+/* Local symbol support.  If we can get away with it, we keep only a
+   small amount of information for local symbols.  */
+
+static struct local_symbol *local_symbol_make PARAMS ((const char *, segT,
+						       valueT, fragS *));
+static symbolS *local_symbol_convert PARAMS ((struct local_symbol *));
+
+/* Used for statistics.  */
+
+static unsigned long local_symbol_count;
+static unsigned long local_symbol_conversion_count;
+
+/* This macro is called with a symbol argument passed by reference.
+   It returns whether this is a local symbol.  If necessary, it
+   changes its argument to the real symbol.  */
+
+#define LOCAL_SYMBOL_CHECK(s)						\
+  (s->bsym == NULL							\
+   ? (local_symbol_converted_p ((struct local_symbol *) s)		\
+      ? (s = local_symbol_get_real_symbol ((struct local_symbol *) s),	\
+	 0)								\
+      : 1)								\
+   : 0)
+
+/* Create a local symbol and insert it into the local hash table.  */
+
+static struct local_symbol *
+local_symbol_make (name, section, offset, frag)
+     const char *name;
+     segT section;
+     valueT offset;
+     fragS *frag;
+{
+  char *name_copy;
+  struct local_symbol *ret;
+
+  ++local_symbol_count;
+
+  name_copy = save_symbol_name (name);
+
+  ret = (struct local_symbol *) obstack_alloc (&notes, sizeof *ret);
+  ret->lsy_marker = NULL;
+  ret->lsy_name = name_copy;
+  ret->lsy_section = section;
+  local_symbol_set_frag (ret, frag);
+  ret->lsy_offset = offset;
+
+  hash_jam (local_hash, name_copy, (PTR) ret);
+
+  return ret;
+}
+
+/* Convert a local symbol into a real symbol.  Note that we do not
+   reclaim the space used by the local symbol.  */
+
+static symbolS *
+local_symbol_convert (locsym)
+     struct local_symbol *locsym;
+{
+  symbolS *ret;
+
+  assert (locsym->lsy_marker == NULL);
+  if (local_symbol_converted_p (locsym))
+    return local_symbol_get_real_symbol (locsym);
+
+  ++local_symbol_conversion_count;
+
+  ret = symbol_new (locsym->lsy_name, locsym->lsy_section, locsym->lsy_offset,
+		    local_symbol_get_frag (locsym));
+
+  if (local_symbol_resolved_p (locsym))
+    ret->sy_resolved = 1;
+
+  /* Local symbols are always either defined or used.  */
+  ret->sy_used = 1;
+
+  symbol_table_insert (ret);
+
+  local_symbol_mark_converted (locsym);
+  local_symbol_set_real_symbol (locsym, ret);
+
+  hash_jam (local_hash, locsym->lsy_name, NULL);
+
+  return ret;
+}
+
+#else /* ! BFD_ASSEMBLER */
+
+#define LOCAL_SYMBOL_CHECK(s) 0
+#define local_symbol_convert(s) ((symbolS *) s)
+
+#endif /* ! BFD_ASSEMBLER */
+
 
 /*
  *			colon()
@@ -238,7 +352,26 @@
       /*
        *	Now check for undefined symbols
        */
-      if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))
+      if (LOCAL_SYMBOL_CHECK (symbolP))
+	{
+#ifdef BFD_ASSEMBLER
+	  struct local_symbol *locsym = (struct local_symbol *) symbolP;
+
+	  if (locsym->lsy_section != undefined_section
+	      && (local_symbol_get_frag (locsym) != frag_now
+		  || locsym->lsy_section != now_seg
+		  || locsym->lsy_offset != frag_now_fix ()))
+	    {
+	      as_bad (_("Symbol %s already defined."), sym_name);
+	      return symbolP;
+	    }
+
+	  locsym->lsy_section = now_seg;
+	  local_symbol_set_frag (locsym, frag_now);
+	  locsym->lsy_offset = frag_now_fix ();
+#endif
+	}
+      else if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))
 	{
 	  if (S_GET_VALUE (symbolP) == 0)
 	    {
@@ -304,18 +437,24 @@
 		}
 	      else
 		{
-#if defined (S_GET_OTHER) && defined (S_GET_DESC)
-		  as_fatal (_("Symbol \"%s\" is already defined as \"%s\"/%d.%d.%ld."),
-			    sym_name,
-			    segment_name (S_GET_SEGMENT (symbolP)),
-			    S_GET_OTHER (symbolP), S_GET_DESC (symbolP),
-			    (long) S_GET_VALUE (symbolP));
+#if (!defined (OBJ_AOUT) && !defined (OBJ_MAYBE_AOUT) \
+     && !defined (OBJ_BOUT) && !defined (OBJ_MAYBE_BOUT))
+		  static const char *od_buf = "";
 #else
-		  as_fatal (_("Symbol \"%s\" is already defined as \"%s\"/%ld."),
+		  char od_buf[100];
+		  od_buf[0] = '\0';
+#ifdef BFD_ASSEMBLER
+		  if (OUTPUT_FLAVOR == bfd_target_aout_flavour)
+#endif
+		    sprintf(od_buf, "%d.%d.",
+			    S_GET_OTHER (symbolP),
+			    S_GET_DESC (symbolP));
+#endif
+		  as_fatal (_("Symbol \"%s\" is already defined as \"%s\"/%s%ld."),
 			    sym_name,
 			    segment_name (S_GET_SEGMENT (symbolP)),
+			    od_buf,
 			    (long) S_GET_VALUE (symbolP));
-#endif
 		}
 	    }			/* if the undefined symbol has no value */
 	}
@@ -329,6 +468,14 @@
 	}			/* if this symbol is not yet defined */
 
     }
+#ifdef BFD_ASSEMBLER
+  else if (! flag_keep_locals && bfd_is_local_label_name (stdoutput, sym_name))
+    {
+      symbolP = (symbolS *) local_symbol_make (sym_name, now_seg,
+					       (valueT) frag_now_fix (),
+					       frag_now);
+    }
+#endif /* BFD_ASSEMBLER */
   else
     {
       symbolP = symbol_new (sym_name, now_seg, (valueT) frag_now_fix (),
@@ -344,6 +491,8 @@
     {
       /* This symbol is actually being defined within an MRI common
          section.  This requires special handling.  */
+      if (LOCAL_SYMBOL_CHECK (symbolP))
+	symbolP = local_symbol_convert ((struct local_symbol *) symbolP);
       symbolP->sy_value.X_op = O_symbol;
       symbolP->sy_value.X_add_symbol = mri_common_symbol;
       symbolP->sy_value.X_add_number = S_GET_VALUE (mri_common_symbol);
@@ -379,6 +528,16 @@
   know (symbolP);
   know (S_GET_NAME (symbolP));
 
+  if (LOCAL_SYMBOL_CHECK (symbolP))
+    {
+      error_string = hash_jam (local_hash, S_GET_NAME (symbolP),
+			       (PTR) symbolP);
+      if (error_string != NULL)
+	as_fatal (_("Inserting \"%s\" into symbol table failed: %s"),
+		  S_GET_NAME (symbolP), error_string);
+      return;
+    }
+
   if ((error_string = hash_jam (sy_hash, S_GET_NAME (symbolP), (PTR) symbolP)))
     {
       as_fatal (_("Inserting \"%s\" into symbol table failed: %s"),
@@ -402,6 +561,20 @@
 
   if (symbolP == NULL)
     {
+#ifdef BFD_ASSEMBLER
+      if (! flag_keep_locals && bfd_is_local_label_name (stdoutput, name))
+	{
+	  symbolP = md_undefined_symbol ((char *) name);
+	  if (symbolP != NULL)
+	    return symbolP;
+
+	  symbolP = (symbolS *) local_symbol_make (name, undefined_section,
+						   (valueT) 0,
+						   &zero_address_frag);
+	  return symbolP;
+	}
+#endif
+
       symbolP = symbol_make (name);
 
       symbol_table_insert (symbolP);
@@ -456,25 +629,42 @@
 #ifdef tc_canonicalize_symbol_name
   {
     char *copy;
+    size_t len = strlen (name) + 1;
 
-    copy = (char *) alloca (strlen (name) + 1);
-    strcpy (copy, name);
+    copy = (char *) alloca (len);
+    memcpy (copy, name, len);
     name = tc_canonicalize_symbol_name (copy);
   }
 #endif
 
   if (! symbols_case_sensitive)
     {
-      unsigned char *copy;
+      char *copy;
+      const char *orig;
+      unsigned char c;
 
-      copy = (unsigned char *) alloca (strlen (name) + 1);
-      strcpy (copy, name);
-      name = (const char *) copy;
-      for (; *copy != '\0'; copy++)
-	if (islower (*copy))
-	  *copy = toupper (*copy);
+      orig = name;
+      name = copy = (char *) alloca (strlen (name) + 1);
+
+      while ((c = *orig++) != '\0')
+	{
+	  if (islower (c))
+	    c = toupper (c);
+	  *copy++ = c;
+	}
+      *copy = '\0';
     }
 
+#ifdef BFD_ASSEMBLER
+  {
+    struct local_symbol *locsym;
+
+    locsym = (struct local_symbol *) hash_find (local_hash, name);
+    if (locsym != NULL)
+      return (symbolS *) locsym;
+  }
+#endif
+
   return ((symbolS *) hash_find (sy_hash, name));
 }
 
@@ -494,6 +684,11 @@
      symbolS **rootPP;
      symbolS **lastPP;
 {
+  if (LOCAL_SYMBOL_CHECK (addme))
+    abort ();
+  if (target != NULL && LOCAL_SYMBOL_CHECK (target))
+    abort ();
+
   if (target == NULL)
     {
       know (*rootPP == NULL);
@@ -534,6 +729,8 @@
 symbol_clear_list_pointers (symbolP)
      symbolS *symbolP;
 {
+  if (LOCAL_SYMBOL_CHECK (symbolP))
+    abort ();
   symbolP->sy_next = NULL;
 #ifdef SYMBOLS_NEED_BACKPOINTERS
   symbolP->sy_previous = NULL;
@@ -548,6 +745,9 @@
      symbolS **rootPP;
      symbolS **lastPP;
 {
+  if (LOCAL_SYMBOL_CHECK (symbolP))
+    abort ();
+
   if (symbolP == *rootPP)
     {
       *rootPP = symbolP->sy_next;
@@ -577,8 +777,13 @@
      symbolS *addme;
      symbolS *target;
      symbolS **rootPP;
-     symbolS **lastPP;
+     symbolS **lastPP ATTRIBUTE_UNUSED;
 {
+  if (LOCAL_SYMBOL_CHECK (addme))
+    abort ();
+  if (LOCAL_SYMBOL_CHECK (target))
+    abort ();
+
   if (target->sy_previous != NULL)
     {
       target->sy_previous->sy_next = addme;
@@ -610,6 +815,9 @@
 
   for (; symbol_next (symbolP) != NULL; symbolP = symbol_next (symbolP))
     {
+#ifdef BFD_ASSEMBLER
+      assert (symbolP->bsym != NULL);
+#endif
 #ifdef SYMBOLS_NEED_BACKPOINTERS
       assert (symbolP->sy_next->sy_previous == symbolP);
 #else
@@ -648,6 +856,27 @@
   valueT final_val;
   segT final_seg;
 
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (symp))
+    {
+      struct local_symbol *locsym = (struct local_symbol *) symp;
+
+      if (local_symbol_resolved_p (locsym))
+	return locsym->lsy_offset / OCTETS_PER_BYTE;
+
+      final_val = (local_symbol_get_frag (locsym)->fr_address
+		   + locsym->lsy_offset) / OCTETS_PER_BYTE;
+
+      if (finalize)
+	{
+	  locsym->lsy_offset = final_val;
+	  local_symbol_mark_resolved (locsym);
+	}
+
+      return final_val;
+    }
+#endif
+
   if (symp->sy_resolved)
     {
       if (symp->sy_value.X_op == O_constant)
@@ -692,7 +921,7 @@
 	  /* Fall through.  */
 
 	case O_constant:
-	  final_val += symp->sy_frag->fr_address;
+	  final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE;
 	  if (final_seg == expr_section)
 	    final_seg = absolute_section;
 	  resolved = 1;
@@ -708,12 +937,17 @@
 	      /* This is a symbol inside an MRI common section.  The
                  relocation routines are going to handle it specially.
                  Don't change the value.  */
-	      resolved = add_symbol->sy_resolved;
+	      resolved = symbol_resolved_p (add_symbol);
 	      break;
 	    }
 
 	  if (finalize && final_val == 0)
-	    copy_symbol_attributes (symp, add_symbol);
+	    {
+	      if (LOCAL_SYMBOL_CHECK (add_symbol))
+		add_symbol = local_symbol_convert ((struct local_symbol *)
+						   add_symbol);
+	      copy_symbol_attributes (symp, add_symbol);
+	    }
 
 	  /* If we have equated this symbol to an undefined symbol, we
              keep X_op set to O_symbol, and we don't change
@@ -731,7 +965,7 @@
 		  symp->sy_value.X_add_number = final_val;
 		}
 	      final_val = 0;
-	      resolved = add_symbol->sy_resolved;
+	      resolved = symbol_resolved_p (add_symbol);
 	      goto exit_dont_set_value;
 	    }
 	  else
@@ -741,7 +975,7 @@
 		final_seg = S_GET_SEGMENT (add_symbol);
 	    }
 
-	  resolved = add_symbol->sy_resolved;
+	  resolved = symbol_resolved_p (add_symbol);
 	  break;
 
 	case O_uminus:
@@ -760,7 +994,7 @@
 	  if (final_seg == expr_section || final_seg == undefined_section)
 	    final_seg = absolute_section;
 
-	  resolved = add_symbol->sy_resolved;
+	  resolved = symbol_resolved_p (add_symbol);
 	  break;
 
 	case O_multiply:
@@ -820,8 +1054,11 @@
 	     expressions, such as IEEE-695.  */
 	  /* Don't emit messages unless we're finalizing the symbol value,
 	     otherwise we may get the same message multiple times.  */
-	  if ((seg_left != absolute_section || seg_right != absolute_section)
-	      && (op != O_subtract || seg_left != seg_right)
+	  if ((seg_left != absolute_section
+	       || seg_right != absolute_section)
+	      && (op != O_subtract
+		  || seg_left != seg_right
+		  || seg_left == undefined_section)
 	      && finalize)
 	    {
 	      char *file;
@@ -905,7 +1142,8 @@
 	  final_val += symp->sy_frag->fr_address + left;
 	  if (final_seg == expr_section || final_seg == undefined_section)
 	    final_seg = absolute_section;
-	  resolved = (add_symbol->sy_resolved && op_symbol->sy_resolved);
+	  resolved = (symbol_resolved_p (add_symbol)
+		      && symbol_resolved_p (op_symbol));
    	  break;
 
 	case O_register:
@@ -950,6 +1188,33 @@
   return final_val;
 }
 
+#ifdef BFD_ASSEMBLER
+
+static void resolve_local_symbol PARAMS ((const char *, PTR));
+
+/* A static function passed to hash_traverse.  */
+
+static void
+resolve_local_symbol (key, value)
+     const char *key ATTRIBUTE_UNUSED;
+     PTR value;
+{
+  if (value != NULL)
+    resolve_symbol_value (value, 1);
+}
+
+#endif
+
+/* Resolve all local symbols.  */
+
+void
+resolve_local_symbol_values ()
+{
+#ifdef BFD_ASSEMBLER
+  hash_traverse (local_hash, resolve_local_symbol);
+#endif
+}
+
 /* Dollar labels look like a number followed by a dollar sign.  Eg, "42$".
    They are *really* local.  That is, they go out of scope whenever we see a
    label that isn't local.  Also, like fb labels, there can be multiple
@@ -1073,6 +1338,9 @@
   know (n >= 0);
   know (augend == 0 || augend == 1);
   p = symbol_name_build;
+#ifdef LOCAL_LABEL_PREFIX
+  *p++ = LOCAL_LABEL_PREFIX;
+#endif
   *p++ = 'L';
 
   /* Next code just does sprintf( {}, "%d", n); */
@@ -1315,6 +1583,11 @@
 S_GET_VALUE (s)
      symbolS *s;
 {
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    return ((struct local_symbol *) s)->lsy_offset;
+#endif
+
   if (!s->sy_resolved && s->sy_value.X_op != O_constant)
     resolve_symbol_value (s, 1);
   if (s->sy_value.X_op != O_constant)
@@ -1344,6 +1617,14 @@
      symbolS *s;
      valueT val;
 {
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    {
+      ((struct local_symbol *) s)->lsy_offset = val;
+      return;
+    }
+#endif
+
   s->sy_value.X_op = O_constant;
   s->sy_value.X_add_number = (offsetT) val;
   s->sy_value.X_unsigned = 0;
@@ -1353,6 +1634,11 @@
 copy_symbol_attributes (dest, src)
      symbolS *dest, *src;
 {
+  if (LOCAL_SYMBOL_CHECK (dest))
+    dest = local_symbol_convert ((struct local_symbol *) dest);
+  if (LOCAL_SYMBOL_CHECK (src))
+    src = local_symbol_convert ((struct local_symbol *) src);
+
 #ifdef BFD_ASSEMBLER
   /* In an expression, transfer the settings of these flags.
      The user can override later, of course.  */
@@ -1371,7 +1657,12 @@
 S_IS_FUNCTION (s)
      symbolS *s;
 {
-  flagword flags = s->bsym->flags;
+  flagword flags;
+
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+
+  flags = s->bsym->flags;
 
   return (flags & BSF_FUNCTION) != 0;
 }
@@ -1380,7 +1671,12 @@
 S_IS_EXTERNAL (s)
      symbolS *s;
 {
-  flagword flags = s->bsym->flags;
+  flagword flags;
+
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+
+  flags = s->bsym->flags;
 
   /* sanity check */
   if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
@@ -1393,6 +1689,8 @@
 S_IS_WEAK (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
   return (s->bsym->flags & BSF_WEAK) != 0;
 }
 
@@ -1400,6 +1698,8 @@
 S_IS_COMMON (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
   return bfd_is_com_section (s->bsym->section);
 }
 
@@ -1407,6 +1707,8 @@
 S_IS_DEFINED (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return ((struct local_symbol *) s)->lsy_section != undefined_section;
   return s->bsym->section != undefined_section;
 }
 
@@ -1414,6 +1716,8 @@
 S_IS_DEBUG (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
   if (s->bsym->flags & BSF_DEBUGGING)
     return 1;
   return 0;
@@ -1423,9 +1727,14 @@
 S_IS_LOCAL (s)
      symbolS *s;
 {
-  flagword flags = s->bsym->flags;
+  flagword flags;
   const char *name;
 
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 1;
+
+  flags = s->bsym->flags;
+
   /* sanity check */
   if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
     abort ();
@@ -1468,6 +1777,8 @@
 S_GET_NAME (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return ((struct local_symbol *) s)->lsy_name;
   return s->bsym->name;
 }
 
@@ -1475,6 +1786,8 @@
 S_GET_SEGMENT (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return ((struct local_symbol *) s)->lsy_section;
   return s->bsym->section;
 }
 
@@ -1487,6 +1800,17 @@
      faults assigning back to const global symbols such as *ABS*, but it
      shouldn't happen anyway.  */
 
+  if (LOCAL_SYMBOL_CHECK (s))
+    {
+      if (seg == reg_section)
+	s = local_symbol_convert ((struct local_symbol *) s);
+      else
+	{
+	  ((struct local_symbol *) s)->lsy_section = seg;
+	  return;
+	}
+    }
+
   if (s->bsym->flags & BSF_SECTION_SYM)
     {
       if (s->bsym->section != seg)
@@ -1500,6 +1824,8 @@
 S_SET_EXTERNAL (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
   if ((s->bsym->flags & BSF_WEAK) != 0)
     {
       /* Let .weak override .global.  */
@@ -1513,6 +1839,8 @@
 S_CLEAR_EXTERNAL (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
   if ((s->bsym->flags & BSF_WEAK) != 0)
     {
       /* Let .weak override.  */
@@ -1526,6 +1854,8 @@
 S_SET_WEAK (s)
      symbolS *s;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
   s->bsym->flags |= BSF_WEAK;
   s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL);
 }
@@ -1535,16 +1865,383 @@
      symbolS *s;
      char *name;
 {
+  if (LOCAL_SYMBOL_CHECK (s))
+    {
+      ((struct local_symbol *) s)->lsy_name = name;
+      return;
+    }
   s->bsym->name = name;
 }
 #endif /* BFD_ASSEMBLER */
 
+#ifdef SYMBOLS_NEED_BACKPOINTERS
+
+/* Return the previous symbol in a chain.  */
+
+symbolS *
+symbol_previous (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    abort ();
+  return s->sy_previous;
+}
+
+#endif /* SYMBOLS_NEED_BACKPOINTERS */
+
+/* Return the next symbol in a chain.  */
+
+symbolS *
+symbol_next (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    abort ();
+  return s->sy_next;
+}
+
+/* Return a pointer to the value of a symbol as an expression.  */
+
+expressionS *
+symbol_get_value_expression (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  return &s->sy_value;
+}
+
+/* Set the value of a symbol to an expression.  */
+
+void
+symbol_set_value_expression (s, exp)
+     symbolS *s;
+     const expressionS *exp;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_value = *exp;
+}
+
+/* Set the frag of a symbol.  */
+
+void
+symbol_set_frag (s, f)
+     symbolS *s;
+     fragS *f;
+{
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    {
+      local_symbol_set_frag ((struct local_symbol *) s, f);
+      return;
+    }
+#endif
+  s->sy_frag = f;
+}
+
+/* Return the frag of a symbol.  */
+
+fragS *
+symbol_get_frag (s)
+     symbolS *s;
+{
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    return local_symbol_get_frag ((struct local_symbol *) s);
+#endif
+  return s->sy_frag;
+}
+
+/* Mark a symbol as having been used.  */
+
+void
+symbol_mark_used (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
+  s->sy_used = 1;
+}
+
+/* Clear the mark of whether a symbol has been used.  */
+
+void
+symbol_clear_used (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_used = 0;
+}
+
+/* Return whether a symbol has been used.  */
+
+int
+symbol_used_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 1;
+  return s->sy_used;
+}
+
+/* Mark a symbol as having been used in a reloc.  */
+
+void
+symbol_mark_used_in_reloc (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_used_in_reloc = 1;
+}
+
+/* Clear the mark of whether a symbol has been used in a reloc.  */
+
+void
+symbol_clear_used_in_reloc (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
+  s->sy_used_in_reloc = 0;
+}
+
+/* Return whether a symbol has been used in a reloc.  */
+
+int
+symbol_used_in_reloc_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+  return s->sy_used_in_reloc;
+}
+
+/* Mark a symbol as an MRI common symbol.  */
+
+void
+symbol_mark_mri_common (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_mri_common = 1;
+}
+
+/* Clear the mark of whether a symbol is an MRI common symbol.  */
+
+void
+symbol_clear_mri_common (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
+  s->sy_mri_common = 0;
+}
+
+/* Return whether a symbol is an MRI common symbol.  */
+
+int
+symbol_mri_common_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+  return s->sy_mri_common;
+}
+
+/* Mark a symbol as having been written.  */
+
+void
+symbol_mark_written (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
+  s->written = 1;
+}
+
+/* Clear the mark of whether a symbol has been written.  */
+
+void
+symbol_clear_written (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return;
+  s->written = 0;
+}
+
+/* Return whether a symbol has been written.  */
+
+int
+symbol_written_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+  return s->written;
+}
+
+/* Mark a symbol has having been resolved.  */
+
+void
+symbol_mark_resolved (s)
+     symbolS *s;
+{
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    {
+      local_symbol_mark_resolved ((struct local_symbol *) s);
+      return;
+    }
+#endif
+  s->sy_resolved = 1;
+}
+
+/* Return whether a symbol has been resolved.  */
+
+int
+symbol_resolved_p (s)
+     symbolS *s;
+{
+#ifdef BFD_ASSEMBLER
+  if (LOCAL_SYMBOL_CHECK (s))
+    return local_symbol_resolved_p ((struct local_symbol *) s);
+#endif
+  return s->sy_resolved;
+}
+
+/* Return whether a symbol is a section symbol.  */
+
+int
+symbol_section_p (s)
+     symbolS *s ATTRIBUTE_UNUSED;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+#ifdef BFD_ASSEMBLER
+  return (s->bsym->flags & BSF_SECTION_SYM) != 0;
+#else
+  /* FIXME */
+  return 0;
+#endif
+}
+
+/* Return whether a symbol is equated to another symbol.  */
+
+int
+symbol_equated_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+  return s->sy_value.X_op == O_symbol;
+}
+
+/* Return whether a symbol has a constant value.  */
+
+int
+symbol_constant_p (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 1;
+  return s->sy_value.X_op == O_constant;
+}
+
+#ifdef BFD_ASSEMBLER
+
+/* Return the BFD symbol for a symbol.  */
+
+asymbol *
+symbol_get_bfdsym (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  return s->bsym;
+}
+
+/* Set the BFD symbol for a symbol.  */
+
+void
+symbol_set_bfdsym (s, bsym)
+     symbolS *s;
+     asymbol *bsym;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->bsym = bsym;
+}
+
+#endif /* BFD_ASSEMBLER */
+
+#ifdef OBJ_SYMFIELD_TYPE
+
+/* Get a pointer to the object format information for a symbol.  */
+
+OBJ_SYMFIELD_TYPE *
+symbol_get_obj (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  return &s->sy_obj;
+}
+
+/* Set the object format information for a symbol.  */
+
+void
+symbol_set_obj (s, o)
+     symbolS *s;
+     OBJ_SYMFIELD_TYPE *o;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_obj = *o;
+}
+
+#endif /* OBJ_SYMFIELD_TYPE */
+
+#ifdef TC_SYMFIELD_TYPE
+
+/* Get a pointer to the processor information for a symbol.  */
+
+TC_SYMFIELD_TYPE *
+symbol_get_tc (s)
+     symbolS *s;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  return &s->sy_tc;
+}
+
+/* Set the processor information for a symbol.  */
+
+void
+symbol_set_tc (s, o)
+     symbolS *s;
+     TC_SYMFIELD_TYPE *o;
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    s = local_symbol_convert ((struct local_symbol *) s);
+  s->sy_tc = *o;
+}
+
+#endif /* TC_SYMFIELD_TYPE */
+
 void
 symbol_begin ()
 {
   symbol_lastP = NULL;
   symbol_rootP = NULL;		/* In case we have 0 symbols (!!) */
   sy_hash = hash_new ();
+#ifdef BFD_ASSEMBLER
+  local_hash = hash_new ();
+#endif
 
   memset ((char *) (&abs_symbol), '\0', sizeof (abs_symbol));
 #ifdef BFD_ASSEMBLER
@@ -1562,6 +2259,7 @@
     fb_label_init ();
 }
 
+
 
 int indent_level;
 
@@ -1588,28 +2286,44 @@
   if (!name || !name[0])
     name = "(unnamed)";
   fprintf (file, "sym %lx %s", (unsigned long) sym, name);
-  if (sym->sy_frag != &zero_address_frag)
-    fprintf (file, " frag %lx", (long) sym->sy_frag);
-  if (sym->written)
-    fprintf (file, " written");
-  if (sym->sy_resolved)
-    fprintf (file, " resolved");
-  else if (sym->sy_resolving)
-    fprintf (file, " resolving");
-  if (sym->sy_used_in_reloc)
-    fprintf (file, " used-in-reloc");
-  if (sym->sy_used)
-    fprintf (file, " used");
-  if (S_IS_LOCAL (sym))
-    fprintf (file, " local");
-  if (S_IS_EXTERN (sym))
-    fprintf (file, " extern");
-  if (S_IS_DEBUG (sym))
-    fprintf (file, " debug");
-  if (S_IS_DEFINED (sym))
-    fprintf (file, " defined");
+
+  if (LOCAL_SYMBOL_CHECK (sym))
+    {
+#ifdef BFD_ASSEMBLER
+      struct local_symbol *locsym = (struct local_symbol *) sym;
+      if (local_symbol_get_frag (locsym) != &zero_address_frag
+	  && local_symbol_get_frag (locsym) != NULL)
+	fprintf (file, " frag %lx", (long) local_symbol_get_frag (locsym));
+      if (local_symbol_resolved_p (locsym))
+	fprintf (file, " resolved");
+      fprintf (file, " local");
+#endif
+    }
+  else
+    {
+      if (sym->sy_frag != &zero_address_frag)
+	fprintf (file, " frag %lx", (long) sym->sy_frag);
+      if (sym->written)
+	fprintf (file, " written");
+      if (sym->sy_resolved)
+	fprintf (file, " resolved");
+      else if (sym->sy_resolving)
+	fprintf (file, " resolving");
+      if (sym->sy_used_in_reloc)
+	fprintf (file, " used-in-reloc");
+      if (sym->sy_used)
+	fprintf (file, " used");
+      if (S_IS_LOCAL (sym))
+	fprintf (file, " local");
+      if (S_IS_EXTERN (sym))
+	fprintf (file, " extern");
+      if (S_IS_DEBUG (sym))
+	fprintf (file, " debug");
+      if (S_IS_DEFINED (sym))
+	fprintf (file, " defined");
+    }
   fprintf (file, " %s", segment_name (S_GET_SEGMENT (sym)));
-  if (sym->sy_resolved)
+  if (symbol_resolved_p (sym))
     {
       segT s = S_GET_SEGMENT (sym);
 
@@ -1622,7 +2336,13 @@
     {
       indent_level++;
       fprintf (file, "\n%*s<", indent_level * 4, "");
-      print_expr_1 (file, &sym->sy_value);
+#ifdef BFD_ASSEMBLER
+      if (LOCAL_SYMBOL_CHECK (sym))
+	fprintf (file, "constant %lx",
+		 (long) ((struct local_symbol *) sym)->lsy_offset);
+      else
+#endif
+	print_expr_1 (file, &sym->sy_value);
       fprintf (file, ">");
       indent_level--;
     }
@@ -1780,6 +2500,11 @@
      FILE *file;
 {
   hash_print_statistics (file, "symbol table", sy_hash);
+#ifdef BFD_ASSEMBLER
+  hash_print_statistics (file, "mini local symbol table", local_hash);
+  fprintf (file, "%lu mini local symbols created, %lu converted\n",
+	   local_symbol_count, local_symbol_conversion_count);
+#endif
 }
 
 /* end of symbols.c */
diff --git a/gas/symbols.h b/gas/symbols.h
index c6efbdb..f3b73af 100644
--- a/gas/symbols.h
+++ b/gas/symbols.h
@@ -1,5 +1,6 @@
 /* symbols.h -
-   Copyright (C) 1987, 90, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1987, 90, 92, 93, 94, 95, 97, 1999
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -18,6 +19,18 @@
    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+#ifdef BFD_ASSEMBLER
+/* The BFD code wants to walk the list in both directions.  */
+#undef  SYMBOLS_NEED_BACKPOINTERS
+#define SYMBOLS_NEED_BACKPOINTERS
+#endif
+
+#ifndef BFD_ASSEMBLER
+/* The non-BFD code expects to be able to manipulate the symbol fields
+   directly.  */
+#include "struc-symbol.h"
+#endif
+
 extern struct obstack notes;	/* eg FixS live here. */
 
 extern struct obstack cond_obstack;	/* this is where we track .ifdef/.endif
@@ -49,6 +62,7 @@
 void symbol_print_statistics PARAMS ((FILE *));
 void symbol_table_insert PARAMS ((symbolS * symbolP));
 valueT resolve_symbol_value PARAMS ((symbolS *, int));
+void resolve_local_symbol_values PARAMS ((void));
 
 void print_symbol_value PARAMS ((symbolS *));
 void print_expr PARAMS ((expressionS *));
@@ -70,6 +84,7 @@
 extern void S_SET_VALUE PARAMS ((symbolS *, valueT));
 
 #ifdef BFD_ASSEMBLER
+extern int S_IS_FUNCTION PARAMS ((symbolS *));
 extern int S_IS_EXTERNAL PARAMS ((symbolS *));
 extern int S_IS_WEAK PARAMS ((symbolS *));
 extern int S_IS_COMMON PARAMS ((symbolS *));
@@ -87,4 +102,104 @@
 extern void S_SET_WEAK PARAMS ((symbolS *));
 #endif
 
+#ifndef WORKING_DOT_WORD
+struct broken_word
+  {
+    /* Linked list -- one of these structures per ".word x-y+C"
+       expression.  */
+    struct broken_word *next_broken_word;
+    /* Segment and subsegment for broken word.  */
+    segT seg;
+    subsegT subseg;
+    /* Which frag is this broken word in?  */
+    fragS *frag;
+    /* Where in the frag is it?  */
+    char *word_goes_here;
+    /* Where to add the break.  */
+    fragS *dispfrag;		/* where to add the break */
+    /* Operands of expression.  */
+    symbolS *add;
+    symbolS *sub;
+    offsetT addnum;
+
+    int added;			/* nasty thing happend yet? */
+    /* 1: added and has a long-jump */
+    /* 2: added but uses someone elses long-jump */
+
+    /* Pointer to broken_word with a similar long-jump.  */
+    struct broken_word *use_jump;
+  };
+extern struct broken_word *broken_words;
+#endif /* ndef WORKING_DOT_WORD */
+
+/*
+ * Current means for getting from symbols to segments and vice verse.
+ * This will change for infinite-segments support (e.g. COFF).
+ */
+extern const segT N_TYPE_seg[];	/* subseg.c */
+
+#define	SEGMENT_TO_SYMBOL_TYPE(seg)  ( seg_N_TYPE [(int) (seg)] )
+extern const short seg_N_TYPE[];/* subseg.c */
+
+#define	N_REGISTER	30	/* Fake N_TYPE value for SEG_REGISTER */
+
+void symbol_clear_list_pointers PARAMS ((symbolS * symbolP));
+
+#ifdef SYMBOLS_NEED_BACKPOINTERS
+
+void symbol_insert PARAMS ((symbolS * addme, symbolS * target,
+			    symbolS ** rootP, symbolS ** lastP));
+void symbol_remove PARAMS ((symbolS * symbolP, symbolS ** rootP,
+			    symbolS ** lastP));
+
+extern symbolS *symbol_previous PARAMS ((symbolS *));
+
+#endif /* SYMBOLS_NEED_BACKPOINTERS */
+
+void verify_symbol_chain PARAMS ((symbolS * rootP, symbolS * lastP));
+void verify_symbol_chain_2 PARAMS ((symbolS * symP));
+
+void symbol_append PARAMS ((symbolS * addme, symbolS * target,
+			    symbolS ** rootP, symbolS ** lastP));
+
+extern symbolS *symbol_next PARAMS ((symbolS *));
+
+extern expressionS *symbol_get_value_expression PARAMS ((symbolS *));
+extern void symbol_set_value_expression PARAMS ((symbolS *,
+						 const expressionS *));
+extern void symbol_set_frag PARAMS ((symbolS *, fragS *));
+extern fragS *symbol_get_frag PARAMS ((symbolS *));
+extern void symbol_mark_used PARAMS ((symbolS *));
+extern void symbol_clear_used PARAMS ((symbolS *));
+extern int symbol_used_p PARAMS ((symbolS *));
+extern void symbol_mark_used_in_reloc PARAMS ((symbolS *));
+extern void symbol_clear_used_in_reloc PARAMS ((symbolS *));
+extern int symbol_used_in_reloc_p PARAMS ((symbolS *));
+extern void symbol_mark_mri_common PARAMS ((symbolS *));
+extern void symbol_clear_mri_common PARAMS ((symbolS *));
+extern int symbol_mri_common_p PARAMS ((symbolS *));
+extern void symbol_mark_written PARAMS ((symbolS *));
+extern void symbol_clear_written PARAMS ((symbolS *));
+extern int symbol_written_p PARAMS ((symbolS *));
+extern void symbol_mark_resolved PARAMS ((symbolS *));
+extern int symbol_resolved_p PARAMS ((symbolS *));
+extern int symbol_section_p PARAMS ((symbolS *));
+extern int symbol_equated_p PARAMS ((symbolS *));
+extern int symbol_constant_p PARAMS ((symbolS *));
+
+#ifdef BFD_ASSEMBLER
+extern asymbol *symbol_get_bfdsym PARAMS ((symbolS *));
+extern void symbol_set_bfdsym PARAMS ((symbolS *, asymbol *));
+#endif
+
+#ifdef OBJ_SYMFIELD_TYPE
+OBJ_SYMFIELD_TYPE *symbol_get_obj PARAMS ((symbolS *));
+void symbol_set_obj PARAMS ((symbolS *, OBJ_SYMFIELD_TYPE *));
+#endif
+
+#ifdef TC_SYMFIELD_TYPE
+TC_SYMFIELD_TYPE *symbol_get_tc PARAMS ((symbolS *));
+void symbol_set_tc PARAMS ((symbolS *, TC_SYMFIELD_TYPE *));
+#endif
+
 /* end of symbols.h */
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index d8f8656..719f922 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,355 @@
+2000-04-01  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* gas/mn10300/am33_5.s: Check that negative SP offsets are encoded
+	with 32 bits, not with the unsigned shorter opcodes.
+	* gas/mn10300/basic.exp: Likewise.
+
+2000-03-31  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* lib/gas-defs.exp (regexp_diff): Don't break on the first
+	difference, list them all.
+
+2000-03-29  Nick Clifton <nickc@cygnus.com
+
+	* gas/arm/thumb.s: Add test of bal instruction.
+
+2000-03-27  Alan Modra  <alan@linuxcare.com.au>
+
+	* gas/ieee-fp/x930509a.exp (dotest): Fix test for
+	LISTING_WORD_SIZE==1.
+	* gas/all/gas.exp (do_930509a): Same here.
+	* gas/all/cond.d: And here.
+
+2000-03-16  Nick Clifton  <nickc@cygnus.com>
+
+	* gas/arm/arm.exp: Run branch.s test.
+	Run tests if target is strongarm.
+
+	* gas/arm/branch.s: New test.  Make sure that assembler can handle
+	same-section branch relocations properly.
+
+	* gas/arm/branch.d: New file.  Expected output from assembling
+	branch.s.
+
+2000-03-10  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* gas/mips/empic.d: New file.
+	* gas/mips/empic.s: New file.
+	* gas/mips/mips16-e.d: New file.
+	* gas/mips/mips16-e.s: New file.
+	* gas/mips/mips16-f.d: New file.
+	* gas/mips/mips16-f.s: New file.
+	* gas/mips/mips.exp: Add empic, mips16-e.  Add mips16-f as an
+	expected failure.
+
+2000-02-25  H.J. Lu <hjl@gnu.org>
+
+	* gas/i386/general.l: Support a.out and coff.
+
+2000-02-25  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/intel.s: New file, intel version of opcode.s
+	* gas/i386/intel.d: New file, copy of opcode.d
+	* gas/i386/i386.exp: Call it.
+
+	* gas/i386/general.s: Add extra "out" instructions.
+	* gas/i386/general.l: Likewise.
+
+2000-01-31  Nick Clifton  <nickc@cygnus.com>
+
+	* gas/arm/inst.s: Include test of ATPCS register naming
+	conventions.
+
+	* gas/arm/float.s: Include test of ATPCS register naming
+	conventions.
+
+Fri Jan 21 12:48:06 2000  H.J. Lu <hjl@gnu.org>
+
+	* gas/i386/general.l: Support a.out.
+	* gas/i386/jump.d: Likewise.
+	* gas/i386/jump16.d: Likewise.
+
+2000-01-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/general.{s,l}: Move 16 bit jmp and call tests from here
+	* gas/i386/jump16.{s,d}: To here.
+	* gas/i386/jump.{s,d}: New files.  Duplicate 32 bit jmp and call
+	tests in general.s so that objdump is exercised.
+
+	* gas/i386/i386.exp: Call new tests.
+
+2000-01-15  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/general.{s,l}: Add jmp and call tests for .code16gcc,
+	.code16, and .code32 modes.
+
+Tue Nov 30 23:02:01 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* gas/mn10300/{am33.s, am33_2.s, am33_3.s}: New test files.
+	* gas/mn10300/{am33_4.s, am33_5.s, am33_6.s}: Likewise.
+	* gas/mn10300/{am33_7.s, am33_8.s}: Likewise.
+	* gas/mn10300/basic.exp: Run the am33 tests.
+
+1999-11-15  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* gas/mips/la.d: Adjust for new la macro expansion.
+	Change matches for explicit addresses to matches for
+	any address.
+	* gas/mips/la-xgot.d: Same.
+	* gas/mips/la-svr4pic.d: Same.
+
+1999-11-01  Nick Clifton  <nickc@cygnus.com>
+
+	Remove reloc generating references to local labels in test code.
+	Some ARM targets (eg PE) generate a reloc based on the label,
+	whilst others (eg ELF) generate a reloc based on the section
+	symbol.  This meant that the disassembled outputs would differ.
+	
+	* gas/arm/inst.s: Change test of BLPL instruction.
+	* gas/arm/inst.d: Change expected decode of BLPL instruction.
+	* gas/arm/arm7t.s: Remove use of .LC0 label in .word directive.
+	Remove .rdata section, since this cannot exist in an arm-aout
+	target.
+	* gas/arm/arm7t.d: Change expected reloc generated for .word
+	directive.
+
+1999-10-21  Nick Clifton  <nickc@cygnus.com>
+
+	* gas/arm/arm7t.d: Update to match latest objdump output.
+	* gas/arm/inst.s: Fix erroneous test case.
+	* gas/arm/inst.d: Update to match latest objdump output.
+
+Mon Oct 11 13:37:51 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* lib/gas-defs.exp (regexp_diff): Allow '#...' to mean "some
+ 	indeterminate number of extra lines here".
+
+	* gas/elf/elf.exp: Remove XFAILs.
+	* gas/elf/section0.d: Make pass on MIPS (and hopefully alpha).
+	* gas/elf/section1.d: Likewise.
+
+Thu Oct  7 00:12:04 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* gas/d10v: New directory.
+	* gas/d10v/d10.exp: New file.
+	* gas/d10v/inst.s: New file.
+	* gas/d10v/inst.d: New file.
+
+Thu Oct  7 12:52:25 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* gas/mips/elf-rel.s: New file.
+	* gas/mips/elf-rel.d: New file.
+	* gas/mips/elf-rel2.d: New file.
+	* gas/mips/e32-rel2.d: New file.
+	* gas/mips/elf-rel2.s: New file.
+	* gas/mips/mips.exp: Add elf-rel, elf-rel2.
+
+	* gas/mips/elf_e_flags1.d: Tweak a little so it passes
+	even if the CPU is set to something by default.
+
+Mon Oct  4 18:25:49 1999  Doug Evans  <devans@canuck.cygnus.com>
+
+	* gas/m32r/error.exp: New testcase driver.
+	* gas/m32r/m32rx.exp: New testcase driver.
+	* gas/m32r/fslotx.[sd]: New testcase.
+	* gas/m32r/m32rx.[sd]: New testcase.
+	* gas/m32r/relax-s.[sd]: New testcase.
+	* gas/m32r/interfere.s: New testcase.
+	* gas/m32r/wrongsize.s: New testcase.
+
+1999-09-17  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/i386.exp: Enable reloc and white tests for COFF.
+	* gas/i386/reloc.d: Accept dir32 relocs.
+
+1999-09-12  Donn Terry  <donn@interix.com>
+
+	* gas/all/gas.exp: Run cofftag test for i*86-*-interix*.
+	* lib/gas-defs.exp: Add perror if can not read .d file.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* gas/pj/{pj.exp, ops.c, ops.d}: New tests for picoJava.
+
+1999-09-02  Nick Clifton  <nickc@cygnus.com>
+
+	* gas/vtable/vtable.exp: Add [istarget "strongarm*-*-*"] to run
+	dump  test "entry0" instead of "entry1".
+	
+1999-09-01  Scott Bambrough  <scottb@netwinder.org>
+ 
+        * gas/vtable/vtable.exp: Added [istarget "arm*-*-*"] to run dump 
+        test "entry0" instead of "entry1".  ARM targets use REL relocs,
+        and should use the test entry0.
+
+1999-09-01  H.J. Lu  <hjl@gnu.org>
+
+	* gas/i386/naked.d: Fix for coff targets.
+
+Mon Aug 30 12:18:40 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* gas/hppa/unsorted/*.s: Use .code instead of .SPACE/.SUBSPA for
+	sectioning.
+	* gas/hppa/unsorted/unsorted.exp: Disable tests not appropriate for
+	PA64.
+
+	* gas/hppa/reloc/*.s: Use .code instead of .SPACE/.SUBSPA for
+	sectioning.
+	* gas/hppa/parse/parse.exp: Disable tests not appropriate for PA64.
+	Revamp address expressions slightly to handle an arbitrary sized
+	address.
+
+	* gas/hppa/parse/*.s: Use .code instead of .SPACE/.SUBSPA for
+	sectioning.
+	* gas/hppa/parse/parse.exp: Disable tests not appropriate for PA64.
+
+	* gas/hppa/basic/*.s: Use .code instead of .SPACE/.SUBSPA for
+	sectioning.
+
+1999-08-30  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/naked.s, gas/i386/naked.d: Test-suite addition for
+	allow_naked_reg parsing.
+	* gas/i386/i386.exp: Call it.
+
+1999-08-29  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/white.s, gas/i386/white.l: Add space in FP reg tests.
+
+Sat Aug 28 00:16:12 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* gas/hppa/basic/basic.exp:  Add new tests shift2.s,
+	shift3.s, extract2.s, extract3.s, deposit2.s, and deposit3.s.
+	* gas/hppa/basic/shift2.s, shift3.s, extract2.s,
+	extract3.s, deposit2.s, deposit3.s:  New.
+
+	* gas/hppa/basic/add.s,addi.s,dcor.s,shladd.s,sub.s,subi.s,unit.s:
+	Add new syntax versions of instructions to tests. 
+	* gas/hppa/basic/add2.s,dcor2.s,perf.s,purge2.s,shladd2.s,sub2.s,
+	system2.s, unit2.s:  New tests.
+	* hppa/basic/basic.exp: Add new tests.
+
+	* gas/hppa/basic/basic.exp:
+	* gas/hppa/basic/media.s:  Add test cases for new instructions.
+
+	* gas/hppa/basic/basic.exp (do_branch2,do_media): New.
+	* gas/hppa/basic/branch2.s:  New.
+	* gas/hppa/basic/media.s:  New.
+
+	* gas/hppa/basic/basic.exp (do_fp_comp2):  New.
+	* gas/hppa/basic/fp_comp2.s:  New.
+
+1999-08-20  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/general.s, gas/i386/general.l: Add .code16gcc
+	displacement checks with auto address prefix.
+
+1999-08-17  H.J. Lu  <hjl@gnu.org>
+
+	* gas/elf/elf.exp: Expected to fail on alpha*-*-*.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	* gas/i386/float.s, gas/i386/float.l: Modify to work correctly
+	when gas uses 2**4 alignment for .text.
+	* gas/i386/general.s, gas/i386/general.l: Likewise.
+	* gas/i386/katmai.s, gas/i386/katmai.d: Likewise.
+	* gas/i386/modrm.s, gas/i386/modrm.l: Likewise.
+	* gas/i386/prefix.s, gas/i386/prefix.d: Likewise.
+
+1999-07-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/reloc.d: Fix so that test passes when enable-targets
+	includes 64-bit bfd target.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* gas/i386/katmai.d: Tweak for recent disassembler changes.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* gas/elf/elf.exp: Don't run tests on "*-*-linux*aout*" or
+	"*-*-linux*oldld*".
+	* gas/vtable/vtable.exp: Likewise.
+	* gas/i386/reloc.d: Modify expected reloc names to accept a.out
+	names.
+
+	* gas/i386/amd.s: Add a symbol so a.out tests will work.
+	* gas/i386/katmai.s: Likewise.
+	* gas/i386/amd.d: Corresponding change.
+	* gas/i386/katmai.d: Corresponding change.
+
+1999-06-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* gas/mips/sync.d: Pass -mips2 to the assembler.
+
+	* gas/mips/elf_e_flags.s: Tweak code so that the tests pass for
+	mips-elf target as well as mips64-elf target.
+	* gas/mips/elf_e_flags1.d: Corresponding changes.
+	* gas/mips/elf_e_flags2.d: Likewise.
+	* gas/mips/elf_e_flags3.d: Likewise.
+	* gas/mips/elf_e_flags4.d: Likewise.
+
+	* gas/elf/elf.exp: Add setup_xfail for mips*-*-*.
+
+	* gas/all/itbl-test.c (main): Update itbl_get_reg_val call for new
+	parameter.
+
+1999-06-10  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* gas/sparc/synth64.s: Add checks for single register signx/clruw.
+	* gas/sparc/set64.s: Add tests for setuw and setsw synthetic insns.
+	* gas/sparc/prefetch.d: Add -64 as switch.
+	* gas/sparc/rdpr.d: Ditto.
+	* gas/sparc/wrpr.d: Ditto.
+	* gas/sparc/synth64.d: Ditto, reflect synth64.s changes.
+	* gas/sparc/reloc64.d: Add -64 as switch, be more tolerant, as
+	current gas outputs %hi(0) and not %hi(0x0).
+	* gas/sparc/set64.d: Add -64 as switch, reflect set64.s changes and
+	optimizations for setx instruction.
+	* gas/sparc/sparc.exp: Do sparc64*-*-* checks if it is any of the
+	compiled-in targets.
+
+1999-06-10  Richard Henderson  <rth@cygnus.com>
+
+	* gas/macros/irp.s: Use `foo' and `bar' instead of `r' and `s'.
+	* gas/macros/rept.s, gas/macros/test2.s, gas/macros/test3.s: Likewise.
+	* gas/macros/{irp,rept,test2,test3}.d: Update.
+
+1999-06-05  Richard Henderson  <rth@cygnus.com>
+
+	* gas/elf/elf.exp: New directory.
+	* gas/elf/section0.[sd]: New test.
+	* gas/elf/section1.[sd]: New test.
+
+1999-06-03  Philip Blundell  <philb@gnu.org>
+
+	* gas/arm/arm7t.d, gas/arm/inst.d: Update to match current gas,
+ 	bfd and opcodes.
+
+1999-05-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* gas/vtable/vtable.exp: Don't run test for i960 yet.
+
+1999-05-17  Nick Clifton  <nickc@cygnus.com>
+
+	* gas/mcore/allinsn.d: Updated to match latest objdump output.
+
+1999-05-12  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* gas/i386/opcode.d: Modify callw to suit disasm fix.
+
+	* gas/i386/amd.d: Modify a '(bad)' to SIMD instruction.
+
+	* gas/i386/amd.s: Pad to multiple of 8
+	* gas/i386/amd.d: Here too.
+
+	* gas/i386/prefix.[sd]: Align with nops
+	* gas/i386/reloc.[sd]: Here too.
+
+	* gas/i386/katmai.[sd]: New for PIII SIMD
+	* gas/i386/i386.exp: Call it.
+
 1999-05-02  Nick Clifton  <nickc@cygnus.com>
 
 	* gas/mcore/allinsn.d: Update to match latest assembler
diff --git a/gas/testsuite/gas/all/cond.d b/gas/testsuite/gas/all/cond.d
index 4ee3942..a496287 100644
--- a/gas/testsuite/gas/all/cond.d
+++ b/gas/testsuite/gas/all/cond.d
@@ -7,14 +7,14 @@
    8[ 	]+.else
    9[ 	]+.if	1
   10[ 	]+.endc
-  11 0000 0[02]00 ?000[02][ 	]+.long[ 	]+2
+  11 0000 0[02] ?00 ?00 ?0[02][ 	]+.long[ 	]+2
   12[ 	]+.if	0
   14[ 	]+.else
-  15 0004 0[04]00 ?000[04][ 	]+.long[ 	]+4
+  15 0004 0[04] ?00 ?00 ?0[04][ 	]+.long[ 	]+4
   16[ 	]+.endc
   17[ 	]+.endc
-  18 0008 0000 ?0000[ 	]+.p2align 5,0
-  18[ 	]+0000 ?0000 
-  18[ 	]+0000 ?0000 
-  18[ 	]+0000 ?0000 
-  18[ 	]+0000 ?0000 
+  18 0008 00 ?00 ?00 ?00[ 	]+.p2align 5,0
+  18[ 	]+00 ?00 ?00 ?00 
+  18[ 	]+00 ?00 ?00 ?00 
+  18[ 	]+00 ?00 ?00 ?00 
+  18[ 	]+00 ?00 ?00 ?00 
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index 9544551..49d9421 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -65,9 +65,9 @@
 # If ".long" means an 8-byte value on some target someday, this test will have
 # to be fixed.
 	expect {
-	    -re "^ +1 .... 0000 *0000" { fail $testname; set x 1 }
-	    -re "^ +1 .... 0400 *0000" { pass $testname; set x 1 }
-	    -re "^ +1 .... 0000 *0004" { pass $testname; set x 1 }
+	    -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
+	    -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
+	    -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
 	    -re "\[^\n\]*\n" { }
 	    timeout { perror "timeout\n"; break }
 	    eof { break }
@@ -112,6 +112,7 @@
      || [istarget i*86-*-go32*] \
      || [istarget i*86-*-cygwin*] \
      || [istarget i*86-*-*nt] \
+     || [istarget i*86-*-interix*] \
      || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
     run_dump_test cofftag
 }
@@ -123,7 +124,7 @@
     global subdir
 
     set testname "conditional listings"
-    gas_run cond.s -alc ">dump.out"
+    gas_run cond.s "-alc" ">dump.out"
     if ![string match "" $comp_output] {
 	send_log "$comp_output\n"
 	fail $testname
diff --git a/gas/testsuite/gas/all/itbl-test.c b/gas/testsuite/gas/all/itbl-test.c
index 023f5d9..d97454e 100644
--- a/gas/testsuite/gas/all/itbl-test.c
+++ b/gas/testsuite/gas/all/itbl-test.c
@@ -118,8 +118,8 @@
 	    n, processor, type, val);
 
   /* We require that names be unique amoung processors and types. */
-  v = itbl_get_reg_val (name);
-  if (!v || v != val)
+  if (! itbl_get_reg_val (name, &v)
+      || v != val)
     printf ("Error - reg val not found for processor=%d, type=%d, name=%s\n",
 	    processor, type, name);
   else
diff --git a/gas/testsuite/gas/arm/arm7t.d b/gas/testsuite/gas/arm/arm7t.d
index 143a161..1e214ee 100644
--- a/gas/testsuite/gas/arm/arm7t.d
+++ b/gas/testsuite/gas/arm/arm7t.d
@@ -15,9 +15,9 @@
 00000014 <[^>]*> e1f100bc ?	ldrh	r0, \[r1, #12\]!
 00000018 <[^>]*> e15100bc ?	ldrh	r0, \[r1, -#12\]
 0000001c <[^>]*> e09100b2 ?	ldrh	r0, \[r1\], r2
-00000020 <[^>]*> e3a00cff ?	mov	r0, #65280
-00000024 <[^>]*> e1df0bb4 ?	ldrh	r0, 000000e0 <\$\$lit_1>
-00000028 <[^>]*> e1df0abc ?	ldrh	r0, 000000dc <.L2>
+00000020 <[^>]*> e3a00cff ?	mov	r0, #65280	; 0xff00
+00000024 <[^>]*> e1df0bb4 ?	ldrh	r0, \[pc, #b4\]	; 000000e0 <[^>]*>
+00000028 <[^>]*> e1df0abc ?	ldrh	r0, \[pc, #ac\]	; 000000dc <[^>]*>
 0000002c <[^>]*> e1c100b0 ?	strh	r0, \[r1\]
 00000030 <[^>]*> e1e100b0 ?	strh	r0, \[r1\]!
 00000034 <[^>]*> e18100b2 ?	strh	r0, \[r1, r2\]
@@ -26,7 +26,7 @@
 00000040 <[^>]*> e1e100bc ?	strh	r0, \[r1, #12\]!
 00000044 <[^>]*> e14100bc ?	strh	r0, \[r1, -#12\]
 00000048 <[^>]*> e08100b2 ?	strh	r0, \[r1\], r2
-0000004c <[^>]*> e1cf08b8 ?	strh	r0, 000000dc <.L2>
+0000004c <[^>]*> e1cf08b8 ?	strh	r0, \[pc, #88\]	; 000000dc <[^>]*>
 00000050 <[^>]*> e1d100d0 ?	ldrsb	r0, \[r1\]
 00000054 <[^>]*> e1f100d0 ?	ldrsb	r0, \[r1\]!
 00000058 <[^>]*> e19100d2 ?	ldrsb	r0, \[r1, r2\]
@@ -35,8 +35,8 @@
 00000064 <[^>]*> e1f100dc ?	ldrsb	r0, \[r1, #12\]!
 00000068 <[^>]*> e15100dc ?	ldrsb	r0, \[r1, -#12\]
 0000006c <[^>]*> e09100d2 ?	ldrsb	r0, \[r1\], r2
-00000070 <[^>]*> e3a000de ?	mov	r0, #222
-00000074 <[^>]*> e1df06d0 ?	ldrsb	r0, 000000dc <.L2>
+00000070 <[^>]*> e3a000de ?	mov	r0, #222	; 0xde
+00000074 <[^>]*> e1df06d0 ?	ldrsb	r0, \[pc, #60\]	; 000000dc <[^>]*>
 00000078 <[^>]*> e1d100f0 ?	ldrsh	r0, \[r1\]
 0000007c <[^>]*> e1f100f0 ?	ldrsh	r0, \[r1\]!
 00000080 <[^>]*> e19100f2 ?	ldrsh	r0, \[r1, r2\]
@@ -45,9 +45,9 @@
 0000008c <[^>]*> e1f100fc ?	ldrsh	r0, \[r1, #12\]!
 00000090 <[^>]*> e15100fc ?	ldrsh	r0, \[r1, -#12\]
 00000094 <[^>]*> e09100f2 ?	ldrsh	r0, \[r1\], r2
-00000098 <[^>]*> e3a00cff ?	mov	r0, #65280
-0000009c <[^>]*> e1df03fc ?	ldrsh	r0, 000000e0 <\$\$lit_1>
-000000a0 <[^>]*> e1df03f4 ?	ldrsh	r0, 000000dc <.L2>
+00000098 <[^>]*> e3a00cff ?	mov	r0, #65280	; 0xff00
+0000009c <[^>]*> e1df03fc ?	ldrsh	r0, \[pc, #3c\]	; 000000e0 <[^>]*>
+000000a0 <[^>]*> e1df03f4 ?	ldrsh	r0, \[pc, #34\]	; 000000dc <[^>]*>
 000000a4 <[^>]*> e19100b2 ?	ldrh	r0, \[r1, r2\]
 000000a8 <[^>]*> 119100b2 ?	ldrneh	r0, \[r1, r2\]
 000000ac <[^>]*> 819100b2 ?	ldrhih	r0, \[r1, r2\]
@@ -60,9 +60,9 @@
 000000c8 <[^>]*> 119100d2 ?	ldrnesb	r0, \[r1, r2\]
 000000cc <[^>]*> 819100d2 ?	ldrhisb	r0, \[r1, r2\]
 000000d0 <[^>]*> b19100d2 ?	ldrltsb	r0, \[r1, r2\]
-000000d4 <[^>]*> e1df00f4 ?	ldrsh	r0, 000000e0 <\$\$lit_1>
-000000d8 <[^>]*> e1df00f4 ?	ldrsh	r0, 000000e4 <\$\$lit_1\+0x4>
+000000d4 <[^>]*> e1df00f4 ?	ldrsh	r0, \[pc, #4\]	; 000000e0 <[^>]*>
+000000d8 <[^>]*> e1df00f4 ?	ldrsh	r0, \[pc, #4\]	; 000000e4 <[^>]*>
 000000dc <[^>]*> 00000000 ?	andeq	r0, r0, r0
-[		]*dc:.*.LC0
+[		]*dc:.*fred
 000000e0 <[^>]*> 0000c0de ?	.*
 000000e4 <[^>]*> 0000dead ?	.*
diff --git a/gas/testsuite/gas/arm/arm7t.s b/gas/testsuite/gas/arm/arm7t.s
index 656e90e..d155752 100644
--- a/gas/testsuite/gas/arm/arm7t.s
+++ b/gas/testsuite/gas/arm/arm7t.s
@@ -1,8 +1,3 @@
-	.section	.rdata
-	.align	0
-.LC0:
-	.ascii	"some data\000"
-
 	.text
 	.align	0
 
@@ -76,4 +71,4 @@
 
 	.align
 .L2:
-	.word	.LC0
+	.word	fred
diff --git a/gas/testsuite/gas/arm/float.s b/gas/testsuite/gas/arm/float.s
index 48aee96..49df454 100644
--- a/gas/testsuite/gas/arm/float.s
+++ b/gas/testsuite/gas/arm/float.s
@@ -4,21 +4,21 @@
 	mvfeqe	f3, f5
 	mvfeqd	f4, #1.0
 	mvfs	f4, f7
-	mvfsp	f0, f1
-	mvfdm	f3, f4
-	mvfez	f7, f7
+	mvfsp	s0, s1
+	mvfdm	s3, s4
+	mvfez	s7, s7
 
 	adfe	f0, f1, #2.0
-	adfeqe	f1, f2, #0.5
-	adfsm	f3, f4, f5
+	adfeqe	f1, s2, #0.5
+	adfsm	f3, f4, s5
 	
-	sufd	f0, f0, #2.0
-	sufs	f1, f2, #10.0
-	sufneez f3, f4, f5
+	sufd	d0, f0, #2.0
+	sufs	d1, d2, #10.0
+	sufneez d3, d4, d5
 
 	rsfs	f1, f1, #0.0
 	rsfdp	f3, f0, #5.0
-	rsfled	f7, f6, f0
+	rsfled	f7, s6, f0
 
 	mufd	f0, f0, f0
 	mufez	f1, f2, #3.0
@@ -34,9 +34,9 @@
 
 	powd	f0, f2, f3
 	pows	f1, f3, #0e1e1
-	powcsez	f4, f7, #1
+	powcsez	f4, d7, #1
 
-	rpws	f7, f6, f7
+	rpws	f7, d6, f7
 	rpweqd	f0, f1, f2
 	rpwem	f2, f2, f3
 
diff --git a/gas/testsuite/gas/arm/inst.d b/gas/testsuite/gas/arm/inst.d
index decb8f0..9566adb 100644
--- a/gas/testsuite/gas/arm/inst.d
+++ b/gas/testsuite/gas/arm/inst.d
@@ -7,20 +7,20 @@
 .*: +file format .*arm.*
 
 Disassembly of section .text:
-00000000 <[^>]*> e3a00000 ?	mov	r0, #0
+00000000 <[^>]*> e3a00000 ?	mov	r0, #0	; 0x0
 00000004 <[^>]*> e1a01002 ?	mov	r1, r2
 00000008 <[^>]*> e1a03184 ?	mov	r3, r4, lsl #3
 0000000c <[^>]*> e1a05736 ?	mov	r5, r6, lsr r7
-00000010 <[^>]*> e1a08a59 ?	mov	r8, r9, asr sl
-00000014 <[^>]*> e1a0bd1c ?	mov	fp, ip, lsl sp
+00000010 <[^>]*> e1a08a59 ?	mov	r8, r9, asr r10
+00000014 <[^>]*> e1a0bd1c ?	mov	r11, r12, lsl sp
 00000018 <[^>]*> e1a0e06f ?	mov	lr, pc, rrx
 0000001c <[^>]*> e1a01002 ?	mov	r1, r2
 00000020 <[^>]*> 01a02003 ?	moveq	r2, r3
 00000024 <[^>]*> 11a04005 ?	movne	r4, r5
 00000028 <[^>]*> b1a06007 ?	movlt	r6, r7
 0000002c <[^>]*> a1a08009 ?	movge	r8, r9
-00000030 <[^>]*> d1a0a00b ?	movle	sl, fp
-00000034 <[^>]*> c1a0c00d ?	movgt	ip, sp
+00000030 <[^>]*> d1a0a00b ?	movle	r10, r11
+00000034 <[^>]*> c1a0c00d ?	movgt	r12, sp
 00000038 <[^>]*> 31a01002 ?	movcc	r1, r2
 0000003c <[^>]*> 21a01003 ?	movcs	r1, r3
 00000040 <[^>]*> 41a03006 ?	movmi	r3, r6
@@ -33,79 +33,79 @@
 0000005c <[^>]*> 31a01003 ?	movcc	r1, r3
 00000060 <[^>]*> e1b00008 ?	movs	r0, r8
 00000064 <[^>]*> 31b00007 ?	movccs	r0, r7
-00000068 <[^>]*> e281000a ?	add	r0, r1, #10
+00000068 <[^>]*> e281000a ?	add	r0, r1, #10	; 0xa
 0000006c <[^>]*> e0832004 ?	add	r2, r3, r4
 00000070 <[^>]*> e0865287 ?	add	r5, r6, r7, lsl #5
 00000074 <[^>]*> e0821113 ?	add	r1, r2, r3, lsl r1
-00000078 <[^>]*> e201000a ?	and	r0, r1, #10
+00000078 <[^>]*> e201000a ?	and	r0, r1, #10	; 0xa
 0000007c <[^>]*> e0032004 ?	and	r2, r3, r4
 00000080 <[^>]*> e0065287 ?	and	r5, r6, r7, lsl #5
 00000084 <[^>]*> e0021113 ?	and	r1, r2, r3, lsl r1
-00000088 <[^>]*> e221000a ?	eor	r0, r1, #10
+00000088 <[^>]*> e221000a ?	eor	r0, r1, #10	; 0xa
 0000008c <[^>]*> e0232004 ?	eor	r2, r3, r4
 00000090 <[^>]*> e0265287 ?	eor	r5, r6, r7, lsl #5
 00000094 <[^>]*> e0221113 ?	eor	r1, r2, r3, lsl r1
-00000098 <[^>]*> e241000a ?	sub	r0, r1, #10
+00000098 <[^>]*> e241000a ?	sub	r0, r1, #10	; 0xa
 0000009c <[^>]*> e0432004 ?	sub	r2, r3, r4
 000000a0 <[^>]*> e0465287 ?	sub	r5, r6, r7, lsl #5
 000000a4 <[^>]*> e0421113 ?	sub	r1, r2, r3, lsl r1
-000000a8 <[^>]*> e2a1000a ?	adc	r0, r1, #10
+000000a8 <[^>]*> e2a1000a ?	adc	r0, r1, #10	; 0xa
 000000ac <[^>]*> e0a32004 ?	adc	r2, r3, r4
 000000b0 <[^>]*> e0a65287 ?	adc	r5, r6, r7, lsl #5
 000000b4 <[^>]*> e0a21113 ?	adc	r1, r2, r3, lsl r1
-000000b8 <[^>]*> e2c1000a ?	sbc	r0, r1, #10
+000000b8 <[^>]*> e2c1000a ?	sbc	r0, r1, #10	; 0xa
 000000bc <[^>]*> e0c32004 ?	sbc	r2, r3, r4
 000000c0 <[^>]*> e0c65287 ?	sbc	r5, r6, r7, lsl #5
 000000c4 <[^>]*> e0c21113 ?	sbc	r1, r2, r3, lsl r1
-000000c8 <[^>]*> e261000a ?	rsb	r0, r1, #10
+000000c8 <[^>]*> e261000a ?	rsb	r0, r1, #10	; 0xa
 000000cc <[^>]*> e0632004 ?	rsb	r2, r3, r4
 000000d0 <[^>]*> e0665287 ?	rsb	r5, r6, r7, lsl #5
 000000d4 <[^>]*> e0621113 ?	rsb	r1, r2, r3, lsl r1
-000000d8 <[^>]*> e2e1000a ?	rsc	r0, r1, #10
+000000d8 <[^>]*> e2e1000a ?	rsc	r0, r1, #10	; 0xa
 000000dc <[^>]*> e0e32004 ?	rsc	r2, r3, r4
 000000e0 <[^>]*> e0e65287 ?	rsc	r5, r6, r7, lsl #5
 000000e4 <[^>]*> e0e21113 ?	rsc	r1, r2, r3, lsl r1
-000000e8 <[^>]*> e381000a ?	orr	r0, r1, #10
+000000e8 <[^>]*> e381000a ?	orr	r0, r1, #10	; 0xa
 000000ec <[^>]*> e1832004 ?	orr	r2, r3, r4
 000000f0 <[^>]*> e1865287 ?	orr	r5, r6, r7, lsl #5
 000000f4 <[^>]*> e1821113 ?	orr	r1, r2, r3, lsl r1
-000000f8 <[^>]*> e3c1000a ?	bic	r0, r1, #10
+000000f8 <[^>]*> e3c1000a ?	bic	r0, r1, #10	; 0xa
 000000fc <[^>]*> e1c32004 ?	bic	r2, r3, r4
 00000100 <[^>]*> e1c65287 ?	bic	r5, r6, r7, lsl #5
 00000104 <[^>]*> e1c21113 ?	bic	r1, r2, r3, lsl r1
-00000108 <[^>]*> e3e0000a ?	mvn	r0, #10
+00000108 <[^>]*> e3e0000a ?	mvn	r0, #10	; 0xa
 0000010c <[^>]*> e1e02004 ?	mvn	r2, r4
 00000110 <[^>]*> e1e05287 ?	mvn	r5, r7, lsl #5
 00000114 <[^>]*> e1e01113 ?	mvn	r1, r3, lsl r1
-00000118 <[^>]*> e310000a ?	tst	r0, #10
+00000118 <[^>]*> e310000a ?	tst	r0, #10	; 0xa
 0000011c <[^>]*> e1120004 ?	tst	r2, r4
 00000120 <[^>]*> e1150287 ?	tst	r5, r7, lsl #5
 00000124 <[^>]*> e1110113 ?	tst	r1, r3, lsl r1
-00000128 <[^>]*> e330000a ?	teq	r0, #10
+00000128 <[^>]*> e330000a ?	teq	r0, #10	; 0xa
 0000012c <[^>]*> e1320004 ?	teq	r2, r4
 00000130 <[^>]*> e1350287 ?	teq	r5, r7, lsl #5
 00000134 <[^>]*> e1310113 ?	teq	r1, r3, lsl r1
-00000138 <[^>]*> e350000a ?	cmp	r0, #10
+00000138 <[^>]*> e350000a ?	cmp	r0, #10	; 0xa
 0000013c <[^>]*> e1520004 ?	cmp	r2, r4
 00000140 <[^>]*> e1550287 ?	cmp	r5, r7, lsl #5
 00000144 <[^>]*> e1510113 ?	cmp	r1, r3, lsl r1
-00000148 <[^>]*> e370000a ?	cmn	r0, #10
+00000148 <[^>]*> e370000a ?	cmn	r0, #10	; 0xa
 0000014c <[^>]*> e1720004 ?	cmn	r2, r4
 00000150 <[^>]*> e1750287 ?	cmn	r5, r7, lsl #5
 00000154 <[^>]*> e1710113 ?	cmn	r1, r3, lsl r1
-00000158 <[^>]*> e330f00a ?	teqp	r0, #10
+00000158 <[^>]*> e330f00a ?	teqp	r0, #10	; 0xa
 0000015c <[^>]*> e132f004 ?	teqp	r2, r4
 00000160 <[^>]*> e135f287 ?	teqp	r5, r7, lsl #5
 00000164 <[^>]*> e131f113 ?	teqp	r1, r3, lsl r1
-00000168 <[^>]*> e370f00a ?	cmnp	r0, #10
+00000168 <[^>]*> e370f00a ?	cmnp	r0, #10	; 0xa
 0000016c <[^>]*> e172f004 ?	cmnp	r2, r4
 00000170 <[^>]*> e175f287 ?	cmnp	r5, r7, lsl #5
 00000174 <[^>]*> e171f113 ?	cmnp	r1, r3, lsl r1
-00000178 <[^>]*> e350f00a ?	cmpp	r0, #10
+00000178 <[^>]*> e350f00a ?	cmpp	r0, #10	; 0xa
 0000017c <[^>]*> e152f004 ?	cmpp	r2, r4
 00000180 <[^>]*> e155f287 ?	cmpp	r5, r7, lsl #5
 00000184 <[^>]*> e151f113 ?	cmpp	r1, r3, lsl r1
-00000188 <[^>]*> e310f00a ?	tstp	r0, #10
+00000188 <[^>]*> e310f00a ?	tstp	r0, #10	; 0xa
 0000018c <[^>]*> e112f004 ?	tstp	r2, r4
 00000190 <[^>]*> e115f287 ?	tstp	r5, r7, lsl #5
 00000194 <[^>]*> e111f113 ?	tstp	r1, r3, lsl r1
@@ -113,8 +113,8 @@
 0000019c <[^>]*> e0110392 ?	muls	r1, r2, r3
 000001a0 <[^>]*> 10000091 ?	mulne	r0, r1, r0
 000001a4 <[^>]*> 90190798 ?	mullss	r9, r8, r7
-000001a8 <[^>]*> e021ba99 ?	mla	r1, r9, sl, fp
-000001ac <[^>]*> e033c994 ?	mlas	r3, r4, r9, ip
+000001a8 <[^>]*> e021ba99 ?	mla	r1, r9, r10, r11
+000001ac <[^>]*> e033c994 ?	mlas	r3, r4, r9, r12
 000001b0 <[^>]*> b029d798 ?	mlalt	r9, r8, r7, sp
 000001b4 <[^>]*> a034e391 ?	mlages	r4, r1, r3, lr
 000001b8 <[^>]*> e5910000 ?	ldr	r0, \[r1\]
@@ -126,33 +126,33 @@
 000001d0 <[^>]*> 14954006 ?	ldrne	r4, \[r5\], #6
 000001d4 <[^>]*> e6b21003 ?	ldrt	r1, \[r2\], r3
 000001d8 <[^>]*> e6942425 ?	ldr	r2, \[r4\], r5, lsr #8
-000001dc <[^>]*> e51f0008 ?	ldr	r0, 000001dc <[^>]*>
+000001dc <[^>]*> e51f0008 ?	ldr	r0, \[pc, #fffffff8\]	; 000001dc <[^>]*>
 000001e0 <[^>]*> e5d43000 ?	ldrb	r3, \[r4\]
 000001e4 <[^>]*> 14f85000 ?	ldrnebt	r5, \[r8\]
 000001e8 <[^>]*> e5810000 ?	str	r0, \[r1\]
 000001ec <[^>]*> e7811002 ?	str	r1, \[r1, r2\]
-000001f0 <[^>]*> e7a33004 ?	str	r3, \[r3, r4\]!
+000001f0 <[^>]*> e7a43003 ?	str	r3, \[r4, r3\]!
 000001f4 <[^>]*> e5822020 ?	str	r2, \[r2, #32\]
 000001f8 <[^>]*> e7832424 ?	str	r2, \[r3, r4, lsr #8\]
 000001fc <[^>]*> 07a54484 ?	streq	r4, \[r5, r4, lsl #9\]!
 00000200 <[^>]*> 14854006 ?	strne	r4, \[r5\], #6
 00000204 <[^>]*> e6821003 ?	str	r1, \[r2\], r3
 00000208 <[^>]*> e6a42425 ?	strt	r2, \[r4\], r5, lsr #8
-0000020c <[^>]*> e50f1004 ?	str	r1, 00000210 <[^>]*>
+0000020c <[^>]*> e50f1004 ?	str	r1, \[pc, #fffffffc\]	; 00000210 <[^>]*>
 00000210 <[^>]*> e5c71000 ?	strb	r1, \[r7\]
 00000214 <[^>]*> e4e02000 ?	strbt	r2, \[r0\]
 00000218 <[^>]*> e8900002 ?	ldmia	r0, {r1}
 0000021c <[^>]*> 09920038 ?	ldmeqib	r2, {r3, r4, r5}
-00000220 <[^>]*> e853ffff ?	ldmda	r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, sp, lr, pc}\^
-00000224 <[^>]*> e93b05ff ?	ldmdb	fp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, sl}
+00000220 <[^>]*> e853ffff ?	ldmda	r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, sp, lr, pc}\^
+00000224 <[^>]*> e93b05ff ?	ldmdb	r11!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r10}
 00000228 <[^>]*> e99100f7 ?	ldmib	r1, {r0, r1, r2, r4, r5, r6, r7}
 0000022c <[^>]*> e89201f8 ?	ldmia	r2, {r3, r4, r5, r6, r7, r8}
 00000230 <[^>]*> e9130003 ?	ldmdb	r3, {r0, r1}
 00000234 <[^>]*> e8740300 ?	ldmda	r4!, {r8, r9}\^
 00000238 <[^>]*> e8800002 ?	stmia	r0, {r1}
 0000023c <[^>]*> 09820038 ?	stmeqib	r2, {r3, r4, r5}
-00000240 <[^>]*> e843ffff ?	stmda	r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, sp, lr, pc}\^
-00000244 <[^>]*> e92a05ff ?	stmdb	sl!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, sl}
+00000240 <[^>]*> e843ffff ?	stmda	r3, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, sp, lr, pc}\^
+00000244 <[^>]*> e92a05ff ?	stmdb	r10!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r10}
 00000248 <[^>]*> e8010007 ?	stmda	r1, {r0, r1, r2}
 0000024c <[^>]*> e9020018 ?	stmdb	r2, {r3, r4}
 00000250 <[^>]*> e8830003 ?	stmia	r3, {r0, r1}
@@ -161,7 +161,8 @@
 0000025c <[^>]*> 2f000033 ?	swics	0x00000033
 00000260 <[^>]*> ebfffffe ?	bl	00000260 <[^>]*>
 [		]*260:.*_wombat.*
-00000264 <[^>]*> 5bffffe9 ?	blpl	00000210 <bar>
+00000264 <[^>]*> 5bfffffe ?	blpl	00000264 <[^>]*>
+[		]*264:.*ARM.*hohum
 00000268 <[^>]*> eafffffe ?	b	00000268 <[^>]*>
 [		]*268:.*_wibble.*
 0000026c <[^>]*> dafffffe ?	ble	0000026c <[^>]*>
diff --git a/gas/testsuite/gas/arm/inst.s b/gas/testsuite/gas/arm/inst.s
index ff092c9..f76bac9 100644
--- a/gas/testsuite/gas/arm/inst.s
+++ b/gas/testsuite/gas/arm/inst.s
@@ -9,25 +9,25 @@
 	mov	r8, r9, asr r10
 	mov	r11, r12, asl r13
 	mov	r14, r15, rrx
-	moval	r1, r2
-	moveq	r2, r3
-	movne	r4, r5
-	movlt	r6, r7
-	movge	r8, r9
-	movle	r10, r11
-	movgt	r12, r13
+	moval	a2, a3
+	moveq	a3, a4
+	movne	v1, v2
+	movlt	v3, v4
+	movge	v5, v6
+	movle	v7, v8
+	movgt	ip, sp
 	movcc	r1, r2
 	movcs	r1, r3
 	movmi	r3, r6
-	movpl	r7, r9
+	movpl	wr, sb
 	movvs	r1, r8
-	movvc	r9, r1, lsr #31
-	movhi	r8, r15
-	movls	r15, r14
+	movvc	SB, r1, lsr #31
+	movhi	r8, pc
+	movls	PC, lr
 	movhs	r9, r8
 	movul	r1, r3
 	movs	r0, r8
-	movuls	r0, r7
+	movuls	r0, WR
 	
 	add	r0, r1, #10
 	add	r2, r3, r4
@@ -129,10 +129,10 @@
 	mulne	r0, r1, r0
 	mullss	r9, r8, r7
 
-	mla	r1, r9, r10, r11
-	mlas	r3, r4, r9, r12
-	mlalt	r9, r8, r7, r13
-	mlages	r4, r1, r3, r14
+	mla	r1, r9, sl, fp
+	mlas	r3, r4, r9, IP
+	mlalt	r9, r8, r7, SP
+	mlages	r4, r1, r3, LR
 
 	ldr	r0, [r1]
 	ldr	r1, [r1, r2]
@@ -150,7 +150,7 @@
 	
 	str	r0, [r1]
 	str	r1, [r1, r2]
-	str	r3, [r3, r4]!
+	str	r3, [r4, r3]!
 	str	r2, [r2, #32]
 	str	r2, [r3, r4, lsr #8]
 	streq	r4, [r5, r4, asl #9]!
@@ -165,7 +165,7 @@
 	ldmia	r0, {r1}
 	ldmeqib	r2, {r3, r4, r5}
 	ldmalda	r3, {r0-r15}^
-	ldmdb	r11!, {r0-r8, r10}
+	ldmdb	FP!, {r0-r8, SL}
 	ldmed	r1, {r0, r1, r2}|0xf0
 	ldmfd	r2, {r3, r4}+{r5, r6, r7, r8}
 	ldmea	r3, 3
@@ -184,6 +184,6 @@
 	swihs	0x33
 
 	bl	_wombat
-	blpl	bar
+	blpl	hohum
 	b	_wibble
 	ble	testerfunc
diff --git a/gas/testsuite/gas/arm/thumb.s b/gas/testsuite/gas/arm/thumb.s
index ea4b82d..422b088 100644
--- a/gas/testsuite/gas/arm/thumb.s
+++ b/gas/testsuite/gas/arm/thumb.s
@@ -118,6 +118,7 @@
 	bhi	bar
 	blo	bar
 	bul	bar
+	bal	bar
 
 close:
 	lsl	r4, r5, #near - close
diff --git a/gas/testsuite/gas/d10v/d10.exp b/gas/testsuite/gas/d10v/d10.exp
new file mode 100644
index 0000000..9d43728
--- /dev/null
+++ b/gas/testsuite/gas/d10v/d10.exp
@@ -0,0 +1,19 @@
+#
+# Driver for D10V assembler testsuite
+#
+proc run_list_test { name opts } {
+  global srcdir subdir
+  set testname "D10V $name"
+  set file $srcdir/$subdir/$name
+  gas_run ${name}.s $opts ">&dump.out"
+  if {[regexp_diff "dump.out" "${file}.l"] } {
+    fail $testname
+    verbose "output is [file_contents "dump.out"]" 2
+    return
+  }
+  pass $testname
+}
+
+if {[istarget d10v-*-*]} {
+  run_dump_test "inst"
+}
diff --git a/gas/testsuite/gas/d10v/inst.d b/gas/testsuite/gas/d10v/inst.d
new file mode 100644
index 0000000..ae3dafc
--- /dev/null
+++ b/gas/testsuite/gas/d10v/inst.d
@@ -0,0 +1,22 @@
+#objdump: -dr
+#name: D10V basic instruction test output
+#as:
+
+.*: +file format elf32-d10v
+
+Disassembly of section .text:
+
+00000000 <start>:
+   0:	a9 04 c2 29 	sac	r0, a0	<-	sachi	r1, a0
+   4:	a9 06 c2 2d 	rac	r0, a0, -0x2	<-	rachi	r1, a0, -0x2
+   8:	2f 00 32 26 	nop		||	slae	a0, r3
+   c:	f2 11 08 00 	ld	r1, @0x800
+  10:	f3 01 08 00 	ld2w	r0, @0x800
+  14:	f7 01 08 00 	st2w	r0, @0x800
+  18:	f6 11 08 00 	st	r1, @0x800
+  1c:	6f 00 5e 00 	nop		->	nop	
+  20:	6f 00 5e 00 	nop		->	nop	
+  24:	2f 00 5e 00 	nop		||	nop	
+  28:	af 00 5e 00 	nop		<-	nop	
+  2c:	23 11 de 00 	not	r1	||	nop	
+  30:	63 21 de 00 	not	r2	->	nop	
diff --git a/gas/testsuite/gas/d10v/inst.s b/gas/testsuite/gas/d10v/inst.s
new file mode 100644
index 0000000..0a0fa74
--- /dev/null
+++ b/gas/testsuite/gas/d10v/inst.s
@@ -0,0 +1,31 @@
+# test all instructions. FIXME: many instructions missing.
+
+start:
+	sachi	r1, a0
+	sac	r0, a0
+	#
+	# disassembler test. sachi&sac should not 
+	# be confused with rachi&rac
+	#
+	rachi	r1, a0, -0x2
+	rac	r0, a0, -0x2
+	slae	a0, r3
+	ld	r1, @0x0800
+	ld2w	r0, @0x0800
+	st2w	r0, @0x0800
+	st	r1, @0x0800
+
+# VLIW syntax test
+	nop
+	nop
+	nop	->	nop
+	nop	||	nop
+	nop	<-	nop
+
+# try changing sections
+	not	r1
+	.section .foo
+	add3	r10,r12,6
+	.text
+	not	r2
+	nop
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
new file mode 100644
index 0000000..216f2ac
--- /dev/null
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -0,0 +1,15 @@
+#
+# elf tests
+#
+
+# We're testing bits in obj-elf -- don't run on anything else.
+if { ([istarget "*-*-elf*"]		
+      || [istarget "*-*-linux*"]
+      || [istarget "sparc*-*-solaris*"]
+      || [istarget "mips*-*-irix6*"])
+     && ![istarget *-*-linux*aout*]
+     && ![istarget *-*-linux*oldld*]
+} then {
+    run_dump_test "section0" 
+    run_dump_test "section1" 
+}
diff --git a/gas/testsuite/gas/elf/section0.d b/gas/testsuite/gas/elf/section0.d
new file mode 100644
index 0000000..c674a65
--- /dev/null
+++ b/gas/testsuite/gas/elf/section0.d
@@ -0,0 +1,16 @@
+#objdump: -s
+#name: elf section0
+
+.*: +file format .*
+
+Contents of section .text:
+Contents of section .data:
+ 0000 0000                                 ..              
+# The MIPS includes a 'section .reginfo' and such here.
+#...
+Contents of section A:
+ 0000 010101                               ...             
+Contents of section B:
+ 0000 0202                                 ..              
+Contents of section C:
+ 0000 03                                   .               
diff --git a/gas/testsuite/gas/elf/section0.s b/gas/testsuite/gas/elf/section0.s
new file mode 100644
index 0000000..bdc8f0c
--- /dev/null
+++ b/gas/testsuite/gas/elf/section0.s
@@ -0,0 +1,16 @@
+.data
+	.byte 0
+.section A
+	.byte 1
+.pushsection B
+	.byte 2
+.pushsection C
+	.byte 3
+.popsection
+	.byte 2
+.popsection
+	.byte 1
+.previous
+	.byte 0
+.previous
+	.byte 1
diff --git a/gas/testsuite/gas/elf/section1.d b/gas/testsuite/gas/elf/section1.d
new file mode 100644
index 0000000..de052f5
--- /dev/null
+++ b/gas/testsuite/gas/elf/section1.d
@@ -0,0 +1,16 @@
+#objdump: -s
+#name: elf section1
+
+.*: +file format .*
+
+Contents of section .text:
+Contents of section .data:
+ 0000 000000                               ...             
+# The MIPS includes a 'section .reginfo' and such here.
+#...
+Contents of section A:
+ 0000 01010101 0101                        ......          
+Contents of section B:
+ 0000 02020202 02                          .....           
+Contents of section C:
+ 0000 0303                                 ..              
diff --git a/gas/testsuite/gas/elf/section1.s b/gas/testsuite/gas/elf/section1.s
new file mode 100644
index 0000000..1592adf
--- /dev/null
+++ b/gas/testsuite/gas/elf/section1.s
@@ -0,0 +1,32 @@
+.data
+	.byte 0
+.section A
+	.byte 1
+.previous
+	.byte 0
+.previous
+	.byte 1
+.pushsection B
+	.byte 2
+.previous
+	.byte 1
+.previous
+	.byte 2
+.pushsection C
+	.byte 3
+.previous
+	.byte 2
+.previous
+	.byte 3
+.popsection
+	.byte 2
+.previous
+	.byte 1
+.previous
+	.byte 2
+.popsection
+	.byte 1
+.previous
+	.byte 0
+.previous
+	.byte 1
diff --git a/gas/testsuite/gas/hppa/basic/add.s b/gas/testsuite/gas/hppa/basic/add.s
index 4d1d4cd..e87f23b 100644
--- a/gas/testsuite/gas/hppa/basic/add.s
+++ b/gas/testsuite/gas/hppa/basic/add.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic add/sh?add instruction tests.  
 ;
@@ -98,3 +89,71 @@
 	addco,vnz  %r4,%r5,%r6
 	addco,nsv  %r4,%r5,%r6
 	addco,ev  %r4,%r5,%r6
+
+	add,l  %r4,%r5,%r6
+	add,l,=  %r4,%r5,%r6
+	add,l,<  %r4,%r5,%r6
+	add,l,<=  %r4,%r5,%r6
+	add,l,nuv  %r4,%r5,%r6
+	add,l,znv  %r4,%r5,%r6
+	add,l,sv  %r4,%r5,%r6
+	add,l,od  %r4,%r5,%r6
+	add,l,tr  %r4,%r5,%r6
+	add,l,<>  %r4,%r5,%r6
+	add,l,>=  %r4,%r5,%r6
+	add,l,>  %r4,%r5,%r6
+	add,l,uv  %r4,%r5,%r6
+	add,l,vnz  %r4,%r5,%r6
+	add,l,nsv  %r4,%r5,%r6
+	add,l,ev  %r4,%r5,%r6
+
+	add,tsv  %r4,%r5,%r6
+	add,tsv,=  %r4,%r5,%r6
+	add,tsv,<  %r4,%r5,%r6
+	add,tsv,<=  %r4,%r5,%r6
+	add,tsv,nuv  %r4,%r5,%r6
+	add,tsv,znv  %r4,%r5,%r6
+	add,tsv,sv  %r4,%r5,%r6
+	add,tsv,od  %r4,%r5,%r6
+	add,tsv,tr  %r4,%r5,%r6
+	add,tsv,<>  %r4,%r5,%r6
+	add,tsv,>=  %r4,%r5,%r6
+	add,tsv,>  %r4,%r5,%r6
+	add,tsv,uv  %r4,%r5,%r6
+	add,tsv,vnz  %r4,%r5,%r6
+	add,tsv,nsv  %r4,%r5,%r6
+	add,tsv,ev  %r4,%r5,%r6
+
+	add,c  %r4,%r5,%r6
+	add,c,=  %r4,%r5,%r6
+	add,c,<  %r4,%r5,%r6
+	add,c,<=  %r4,%r5,%r6
+	add,c,nuv  %r4,%r5,%r6
+	add,c,znv  %r4,%r5,%r6
+	add,c,sv  %r4,%r5,%r6
+	add,c,od  %r4,%r5,%r6
+	add,c,tr  %r4,%r5,%r6
+	add,c,<>  %r4,%r5,%r6
+	add,c,>=  %r4,%r5,%r6
+	add,c,>  %r4,%r5,%r6
+	add,c,uv  %r4,%r5,%r6
+	add,c,vnz  %r4,%r5,%r6
+	add,c,nsv  %r4,%r5,%r6
+	add,c,ev  %r4,%r5,%r6
+
+	add,c,tsv  %r4,%r5,%r6
+	add,c,tsv,=  %r4,%r5,%r6
+	add,c,tsv,<  %r4,%r5,%r6
+	add,c,tsv,<=  %r4,%r5,%r6
+	add,c,tsv,nuv  %r4,%r5,%r6
+	add,c,tsv,znv  %r4,%r5,%r6
+	add,c,tsv,sv  %r4,%r5,%r6
+	add,c,tsv,od  %r4,%r5,%r6
+	add,tsv,c,tr  %r4,%r5,%r6
+	add,tsv,c,<>  %r4,%r5,%r6
+	add,tsv,c,>=  %r4,%r5,%r6
+	add,tsv,c,>  %r4,%r5,%r6
+	add,tsv,c,uv  %r4,%r5,%r6
+	add,tsv,c,vnz  %r4,%r5,%r6
+	add,tsv,c,nsv  %r4,%r5,%r6
+	add,tsv,c,ev  %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/add2.s b/gas/testsuite/gas/hppa/basic/add2.s
new file mode 100644
index 0000000..b50f515
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/add2.s
@@ -0,0 +1,92 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; Basic add/sh?add instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	add,*  %r4,%r5,%r6
+	add,*=  %r4,%r5,%r6
+	add,*<  %r4,%r5,%r6
+	add,*<=  %r4,%r5,%r6
+	add,*nuv  %r4,%r5,%r6
+	add,*znv  %r4,%r5,%r6
+	add,*sv  %r4,%r5,%r6
+	add,*od  %r4,%r5,%r6
+	add,*tr  %r4,%r5,%r6
+	add,*<>  %r4,%r5,%r6
+	add,*>=  %r4,%r5,%r6
+	add,*>  %r4,%r5,%r6
+	add,*uv  %r4,%r5,%r6
+	add,*vnz  %r4,%r5,%r6
+	add,*nsv  %r4,%r5,%r6
+	add,*ev  %r4,%r5,%r6
+
+	add,l,*  %r4,%r5,%r6
+	add,l,*=  %r4,%r5,%r6
+	add,l,*<  %r4,%r5,%r6
+	add,l,*<=  %r4,%r5,%r6
+	add,l,*nuv  %r4,%r5,%r6
+	add,l,*znv  %r4,%r5,%r6
+	add,l,*sv  %r4,%r5,%r6
+	add,l,*od  %r4,%r5,%r6
+	add,l,*tr  %r4,%r5,%r6
+	add,l,*<>  %r4,%r5,%r6
+	add,l,*>=  %r4,%r5,%r6
+	add,l,*>  %r4,%r5,%r6
+	add,l,*uv  %r4,%r5,%r6
+	add,l,*vnz  %r4,%r5,%r6
+	add,l,*nsv  %r4,%r5,%r6
+	add,l,*ev  %r4,%r5,%r6
+
+	add,tsv,*  %r4,%r5,%r6
+	add,tsv,*=  %r4,%r5,%r6
+	add,tsv,*<  %r4,%r5,%r6
+	add,tsv,*<=  %r4,%r5,%r6
+	add,tsv,*nuv  %r4,%r5,%r6
+	add,tsv,*znv  %r4,%r5,%r6
+	add,tsv,*sv  %r4,%r5,%r6
+	add,tsv,*od  %r4,%r5,%r6
+	add,tsv,*tr  %r4,%r5,%r6
+	add,tsv,*<>  %r4,%r5,%r6
+	add,tsv,*>=  %r4,%r5,%r6
+	add,tsv,*>  %r4,%r5,%r6
+	add,tsv,*uv  %r4,%r5,%r6
+	add,tsv,*vnz  %r4,%r5,%r6
+	add,tsv,*nsv  %r4,%r5,%r6
+	add,tsv,*ev  %r4,%r5,%r6
+
+	add,dc,*  %r4,%r5,%r6
+	add,dc,*=  %r4,%r5,%r6
+	add,dc,*<  %r4,%r5,%r6
+	add,dc,*<=  %r4,%r5,%r6
+	add,dc,*nuv  %r4,%r5,%r6
+	add,dc,*znv  %r4,%r5,%r6
+	add,dc,*sv  %r4,%r5,%r6
+	add,dc,*od  %r4,%r5,%r6
+	add,dc,*tr  %r4,%r5,%r6
+	add,dc,*<>  %r4,%r5,%r6
+	add,dc,*>=  %r4,%r5,%r6
+	add,dc,*>  %r4,%r5,%r6
+	add,dc,*uv  %r4,%r5,%r6
+	add,dc,*vnz  %r4,%r5,%r6
+	add,dc,*nsv  %r4,%r5,%r6
+	add,dc,*ev  %r4,%r5,%r6
+
+	add,dc,tsv,*  %r4,%r5,%r6
+	add,dc,tsv,*=  %r4,%r5,%r6
+	add,dc,tsv,*<  %r4,%r5,%r6
+	add,dc,tsv,*<=  %r4,%r5,%r6
+	add,dc,tsv,*nuv  %r4,%r5,%r6
+	add,dc,tsv,*znv  %r4,%r5,%r6
+	add,dc,tsv,*sv  %r4,%r5,%r6
+	add,dc,tsv,*od  %r4,%r5,%r6
+	add,tsv,dc,*tr  %r4,%r5,%r6
+	add,tsv,dc,*<>  %r4,%r5,%r6
+	add,tsv,dc,*>=  %r4,%r5,%r6
+	add,tsv,dc,*>  %r4,%r5,%r6
+	add,tsv,dc,*uv  %r4,%r5,%r6
+	add,tsv,dc,*vnz  %r4,%r5,%r6
+	add,tsv,dc,*nsv  %r4,%r5,%r6
+	add,tsv,dc,*ev  %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/addi.s b/gas/testsuite/gas/hppa/basic/addi.s
index b036b80..e45171c 100644
--- a/gas/testsuite/gas/hppa/basic/addi.s
+++ b/gas/testsuite/gas/hppa/basic/addi.s
@@ -1,15 +1,6 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
-; Basic immediate instruction tests.  
+; Basic add immediate instruction tests.  
 ;
 ; We could/should test some of the corner cases for register and 
 ; immediate fields.  We should also check the assorted field
@@ -81,3 +72,54 @@
 	addito,vnz  123,%r5,%r6
 	addito,nsv  123,%r5,%r6
 	addito,ev  123,%r5,%r6
+
+	addi,tsv  123,%r5,%r6
+	addi,tsv,=  123,%r5,%r6
+	addi,tsv,<  123,%r5,%r6
+	addi,tsv,<=  123,%r5,%r6
+	addi,tsv,nuv  123,%r5,%r6
+	addi,tsv,znv  123,%r5,%r6
+	addi,tsv,sv  123,%r5,%r6
+	addi,tsv,od  123,%r5,%r6
+	addi,tsv,tr  123,%r5,%r6
+	addi,tsv,<>  123,%r5,%r6
+	addi,tsv,>=  123,%r5,%r6
+	addi,tsv,>  123,%r5,%r6
+	addi,tsv,uv  123,%r5,%r6
+	addi,tsv,vnz  123,%r5,%r6
+	addi,tsv,nsv  123,%r5,%r6
+	addi,tsv,ev  123,%r5,%r6
+
+	addi,tc  123,%r5,%r6
+	addi,tc,=  123,%r5,%r6
+	addi,tc,<  123,%r5,%r6
+	addi,tc,<=  123,%r5,%r6
+	addi,tc,nuv  123,%r5,%r6
+	addi,tc,znv  123,%r5,%r6
+	addi,tc,sv  123,%r5,%r6
+	addi,tc,od  123,%r5,%r6
+	addi,tc,tr  123,%r5,%r6
+	addi,tc,<>  123,%r5,%r6
+	addi,tc,>=  123,%r5,%r6
+	addi,tc,>  123,%r5,%r6
+	addi,tc,uv  123,%r5,%r6
+	addi,tc,vnz  123,%r5,%r6
+	addi,tc,nsv  123,%r5,%r6
+	addi,tc,ev  123,%r5,%r6
+
+	addi,tc,tsv  123,%r5,%r6
+	addi,tc,tsv,=  123,%r5,%r6
+	addi,tc,tsv,<  123,%r5,%r6
+	addi,tc,tsv,<=  123,%r5,%r6
+	addi,tc,tsv,nuv  123,%r5,%r6
+	addi,tc,tsv,znv  123,%r5,%r6
+	addi,tc,tsv,sv  123,%r5,%r6
+	addi,tc,tsv,od  123,%r5,%r6
+	addi,tsv,tc,tr  123,%r5,%r6
+	addi,tsv,tc,<>  123,%r5,%r6
+	addi,tsv,tc,>=  123,%r5,%r6
+	addi,tsv,tc,>  123,%r5,%r6
+	addi,tsv,tc,uv  123,%r5,%r6
+	addi,tsv,tc,vnz  123,%r5,%r6
+	addi,tsv,tc,nsv  123,%r5,%r6
+	addi,tsv,tc,ev  123,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/basic.exp b/gas/testsuite/gas/hppa/basic/basic.exp
index a9ba5ea..f7b0684 100644
--- a/gas/testsuite/gas/hppa/basic/basic.exp
+++ b/gas/testsuite/gas/hppa/basic/basic.exp
@@ -359,6 +359,52 @@
     if [expr $x==183] then { pass $testname } else { fail $testname }
 }
 
+proc do_branch2 {} {
+    set testname "branch2.s: branch tests"
+    set x 0
+
+    gas_start "branch2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 C0045FF5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 C004DFED\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 C0045FE7\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c C004DFDF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 C0047FD5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 C004FFCD\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 C0047FC7\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c C004FFBF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 C4A47FB5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 C4A4FFAD\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 C4A47FA7\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c C4A4FF9F\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 E8004005\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 E800400D\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 E8004F9D\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c E8004001\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 E8044001\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==17] then { pass $testname } else { fail $testname }
+}
+
 proc do_add {} {
     set testname "add.s: add tests"
     set x 0
@@ -454,6 +500,179 @@
 	    -re "^ +\[0-9\]+ 0134 08A4BF06\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 0138 08A4DF06\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 013c 08A4FF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0140 08A40A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0144 08A42A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0148 08A44A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014c 08A46A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0150 08A48A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0154 08A4AA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 08A4CA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015c 08A4EA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0160 08A41A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0164 08A43A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0168 08A45A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016c 08A47A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0170 08A49A06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 08A4BA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0178 08A4DA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017c 08A4FA06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0180 08A40E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0184 08A42E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0188 08A44E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 018c 08A46E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 08A48E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0194 08A4AE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0198 08A4CE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019c 08A4EE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a0 08A41E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a4 08A43E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a8 08A45E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac 08A47E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b0 08A49E06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b4 08A4BE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b8 08A4DE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01bc 08A4FE06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c0 08A40706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c4 08A42706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c8 08A44706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01cc 08A46706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d0 08A48706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d4 08A4A706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d8 08A4C706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01dc 08A4E706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e0 08A41706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e4 08A43706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e8 08A45706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ec 08A47706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f0 08A49706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f4 08A4B706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f8 08A4D706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01fc 08A4F706\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0200 08A40F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0204 08A42F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0208 08A44F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 020c 08A46F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0210 08A48F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0214 08A4AF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0218 08A4CF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 021c 08A4EF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0220 08A41F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0224 08A43F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0228 08A45F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 022c 08A47F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0230 08A49F06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0234 08A4BF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0238 08A4DF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 023c 08A4FF06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==144] then { pass $testname } else { fail $testname }
+}
+
+proc do_add2 {} {
+    set testname "add2.s: add2 tests"
+    set x 0
+
+    gas_start "add2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08A40626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08A42626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08A44626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08A46626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 08A48626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 08A4A626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08A4C626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08A4E626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08A41626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08A43626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 08A45626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 08A47626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08A49626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08A4B626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08A4D626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08A4F626\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 08A40A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 08A42A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08A44A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08A46A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08A48A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08A4AA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 08A4CA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 08A4EA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08A41A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08A43A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08A45A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08A47A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 08A49A26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 08A4BA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08A4DA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08A4FA26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08A40E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08A42E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 08A44E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 08A46E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 08A48E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 08A4AE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 08A4CE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 08A4EE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 08A41E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 08A43E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 08A45E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 08A47E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 08A49E26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 08A4BE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 08A4DE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 08A4FE26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 08A40726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 08A42726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 08A44726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc 08A46726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 08A48726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 08A4A726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 08A4C726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc 08A4E726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 08A41726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 08A43726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 08A45726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec 08A47726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 08A49726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 08A4B726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 08A4D726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc 08A4F726\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 08A40F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 08A42F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 08A44F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c 08A46F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0110 08A48F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0114 08A4AF26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 08A4CF26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011c 08A4EF26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0120 08A41F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0124 08A43F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0128 08A45F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012c 08A47F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0130 08A49F26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 08A4BF26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0138 08A4DF26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013c 08A4FF26\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -699,6 +918,352 @@
     if [expr $x==48] then { pass $testname } else { fail $testname }
 }
 
+proc do_shladd {} {
+    set testname "shladd.s: shladd tests"
+    set x 0
+
+    gas_start "shladd.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08A40646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08A42646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08A44646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08A46646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 08A48646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 08A4A646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08A4C646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08A4E646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08A41646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08A43646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 08A45646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 08A47646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08A49646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08A4B646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08A4D646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08A4F646\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 08A40A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 08A42A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08A44A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08A46A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08A48A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08A4AA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 08A4CA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 08A4EA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08A41A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08A43A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08A45A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08A47A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 08A49A46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 08A4BA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08A4DA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08A4FA46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08A40E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08A42E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 08A44E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 08A46E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 08A48E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 08A4AE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 08A4CE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 08A4EE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 08A41E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 08A43E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 08A45E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 08A47E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 08A49E46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 08A4BE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 08A4DE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 08A4FE46\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 08A40686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 08A42686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 08A44686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc 08A46686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 08A48686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 08A4A686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 08A4C686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc 08A4E686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 08A41686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 08A43686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 08A45686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec 08A47686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 08A49686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 08A4B686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 08A4D686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc 08A4F686\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 08A40A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 08A42A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 08A44A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c 08A46A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0110 08A48A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0114 08A4AA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 08A4CA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011c 08A4EA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0120 08A41A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0124 08A43A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0128 08A45A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012c 08A47A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0130 08A49A86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 08A4BA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0138 08A4DA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013c 08A4FA86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0140 08A40E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0144 08A42E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0148 08A44E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014c 08A46E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0150 08A48E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0154 08A4AE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 08A4CE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015c 08A4EE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0160 08A41E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0164 08A43E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0168 08A45E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016c 08A47E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0170 08A49E86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 08A4BE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0178 08A4DE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017c 08A4FE86\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0180 08A406C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0184 08A426C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0188 08A446C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 018c 08A466C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 08A486C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0194 08A4A6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0198 08A4C6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019c 08A4E6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a0 08A416C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a4 08A436C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a8 08A456C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac 08A476C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b0 08A496C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b4 08A4B6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b8 08A4D6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01bc 08A4F6C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c0 08A40AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c4 08A42AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c8 08A44AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01cc 08A46AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d0 08A48AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d4 08A4AAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d8 08A4CAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01dc 08A4EAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e0 08A41AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e4 08A43AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e8 08A45AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ec 08A47AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f0 08A49AC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f4 08A4BAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f8 08A4DAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01fc 08A4FAC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0200 08A40EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0204 08A42EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0208 08A44EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 020c 08A46EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0210 08A48EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0214 08A4AEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0218 08A4CEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 021c 08A4EEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0220 08A41EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0224 08A43EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0228 08A45EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 022c 08A47EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0230 08A49EC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0234 08A4BEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0238 08A4DEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 023c 08A4FEC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==144] then { pass $testname } else { fail $testname }
+}
+
+proc do_shladd2 {} {
+    set testname "shladd2.s: shladd2 tests"
+    set x 0
+
+    gas_start "shladd2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08A40666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08A42666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08A44666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08A46666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 08A48666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 08A4A666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08A4C666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08A4E666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08A41666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08A43666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 08A45666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 08A47666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08A49666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08A4B666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08A4D666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08A4F666\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 08A40A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 08A42A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08A44A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08A46A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08A48A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08A4AA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 08A4CA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 08A4EA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08A41A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08A43A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08A45A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08A47A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 08A49A66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 08A4BA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08A4DA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08A4FA66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08A40E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08A42E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 08A44E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 08A46E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 08A48E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 08A4AE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 08A4CE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 08A4EE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 08A41E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 08A43E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 08A45E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 08A47E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 08A49E66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 08A4BE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 08A4DE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 08A4FE66\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 08A406A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 08A426A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 08A446A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc 08A466A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 08A486A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 08A4A6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 08A4C6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc 08A4E6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 08A416A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 08A436A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 08A456A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec 08A476A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 08A496A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 08A4B6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 08A4D6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc 08A4F6A6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 08A40AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 08A42AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 08A44AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c 08A46AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0110 08A48AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0114 08A4AAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 08A4CAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011c 08A4EAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0120 08A41AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0124 08A43AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0128 08A45AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012c 08A47AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0130 08A49AA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 08A4BAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0138 08A4DAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013c 08A4FAA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0140 08A40EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0144 08A42EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0148 08A44EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014c 08A46EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0150 08A48EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0154 08A4AEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 08A4CEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015c 08A4EEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0160 08A41EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0164 08A43EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0168 08A45EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016c 08A47EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0170 08A49EA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 08A4BEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0178 08A4DEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017c 08A4FEA6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0180 08A406E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0184 08A426E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0188 08A446E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 018c 08A466E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 08A486E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0194 08A4A6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0198 08A4C6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019c 08A4E6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a0 08A416E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a4 08A436E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a8 08A456E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac 08A476E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b0 08A496E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b4 08A4B6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b8 08A4D6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01bc 08A4F6E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c0 08A40AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c4 08A42AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c8 08A44AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01cc 08A46AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d0 08A48AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d4 08A4AAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d8 08A4CAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01dc 08A4EAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e0 08A41AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e4 08A43AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e8 08A45AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ec 08A47AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f0 08A49AE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f4 08A4BAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f8 08A4DAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01fc 08A4FAE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0200 08A40EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0204 08A42EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0208 08A44EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 020c 08A46EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0210 08A48EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0214 08A4AEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0218 08A4CEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 021c 08A4EEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0220 08A41EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0224 08A43EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0228 08A45EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 022c 08A47EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0230 08A49EE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0234 08A4BEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0238 08A4DEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 023c 08A4FEE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==144] then { pass $testname } else { fail $testname }
+}
+
 proc do_sub {} {
     set testname "sub.s: sub tests"
     set x 0
@@ -810,6 +1375,211 @@
 	    -re "^ +\[0-9\]+ 0174 08A4BCC6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 0178 08A4DCC6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 017c 08A4FCC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0180 08A40C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0184 08A42C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0188 08A44C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 018c 08A46C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 08A48C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0194 08A4AC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0198 08A4CC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019c 08A4EC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a0 08A41C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a4 08A43C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a8 08A45C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac 08A47C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b0 08A49C06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b4 08A4BC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b8 08A4DC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01bc 08A4FC06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c0 08A40506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c4 08A42506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01c8 08A44506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01cc 08A46506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d0 08A48506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d4 08A4A506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01d8 08A4C506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01dc 08A4E506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e0 08A41506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e4 08A43506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01e8 08A45506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ec 08A47506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f0 08A49506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f4 08A4B506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01f8 08A4D506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01fc 08A4F506\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0200 08A40D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0204 08A42D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0208 08A44D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 020c 08A46D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0210 08A48D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0214 08A4AD06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0218 08A4CD06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 021c 08A4ED06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0220 08A41D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0224 08A43D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0228 08A45D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 022c 08A47D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0230 08A49D06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0234 08A4BD06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0238 08A4DD06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 023c 08A4FD06\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0240 08A404C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0244 08A424C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0248 08A444C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 024c 08A464C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0250 08A484C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0254 08A4A4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0258 08A4C4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 025c 08A4E4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0260 08A414C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0264 08A434C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0268 08A454C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 026c 08A474C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0270 08A494C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0274 08A4B4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0278 08A4D4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 027c 08A4F4C6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0280 08A40CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0284 08A42CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0288 08A44CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 028c 08A46CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0290 08A48CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0294 08A4ACC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0298 08A4CCC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 029c 08A4ECC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02a0 08A41CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02a4 08A43CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02a8 08A45CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02ac 08A47CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02b0 08A49CC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02b4 08A4BCC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02b8 08A4DCC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 02bc 08A4FCC6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==176] then { pass $testname } else { fail $testname }
+}
+
+proc do_sub2 {} {
+    set testname "sub2.s: sub2 tests"
+    set x 0
+
+    gas_start "sub2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08A40426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08A42426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08A44426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08A46426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 08A48426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 08A4A426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08A4C426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08A4E426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08A41426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08A43426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 08A45426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 08A47426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08A49426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08A4B426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08A4D426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08A4F426\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 08A40C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 08A42C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08A44C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08A46C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08A48C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08A4AC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 08A4CC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 08A4EC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08A41C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08A43C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08A45C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08A47C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 08A49C26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 08A4BC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08A4DC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08A4FC26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08A40526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08A42526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 08A44526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 08A46526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 08A48526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 08A4A526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 08A4C526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 08A4E526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 08A41526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 08A43526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 08A45526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 08A47526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 08A49526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 08A4B526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 08A4D526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 08A4F526\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 08A40D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 08A42D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 08A44D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc 08A46D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 08A48D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 08A4AD26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 08A4CD26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc 08A4ED26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 08A41D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 08A43D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 08A45D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec 08A47D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 08A49D26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 08A4BD26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 08A4DD26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc 08A4FD26\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 08A404E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 08A424E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 08A444E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c 08A464E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0110 08A484E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0114 08A4A4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 08A4C4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011c 08A4E4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0120 08A414E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0124 08A434E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0128 08A454E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012c 08A474E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0130 08A494E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 08A4B4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0138 08A4D4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013c 08A4F4E6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0140 08A40CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0144 08A42CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0148 08A44CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014c 08A46CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0150 08A48CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0154 08A4ACE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 08A4CCE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015c 08A4ECE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0160 08A41CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0164 08A43CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0168 08A45CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016c 08A47CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0170 08A49CE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 08A4BCE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0178 08A4DCE6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017c 08A4FCE6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -1050,6 +1820,83 @@
 	    -re "^ +\[0-9\]+ 0084 08A499C6\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 0088 08A4D9C6\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 008c 08A4F9C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 08A409C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 08A449C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 08A469C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 08A489C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 08A4C9C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 08A4E9C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 08A419C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 08A459C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 08A479C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 08A499C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 08A4D9C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 08A4F9C6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==48] then { pass $testname } else { fail $testname }
+}
+
+proc do_unit2 {} {
+    set testname "unit2.s: unit2 tests"
+    set x 0
+
+    gas_start "unit2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08A403A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08A443A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08A463A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08A483A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 08A4C3A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 08A4E3A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08A413A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08A453A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08A473A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08A493A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 08A4D3A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 08A4F3A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08A409A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08A449A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08A469A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08A489A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 08A4C9A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 08A4E9A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08A419A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08A459A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08A479A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08A499A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 08A4D9A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 08A4F9A6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08A409E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08A449E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08A469E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08A489E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 08A4C9E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 08A4E9E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08A419E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08A459E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08A479E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08A499E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 08A4D9E6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 08A4F9E6\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -1103,6 +1950,71 @@
 	    -re "^ +\[0-9\]+ 0054 08809BC5\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 0058 0880DBC5\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 005c 0880FBC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 08800BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 08804BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 08806BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c 08808BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 0880CBC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 0880EBC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 08801BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c 08805BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 08807BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 08809BC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 0880DBC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 0880FBC5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==36] then { pass $testname } else { fail $testname }
+}
+
+proc do_dcor2 {} {
+    set testname "dcor2.s: dcor2 tests"
+    set x 0
+
+    gas_start "dcor2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 08800BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 08804BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 08806BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 08808BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 0880CBA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 0880EBA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 08801BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 08805BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 08807BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 08809BA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 0880DBA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 0880FBA5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 08800BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 08804BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 08806BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 08808BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 0880CBE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 0880EBE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 08801BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c 08805BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 08807BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 08809BE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 0880DBE5\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c 0880FBE5\[^\n]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -1196,6 +2108,54 @@
 	    -re "^ +\[0-9\]+ 00f4 B0A6B8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 00f8 B0A6D8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 00fc B0A6F8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 B4A608F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 B4A628F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 B4A648F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c B4A668F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0110 B4A688F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0114 B4A6A8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 B4A6C8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011c B4A6E8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0120 B4A618F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0124 B4A638F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0128 B4A658F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012c B4A678F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0130 B4A698F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 B4A6B8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0138 B4A6D8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013c B4A6F8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0140 B0A600F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0144 B0A620F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0148 B0A640F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014c B0A660F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0150 B0A680F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0154 B0A6A0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 B0A6C0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015c B0A6E0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0160 B0A610F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0164 B0A630F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0168 B0A650F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016c B0A670F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0170 B0A690F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 B0A6B0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0178 B0A6D0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017c B0A6F0F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0180 B0A608F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0184 B0A628F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0188 B0A648F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 018c B0A668F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 B0A688F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0194 B0A6A8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0198 B0A6C8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019c B0A6E8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a0 B0A618F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a4 B0A638F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a8 B0A658F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac B0A678F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b0 B0A698F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b4 B0A6B8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01b8 B0A6D8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01bc B0A6F8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -1207,7 +2167,7 @@
     gas_finish
 
     # Did we find what we were looking for?  If not, flunk it.
-    if [expr $x==64] then { pass $testname } else { fail $testname }
+    if [expr $x==112] then { pass $testname } else { fail $testname }
 }
 
 proc do_subi {} {
@@ -1257,6 +2217,22 @@
 	    -re "^ +\[0-9\]+ 0074 94A6B8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 0078 94A6D8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "^ +\[0-9\]+ 007c 94A6F8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 94A608F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 94A628F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 94A648F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c 94A668F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 94A688F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 94A6A8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 94A6C8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c 94A6E8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 94A618F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 94A638F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 94A658F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac 94A678F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 94A698F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 94A6B8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 94A6D8F6\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc 94A6F8F6\[^\n\]*\n"	{ set x [expr $x+1] }
 	    -re "\[^\n\]*\n"				{ }
 	    timeout				{ perror "timeout\n"; break }
 	    eof					{ break }
@@ -1268,7 +2244,7 @@
     gas_finish
 
     # Did we find what we were looking for?  If not, flunk it.
-    if [expr $x==32] then { pass $testname } else { fail $testname }
+    if [expr $x==48] then { pass $testname } else { fail $testname }
 }
 
 proc do_shift {} {
@@ -1316,6 +2292,96 @@
     if [expr $x==16] then { pass $testname } else { fail $testname }
 }
 
+proc do_shift2 {} {
+    set testname "shift2.s: shift tests"
+    set x 0
+
+    gas_start "shift2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 D0A40006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 D0A42006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 D0A44006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c D0A46006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 D0A48006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 D0A4A006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 D0A4C006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c D0A4E006\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 D0A40B46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 D0A42B46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 D0A44B46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c D0A46B46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 D0A48B46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 D0A4AB46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 D0A4CB46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c D0A4EB46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==16] then { pass $testname } else { fail $testname }
+}
+
+proc do_shift3 {} {
+    set testname "shift3.s: shift3 tests"
+    set x 0
+
+    gas_start "shift3.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 D0A40206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 D0A42206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 D0A44206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c D0A46206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 D0A48206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 D0A4A206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 D0A4C206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c D0A4E206\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 D0A40F46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 D0A42F46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 D0A44F46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c D0A46F46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 D0A48F46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 D0A4AF46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 D0A4CF46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c D0A4EF46\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==16] then { pass $testname } else { fail $testname }
+}
+
 proc do_extract {} {
     set testname "extract.s: extract tests"
     set x 0
@@ -1377,6 +2443,128 @@
     if [expr $x==32] then { pass $testname } else { fail $testname }
 }
 
+proc do_extract2 {} {
+    set testname "extract2.s: extract2 tests"
+    set x 0
+
+    gas_start "extract2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 D08618B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 D08638B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 D08658B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c D08678B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 D08698B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 D086B8B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 D086D8B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c D086F8B6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 D0861CB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 D0863CB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 D0865CB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c D0867CB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 D0869CB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 D086BCB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 D086DCB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c D086FCB6\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 D086101B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 D086301B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 D086501B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c D086701B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 D086901B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 D086B01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 D086D01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c D086F01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 D086141B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 D086341B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 D086541B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c D086741B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 D086941B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 D086B41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 D086D41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c D086F41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==32] then { pass $testname } else { fail $testname }
+}
+
+proc do_extract3 {} {
+    set testname "extract3.s: extract3 tests"
+    set x 0
+
+    gas_start "extract3.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 D886015B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 D886215B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 D886415B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c D886615B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 D886815B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 D886A15B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 D886C15B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c D886E15B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 D886055B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 D886255B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 D886455B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c D886655B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 D886855B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 D886A55B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 D886C55B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c D886E55B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 D086121B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 D086321B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 D086521B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c D086721B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 D086921B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 D086B21B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 D086D21B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c D086F21B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 D086161B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 D086361B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 D086561B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c D086761B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 D086961B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 D086B61B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 D086D61B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c D086F61B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==32] then { pass $testname } else { fail $testname }
+}
+
 proc do_deposit {} {
     set testname "deposit.s: deposit tests"
     set x 0
@@ -1470,6 +2658,192 @@
     if [expr $x==64] then { pass $testname } else { fail $testname }
 }
 
+proc do_deposit2 {} {
+    set testname "deposit2.s: deposit2 tests"
+    set x 0
+
+    gas_start "deposit2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 D4C40B56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 D4C42B56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 D4C44B56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c D4C46B56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 D4C48B56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 D4C4AB56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 D4C4CB56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c D4C4EB56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 D4C40F56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 D4C42F56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 D4C44F56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c D4C46F56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 D4C48F56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 D4C4AF56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 D4C4CF56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c D4C4EF56\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 D4C4001B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 D4C4201B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 D4C4401B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c D4C4601B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 D4C4801B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 D4C4A01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 D4C4C01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c D4C4E01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 D4C4041B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 D4C4241B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 D4C4441B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c D4C4641B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 D4C4841B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 D4C4A41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 D4C4C41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c D4C4E41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 D4DF141B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 D4DF341B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 D4DF541B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c D4DF741B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 D4DF941B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 D4DFB41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 D4DFD41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c D4DFF41B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 D4DF101B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 D4DF301B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 D4DF501B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac D4DF701B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 D4DF901B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 D4DFB01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 D4DFD01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc D4DFF01B\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 D4DF1F76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 D4DF3F76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 D4DF5F76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc D4DF7F76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 D4DF9F76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 D4DFBF76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 D4DFDF76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc D4DFFF76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 D4DF1B76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 D4DF3B76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 D4DF5B76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec D4DF7B76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 D4DF9B76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 D4DFBB76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 D4DFDB76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc D4DFFB76\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==64] then { pass $testname } else { fail $testname }
+}
+
+proc do_deposit3 {} {
+    set testname "deposit3.s: deposit3 tests"
+    set x 0
+
+    gas_start "deposit3.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 F0C40ABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 F0C42ABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 F0C44ABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c F0C46ABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 F0C48ABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 F0C4AABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 F0C4CABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c F0C4EABB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 F0C40EBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F0C42EBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 F0C44EBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c F0C46EBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 F0C48EBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 F0C4AEBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 F0C4CEBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c F0C4EEBB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 D4C4021B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 D4C4221B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 D4C4421B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c D4C4621B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 D4C4821B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 D4C4A21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 D4C4C21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c D4C4E21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 D4C4061B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 D4C4261B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 D4C4461B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c D4C4661B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 D4C4861B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 D4C4A61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 D4C4C61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c D4C4E61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 D4DF161B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 D4DF361B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 D4DF561B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c D4DF761B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 D4DF961B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 D4DFB61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 D4DFD61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c D4DFF61B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 D4DF121B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 D4DF321B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 D4DF521B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac D4DF721B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 D4DF921B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 D4DFB21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 D4DFD21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc D4DFF21B\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 F4DF0EBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 F4DF2EBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 F4DF4EBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc F4DF6EBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 F4DF8EBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 F4DFAEBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 F4DFCEBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc F4DFEEBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 F4DF0ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 F4DF2ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 F4DF4ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec F4DF6ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 F4DF8ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 F4DFAABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 F4DFCABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc F4DFEABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==64] then { pass $testname } else { fail $testname }
+}
+
 proc do_system {} {
     set testname "system.s: system tests"
     set x 0
@@ -1526,6 +2900,44 @@
     if [expr $x==27] then { pass $testname } else { fail $testname }
 }
 
+proc do_system2 {} {
+    set testname "system2.s: system2 tests"
+    set x 0
+
+    gas_start "system2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 00000C00\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 00000CA0\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 039B0D64\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 039B0E64\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 016048A4\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 04A61187\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 04A13187\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 04A611C7\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 04A131C7\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==9] then { pass $testname } else { fail $testname }
+}
+
 proc do_purge {} {
     set testname "purge.s: purge tests"
     set x 0
@@ -1574,6 +2986,40 @@
     if [expr $x==18] then { pass $testname } else { fail $testname }
 }
 
+proc do_purge2 {} {
+    set testname "purge2.s: purge2 tests"
+    set x 0
+
+    gas_start "purge2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 04A41600\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 04A41620\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 04A42600\[^\n]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 04A42620\[^\n]*\n"	{ set x [expr $x+1] }
+
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==4] then { pass $testname } else { fail $testname }
+}
+
 proc do_fp_misc {} {
     set testname "fp_misc.s: fp_misc tests"
     set x 0
@@ -1752,6 +3198,53 @@
     if [expr $x==55] then { pass $testname } else { fail $testname }
 }
 
+proc do_fp_comp2 {} {
+    set testname "fp_comp2.s: fp_comp2 tests"
+    set x 0
+
+    gas_start "fp_comp2.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 B8AA638E\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 B8AA6A0E\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 BA5B2595\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c BA5B2C15\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 B8AA63AE\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 B8AA6A2E\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 BA5B25B5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c BA5B2C35\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 38A0C04A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 30A0C80A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 30A0D80A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 3A80C098\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 3280C818\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 38A0E04A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 30A0E80A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 30A0F80A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 3A80E098\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 3280E818\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==18] then { pass $testname } else { fail $testname }
+}
+
 proc do_fp_conv {} {
     set testname "fp_conv.s: fp_conv tests"
     set x 0
@@ -1978,6 +3471,59 @@
     if [expr $x==96] then { pass $testname } else { fail $testname }
 }
 
+proc do_media {} {
+    set testname "media.s: media tests"
+    set x 0
+
+    gas_start "media.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 096703CC\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 0967034C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 0967030C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c 096702CC\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 F8078B4B\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 0967074C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 0967078C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c 096707CC\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 F8E0CF4B\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F8E0CF4B\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 F8E0CB4B\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c 0967054C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 0967058C\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 096705CC\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 0ACE01C9\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c 0ACE0149\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 0ACE0109\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 FACE8409\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 FACEC409\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c FACE8009\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 FACEC009\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 FAD60E49\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 FAD64A89\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c FAD66309\[^\n\]*\n"	{set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==24] then { pass $testname } else { fail $testname }
+}
+
 proc do_special {} {
     set testname "special.s: special tests"
     set x 0
@@ -2011,6 +3557,42 @@
     if [expr $x==4] then { pass $testname } else { fail $testname }
 }
 
+proc do_perf {} {
+    set testname "perf.s: perf tests"
+    set x 0
+
+    gas_start "perf.s" "-al"
+
+    # Check the assembled instruction against a table built by the HP assembler
+    # Any differences should be checked by hand -- with the number of problems
+    # I've seen in the HP assembler I don't completely trust it.
+    #
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+
+    # The third one is questionable.  HP as doesn't generate what the book
+    # says.  It outputs the nullify flag at 30 instead.
+
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 30000680\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 30000280\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 300002A0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==3] then { pass $testname } else { fail $testname }
+}
+
 proc do_spop {} {
     set testname "spop.s: spop tests"
     set x 0
@@ -2226,28 +3808,43 @@
     do_immed
     do_branch
     do_add
+    do_add2
     do_sh1add
     do_sh2add
     do_sh3add
+    do_shladd
+    do_shladd2
     do_sub
+    do_sub2
     do_ds
     do_comclr
     do_logical
     do_unit
+    do_unit2
     do_dcor
+    do_dcor2
     do_addi
     do_subi
     do_shift
+    do_shift2
+    do_shift3
     do_extract
+    do_extract2
+    do_extract3
     do_deposit
+    do_deposit2
+    do_deposit3
     do_system
+    do_system2
     do_purge
+    do_purge2
     do_fp_misc
     do_fmem
     do_fp_comp
     do_fp_conv
     do_fp_fcmp
     do_special
+    do_perf
     do_spop
     do_copr
     do_coprmem
@@ -2259,4 +3856,9 @@
     # Test that we correctly assemble some FP memory tests which
     # L/R register selects.  (Regression test for a bug Tege found).
     do_fmem_LR_tests
+
+    # PA2.0 tests
+    do_fp_comp2
+    do_branch2
+    do_media
 }
diff --git a/gas/testsuite/gas/hppa/basic/branch.s b/gas/testsuite/gas/hppa/basic/branch.s
index a1f839d..cd49611 100644
--- a/gas/testsuite/gas/hppa/basic/branch.s
+++ b/gas/testsuite/gas/hppa/basic/branch.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; More branching instructions than you ever knew what to do with.
 ;
diff --git a/gas/testsuite/gas/hppa/basic/branch2.s b/gas/testsuite/gas/hppa/basic/branch2.s
new file mode 100644
index 0000000..c950bd5
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/branch2.s
@@ -0,0 +1,32 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; More branching instructions than you ever knew what to do with.
+; PA 2.0 versions and new syntax.
+
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+
+bb_tests:	
+	bb,< %r4,%sar,bb_tests
+	bb,>= %r4,%sar,bb_tests
+	bb,<,n %r4,%cr11,bb_tests
+	bb,>=,n %r4,%cr11,bb_tests
+	bb,*< %r4,%sar,bb_tests
+	bb,*>= %r4,%sar,bb_tests
+	bb,*<,n %r4,%cr11,bb_tests
+	bb,*>=,n %r4,%cr11,bb_tests
+	bb,*< %r4,5,bb_tests
+	bb,*>= %r4,5,bb_tests
+	bb,*<,n %r4,5,bb_tests
+	bb,*>=,n %r4,5,bb_tests
+	
+branch_stack:	
+	clrbts
+	popbts 1
+	popbts 499
+	pushnom
+	pushbts %r4
+
diff --git a/gas/testsuite/gas/hppa/basic/comclr.s b/gas/testsuite/gas/hppa/basic/comclr.s
index a8e5aa6..fabfbad 100644
--- a/gas/testsuite/gas/hppa/basic/comclr.s
+++ b/gas/testsuite/gas/hppa/basic/comclr.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/copr.s b/gas/testsuite/gas/hppa/basic/copr.s
index 77cb6a2..ec146a4 100644
--- a/gas/testsuite/gas/hppa/basic/copr.s
+++ b/gas/testsuite/gas/hppa/basic/copr.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; We could/should test some of the corner cases for register and 
 ; immediate fields.  We should also check the assorted field
diff --git a/gas/testsuite/gas/hppa/basic/coprmem.s b/gas/testsuite/gas/hppa/basic/coprmem.s
index 7eff151..c5d56cf 100644
--- a/gas/testsuite/gas/hppa/basic/coprmem.s
+++ b/gas/testsuite/gas/hppa/basic/coprmem.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic copr memory tests which also test the various 
 ; addressing modes and completers.
diff --git a/gas/testsuite/gas/hppa/basic/dcor.s b/gas/testsuite/gas/hppa/basic/dcor.s
index 8474554..59bfc3e 100644
--- a/gas/testsuite/gas/hppa/basic/dcor.s
+++ b/gas/testsuite/gas/hppa/basic/dcor.s
@@ -1,15 +1,6 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
-; Basic immediate instruction tests.  
+; decimal correction instruction tests.  
 ;
 ; We could/should test some of the corner cases for register and 
 ; immediate fields.  We should also check the assorted field
@@ -39,3 +30,17 @@
 	idcor,ndc %r4,%r5
 	idcor,nbc %r4,%r5
 	idcor,nhc %r4,%r5
+
+	dcor,i %r4,%r5
+	dcor,i,sbz %r4,%r5
+	dcor,i,shz %r4,%r5
+	dcor,i,sdc %r4,%r5
+	dcor,i,sbc %r4,%r5
+	dcor,i,shc %r4,%r5
+	dcor,i,tr %r4,%r5
+	dcor,i,nbz %r4,%r5
+	dcor,i,nhz %r4,%r5
+	dcor,i,ndc %r4,%r5
+	dcor,i,nbc %r4,%r5
+	dcor,i,nhc %r4,%r5
+
diff --git a/gas/testsuite/gas/hppa/basic/dcor2.s b/gas/testsuite/gas/hppa/basic/dcor2.s
new file mode 100644
index 0000000..5eddc1d
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/dcor2.s
@@ -0,0 +1,34 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 decimal correction instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	dcor,* %r4,%r5
+	dcor,*sbz %r4,%r5
+	dcor,*shz %r4,%r5
+	dcor,*sdc %r4,%r5
+	dcor,*sbc %r4,%r5
+	dcor,*shc %r4,%r5
+	dcor,*tr %r4,%r5
+	dcor,*nbz %r4,%r5
+	dcor,*nhz %r4,%r5
+	dcor,*ndc %r4,%r5
+	dcor,*nbc %r4,%r5
+	dcor,*nhc %r4,%r5
+
+	dcor,i,* %r4,%r5
+	dcor,i,*sbz %r4,%r5
+	dcor,i,*shz %r4,%r5
+	dcor,i,*sdc %r4,%r5
+	dcor,i,*sbc %r4,%r5
+	dcor,i,*shc %r4,%r5
+	dcor,i,*tr %r4,%r5
+	dcor,i,*nbz %r4,%r5
+	dcor,i,*nhz %r4,%r5
+	dcor,i,*ndc %r4,%r5
+	dcor,i,*nbc %r4,%r5
+	dcor,i,*nhc %r4,%r5
+
diff --git a/gas/testsuite/gas/hppa/basic/deposit.s b/gas/testsuite/gas/hppa/basic/deposit.s
index 70853b3..15a7dcb 100644
--- a/gas/testsuite/gas/hppa/basic/deposit.s
+++ b/gas/testsuite/gas/hppa/basic/deposit.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/deposit2.s b/gas/testsuite/gas/hppa/basic/deposit2.s
new file mode 100644
index 0000000..a6b7596
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/deposit2.s
@@ -0,0 +1,78 @@
+	.code
+	.align 4
+; Deposit instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	depw,z %r4,5,10,%r6
+	depw,z,= %r4,5,10,%r6
+	depw,z,< %r4,5,10,%r6
+	depw,z,od %r4,5,10,%r6
+	depw,z,tr %r4,5,10,%r6
+	depw,z,<> %r4,5,10,%r6
+	depw,z,>= %r4,5,10,%r6
+	depw,z,ev %r4,5,10,%r6
+
+	depw %r4,5,10,%r6
+	depw,= %r4,5,10,%r6
+	depw,< %r4,5,10,%r6
+	depw,od %r4,5,10,%r6
+	depw,tr %r4,5,10,%r6
+	depw,<> %r4,5,10,%r6
+	depw,>= %r4,5,10,%r6
+	depw,ev %r4,5,10,%r6
+
+	depw,z	%r4,%sar,5,%r6
+	depw,z,= %r4,%sar,5,%r6
+	depw,z,< %r4,%sar,5,%r6
+	depw,z,od %r4,%sar,5,%r6
+	depw,z,tr %r4,%sar,5,%r6
+	depw,z,<> %r4,%sar,5,%r6
+	depw,z,>= %r4,%sar,5,%r6
+	depw,z,ev %r4,%sar,5,%r6
+
+	depw %r4,%sar,5,%r6
+	depw,= %r4,%sar,5,%r6
+	depw,< %r4,%sar,5,%r6
+	depw,od %r4,%sar,5,%r6
+	depw,tr %r4,%sar,5,%r6
+	depw,<> %r4,%sar,5,%r6
+	depw,>= %r4,%sar,5,%r6
+	depw,ev %r4,%sar,5,%r6
+
+	depwi -1,%sar,5,%r6
+	depwi,= -1,%sar,5,%r6
+	depwi,< -1,%sar,5,%r6
+	depwi,od -1,%sar,5,%r6
+	depwi,tr -1,%sar,5,%r6
+	depwi,<> -1,%sar,5,%r6
+	depwi,>= -1,%sar,5,%r6
+	depwi,ev -1,%sar,5,%r6
+
+	depwi,z -1,%sar,5,%r6
+	depwi,z,= -1,%sar,5,%r6
+	depwi,z,< -1,%sar,5,%r6
+	depwi,z,od -1,%sar,5,%r6
+	depwi,z,tr -1,%sar,5,%r6
+	depwi,z,<> -1,%sar,5,%r6
+	depwi,z,>= -1,%sar,5,%r6
+	depwi,z,ev -1,%sar,5,%r6
+
+	depwi -1,4,10,%r6
+	depwi,= -1,4,10,%r6
+	depwi,< -1,4,10,%r6
+	depwi,od -1,4,10,%r6
+	depwi,tr -1,4,10,%r6
+	depwi,<> -1,4,10,%r6
+	depwi,>= -1,4,10,%r6
+	depwi,ev -1,4,10,%r6
+
+	depwi,z	-1,4,10,%r6
+	depwi,z,= -1,4,10,%r6
+	depwi,z,< -1,4,10,%r6
+	depwi,z,od -1,4,10,%r6
+	depwi,z,tr -1,4,10,%r6
+	depwi,z,<> -1,4,10,%r6
+	depwi,z,>= -1,4,10,%r6
+	depwi,z,ev -1,4,10,%r6
diff --git a/gas/testsuite/gas/hppa/basic/deposit3.s b/gas/testsuite/gas/hppa/basic/deposit3.s
new file mode 100644
index 0000000..bdb7117
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/deposit3.s
@@ -0,0 +1,79 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA 2.0 Deposit instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	depd,z,* %r4,10,5,%r6
+	depd,z,*= %r4,10,5,%r6
+	depd,z,*< %r4,10,5,%r6
+	depd,z,*od %r4,10,5,%r6
+	depd,z,*tr %r4,10,5,%r6
+	depd,z,*<> %r4,10,5,%r6
+	depd,z,*>= %r4,10,5,%r6
+	depd,z,*ev %r4,10,5,%r6
+
+	depd,* %r4,10,5,%r6
+	depd,*= %r4,10,5,%r6
+	depd,*< %r4,10,5,%r6
+	depd,*od %r4,10,5,%r6
+	depd,*tr %r4,10,5,%r6
+	depd,*<> %r4,10,5,%r6
+	depd,*>= %r4,10,5,%r6
+	depd,*ev %r4,10,5,%r6
+
+	depd,z,* %r4,%sar,5,%r6
+	depd,z,*= %r4,%sar,5,%r6
+	depd,z,*< %r4,%sar,5,%r6
+	depd,z,*od %r4,%sar,5,%r6
+	depd,z,*tr %r4,%sar,5,%r6
+	depd,z,*<> %r4,%sar,5,%r6
+	depd,z,*>= %r4,%sar,5,%r6
+	depd,z,*ev %r4,%sar,5,%r6
+
+	depd,* %r4,%sar,5,%r6
+	depd,*= %r4,%sar,5,%r6
+	depd,*< %r4,%sar,5,%r6
+	depd,*od %r4,%sar,5,%r6
+	depd,*tr %r4,%sar,5,%r6
+	depd,*<> %r4,%sar,5,%r6
+	depd,*>= %r4,%sar,5,%r6
+	depd,*ev %r4,%sar,5,%r6
+
+	depdi,* -1,%sar,5,%r6
+	depdi,*= -1,%sar,5,%r6
+	depdi,*< -1,%sar,5,%r6
+	depdi,*od -1,%sar,5,%r6
+	depdi,*tr -1,%sar,5,%r6
+	depdi,*<> -1,%sar,5,%r6
+	depdi,*>= -1,%sar,5,%r6
+	depdi,*ev -1,%sar,5,%r6
+
+	depdi,z,* -1,%sar,5,%r6
+	depdi,z,*= -1,%sar,5,%r6
+	depdi,z,*< -1,%sar,5,%r6
+	depdi,z,*od -1,%sar,5,%r6
+	depdi,z,*tr -1,%sar,5,%r6
+	depdi,z,*<> -1,%sar,5,%r6
+	depdi,z,*>= -1,%sar,5,%r6
+	depdi,z,*ev -1,%sar,5,%r6
+
+	depdi,* -1,10,4,%r6
+	depdi,*= -1,10,4,%r6
+	depdi,*< -1,10,4,%r6
+	depdi,*od -1,10,4,%r6
+	depdi,*tr -1,10,4,%r6
+	depdi,*<> -1,10,4,%r6
+	depdi,*>= -1,10,4,%r6
+	depdi,*ev -1,10,4,%r6
+
+	depdi,z,* -1,10,4,%r6
+	depdi,z,*= -1,10,4,%r6
+	depdi,z,*< -1,10,4,%r6
+	depdi,z,*od -1,10,4,%r6
+	depdi,z,*tr -1,10,4,%r6
+	depdi,z,*<> -1,10,4,%r6
+	depdi,z,*>= -1,10,4,%r6
+	depdi,z,*ev -1,10,4,%r6
diff --git a/gas/testsuite/gas/hppa/basic/ds.s b/gas/testsuite/gas/hppa/basic/ds.s
index 5831e26..709d445 100644
--- a/gas/testsuite/gas/hppa/basic/ds.s
+++ b/gas/testsuite/gas/hppa/basic/ds.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/extract.s b/gas/testsuite/gas/hppa/basic/extract.s
index 29030f4..3cb5a8d 100644
--- a/gas/testsuite/gas/hppa/basic/extract.s
+++ b/gas/testsuite/gas/hppa/basic/extract.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/extract2.s b/gas/testsuite/gas/hppa/basic/extract2.s
new file mode 100644
index 0000000..8075ba7
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/extract2.s
@@ -0,0 +1,42 @@
+	.code
+	.align 4
+; Basic immediate instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	extrw,u %r4,5,10,%r6
+	extrw,u,= %r4,5,10,%r6
+	extrw,u,< %r4,5,10,%r6
+	extrw,u,od %r4,5,10,%r6
+	extrw,u,tr %r4,5,10,%r6
+	extrw,u,<> %r4,5,10,%r6
+	extrw,u,>= %r4,5,10,%r6
+	extrw,u,ev %r4,5,10,%r6
+
+	extrw,s %r4,5,10,%r6
+	extrw,s,= %r4,5,10,%r6
+	extrw,s,< %r4,5,10,%r6
+	extrw,s,od %r4,5,10,%r6
+	extrw,tr %r4,5,10,%r6
+	extrw,<> %r4,5,10,%r6
+	extrw,>= %r4,5,10,%r6
+	extrw,ev %r4,5,10,%r6
+
+	extrw,u %r4,%sar,5,%r6
+	extrw,u,= %r4,%sar,5,%r6
+	extrw,u,< %r4,%sar,5,%r6
+	extrw,u,od %r4,%sar,5,%r6
+	extrw,u,tr %r4,%sar,5,%r6
+	extrw,u,<> %r4,%sar,5,%r6
+	extrw,u,>= %r4,%sar,5,%r6
+	extrw,u,ev %r4,%sar,5,%r6
+	
+	extrw,s %r4,%sar,5,%r6
+	extrw,s,= %r4,%sar,5,%r6
+	extrw,s,< %r4,%sar,5,%r6
+	extrw,s,od %r4,%sar,5,%r6
+	extrw,tr %r4,%sar,5,%r6
+	extrw,<> %r4,%sar,5,%r6
+	extrw,>= %r4,%sar,5,%r6
+	extrw,ev %r4,%sar,5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/extract3.s b/gas/testsuite/gas/hppa/basic/extract3.s
new file mode 100644
index 0000000..f101ceb
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/extract3.s
@@ -0,0 +1,43 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; Basic immediate instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	extrd,u,* %r4,10,5,%r6
+	extrd,u,*= %r4,10,5,%r6
+	extrd,u,*< %r4,10,5,%r6
+	extrd,u,*od %r4,10,5,%r6
+	extrd,u,*tr %r4,10,5,%r6
+	extrd,u,*<> %r4,10,5,%r6
+	extrd,u,*>= %r4,10,5,%r6
+	extrd,u,*ev %r4,10,5,%r6
+
+	extrd,s,* %r4,10,5,%r6
+	extrd,s,*= %r4,10,5,%r6
+	extrd,s,*< %r4,10,5,%r6
+	extrd,s,*od %r4,10,5,%r6
+	extrd,*tr %r4,10,5,%r6
+	extrd,*<> %r4,10,5,%r6
+	extrd,*>= %r4,10,5,%r6
+	extrd,*ev %r4,10,5,%r6
+
+	extrd,u,* %r4,%sar,5,%r6
+	extrd,u,*= %r4,%sar,5,%r6
+	extrd,u,*< %r4,%sar,5,%r6
+	extrd,u,*od %r4,%sar,5,%r6
+	extrd,u,*tr %r4,%sar,5,%r6
+	extrd,u,*<> %r4,%sar,5,%r6
+	extrd,u,*>= %r4,%sar,5,%r6
+	extrd,u,*ev %r4,%sar,5,%r6
+	
+	extrd,s,* %r4,%sar,5,%r6
+	extrd,s,*= %r4,%sar,5,%r6
+	extrd,s,*< %r4,%sar,5,%r6
+	extrd,s,*od %r4,%sar,5,%r6
+	extrd,*tr %r4,%sar,5,%r6
+	extrd,*<> %r4,%sar,5,%r6
+	extrd,*>= %r4,%sar,5,%r6
+	extrd,*ev %r4,%sar,5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/fmem.s b/gas/testsuite/gas/hppa/basic/fmem.s
index b730b40..9a02be7 100644
--- a/gas/testsuite/gas/hppa/basic/fmem.s
+++ b/gas/testsuite/gas/hppa/basic/fmem.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/fp_comp.s b/gas/testsuite/gas/hppa/basic/fp_comp.s
index c1017f7..298e2d6 100644
--- a/gas/testsuite/gas/hppa/basic/fp_comp.s
+++ b/gas/testsuite/gas/hppa/basic/fp_comp.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/fp_comp2.s b/gas/testsuite/gas/hppa/basic/fp_comp2.s
new file mode 100644
index 0000000..0e502b8
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/fp_comp2.s
@@ -0,0 +1,30 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; Basic immediate instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	fmpyfadd,sgl %fr5R,%fr10L,%fr13R,%fr14L
+	fmpyfadd,dbl %fr5,%fr10,%fr13,%fr14
+	fmpyfadd,sgl %fr18R,%fr27L,%fr6R,%fr21L
+	fmpyfadd,dbl %fr18,%fr27,%fr6,%fr21
+
+	fmpynfadd,sgl %fr5R,%fr10L,%fr13R,%fr14L
+	fmpynfadd,dbl %fr5,%fr10,%fr13,%fr14
+	fmpynfadd,sgl %fr18R,%fr27L,%fr6R,%fr21L
+	fmpynfadd,dbl %fr18,%fr27,%fr6,%fr21
+
+	fneg,sgl %fr5,%fr10R
+	fneg,dbl %fr5,%fr10
+	fneg,quad %fr5,%fr10
+	fneg,sgl %fr20R,%fr24L
+	fneg,dbl %fr20,%fr24
+
+	fnegabs,sgl %fr5,%fr10R
+	fnegabs,dbl %fr5,%fr10
+	fnegabs,quad %fr5,%fr10
+	fnegabs,sgl %fr20R,%fr24L
+	fnegabs,dbl %fr20,%fr24
+
diff --git a/gas/testsuite/gas/hppa/basic/fp_conv.s b/gas/testsuite/gas/hppa/basic/fp_conv.s
index 5a44cb1..c2e8a1d 100644
--- a/gas/testsuite/gas/hppa/basic/fp_conv.s
+++ b/gas/testsuite/gas/hppa/basic/fp_conv.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/fp_fcmp.s b/gas/testsuite/gas/hppa/basic/fp_fcmp.s
index fbd092c..d43149e 100644
--- a/gas/testsuite/gas/hppa/basic/fp_fcmp.s
+++ b/gas/testsuite/gas/hppa/basic/fp_fcmp.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/fp_misc.s b/gas/testsuite/gas/hppa/basic/fp_misc.s
index 356ac04..9f24933 100644
--- a/gas/testsuite/gas/hppa/basic/fp_misc.s
+++ b/gas/testsuite/gas/hppa/basic/fp_misc.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/imem.s b/gas/testsuite/gas/hppa/basic/imem.s
index 3c49c12..958b080 100644
--- a/gas/testsuite/gas/hppa/basic/imem.s
+++ b/gas/testsuite/gas/hppa/basic/imem.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT integer_memory_tests,CODE
 	.EXPORT integer_indexing_load,CODE
diff --git a/gas/testsuite/gas/hppa/basic/immed.s b/gas/testsuite/gas/hppa/basic/immed.s
index dd27d2f..f340010 100644
--- a/gas/testsuite/gas/hppa/basic/immed.s
+++ b/gas/testsuite/gas/hppa/basic/immed.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/logical.s b/gas/testsuite/gas/hppa/basic/logical.s
index 771059e..3c62c52 100644
--- a/gas/testsuite/gas/hppa/basic/logical.s
+++ b/gas/testsuite/gas/hppa/basic/logical.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/media.s b/gas/testsuite/gas/hppa/basic/media.s
new file mode 100644
index 0000000..9f0977e
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/media.s
@@ -0,0 +1,38 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 multimedia (halfword) instruction tests
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+
+	hadd %r7,%r11,%r12
+	hadd,ss %r7,%r11,%r12
+	hadd,us %r7,%r11,%r12
+
+	havg %r7,%r11,%r12
+	hshl %r7,13,%r11
+	hshladd %r7,1,%r11,%r12
+	hshladd %r7,2,%r11,%r12
+	hshladd %r7,3,%r11,%r12
+	hshr %r7,13,%r11
+	hshr,s %r7,13,%r11
+	hshr,u %r7,13,%r11
+	hshradd %r7,1,%r11,%r12
+	hshradd %r7,2,%r11,%r12
+	hshradd %r7,3,%r11,%r12
+
+	hsub %r14,%r22,%r9
+	hsub,ss %r14,%r22,%r9
+	hsub,us %r14,%r22,%r9
+
+	mixh,l %r14,%r22,%r9
+	mixh,r %r14,%r22,%r9
+	mixw,l %r14,%r22,%r9
+	mixw,r %r14,%r22,%r9
+
+	permh,0321 %r22,%r9
+	permh,2222 %r22,%r9
+	permh,3030 %r22,%r9
+
diff --git a/gas/testsuite/gas/hppa/basic/perf.s b/gas/testsuite/gas/hppa/basic/perf.s
new file mode 100644
index 0000000..2fd02e2
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/perf.s
@@ -0,0 +1,10 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 performance monitor instruction tests
+
+
+	pmenb
+	pmdis
+	pmdis,n
+
diff --git a/gas/testsuite/gas/hppa/basic/purge.s b/gas/testsuite/gas/hppa/basic/purge.s
index 2319f90..1cc2ed7 100644
--- a/gas/testsuite/gas/hppa/basic/purge.s
+++ b/gas/testsuite/gas/hppa/basic/purge.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/purge2.s b/gas/testsuite/gas/hppa/basic/purge2.s
new file mode 100644
index 0000000..2ce2885
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/purge2.s
@@ -0,0 +1,12 @@
+	.level 2.0
+	.code
+	.align 4
+; PA2.0 purge instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	pdtlb,l %r4(%sr0,%r5)
+	pdtlb,l,m %r4(%sr0,%r5)
+	pitlb,l %r4(%sr4,%r5)
+	pitlb,l,m %r4(%sr4,%r5)
diff --git a/gas/testsuite/gas/hppa/basic/sh1add.s b/gas/testsuite/gas/hppa/basic/sh1add.s
index 325d6cc..0759d1c 100644
--- a/gas/testsuite/gas/hppa/basic/sh1add.s
+++ b/gas/testsuite/gas/hppa/basic/sh1add.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/sh2add.s b/gas/testsuite/gas/hppa/basic/sh2add.s
index d19c99b..df0c8d8 100644
--- a/gas/testsuite/gas/hppa/basic/sh2add.s
+++ b/gas/testsuite/gas/hppa/basic/sh2add.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/sh3add.s b/gas/testsuite/gas/hppa/basic/sh3add.s
index a51e6e3..d20c973 100644
--- a/gas/testsuite/gas/hppa/basic/sh3add.s
+++ b/gas/testsuite/gas/hppa/basic/sh3add.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/shift.s b/gas/testsuite/gas/hppa/basic/shift.s
index 5cc621d..1838c18 100644
--- a/gas/testsuite/gas/hppa/basic/shift.s
+++ b/gas/testsuite/gas/hppa/basic/shift.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/shift2.s b/gas/testsuite/gas/hppa/basic/shift2.s
new file mode 100644
index 0000000..f1bee3c
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/shift2.s
@@ -0,0 +1,24 @@
+	.code
+	.align 4
+; PA 2.0 format shift right instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	shrpw %r4,%r5,%sar,%r6
+	shrpw,= %r4,%r5,%sar,%r6
+	shrpw,< %r4,%r5,%sar,%r6
+	shrpw,od %r4,%r5,%sar,%r6
+	shrpw,tr %r4,%r5,%cr11,%r6
+	shrpw,<> %r4,%r5,%cr11,%r6
+	shrpw,>= %r4,%r5,%cr11,%r6
+	shrpw,ev %r4,%r5,%cr11,%r6
+
+	shrpw %r4,%r5,5,%r6
+	shrpw,= %r4,%r5,5,%r6
+	shrpw,< %r4,%r5,5,%r6
+	shrpw,od %r4,%r5,5,%r6
+	shrpw,tr %r4,%r5,5,%r6
+	shrpw,<> %r4,%r5,5,%r6
+	shrpw,>= %r4,%r5,5,%r6
+	shrpw,ev %r4,%r5,5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/shift3.s b/gas/testsuite/gas/hppa/basic/shift3.s
new file mode 100644
index 0000000..0d00038
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/shift3.s
@@ -0,0 +1,26 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA 2.0 shift right instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	shrpd,* %r4,%r5,%sar,%r6
+	shrpd,*= %r4,%r5,%sar,%r6
+	shrpd,*< %r4,%r5,%sar,%r6
+	shrpd,*od %r4,%r5,%sar,%r6
+	shrpd,*tr %r4,%r5,%cr11,%r6
+	shrpd,*<> %r4,%r5,%cr11,%r6
+	shrpd,*>= %r4,%r5,%cr11,%r6
+	shrpd,*ev %r4,%r5,%cr11,%r6
+
+	shrpd,* %r4,%r5,5,%r6
+	shrpd,*= %r4,%r5,5,%r6
+	shrpd,*< %r4,%r5,5,%r6
+	shrpd,*od %r4,%r5,5,%r6
+	shrpd,*tr %r4,%r5,5,%r6
+	shrpd,*<> %r4,%r5,5,%r6
+	shrpd,*>= %r4,%r5,5,%r6
+	shrpd,*ev %r4,%r5,5,%r6
+
diff --git a/gas/testsuite/gas/hppa/basic/shladd.s b/gas/testsuite/gas/hppa/basic/shladd.s
new file mode 100644
index 0000000..9608478
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/shladd.s
@@ -0,0 +1,160 @@
+	.code
+	.align 4
+; Basic shladd instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	shladd  %r4,1,%r5,%r6
+	shladd,=  %r4,1,%r5,%r6
+	shladd,<  %r4,1,%r5,%r6
+	shladd,<=  %r4,1,%r5,%r6
+	shladd,nuv  %r4,1,%r5,%r6
+	shladd,znv  %r4,1,%r5,%r6
+	shladd,sv  %r4,1,%r5,%r6
+	shladd,od  %r4,1,%r5,%r6
+	shladd,tr  %r4,1,%r5,%r6
+	shladd,<>  %r4,1,%r5,%r6
+	shladd,>=  %r4,1,%r5,%r6
+	shladd,>  %r4,1,%r5,%r6
+	shladd,uv  %r4,1,%r5,%r6
+	shladd,vnz  %r4,1,%r5,%r6
+	shladd,nsv  %r4,1,%r5,%r6
+	shladd,ev  %r4,1,%r5,%r6
+
+	shladd,l  %r4,1,%r5,%r6
+	shladd,l,=  %r4,1,%r5,%r6
+	shladd,l,<  %r4,1,%r5,%r6
+	shladd,l,<=  %r4,1,%r5,%r6
+	shladd,l,nuv  %r4,1,%r5,%r6
+	shladd,l,znv  %r4,1,%r5,%r6
+	shladd,l,sv  %r4,1,%r5,%r6
+	shladd,l,od  %r4,1,%r5,%r6
+	shladd,l,tr  %r4,1,%r5,%r6
+	shladd,l,<>  %r4,1,%r5,%r6
+	shladd,l,>=  %r4,1,%r5,%r6
+	shladd,l,>  %r4,1,%r5,%r6
+	shladd,l,uv  %r4,1,%r5,%r6
+	shladd,l,vnz  %r4,1,%r5,%r6
+	shladd,l,nsv  %r4,1,%r5,%r6
+	shladd,l,ev  %r4,1,%r5,%r6
+
+	shladd,tsv  %r4,1,%r5,%r6
+	shladd,tsv,=  %r4,1,%r5,%r6
+	shladd,tsv,<  %r4,1,%r5,%r6
+	shladd,tsv,<=  %r4,1,%r5,%r6
+	shladd,tsv,nuv  %r4,1,%r5,%r6
+	shladd,tsv,znv  %r4,1,%r5,%r6
+	shladd,tsv,sv  %r4,1,%r5,%r6
+	shladd,tsv,od  %r4,1,%r5,%r6
+	shladd,tsv,tr  %r4,1,%r5,%r6
+	shladd,tsv,<>  %r4,1,%r5,%r6
+	shladd,tsv,>=  %r4,1,%r5,%r6
+	shladd,tsv,>  %r4,1,%r5,%r6
+	shladd,tsv,uv  %r4,1,%r5,%r6
+	shladd,tsv,vnz  %r4,1,%r5,%r6
+	shladd,tsv,nsv  %r4,1,%r5,%r6
+	shladd,tsv,ev  %r4,1,%r5,%r6
+
+	shladd  %r4,2,%r5,%r6
+	shladd,=  %r4,2,%r5,%r6
+	shladd,<  %r4,2,%r5,%r6
+	shladd,<=  %r4,2,%r5,%r6
+	shladd,nuv  %r4,2,%r5,%r6
+	shladd,znv  %r4,2,%r5,%r6
+	shladd,sv  %r4,2,%r5,%r6
+	shladd,od  %r4,2,%r5,%r6
+	shladd,tr  %r4,2,%r5,%r6
+	shladd,<>  %r4,2,%r5,%r6
+	shladd,>=  %r4,2,%r5,%r6
+	shladd,>  %r4,2,%r5,%r6
+	shladd,uv  %r4,2,%r5,%r6
+	shladd,vnz  %r4,2,%r5,%r6
+	shladd,nsv  %r4,2,%r5,%r6
+	shladd,ev  %r4,2,%r5,%r6
+
+	shladd,l  %r4,2,%r5,%r6
+	shladd,l,=  %r4,2,%r5,%r6
+	shladd,l,<  %r4,2,%r5,%r6
+	shladd,l,<=  %r4,2,%r5,%r6
+	shladd,l,nuv  %r4,2,%r5,%r6
+	shladd,l,znv  %r4,2,%r5,%r6
+	shladd,l,sv  %r4,2,%r5,%r6
+	shladd,l,od  %r4,2,%r5,%r6
+	shladd,l,tr  %r4,2,%r5,%r6
+	shladd,l,<>  %r4,2,%r5,%r6
+	shladd,l,>=  %r4,2,%r5,%r6
+	shladd,l,>  %r4,2,%r5,%r6
+	shladd,l,uv  %r4,2,%r5,%r6
+	shladd,l,vnz  %r4,2,%r5,%r6
+	shladd,l,nsv  %r4,2,%r5,%r6
+	shladd,l,ev  %r4,2,%r5,%r6
+
+	shladd,tsv  %r4,2,%r5,%r6
+	shladd,tsv,=  %r4,2,%r5,%r6
+	shladd,tsv,<  %r4,2,%r5,%r6
+	shladd,tsv,<=  %r4,2,%r5,%r6
+	shladd,tsv,nuv  %r4,2,%r5,%r6
+	shladd,tsv,znv  %r4,2,%r5,%r6
+	shladd,tsv,sv  %r4,2,%r5,%r6
+	shladd,tsv,od  %r4,2,%r5,%r6
+	shladd,tsv,tr  %r4,2,%r5,%r6
+	shladd,tsv,<>  %r4,2,%r5,%r6
+	shladd,tsv,>=  %r4,2,%r5,%r6
+	shladd,tsv,>  %r4,2,%r5,%r6
+	shladd,tsv,uv  %r4,2,%r5,%r6
+	shladd,tsv,vnz  %r4,2,%r5,%r6
+	shladd,tsv,nsv  %r4,2,%r5,%r6
+	shladd,tsv,ev  %r4,2,%r5,%r6
+
+	shladd  %r4,3,%r5,%r6
+	shladd,=  %r4,3,%r5,%r6
+	shladd,<  %r4,3,%r5,%r6
+	shladd,<=  %r4,3,%r5,%r6
+	shladd,nuv  %r4,3,%r5,%r6
+	shladd,znv  %r4,3,%r5,%r6
+	shladd,sv  %r4,3,%r5,%r6
+	shladd,od  %r4,3,%r5,%r6
+	shladd,tr  %r4,3,%r5,%r6
+	shladd,<>  %r4,3,%r5,%r6
+	shladd,>=  %r4,3,%r5,%r6
+	shladd,>  %r4,3,%r5,%r6
+	shladd,uv  %r4,3,%r5,%r6
+	shladd,vnz  %r4,3,%r5,%r6
+	shladd,nsv  %r4,3,%r5,%r6
+	shladd,ev  %r4,3,%r5,%r6
+
+	shladd,l  %r4,3,%r5,%r6
+	shladd,l,=  %r4,3,%r5,%r6
+	shladd,l,<  %r4,3,%r5,%r6
+	shladd,l,<=  %r4,3,%r5,%r6
+	shladd,l,nuv  %r4,3,%r5,%r6
+	shladd,l,znv  %r4,3,%r5,%r6
+	shladd,l,sv  %r4,3,%r5,%r6
+	shladd,l,od  %r4,3,%r5,%r6
+	shladd,l,tr  %r4,3,%r5,%r6
+	shladd,l,<>  %r4,3,%r5,%r6
+	shladd,l,>=  %r4,3,%r5,%r6
+	shladd,l,>  %r4,3,%r5,%r6
+	shladd,l,uv  %r4,3,%r5,%r6
+	shladd,l,vnz  %r4,3,%r5,%r6
+	shladd,l,nsv  %r4,3,%r5,%r6
+	shladd,l,ev  %r4,3,%r5,%r6
+
+	shladd,tsv  %r4,3,%r5,%r6
+	shladd,tsv,=  %r4,3,%r5,%r6
+	shladd,tsv,<  %r4,3,%r5,%r6
+	shladd,tsv,<=  %r4,3,%r5,%r6
+	shladd,tsv,nuv  %r4,3,%r5,%r6
+	shladd,tsv,znv  %r4,3,%r5,%r6
+	shladd,tsv,sv  %r4,3,%r5,%r6
+	shladd,tsv,od  %r4,3,%r5,%r6
+	shladd,tsv,tr  %r4,3,%r5,%r6
+	shladd,tsv,<>  %r4,3,%r5,%r6
+	shladd,tsv,>=  %r4,3,%r5,%r6
+	shladd,tsv,>  %r4,3,%r5,%r6
+	shladd,tsv,uv  %r4,3,%r5,%r6
+	shladd,tsv,vnz  %r4,3,%r5,%r6
+	shladd,tsv,nsv  %r4,3,%r5,%r6
+	shladd,tsv,ev  %r4,3,%r5,%r6
+
diff --git a/gas/testsuite/gas/hppa/basic/shladd2.s b/gas/testsuite/gas/hppa/basic/shladd2.s
new file mode 100644
index 0000000..c0bb67b
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/shladd2.s
@@ -0,0 +1,161 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 shladd instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	shladd,*  %r4,1,%r5,%r6
+	shladd,*=  %r4,1,%r5,%r6
+	shladd,*<  %r4,1,%r5,%r6
+	shladd,*<=  %r4,1,%r5,%r6
+	shladd,*nuv  %r4,1,%r5,%r6
+	shladd,*znv  %r4,1,%r5,%r6
+	shladd,*sv  %r4,1,%r5,%r6
+	shladd,*od  %r4,1,%r5,%r6
+	shladd,*tr  %r4,1,%r5,%r6
+	shladd,*<>  %r4,1,%r5,%r6
+	shladd,*>=  %r4,1,%r5,%r6
+	shladd,*>  %r4,1,%r5,%r6
+	shladd,*uv  %r4,1,%r5,%r6
+	shladd,*vnz  %r4,1,%r5,%r6
+	shladd,*nsv  %r4,1,%r5,%r6
+	shladd,*ev  %r4,1,%r5,%r6
+
+	shladd,l,*  %r4,1,%r5,%r6
+	shladd,l,*=  %r4,1,%r5,%r6
+	shladd,l,*<  %r4,1,%r5,%r6
+	shladd,l,*<=  %r4,1,%r5,%r6
+	shladd,l,*nuv  %r4,1,%r5,%r6
+	shladd,l,*znv  %r4,1,%r5,%r6
+	shladd,l,*sv  %r4,1,%r5,%r6
+	shladd,l,*od  %r4,1,%r5,%r6
+	shladd,l,*tr  %r4,1,%r5,%r6
+	shladd,l,*<>  %r4,1,%r5,%r6
+	shladd,l,*>=  %r4,1,%r5,%r6
+	shladd,l,*>  %r4,1,%r5,%r6
+	shladd,l,*uv  %r4,1,%r5,%r6
+	shladd,l,*vnz  %r4,1,%r5,%r6
+	shladd,l,*nsv  %r4,1,%r5,%r6
+	shladd,l,*ev  %r4,1,%r5,%r6
+
+	shladd,tsv,*  %r4,1,%r5,%r6
+	shladd,tsv,*=  %r4,1,%r5,%r6
+	shladd,tsv,*<  %r4,1,%r5,%r6
+	shladd,tsv,*<=  %r4,1,%r5,%r6
+	shladd,tsv,*nuv  %r4,1,%r5,%r6
+	shladd,tsv,*znv  %r4,1,%r5,%r6
+	shladd,tsv,*sv  %r4,1,%r5,%r6
+	shladd,tsv,*od  %r4,1,%r5,%r6
+	shladd,tsv,*tr  %r4,1,%r5,%r6
+	shladd,tsv,*<>  %r4,1,%r5,%r6
+	shladd,tsv,*>=  %r4,1,%r5,%r6
+	shladd,tsv,*>  %r4,1,%r5,%r6
+	shladd,tsv,*uv  %r4,1,%r5,%r6
+	shladd,tsv,*vnz  %r4,1,%r5,%r6
+	shladd,tsv,*nsv  %r4,1,%r5,%r6
+	shladd,tsv,*ev  %r4,1,%r5,%r6
+
+	shladd,*  %r4,2,%r5,%r6
+	shladd,*=  %r4,2,%r5,%r6
+	shladd,*<  %r4,2,%r5,%r6
+	shladd,*<=  %r4,2,%r5,%r6
+	shladd,*nuv  %r4,2,%r5,%r6
+	shladd,*znv  %r4,2,%r5,%r6
+	shladd,*sv  %r4,2,%r5,%r6
+	shladd,*od  %r4,2,%r5,%r6
+	shladd,*tr  %r4,2,%r5,%r6
+	shladd,*<>  %r4,2,%r5,%r6
+	shladd,*>=  %r4,2,%r5,%r6
+	shladd,*>  %r4,2,%r5,%r6
+	shladd,*uv  %r4,2,%r5,%r6
+	shladd,*vnz  %r4,2,%r5,%r6
+	shladd,*nsv  %r4,2,%r5,%r6
+	shladd,*ev  %r4,2,%r5,%r6
+
+	shladd,l,*  %r4,2,%r5,%r6
+	shladd,l,*=  %r4,2,%r5,%r6
+	shladd,l,*<  %r4,2,%r5,%r6
+	shladd,l,*<=  %r4,2,%r5,%r6
+	shladd,l,*nuv  %r4,2,%r5,%r6
+	shladd,l,*znv  %r4,2,%r5,%r6
+	shladd,l,*sv  %r4,2,%r5,%r6
+	shladd,l,*od  %r4,2,%r5,%r6
+	shladd,l,*tr  %r4,2,%r5,%r6
+	shladd,l,*<>  %r4,2,%r5,%r6
+	shladd,l,*>=  %r4,2,%r5,%r6
+	shladd,l,*>  %r4,2,%r5,%r6
+	shladd,l,*uv  %r4,2,%r5,%r6
+	shladd,l,*vnz  %r4,2,%r5,%r6
+	shladd,l,*nsv  %r4,2,%r5,%r6
+	shladd,l,*ev  %r4,2,%r5,%r6
+
+	shladd,tsv,*  %r4,2,%r5,%r6
+	shladd,tsv,*=  %r4,2,%r5,%r6
+	shladd,tsv,*<  %r4,2,%r5,%r6
+	shladd,tsv,*<=  %r4,2,%r5,%r6
+	shladd,tsv,*nuv  %r4,2,%r5,%r6
+	shladd,tsv,*znv  %r4,2,%r5,%r6
+	shladd,tsv,*sv  %r4,2,%r5,%r6
+	shladd,tsv,*od  %r4,2,%r5,%r6
+	shladd,tsv,*tr  %r4,2,%r5,%r6
+	shladd,tsv,*<>  %r4,2,%r5,%r6
+	shladd,tsv,*>=  %r4,2,%r5,%r6
+	shladd,tsv,*>  %r4,2,%r5,%r6
+	shladd,tsv,*uv  %r4,2,%r5,%r6
+	shladd,tsv,*vnz  %r4,2,%r5,%r6
+	shladd,tsv,*nsv  %r4,2,%r5,%r6
+	shladd,tsv,*ev  %r4,2,%r5,%r6
+
+	shladd,*  %r4,3,%r5,%r6
+	shladd,*=  %r4,3,%r5,%r6
+	shladd,*<  %r4,3,%r5,%r6
+	shladd,*<=  %r4,3,%r5,%r6
+	shladd,*nuv  %r4,3,%r5,%r6
+	shladd,*znv  %r4,3,%r5,%r6
+	shladd,*sv  %r4,3,%r5,%r6
+	shladd,*od  %r4,3,%r5,%r6
+	shladd,*tr  %r4,3,%r5,%r6
+	shladd,*<>  %r4,3,%r5,%r6
+	shladd,*>=  %r4,3,%r5,%r6
+	shladd,*>  %r4,3,%r5,%r6
+	shladd,*uv  %r4,3,%r5,%r6
+	shladd,*vnz  %r4,3,%r5,%r6
+	shladd,*nsv  %r4,3,%r5,%r6
+	shladd,*ev  %r4,3,%r5,%r6
+
+	shladd,l,*  %r4,3,%r5,%r6
+	shladd,l,*=  %r4,3,%r5,%r6
+	shladd,l,*<  %r4,3,%r5,%r6
+	shladd,l,*<=  %r4,3,%r5,%r6
+	shladd,l,*nuv  %r4,3,%r5,%r6
+	shladd,l,*znv  %r4,3,%r5,%r6
+	shladd,l,*sv  %r4,3,%r5,%r6
+	shladd,l,*od  %r4,3,%r5,%r6
+	shladd,l,*tr  %r4,3,%r5,%r6
+	shladd,l,*<>  %r4,3,%r5,%r6
+	shladd,l,*>=  %r4,3,%r5,%r6
+	shladd,l,*>  %r4,3,%r5,%r6
+	shladd,l,*uv  %r4,3,%r5,%r6
+	shladd,l,*vnz  %r4,3,%r5,%r6
+	shladd,l,*nsv  %r4,3,%r5,%r6
+	shladd,l,*ev  %r4,3,%r5,%r6
+
+	shladd,tsv,*  %r4,3,%r5,%r6
+	shladd,tsv,*=  %r4,3,%r5,%r6
+	shladd,tsv,*<  %r4,3,%r5,%r6
+	shladd,tsv,*<=  %r4,3,%r5,%r6
+	shladd,tsv,*nuv  %r4,3,%r5,%r6
+	shladd,tsv,*znv  %r4,3,%r5,%r6
+	shladd,tsv,*sv  %r4,3,%r5,%r6
+	shladd,tsv,*od  %r4,3,%r5,%r6
+	shladd,tsv,*tr  %r4,3,%r5,%r6
+	shladd,tsv,*<>  %r4,3,%r5,%r6
+	shladd,tsv,*>=  %r4,3,%r5,%r6
+	shladd,tsv,*>  %r4,3,%r5,%r6
+	shladd,tsv,*uv  %r4,3,%r5,%r6
+	shladd,tsv,*vnz  %r4,3,%r5,%r6
+	shladd,tsv,*nsv  %r4,3,%r5,%r6
+	shladd,tsv,*ev  %r4,3,%r5,%r6
+
diff --git a/gas/testsuite/gas/hppa/basic/special.s b/gas/testsuite/gas/hppa/basic/special.s
index d341667..e61ce9a 100644
--- a/gas/testsuite/gas/hppa/basic/special.s
+++ b/gas/testsuite/gas/hppa/basic/special.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	gfw %r4(%sr0,%r5)
 	gfw,m %r4(%sr0,%r5)
diff --git a/gas/testsuite/gas/hppa/basic/spop.s b/gas/testsuite/gas/hppa/basic/spop.s
index 9076a95..01f64d6 100644
--- a/gas/testsuite/gas/hppa/basic/spop.s
+++ b/gas/testsuite/gas/hppa/basic/spop.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; We could/should test some of the corner cases for register and 
 ; immediate fields.  We should also check the assorted field
diff --git a/gas/testsuite/gas/hppa/basic/sub.s b/gas/testsuite/gas/hppa/basic/sub.s
index 64ff0df..16c2ca3 100644
--- a/gas/testsuite/gas/hppa/basic/sub.s
+++ b/gas/testsuite/gas/hppa/basic/sub.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
@@ -115,3 +106,88 @@
 	subto,>> %r4,%r5,%r6
 	subto,nsv %r4,%r5,%r6
 	subto,ev %r4,%r5,%r6
+
+	sub,tsv %r4,%r5,%r6
+	sub,tsv,= %r4,%r5,%r6
+	sub,tsv,< %r4,%r5,%r6
+	sub,tsv,<= %r4,%r5,%r6
+	sub,tsv,<< %r4,%r5,%r6
+	sub,tsv,<<= %r4,%r5,%r6
+	sub,tsv,sv %r4,%r5,%r6
+	sub,tsv,od %r4,%r5,%r6
+	sub,tsv,tr %r4,%r5,%r6
+	sub,tsv,<> %r4,%r5,%r6
+	sub,tsv,>= %r4,%r5,%r6
+	sub,tsv,> %r4,%r5,%r6
+	sub,tsv,>>= %r4,%r5,%r6
+	sub,tsv,>> %r4,%r5,%r6
+	sub,tsv,nsv %r4,%r5,%r6
+	sub,tsv,ev %r4,%r5,%r6
+
+	sub,b %r4,%r5,%r6
+	sub,b,= %r4,%r5,%r6
+	sub,b,< %r4,%r5,%r6
+	sub,b,<= %r4,%r5,%r6
+	sub,b,<< %r4,%r5,%r6
+	sub,b,<<= %r4,%r5,%r6
+	sub,b,sv %r4,%r5,%r6
+	sub,b,od %r4,%r5,%r6
+	sub,b,tr %r4,%r5,%r6
+	sub,b,<> %r4,%r5,%r6
+	sub,b,>= %r4,%r5,%r6
+	sub,b,> %r4,%r5,%r6
+	sub,b,>>= %r4,%r5,%r6
+	sub,b,>> %r4,%r5,%r6
+	sub,b,nsv %r4,%r5,%r6
+	sub,b,ev %r4,%r5,%r6
+
+	sub,b,tsv %r4,%r5,%r6
+	sub,b,tsv,= %r4,%r5,%r6
+	sub,b,tsv,< %r4,%r5,%r6
+	sub,b,tsv,<= %r4,%r5,%r6
+	sub,b,tsv,<< %r4,%r5,%r6
+	sub,b,tsv,<<= %r4,%r5,%r6
+	sub,b,tsv,sv %r4,%r5,%r6
+	sub,b,tsv,od %r4,%r5,%r6
+	sub,tsv,b,tr %r4,%r5,%r6
+	sub,tsv,b,<> %r4,%r5,%r6
+	sub,tsv,b,>= %r4,%r5,%r6
+	sub,tsv,b,> %r4,%r5,%r6
+	sub,tsv,b,>>= %r4,%r5,%r6
+	sub,tsv,b,>> %r4,%r5,%r6
+	sub,tsv,b,nsv %r4,%r5,%r6
+	sub,tsv,b,ev %r4,%r5,%r6
+
+	sub,tc %r4,%r5,%r6
+	sub,tc,= %r4,%r5,%r6
+	sub,tc,< %r4,%r5,%r6
+	sub,tc,<= %r4,%r5,%r6
+	sub,tc,<< %r4,%r5,%r6
+	sub,tc,<<= %r4,%r5,%r6
+	sub,tc,sv %r4,%r5,%r6
+	sub,tc,od %r4,%r5,%r6
+	sub,tc,tr %r4,%r5,%r6
+	sub,tc,<> %r4,%r5,%r6
+	sub,tc,>= %r4,%r5,%r6
+	sub,tc,> %r4,%r5,%r6
+	sub,tc,>>= %r4,%r5,%r6
+	sub,tc,>> %r4,%r5,%r6
+	sub,tc,nsv %r4,%r5,%r6
+	sub,tc,ev %r4,%r5,%r6
+
+	sub,tc,tsv %r4,%r5,%r6
+	sub,tc,tsv,= %r4,%r5,%r6
+	sub,tc,tsv,< %r4,%r5,%r6
+	sub,tc,tsv,<= %r4,%r5,%r6
+	sub,tc,tsv,<< %r4,%r5,%r6
+	sub,tc,tsv,<<= %r4,%r5,%r6
+	sub,tc,tsv,sv %r4,%r5,%r6
+	sub,tc,tsv,od %r4,%r5,%r6
+	sub,tsv,tc,tr %r4,%r5,%r6
+	sub,tsv,tc,<> %r4,%r5,%r6
+	sub,tsv,tc,>= %r4,%r5,%r6
+	sub,tsv,tc,> %r4,%r5,%r6
+	sub,tsv,tc,>>= %r4,%r5,%r6
+	sub,tsv,tc,>> %r4,%r5,%r6
+	sub,tsv,tc,nsv %r4,%r5,%r6
+	sub,tsv,tc,ev %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/sub2.s b/gas/testsuite/gas/hppa/basic/sub2.s
new file mode 100644
index 0000000..af0435e
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/sub2.s
@@ -0,0 +1,109 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; Basic immediate instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	sub,* %r4,%r5,%r6
+	sub,*= %r4,%r5,%r6
+	sub,*< %r4,%r5,%r6
+	sub,*<= %r4,%r5,%r6
+	sub,*<< %r4,%r5,%r6
+	sub,*<<= %r4,%r5,%r6
+	sub,*sv %r4,%r5,%r6
+	sub,*od %r4,%r5,%r6
+	sub,*tr %r4,%r5,%r6
+	sub,*<> %r4,%r5,%r6
+	sub,*>= %r4,%r5,%r6
+	sub,*> %r4,%r5,%r6
+	sub,*>>= %r4,%r5,%r6
+	sub,*>> %r4,%r5,%r6
+	sub,*nsv %r4,%r5,%r6
+	sub,*ev %r4,%r5,%r6
+
+	sub,tsv,* %r4,%r5,%r6
+	sub,tsv,*= %r4,%r5,%r6
+	sub,tsv,*< %r4,%r5,%r6
+	sub,tsv,*<= %r4,%r5,%r6
+	sub,tsv,*<< %r4,%r5,%r6
+	sub,tsv,*<<= %r4,%r5,%r6
+	sub,tsv,*sv %r4,%r5,%r6
+	sub,tsv,*od %r4,%r5,%r6
+	sub,tsv,*tr %r4,%r5,%r6
+	sub,tsv,*<> %r4,%r5,%r6
+	sub,tsv,*>= %r4,%r5,%r6
+	sub,tsv,*> %r4,%r5,%r6
+	sub,tsv,*>>= %r4,%r5,%r6
+	sub,tsv,*>> %r4,%r5,%r6
+	sub,tsv,*nsv %r4,%r5,%r6
+	sub,tsv,*ev %r4,%r5,%r6
+
+	sub,db,* %r4,%r5,%r6
+	sub,db,*= %r4,%r5,%r6
+	sub,db,*< %r4,%r5,%r6
+	sub,db,*<= %r4,%r5,%r6
+	sub,db,*<< %r4,%r5,%r6
+	sub,db,*<<= %r4,%r5,%r6
+	sub,db,*sv %r4,%r5,%r6
+	sub,db,*od %r4,%r5,%r6
+	sub,db,*tr %r4,%r5,%r6
+	sub,db,*<> %r4,%r5,%r6
+	sub,db,*>= %r4,%r5,%r6
+	sub,db,*> %r4,%r5,%r6
+	sub,db,*>>= %r4,%r5,%r6
+	sub,db,*>> %r4,%r5,%r6
+	sub,db,*nsv %r4,%r5,%r6
+	sub,db,*ev %r4,%r5,%r6
+
+	sub,db,tsv,* %r4,%r5,%r6
+	sub,db,tsv,*= %r4,%r5,%r6
+	sub,db,tsv,*< %r4,%r5,%r6
+	sub,db,tsv,*<= %r4,%r5,%r6
+	sub,db,tsv,*<< %r4,%r5,%r6
+	sub,db,tsv,*<<= %r4,%r5,%r6
+	sub,db,tsv,*sv %r4,%r5,%r6
+	sub,db,tsv,*od %r4,%r5,%r6
+	sub,tsv,db,*tr %r4,%r5,%r6
+	sub,tsv,db,*<> %r4,%r5,%r6
+	sub,tsv,db,*>= %r4,%r5,%r6
+	sub,tsv,db,*> %r4,%r5,%r6
+	sub,tsv,db,*>>= %r4,%r5,%r6
+	sub,tsv,db,*>> %r4,%r5,%r6
+	sub,tsv,db,*nsv %r4,%r5,%r6
+	sub,tsv,db,*ev %r4,%r5,%r6
+
+	sub,tc,* %r4,%r5,%r6
+	sub,tc,*= %r4,%r5,%r6
+	sub,tc,*< %r4,%r5,%r6
+	sub,tc,*<= %r4,%r5,%r6
+	sub,tc,*<< %r4,%r5,%r6
+	sub,tc,*<<= %r4,%r5,%r6
+	sub,tc,*sv %r4,%r5,%r6
+	sub,tc,*od %r4,%r5,%r6
+	sub,tc,*tr %r4,%r5,%r6
+	sub,tc,*<> %r4,%r5,%r6
+	sub,tc,*>= %r4,%r5,%r6
+	sub,tc,*> %r4,%r5,%r6
+	sub,tc,*>>= %r4,%r5,%r6
+	sub,tc,*>> %r4,%r5,%r6
+	sub,tc,*nsv %r4,%r5,%r6
+	sub,tc,*ev %r4,%r5,%r6
+
+	sub,tc,tsv,* %r4,%r5,%r6
+	sub,tc,tsv,*= %r4,%r5,%r6
+	sub,tc,tsv,*< %r4,%r5,%r6
+	sub,tc,tsv,*<= %r4,%r5,%r6
+	sub,tc,tsv,*<< %r4,%r5,%r6
+	sub,tc,tsv,*<<= %r4,%r5,%r6
+	sub,tc,tsv,*sv %r4,%r5,%r6
+	sub,tc,tsv,*od %r4,%r5,%r6
+	sub,tsv,tc,*tr %r4,%r5,%r6
+	sub,tsv,tc,*<> %r4,%r5,%r6
+	sub,tsv,tc,*>= %r4,%r5,%r6
+	sub,tsv,tc,*> %r4,%r5,%r6
+	sub,tsv,tc,*>>= %r4,%r5,%r6
+	sub,tsv,tc,*>> %r4,%r5,%r6
+	sub,tsv,tc,*nsv %r4,%r5,%r6
+	sub,tsv,tc,*ev %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/subi.s b/gas/testsuite/gas/hppa/basic/subi.s
index 063267c..5a043da 100644
--- a/gas/testsuite/gas/hppa/basic/subi.s
+++ b/gas/testsuite/gas/hppa/basic/subi.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
@@ -47,3 +38,20 @@
 	subio,>> 123,%r5,%r6
 	subio,nsv 123,%r5,%r6
 	subio,ev 123,%r5,%r6
+
+	subi,tsv 123,%r5,%r6
+	subi,tsv,= 123,%r5,%r6
+	subi,tsv,< 123,%r5,%r6
+	subi,tsv,<= 123,%r5,%r6
+	subi,tsv,<< 123,%r5,%r6
+	subi,tsv,<<= 123,%r5,%r6
+	subi,tsv,sv 123,%r5,%r6
+	subi,tsv,od 123,%r5,%r6
+	subi,tsv,tr 123,%r5,%r6
+	subi,tsv,<> 123,%r5,%r6
+	subi,tsv,>= 123,%r5,%r6
+	subi,tsv,> 123,%r5,%r6
+	subi,tsv,>>= 123,%r5,%r6
+	subi,tsv,>> 123,%r5,%r6
+	subi,tsv,nsv 123,%r5,%r6
+	subi,tsv,ev 123,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/system.s b/gas/testsuite/gas/hppa/basic/system.s
index 1b2e7bf..b9846b9 100644
--- a/gas/testsuite/gas/hppa/basic/system.s
+++ b/gas/testsuite/gas/hppa/basic/system.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; Basic immediate instruction tests.  
 ;
diff --git a/gas/testsuite/gas/hppa/basic/system2.s b/gas/testsuite/gas/hppa/basic/system2.s
new file mode 100644
index 0000000..42733a8
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/system2.s
@@ -0,0 +1,19 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 system instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+	rfi
+	rfi,r
+	ssm 923,%r4
+	rsm 923,%r4
+	mfctl,w %cr11,%r4
+
+	probe,r (%sr0,%r5),%r6,%r7
+	probei,r (%sr0,%r5),1,%r7
+	probe,w (%sr0,%r5),%r6,%r7
+	probei,w (%sr0,%r5),1,%r7
+	
diff --git a/gas/testsuite/gas/hppa/basic/unit.s b/gas/testsuite/gas/hppa/basic/unit.s
index b69b10e..2f2fefd 100644
--- a/gas/testsuite/gas/hppa/basic/unit.s
+++ b/gas/testsuite/gas/hppa/basic/unit.s
@@ -1,15 +1,6 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
-; Basic immediate instruction tests.  
+; Basic unit instruction tests.  
 ;
 ; We could/should test some of the corner cases for register and 
 ; immediate fields.  We should also check the assorted field
@@ -53,3 +44,16 @@
 	uaddcmt,ndc %r4,%r5,%r6
 	uaddcmt,nbc %r4,%r5,%r6
 	uaddcmt,nhc %r4,%r5,%r6
+
+	uaddcm,tc %r4,%r5,%r6
+	uaddcm,tc,sbz %r4,%r5,%r6
+	uaddcm,tc,shz %r4,%r5,%r6
+	uaddcm,tc,sdc %r4,%r5,%r6
+	uaddcm,tc,sbc %r4,%r5,%r6
+	uaddcm,tc,shc %r4,%r5,%r6
+	uaddcm,tc,tr %r4,%r5,%r6
+	uaddcm,tc,nbz %r4,%r5,%r6
+	uaddcm,tc,nhz %r4,%r5,%r6
+	uaddcm,tc,ndc %r4,%r5,%r6
+	uaddcm,tc,nbc %r4,%r5,%r6
+	uaddcm,tc,nhc %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/basic/unit2.s b/gas/testsuite/gas/hppa/basic/unit2.s
new file mode 100644
index 0000000..1707dae
--- /dev/null
+++ b/gas/testsuite/gas/hppa/basic/unit2.s
@@ -0,0 +1,47 @@
+	.LEVEL 2.0
+	.code
+	.align 4
+; PA2.0 unit instruction tests.  
+;
+; We could/should test some of the corner cases for register and 
+; immediate fields.  We should also check the assorted field
+; selectors to make sure they're handled correctly.
+
+	uxor,* %r4,%r5,%r6
+	uxor,*sbz %r4,%r5,%r6
+	uxor,*shz %r4,%r5,%r6
+	uxor,*sdc %r4,%r5,%r6
+	uxor,*sbc %r4,%r5,%r6
+	uxor,*shc %r4,%r5,%r6
+	uxor,*tr %r4,%r5,%r6
+	uxor,*nbz %r4,%r5,%r6
+	uxor,*nhz %r4,%r5,%r6
+	uxor,*ndc %r4,%r5,%r6
+	uxor,*nbc %r4,%r5,%r6
+	uxor,*nhc %r4,%r5,%r6
+
+	uaddcm,* %r4,%r5,%r6
+	uaddcm,*sbz %r4,%r5,%r6
+	uaddcm,*shz %r4,%r5,%r6
+	uaddcm,*sdc %r4,%r5,%r6
+	uaddcm,*sbc %r4,%r5,%r6
+	uaddcm,*shc %r4,%r5,%r6
+	uaddcm,*tr %r4,%r5,%r6
+	uaddcm,*nbz %r4,%r5,%r6
+	uaddcm,*nhz %r4,%r5,%r6
+	uaddcm,*ndc %r4,%r5,%r6
+	uaddcm,*nbc %r4,%r5,%r6
+	uaddcm,*nhc %r4,%r5,%r6
+
+	uaddcm,tc,* %r4,%r5,%r6
+	uaddcm,tc,*sbz %r4,%r5,%r6
+	uaddcm,tc,*shz %r4,%r5,%r6
+	uaddcm,tc,*sdc %r4,%r5,%r6
+	uaddcm,tc,*sbc %r4,%r5,%r6
+	uaddcm,tc,*shc %r4,%r5,%r6
+	uaddcm,tc,*tr %r4,%r5,%r6
+	uaddcm,tc,*nbz %r4,%r5,%r6
+	uaddcm,tc,*nhz %r4,%r5,%r6
+	uaddcm,tc,*ndc %r4,%r5,%r6
+	uaddcm,tc,*nbc %r4,%r5,%r6
+	uaddcm,tc,*nhc %r4,%r5,%r6
diff --git a/gas/testsuite/gas/hppa/parse/align1.s b/gas/testsuite/gas/hppa/parse/align1.s
index df81e96..0494af3 100644
--- a/gas/testsuite/gas/hppa/parse/align1.s
+++ b/gas/testsuite/gas/hppa/parse/align1.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 1
 	.align 8
 	nop
@@ -18,8 +9,7 @@
 	nop
 
 
-        .SPACE  $PRIVATE$
-        .SUBSPA $BSS$
+	.data
 
         .ALIGN  8
 $L00BSS:
diff --git a/gas/testsuite/gas/hppa/parse/align2.s b/gas/testsuite/gas/hppa/parse/align2.s
index af734c8..1fa358e 100644
--- a/gas/testsuite/gas/hppa/parse/align2.s
+++ b/gas/testsuite/gas/hppa/parse/align2.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 3
 
 	
diff --git a/gas/testsuite/gas/hppa/parse/badfmpyadd.s b/gas/testsuite/gas/hppa/parse/badfmpyadd.s
index fd1c1f8..f93f429 100644
--- a/gas/testsuite/gas/hppa/parse/badfmpyadd.s
+++ b/gas/testsuite/gas/hppa/parse/badfmpyadd.s
@@ -1,15 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT foobar,ENTRY,PRIV_LEV=3,ARGW0=FR,ARGW1=FU,ARGW2=FR,ARGW3=FU,RTNVAL=FR
 foobar
@@ -26,8 +15,7 @@
 	fstds %fr5,0(%r19)
 	.EXIT
 	.PROCEND
-	.SPACE $PRIVATE$
-	.SUBSPA $BSS$
+	.bss
 
 x	.comm 8
 y	.comm 8
diff --git a/gas/testsuite/gas/hppa/parse/block1.s b/gas/testsuite/gas/hppa/parse/block1.s
index 317699f..4f12ab5 100644
--- a/gas/testsuite/gas/hppa/parse/block1.s
+++ b/gas/testsuite/gas/hppa/parse/block1.s
@@ -1,12 +1,5 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+	.data
 
-	.SPACE $TEXT$
-	.SUBSPA $DATA$
 
 foo:
 	.block
diff --git a/gas/testsuite/gas/hppa/parse/block2.s b/gas/testsuite/gas/hppa/parse/block2.s
index 1a3b5f1..87fd198 100644
--- a/gas/testsuite/gas/hppa/parse/block2.s
+++ b/gas/testsuite/gas/hppa/parse/block2.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $DATA$
-
+	.data
 foo:
 	.block -1
 
diff --git a/gas/testsuite/gas/hppa/parse/calldatabug.s b/gas/testsuite/gas/hppa/parse/calldatabug.s
index 6c80cf4..6806a0d 100644
--- a/gas/testsuite/gas/hppa/parse/calldatabug.s
+++ b/gas/testsuite/gas/hppa/parse/calldatabug.s
@@ -1,15 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.IMPORT printf,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 LC$0000:
 	.STRING "%d %lf %d\x0a\x00"
diff --git a/gas/testsuite/gas/hppa/parse/callinfobug.s b/gas/testsuite/gas/hppa/parse/callinfobug.s
index c08c773..7768e87 100644
--- a/gas/testsuite/gas/hppa/parse/callinfobug.s
+++ b/gas/testsuite/gas/hppa/parse/callinfobug.s
@@ -1,5 +1,4 @@
-	.space $TEXT$
-	.subspa $CODE$
+	.code
 	.align 4
 	.export divu,millicode
 	.proc
diff --git a/gas/testsuite/gas/hppa/parse/defbug.s b/gas/testsuite/gas/hppa/parse/defbug.s
index 064caf4..4482656 100644
--- a/gas/testsuite/gas/hppa/parse/defbug.s
+++ b/gas/testsuite/gas/hppa/parse/defbug.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.import	_seterrno
  	.export   vfork  !	.label   vfork  !	.proc!	.callinfo no_calls!	.entry !	 	.label	__vfork  !	mtsp	%r0,%sr0!	ldil	L%0xc0000004,%r1!	ble	R%0xc0000004(%sr0,%r1)!	ldi	66   ,%r22 !	b,n	yyy!	b,n	__vfork !	b	_seterrno!	copy	%r28,%r26!	.label	yyy 
diff --git a/gas/testsuite/gas/hppa/parse/entrybug.s b/gas/testsuite/gas/hppa/parse/entrybug.s
index c4fe7a4..f04f734 100644
--- a/gas/testsuite/gas/hppa/parse/entrybug.s
+++ b/gas/testsuite/gas/hppa/parse/entrybug.s
@@ -1,14 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.PARAM foo,RTNVAL=GR
@@ -19,6 +9,4 @@
 	bv,n %r0(%r2)
 	.EXIT
 	.PROCEND
-	.SPACE $TEXT$
-	.SUBSPA $LIT$
 
diff --git a/gas/testsuite/gas/hppa/parse/exportbug.s b/gas/testsuite/gas/hppa/parse/exportbug.s
index 4966415..bf9041f 100644
--- a/gas/testsuite/gas/hppa/parse/exportbug.s
+++ b/gas/testsuite/gas/hppa/parse/exportbug.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
         .EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR
 
diff --git a/gas/testsuite/gas/hppa/parse/exprbug.s b/gas/testsuite/gas/hppa/parse/exprbug.s
index 07bad42..b644d2c 100644
--- a/gas/testsuite/gas/hppa/parse/exprbug.s
+++ b/gas/testsuite/gas/hppa/parse/exprbug.s
@@ -1,5 +1,4 @@
-        .space	$TEXT$
-        .subspa	$CODE$
+	.code
 
 	.align	8
 	.export	icode,data
diff --git a/gas/testsuite/gas/hppa/parse/fixup7bug.s b/gas/testsuite/gas/hppa/parse/fixup7bug.s
index 23c8740..66842bb 100644
--- a/gas/testsuite/gas/hppa/parse/fixup7bug.s
+++ b/gas/testsuite/gas/hppa/parse/fixup7bug.s
@@ -1,18 +1,6 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.IMPORT xmalloc,CODE
-	.IMPORT _obstack_newchunk,CODE
-	.IMPORT memset,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT alloc_type,CODE
 	.EXPORT alloc_type,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR
@@ -2729,8 +2717,7 @@
 	.align 4
 LC$0020: 
 	.STRING "stub type has NULL name\x00"
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 stub_noname_complaint: 
@@ -2739,8 +2726,7 @@
 	.word 0
 	.IMPORT complain,CODE
 	.IMPORT memcpy,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.EXPORT check_stub_type,CODE
@@ -3309,8 +3295,6 @@
 	add %r20,%r19,%r19
 	ldw 0(%r19),%r20
 	ldw 48(%r20),%r19
-	ldil L'cplus_struct_default,%r20
-	ldo R'cplus_struct_default(%r20),%r20
 	comclr,= %r19,%r20,%r0
 	bl L$0150,%r0
 	nop
@@ -3433,9 +3417,7 @@
 	add %r21,%r19,%r20
 	ldw 0(%r20),%r19
 	ldw 48(%r19),%r20
-	ldil L'cplus_struct_default,%r19
 	copy %r20,%r21
-	ldo R'cplus_struct_default(%r19),%r22
 	ldws,ma 4(%r22),%r19
 	ldws,ma 4(%r22),%r20
 	stws,ma %r19,4(%r21)
@@ -3585,8 +3567,6 @@
 	nop
 	bl,n L$0161,%r0
 L$0162: 
-	ldil L'cplus_struct_default,%r19
-	ldo R'cplus_struct_default(%r19),%r19
 	stw %r19,48(%r13)
 L$0161: 
 	copy %r13,%r28
@@ -6185,8 +6165,3 @@
 	ldwm -8(%r30),%r4
 	.EXIT
 	.PROCEND
-	.SPACE $PRIVATE$
-	.SUBSPA $BSS$
-
-cplus_struct_default: .comm 24
-
diff --git a/gas/testsuite/gas/hppa/parse/global.s b/gas/testsuite/gas/hppa/parse/global.s
index 550c4a5..6a82f45 100644
--- a/gas/testsuite/gas/hppa/parse/global.s
+++ b/gas/testsuite/gas/hppa/parse/global.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 	.IMPORT foo,data
 
 	.align 4
diff --git a/gas/testsuite/gas/hppa/parse/labelbug.s b/gas/testsuite/gas/hppa/parse/labelbug.s
index 3f36a71..f4af9d0 100644
--- a/gas/testsuite/gas/hppa/parse/labelbug.s
+++ b/gas/testsuite/gas/hppa/parse/labelbug.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE	$TEXT$, SORT=8
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 ; A comment.  This should not be interpreted as a label, but both of the
diff --git a/gas/testsuite/gas/hppa/parse/linesepbug.s b/gas/testsuite/gas/hppa/parse/linesepbug.s
index a819c15..13f84b7 100644
--- a/gas/testsuite/gas/hppa/parse/linesepbug.s
+++ b/gas/testsuite/gas/hppa/parse/linesepbug.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 ; Basic immediate instruction tests.  
diff --git a/gas/testsuite/gas/hppa/parse/lselbug.s b/gas/testsuite/gas/hppa/parse/lselbug.s
index 29cd997..c937e86 100644
--- a/gas/testsuite/gas/hppa/parse/lselbug.s
+++ b/gas/testsuite/gas/hppa/parse/lselbug.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 ; In gas-1.36 the ldil instruction using parenthesis generated
diff --git a/gas/testsuite/gas/hppa/parse/parse.exp b/gas/testsuite/gas/hppa/parse/parse.exp
index da4c2a7..44d674e 100644
--- a/gas/testsuite/gas/hppa/parse/parse.exp
+++ b/gas/testsuite/gas/hppa/parse/parse.exp
@@ -189,6 +189,7 @@
     # Bad things happen in the PA ELF backend (others too?) if a non-default
     # section is created...
     setup_xfail hppa*-*-*elf*
+    setup_xfail hppa*w-*-*
     gas_test "ssbug.s" "" "" "Check for acceptance of non-default subspaces"
 
     # To be compatable with certain "features" of the HP compiler
diff --git a/gas/testsuite/gas/hppa/parse/procbug.s b/gas/testsuite/gas/hppa/parse/procbug.s
index 5ae5057..955358a 100644
--- a/gas/testsuite/gas/hppa/parse/procbug.s
+++ b/gas/testsuite/gas/hppa/parse/procbug.s
@@ -1,5 +1,4 @@
-	.space $TEXT$
-	.subspa $CODE$
+	.code
 	.align 4
 	.export divu,entry
 	.proc
diff --git a/gas/testsuite/gas/hppa/parse/regpopbug.s b/gas/testsuite/gas/hppa/parse/regpopbug.s
index 46db262..1357d9e 100644
--- a/gas/testsuite/gas/hppa/parse/regpopbug.s
+++ b/gas/testsuite/gas/hppa/parse/regpopbug.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 r0	.reg	%r0
 shift	.reg	%sar
diff --git a/gas/testsuite/gas/hppa/parse/stdreg.s b/gas/testsuite/gas/hppa/parse/stdreg.s
index e42978e..a5f668c7 100644
--- a/gas/testsuite/gas/hppa/parse/stdreg.s
+++ b/gas/testsuite/gas/hppa/parse/stdreg.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.export foo
 foo:
diff --git a/gas/testsuite/gas/hppa/parse/stringer.s b/gas/testsuite/gas/hppa/parse/stringer.s
index 06c5e6d..9f00b11 100644
--- a/gas/testsuite/gas/hppa/parse/stringer.s
+++ b/gas/testsuite/gas/hppa/parse/stringer.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 
 ; GAS used to mis-parse the embedded quotes
diff --git a/gas/testsuite/gas/hppa/parse/undefbug.s b/gas/testsuite/gas/hppa/parse/undefbug.s
index d5eda92..f6ca53b 100644
--- a/gas/testsuite/gas/hppa/parse/undefbug.s
+++ b/gas/testsuite/gas/hppa/parse/undefbug.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	bl somewhere,%r2
diff --git a/gas/testsuite/gas/hppa/parse/versionbug.s b/gas/testsuite/gas/hppa/parse/versionbug.s
index 9fef1b7..96b2219 100644
--- a/gas/testsuite/gas/hppa/parse/versionbug.s
+++ b/gas/testsuite/gas/hppa/parse/versionbug.s
@@ -1,9 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+	.code
 
 	.VERSION "abc123"
 
diff --git a/gas/testsuite/gas/hppa/parse/xmpyubug.s b/gas/testsuite/gas/hppa/parse/xmpyubug.s
index 3ee7274..4790844 100644
--- a/gas/testsuite/gas/hppa/parse/xmpyubug.s
+++ b/gas/testsuite/gas/hppa/parse/xmpyubug.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 ; No format selector for xmpyu!
 	xmpyu,sgl %fr4,%fr5,%fr6
diff --git a/gas/testsuite/gas/hppa/reloc/applybug.s b/gas/testsuite/gas/hppa/reloc/applybug.s
index f8ed6e8..d4cb7ca 100644
--- a/gas/testsuite/gas/hppa/reloc/applybug.s
+++ b/gas/testsuite/gas/hppa/reloc/applybug.s
@@ -1,22 +1,14 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 tab___2
 	.word L$0002
 	.word L$0003
 	.word L$0004
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.EXPORT execute,CODE
@@ -64,16 +56,13 @@
 	.PROCEND
 	.IMPORT __main,CODE
 	.IMPORT strcmp,CODE
-	.SPACE $TEXT$
-	.SUBSPA $LIT$
 
 	.align 4
 L$C0000
 	.STRING "xyxyz\x00"
 	.IMPORT abort,CODE
 	.IMPORT exit,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.EXPORT main,CODE
@@ -122,8 +111,7 @@
 	nop
 	.EXIT
 	.PROCEND
-	.SPACE $PRIVATE$
-	.SUBSPA $BSS$
+	.data
 
 optab	.comm 10
 buf	.comm 10
diff --git a/gas/testsuite/gas/hppa/reloc/blebug.s b/gas/testsuite/gas/hppa/reloc/blebug.s
index 0930774..32bde7a 100644
--- a/gas/testsuite/gas/hppa/reloc/blebug.s
+++ b/gas/testsuite/gas/hppa/reloc/blebug.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.IMPORT	$$dyncall,MILLICODE ; Code for dynamic function calls.
 
diff --git a/gas/testsuite/gas/hppa/reloc/blebug2.s b/gas/testsuite/gas/hppa/reloc/blebug2.s
index 9577b53..47d4430 100644
--- a/gas/testsuite/gas/hppa/reloc/blebug2.s
+++ b/gas/testsuite/gas/hppa/reloc/blebug2.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 
   	ldil	L%0xc0001004,%r1
diff --git a/gas/testsuite/gas/hppa/reloc/blebug3.s b/gas/testsuite/gas/hppa/reloc/blebug3.s
index 5ee9b3b..3d581ce 100644
--- a/gas/testsuite/gas/hppa/reloc/blebug3.s
+++ b/gas/testsuite/gas/hppa/reloc/blebug3.s
@@ -1,13 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.import yabba,code
 
diff --git a/gas/testsuite/gas/hppa/reloc/exitbug.s b/gas/testsuite/gas/hppa/reloc/exitbug.s
index 8898e35..fc4f78a 100644
--- a/gas/testsuite/gas/hppa/reloc/exitbug.s
+++ b/gas/testsuite/gas/hppa/reloc/exitbug.s
@@ -1,15 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT foo,CODE
 	.EXPORT foo,ENTRY,PRIV_LEV=3
diff --git a/gas/testsuite/gas/hppa/reloc/fixupbug.s b/gas/testsuite/gas/hppa/reloc/fixupbug.s
index 8a58d02..d446e43 100644
--- a/gas/testsuite/gas/hppa/reloc/fixupbug.s
+++ b/gas/testsuite/gas/hppa/reloc/fixupbug.s
@@ -1,14 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	b,n	$$foo
 	nop
 	nop
diff --git a/gas/testsuite/gas/hppa/reloc/funcrelocbug.s b/gas/testsuite/gas/hppa/reloc/funcrelocbug.s
index 46a43bc6..fcfe93b 100644
--- a/gas/testsuite/gas/hppa/reloc/funcrelocbug.s
+++ b/gas/testsuite/gas/hppa/reloc/funcrelocbug.s
@@ -1,15 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT g,CODE
 	.EXPORT g,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,RTNVAL=GR
@@ -72,8 +61,7 @@
 	.EXIT
 	.PROCEND
 	.IMPORT abort,CODE
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 L$TRAMP0000
@@ -88,8 +76,7 @@
 	ldw	40(%r22),%r29
 	.word	0
 	.word	0
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.EXPORT f,CODE
diff --git a/gas/testsuite/gas/hppa/reloc/labelopbug.s b/gas/testsuite/gas/hppa/reloc/labelopbug.s
index 3cdc421..7116b87 100644
--- a/gas/testsuite/gas/hppa/reloc/labelopbug.s
+++ b/gas/testsuite/gas/hppa/reloc/labelopbug.s
@@ -1,15 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 s:
 	.PROC
diff --git a/gas/testsuite/gas/hppa/reloc/longcall.s b/gas/testsuite/gas/hppa/reloc/longcall.s
index fc3996f..699138b 100644
--- a/gas/testsuite/gas/hppa/reloc/longcall.s
+++ b/gas/testsuite/gas/hppa/reloc/longcall.s
@@ -1,16 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.IMPORT bar,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 	.EXPORT foo,CODE
 	.EXPORT foo,ENTRY,PRIV_LEV=3,RTNVAL=GR
diff --git a/gas/testsuite/gas/hppa/reloc/picreloc.s b/gas/testsuite/gas/hppa/reloc/picreloc.s
index 639a44c..20f3abb 100644
--- a/gas/testsuite/gas/hppa/reloc/picreloc.s
+++ b/gas/testsuite/gas/hppa/reloc/picreloc.s
@@ -1,13 +1,9 @@
 
-	.SPACE	$TEXT$,SORT=8
-	.SUBSPA	$CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24
-	.SPACE	$PRIVATE$,SORT=16
-	.SUBSPA	$DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16
+	.data
 bogo
 	.ALIGN	8
 	.WORD  bogo+4	; = 0x4
 	.STRING	"\x00\x00\x00{\x00\x00\x01\xC8\x00\x00\x03\x15"
-	.SPACE	$PRIVATE$
-	.SUBSPA	$DATA$
+	.data
 	.EXPORT	bogo
 	.END
diff --git a/gas/testsuite/gas/hppa/reloc/plabelbug.s b/gas/testsuite/gas/hppa/reloc/plabelbug.s
index ee05b32..9f4a465 100644
--- a/gas/testsuite/gas/hppa/reloc/plabelbug.s
+++ b/gas/testsuite/gas/hppa/reloc/plabelbug.s
@@ -1,26 +1,16 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
 	.IMPORT abort,CODE
 	.EXPORT f,DATA
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
-
+	.data
 	.align 4
 f:
 	.word P%abort
 	.word P%abort
 	.IMPORT __main,CODE
 	.IMPORT printf,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
-
+	.code
 	.align 4
 LC$0000:
 	.STRING "frob\x0a\x00"
diff --git a/gas/testsuite/gas/hppa/reloc/r_no_reloc.s b/gas/testsuite/gas/hppa/reloc/r_no_reloc.s
index 026f2d0..9e5debd 100644
--- a/gas/testsuite/gas/hppa/reloc/r_no_reloc.s
+++ b/gas/testsuite/gas/hppa/reloc/r_no_reloc.s
@@ -1,15 +1,7 @@
 	.COPYRIGHT "MetaWare Incorporated, 1992"
 	.VERSION	"hc2.6a -O1 t3.c\n"
 
-	.SPACE	$PRIVATE$,SORT=16
-	.SUBSPA	$BSS$,QUAD=1,ALIGN=8,ACCESS=0x1F,SORT=80,ZERO
-	.SUBSPA	$DATA$,QUAD=1,ALIGN=8,ACCESS=0x1F,SORT=16
-
-	.SPACE	$TEXT$,SORT=8
-	.SUBSPA	$CODE$,QUAD=0,ALIGN=4,ACCESS=44,CODE_ONLY,SORT=24
-
-	.SPACE	$PRIVATE$
-	.SUBSPA	$DATA$
+	.data
 	.ALIGN	8
 $L00DATA
 	.ALIGN	8
@@ -19,8 +11,7 @@
 	.BLOCKZ	786425
 	.BLOCKZ	7
 
-	.SPACE	$TEXT$
-	.SUBSPA	$CODE$
+	.code
 L$001.3
 g	.PROC
 	.CALLINFO FRAME=0,NO_CALLS
@@ -32,8 +23,7 @@
 	.PROCEND
 
 
-	.SPACE	$PRIVATE$
-	.SUBSPA	$DATA$
+	.data
 	.ALIGN	4
 	.EXPORT	l
 l
diff --git a/gas/testsuite/gas/hppa/reloc/reduce.s b/gas/testsuite/gas/hppa/reloc/reduce.s
index 737752f..ad226f8 100644
--- a/gas/testsuite/gas/hppa/reloc/reduce.s
+++ b/gas/testsuite/gas/hppa/reloc/reduce.s
@@ -1,15 +1,8 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
 
+	.code
 	.align 4
 	.PARAM foo,RTNVAL=GR
 foo:
@@ -19,14 +12,10 @@
 	bv,n %r0(%r2)
 	.EXIT
 	.PROCEND
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
 
 	.align 4
 LC$0000:
 	.word P%foo
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
 
 	.align 4
 	.EXPORT bar,CODE
diff --git a/gas/testsuite/gas/hppa/reloc/reduce3.s b/gas/testsuite/gas/hppa/reloc/reduce3.s
index 9671e78..666a796 100644
--- a/gas/testsuite/gas/hppa/reloc/reduce3.s
+++ b/gas/testsuite/gas/hppa/reloc/reduce3.s
@@ -1,16 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
-	.EXPORT blah,DATA
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
-
+	.data
 	.align 8
 blah
 	; .double 0e+00
@@ -26,8 +14,7 @@
 	.align 4
 yabba
 	.word 1
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.EXPORT bar,CODE
diff --git a/gas/testsuite/gas/hppa/reloc/reloc.exp b/gas/testsuite/gas/hppa/reloc/reloc.exp
index ccb236c..aa81bdd 100644
--- a/gas/testsuite/gas/hppa/reloc/reloc.exp
+++ b/gas/testsuite/gas/hppa/reloc/reloc.exp
@@ -32,7 +32,7 @@
 	    # a PC-relative relocation for a BLE instruction.
 	    while 1 {
 		expect {
-		    -re "^00000004\[^\n\]*ABS_CALL\[^\n\]*\n"	{ set x 1 }
+		    -re "^0+4\[^\n\]*ABS_CALL\[^\n\]*\n"	{ set x 1 }
 		    -re "\[^\n\]*\n"				{ }
 		    timeout			{ perror "timeout\n"; break }
 		    eof				{ break }
@@ -43,8 +43,8 @@
 	    # a PC-relative relocation for a BLE instruction.
 	    while 1 {
 		expect {
-		    -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n"	{ set x 1 }
-		    -re "^00000004\[^\n\]*DIR17R\[^\n\]*\n"	{ set x 1 }
+		    -re "^0+\[^\n\]*DIR21L\[^\n\]*\n"	{ set x 1 }
+		    -re "^0+4\[^\n\]*DIR17R\[^\n\]*\n"	{ set x 1 }
 		    -re "\[^\n\]*\n"				{ }
 		    timeout			{ perror "timeout\n"; break }
 		    eof				{ break }
@@ -65,6 +65,10 @@
     set testname "reduce.s: Test relocation reductions (part 2)"
     set x 0
 
+    if [istarget hppa*w-*-*] then {
+      return;
+    }
+
     if [gas_test_old "reduce.s" "" "Relocation reductions (part1)"] then {
 	objdump_start_no_subdir "a.out" "-r"
 
@@ -73,9 +77,9 @@
 	# Doing so makes generating parameter relocation stubs impossible.
 	while 1 {
 	    expect {
-		-re "^00000004\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
+		-re "^0+4\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
 		    { set x [expr $x+1] }
-		-re "^00000014\[^\n\]*PCREL\[^\n\]*foo\[^\n\]*\n"
+		-re "^0+14\[^\n\]*PCREL\[^\n\]*foo\[^\n\]*\n"
 		    { set x [expr $x+1] }
 		-re "\[^\n\]*\n"		{ }
 		timeout				{ perror "timeout\n"; break }
@@ -94,20 +98,20 @@
     set testname "reduce2.s: More relocation reduction tests (part 2)"
     set x 0
 
-    if [gas_test_old "reduce2.s" "" "More relocatoin  reductions (part1)"] then {
+    if [gas_test_old "reduce2.s" "" "More relocation  reductions (part1)"] then {
 	objdump_start_no_subdir "a.out" "-r"
 
 	# Check to make sure DLT relative relocs are not reduced to sym+addend
 	# Doing so doesn't work as one might expect
 	while 1 {
 	    expect {
-		-re "^00000004\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n"
+		-re "^0+4\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n"
 		    { set x [expr $x+1] }
-		-re "^0000001c\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n"
+		-re "^0+1c\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n"
 		    { set x [expr $x+1] }
-		-re "^00000030\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n"
+		-re "^0+30\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n"
 		    { set x [expr $x+1] }
-		-re "^00000048\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n"
+		-re "^0+48\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n"
 		    { set x [expr $x+1] }
 		-re "\[^\n\]*\n"		{ }
 		timeout				{ perror "timeout\n"; break }
@@ -134,13 +138,13 @@
 	# Doing so makes generating parameter relocation stubs impossible.
 	while 1 {
 	    expect {
-		-re "^0000000c\[^\n\]*yabba\[^\n\+\]*\n"
+		-re "^0+c\[^\n\]*yabba\[^\n\+\]*\n"
 		    { set x [expr $x+1] }
-		-re "^0000000c\[^\n\]*yabba\+\[^\n\]*\n"
+		-re "^0+c\[^\n\]*yabba\+\[^\n\]*\n"
 		    { set x 0; break }
-		-re "^00000010\[^\n\]*yabba\[^\n\+\]*\n"
+		-re "^0+10\[^\n\]*yabba\[^\n\+\]*\n"
 		    { set x [expr $x+1] }
-		-re "^00000010\[^\n\]*yabba\+\[^\n\]*\n"
+		-re "^0+10\[^\n\]*yabba\+\[^\n\]*\n"
 		    { set x 0; break }
 		-re "\[^\n\]*\n"		{ }
 		timeout				{ perror "timeout\n"; break }
@@ -215,9 +219,9 @@
 	# Check that we make PLABEL relocation entries when they're needed.
 	while 1 {
 	    expect {
-		-re "^00000000\[^\n\]*PLABEL\[^\n\]*\n"
+		-re "^0+\[^\n\]*PLABEL\[^\n\]*\n"
 		    { set x [expr $x+1] }
-		-re "^00000004\[^\n\]*PLABEL\[^\n\]*\n"
+		-re "^0+4\[^\n\]*PLABEL\[^\n\]*\n"
 		    { set x [expr $x+1] }
 		-re "\[^\n\]*\n"			{ }
 		timeout				{ perror "timeout\n"; break }
@@ -238,6 +242,10 @@
     set testname "selectorbug.s: Test scope of field selector" 
     set x 0
 
+    if [istarget hppa*w-*-*] then {
+      return;
+    }
+
     if [gas_test_old "selectorbug.s" "" "Test scope of field selector (part 1)"] {
 	objdump_start_no_subdir "a.out" "-r"
 
@@ -247,9 +255,9 @@
         if [istarget hppa*-*-*elf*] then {
 	    while 1 {
 		expect {
-	            -re "^00000014\[^\n\]*DIR32\[^\n\]*\n"
+	            -re "^0+14\[^\n\]*DIR32\[^\n\]*\n"
 			{ set x 1 }
-		    -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
+		    -re "^0+14\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
 			{ set x 0 }
 	            -re "\[^\n\]*\n"		{ }
 	            timeout			{ perror "timeout\n"; break }
@@ -259,9 +267,9 @@
 	} else {
 	    while 1 {
 		expect {
-	            -re "^00000014\[^\n\]*DATA_ONE\[^\n\]*\n"
+	            -re "^0+14\[^\n\]*DATA_ONE\[^\n\]*\n"
 			{ set x 1 }
-		    -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
+		    -re "^0+14\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
 			{ set x 0 }
 	            -re "\[^\n\]*\n"		{ }
 	            timeout			{ perror "timeout\n"; break }
@@ -290,9 +298,9 @@
 	# to a non-branching instruction correctly.
 	while 1 {
 	    expect {
-	        -re "^0000002c\[^\n\]*0x00000024\[^\n\]*\n" 
+	        -re "^0+2c\[^\n\]*0x0+24\[^\n\]*\n" 
 		    { set x [expr $x+1] }
-	        -re "^00000030\[^\n\]*0x00000024\[^\n\]*\n" 
+	        -re "^0+30\[^\n\]*0x0+24\[^\n\]*\n" 
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -327,7 +335,7 @@
 	# Note that a match here is really a FAILURE!
 	while 1 {
 	    expect {
-	        -re "^00000000\[^\n\]*R_EXIT\[^\n\]*\n" 
+	        -re "^0+\[^\n\]*R_EXIT\[^\n\]*\n" 
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -348,6 +356,10 @@
     set testname "fixupbug.s: Test cross space jump/call fixup bug (part 2)"
     set x 0
 
+    if [istarget hppa*w-*-*] then {
+      return;
+    }
+
     # ELF (osf) doesn't really handle extra sections too well...
     if [istarget hppa*-*-*elf*] then {
 	return;
@@ -360,7 +372,7 @@
 	# branch/call
 	while 1 {
 	    expect {
-	        -re "^00000000\[^\n\]*PCREL_CALL\[^\n\]*\n" 
+	        -re "^0+\[^\n\]*PCREL_CALL\[^\n\]*\n" 
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -381,6 +393,10 @@
     set testname "fixupbug.s: Test cross space jump/call fixup bug (part 3)"
     set x 0
 
+    if [istarget hppa*w-*-*] then {
+      return;
+    }
+
     # ELF (osf) doesn't really handle extra sections too well...
     if [istarget hppa*-*-*elf*] then {
 	return;
@@ -415,24 +431,24 @@
 	# Make sure GAS generated correct relocations to switch rounding modes.
 	# Also make sure (for SOM) that redundant rounding mode relocations
 	# were eliminated.
-	if [istarget hppa*-*-*elf*] then {
+	if { [istarget hppa*-*-*elf*] || [istarget hppa*w-*-*] } then {
 	    while 1 {
 		expect {
-	            -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n"
+	            -re "^0+\[^\n\]*DIR21L\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^00000004\[^\n\]*DIR14R\[^\n\]*\n" 
+	            -re "^0+4\[^\n\]*DIR14R\[^\n\]*\n" 
 			{ set x [expr $x+1] }
-	            -re "^00000008\[^\n\]*DIR21L\[^\n\]*\n"
+	            -re "^0+8\[^\n\]*DIR21L\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^0000000c\[^\n\]*DIR14R\[^\n\]*\n" 
+	            -re "^0+c\[^\n\]*DIR14R\[^\n\]*\n" 
 			{ set x [expr $x+1] }
-	            -re "^00000010\[^\n\]*DIR21L\[^\n\]*\n"
+	            -re "^0+10\[^\n\]*DIR21L\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^00000014\[^\n\]*DIR14R\[^\n\]*\n" 
+	            -re "^0+14\[^\n\]*DIR14R\[^\n\]*\n" 
 			{ set x [expr $x+1] }
-	            -re "^00000018\[^\n\]*DIR21L\[^\n\]*\n"
+	            -re "^0+18\[^\n\]*DIR21L\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^0000001c\[^\n\]*DIR14R\[^\n\]*\n" 
+	            -re "^0+1c\[^\n\]*DIR14R\[^\n\]*\n" 
 			{ set x [expr $x+1] }
 	            -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -442,19 +458,19 @@
 	} else {
 	    while 1 {
 		expect {
-	            -re "^00000000\[^\n\]*R_R_MODE\[^\n\]*\n"
+	            -re "^0+\[^\n\]*R_R_MODE\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^00000004\[^\n\]*R_R_MODE\[^\n\]*\n" 
+	            -re "^0+4\[^\n\]*R_R_MODE\[^\n\]*\n" 
 			{ fail $testname }
-	            -re "^00000008\[^\n\]*R_N_MODE\[^\n\]*\n"
+	            -re "^0+8\[^\n\]*R_N_MODE\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^0000000c\[^\n\]*R_N_MODE\[^\n\]*\n" 
+	            -re "^0+c\[^\n\]*R_N_MODE\[^\n\]*\n" 
 			{ fail $testname }
-	            -re "^00000010\[^\n\]*R_R_MODE\[^\n\]*\n"
+	            -re "^0+10\[^\n\]*R_R_MODE\[^\n\]*\n"
 			{ set x [expr $x+1] }
-	            -re "^00000014\[^\n\]*R_R_MODE\[^\n\]*\n" 
+	            -re "^0+14\[^\n\]*R_R_MODE\[^\n\]*\n" 
 			{ fail $testname }
-	            -re "^0000001c\[^\n\]*R_R_MODE\[^\n\]*\n" 
+	            -re "^0+1c\[^\n\]*R_R_MODE\[^\n\]*\n" 
 			{ fail $testname }
 	            -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -468,7 +484,7 @@
 	objdump_finish
 
 	# Did we find what we were looking for?  If not, flunk it.
-	if [istarget hppa*-*-*elf*] then {
+	if {[istarget hppa*-*-*elf*] || [istarget hppa*w-*-*] } then {
 	    if [expr $x==8] then { pass $testname } else { fail $testname }
 	} else {
 	    if [expr $x==3] then { pass $testname } else { fail $testname }
@@ -487,9 +503,9 @@
 	# branch/call
 	while 1 {
 	    expect {
-	        -re "^000000cc\[^\n\]*f2___4\[^\n+\]*\n" 
+	        -re "^0+cc\[^\n\]*f2___4\[^\n+\]*\n" 
 		    { set x [expr $x+1] }
-	        -re "^000000d0\[^\n\]*f2___4\[^\n+\]*\n"  
+	        -re "^0+d0\[^\n\]*f2___4\[^\n+\]*\n"  
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -511,9 +527,9 @@
 	# Make sure we didn't put anything in the instruction itself!
 	while 1 {
 	    expect {
-	        -re "^000000cc\[^\n\]*ldil 0,r20\[^\n\]*\n" 
+	        -re "^0+cc\[^\n\]*ldil 0,r20\[^\n\]*\n" 
 		    { set x [expr $x+1] }
-	        -re "^000000d0\[^\n\]*ldo 0\[\(\]+r20\[\)\]+,r19\[^\n\]*\n" 
+	        -re "^0+d0\[^\n\]*ldo 0\[\(\]+r20\[\)\]+,r19\[^\n\]*\n" 
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -541,7 +557,7 @@
 	# Make sure GAS generated a correct relocation for the reference.
 	while 1 {
 	    expect {
-	        -re "^000c0004\[^\n\]*PLABEL\[^\n]*g\[^\n\]*\n" 
+	        -re "^0+c0004\[^\n\]*PLABEL\[^\n]*g\[^\n\]*\n" 
 		    { set x [expr $x+1] }
 	        -re "\[^\n\]*\n"		{ }
 	        timeout				{ perror "timeout\n"; break }
@@ -563,6 +579,10 @@
     set testname "picreloc.s: Test for proper PIC relocation (part 2)"
     set x 0
 
+    if [istarget hppa*w-*-*] then {
+      return;
+    }
+
     # ELF (osf) doesn't really handle extra sections too well...
     if [istarget hppa*-*-*elf*] then {
 	return;
diff --git a/gas/testsuite/gas/hppa/reloc/roundmode.s b/gas/testsuite/gas/hppa/reloc/roundmode.s
index 5a87e63..6b65373 100644
--- a/gas/testsuite/gas/hppa/reloc/roundmode.s
+++ b/gas/testsuite/gas/hppa/reloc/roundmode.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 	.IMPORT foo,data
diff --git a/gas/testsuite/gas/hppa/reloc/selectorbug.s b/gas/testsuite/gas/hppa/reloc/selectorbug.s
index 6925d38..4962780 100644
--- a/gas/testsuite/gas/hppa/reloc/selectorbug.s
+++ b/gas/testsuite/gas/hppa/reloc/selectorbug.s
@@ -1,21 +1,11 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-	.IMPORT $global$,DATA
-	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
 	.EXPORT intVec_error_handler,DATA
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 intVec_error_handler:
 	.word P%default_intVec_error_handler__FPCc
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
 
+	.code
 	.align 4
 	.EXPORT foo,CODE
 	.EXPORT foo,ENTRY,PRIV_LEV=3
diff --git a/gas/testsuite/gas/hppa/unsorted/brlenbug.s b/gas/testsuite/gas/hppa/unsorted/brlenbug.s
index 58e5c7e..8a20cc3 100644
--- a/gas/testsuite/gas/hppa/unsorted/brlenbug.s
+++ b/gas/testsuite/gas/hppa/unsorted/brlenbug.s
@@ -1,14 +1,7 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 done___2
@@ -18,8 +11,6 @@
 	.align 4
 re_syntax_options
 	.word 0
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
 
 	.align 4
 re_error_msg
@@ -40,8 +31,7 @@
 	.word L$C0013
 	.word L$C0014
 	.word L$C0015
-	.SPACE $TEXT$
-	.SUBSPA $LIT$
+	.code
 
 	.align 4
 L$C0015
@@ -92,8 +82,7 @@
 L$C0000
 	.STRING "No match\x00"
 	.EXPORT re_max_failures,DATA
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 re_max_failures
@@ -102,8 +91,7 @@
 	.IMPORT realloc,CODE
 	.IMPORT free,CODE
 	.IMPORT strcmp,CODE
-	.SPACE $TEXT$
-	.SUBSPA $LIT$
+	.code
 
 	.align 4
 L$C0016
@@ -152,8 +140,7 @@
 	.IMPORT insert_op2,CODE
 	.IMPORT compile_range,CODE
 	.IMPORT group_in_compile_stack,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 regex_compile
@@ -3494,8 +3481,7 @@
 	ldo -320(%r30),%r30 ;# 9060 addsi3/2
 	.EXIT
 	.PROCEND
-	.SPACE $PRIVATE$
-	.SUBSPA $BSS$
+	.data
 
 	.align 1
 re_syntax_table
diff --git a/gas/testsuite/gas/hppa/unsorted/common.s b/gas/testsuite/gas/hppa/unsorted/common.s
index d92b0cb..b07fd05 100644
--- a/gas/testsuite/gas/hppa/unsorted/common.s
+++ b/gas/testsuite/gas/hppa/unsorted/common.s
@@ -1,4 +1,4 @@
-	.text
+	.code
 text_symbol:	
 	.long	1
 	.long	external_symbol
diff --git a/gas/testsuite/gas/hppa/unsorted/fragbug.s b/gas/testsuite/gas/hppa/unsorted/fragbug.s
index 5734193..3bf9a86 100644
--- a/gas/testsuite/gas/hppa/unsorted/fragbug.s
+++ b/gas/testsuite/gas/hppa/unsorted/fragbug.s
@@ -1,3 +1,2 @@
-	.SPACE $TEXT$	
-	.SUBSPA $CODE$	
+	.code
 	nop			
diff --git a/gas/testsuite/gas/hppa/unsorted/importbug.s b/gas/testsuite/gas/hppa/unsorted/importbug.s
index 104afb6..5e7e04d 100644
--- a/gas/testsuite/gas/hppa/unsorted/importbug.s
+++ b/gas/testsuite/gas/hppa/unsorted/importbug.s
@@ -1,23 +1,15 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
 	.IMPORT $global$,DATA
 	.IMPORT $$dyncall,MILLICODE
 ; gcc_compiled.:
 	.EXPORT foo,DATA
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$
+	.data
 
 	.align 4
 foo:
 	.word 0
 	.IMPORT __main,CODE
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
 
+	.code
 	.align 4
 	.EXPORT main,CODE
 	.EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR
diff --git a/gas/testsuite/gas/hppa/unsorted/labeldiffs.s b/gas/testsuite/gas/hppa/unsorted/labeldiffs.s
index 6ee66f9..8547ec3 100644
--- a/gas/testsuite/gas/hppa/unsorted/labeldiffs.s
+++ b/gas/testsuite/gas/hppa/unsorted/labeldiffs.s
@@ -1,7 +1,6 @@
 ; Should check to make sure something useful gets put on those .word
 ; statements.
-        .space	$TEXT$
-        .subspa	$CODE$
+	.code
 
 	.align	8
 	.export	icode,data
diff --git a/gas/testsuite/gas/hppa/unsorted/locallabel.s b/gas/testsuite/gas/hppa/unsorted/locallabel.s
index 7d5721e..60357b9 100644
--- a/gas/testsuite/gas/hppa/unsorted/locallabel.s
+++ b/gas/testsuite/gas/hppa/unsorted/locallabel.s
@@ -1,12 +1,4 @@
-	.SPACE $PRIVATE$
-	.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
-	.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
-	.SPACE $TEXT$
-	.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
-	.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
-
-	.SPACE $TEXT$
-	.SUBSPA $CODE$
+	.code
 
 	.align 4
 
diff --git a/gas/testsuite/gas/hppa/unsorted/unsorted.exp b/gas/testsuite/gas/hppa/unsorted/unsorted.exp
index 31300c7..5487fd9 100644
--- a/gas/testsuite/gas/hppa/unsorted/unsorted.exp
+++ b/gas/testsuite/gas/hppa/unsorted/unsorted.exp
@@ -24,28 +24,21 @@
     set testname "ss_align.s: Test subspace alignment (part 2)"
     set x 0
 
+    if { [istarget hppa*-*-*elf*] || [istarget hppa*w-*-*] } then {
+      return 
+    }
+
     if [gas_test_old "ss_align.s" "" "subspace alignment (part 1)"] then {
 	objdump_start_no_subdir "a.out" "-h"
 
     # Check the headers for the correct alignment value for the
-    # .data section (elf) or the $DATA$ subspace (som).
-	if [istarget hppa*-*-*elf*] then {
-	    while 1 {
-		expect {
-		    -re "data\[^\n\]* 2..6\[^\n\]*\n"	{ set x 1 }
-		    -re "\[^\n\]*\n"				{ }
-		    timeout			{ perror "timeout\n"; break }
-		    eof				{ break }
-		}
-	    }
-	} else {
-	    while 1 {
-		expect  {
-		    -re "DATA\[^\n\]* 2..6\[^\n\]*\n"	{ set x 1 }
-		    -re "\[^\n\]*\n"				{ }
-		    timeout			{ perror "timeout\n"; break }
-		    eof				{ break }
-		}
+    # the $DATA$ subspace (som).
+	while 1 {
+	    expect  {
+		-re "DATA\[^\n\]* 2..6\[^\n\]*\n"	{ set x 1 }
+		-re "\[^\n\]*\n"				{ }
+		timeout			{ perror "timeout\n"; break }
+		eof				{ break }
 	    }
 	}
 
@@ -114,6 +107,10 @@
     set testname "align3.s: Test for alignment bug when switching subspaces (part2)"
     set x 0
 
+    if { [istarget hppa*-*-*elf*] || [istarget hppa*w-*-*] } then {
+      return 
+    }
+
     if [gas_test_old "align3.s" "" "Test for alignment bug when switching subspaces (part1)"] {
 	objdump_start_no_subdir "a.out" "--prefix-addresses -d"
 
@@ -141,7 +138,7 @@
     set testname "align4.s: More subspace alignment tests (part2)"
     set x 0
 
-    if [istarget hppa*-*-*elf*] then {
+    if { [istarget hppa*-*-*elf*] || [istarget hppa*w-*-*] } then {
 	return
     }
 
diff --git a/gas/testsuite/gas/i386/amd.d b/gas/testsuite/gas/i386/amd.d
index 2fe8b0e..1ff1679 100644
--- a/gas/testsuite/gas/i386/amd.d
+++ b/gas/testsuite/gas/i386/amd.d
@@ -5,7 +5,7 @@
 
 Disassembly of section .text:
 
-0+000 <.text>:
+0+000 <foo>:
    0:	0f 0d 03 [ 	]*prefetch \(%ebx\)
    3:	0f 0d 0c 75 00 10 00 00 [ 	]*prefetchw 0x1000\(,%esi,2\)
    b:	0f 0e [ 	]*femms  
@@ -29,9 +29,12 @@
   6b:	0f 0f ce 0d [ 	]*pi2fd  %mm6,%mm1
   6f:	0f 0f d7 b7 [ 	]*pfmulhrw %mm7,%mm2
   73:	2e 0f [ 	]*\(bad\)  
-  75:	0f 54 [ 	]*\(bad\)  
-  77:	c3 [ 	]*ret    
+  75:	0f 54 c3 [ 	]*andps  %xmm3,%xmm0
   78:	07 [ 	]*pop    %es
   79:	c3 [ 	]*ret    
   7a:	90 [ 	]*nop    
   7b:	90 [ 	]*nop    
+  7c:	90 [ 	]*nop    
+  7d:	90 [ 	]*nop    
+  7e:	90 [ 	]*nop    
+  7f:	90 [ 	]*nop    
diff --git a/gas/testsuite/gas/i386/amd.s b/gas/testsuite/gas/i386/amd.s
index 5e4d581..b409c61 100644
--- a/gas/testsuite/gas/i386/amd.s
+++ b/gas/testsuite/gas/i386/amd.s
@@ -1,6 +1,7 @@
 #AMD 3DNow! instructions
 
 .text
+foo:
  prefetch	(%ebx)
  prefetchw	0x1000(,%esi,2)
  femms
@@ -28,6 +29,5 @@
 # Everything's good bar the opcode suffix
 .byte 0x2e, 0x0f, 0x0f, 0x54, 0xc3, 0x07, 0xc3
 
-# to make us insensitive to alignment
- nop
- nop
+# Pad out to a good alignment
+ .byte 0x90,0x90,0x90,0x90,0x90,0x90
diff --git a/gas/testsuite/gas/i386/float.l b/gas/testsuite/gas/i386/float.l
index 6d6cadd..ec56f55 100644
--- a/gas/testsuite/gas/i386/float.l
+++ b/gas/testsuite/gas/i386/float.l
@@ -79,3 +79,7 @@
   66 007e DEF9 [ 	]*fdivrp
   67 0080 DEFB [ 	]*fdivrp	%st\(3\)
   68 0082 DEFB [ 	]*fdivrp	%st,%st\(3\)
+  69 [ 	]*
+  70 0084 00000000 [ 	]*.p2align	4,0
+  70      00000000 
+  70      00000000 
diff --git a/gas/testsuite/gas/i386/float.s b/gas/testsuite/gas/i386/float.s
index 6bb09f8..03d30b7 100644
--- a/gas/testsuite/gas/i386/float.s
+++ b/gas/testsuite/gas/i386/float.s
@@ -66,3 +66,5 @@
 	fdivrp
 	fdivrp	%st(3)
 	fdivrp	%st,%st(3)
+
+	.p2align	4,0
diff --git a/gas/testsuite/gas/i386/general.l b/gas/testsuite/gas/i386/general.l
index a403447..25a7279 100644
--- a/gas/testsuite/gas/i386/general.l
+++ b/gas/testsuite/gas/i386/general.l
@@ -3,20 +3,6 @@
 .*:12: Warning:.*
 .*:19: Warning:.*
 .*:22: Warning:.*
-.*:81: Warning:.*
-.*:82: Warning:.*
-.*:83: Warning:.*
-.*:84: Warning:.*
-.*:85: Warning:.*
-.*:86: Warning:.*
-.*:87: Warning:.*
-.*:88: Warning:.*
-.*:89: Warning:.*
-.*:90: Warning:.*
-.*:91: Warning:.*
-.*:92: Warning:.*
-.*:93: Warning:.*
-.*:94: Warning:.*
 .*:95: Warning:.*
 .*:96: Warning:.*
 .*:97: Warning:.*
@@ -24,7 +10,31 @@
 .*:99: Warning:.*
 .*:100: Warning:.*
 .*:101: Warning:.*
-.*:135: Warning:.*
+.*:102: Warning:.*
+.*:103: Warning:.*
+.*:104: Warning:.*
+.*:105: Warning:.*
+.*:106: Warning:.*
+.*:107: Warning:.*
+.*:108: Warning:.*
+.*:109: Warning:.*
+.*:110: Warning:.*
+.*:111: Warning:.*
+.*:112: Warning:.*
+.*:113: Warning:.*
+.*:114: Warning:.*
+.*:115: Warning:.*
+.*:149: Warning:.*
+.*:176: Warning:.*
+.*:178: Warning:.*
+.*:180: Warning:.*
+.*:182: Warning:.*
+.*:184: Warning:.*
+.*:190: Warning:.*
+.*:192: Warning:.*
+.*:194: Warning:.*
+.*:196: Warning:.*
+.*:198: Warning:.*
    1                       	.psize 0
    2                       	.text
    3                       	# test various segment reg insns
@@ -92,114 +102,175 @@
   61 0081 E4FF              		inb	\$255
   62 0083 66E502            		inw	\$2
   63 0086 E504              		inl	\$4
-  64 0088 EF                		outl	%eax,%dx
-  65 0089 E62A              		out	%al, \$42
-  66 008b 66E50D            		in	\$13, %ax
-  67                       	# These are used in AIX.
-  68 008e 66ED              		inw	\(%dx\)
-  69 0090 66EF              		outw	\(%dx\)
-  70                       	
-  71 0092 A4                		movsb
-  72 0093 66A7              		cmpsw
-  73 0095 AF                		scasl
-  74 0096 D7                		xlatb
-  75 0097 2EA5              		movsl	%cs:\(%esi\),%es:\(%edi\)
-  76 0099 0F9303            		setae	\(%ebx\)
-  77 009c 0F9303            		setaeb	\(%ebx\)
-  78 009f 0F93C0            		setae	%al
-  79                       	
-  80                       	#these should give warnings
-  81 00a2 0C01              		orb	\$1,%ax
+  64 0088 66E50D            		in	\$13, %ax
+  65 008b EE                		out	%al,%dx
+  66 008c 66EF              		out	%ax,%dx
+  67 008e EF                		out	%eax,%dx
+  68 008f EE                		out	%al,\(%dx\)
+  69 0090 66EF              		out	%ax,\(%dx\)
+  70 0092 EF                		out	%eax,\(%dx\)
+  71 0093 EE                		outb	%al,%dx
+  72 0094 66EF              		outw	%ax,%dx
+  73 0096 EF                		outl	%eax,%dx
+  74 0097 EE                		outb	%dx
+  75 0098 66EF              		outw	%dx
+  76 009a EF                		outl	%dx
+  77 009b E6FF              		outb	\$255
+  78 009d 66E702            		outw	\$2
+  79 00a0 E704              		outl	\$4
+  80 00a2 66E70D            		out	%ax, \$13
+  81                       	# These are used in AIX.
+  82 00a5 66ED              		inw	\(%dx\)
+  83 00a7 66EF              		outw	\(%dx\)
+  84                       	
+  85 00a9 A4                		movsb
+  86 00aa 66A7              		cmpsw
+  87 00ac AF                		scasl
+  88 00ad D7                		xlatb
+  89 00ae 2EA5              		movsl	%cs:\(%esi\),%es:\(%edi\)
+  90 00b0 0F9303            		setae	\(%ebx\)
+  91 00b3 0F9303            		setaeb	\(%ebx\)
+  92 00b6 0F93C0            		setae	%al
+  93                       	
+  94                       	#these should give warnings
+  95 00b9 0C01              		orb	\$1,%ax
 .*Warning:.*
-  82 00a4 0C01              		orb	\$1,%eax
+  96 00bb 0C01              		orb	\$1,%eax
 .*Warning:.*
-  83 00a6 80CB01            		orb	\$1,%bx
+  97 00bd 80CB01            		orb	\$1,%bx
 .*Warning:.*
-  84 00a9 80CB01            		orb	\$1,%ebx
+  98 00c0 80CB01            		orb	\$1,%ebx
 .*Warning:.*
-  85 00ac D9C1              		fldl	%st\(1\)
+  99 00c3 D9C1              		fldl	%st\(1\)
 .*Warning:.*
-  86 00ae DDD2              		fstl	%st\(2\)
+ 100 00c5 DDD2              		fstl	%st\(2\)
 .*Warning:.*
-  87 00b0 DDDB              		fstpl	%st\(3\)
+ 101 00c7 DDDB              		fstpl	%st\(3\)
 .*Warning:.*
-  88 00b2 D8D4              		fcoml	%st\(4\)
+ 102 00c9 D8D4              		fcoml	%st\(4\)
 .*Warning:.*
-  89 00b4 D8DD              		fcompl	%st\(5\)
+ 103 00cb D8DD              		fcompl	%st\(5\)
 .*Warning:.*
-  90 00b6 DEC1              		faddp	%st\(1\),%st
+ 104 00cd DEC1              		faddp	%st\(1\),%st
 .*Warning:.*
-  91 00b8 DECA              		fmulp	%st\(2\),%st
+ 105 00cf DECA              		fmulp	%st\(2\),%st
 .*Warning:.*
-  92 00ba DEE3              		fsubp	%st\(3\),%st
+ 106 00d1 DEE3              		fsubp	%st\(3\),%st
 .*Warning:.*
-  93 00bc DEEC              		fsubrp	%st\(4\),%st
+ 107 00d3 DEEC              		fsubrp	%st\(4\),%st
 .*Warning:.*
-  94 00be DEF5              		fdivp	%st\(5\),%st
+ 108 00d5 DEF5              		fdivp	%st\(5\),%st
 .*Warning:.*
-  95 00c0 DEFE              		fdivrp	%st\(6\),%st
+ 109 00d7 DEFE              		fdivrp	%st\(6\),%st
 .*Warning:.*
-  96 00c2 DEC1              		fadd
+ 110 00d9 DEC1              		fadd
 .*Warning:.*
-  97 00c4 DEE1              		fsub
+ 111 00db DEE1              		fsub
 .*Warning:.*
-  98 00c6 DEC9              		fmul
+ 112 00dd DEC9              		fmul
 .*Warning:.*
-  99 00c8 DEF1              		fdiv
+ 113 00df DEF1              		fdiv
 .*Warning:.*
- 100 00ca DEE9              		fsubr
+ 114 00e1 DEE9              		fsubr
 .*Warning:.*
- 101 00cc DEF9              		fdivr
+ 115 00e3 DEF9              		fdivr
 .*Warning:.*
- 102                       	#these should all be legal
- 103 00ce 0FA31556 341200   		btl	%edx, 0x123456
- 104 00d5 0FA3D0            		btl	%edx, %eax
- 105 00d8 0C01              		orb	\$1,%al
- 106 00da 80CB01            		orb	\$1,%bl
- 107 00dd A1110000 00       		movl	17,%eax
- 108 00e2 A1110000 00       		mov	17,%eax
- 109 00e7 66ED              		inw	%dx,%ax
- 110 00e9 ED                		inl	%dx,%eax
- 111 00ea 66ED              		inw	\(%dx\),%ax
- 112 00ec ED                		inl	\(%dx\),%eax
- 113 00ed EC                		in	\(%dx\),%al
- 114 00ee 66ED              		in	\(%dx\),%ax
- 115 00f0 ED                		in	\(%dx\),%eax
- 116 00f1 0FB61437          		movzbl	\(%edi,%esi\),%edx
- 117 00f5 0FB6451C          		movzbl	28\(%ebp\),%eax
- 118 00f9 0FB6C0            		movzbl	%al,%eax
- 119 00fc 0FB6F1            		movzbl	%cl,%esi
- 120 00ff 26D7              		xlat	%es:\(%ebx\)
- 121 0101 D7                		xlat
- 122 0102 D7                		xlatb
- 123 0103 DDD8              	1:	fstp	%st\(0\)
- 124 0105 E2FC              		loop	1b
- 125 0107 F6F1              		divb    %cl 
- 126 0109 66F7F1            		divw    %cx 
- 127 010c F7F1              		divl    %ecx
- 128 010e F6F1              		div	%cl
- 129 0110 66F7F1            		div	%cx
- 130 0113 F7F1              		div	%ecx
- 131 0115 F6F1              		div	%cl,%al
- 132 0117 66F7F1            		div	%cx,%ax
- 133 011a F7F1              		div	%ecx,%eax
- 134 011c 8EDE              		mov	%si,%ds
- 135 011e 8EDE              		movl	%si,%ds		# warning here
+ 116                       	#these should all be legal
+ 117 00e5 0FA31556 341200   		btl	%edx, 0x123456
+ 118 00ec 0FA3D0            		btl	%edx, %eax
+ 119 00ef 0C01              		orb	\$1,%al
+ 120 00f1 80CB01            		orb	\$1,%bl
+ 121 00f4 A1110000 00       		movl	17,%eax
+ 122 00f9 A1110000 00       		mov	17,%eax
+ 123 00fe 66ED              		inw	%dx,%ax
+ 124 0100 ED                		inl	%dx,%eax
+ 125 0101 66ED              		inw	\(%dx\),%ax
+ 126 0103 ED                		inl	\(%dx\),%eax
+ 127 0104 EC                		in	\(%dx\),%al
+ 128 0105 66ED              		in	\(%dx\),%ax
+ 129 0107 ED                		in	\(%dx\),%eax
+ 130 0108 0FB61437          		movzbl	\(%edi,%esi\),%edx
+ 131 010c 0FB6451C          		movzbl	28\(%ebp\),%eax
+ 132 0110 0FB6C0            		movzbl	%al,%eax
+ 133 0113 0FB6F1            		movzbl	%cl,%esi
+ 134 0116 26D7              		xlat	%es:\(%ebx\)
+ 135 0118 D7                		xlat
+ 136 0119 D7                		xlatb
+ 137 011a DDD8              	1:	fstp	%st\(0\)
+ 138 011c E2FC              		loop	1b
+ 139 011e F6F1              		divb    %cl 
+ 140 0120 66F7F1            		divw    %cx 
+ 141 0123 F7F1              		divl    %ecx
+ 142 0125 F6F1              		div	%cl
+ 143 0127 66F7F1            		div	%cx
+ 144 012a F7F1              		div	%ecx
+ 145 012c F6F1              		div	%cl,%al
+ 146 012e 66F7F1            		div	%cx,%ax
+ 147 0131 F7F1              		div	%ecx,%eax
+ 148 0133 8EDE              		mov	%si,%ds
+ 149 0135 8EDE              		movl	%si,%ds		# warning here
 .*Warning:.*
- 136 0120 1E                		pushl	%ds
- 137 0121 1E                		push	%ds
- 138 0122 A0000000 00       		mov	0,%al
- 139 0127 66A10000 0100     		mov	0x10000,%ax
- 140 012d 89C3              		mov	%eax,%ebx
- 141 012f 9C                		pushf
- 142 0130 9C                		pushfl
- 143 0131 669C              		pushfw
- 144 0133 9D                		popf
- 145 0134 9D                		popfl
- 146 0135 669D              		popfw
- 147 0137 89341D00 000000   		mov	%esi,\(,%ebx,1\)
- 148 013e 80250000 00007F   		andb	\$~0x80,foo
- 149                       	
- 150                       		# Force a good alignment.
- 151 0145 0000              		.word	0
- 152 0147 00                		.byte	0
+ 150 0137 1E                		pushl	%ds
+ 151 0138 1E                		push	%ds
+ 152 0139 A0000000 00       		mov	0,%al
+ 153 013e 66A10000 0100     		mov	0x10000,%ax
+ 154 0144 89C3              		mov	%eax,%ebx
+ 155 0146 9C                		pushf
+ 156 0147 9C                		pushfl
+ 157 0148 669C              		pushfw
+ 158 014a 9D                		popf
+ 159 014b 9D                		popfl
+ 160 014c 669D              		popfw
+ 161 014e 89341D00 000000   		mov	%esi,\(,%ebx,1\)
+ 162 0155 80250000 00007F   		andb	\$~0x80,foo
+ 163                       	
+ 164                       	#check 16-bit code auto address prefix
+ 165                       	.code16gcc
+ 166 015c 67668D95 00FFFFFF 		leal	-256\(%ebp\),%edx
+ 167 0164 6788857F FFFFFF   		mov	%al,-129\(%ebp\)
+ 168 016b 67886580          		mov	%ah,-128\(%ebp\)
+ 169 016f 67668D9D 20F9FFFF 		leal	-1760\(%ebp\),%ebx
+ 170 0177 67668984 248C0000 		movl	%eax,140\(%esp\)
+ 170      00
+ 171                       	
+ 172                       	.code32
+ 173 0180 EB98              		jmp	1b
+ 174 0182 E9(FCFF|79FE)FF FF       		jmp	xxx
+ 175 0187 FF250000 0000     		jmp	\*xxx
+ 176 018d FF250000 0000     		jmp	xxx\(,1\)
+.*Warning:.*
+ 177 0193 FFE7              		jmp	\*%edi
+ 178 0195 FFE7              		jmp	%edi
+.*Warning:.*
+ 179 0197 FF27              		jmp	\*\(%edi\)
+ 180 0199 FF27              		jmp	\(%edi\)
+.*Warning:.*
+ 181 019b FF2CBD00 000000   		ljmp	\*xxx\(,%edi,4\)
+ 182 01a2 FF2CBD00 000000   		ljmp	xxx\(,%edi,4\)
+.*Warning:.*
+ 183 01a9 FF2D0000 0000     		ljmp	\*xxx
+ 184 01af FF2D0000 0000     		ljmp	xxx\(,1\)
+.*Warning:.*
+ 185 01b5 EA000000 003412   		ljmp	\$0x1234,\$xxx
+ 186                       	
+ 187 01bc E859FFFF FF       		call	1b
+ 188 01c1 E8(FCFF|3AFE)FF FF       		call	xxx
+ 189 01c6 FF150000 0000     		call	\*xxx
+ 190 01cc FF150000 0000     		call	xxx\(,1\)
+.*Warning:.*
+ 191 01d2 FFD7              		call	\*%edi
+ 192 01d4 FFD7              		call	%edi
+.*Warning:.*
+ 193 01d6 FF17              		call	\*\(%edi\)
+ 194 01d8 FF17              		call	\(%edi\)
+.*Warning:.*
+ 195 01da FF1CBD00 000000   		lcall	\*xxx\(,%edi,4\)
+ 196 01e1 FF1CBD00 000000   		lcall	xxx\(,%edi,4\)
+.*Warning:.*
+ 197 01e8 FF1D0000 0000     		lcall	\*xxx
+ 198 01ee FF1D0000 0000     		lcall	xxx\(,1\)
+.*Warning:.*
+ 199 01f4 9A000000 003412   		lcall	\$0x1234,\$xxx
+ 200                       	
+ 201                       		# Force a good alignment.
+ 202 01fb 00000000 00       		.p2align	4,0
diff --git a/gas/testsuite/gas/i386/general.s b/gas/testsuite/gas/i386/general.s
index d73f489..8d08dbf 100644
--- a/gas/testsuite/gas/i386/general.s
+++ b/gas/testsuite/gas/i386/general.s
@@ -61,9 +61,23 @@
 	inb	$255
 	inw	$2
 	inl	$4
-	outl	%eax,%dx
-	out	%al, $42
 	in	$13, %ax
+	out	%al,%dx
+	out	%ax,%dx
+	out	%eax,%dx
+	out	%al,(%dx)
+	out	%ax,(%dx)
+	out	%eax,(%dx)
+	outb	%al,%dx
+	outw	%ax,%dx
+	outl	%eax,%dx
+	outb	%dx
+	outw	%dx
+	outl	%dx
+	outb	$255
+	outw	$2
+	outl	$4
+	out	%ax, $13
 # These are used in AIX.
 	inw	(%dx)
 	outw	(%dx)
@@ -147,6 +161,42 @@
 	mov	%esi,(,%ebx,1)
 	andb	$~0x80,foo
 
+#check 16-bit code auto address prefix
+.code16gcc
+	leal	-256(%ebp),%edx
+	mov	%al,-129(%ebp)
+	mov	%ah,-128(%ebp)
+	leal	-1760(%ebp),%ebx
+	movl	%eax,140(%esp)
+
+.code32
+	jmp	1b
+	jmp	xxx
+	jmp	*xxx
+	jmp	xxx(,1)
+	jmp	*%edi
+	jmp	%edi
+	jmp	*(%edi)
+	jmp	(%edi)
+	ljmp	*xxx(,%edi,4)
+	ljmp	xxx(,%edi,4)
+	ljmp	*xxx
+	ljmp	xxx(,1)
+	ljmp	$0x1234,$xxx
+
+	call	1b
+	call	xxx
+	call	*xxx
+	call	xxx(,1)
+	call	*%edi
+	call	%edi
+	call	*(%edi)
+	call	(%edi)
+	lcall	*xxx(,%edi,4)
+	lcall	xxx(,%edi,4)
+	lcall	*xxx
+	lcall	xxx(,1)
+	lcall	$0x1234,$xxx
+
 	# Force a good alignment.
-	.word	0
-	.byte	0
+	.p2align	4,0
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index cef1ff7..13ac8ef 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -21,14 +21,19 @@
     run_list_test "general" "-al --listing-lhs-width=2"
     run_list_test "inval" "-al"
     run_list_test "modrm" "-al --listing-lhs-width=2"
+    run_dump_test "naked"
     run_dump_test "opcode"
+    run_dump_test "intel"
     run_dump_test "prefix"
     run_dump_test "amd"
+    run_dump_test "katmai"
+    run_dump_test "jump"
 
-    # The reloc and white tests require support for 8 and 16 bit
-    # relocs, so we only run them for ELF targets.
-    if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"]} then {
+    # These tests require support for 8 and 16 bit relocs,
+    # so we only run them for ELF and COFF targets.
+    if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"] || [istarget "*-*-coff*"]} then {
 	run_dump_test "reloc"
+	run_dump_test "jump16"
 	run_list_test "white" "-al --listing-lhs-width=3"
     }
 }
diff --git a/gas/testsuite/gas/i386/intel.d b/gas/testsuite/gas/i386/intel.d
new file mode 100644
index 0000000..76f0f8a
--- /dev/null
+++ b/gas/testsuite/gas/i386/intel.d
@@ -0,0 +1,574 @@
+#as: -J
+#objdump: -dw
+#name: i386 intel
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+   0:	00 90 90 90 90 90 [ 	]*add    %dl,0x90909090\(%eax\)
+   6:	01 90 90 90 90 90 [ 	]*add    %edx,0x90909090\(%eax\)
+   c:	02 90 90 90 90 90 [ 	]*add    0x90909090\(%eax\),%dl
+  12:	03 90 90 90 90 90 [ 	]*add    0x90909090\(%eax\),%edx
+  18:	04 90 [ 	]*add    \$0x90,%al
+  1a:	05 90 90 90 90 [ 	]*add    \$0x90909090,%eax
+  1f:	06 [ 	]*push   %es
+  20:	07 [ 	]*pop    %es
+  21:	08 90 90 90 90 90 [ 	]*or     %dl,0x90909090\(%eax\)
+  27:	09 90 90 90 90 90 [ 	]*or     %edx,0x90909090\(%eax\)
+  2d:	0a 90 90 90 90 90 [ 	]*or     0x90909090\(%eax\),%dl
+  33:	0b 90 90 90 90 90 [ 	]*or     0x90909090\(%eax\),%edx
+  39:	0c 90 [ 	]*or     \$0x90,%al
+  3b:	0d 90 90 90 90 [ 	]*or     \$0x90909090,%eax
+  40:	0e [ 	]*push   %cs
+  41:	10 90 90 90 90 90 [ 	]*adc    %dl,0x90909090\(%eax\)
+  47:	11 90 90 90 90 90 [ 	]*adc    %edx,0x90909090\(%eax\)
+  4d:	12 90 90 90 90 90 [ 	]*adc    0x90909090\(%eax\),%dl
+  53:	13 90 90 90 90 90 [ 	]*adc    0x90909090\(%eax\),%edx
+  59:	14 90 [ 	]*adc    \$0x90,%al
+  5b:	15 90 90 90 90 [ 	]*adc    \$0x90909090,%eax
+  60:	16 [ 	]*push   %ss
+  61:	17 [ 	]*pop    %ss
+  62:	18 90 90 90 90 90 [ 	]*sbb    %dl,0x90909090\(%eax\)
+  68:	19 90 90 90 90 90 [ 	]*sbb    %edx,0x90909090\(%eax\)
+  6e:	1a 90 90 90 90 90 [ 	]*sbb    0x90909090\(%eax\),%dl
+  74:	1b 90 90 90 90 90 [ 	]*sbb    0x90909090\(%eax\),%edx
+  7a:	1c 90 [ 	]*sbb    \$0x90,%al
+  7c:	1d 90 90 90 90 [ 	]*sbb    \$0x90909090,%eax
+  81:	1e [ 	]*push   %ds
+  82:	1f [ 	]*pop    %ds
+  83:	20 90 90 90 90 90 [ 	]*and    %dl,0x90909090\(%eax\)
+  89:	21 90 90 90 90 90 [ 	]*and    %edx,0x90909090\(%eax\)
+  8f:	22 90 90 90 90 90 [ 	]*and    0x90909090\(%eax\),%dl
+  95:	23 90 90 90 90 90 [ 	]*and    0x90909090\(%eax\),%edx
+  9b:	24 90 [ 	]*and    \$0x90,%al
+  9d:	25 90 90 90 90 [ 	]*and    \$0x90909090,%eax
+  a2:	27 [ 	]*daa    
+  a3:	28 90 90 90 90 90 [ 	]*sub    %dl,0x90909090\(%eax\)
+  a9:	29 90 90 90 90 90 [ 	]*sub    %edx,0x90909090\(%eax\)
+  af:	2a 90 90 90 90 90 [ 	]*sub    0x90909090\(%eax\),%dl
+  b5:	2b 90 90 90 90 90 [ 	]*sub    0x90909090\(%eax\),%edx
+  bb:	2c 90 [ 	]*sub    \$0x90,%al
+  bd:	2d 90 90 90 90 [ 	]*sub    \$0x90909090,%eax
+  c2:	2f [ 	]*das    
+  c3:	30 90 90 90 90 90 [ 	]*xor    %dl,0x90909090\(%eax\)
+  c9:	31 90 90 90 90 90 [ 	]*xor    %edx,0x90909090\(%eax\)
+  cf:	32 90 90 90 90 90 [ 	]*xor    0x90909090\(%eax\),%dl
+  d5:	33 90 90 90 90 90 [ 	]*xor    0x90909090\(%eax\),%edx
+  db:	34 90 [ 	]*xor    \$0x90,%al
+  dd:	35 90 90 90 90 [ 	]*xor    \$0x90909090,%eax
+  e2:	37 [ 	]*aaa    
+  e3:	38 90 90 90 90 90 [ 	]*cmp    %dl,0x90909090\(%eax\)
+  e9:	39 90 90 90 90 90 [ 	]*cmp    %edx,0x90909090\(%eax\)
+  ef:	3a 90 90 90 90 90 [ 	]*cmp    0x90909090\(%eax\),%dl
+  f5:	3b 90 90 90 90 90 [ 	]*cmp    0x90909090\(%eax\),%edx
+  fb:	3c 90 [ 	]*cmp    \$0x90,%al
+  fd:	3d 90 90 90 90 [ 	]*cmp    \$0x90909090,%eax
+ 102:	3f [ 	]*aas    
+ 103:	40 [ 	]*inc    %eax
+ 104:	41 [ 	]*inc    %ecx
+ 105:	42 [ 	]*inc    %edx
+ 106:	43 [ 	]*inc    %ebx
+ 107:	44 [ 	]*inc    %esp
+ 108:	45 [ 	]*inc    %ebp
+ 109:	46 [ 	]*inc    %esi
+ 10a:	47 [ 	]*inc    %edi
+ 10b:	48 [ 	]*dec    %eax
+ 10c:	49 [ 	]*dec    %ecx
+ 10d:	4a [ 	]*dec    %edx
+ 10e:	4b [ 	]*dec    %ebx
+ 10f:	4c [ 	]*dec    %esp
+ 110:	4d [ 	]*dec    %ebp
+ 111:	4e [ 	]*dec    %esi
+ 112:	4f [ 	]*dec    %edi
+ 113:	50 [ 	]*push   %eax
+ 114:	51 [ 	]*push   %ecx
+ 115:	52 [ 	]*push   %edx
+ 116:	53 [ 	]*push   %ebx
+ 117:	54 [ 	]*push   %esp
+ 118:	55 [ 	]*push   %ebp
+ 119:	56 [ 	]*push   %esi
+ 11a:	57 [ 	]*push   %edi
+ 11b:	58 [ 	]*pop    %eax
+ 11c:	59 [ 	]*pop    %ecx
+ 11d:	5a [ 	]*pop    %edx
+ 11e:	5b [ 	]*pop    %ebx
+ 11f:	5c [ 	]*pop    %esp
+ 120:	5d [ 	]*pop    %ebp
+ 121:	5e [ 	]*pop    %esi
+ 122:	5f [ 	]*pop    %edi
+ 123:	60 [ 	]*pusha  
+ 124:	61 [ 	]*popa   
+ 125:	62 90 90 90 90 90 [ 	]*bound  %edx,0x90909090\(%eax\)
+ 12b:	63 90 90 90 90 90 [ 	]*arpl   %dx,0x90909090\(%eax\)
+ 131:	68 90 90 90 90 [ 	]*push   \$0x90909090
+ 136:	69 90 90 90 90 90 90 90 90 90 [ 	]*imul   \$0x90909090,0x90909090\(%eax\),%edx
+ 140:	6a 90 [ 	]*push   \$0xffffff90
+ 142:	6b 90 90 90 90 90 90 [ 	]*imul   \$0xffffff90,0x90909090\(%eax\),%edx
+ 149:	6c [ 	]*insb   \(%dx\),%es:\(%edi\)
+ 14a:	6d [ 	]*insl   \(%dx\),%es:\(%edi\)
+ 14b:	6e [ 	]*outsb  %ds:\(%esi\),\(%dx\)
+ 14c:	6f [ 	]*outsl  %ds:\(%esi\),\(%dx\)
+ 14d:	70 90 [ 	]*jo     (0x)?df.*
+ 14f:	71 90 [ 	]*jno    (0x)?e1.*
+ 151:	72 90 [ 	]*jb     (0x)?e3.*
+ 153:	73 90 [ 	]*jae    (0x)?e5.*
+ 155:	74 90 [ 	]*je     (0x)?e7.*
+ 157:	75 90 [ 	]*jne    (0x)?e9.*
+ 159:	76 90 [ 	]*jbe    (0x)?eb.*
+ 15b:	77 90 [ 	]*ja     (0x)?ed.*
+ 15d:	78 90 [ 	]*js     (0x)?ef.*
+ 15f:	79 90 [ 	]*jns    (0x)?f1.*
+ 161:	7a 90 [ 	]*jp     (0x)?f3.*
+ 163:	7b 90 [ 	]*jnp    (0x)?f5.*
+ 165:	7c 90 [ 	]*jl     (0x)?f7.*
+ 167:	7d 90 [ 	]*jge    (0x)?f9.*
+ 169:	7e 90 [ 	]*jle    (0x)?fb.*
+ 16b:	7f 90 [ 	]*jg     (0x)?fd.*
+ 16d:	80 90 90 90 90 90 90 [ 	]*adcb   \$0x90,0x90909090\(%eax\)
+ 174:	81 90 90 90 90 90 90 90 90 90 [ 	]*adcl   \$0x90909090,0x90909090\(%eax\)
+ 17e:	83 90 90 90 90 90 90 [ 	]*adcl   \$0xffffff90,0x90909090\(%eax\)
+ 185:	84 90 90 90 90 90 [ 	]*test   %dl,0x90909090\(%eax\)
+ 18b:	85 90 90 90 90 90 [ 	]*test   %edx,0x90909090\(%eax\)
+ 191:	86 90 90 90 90 90 [ 	]*xchg   %dl,0x90909090\(%eax\)
+ 197:	87 90 90 90 90 90 [ 	]*xchg   %edx,0x90909090\(%eax\)
+ 19d:	88 90 90 90 90 90 [ 	]*mov    %dl,0x90909090\(%eax\)
+ 1a3:	89 90 90 90 90 90 [ 	]*mov    %edx,0x90909090\(%eax\)
+ 1a9:	8a 90 90 90 90 90 [ 	]*mov    0x90909090\(%eax\),%dl
+ 1af:	8b 90 90 90 90 90 [ 	]*mov    0x90909090\(%eax\),%edx
+ 1b5:	8c 90 90 90 90 90 [ 	]*movl   %ss,0x90909090\(%eax\)
+ 1bb:	8d 90 90 90 90 90 [ 	]*lea    0x90909090\(%eax\),%edx
+ 1c1:	8e 90 90 90 90 90 [ 	]*movl   0x90909090\(%eax\),%ss
+ 1c7:	8f 80 90 90 90 90 [ 	]*popl   0x90909090\(%eax\)
+ 1cd:	90 [ 	]*nop    
+ 1ce:	91 [ 	]*xchg   %eax,%ecx
+ 1cf:	92 [ 	]*xchg   %eax,%edx
+ 1d0:	93 [ 	]*xchg   %eax,%ebx
+ 1d1:	94 [ 	]*xchg   %eax,%esp
+ 1d2:	95 [ 	]*xchg   %eax,%ebp
+ 1d3:	96 [ 	]*xchg   %eax,%esi
+ 1d4:	97 [ 	]*xchg   %eax,%edi
+ 1d5:	98 [ 	]*cwtl   
+ 1d6:	99 [ 	]*cltd   
+ 1d7:	9a 90 90 90 90 90 90 [ 	]*lcall  \$0x9090,\$0x90909090
+ 1de:	9b [ 	]*fwait
+ 1df:	9c [ 	]*pushf  
+ 1e0:	9d [ 	]*popf   
+ 1e1:	9e [ 	]*sahf   
+ 1e2:	9f [ 	]*lahf   
+ 1e3:	a0 90 90 90 90 [ 	]*mov    0x90909090,%al
+ 1e8:	a1 90 90 90 90 [ 	]*mov    0x90909090,%eax
+ 1ed:	a2 90 90 90 90 [ 	]*mov    %al,0x90909090
+ 1f2:	a3 90 90 90 90 [ 	]*mov    %eax,0x90909090
+ 1f7:	a4 [ 	]*movsb  %ds:\(%esi\),%es:\(%edi\)
+ 1f8:	a5 [ 	]*movsl  %ds:\(%esi\),%es:\(%edi\)
+ 1f9:	a6 [ 	]*cmpsb  %es:\(%edi\),%ds:\(%esi\)
+ 1fa:	a7 [ 	]*cmpsl  %es:\(%edi\),%ds:\(%esi\)
+ 1fb:	a8 90 [ 	]*test   \$0x90,%al
+ 1fd:	a9 90 90 90 90 [ 	]*test   \$0x90909090,%eax
+ 202:	aa [ 	]*stos   %al,%es:\(%edi\)
+ 203:	ab [ 	]*stos   %eax,%es:\(%edi\)
+ 204:	ac [ 	]*lods   %ds:\(%esi\),%al
+ 205:	ad [ 	]*lods   %ds:\(%esi\),%eax
+ 206:	ae [ 	]*scas   %es:\(%edi\),%al
+ 207:	af [ 	]*scas   %es:\(%edi\),%eax
+ 208:	b0 90 [ 	]*mov    \$0x90,%al
+ 20a:	b1 90 [ 	]*mov    \$0x90,%cl
+ 20c:	b2 90 [ 	]*mov    \$0x90,%dl
+ 20e:	b3 90 [ 	]*mov    \$0x90,%bl
+ 210:	b4 90 [ 	]*mov    \$0x90,%ah
+ 212:	b5 90 [ 	]*mov    \$0x90,%ch
+ 214:	b6 90 [ 	]*mov    \$0x90,%dh
+ 216:	b7 90 [ 	]*mov    \$0x90,%bh
+ 218:	b8 90 90 90 90 [ 	]*mov    \$0x90909090,%eax
+ 21d:	b9 90 90 90 90 [ 	]*mov    \$0x90909090,%ecx
+ 222:	ba 90 90 90 90 [ 	]*mov    \$0x90909090,%edx
+ 227:	bb 90 90 90 90 [ 	]*mov    \$0x90909090,%ebx
+ 22c:	bc 90 90 90 90 [ 	]*mov    \$0x90909090,%esp
+ 231:	bd 90 90 90 90 [ 	]*mov    \$0x90909090,%ebp
+ 236:	be 90 90 90 90 [ 	]*mov    \$0x90909090,%esi
+ 23b:	bf 90 90 90 90 [ 	]*mov    \$0x90909090,%edi
+ 240:	c0 90 90 90 90 90 90 [ 	]*rclb   \$0x90,0x90909090\(%eax\)
+ 247:	c1 90 90 90 90 90 90 [ 	]*rcll   \$0x90,0x90909090\(%eax\)
+ 24e:	c2 90 90 [ 	]*ret    \$0x9090
+ 251:	c3 [ 	]*ret    
+ 252:	c4 90 90 90 90 90 [ 	]*les    0x90909090\(%eax\),%edx
+ 258:	c5 90 90 90 90 90 [ 	]*lds    0x90909090\(%eax\),%edx
+ 25e:	c6 80 90 90 90 90 90 [ 	]*movb   \$0x90,0x90909090\(%eax\)
+ 265:	c7 80 90 90 90 90 90 90 90 90 [ 	]*movl   \$0x90909090,0x90909090\(%eax\)
+ 26f:	c8 90 90 90 [ 	]*enter  \$0x9090,\$0x90
+ 273:	c9 [ 	]*leave  
+ 274:	ca 90 90 [ 	]*lret   \$0x9090
+ 277:	cb [ 	]*lret   
+ 278:	cc [ 	]*int3   
+ 279:	cd 90 [ 	]*int    \$0x90
+ 27b:	ce [ 	]*into   
+ 27c:	cf [ 	]*iret   
+ 27d:	d0 90 90 90 90 90 [ 	]*rclb   0x90909090\(%eax\)
+ 283:	d1 90 90 90 90 90 [ 	]*rcll   0x90909090\(%eax\)
+ 289:	d2 90 90 90 90 90 [ 	]*rclb   %cl,0x90909090\(%eax\)
+ 28f:	d3 90 90 90 90 90 [ 	]*rcll   %cl,0x90909090\(%eax\)
+ 295:	d4 90 [ 	]*aam    \$0xffffff90
+ 297:	d5 90 [ 	]*aad    \$0xffffff90
+ 299:	d7 [ 	]*xlat   %ds:\(%ebx\)
+ 29a:	d8 90 90 90 90 90 [ 	]*fcoms  0x90909090\(%eax\)
+ 2a0:	d9 90 90 90 90 90 [ 	]*fsts   0x90909090\(%eax\)
+ 2a6:	da 90 90 90 90 90 [ 	]*ficoml 0x90909090\(%eax\)
+ 2ac:	db 90 90 90 90 90 [ 	]*fistl  0x90909090\(%eax\)
+ 2b2:	dc 90 90 90 90 90 [ 	]*fcoml  0x90909090\(%eax\)
+ 2b8:	dd 90 90 90 90 90 [ 	]*fstl   0x90909090\(%eax\)
+ 2be:	de 90 90 90 90 90 [ 	]*ficom  0x90909090\(%eax\)
+ 2c4:	df 90 90 90 90 90 [ 	]*fist   0x90909090\(%eax\)
+ 2ca:	e0 90 [ 	]*loopne (0x)?25c.*
+ 2cc:	e1 90 [ 	]*loope  (0x)?25e.*
+ 2ce:	e2 90 [ 	]*loop   (0x)?260.*
+ 2d0:	e3 90 [ 	]*jecxz  (0x)?262.*
+ 2d2:	e4 90 [ 	]*in     \$0x90,%al
+ 2d4:	e5 90 [ 	]*in     \$0x90,%eax
+ 2d6:	e6 90 [ 	]*out    %al,\$0x90
+ 2d8:	e7 90 [ 	]*out    %eax,\$0x90
+ 2da:	e8 90 90 90 90 [ 	]*call   (0x)?9090936f.*
+ 2df:	e9 90 90 90 90 [ 	]*jmp    (0x)?90909374.*
+ 2e4:	ea 90 90 90 90 90 90 [ 	]*ljmp   \$0x9090,\$0x90909090
+ 2eb:	eb 90 [ 	]*jmp    (0x)?27d.*
+ 2ed:	ec [ 	]*in     \(%dx\),%al
+ 2ee:	ed [ 	]*in     \(%dx\),%eax
+ 2ef:	ee [ 	]*out    %al,\(%dx\)
+ 2f0:	ef [ 	]*out    %eax,\(%dx\)
+ 2f1:	f4 [ 	]*hlt    
+ 2f2:	f5 [ 	]*cmc    
+ 2f3:	f6 90 90 90 90 90 [ 	]*notb   0x90909090\(%eax\)
+ 2f9:	f7 90 90 90 90 90 [ 	]*notl   0x90909090\(%eax\)
+ 2ff:	f8 [ 	]*clc    
+ 300:	f9 [ 	]*stc    
+ 301:	fa [ 	]*cli    
+ 302:	fb [ 	]*sti    
+ 303:	fc [ 	]*cld    
+ 304:	fd [ 	]*std    
+ 305:	ff 90 90 90 90 90 [ 	]*call   \*0x90909090\(%eax\)
+ 30b:	0f 00 90 90 90 90 90 [ 	]*lldt   0x90909090\(%eax\)
+ 312:	0f 01 90 90 90 90 90 [ 	]*lgdt   0x90909090\(%eax\)
+ 319:	0f 02 90 90 90 90 90 [ 	]*lar    0x90909090\(%eax\),%edx
+ 320:	0f 03 90 90 90 90 90 [ 	]*lsl    0x90909090\(%eax\),%edx
+ 327:	0f 06 [ 	]*clts   
+ 329:	0f 08 [ 	]*invd   
+ 32b:	0f 09 [ 	]*wbinvd 
+ 32d:	0f 0b [ 	]*ud2a   
+ 32f:	0f 20 d0 [ 	]*mov    %cr2,%eax
+ 332:	0f 21 d0 [ 	]*mov    %db2,%eax
+ 335:	0f 22 d0 [ 	]*mov    %eax,%cr2
+ 338:	0f 23 d0 [ 	]*mov    %eax,%db2
+ 33b:	0f 24 d0 [ 	]*mov    %tr2,%eax
+ 33e:	0f 26 d0 [ 	]*mov    %eax,%tr2
+ 341:	0f 30 [ 	]*wrmsr  
+ 343:	0f 31 [ 	]*rdtsc  
+ 345:	0f 32 [ 	]*rdmsr  
+ 347:	0f 33 [ 	]*rdpmc  
+ 349:	0f 40 90 90 90 90 90 [ 	]*cmovo  0x90909090\(%eax\),%edx
+ 350:	0f 41 90 90 90 90 90 [ 	]*cmovno 0x90909090\(%eax\),%edx
+ 357:	0f 42 90 90 90 90 90 [ 	]*cmovb  0x90909090\(%eax\),%edx
+ 35e:	0f 43 90 90 90 90 90 [ 	]*cmovae 0x90909090\(%eax\),%edx
+ 365:	0f 44 90 90 90 90 90 [ 	]*cmove  0x90909090\(%eax\),%edx
+ 36c:	0f 45 90 90 90 90 90 [ 	]*cmovne 0x90909090\(%eax\),%edx
+ 373:	0f 46 90 90 90 90 90 [ 	]*cmovbe 0x90909090\(%eax\),%edx
+ 37a:	0f 47 90 90 90 90 90 [ 	]*cmova  0x90909090\(%eax\),%edx
+ 381:	0f 48 90 90 90 90 90 [ 	]*cmovs  0x90909090\(%eax\),%edx
+ 388:	0f 49 90 90 90 90 90 [ 	]*cmovns 0x90909090\(%eax\),%edx
+ 38f:	0f 4a 90 90 90 90 90 [ 	]*cmovp  0x90909090\(%eax\),%edx
+ 396:	0f 4b 90 90 90 90 90 [ 	]*cmovnp 0x90909090\(%eax\),%edx
+ 39d:	0f 4c 90 90 90 90 90 [ 	]*cmovl  0x90909090\(%eax\),%edx
+ 3a4:	0f 4d 90 90 90 90 90 [ 	]*cmovge 0x90909090\(%eax\),%edx
+ 3ab:	0f 4e 90 90 90 90 90 [ 	]*cmovle 0x90909090\(%eax\),%edx
+ 3b2:	0f 4f 90 90 90 90 90 [ 	]*cmovg  0x90909090\(%eax\),%edx
+ 3b9:	0f 60 90 90 90 90 90 [ 	]*punpcklbw 0x90909090\(%eax\),%mm2
+ 3c0:	0f 61 90 90 90 90 90 [ 	]*punpcklwd 0x90909090\(%eax\),%mm2
+ 3c7:	0f 62 90 90 90 90 90 [ 	]*punpckldq 0x90909090\(%eax\),%mm2
+ 3ce:	0f 63 90 90 90 90 90 [ 	]*packsswb 0x90909090\(%eax\),%mm2
+ 3d5:	0f 64 90 90 90 90 90 [ 	]*pcmpgtb 0x90909090\(%eax\),%mm2
+ 3dc:	0f 65 90 90 90 90 90 [ 	]*pcmpgtw 0x90909090\(%eax\),%mm2
+ 3e3:	0f 66 90 90 90 90 90 [ 	]*pcmpgtd 0x90909090\(%eax\),%mm2
+ 3ea:	0f 67 90 90 90 90 90 [ 	]*packuswb 0x90909090\(%eax\),%mm2
+ 3f1:	0f 68 90 90 90 90 90 [ 	]*punpckhbw 0x90909090\(%eax\),%mm2
+ 3f8:	0f 69 90 90 90 90 90 [ 	]*punpckhwd 0x90909090\(%eax\),%mm2
+ 3ff:	0f 6a 90 90 90 90 90 [ 	]*punpckhdq 0x90909090\(%eax\),%mm2
+ 406:	0f 6b 90 90 90 90 90 [ 	]*packssdw 0x90909090\(%eax\),%mm2
+ 40d:	0f 6e 90 90 90 90 90 [ 	]*movd   0x90909090\(%eax\),%mm2
+ 414:	0f 6f 90 90 90 90 90 [ 	]*movq   0x90909090\(%eax\),%mm2
+ 41b:	0f 71 d0 90 [ 	]*psrlw  \$0x90,%mm0
+ 41f:	0f 72 d0 90 [ 	]*psrld  \$0x90,%mm0
+ 423:	0f 73 d0 90 [ 	]*psrlq  \$0x90,%mm0
+ 427:	0f 74 90 90 90 90 90 [ 	]*pcmpeqb 0x90909090\(%eax\),%mm2
+ 42e:	0f 75 90 90 90 90 90 [ 	]*pcmpeqw 0x90909090\(%eax\),%mm2
+ 435:	0f 76 90 90 90 90 90 [ 	]*pcmpeqd 0x90909090\(%eax\),%mm2
+ 43c:	0f 77 [ 	]*emms   
+ 43e:	0f 7e 90 90 90 90 90 [ 	]*movd   %mm2,0x90909090\(%eax\)
+ 445:	0f 7f 90 90 90 90 90 [ 	]*movq   %mm2,0x90909090\(%eax\)
+ 44c:	0f 80 90 90 90 90 [ 	]*jo     (0x)?909094e2.*
+ 452:	0f 81 90 90 90 90 [ 	]*jno    (0x)?909094e8.*
+ 458:	0f 82 90 90 90 90 [ 	]*jb     (0x)?909094ee.*
+ 45e:	0f 83 90 90 90 90 [ 	]*jae    (0x)?909094f4.*
+ 464:	0f 84 90 90 90 90 [ 	]*je     (0x)?909094fa.*
+ 46a:	0f 85 90 90 90 90 [ 	]*jne    (0x)?90909500.*
+ 470:	0f 86 90 90 90 90 [ 	]*jbe    (0x)?90909506.*
+ 476:	0f 87 90 90 90 90 [ 	]*ja     (0x)?9090950c.*
+ 47c:	0f 88 90 90 90 90 [ 	]*js     (0x)?90909512.*
+ 482:	0f 89 90 90 90 90 [ 	]*jns    (0x)?90909518.*
+ 488:	0f 8a 90 90 90 90 [ 	]*jp     (0x)?9090951e.*
+ 48e:	0f 8b 90 90 90 90 [ 	]*jnp    (0x)?90909524.*
+ 494:	0f 8c 90 90 90 90 [ 	]*jl     (0x)?9090952a.*
+ 49a:	0f 8d 90 90 90 90 [ 	]*jge    (0x)?90909530.*
+ 4a0:	0f 8e 90 90 90 90 [ 	]*jle    (0x)?90909536.*
+ 4a6:	0f 8f 90 90 90 90 [ 	]*jg     (0x)?9090953c.*
+ 4ac:	0f 90 80 90 90 90 90 [ 	]*seto   0x90909090\(%eax\)
+ 4b3:	0f 91 80 90 90 90 90 [ 	]*setno  0x90909090\(%eax\)
+ 4ba:	0f 92 80 90 90 90 90 [ 	]*setb   0x90909090\(%eax\)
+ 4c1:	0f 93 80 90 90 90 90 [ 	]*setae  0x90909090\(%eax\)
+ 4c8:	0f 94 80 90 90 90 90 [ 	]*sete   0x90909090\(%eax\)
+ 4cf:	0f 95 80 90 90 90 90 [ 	]*setne  0x90909090\(%eax\)
+ 4d6:	0f 96 80 90 90 90 90 [ 	]*setbe  0x90909090\(%eax\)
+ 4dd:	0f 97 80 90 90 90 90 [ 	]*seta   0x90909090\(%eax\)
+ 4e4:	0f 98 80 90 90 90 90 [ 	]*sets   0x90909090\(%eax\)
+ 4eb:	0f 99 80 90 90 90 90 [ 	]*setns  0x90909090\(%eax\)
+ 4f2:	0f 9a 80 90 90 90 90 [ 	]*setp   0x90909090\(%eax\)
+ 4f9:	0f 9b 80 90 90 90 90 [ 	]*setnp  0x90909090\(%eax\)
+ 500:	0f 9c 80 90 90 90 90 [ 	]*setl   0x90909090\(%eax\)
+ 507:	0f 9d 80 90 90 90 90 [ 	]*setge  0x90909090\(%eax\)
+ 50e:	0f 9e 80 90 90 90 90 [ 	]*setle  0x90909090\(%eax\)
+ 515:	0f 9f 80 90 90 90 90 [ 	]*setg   0x90909090\(%eax\)
+ 51c:	0f a0 [ 	]*push   %fs
+ 51e:	0f a1 [ 	]*pop    %fs
+ 520:	0f a2 [ 	]*cpuid  
+ 522:	0f a3 90 90 90 90 90 [ 	]*bt     %edx,0x90909090\(%eax\)
+ 529:	0f a4 90 90 90 90 90 90 [ 	]*shld   \$0x90,%edx,0x90909090\(%eax\)
+ 531:	0f a5 90 90 90 90 90 [ 	]*shld   %cl,%edx,0x90909090\(%eax\)
+ 538:	0f a8 [ 	]*push   %gs
+ 53a:	0f a9 [ 	]*pop    %gs
+ 53c:	0f aa [ 	]*rsm    
+ 53e:	0f ab 90 90 90 90 90 [ 	]*bts    %edx,0x90909090\(%eax\)
+ 545:	0f ac 90 90 90 90 90 90 [ 	]*shrd   \$0x90,%edx,0x90909090\(%eax\)
+ 54d:	0f ad 90 90 90 90 90 [ 	]*shrd   %cl,%edx,0x90909090\(%eax\)
+ 554:	0f af 90 90 90 90 90 [ 	]*imul   0x90909090\(%eax\),%edx
+ 55b:	0f b0 90 90 90 90 90 [ 	]*cmpxchg %dl,0x90909090\(%eax\)
+ 562:	0f b1 90 90 90 90 90 [ 	]*cmpxchg %edx,0x90909090\(%eax\)
+ 569:	0f b2 90 90 90 90 90 [ 	]*lss    0x90909090\(%eax\),%edx
+ 570:	0f b3 90 90 90 90 90 [ 	]*btr    %edx,0x90909090\(%eax\)
+ 577:	0f b4 90 90 90 90 90 [ 	]*lfs    0x90909090\(%eax\),%edx
+ 57e:	0f b5 90 90 90 90 90 [ 	]*lgs    0x90909090\(%eax\),%edx
+ 585:	0f b6 90 90 90 90 90 [ 	]*movzbl 0x90909090\(%eax\),%edx
+ 58c:	0f b7 90 90 90 90 90 [ 	]*movzwl 0x90909090\(%eax\),%edx
+ 593:	0f b9 [ 	]*ud2b   
+ 595:	0f bb 90 90 90 90 90 [ 	]*btc    %edx,0x90909090\(%eax\)
+ 59c:	0f bc 90 90 90 90 90 [ 	]*bsf    0x90909090\(%eax\),%edx
+ 5a3:	0f bd 90 90 90 90 90 [ 	]*bsr    0x90909090\(%eax\),%edx
+ 5aa:	0f be 90 90 90 90 90 [ 	]*movsbl 0x90909090\(%eax\),%edx
+ 5b1:	0f bf 90 90 90 90 90 [ 	]*movswl 0x90909090\(%eax\),%edx
+ 5b8:	0f c0 90 90 90 90 90 [ 	]*xadd   %dl,0x90909090\(%eax\)
+ 5bf:	0f c1 90 90 90 90 90 [ 	]*xadd   %edx,0x90909090\(%eax\)
+ 5c6:	0f c8 [ 	]*bswap  %eax
+ 5c8:	0f c9 [ 	]*bswap  %ecx
+ 5ca:	0f ca [ 	]*bswap  %edx
+ 5cc:	0f cb [ 	]*bswap  %ebx
+ 5ce:	0f cc [ 	]*bswap  %esp
+ 5d0:	0f cd [ 	]*bswap  %ebp
+ 5d2:	0f ce [ 	]*bswap  %esi
+ 5d4:	0f cf [ 	]*bswap  %edi
+ 5d6:	0f d1 90 90 90 90 90 [ 	]*psrlw  0x90909090\(%eax\),%mm2
+ 5dd:	0f d2 90 90 90 90 90 [ 	]*psrld  0x90909090\(%eax\),%mm2
+ 5e4:	0f d3 90 90 90 90 90 [ 	]*psrlq  0x90909090\(%eax\),%mm2
+ 5eb:	0f d5 90 90 90 90 90 [ 	]*pmullw 0x90909090\(%eax\),%mm2
+ 5f2:	0f d8 90 90 90 90 90 [ 	]*psubusb 0x90909090\(%eax\),%mm2
+ 5f9:	0f d9 90 90 90 90 90 [ 	]*psubusw 0x90909090\(%eax\),%mm2
+ 600:	0f db 90 90 90 90 90 [ 	]*pand   0x90909090\(%eax\),%mm2
+ 607:	0f dc 90 90 90 90 90 [ 	]*paddusb 0x90909090\(%eax\),%mm2
+ 60e:	0f dd 90 90 90 90 90 [ 	]*paddusw 0x90909090\(%eax\),%mm2
+ 615:	0f df 90 90 90 90 90 [ 	]*pandn  0x90909090\(%eax\),%mm2
+ 61c:	0f e1 90 90 90 90 90 [ 	]*psraw  0x90909090\(%eax\),%mm2
+ 623:	0f e2 90 90 90 90 90 [ 	]*psrad  0x90909090\(%eax\),%mm2
+ 62a:	0f e5 90 90 90 90 90 [ 	]*pmulhw 0x90909090\(%eax\),%mm2
+ 631:	0f e8 90 90 90 90 90 [ 	]*psubsb 0x90909090\(%eax\),%mm2
+ 638:	0f e9 90 90 90 90 90 [ 	]*psubsw 0x90909090\(%eax\),%mm2
+ 63f:	0f eb 90 90 90 90 90 [ 	]*por    0x90909090\(%eax\),%mm2
+ 646:	0f ec 90 90 90 90 90 [ 	]*paddsb 0x90909090\(%eax\),%mm2
+ 64d:	0f ed 90 90 90 90 90 [ 	]*paddsw 0x90909090\(%eax\),%mm2
+ 654:	0f ef 90 90 90 90 90 [ 	]*pxor   0x90909090\(%eax\),%mm2
+ 65b:	0f f1 90 90 90 90 90 [ 	]*psllw  0x90909090\(%eax\),%mm2
+ 662:	0f f2 90 90 90 90 90 [ 	]*pslld  0x90909090\(%eax\),%mm2
+ 669:	0f f3 90 90 90 90 90 [ 	]*psllq  0x90909090\(%eax\),%mm2
+ 670:	0f f5 90 90 90 90 90 [ 	]*pmaddwd 0x90909090\(%eax\),%mm2
+ 677:	0f f8 90 90 90 90 90 [ 	]*psubb  0x90909090\(%eax\),%mm2
+ 67e:	0f f9 90 90 90 90 90 [ 	]*psubw  0x90909090\(%eax\),%mm2
+ 685:	0f fa 90 90 90 90 90 [ 	]*psubd  0x90909090\(%eax\),%mm2
+ 68c:	0f fc 90 90 90 90 90 [ 	]*paddb  0x90909090\(%eax\),%mm2
+ 693:	0f fd 90 90 90 90 90 [ 	]*paddw  0x90909090\(%eax\),%mm2
+ 69a:	0f fe 90 90 90 90 90 [ 	]*paddd  0x90909090\(%eax\),%mm2
+ 6a1:	66 01 90 90 90 90 90 [ 	]*add    %dx,0x90909090\(%eax\)
+ 6a8:	66 03 90 90 90 90 90 [ 	]*add    0x90909090\(%eax\),%dx
+ 6af:	66 05 90 90 [ 	]*add    \$0x9090,%ax
+ 6b3:	66 06 [ 	]*pushw  %es
+ 6b5:	66 07 [ 	]*popw   %es
+ 6b7:	66 09 90 90 90 90 90 [ 	]*or     %dx,0x90909090\(%eax\)
+ 6be:	66 0b 90 90 90 90 90 [ 	]*or     0x90909090\(%eax\),%dx
+ 6c5:	66 0d 90 90 [ 	]*or     \$0x9090,%ax
+ 6c9:	66 0e [ 	]*pushw  %cs
+ 6cb:	66 11 90 90 90 90 90 [ 	]*adc    %dx,0x90909090\(%eax\)
+ 6d2:	66 13 90 90 90 90 90 [ 	]*adc    0x90909090\(%eax\),%dx
+ 6d9:	66 15 90 90 [ 	]*adc    \$0x9090,%ax
+ 6dd:	66 16 [ 	]*pushw  %ss
+ 6df:	66 17 [ 	]*popw   %ss
+ 6e1:	66 19 90 90 90 90 90 [ 	]*sbb    %dx,0x90909090\(%eax\)
+ 6e8:	66 1b 90 90 90 90 90 [ 	]*sbb    0x90909090\(%eax\),%dx
+ 6ef:	66 1d 90 90 [ 	]*sbb    \$0x9090,%ax
+ 6f3:	66 1e [ 	]*pushw  %ds
+ 6f5:	66 1f [ 	]*popw   %ds
+ 6f7:	66 21 90 90 90 90 90 [ 	]*and    %dx,0x90909090\(%eax\)
+ 6fe:	66 23 90 90 90 90 90 [ 	]*and    0x90909090\(%eax\),%dx
+ 705:	66 25 90 90 [ 	]*and    \$0x9090,%ax
+ 709:	66 29 90 90 90 90 90 [ 	]*sub    %dx,0x90909090\(%eax\)
+ 710:	66 2b 90 90 90 90 90 [ 	]*sub    0x90909090\(%eax\),%dx
+ 717:	66 2d 90 90 [ 	]*sub    \$0x9090,%ax
+ 71b:	66 31 90 90 90 90 90 [ 	]*xor    %dx,0x90909090\(%eax\)
+ 722:	66 33 90 90 90 90 90 [ 	]*xor    0x90909090\(%eax\),%dx
+ 729:	66 35 90 90 [ 	]*xor    \$0x9090,%ax
+ 72d:	66 39 90 90 90 90 90 [ 	]*cmp    %dx,0x90909090\(%eax\)
+ 734:	66 3b 90 90 90 90 90 [ 	]*cmp    0x90909090\(%eax\),%dx
+ 73b:	66 3d 90 90 [ 	]*cmp    \$0x9090,%ax
+ 73f:	66 40 [ 	]*inc    %ax
+ 741:	66 41 [ 	]*inc    %cx
+ 743:	66 42 [ 	]*inc    %dx
+ 745:	66 43 [ 	]*inc    %bx
+ 747:	66 44 [ 	]*inc    %sp
+ 749:	66 45 [ 	]*inc    %bp
+ 74b:	66 46 [ 	]*inc    %si
+ 74d:	66 47 [ 	]*inc    %di
+ 74f:	66 48 [ 	]*dec    %ax
+ 751:	66 49 [ 	]*dec    %cx
+ 753:	66 4a [ 	]*dec    %dx
+ 755:	66 4b [ 	]*dec    %bx
+ 757:	66 4c [ 	]*dec    %sp
+ 759:	66 4d [ 	]*dec    %bp
+ 75b:	66 4e [ 	]*dec    %si
+ 75d:	66 4f [ 	]*dec    %di
+ 75f:	66 50 [ 	]*push   %ax
+ 761:	66 51 [ 	]*push   %cx
+ 763:	66 52 [ 	]*push   %dx
+ 765:	66 53 [ 	]*push   %bx
+ 767:	66 54 [ 	]*push   %sp
+ 769:	66 55 [ 	]*push   %bp
+ 76b:	66 56 [ 	]*push   %si
+ 76d:	66 57 [ 	]*push   %di
+ 76f:	66 58 [ 	]*pop    %ax
+ 771:	66 59 [ 	]*pop    %cx
+ 773:	66 5a [ 	]*pop    %dx
+ 775:	66 5b [ 	]*pop    %bx
+ 777:	66 5c [ 	]*pop    %sp
+ 779:	66 5d [ 	]*pop    %bp
+ 77b:	66 5e [ 	]*pop    %si
+ 77d:	66 5f [ 	]*pop    %di
+ 77f:	66 60 [ 	]*pushaw 
+ 781:	66 61 [ 	]*popaw  
+ 783:	66 62 90 90 90 90 90 [ 	]*bound  %dx,0x90909090\(%eax\)
+ 78a:	66 68 90 90 [ 	]*pushw  \$0x9090
+ 78e:	66 69 90 90 90 90 90 90 90 [ 	]*imul   \$0x9090,0x90909090\(%eax\),%dx
+ 797:	66 6a 90 [ 	]*pushw  \$0xffffff90
+ 79a:	66 6b 90 90 90 90 90 90 [ 	]*imul   \$0xffffff90,0x90909090\(%eax\),%dx
+ 7a2:	66 6d [ 	]*insw   \(%dx\),%es:\(%edi\)
+ 7a4:	66 6f [ 	]*outsw  %ds:\(%esi\),\(%dx\)
+ 7a6:	66 81 90 90 90 90 90 90 90 [ 	]*adcw   \$0x9090,0x90909090\(%eax\)
+ 7af:	66 83 90 90 90 90 90 90 [ 	]*adcw   \$0xffffff90,0x90909090\(%eax\)
+ 7b7:	66 85 90 90 90 90 90 [ 	]*test   %dx,0x90909090\(%eax\)
+ 7be:	66 87 90 90 90 90 90 [ 	]*xchg   %dx,0x90909090\(%eax\)
+ 7c5:	66 89 90 90 90 90 90 [ 	]*mov    %dx,0x90909090\(%eax\)
+ 7cc:	66 8b 90 90 90 90 90 [ 	]*mov    0x90909090\(%eax\),%dx
+ 7d3:	66 8c 90 90 90 90 90 [ 	]*movw   %ss,0x90909090\(%eax\)
+ 7da:	66 8d 90 90 90 90 90 [ 	]*lea    0x90909090\(%eax\),%dx
+ 7e1:	66 8f 80 90 90 90 90 [ 	]*popw   0x90909090\(%eax\)
+ 7e8:	66 91 [ 	]*xchg   %ax,%cx
+ 7ea:	66 92 [ 	]*xchg   %ax,%dx
+ 7ec:	66 93 [ 	]*xchg   %ax,%bx
+ 7ee:	66 94 [ 	]*xchg   %ax,%sp
+ 7f0:	66 95 [ 	]*xchg   %ax,%bp
+ 7f2:	66 96 [ 	]*xchg   %ax,%si
+ 7f4:	66 97 [ 	]*xchg   %ax,%di
+ 7f6:	66 98 [ 	]*cbtw   
+ 7f8:	66 99 [ 	]*cwtd   
+ 7fa:	66 9a 90 90 90 90 [ 	]*lcallw \$0x9090,\$0x9090
+ 800:	66 9c [ 	]*pushfw 
+ 802:	66 9d [ 	]*popfw  
+ 804:	66 a1 90 90 90 90 [ 	]*mov    0x90909090,%ax
+ 80a:	66 a3 90 90 90 90 [ 	]*mov    %ax,0x90909090
+ 810:	66 a5 [ 	]*movsw  %ds:\(%esi\),%es:\(%edi\)
+ 812:	66 a7 [ 	]*cmpsw  %es:\(%edi\),%ds:\(%esi\)
+ 814:	66 a9 90 90 [ 	]*test   \$0x9090,%ax
+ 818:	66 ab [ 	]*stos   %ax,%es:\(%edi\)
+ 81a:	66 ad [ 	]*lods   %ds:\(%esi\),%ax
+ 81c:	66 af [ 	]*scas   %es:\(%edi\),%ax
+ 81e:	66 b8 90 90 [ 	]*mov    \$0x9090,%ax
+ 822:	66 b9 90 90 [ 	]*mov    \$0x9090,%cx
+ 826:	66 ba 90 90 [ 	]*mov    \$0x9090,%dx
+ 82a:	66 bb 90 90 [ 	]*mov    \$0x9090,%bx
+ 82e:	66 bc 90 90 [ 	]*mov    \$0x9090,%sp
+ 832:	66 bd 90 90 [ 	]*mov    \$0x9090,%bp
+ 836:	66 be 90 90 [ 	]*mov    \$0x9090,%si
+ 83a:	66 bf 90 90 [ 	]*mov    \$0x9090,%di
+ 83e:	66 c1 90 90 90 90 90 90 [ 	]*rclw   \$0x90,0x90909090\(%eax\)
+ 846:	66 c2 90 90 [ 	]*retw   \$0x9090
+ 84a:	66 c3 [ 	]*retw   
+ 84c:	66 c4 90 90 90 90 90 [ 	]*les    0x90909090\(%eax\),%dx
+ 853:	66 c5 90 90 90 90 90 [ 	]*lds    0x90909090\(%eax\),%dx
+ 85a:	66 c7 80 90 90 90 90 90 90 [ 	]*movw   \$0x9090,0x90909090\(%eax\)
+ 863:	66 c8 90 90 90 [ 	]*enterw \$0x9090,\$0x90
+ 868:	66 c9 [ 	]*leavew 
+ 86a:	66 ca 90 90 [ 	]*lretw  \$0x9090
+ 86e:	66 cb [ 	]*lretw  
+ 870:	66 cf [ 	]*iretw  
+ 872:	66 d1 90 90 90 90 90 [ 	]*rclw   0x90909090\(%eax\)
+ 879:	66 d3 90 90 90 90 90 [ 	]*rclw   %cl,0x90909090\(%eax\)
+ 880:	66 e5 90 [ 	]*in     \$0x90,%ax
+ 883:	66 e7 90 [ 	]*out    %ax,\$0x90
+ 886:	66 e8 8f 90 [ 	]*callw  (0x)?9919.*
+ 88a:	66 ea 90 90 90 90 [ 	]*ljmpw  \$0x9090,\$0x9090
+ 890:	66 ed [ 	]*in     \(%dx\),%ax
+ 892:	66 ef [ 	]*out    %ax,\(%dx\)
+ 894:	66 f7 90 90 90 90 90 [ 	]*notw   0x90909090\(%eax\)
+ 89b:	66 ff 90 90 90 90 90 [ 	]*callw  \*0x90909090\(%eax\)
+ 8a2:	66 0f 02 90 90 90 90 90 [ 	]*lar    0x90909090\(%eax\),%dx
+ 8aa:	66 0f 03 90 90 90 90 90 [ 	]*lsl    0x90909090\(%eax\),%dx
+ 8b2:	66 0f 40 90 90 90 90 90 [ 	]*cmovo  0x90909090\(%eax\),%dx
+ 8ba:	66 0f 41 90 90 90 90 90 [ 	]*cmovno 0x90909090\(%eax\),%dx
+ 8c2:	66 0f 42 90 90 90 90 90 [ 	]*cmovb  0x90909090\(%eax\),%dx
+ 8ca:	66 0f 43 90 90 90 90 90 [ 	]*cmovae 0x90909090\(%eax\),%dx
+ 8d2:	66 0f 44 90 90 90 90 90 [ 	]*cmove  0x90909090\(%eax\),%dx
+ 8da:	66 0f 45 90 90 90 90 90 [ 	]*cmovne 0x90909090\(%eax\),%dx
+ 8e2:	66 0f 46 90 90 90 90 90 [ 	]*cmovbe 0x90909090\(%eax\),%dx
+ 8ea:	66 0f 47 90 90 90 90 90 [ 	]*cmova  0x90909090\(%eax\),%dx
+ 8f2:	66 0f 48 90 90 90 90 90 [ 	]*cmovs  0x90909090\(%eax\),%dx
+ 8fa:	66 0f 49 90 90 90 90 90 [ 	]*cmovns 0x90909090\(%eax\),%dx
+ 902:	66 0f 4a 90 90 90 90 90 [ 	]*cmovp  0x90909090\(%eax\),%dx
+ 90a:	66 0f 4b 90 90 90 90 90 [ 	]*cmovnp 0x90909090\(%eax\),%dx
+ 912:	66 0f 4c 90 90 90 90 90 [ 	]*cmovl  0x90909090\(%eax\),%dx
+ 91a:	66 0f 4d 90 90 90 90 90 [ 	]*cmovge 0x90909090\(%eax\),%dx
+ 922:	66 0f 4e 90 90 90 90 90 [ 	]*cmovle 0x90909090\(%eax\),%dx
+ 92a:	66 0f 4f 90 90 90 90 90 [ 	]*cmovg  0x90909090\(%eax\),%dx
+ 932:	66 0f a0 [ 	]*pushw  %fs
+ 935:	66 0f a1 [ 	]*popw   %fs
+ 938:	66 0f a3 90 90 90 90 90 [ 	]*bt     %dx,0x90909090\(%eax\)
+ 940:	66 0f a4 90 90 90 90 90 90 [ 	]*shld   \$0x90,%dx,0x90909090\(%eax\)
+ 949:	66 0f a5 90 90 90 90 90 [ 	]*shld   %cl,%dx,0x90909090\(%eax\)
+ 951:	66 0f a8 [ 	]*pushw  %gs
+ 954:	66 0f a9 [ 	]*popw   %gs
+ 957:	66 0f ab 90 90 90 90 90 [ 	]*bts    %dx,0x90909090\(%eax\)
+ 95f:	66 0f ac 90 90 90 90 90 90 [ 	]*shrd   \$0x90,%dx,0x90909090\(%eax\)
+ 968:	66 0f ad 90 90 90 90 90 [ 	]*shrd   %cl,%dx,0x90909090\(%eax\)
+ 970:	66 0f af 90 90 90 90 90 [ 	]*imul   0x90909090\(%eax\),%dx
+ 978:	66 0f b1 90 90 90 90 90 [ 	]*cmpxchg %dx,0x90909090\(%eax\)
+ 980:	66 0f b2 90 90 90 90 90 [ 	]*lss    0x90909090\(%eax\),%dx
+ 988:	66 0f b3 90 90 90 90 90 [ 	]*btr    %dx,0x90909090\(%eax\)
+ 990:	66 0f b4 90 90 90 90 90 [ 	]*lfs    0x90909090\(%eax\),%dx
+ 998:	66 0f b5 90 90 90 90 90 [ 	]*lgs    0x90909090\(%eax\),%dx
+ 9a0:	66 0f b6 90 90 90 90 90 [ 	]*movzbw 0x90909090\(%eax\),%dx
+ 9a8:	66 0f bb 90 90 90 90 90 [ 	]*btc    %dx,0x90909090\(%eax\)
+ 9b0:	66 0f bc 90 90 90 90 90 [ 	]*bsf    0x90909090\(%eax\),%dx
+ 9b8:	66 0f bd 90 90 90 90 90 [ 	]*bsr    0x90909090\(%eax\),%dx
+ 9c0:	66 0f be 90 90 90 90 90 [ 	]*movsbw 0x90909090\(%eax\),%dx
+ 9c8:	66 0f c1 90 90 90 90 90 [ 	]*xadd   %dx,0x90909090\(%eax\)
diff --git a/gas/testsuite/gas/i386/intel.s b/gas/testsuite/gas/i386/intel.s
new file mode 100644
index 0000000..ab41dbf
--- /dev/null
+++ b/gas/testsuite/gas/i386/intel.s
@@ -0,0 +1,568 @@
+.text
+.intel_syntax noprefix
+foo:
+ add    byte ptr 0x90909090[eax], dl
+ add    dword ptr 0x90909090[eax], edx
+ add    dl, byte ptr 0x90909090[eax]
+ add    edx, dword ptr 0x90909090[eax]
+ add    al, 0x90
+ add    eax, 0x90909090
+ push   es
+ pop    es
+ or     [eax+0x90909090], dl
+ or     [eax+0x90909090], edx
+ or     dl, [eax+0x90909090]
+ or     edx, [eax+0x90909090]
+ or     al, 0x90
+ or     eax, 0x90909090
+ push   cs
+ adc    byte ptr [eax+0x90909090], dl
+ adc    dword ptr [eax+0x90909090], edx
+ adc    dl, byte ptr [eax+0x90909090]
+ adc    edx, dword ptr [eax+0x90909090]
+ adc    al, 0x90
+ adc    eax, 0x90909090
+ push   ss
+ pop    ss
+ sbb    0x90909090[eax], dl
+ sbb    0x90909090[eax], edx
+ sbb    dl, 0x90909090[eax]
+ sbb    edx, 0x90909090[eax]
+ sbb    al, 0x90
+ sbb    eax, 0x90909090
+ push   ds
+ pop    ds
+ and    0x90909090[eax], dl
+ and    0x90909090[eax], edx
+ and    dl, 0x90909090[eax]
+ and    edx, 0x90909090[eax]
+ and    al, 0x90
+ and    eax, 0x90909090
+ daa
+ sub    0x90909090[eax], dl
+ sub    0x90909090[eax], edx
+ sub    dl, 0x90909090[eax]
+ sub    edx, 0x90909090[eax]
+ sub    al, 0x90
+ sub    eax, 0x90909090
+ das
+ xor    0x90909090[eax], dl
+ xor    0x90909090[eax], edx
+ xor    dl, 0x90909090[eax]
+ xor    edx, 0x90909090[eax]
+ xor    al, 0x90
+ xor    eax, 0x90909090
+ aaa
+ cmp    0x90909090[eax], dl
+ cmp    0x90909090[eax], edx
+ cmp    dl, 0x90909090[eax]
+ cmp    edx, 0x90909090[eax]
+ cmp    al, 0x90
+ cmp    eax, 0x90909090
+ aas
+ inc    eax
+ inc    ecx
+ inc    edx
+ inc    ebx
+ inc    esp
+ inc    ebp
+ inc    esi
+ inc    edi
+ dec    eax
+ dec    ecx
+ dec    edx
+ dec    ebx
+ dec    esp
+ dec    ebp
+ dec    esi
+ dec    edi
+ push   eax
+ push   ecx
+ push   edx
+ push   ebx
+ push   esp
+ push   ebp
+ push   esi
+ push   edi
+ pop    eax
+ pop    ecx
+ pop    edx
+ pop    ebx
+ pop    esp
+ pop    ebp
+ pop    esi
+ pop    edi
+ pusha
+ popa
+ bound  edx, 0x90909090[eax]
+ arpl   0x90909090[eax], dx
+ push   0x90909090
+ imul   edx, 0x90909090[eax], 0x90909090
+ push   0xffffff90
+ imul   edx, 0x90909090[eax], 0xffffff90
+ ins    byte ptr es:[edi], dx
+ ins    dword ptr es:[edi], dx
+ outs   dx, byte ptr ds:[esi]
+ outs   dx, dword ptr ds:[esi]
+ jo     .+2-0x70
+ jno    .+2-0x70
+ jb     .+2-0x70
+ jae    .+2-0x70
+ je     .+2-0x70
+ jne    .+2-0x70
+ jbe    .+2-0x70
+ ja     .+2-0x70
+ js     .+2-0x70
+ jns    .+2-0x70
+ jp     .+2-0x70
+ jnp    .+2-0x70
+ jl     .+2-0x70
+ jge    .+2-0x70
+ jle    .+2-0x70
+ jg     .+2-0x70
+ adc    byte ptr 0x90909090[eax], 0x90
+ adc    dword ptr 0x90909090[eax], 0x90909090
+ adc    dword ptr 0x90909090[eax], 0xffffff90
+ test   0x90909090[eax], dl
+ test   0x90909090[eax], edx
+ xchg   0x90909090[eax], dl
+ xchg   0x90909090[eax], edx
+ mov    0x90909090[eax], dl
+ mov    0x90909090[eax], edx
+ mov    dl, 0x90909090[eax]
+ mov    edx, 0x90909090[eax]
+ mov    dword ptr 0x90909090[eax], ss
+ lea    edx, 0x90909090[eax]
+ mov    ss, dword ptr 0x90909090[eax]
+ pop    dword ptr 0x90909090[eax]
+ xchg   eax, eax
+ xchg   ecx, eax
+ xchg   edx, eax
+ xchg   ebx, eax
+ xchg   esp, eax
+ xchg   ebp, eax
+ xchg   esi, eax
+ xchg   edi, eax
+ cwde
+ cdq
+ call   0x9090,0x90909090
+ fwait
+ pushf
+ popf
+ sahf
+ lahf
+ mov    al, [0x90909090]
+ mov    eax, [0x90909090]
+ mov    [0x90909090], al
+ mov    [0x90909090], eax
+ movs   byte ptr es:[edi], byte ptr ds:[esi]
+ movs   dword ptr es:[edi], dword ptr ds:[esi]
+ cmps   byte ptr ds:[esi], byte ptr es:[edi]
+ cmps   dword ptr ds:[esi], dword ptr es:[edi]
+ test   al, 0x90
+ test   eax, 0x90909090
+ stos   byte ptr es:[edi], al
+ stos   dword ptr es:[edi], eax
+ lods   al, byte ptr ds:[esi]
+ lods   eax, dword ptr ds:[esi]
+ scas   al, byte ptr es:[edi]
+ scas   eax, dword ptr es:[edi]
+ mov    al, 0x90
+ mov    cl, 0x90
+ mov    dl, 0x90
+ mov    bl, 0x90
+ mov    ah, 0x90
+ mov    ch, 0x90
+ mov    dh, 0x90
+ mov    bh, 0x90
+ mov    eax, 0x90909090
+ mov    ecx, 0x90909090
+ mov    edx, 0x90909090
+ mov    ebx, 0x90909090
+ mov    esp, 0x90909090
+ mov    ebp, 0x90909090
+ mov    esi, 0x90909090
+ mov    edi, 0x90909090
+ rcl    byte ptr 0x90909090[eax], 0x90
+ rcl    dword ptr 0x90909090[eax], 0x90
+ ret    0x9090
+ ret
+ les    edx, 0x90909090[eax]
+ lds    edx, 0x90909090[eax]
+ mov    byte ptr 0x90909090[eax], 0x90
+ mov    dword ptr 0x90909090[eax], 0x90909090
+ enter  0x9090, 0x90
+ leave
+ lret   0x9090
+ lret
+ int3
+ int    0x90
+ into
+ iret
+ rcl    byte ptr 0x90909090[eax]
+ rcl    dword ptr 0x90909090[eax]
+ rcl    byte ptr 0x90909090[eax], cl
+ rcl    dword ptr 0x90909090[eax], cl
+ aam    0xffffff90
+ aad    0xffffff90
+ xlat   byte ptr ds:[ebx]
+ fcom   dword ptr 0x90909090[eax]
+ fst    dword ptr 0x90909090[eax]
+ ficom  dword ptr 0x90909090[eax]
+ fist   dword ptr 0x90909090[eax]
+ fcom   qword ptr 0x90909090[eax]
+ fst    qword ptr 0x90909090[eax]
+ ficom  word ptr 0x90909090[eax]
+ fist   word ptr 0x90909090[eax]
+ loopne .+2-0x70
+ loope  .+2-0x70
+ loop   .+2-0x70
+ jecxz  .+2-0x70
+ in     al, 0x90
+ in     eax, 0x90
+ out    0x90, al
+ out    0x90, eax
+ call   .+5+0x90909090
+ jmp    .+5+0x90909090
+ jmp    0x9090,0x90909090
+ jmp    .+2-0x70
+ in     al, dx
+ in     eax, dx
+ out    dx, al
+ out    dx, eax
+ hlt
+ cmc
+ not    byte ptr 0x90909090[eax]
+ not    dword ptr 0x90909090[eax]
+ clc
+ stc
+ cli
+ sti
+ cld
+ std
+ call   dword ptr 0x90909090[eax]
+ lldt   0x90909090[eax]
+ lgdt   0x90909090[eax]
+ lar    edx, 0x90909090[eax]
+ lsl    edx, 0x90909090[eax]
+ clts
+ invd
+ wbinvd
+ ud2a
+ mov    eax, cr2
+ mov    eax, db2
+ mov    cr2, eax
+ mov    db2, eax
+ mov    eax, tr2
+ mov    tr2, eax
+ wrmsr
+ rdtsc
+ rdmsr
+ rdpmc
+ cmovo  edx, 0x90909090[eax]
+ cmovno edx, 0x90909090[eax]
+ cmovb  edx, 0x90909090[eax]
+ cmovae edx, 0x90909090[eax]
+ cmove  edx, 0x90909090[eax]
+ cmovne edx, 0x90909090[eax]
+ cmovbe edx, 0x90909090[eax]
+ cmova  edx, 0x90909090[eax]
+ cmovs  edx, 0x90909090[eax]
+ cmovns edx, 0x90909090[eax]
+ cmovp  edx, 0x90909090[eax]
+ cmovnp edx, 0x90909090[eax]
+ cmovl  edx, 0x90909090[eax]
+ cmovge edx, 0x90909090[eax]
+ cmovle edx, 0x90909090[eax]
+ cmovg  edx, 0x90909090[eax]
+ punpcklbw mm2, 0x90909090[eax]
+ punpcklwd mm2, 0x90909090[eax]
+ punpckldq mm2, 0x90909090[eax]
+ packsswb mm2, 0x90909090[eax]
+ pcmpgtb mm2, 0x90909090[eax]
+ pcmpgtw mm2, 0x90909090[eax]
+ pcmpgtd mm2, 0x90909090[eax]
+ packuswb mm2, 0x90909090[eax]
+ punpckhbw mm2, 0x90909090[eax]
+ punpckhwd mm2, 0x90909090[eax]
+ punpckhdq mm2, 0x90909090[eax]
+ packssdw mm2, 0x90909090[eax]
+ movd   mm2, 0x90909090[eax]
+ movq   mm2, 0x90909090[eax]
+ psrlw  mm0, 0x90
+ psrld  mm0, 0x90
+ psrlq  mm0, 0x90
+ pcmpeqb mm2, 0x90909090[eax]
+ pcmpeqw mm2, 0x90909090[eax]
+ pcmpeqd mm2, 0x90909090[eax]
+ emms
+ movd   0x90909090[eax], mm2
+ movq   0x90909090[eax], mm2
+ jo     .+6+0x90909090
+ jno    .+6+0x90909090
+ jb     .+6+0x90909090
+ jae    .+6+0x90909090
+ je     .+6+0x90909090
+ jne    .+6+0x90909090
+ jbe    .+6+0x90909090
+ ja     .+6+0x90909090
+ js     .+6+0x90909090
+ jns    .+6+0x90909090
+ jp     .+6+0x90909090
+ jnp    .+6+0x90909090
+ jl     .+6+0x90909090
+ jge    .+6+0x90909090
+ jle    .+6+0x90909090
+ jg     .+6+0x90909090
+ seto   0x90909090[eax]
+ setno  0x90909090[eax]
+ setb   0x90909090[eax]
+ setae  0x90909090[eax]
+ sete   0x90909090[eax]
+ setne  0x90909090[eax]
+ setbe  0x90909090[eax]
+ seta   0x90909090[eax]
+ sets   0x90909090[eax]
+ setns  0x90909090[eax]
+ setp   0x90909090[eax]
+ setnp  0x90909090[eax]
+ setl   0x90909090[eax]
+ setge  0x90909090[eax]
+ setle  0x90909090[eax]
+ setg   0x90909090[eax]
+ push   fs
+ pop    fs
+ cpuid
+ bt     0x90909090[eax], edx
+ shld   0x90909090[eax], edx, 0x90
+ shld   0x90909090[eax], edx, cl
+ push   gs
+ pop    gs
+ rsm
+ bts    0x90909090[eax], edx
+ shrd   0x90909090[eax], edx, 0x90
+ shrd   0x90909090[eax], edx, cl
+ imul   edx, 0x90909090[eax]
+ cmpxchg 0x90909090[eax], dl
+ cmpxchg 0x90909090[eax], edx
+ lss    edx, 0x90909090[eax]
+ btr    0x90909090[eax], edx
+ lfs    edx, 0x90909090[eax]
+ lgs    edx, 0x90909090[eax]
+ movzx  edx, byte ptr 0x90909090[eax]
+ movzx  edx, word ptr 0x90909090[eax]
+ ud2b
+ btc    0x90909090[eax], edx
+ bsf    edx, 0x90909090[eax]
+ bsr    edx, 0x90909090[eax]
+ movsx  edx, byte ptr 0x90909090[eax]
+ movsx  edx, word ptr 0x90909090[eax]
+ xadd   0x90909090[eax], dl
+ xadd   0x90909090[eax], edx
+ bswap  eax
+ bswap  ecx
+ bswap  edx
+ bswap  ebx
+ bswap  esp
+ bswap  ebp
+ bswap  esi
+ bswap  edi
+ psrlw  mm2, 0x90909090[eax]
+ psrld  mm2, 0x90909090[eax]
+ psrlq  mm2, 0x90909090[eax]
+ pmullw mm2, 0x90909090[eax]
+ psubusb mm2, 0x90909090[eax]
+ psubusw mm2, 0x90909090[eax]
+ pand   mm2, 0x90909090[eax]
+ paddusb mm2, 0x90909090[eax]
+ paddusw mm2, 0x90909090[eax]
+ pandn  mm2, 0x90909090[eax]
+ psraw  mm2, 0x90909090[eax]
+ psrad  mm2, 0x90909090[eax]
+ pmulhw mm2, 0x90909090[eax]
+ psubsb mm2, 0x90909090[eax]
+ psubsw mm2, 0x90909090[eax]
+ por    mm2, 0x90909090[eax]
+ paddsb mm2, 0x90909090[eax]
+ paddsw mm2, 0x90909090[eax]
+ pxor   mm2, 0x90909090[eax]
+ psllw  mm2, 0x90909090[eax]
+ pslld  mm2, 0x90909090[eax]
+ psllq  mm2, 0x90909090[eax]
+ pmaddwd mm2, 0x90909090[eax]
+ psubb  mm2, 0x90909090[eax]
+ psubw  mm2, 0x90909090[eax]
+ psubd  mm2, 0x90909090[eax]
+ paddb  mm2, 0x90909090[eax]
+ paddw  mm2, 0x90909090[eax]
+ paddd  mm2, 0x90909090[eax]
+ add    0x90909090[eax], dx
+ add    dx, 0x90909090[eax]
+ add    ax, 0x9090
+ pushw  es
+ popw   es
+ or     0x90909090[eax], dx
+ or     dx, 0x90909090[eax]
+ or     ax, 0x9090
+ pushw  cs
+ adc    0x90909090[eax], dx
+ adc    dx, 0x90909090[eax]
+ adc    ax, 0x9090
+ pushw  ss
+ popw   ss
+ sbb    0x90909090[eax], dx
+ sbb    dx, 0x90909090[eax]
+ sbb    ax, 0x9090
+ pushw  ds
+ popw   ds
+ and    0x90909090[eax], dx
+ and    dx, 0x90909090[eax]
+ and    ax, 0x9090
+ sub    0x90909090[eax], dx
+ sub    dx, 0x90909090[eax]
+ sub    ax, 0x9090
+ xor    0x90909090[eax], dx
+ xor    dx, 0x90909090[eax]
+ xor    ax, 0x9090
+ cmp    0x90909090[eax], dx
+ cmp    dx, 0x90909090[eax]
+ cmp    ax, 0x9090
+ inc    ax
+ inc    cx
+ inc    dx
+ inc    bx
+ inc    sp
+ inc    bp
+ inc    si
+ inc    di
+ dec    ax
+ dec    cx
+ dec    dx
+ dec    bx
+ dec    sp
+ dec    bp
+ dec    si
+ dec    di
+ push   ax
+ push   cx
+ push   dx
+ push   bx
+ push   sp
+ push   bp
+ push   si
+ push   di
+ pop    ax
+ pop    cx
+ pop    dx
+ pop    bx
+ pop    sp
+ pop    bp
+ pop    si
+ pop    di
+ pushaw			# how should we specify a word push all regs?
+ popaw			# ditto for popa
+ bound  dx, 0x90909090[eax]
+ pushw  0x9090
+ imul   dx, 0x90909090[eax], 0x9090
+ pushw  0xffffff90
+ imul   dx, 0x90909090[eax], 0xffffff90
+ ins    word ptr es:[edi], dx
+ outs   dx, word ptr ds:[esi]
+ adc    word ptr 0x90909090[eax], 0x9090
+ adc    word ptr 0x90909090[eax], 0xffffff90
+ test   0x90909090[eax], dx
+ xchg   0x90909090[eax], dx
+ mov    0x90909090[eax], dx
+ mov    dx, 0x90909090[eax]
+ mov    word ptr 0x90909090[eax], ss
+ lea    dx, 0x90909090[eax]
+ pop    word ptr 0x90909090[eax]
+ xchg   cx, ax
+ xchg   dx, ax
+ xchg   bx, ax
+ xchg   sp, ax
+ xchg   bp, ax
+ xchg   si, ax
+ xchg   di, ax
+ cbtw
+ cwtd
+ callw  0x9090,0x9090
+ pushfw
+ popfw
+ mov    ax, [0x90909090]
+ mov    [0x90909090], ax
+ movs   word ptr es:[edi], word ptr ds:[esi]
+ cmps   word ptr ds:[esi], word ptr es:[edi]
+ test   ax, 0x9090
+ stos   word ptr es:[edi], ax
+ lods   ax, word ptr ds:[esi]
+ scas   ax, word ptr es:[edi]
+ mov    ax, 0x9090
+ mov    cx, 0x9090
+ mov    dx, 0x9090
+ mov    bx, 0x9090
+ mov    sp, 0x9090
+ mov    bp, 0x9090
+ mov    si, 0x9090
+ mov    di, 0x9090
+ rcl    word ptr 0x90909090[eax], 0x90
+ retw   0x9090
+ retw
+ les    dx, 0x90909090[eax]
+ lds    dx, 0x90909090[eax]
+ mov    word ptr 0x90909090[eax], 0x9090
+ enterw 0x9090, 0x90
+ leavew
+ lretw  0x9090
+ lretw
+ iretw
+ rcl    word ptr 0x90909090[eax]
+ rcl    word ptr 0x90909090[eax], cl
+ in     ax, 0x90
+ out    0x90, ax
+ call   word ptr .+3+0x9090
+ jmpw   0x9090,0x9090
+ in     ax, dx
+ out    dx, ax
+ not    word ptr 0x90909090[eax]
+ call   word ptr 0x90909090[eax]
+ lar    dx, 0x90909090[eax]
+ lsl    dx, 0x90909090[eax]
+ cmovo  dx, 0x90909090[eax]
+ cmovno dx, 0x90909090[eax]
+ cmovb  dx, 0x90909090[eax]
+ cmovae dx, 0x90909090[eax]
+ cmove  dx, 0x90909090[eax]
+ cmovne dx, 0x90909090[eax]
+ cmovbe dx, 0x90909090[eax]
+ cmova  dx, 0x90909090[eax]
+ cmovs  dx, 0x90909090[eax]
+ cmovns dx, 0x90909090[eax]
+ cmovp  dx, 0x90909090[eax]
+ cmovnp dx, 0x90909090[eax]
+ cmovl  dx, 0x90909090[eax]
+ cmovge dx, 0x90909090[eax]
+ cmovle dx, 0x90909090[eax]
+ cmovg  dx, 0x90909090[eax]
+ pushw  fs
+ popw   fs
+ bt     0x90909090[eax], dx
+ shld   0x90909090[eax], dx, 0x90
+ shld   0x90909090[eax], dx, cl
+ pushw  gs
+ popw   gs
+ bts    0x90909090[eax], dx
+ shrd   0x90909090[eax], dx, 0x90
+ shrd   0x90909090[eax], dx, cl
+ imul   dx, 0x90909090[eax]
+ cmpxchg 0x90909090[eax], dx
+ lss    dx, 0x90909090[eax]
+ btr    0x90909090[eax], dx
+ lfs    dx, 0x90909090[eax]
+ lgs    dx, 0x90909090[eax]
+ movzx  dx, byte ptr 0x90909090[eax]
+ btc    0x90909090[eax], dx
+ bsf    dx, 0x90909090[eax]
+ bsr    dx, 0x90909090[eax]
+ movsx  dx, byte ptr 0x90909090[eax]
+ xadd   0x90909090[eax], dx
diff --git a/gas/testsuite/gas/i386/jump.d b/gas/testsuite/gas/i386/jump.d
new file mode 100644
index 0000000..5e9fe4b
--- /dev/null
+++ b/gas/testsuite/gas/i386/jump.d
@@ -0,0 +1,26 @@
+#name: i386 jump
+#objdump: -drw
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+000 <.text>:
+   0:	eb fe [ 	]*jmp    (0x0|0 <.text>)
+   2:	e9 (fc|f9) ff ff ff [ 	]*jmp    (0x3|0x0|0 <.text>)	3: (R_386_PC)?(DISP)?32	xxx
+   7:	ff 25 00 00 00 00 [ 	]*jmp    \*0x0	9: (R_386_)?(dir)?32	xxx
+   d:	ff e7 [ 	]*jmp    \*%edi
+   f:	ff 27 [ 	]*jmp    \*\(%edi\)
+  11:	ff 2c bd 00 00 00 00 [ 	]*ljmp   \*0x0\(,%edi,4\)	14: (R_386_)?(dir)?32	xxx
+  18:	ff 2d 00 00 00 00 [ 	]*ljmp   \*0x0	1a: (R_386_)?(dir)?32	xxx
+  1e:	ea 00 00 00 00 34 12 [ 	]*ljmp   \$0x1234,\$0x0	1f: (R_386_)?(dir)?32	xxx
+  25:	e8 d6 ff ff ff [ 	]*call   (0x0|0 <.text>)
+  2a:	e8 (fc|d1) ff ff ff [ 	]*call   (0x2b|0x0|0 <.text>)	2b: (R_386_PC)?(DISP)?32	xxx
+  2f:	ff 15 00 00 00 00 [ 	]*call   \*0x0	31: (R_386_)?(dir)?32	xxx
+  35:	ff d7 [ 	]*call   \*%edi
+  37:	ff 17 [ 	]*call   \*\(%edi\)
+  39:	ff 1c bd 00 00 00 00 [ 	]*lcall  \*0x0\(,%edi,4\)	3c: (R_386_)?(dir)?32	xxx
+  40:	ff 1d 00 00 00 00 [ 	]*lcall  \*0x0	42: (R_386_)?(dir)?32	xxx
+  46:	9a 00 00 00 00 34 12 [ 	]*lcall  \$0x1234,\$0x0	47: (R_386_)?(dir)?32	xxx
+  4d:.*
+.*
diff --git a/gas/testsuite/gas/i386/jump.s b/gas/testsuite/gas/i386/jump.s
new file mode 100644
index 0000000..1f11cd3
--- /dev/null
+++ b/gas/testsuite/gas/i386/jump.s
@@ -0,0 +1,24 @@
+.psize 0
+.text
+.extern xxx
+
+1:	jmp	1b
+	jmp	xxx
+	jmp	*xxx
+	jmp	*%edi
+	jmp	*(%edi)
+	ljmp	*xxx(,%edi,4)
+	ljmp	*xxx
+	ljmp	$0x1234,$xxx
+
+	call	1b
+	call	xxx
+	call	*xxx
+	call	*%edi
+	call	*(%edi)
+	lcall	*xxx(,%edi,4)
+	lcall	*xxx
+	lcall	$0x1234,$xxx
+
+	# Force a good alignment.
+	.p2align	4,0
diff --git a/gas/testsuite/gas/i386/jump16.d b/gas/testsuite/gas/i386/jump16.d
new file mode 100644
index 0000000..3d5d6bb
--- /dev/null
+++ b/gas/testsuite/gas/i386/jump16.d
@@ -0,0 +1,40 @@
+#name: i386 jump16
+#objdump: -drw -mi8086
+
+.*:     file format .*i386.*
+
+Disassembly of section .text:
+
+0+000 <.text>:
+   0:	eb fe [ 	]*jmp    (0x0|0 <.text>)
+   2:	e9 (fe|fb) ff [ 	]*jmp    (0x3|0x0|0 <.text>)	3: (R_386_PC)?(DISP)?16	xxx
+   5:	ff 26 00 00 [ 	]*jmp    \*0	7: (R_386_)?(dir)?16	xxx
+   9:	66 ff e7 [ 	]*jmpl   \*%edi
+   c:	67 ff 27 [ 	]*addr32 jmp \*\(%edi\)
+   f:	67 ff af 00 00 00 00 [ 	]*addr32 ljmp \*0x0\(%edi\)	12: (R_386_)?(dir)?32	xxx
+  16:	ff 2e 00 00 [ 	]*ljmp   \*0	18: (R_386_)?(dir)?16	xxx
+  1a:	ea 00 00 34 12 [ 	]*ljmp   \$0x1234,\$0x0	1b: (R_386_)?(dir)?16	xxx
+  1f:	66 e8 db ff ff ff [ 	]*calll  (0x0|0 <.text>)
+  25:	66 e8 (fc|d5) ff ff ff [ 	]*calll  (0x27|0x0|0 <.text>)	27: (R_386_PC)?(DISP)?32	xxx
+  2b:	66 ff 16 00 00 [ 	]*calll  \*0	2e: (R_386_)?(dir)?16	xxx
+  30:	66 ff d7 [ 	]*calll  \*%edi
+  33:	67 66 ff 17 [ 	]*addr32 calll \*\(%edi\)
+  37:	67 66 ff 9f 00 00 00 00 [ 	]*addr32 lcalll \*0x0\(%edi\)	3b: (R_386_)?(dir)?32	xxx
+  3f:	66 ff 1e 00 00 [ 	]*lcalll \*0	42: (R_386_)?(dir)?16	xxx
+  44:	66 9a 00 00 00 00 34 12 [ 	]*lcalll \$0x1234,\$0x0	46: (R_386_)?(dir)?32	xxx
+  4c:	eb b2 [ 	]*jmp    (0x0|0 <.text>)
+  4e:	ff 26 00 00 [ 	]*jmp    \*0	50: (R_386_)?(dir)?16	xxx
+  52:	ff e7 [ 	]*jmp    \*%di
+  54:	ff 25 [ 	]*jmp    \*\(%di\)
+  56:	ff ad 00 00 [ 	]*ljmp   \*0\(%di\)	58: (R_386_)?(dir)?16	xxx
+  5a:	ff 2e 00 00 [ 	]*ljmp   \*0	5c: (R_386_)?(dir)?16	xxx
+  5e:	ea 00 00 34 12 [ 	]*ljmp   \$0x1234,\$0x0	5f: (R_386_)?(dir)?16	xxx
+  63:	e8 9a ff [ 	]*call   (0x0|0 <.text>)
+  66:	e8 (fe|97) ff [ 	]*call   (0x67|0x0|0 <.text>)	67: (R_386_PC)?(DISP)?16	xxx
+  69:	ff 16 00 00 [ 	]*call   \*0	6b: (R_386_)?(dir)?16	xxx
+  6d:	ff d7 [ 	]*call   \*%di
+  6f:	ff 15 [ 	]*call   \*\(%di\)
+  71:	ff 9d 00 00 [ 	]*lcall  \*0\(%di\)	73: (R_386_)?(dir)?16	xxx
+  75:	ff 1e 00 00 [ 	]*lcall  \*0	77: (R_386_)?(dir)?16	xxx
+  79:	9a 00 00 34 12 [ 	]*lcall  \$0x1234,\$0x0	7a: (R_386_)?(dir)?16	xxx
+	...
diff --git a/gas/testsuite/gas/i386/jump16.s b/gas/testsuite/gas/i386/jump16.s
new file mode 100644
index 0000000..1eee242
--- /dev/null
+++ b/gas/testsuite/gas/i386/jump16.s
@@ -0,0 +1,43 @@
+.psize 0
+.text
+.extern xxx
+
+.code16gcc
+1:	jmp	1b
+	jmp	xxx
+	jmp	*xxx
+	jmp	*%edi
+	jmp	*(%edi)
+	ljmp	*xxx(%edi)
+	ljmp	*xxx
+	ljmp	$0x1234,$xxx
+
+	call	1b
+	call	xxx
+	call	*xxx
+	call	*%edi
+	call	*(%edi)
+	lcall	*xxx(%edi)
+	lcall	*xxx
+	lcall	$0x1234,$xxx
+
+.code16
+	jmp	1b
+	jmp	*xxx
+	jmp	*%di
+	jmp	*(%di)
+	ljmp	*xxx(%di)
+	ljmp	*xxx
+	ljmp	$0x1234,$xxx
+
+	call	1b
+	call	xxx
+	call	*xxx
+	call	*%di
+	call	*(%di)
+	lcall	*xxx(%di)
+	lcall	*xxx
+	lcall	$0x1234,$xxx
+
+	# Force a good alignment.
+	.p2align	4,0
diff --git a/gas/testsuite/gas/i386/katmai.d b/gas/testsuite/gas/i386/katmai.d
new file mode 100644
index 0000000..7d08581
--- /dev/null
+++ b/gas/testsuite/gas/i386/katmai.d
@@ -0,0 +1,172 @@
+#objdump: -dw
+#name: i386 katmai
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+   0:	0f 58 01 [ 	]*addps  \(%ecx\),%xmm0
+   3:	0f 58 ca [ 	]*addps  %xmm2,%xmm1
+   6:	f3 0f 58 13 [ 	]*addss  \(%ebx\),%xmm2
+   a:	f3 0f 58 dc [ 	]*addss  %xmm4,%xmm3
+   e:	0f 55 65 00 [ 	]*andnps 0x0\(%ebp\),%xmm4
+  12:	0f 55 ee [ 	]*andnps %xmm6,%xmm5
+  15:	0f 54 37 [ 	]*andps  \(%edi\),%xmm6
+  18:	0f 54 f8 [ 	]*andps  %xmm0,%xmm7
+  1b:	0f c2 c1 02 [ 	]*cmpleps %xmm1,%xmm0
+  1f:	0f c2 0a 03 [ 	]*cmpunordps \(%edx\),%xmm1
+  23:	f3 0f c2 d2 04 [ 	]*cmpneqss %xmm2,%xmm2
+  28:	f3 0f c2 1c 24 05 [ 	]*cmpnltss \(%esp,1\),%xmm3
+  2e:	0f c2 e5 06 [ 	]*cmpnleps %xmm5,%xmm4
+  32:	0f c2 2e 07 [ 	]*cmpordps \(%esi\),%xmm5
+  36:	f3 0f c2 f7 00 [ 	]*cmpeqss %xmm7,%xmm6
+  3b:	f3 0f c2 38 01 [ 	]*cmpltss \(%eax\),%xmm7
+  40:	0f c2 c1 00 [ 	]*cmpeqps %xmm1,%xmm0
+  44:	0f c2 0a 00 [ 	]*cmpeqps \(%edx\),%xmm1
+  48:	f3 0f c2 d2 00 [ 	]*cmpeqss %xmm2,%xmm2
+  4d:	f3 0f c2 1c 24 00 [ 	]*cmpeqss \(%esp,1\),%xmm3
+  53:	0f c2 e5 01 [ 	]*cmpltps %xmm5,%xmm4
+  57:	0f c2 2e 01 [ 	]*cmpltps \(%esi\),%xmm5
+  5b:	f3 0f c2 f7 01 [ 	]*cmpltss %xmm7,%xmm6
+  60:	f3 0f c2 38 01 [ 	]*cmpltss \(%eax\),%xmm7
+  65:	0f c2 01 02 [ 	]*cmpleps \(%ecx\),%xmm0
+  69:	0f c2 ca 02 [ 	]*cmpleps %xmm2,%xmm1
+  6d:	f3 0f c2 13 02 [ 	]*cmpless \(%ebx\),%xmm2
+  72:	f3 0f c2 dc 02 [ 	]*cmpless %xmm4,%xmm3
+  77:	0f c2 65 00 03 [ 	]*cmpunordps 0x0\(%ebp\),%xmm4
+  7c:	0f c2 ee 03 [ 	]*cmpunordps %xmm6,%xmm5
+  80:	f3 0f c2 37 03 [ 	]*cmpunordss \(%edi\),%xmm6
+  85:	f3 0f c2 f8 03 [ 	]*cmpunordss %xmm0,%xmm7
+  8a:	0f c2 c1 04 [ 	]*cmpneqps %xmm1,%xmm0
+  8e:	0f c2 0a 04 [ 	]*cmpneqps \(%edx\),%xmm1
+  92:	f3 0f c2 d2 04 [ 	]*cmpneqss %xmm2,%xmm2
+  97:	f3 0f c2 1c 24 04 [ 	]*cmpneqss \(%esp,1\),%xmm3
+  9d:	0f c2 e5 05 [ 	]*cmpnltps %xmm5,%xmm4
+  a1:	0f c2 2e 05 [ 	]*cmpnltps \(%esi\),%xmm5
+  a5:	f3 0f c2 f7 05 [ 	]*cmpnltss %xmm7,%xmm6
+  aa:	f3 0f c2 38 05 [ 	]*cmpnltss \(%eax\),%xmm7
+  af:	0f c2 01 06 [ 	]*cmpnleps \(%ecx\),%xmm0
+  b3:	0f c2 ca 06 [ 	]*cmpnleps %xmm2,%xmm1
+  b7:	f3 0f c2 13 06 [ 	]*cmpnless \(%ebx\),%xmm2
+  bc:	f3 0f c2 dc 06 [ 	]*cmpnless %xmm4,%xmm3
+  c1:	0f c2 65 00 07 [ 	]*cmpordps 0x0\(%ebp\),%xmm4
+  c6:	0f c2 ee 07 [ 	]*cmpordps %xmm6,%xmm5
+  ca:	f3 0f c2 37 07 [ 	]*cmpordss \(%edi\),%xmm6
+  cf:	f3 0f c2 f8 07 [ 	]*cmpordss %xmm0,%xmm7
+  d4:	0f 2f c1 [ 	]*comiss %xmm1,%xmm0
+  d7:	0f 2f 0a [ 	]*comiss \(%edx\),%xmm1
+  da:	0f 2a d3 [ 	]*cvtpi2ps %mm3,%xmm2
+  dd:	0f 2a 1c 24 [ 	]*cvtpi2ps \(%esp,1\),%xmm3
+  e1:	f3 0f 2a e5 [ 	]*cvtsi2ss %ebp,%xmm4
+  e5:	f3 0f 2a 2e [ 	]*cvtsi2ss \(%esi\),%xmm5
+  e9:	0f 2d f7 [ 	]*cvtps2pi %xmm7,%mm6
+  ec:	0f 2d 38 [ 	]*cvtps2pi \(%eax\),%mm7
+  ef:	f3 0f 2d 01 [ 	]*cvtss2si \(%ecx\),%eax
+  f3:	f3 0f 2d ca [ 	]*cvtss2si %xmm2,%ecx
+  f7:	0f 2c 13 [ 	]*cvttps2pi \(%ebx\),%mm2
+  fa:	0f 2c dc [ 	]*cvttps2pi %xmm4,%mm3
+  fd:	f3 0f 2c 65 00 [ 	]*cvttss2si 0x0\(%ebp\),%esp
+ 102:	f3 0f 2c ee [ 	]*cvttss2si %xmm6,%ebp
+ 106:	0f 5e c1 [ 	]*divps  %xmm1,%xmm0
+ 109:	0f 5e 0a [ 	]*divps  \(%edx\),%xmm1
+ 10c:	f3 0f 5e d3 [ 	]*divss  %xmm3,%xmm2
+ 110:	f3 0f 5e 1c 24 [ 	]*divss  \(%esp,1\),%xmm3
+ 115:	0f ae 55 00 [ 	]*ldmxcsr 0x0\(%ebp\)
+ 119:	0f ae 1e [ 	]*stmxcsr \(%esi\)
+ 11c:	0f ae f8 [ 	]*sfence 
+ 11f:	0f 5f c1 [ 	]*maxps  %xmm1,%xmm0
+ 122:	0f 5f 0a [ 	]*maxps  \(%edx\),%xmm1
+ 125:	f3 0f 5f d3 [ 	]*maxss  %xmm3,%xmm2
+ 129:	f3 0f 5f 1c 24 [ 	]*maxss  \(%esp,1\),%xmm3
+ 12e:	0f 5d e5 [ 	]*minps  %xmm5,%xmm4
+ 131:	0f 5d 2e [ 	]*minps  \(%esi\),%xmm5
+ 134:	f3 0f 5d f7 [ 	]*minss  %xmm7,%xmm6
+ 138:	f3 0f 5d 38 [ 	]*minss  \(%eax\),%xmm7
+ 13c:	0f 28 c1 [ 	]*movaps %xmm1,%xmm0
+ 13f:	0f 29 11 [ 	]*movaps %xmm2,\(%ecx\)
+ 142:	0f 28 12 [ 	]*movaps \(%edx\),%xmm2
+ 145:	0f 16 dc [ 	]*movlhps %xmm4,%xmm3
+ 148:	0f 17 2c 24 [ 	]*movhps %xmm5,\(%esp,1\)
+ 14c:	0f 16 2e [ 	]*movhps \(%esi\),%xmm5
+ 14f:	0f 12 f7 [ 	]*movhlps %xmm7,%xmm6
+ 152:	0f 13 07 [ 	]*movlps %xmm0,\(%edi\)
+ 155:	0f 12 00 [ 	]*movlps \(%eax\),%xmm0
+ 158:	0f 50 ca [ 	]*movmskps %xmm2,%ecx
+ 15b:	0f 10 d3 [ 	]*movups %xmm3,%xmm2
+ 15e:	0f 11 22 [ 	]*movups %xmm4,\(%edx\)
+ 161:	0f 10 65 00 [ 	]*movups 0x0\(%ebp\),%xmm4
+ 165:	f3 0f 10 ee [ 	]*movss  %xmm6,%xmm5
+ 169:	f3 0f 11 3e [ 	]*movss  %xmm7,\(%esi\)
+ 16d:	f3 0f 10 38 [ 	]*movss  \(%eax\),%xmm7
+ 171:	0f 59 c1 [ 	]*mulps  %xmm1,%xmm0
+ 174:	0f 59 0a [ 	]*mulps  \(%edx\),%xmm1
+ 177:	f3 0f 59 d2 [ 	]*mulss  %xmm2,%xmm2
+ 17b:	f3 0f 59 1c 24 [ 	]*mulss  \(%esp,1\),%xmm3
+ 180:	0f 56 e5 [ 	]*orps   %xmm5,%xmm4
+ 183:	0f 56 2e [ 	]*orps   \(%esi\),%xmm5
+ 186:	0f 53 f7 [ 	]*rcpps  %xmm7,%xmm6
+ 189:	0f 53 38 [ 	]*rcpps  \(%eax\),%xmm7
+ 18c:	f3 0f 53 01 [ 	]*rcpss  \(%ecx\),%xmm0
+ 190:	f3 0f 53 ca [ 	]*rcpss  %xmm2,%xmm1
+ 194:	0f 52 13 [ 	]*rsqrtps \(%ebx\),%xmm2
+ 197:	0f 52 dc [ 	]*rsqrtps %xmm4,%xmm3
+ 19a:	f3 0f 52 65 00 [ 	]*rsqrtss 0x0\(%ebp\),%xmm4
+ 19f:	f3 0f 52 ee [ 	]*rsqrtss %xmm6,%xmm5
+ 1a3:	0f c6 37 02 [ 	]*shufps \$0x2,\(%edi\),%xmm6
+ 1a7:	0f c6 f8 03 [ 	]*shufps \$0x3,%xmm0,%xmm7
+ 1ab:	0f 51 c1 [ 	]*sqrtps %xmm1,%xmm0
+ 1ae:	0f 51 0a [ 	]*sqrtps \(%edx\),%xmm1
+ 1b1:	f3 0f 51 d2 [ 	]*sqrtss %xmm2,%xmm2
+ 1b5:	f3 0f 51 1c 24 [ 	]*sqrtss \(%esp,1\),%xmm3
+ 1ba:	0f 5c e5 [ 	]*subps  %xmm5,%xmm4
+ 1bd:	0f 5c 2e [ 	]*subps  \(%esi\),%xmm5
+ 1c0:	f3 0f 5c f7 [ 	]*subss  %xmm7,%xmm6
+ 1c4:	f3 0f 5c 38 [ 	]*subss  \(%eax\),%xmm7
+ 1c8:	0f 2e 01 [ 	]*ucomiss \(%ecx\),%xmm0
+ 1cb:	0f 2e ca [ 	]*ucomiss %xmm2,%xmm1
+ 1ce:	0f 15 13 [ 	]*unpckhps \(%ebx\),%xmm2
+ 1d1:	0f 15 dc [ 	]*unpckhps %xmm4,%xmm3
+ 1d4:	0f 14 65 00 [ 	]*unpcklps 0x0\(%ebp\),%xmm4
+ 1d8:	0f 14 ee [ 	]*unpcklps %xmm6,%xmm5
+ 1db:	0f 57 37 [ 	]*xorps  \(%edi\),%xmm6
+ 1de:	0f 57 f8 [ 	]*xorps  %xmm0,%xmm7
+ 1e1:	0f e0 c1 [ 	]*pavgb  %mm1,%mm0
+ 1e4:	0f e0 0a [ 	]*pavgb  \(%edx\),%mm1
+ 1e7:	0f e3 d3 [ 	]*pavgw  %mm3,%mm2
+ 1ea:	0f e3 1c 24 [ 	]*pavgw  \(%esp,1\),%mm3
+ 1ee:	0f c5 c8 00 [ 	]*pextrw \$0x0,%mm1,%eax
+ 1f2:	0f c4 09 01 [ 	]*pinsrw \$0x1,\(%ecx\),%mm1
+ 1f6:	0f c4 d2 02 [ 	]*pinsrw \$0x2,%edx,%mm2
+ 1fa:	0f ee c1 [ 	]*pmaxsw %mm1,%mm0
+ 1fd:	0f ee 0a [ 	]*pmaxsw \(%edx\),%mm1
+ 200:	0f de d2 [ 	]*pmaxub %mm2,%mm2
+ 203:	0f de 1c 24 [ 	]*pmaxub \(%esp,1\),%mm3
+ 207:	0f ea e5 [ 	]*pminsw %mm5,%mm4
+ 20a:	0f ea 2e [ 	]*pminsw \(%esi\),%mm5
+ 20d:	0f da f7 [ 	]*pminub %mm7,%mm6
+ 210:	0f da 38 [ 	]*pminub \(%eax\),%mm7
+ 213:	0f d7 e8 [ 	]*pmovmskb %mm5,%eax
+ 216:	0f e4 e5 [ 	]*pmulhuw %mm5,%mm4
+ 219:	0f e4 2e [ 	]*pmulhuw \(%esi\),%mm5
+ 21c:	0f f6 f7 [ 	]*psadbw %mm7,%mm6
+ 21f:	0f f6 38 [ 	]*psadbw \(%eax\),%mm7
+ 222:	0f 70 da 01 [ 	]*pshufw \$0x1,%mm2,%mm3
+ 226:	0f 70 75 00 04 [ 	]*pshufw \$0x4,0x0\(%ebp\),%mm6
+ 22b:	0f f7 c7 [ 	]*maskmovq %mm7,%mm0
+ 22e:	0f 2b 33 [ 	]*movntps %xmm6,\(%ebx\)
+ 231:	0f e7 10 [ 	]*movntq %mm2,\(%eax\)
+ 234:	0f 18 06 [ 	]*prefetchnta \(%esi\)
+ 237:	0f 18 0c 98 [ 	]*prefetcht0 \(%eax,%ebx,4\)
+ 23b:	0f 18 12 [ 	]*prefetcht1 \(%edx\)
+ 23e:	0f 18 19 [ 	]*prefetcht2 \(%ecx\)
+ 241:	2e 0f [ 	]*\(bad\)  
+ 243:	c2 0a 08 [ 	]*ret    \$0x80a
+ 246:	90 [ 	]*nop    
+ 247:	90 [ 	]*nop    
+ 248:	65 [ 	]*gs
+ 249:	0f [ 	]*sfence.*\(bad\).*
+ 24a:	ae [ 	]*scas   %es:\(%edi\),%al
+ 24b:	ff 00 [ 	]*incl   \(%eax\)
+ 24d:	00 00 [ 	]*add    %al,\(%eax\)
+	...
diff --git a/gas/testsuite/gas/i386/katmai.s b/gas/testsuite/gas/i386/katmai.s
new file mode 100644
index 0000000..534d15d
--- /dev/null
+++ b/gas/testsuite/gas/i386/katmai.s
@@ -0,0 +1,167 @@
+#PIII SIMD instructions
+
+.text
+foo:
+ addps		(%ecx),%xmm0
+ addps		%xmm2,%xmm1
+ addss		(%ebx),%xmm2
+ addss		%xmm4,%xmm3
+ andnps		0x0(%ebp),%xmm4
+ andnps		%xmm6,%xmm5
+ andps		(%edi),%xmm6
+ andps		%xmm0,%xmm7
+ cmpps		$0x2,%xmm1,%xmm0
+ cmpps		$0x3,(%edx),%xmm1
+ cmpss		$0x4,%xmm2,%xmm2
+ cmpss		$0x5,(%esp,1),%xmm3
+ cmpps		$0x6,%xmm5,%xmm4
+ cmpps		$0x7,(%esi),%xmm5
+ cmpss		$0x0,%xmm7,%xmm6
+ cmpss		$0x1,(%eax),%xmm7
+ cmpeqps	%xmm1,%xmm0
+ cmpeqps	(%edx),%xmm1
+ cmpeqss	%xmm2,%xmm2
+ cmpeqss	(%esp,1),%xmm3
+ cmpltps	%xmm5,%xmm4
+ cmpltps	(%esi),%xmm5
+ cmpltss	%xmm7,%xmm6
+ cmpltss	(%eax),%xmm7
+ cmpleps	(%ecx),%xmm0
+ cmpleps	%xmm2,%xmm1
+ cmpless	(%ebx),%xmm2
+ cmpless	%xmm4,%xmm3
+ cmpunordps	0x0(%ebp),%xmm4
+ cmpunordps	%xmm6,%xmm5
+ cmpunordss	(%edi),%xmm6
+ cmpunordss	%xmm0,%xmm7
+ cmpneqps	%xmm1,%xmm0
+ cmpneqps	(%edx),%xmm1
+ cmpneqss	%xmm2,%xmm2
+ cmpneqss	(%esp,1),%xmm3
+ cmpnltps	%xmm5,%xmm4
+ cmpnltps	(%esi),%xmm5
+ cmpnltss	%xmm7,%xmm6
+ cmpnltss	(%eax),%xmm7
+ cmpnleps	(%ecx),%xmm0
+ cmpnleps	%xmm2,%xmm1
+ cmpnless	(%ebx),%xmm2
+ cmpnless	%xmm4,%xmm3
+ cmpordps	0x0(%ebp),%xmm4
+ cmpordps	%xmm6,%xmm5
+ cmpordss	(%edi),%xmm6
+ cmpordss	%xmm0,%xmm7
+ comiss		%xmm1,%xmm0
+ comiss		(%edx),%xmm1
+ cvtpi2ps	%mm3,%xmm2
+ cvtpi2ps	(%esp,1),%xmm3
+ cvtsi2ss	%ebp,%xmm4
+ cvtsi2ss	(%esi),%xmm5
+ cvtps2pi	%xmm7,%mm6
+ cvtps2pi	(%eax),%mm7
+ cvtss2si	(%ecx),%eax
+ cvtss2si	%xmm2,%ecx
+ cvttps2pi	(%ebx),%mm2
+ cvttps2pi	%xmm4,%mm3
+ cvttss2si	0x0(%ebp),%esp
+ cvttss2si	%xmm6,%ebp
+ divps		%xmm1,%xmm0
+ divps		(%edx),%xmm1
+ divss		%xmm3,%xmm2
+ divss		(%esp,1),%xmm3
+ ldmxcsr	0x0(%ebp)
+ stmxcsr	(%esi)
+ sfence
+ maxps		%xmm1,%xmm0
+ maxps		(%edx),%xmm1
+ maxss		%xmm3,%xmm2
+ maxss		(%esp,1),%xmm3
+ minps		%xmm5,%xmm4
+ minps		(%esi),%xmm5
+ minss		%xmm7,%xmm6
+ minss		(%eax),%xmm7
+ movaps		%xmm1,%xmm0
+ movaps		%xmm2,(%ecx)
+ movaps		(%edx),%xmm2
+ movlhps	%xmm4,%xmm3
+ movhps		%xmm5,(%esp,1)
+ movhps		(%esi),%xmm5
+ movhlps	%xmm7,%xmm6
+ movlps		%xmm0,(%edi)
+ movlps		(%eax),%xmm0
+ movmskps	%xmm2,%ecx
+ movups		%xmm3,%xmm2
+ movups		%xmm4,(%edx)
+ movups		0x0(%ebp),%xmm4
+ movss		%xmm6,%xmm5
+ movss		%xmm7,(%esi)
+ movss		(%eax),%xmm7
+ mulps		%xmm1,%xmm0
+ mulps		(%edx),%xmm1
+ mulss		%xmm2,%xmm2
+ mulss		(%esp,1),%xmm3
+ orps		%xmm5,%xmm4
+ orps		(%esi),%xmm5
+ rcpps		%xmm7,%xmm6
+ rcpps		(%eax),%xmm7
+ rcpss		(%ecx),%xmm0
+ rcpss		%xmm2,%xmm1
+ rsqrtps	(%ebx),%xmm2
+ rsqrtps	%xmm4,%xmm3
+ rsqrtss	0x0(%ebp),%xmm4
+ rsqrtss	%xmm6,%xmm5
+ shufps		$0x2,(%edi),%xmm6
+ shufps		$0x3,%xmm0,%xmm7
+ sqrtps		%xmm1,%xmm0
+ sqrtps		(%edx),%xmm1
+ sqrtss		%xmm2,%xmm2
+ sqrtss		(%esp,1),%xmm3
+ subps		%xmm5,%xmm4
+ subps		(%esi),%xmm5
+ subss		%xmm7,%xmm6
+ subss		(%eax),%xmm7
+ ucomiss	(%ecx),%xmm0
+ ucomiss	%xmm2,%xmm1
+ unpckhps	(%ebx),%xmm2
+ unpckhps	%xmm4,%xmm3
+ unpcklps	0x0(%ebp),%xmm4
+ unpcklps	%xmm6,%xmm5
+ xorps		(%edi),%xmm6
+ xorps		%xmm0,%xmm7
+ pavgb		%mm1,%mm0
+ pavgb		(%edx),%mm1
+ pavgw		%mm3,%mm2
+ pavgw		(%esp,1),%mm3
+ pextrw		$0x0,%mm1,%eax
+ pinsrw		$0x1,(%ecx),%mm1
+ pinsrw		$0x2,%edx,%mm2
+ pmaxsw		%mm1,%mm0
+ pmaxsw		(%edx),%mm1
+ pmaxub		%mm2,%mm2
+ pmaxub		(%esp,1),%mm3
+ pminsw		%mm5,%mm4
+ pminsw		(%esi),%mm5
+ pminub		%mm7,%mm6
+ pminub		(%eax),%mm7
+ pmovmskb	%mm5,%eax
+ pmulhuw	%mm5,%mm4
+ pmulhuw	(%esi),%mm5
+ psadbw		%mm7,%mm6
+ psadbw		(%eax),%mm7
+ pshufw		$0x1,%mm2,%mm3
+ pshufw		$0x4,0x0(%ebp),%mm6
+ maskmovq	%mm7,%mm0
+ movntps	%xmm6,(%ebx)
+ movntq		%mm2,(%eax)
+ prefetchnta	(%esi)
+ prefetcht0	(%eax,%ebx,4)
+ prefetcht1	(%edx)
+ prefetcht2	(%ecx)
+
+# A SIMD instruction with a bad extension byte
+.byte 0x2E,0x0F,0xC2,0x0A,0x08
+ nop
+ nop
+# A bad sfence modrm byte
+.byte 0x65,0x0F,0xAE,0xff
+# Pad out to good alignment
+ .p2align 4,0
diff --git a/gas/testsuite/gas/i386/modrm.l b/gas/testsuite/gas/i386/modrm.l
index 8a1bc79..3e3b096 100644
--- a/gas/testsuite/gas/i386/modrm.l
+++ b/gas/testsuite/gas/i386/modrm.l
@@ -1981,4 +1981,4 @@
 .*Warning:.*
  1669 [ 	]*
  1670 [ 	]*     		# Force a good alignment.
- 1671 217b 00 [ 	]*	.byte	0
+ 1671 217b 00000000 00[ 	]*.p2align	4,0
diff --git a/gas/testsuite/gas/i386/modrm.s b/gas/testsuite/gas/i386/modrm.s
index a6fc689..dbd446c 100644
--- a/gas/testsuite/gas/i386/modrm.s
+++ b/gas/testsuite/gas/i386/modrm.s
@@ -1668,4 +1668,4 @@
 	mov	%ds,%ds:0x12(,8)
 
 	# Force a good alignment.
-	.byte	0
+	.p2align	4,0
diff --git a/gas/testsuite/gas/i386/naked.d b/gas/testsuite/gas/i386/naked.d
new file mode 100644
index 0000000..206e300
--- /dev/null
+++ b/gas/testsuite/gas/i386/naked.d
@@ -0,0 +1,32 @@
+#objdump: -drw
+#name: i386 naked reg
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+   0:	66 26 ff 23 [ 	]*jmpw   \*%es:\(%ebx\)
+   4:	8a 25 50 00 00 00 [ 	]*mov    0x50,%ah
+   a:	b2 20 [ 	]*mov    \$0x20,%dl
+   c:	bb 00 00 00 00 [ 	]*mov    \$0x0,%ebx	d: (R_386_)?(dir)?32	.text
+  11:	d9 c9 [ 	]*fxch   %st\(1\)
+  13:	36 8c a4 81 d2 04 00 00 [ 	]*movl   %fs,%ss:0x4d2\(%ecx,%eax,4\)
+  1b:	8c 2c ed 00 00 00 00 [ 	]*movl   %gs,0x0\(,%ebp,8\)
+  22:	26 88 25 00 00 00 00 [ 	]*mov    %ah,%es:0x0
+  29:	2e 8b 74 14 80 [ 	]*mov    %cs:0xffffff80\(%esp,%edx,1\),%esi
+  2e:	f3 65 a5 [ 	]*repz movsl %gs:\(%esi\),%es:\(%edi\)
+  31:	ec [ 	]*in     \(%dx\),%al
+  32:	66 ef [ 	]*out    %ax,\(%dx\)
+  34:	67 d2 14 [ 	]*addr16 rclb %cl,\(%si\)
+  37:	0f 20 d0 [ 	]*mov    %cr2,%eax
+  3a:	0f 72 d0 04 [ 	]*psrld  \$0x4,%mm0
+  3e:	66 47 [ 	]*inc    %di
+  40:	66 51 [ 	]*push   %cx
+  42:	66 58 [ 	]*pop    %ax
+  44:	66 87 dd [ 	]*xchg   %bx,%bp
+  47:	6a 02 [ 	]*push   \$0x2
+  49:	00 00 [ 	]*add    %al,\(%eax\)
+  4b:	00 00 [ 	]*add    %al,\(%eax\)
+  4d:	00 00 [ 	]*add    %al,\(%eax\)
+	...
diff --git a/gas/testsuite/gas/i386/naked.s b/gas/testsuite/gas/i386/naked.s
new file mode 100644
index 0000000..ee2cc4c
--- /dev/null
+++ b/gas/testsuite/gas/i386/naked.s
@@ -0,0 +1,25 @@
+.att_syntax noprefix
+
+foo:	jmpw es:*(ebx)
+	mov (0x8*0xa),ah
+	mov $(8*4),dl
+	mov $foo,ebx
+	fxch st(1)
+	mov fs,ss:1234(ecx,eax,4)
+	mov gs,ds:(,ebp,8)
+	mov ah,es:0
+	mov cs:-128(esp,edx),esi
+	rep movsl gs:(esi),es:(edi)
+	in dx,al
+	outw (dx)
+ addr16 rclb cl,(si)
+	mov cr2,eax
+	psrld $4,mm0
+	inc di
+	push cx
+	pop ax
+	xchg bx,bp
+	pushl $2
+
+# Force a good alignment.
+.p2align	4,0
diff --git a/gas/testsuite/gas/i386/opcode.d b/gas/testsuite/gas/i386/opcode.d
index fc3c158..6df49d7 100644
--- a/gas/testsuite/gas/i386/opcode.d
+++ b/gas/testsuite/gas/i386/opcode.d
@@ -526,7 +526,7 @@
  879:	66 d3 90 90 90 90 90 [ 	]*rclw   %cl,0x90909090\(%eax\)
  880:	66 e5 90 [ 	]*in     \$0x90,%ax
  883:	66 e7 90 [ 	]*out    %ax,\$0x90
- 886:	66 e8 8f 90 [ 	]*callw  (0x)?ffff9919.*
+ 886:	66 e8 8f 90 [ 	]*callw  (0x)?9919.*
  88a:	66 ea 90 90 90 90 [ 	]*ljmpw  \$0x9090,\$0x9090
  890:	66 ed [ 	]*in     \(%dx\),%ax
  892:	66 ef [ 	]*out    %ax,\(%dx\)
diff --git a/gas/testsuite/gas/i386/prefix.s b/gas/testsuite/gas/i386/prefix.s
index 043d310..8f5dffd 100644
--- a/gas/testsuite/gas/i386/prefix.s
+++ b/gas/testsuite/gas/i386/prefix.s
@@ -7,5 +7,5 @@
  addr16 fstsw %ax
  addr16 rep cmpsw %es:(%di),%ss:(%si)
 
- # Get a good alignment.
- .byte 0
+# Get a good alignment.
+ .p2align	4,0
diff --git a/gas/testsuite/gas/i386/reloc.d b/gas/testsuite/gas/i386/reloc.d
index c7903dd..3a95eed 100644
--- a/gas/testsuite/gas/i386/reloc.d
+++ b/gas/testsuite/gas/i386/reloc.d
@@ -5,11 +5,16 @@
 
 Disassembly of section .text:
 
-00000000 <foo>:
-   0:	b3 00 [ 	]*mov    \$0x0,%bl	1: R_386_8	.text
-   2:	68 00 00 00 00 [ 	]*push   \$0x0	3: R_386_32	.text
-   7:	05 00 00 00 00 [ 	]*add    \$0x0,%eax	8: R_386_32	.text
-   c:	81 c3 00 00 00 00 [ 	]*add    \$0x0,%ebx	e: R_386_32	.text
-  12:	69 d2 00 00 00 00 [ 	]*imul   \$0x0,%edx,%edx	14: R_386_32	.text
-  18:	9a 00 00 00 00 00 00 [ 	]*lcall  \$0x0,\$0x0	19: R_386_32	.text
-  1f:	66 68 00 00 [ 	]*pushw  \$0x0	21: R_386_16	.text
+0+000 <foo>:
+   0:	b3 00 [ 	]*mov    \$0x0,%bl	1: (R_386_)?8	.text
+   2:	68 00 00 00 00 [ 	]*push   \$0x0	3: (R_386_)?(dir)?32	.text
+   7:	05 00 00 00 00 [ 	]*add    \$0x0,%eax	8: (R_386_)?(dir)?32	.text
+   c:	81 c3 00 00 00 00 [ 	]*add    \$0x0,%ebx	e: (R_386_)?(dir)?32	.text
+  12:	69 d2 00 00 00 00 [ 	]*imul   \$0x0,%edx,%edx	14: (R_386_)?(dir)?32	.text
+  18:	9a 00 00 00 00 00 00 [ 	]*lcall  \$0x0,\$0x0	19: (R_386_)?(dir)?32	.text
+  1f:	66 68 00 00 [ 	]*pushw  \$0x0	21: (R_386_)?16	.text
+  23:	90 [ 	]*nop    
+  24:	90 [ 	]*nop    
+  25:	90 [ 	]*nop    
+  26:	90 [ 	]*nop    
+  27:	90 [ 	]*nop    
diff --git a/gas/testsuite/gas/i386/reloc.s b/gas/testsuite/gas/i386/reloc.s
index 13ee930..2bf95b6 100644
--- a/gas/testsuite/gas/i386/reloc.s
+++ b/gas/testsuite/gas/i386/reloc.s
@@ -6,3 +6,6 @@
 	imul	$foo, %edx
 	lcall	$0, $foo
 	pushw	$foo
+
+# Pad out to a good alignment
+ .byte 0x90,0x90,0x90,0x90,0x90
diff --git a/gas/testsuite/gas/i386/white.l b/gas/testsuite/gas/i386/white.l
index 1ce6161..c2d9157 100644
--- a/gas/testsuite/gas/i386/white.l
+++ b/gas/testsuite/gas/i386/white.l
@@ -19,3 +19,6 @@
   16 0022 66B81300 0000              		Mov \$ foo , %eAx	
   17                                	.Code32 
   18 0028 66B81300                   		mov \$ foo , %ax	
+  19                                	
+  20 002c D9C9                       		fxch   %st  \(  1  \) 
+  21 002e D9C9                       		fxch   %           st\(1\)
diff --git a/gas/testsuite/gas/i386/white.s b/gas/testsuite/gas/i386/white.s
index 3bf5070..11eccfb 100644
--- a/gas/testsuite/gas/i386/white.s
+++ b/gas/testsuite/gas/i386/white.s
@@ -16,3 +16,6 @@
 	Mov $ foo , %eAx	
 .Code32 
 	mov $ foo , %ax	
+
+	fxch   %st  (  1  ) 
+	fxch   %           st(1)
diff --git a/gas/testsuite/gas/ieee-fp/x930509a.exp b/gas/testsuite/gas/ieee-fp/x930509a.exp
index d788d2c..8556972 100644
--- a/gas/testsuite/gas/ieee-fp/x930509a.exp
+++ b/gas/testsuite/gas/ieee-fp/x930509a.exp
@@ -7,10 +7,9 @@
     gas_start "x930509a.s" "-al"
     while 1 {
 	expect {
-	    -re " 00008000\[ 	\]+.single" { pass $testname; set x 1 }
-	    -re " 00800000\[ 	\]+.single" { pass $testname; set x 1 }
-	    -re " 0080 0000\[ 	\]+.single" { pass $testname; set x 1 }
-	    -re " ........ +.single" { fail $testname; set x 1 }
+	    -re " 00 ?00 ?80 ?00\[ 	\]+.single" { pass $testname; set x 1 }
+	    -re " 00 ?80 ?00 ?00\[ 	\]+.single" { pass $testname; set x 1 }
+	    -re ".single" { fail $testname; set x 1 }
 	    -re "\[^\n\]*\n" { }
 	    timeout { perror "timeout\n"; break }
 	    eof { break }
diff --git a/gas/testsuite/gas/m32r/error.exp b/gas/testsuite/gas/m32r/error.exp
new file mode 100644
index 0000000..a188719
--- /dev/null
+++ b/gas/testsuite/gas/m32r/error.exp
@@ -0,0 +1,15 @@
+# Test assembler warnings and errors.
+
+if [istarget m32r-*-*] {
+
+    load_lib gas-dg.exp
+
+    dg-init
+
+    dg-runtest "$srcdir/$subdir/wrongsize.s" "" ""
+    dg-runtest "$srcdir/$subdir/interfere.s" "" ""
+    dg-runtest "$srcdir/$subdir/outofrange.s" "" ""
+
+    dg-finish
+
+}
diff --git a/gas/testsuite/gas/m32r/fslotx.d b/gas/testsuite/gas/m32r/fslotx.d
new file mode 100644
index 0000000..d3e2d1a
--- /dev/null
+++ b/gas/testsuite/gas/m32r/fslotx.d
@@ -0,0 +1,23 @@
+#as: -m32rx
+#objdump: -dr
+#name: fslotx
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+0 <bcl>:
+ *0:	78 00 f0 00 	bcl 0 <bcl> \|\| nop
+ *4:	60 08 f0 00 	ldi r0,[#]*8 \|\| nop
+
+0+8 <bcl_s>:
+ *8:	78 00 f0 00 	bcl 8 <bcl_s> \|\| nop
+ *c:	60 08 f0 00 	ldi r0,[#]*8 \|\| nop
+
+0+10 <bncl>:
+  10:	79 00 f0 00 	bncl 10 <bncl> \|\| nop
+  14:	60 08 f0 00 	ldi r0,[#]*8 \|\| nop
+
+0+18 <bncl_s>:
+  18:	79 00 f0 00 	bncl 18 <bncl_s> \|\| nop
+  1c:	60 08 f0 00 	ldi r0,[#]*8 \|\| nop
diff --git a/gas/testsuite/gas/m32r/fslotx.s b/gas/testsuite/gas/m32r/fslotx.s
new file mode 100644
index 0000000..9cfb231
--- /dev/null
+++ b/gas/testsuite/gas/m32r/fslotx.s
@@ -0,0 +1,19 @@
+# Test the FILL-SLOT attribute.
+# The FILL-SLOT attribute ensures the next insn begins on a 32 byte boundary.
+# This is needed for example with bl because the subroutine will return
+# to a 32 bit boundary.
+
+	.text
+bcl:
+	bcl bcl
+	ldi r0,#8
+bcl_s:
+	bcl.s bcl_s
+	ldi r0,#8
+
+bncl:
+	bncl bncl
+	ldi r0,#8
+bncl_s:
+	bncl.s bncl_s
+	ldi r0,#8
diff --git a/gas/testsuite/gas/m32r/interfere.s b/gas/testsuite/gas/m32r/interfere.s
new file mode 100644
index 0000000..775ecde
--- /dev/null
+++ b/gas/testsuite/gas/m32r/interfere.s
@@ -0,0 +1,14 @@
+; Test error messages in instances where output operands interfere.
+
+; { dg-do assemble { target m32r-*-* } }
+; { dg-options -m32rx }
+
+interfere:
+	trap #1      || cmp  r3, r4	; { dg-error "write to the same" }
+		; { dg-warning "same" "out->in" { target *-*-* } { 7 } }
+	rte          || addx r3, r4	; { dg-error "write to the same" }
+		; { dg-warning "same" "out->in" { target *-*-* } { 9 } }
+	cmp  r1, r2  || addx r3, r4	; { dg-error "write to the same" }
+		; { dg-warning "same" "out->in" { target *-*-* } { 11 } }
+	mvtc r0, psw || addx r1, r4	; { dg-error "write to the same" }
+		; { dg-warning "same" "out->in" { target *-*-* } { 13 } }
diff --git a/gas/testsuite/gas/m32r/m32rx.d b/gas/testsuite/gas/m32r/m32rx.d
new file mode 100644
index 0000000..6713dd2
--- /dev/null
+++ b/gas/testsuite/gas/m32r/m32rx.d
@@ -0,0 +1,337 @@
+#as: -m32rx --no-warn-explicit-parallel-conflicts --hidden -O
+#objdump: -dr
+#name: m32rx
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+0000 <bcl>:
+   0:	78 00 f0 00 	bcl 0 <bcl> \|\| nop
+
+0+0004 <bncl>:
+   4:	79 ff f0 00 	bncl 0 <bcl> \|\| nop
+
+0+0008 <cmpz>:
+   8:	00 7d f0 00 	cmpz fp \|\| nop
+
+0+000c <cmpeq>:
+   c:	0d 6d f0 00 	cmpeq fp,fp \|\| nop
+
+0+0010 <maclh1>:
+  10:	5d cd f0 00 	maclh1 fp,fp \|\| nop
+
+0+0014 <msblo>:
+  14:	5d dd f0 00 	msblo fp,fp \|\| nop
+
+0+0018 <mulwu1>:
+  18:	5d ad f0 00 	mulwu1 fp,fp \|\| nop
+
+0+001c <macwu1>:
+  1c:	5d bd f0 00 	macwu1 fp,fp \|\| nop
+
+0+0020 <sadd>:
+  20:	50 e4 f0 00 	sadd \|\| nop
+
+0+0024 <satb>:
+  24:	8d 6d 03 00 	satb fp,fp
+
+0+0028 <mulhi>:
+  28:	3d 8d f0 00 	mulhi fp,fp,a1 \|\| nop
+
+0+002c <mullo>:
+  2c:	3d 1d f0 00 	mullo fp,fp \|\| nop
+
+0+0030 <divh>:
+  30:	9d 0d 00 10 	divh fp,fp
+
+0+0034 <machi>:
+  34:	3d cd f0 00 	machi fp,fp,a1 \|\| nop
+
+0+0038 <maclo>:
+  38:	3d 5d f0 00 	maclo fp,fp \|\| nop
+
+0+003c <mvfachi>:
+  3c:	5d f4 f0 00 	mvfachi fp,a1 \|\| nop
+
+0+0040 <mvfacmi>:
+  40:	5d f6 f0 00 	mvfacmi fp,a1 \|\| nop
+
+0+0044 <mvfaclo>:
+  44:	5d f5 f0 00 	mvfaclo fp,a1 \|\| nop
+
+0+0048 <mvtachi>:
+  48:	5d 74 f0 00 	mvtachi fp,a1 \|\| nop
+
+0+004c <mvtaclo>:
+  4c:	5d 71 f0 00 	mvtaclo fp \|\| nop
+
+0+0050 <rac>:
+  50:	54 90 f0 00 	rac a1 \|\| nop
+
+0+0054 <rac_ds>:
+  54:	54 90 f0 00 	rac a1 \|\| nop
+
+0+0058 <rac_dsi>:
+  58:	50 94 f0 00 	rac a0,a1 \|\| nop
+
+0+005c <rach>:
+  5c:	54 80 f0 00 	rach a1 \|\| nop
+
+0+0060 <rach_ds>:
+  60:	50 84 f0 00 	rach a0,a1 \|\| nop
+
+0+0064 <rach_dsi>:
+  64:	54 81 f0 00 	rach a1,a0,#0x2 \|\| nop
+
+0+0068 <bc__add>:
+  68:	7c e6 8d ad 	bc 0 <bcl> \|\| add fp,fp
+  6c:	7c e5 0d ad 	bc 0 <bcl> -> add fp,fp
+
+0+0070 <bcl__addi>:
+  70:	78 e4 cd 4d 	bcl 0 <bcl> \|\| addi fp,#77
+  74:	78 e3 cd 4d 	bcl 0 <bcl> \|\| addi fp,#77
+
+0+0078 <bl__addv>:
+  78:	7e e2 8d 8d 	bl 0 <bcl> \|\| addv fp,fp
+  7c:	7e e1 8d 8d 	bl 0 <bcl> \|\| addv fp,fp
+
+0+0080 <bnc__addx>:
+  80:	7d e0 8d 9d 	bnc 0 <bcl> \|\| addx fp,fp
+  84:	7d df 0d 9d 	bnc 0 <bcl> -> addx fp,fp
+
+0+0088 <bncl__and>:
+  88:	79 de 8d cd 	bncl 0 <bcl> \|\| and fp,fp
+  8c:	0d cd 79 dd 	and fp,fp -> bncl 0 <bcl>
+
+0+0090 <bra__cmp>:
+  90:	7f dc 8d 4d 	bra 0 <bcl> \|\| cmp fp,fp
+  94:	7f db 8d 4d 	bra 0 <bcl> \|\| cmp fp,fp
+
+0+0098 <jl__cmpeq>:
+  98:	1e cd 8d 6d 	jl fp \|\| cmpeq fp,fp
+  9c:	1e cd 8d 6d 	jl fp \|\| cmpeq fp,fp
+
+0+00a0 <jmp__cmpu>:
+  a0:	1f cd 8d 5d 	jmp fp \|\| cmpu fp,fp
+  a4:	1f cd 8d 5d 	jmp fp \|\| cmpu fp,fp
+
+0+00a8 <ld__cmpz>:
+  a8:	2d cd 80 71 	ld fp,@fp \|\| cmpz r1
+  ac:	2d cd 80 71 	ld fp,@fp \|\| cmpz r1
+
+0+00b0 <ld__ldi>:
+  b0:	2d e1 e2 4d 	ld fp,@r1\+ \|\| ldi r2,#77
+  b4:	2d e1 e2 4d 	ld fp,@r1\+ \|\| ldi r2,#77
+
+0+00b8 <ldb__mv>:
+  b8:	2d 8d 92 8d 	ldb fp,@fp \|\| mv r2,fp
+  bc:	2d 8d 12 8d 	ldb fp,@fp -> mv r2,fp
+
+0+00c0 <ldh__neg>:
+  c0:	2d ad 82 3d 	ldh fp,@fp \|\| neg r2,fp
+  c4:	2d ad 02 3d 	ldh fp,@fp -> neg r2,fp
+
+0+00c8 <ldub__nop>:
+  c8:	2d 9d f0 00 	ldub fp,@fp \|\| nop
+  cc:	2d 9d f0 00 	ldub fp,@fp \|\| nop
+
+0+00d0 <lduh__not>:
+  d0:	2d bd 82 bd 	lduh fp,@fp \|\| not r2,fp
+  d4:	2d bd 02 bd 	lduh fp,@fp -> not r2,fp
+
+0+00d8 <lock__or>:
+  d8:	2d dd 82 ed 	lock fp,@fp \|\| or r2,fp
+  dc:	2d dd 02 ed 	lock fp,@fp -> or r2,fp
+
+0+00e0 <mvfc__sub>:
+  e0:	1d 91 82 2d 	mvfc fp,cbr \|\| sub r2,fp
+  e4:	1d 91 02 2d 	mvfc fp,cbr -> sub r2,fp
+
+0+00e8 <mvtc__subv>:
+  e8:	12 ad 82 0d 	mvtc fp,spi \|\| subv r2,fp
+  ec:	12 ad 82 0d 	mvtc fp,spi \|\| subv r2,fp
+
+0+00f0 <rte__subx>:
+  f0:	10 d6 82 2d 	rte \|\| sub r2,fp
+  f4:	10 d6 02 1d 	rte -> subx r2,fp
+
+0+00f8 <sll__xor>:
+  f8:	1d 41 82 dd 	sll fp,r1 \|\| xor r2,fp
+  fc:	1d 41 02 dd 	sll fp,r1 -> xor r2,fp
+
+0+0100 <slli__machi>:
+ 100:	5d 56 b2 4d 	slli fp,#0x16 \|\| machi r2,fp
+ 104:	5d 56 32 4d 	slli fp,#0x16 -> machi r2,fp
+
+0+0108 <sra__maclh1>:
+ 108:	1d 2d d2 cd 	sra fp,fp \|\| maclh1 r2,fp
+ 10c:	1d 2d 52 cd 	sra fp,fp -> maclh1 r2,fp
+
+0+0110 <srai__maclo>:
+ 110:	5d 36 b2 5d 	srai fp,#0x16 \|\| maclo r2,fp
+ 114:	5d 36 32 5d 	srai fp,#0x16 -> maclo r2,fp
+
+0+0118 <srl__macwhi>:
+ 118:	1d 0d b2 6d 	srl fp,fp \|\| macwhi r2,fp
+ 11c:	1d 0d 32 6d 	srl fp,fp -> macwhi r2,fp
+
+0+0120 <srli__macwlo>:
+ 120:	5d 16 b2 7d 	srli fp,#0x16 \|\| macwlo r2,fp
+ 124:	5d 16 32 7d 	srli fp,#0x16 -> macwlo r2,fp
+
+0+0128 <st__macwu1>:
+ 128:	2d 4d d2 bd 	st fp,@fp \|\| macwu1 r2,fp
+ 12c:	2d 4d d2 bd 	st fp,@fp \|\| macwu1 r2,fp
+
+0+0130 <st__msblo>:
+ 130:	2d 6d d2 dd 	st fp,@\+fp \|\| msblo r2,fp
+ 134:	2d 6d 52 dd 	st fp,@\+fp -> msblo r2,fp
+
+0+0138 <st__mul>:
+ 138:	2d 7d 92 6d 	st fp,@-fp \|\| mul r2,fp
+ 13c:	2d 7d 12 6d 	st fp,@-fp -> mul r2,fp
+
+0+0140 <stb__mulhi>:
+ 140:	2d 0d b2 0d 	stb fp,@fp \|\| mulhi r2,fp
+ 144:	2d 0d b2 0d 	stb fp,@fp \|\| mulhi r2,fp
+
+0+0148 <sth__mullo>:
+ 148:	2d 2d b2 1d 	sth fp,@fp \|\| mullo r2,fp
+ 14c:	2d 2d b2 1d 	sth fp,@fp \|\| mullo r2,fp
+
+0+0150 <trap__mulwhi>:
+ 150:	10 f2 b2 2d 	trap #0x2 \|\| mulwhi r2,fp
+ 154:	10 f2 f0 00 	trap #0x2 \|\| nop
+ 158:	32 2d f0 00 	mulwhi r2,fp \|\| nop
+
+0+015c <unlock__mulwlo>:
+ 15c:	2d 5d b2 3d 	unlock fp,@fp \|\| mulwlo r2,fp
+ 160:	2d 5d b2 3d 	unlock fp,@fp \|\| mulwlo r2,fp
+
+0+0164 <add__mulwu1>:
+ 164:	0d ad d2 ad 	add fp,fp \|\| mulwu1 r2,fp
+ 168:	0d ad 52 ad 	add fp,fp -> mulwu1 r2,fp
+
+0+016c <addi__mvfachi>:
+ 16c:	4d 4d d2 f0 	addi fp,#77 \|\| mvfachi r2
+ 170:	4d 4d d2 f0 	addi fp,#77 \|\| mvfachi r2
+
+0+0174 <addv__mvfaclo>:
+ 174:	0d 8d d2 f5 	addv fp,fp \|\| mvfaclo r2,a1
+ 178:	0d 8d d2 f5 	addv fp,fp \|\| mvfaclo r2,a1
+
+0+017c <addx__mvfacmi>:
+ 17c:	0d 9d d2 f2 	addx fp,fp \|\| mvfacmi r2
+ 180:	0d 9d d2 f2 	addx fp,fp \|\| mvfacmi r2
+
+0+0184 <and__mvtachi>:
+ 184:	0d cd d2 70 	and fp,fp \|\| mvtachi r2
+ 188:	0d cd d2 70 	and fp,fp \|\| mvtachi r2
+
+0+018c <cmp__mvtaclo>:
+ 18c:	0d 4d d2 71 	cmp fp,fp \|\| mvtaclo r2
+ 190:	0d 4d d2 71 	cmp fp,fp \|\| mvtaclo r2
+
+0+0194 <cmpeq__rac>:
+ 194:	0d 6d d4 90 	cmpeq fp,fp \|\| rac a1
+ 198:	0d 6d d4 90 	cmpeq fp,fp \|\| rac a1
+
+0+019c <cmpu__rach>:
+ 19c:	0d 5d d0 84 	cmpu fp,fp \|\| rach a0,a1
+ 1a0:	0d 5d d4 84 	cmpu fp,fp \|\| rach a1,a1
+
+0+01a4 <cmpz__sadd>:
+ 1a4:	00 7d d0 e4 	cmpz fp \|\| sadd
+ 1a8:	00 7d d0 e4 	cmpz fp \|\| sadd
+
+0+01ac <sc>:
+ 1ac:	74 01 d0 e4 	sc \|\| sadd
+
+0+01b0 <snc>:
+ 1b0:	75 01 d0 e4 	snc \|\| sadd
+
+0+01b4 <jc>:
+ 1b4:	1c cd f0 00 	jc fp \|\| nop
+
+0+01b8 <jnc>:
+ 1b8:	1d cd f0 00 	jnc fp \|\| nop
+
+0+01bc <pcmpbz>:
+ 1bc:	03 7d f0 00 	pcmpbz fp \|\| nop
+
+0+01c0 <sat>:
+ 1c0:	8d 6d 00 00 	sat fp,fp
+
+0+01c4 <sath>:
+ 1c4:	8d 6d 02 00 	sath fp,fp
+
+0+01c8 <jc__pcmpbz>:
+ 1c8:	1c cd 83 7d 	jc fp \|\| pcmpbz fp
+ 1cc:	1c cd 03 7d 	jc fp -> pcmpbz fp
+
+0+01d0 <jnc__ldi>:
+ 1d0:	1d cd ed 4d 	jnc fp \|\| ldi fp,#77
+ 1d4:	1d cd 6d 4d 	jnc fp -> ldi fp,#77
+
+0+01d8 <sc__mv>:
+ 1d8:	74 01 9d 82 	sc \|\| mv fp,r2
+ 1dc:	74 01 9d 82 	sc \|\| mv fp,r2
+
+0+01e0 <snc__neg>:
+ 1e0:	75 01 8d 32 	snc \|\| neg fp,r2
+ 1e4:	75 01 8d 32 	snc \|\| neg fp,r2
+
+0+01e8 <nop__sadd>:
+ 1e8:	70 00 d0 e4 	nop \|\| sadd
+
+0+01ec <sadd__nop>:
+ 1ec:	70 00 d0 e4 	nop \|\| sadd
+
+0+01f0 <sadd__nop_reverse>:
+ 1f0:	70 00 d0 e4 	nop \|\| sadd
+
+0+01f4 <add__not>:
+ 1f4:	00 a1 83 b5 	add r0,r1 \|\| not r3,r5
+
+0+01f8 <add__not_dest_clash>:
+ 1f8:	03 a4 03 b5 	add r3,r4 -> not r3,r5
+
+0+01fc <add__not__src_clash>:
+ 1fc:	03 a4 05 b3 	add r3,r4 -> not r5,r3
+
+0+0200 <add__not__no_clash>:
+ 200:	03 a4 84 b5 	add r3,r4 \|\| not r4,r5
+
+0+0204 <mul__sra>:
+ 204:	13 24 91 62 	sra r3,r4 \|\| mul r1,r2
+
+0+0208 <mul__sra__reverse_src_clash>:
+ 208:	13 24 91 63 	sra r3,r4 \|\| mul r1,r3
+
+0+020c <bc__add_>:
+ 20c:	7c 04 01 a2 	bc 21c <label> -> add r1,r2
+
+0+0210 <add__bc>:
+ 210:	7c 03 83 a4 	bc 21c <label> \|\| add r3,r4
+
+0+0214 <bc__add__forced_parallel>:
+ 214:	7c 02 85 a6 	bc 21c <label> \|\| add r5,r6
+
+0+0218 <add__bc__forced_parallel>:
+ 218:	7c 01 87 a8 	bc 21c <label> \|\| add r7,r8
+
+0+021c <label>:
+ 21c:	70 00 f0 00 	nop \|\| nop
+
+0+0220 <mulwhi>:
+ 220:	3d 2d 3d ad 	mulwhi fp,fp -> mulwhi fp,fp,a1
+
+0+0224 <mulwlo>:
+ 224:	3d 3d 3d bd 	mulwlo fp,fp -> mulwlo fp,fp,a1
+
+0+0228 <macwhi>:
+ 228:	3d 6d 3d ed 	macwhi fp,fp -> macwhi fp,fp,a1
+
+0+022c <macwlo>:
+ 22c:	3d 7d 3d fd 	macwlo fp,fp -> macwlo fp,fp,a1
diff --git a/gas/testsuite/gas/m32r/m32rx.exp b/gas/testsuite/gas/m32r/m32rx.exp
new file mode 100644
index 0000000..6dd33de
--- /dev/null
+++ b/gas/testsuite/gas/m32r/m32rx.exp
@@ -0,0 +1,7 @@
+# M32Rx assembler testsuite.
+
+if [istarget m32r*-*-*] {
+    run_dump_test "m32rx"
+    run_dump_test "fslotx"
+    run_dump_test "relax-2"
+}
diff --git a/gas/testsuite/gas/m32r/m32rx.s b/gas/testsuite/gas/m32r/m32rx.s
new file mode 100644
index 0000000..b86dab0
--- /dev/null
+++ b/gas/testsuite/gas/m32r/m32rx.s
@@ -0,0 +1,590 @@
+# Test new instructions
+branchpoint:
+	
+	.text
+	.global bcl
+bcl:
+	bcl branchpoint
+
+	.text
+	.global bncl
+bncl:
+	bncl branchpoint
+
+	.text
+	.global cmpz
+cmpz:
+	cmpz fp
+
+	.text
+	.global cmpeq
+cmpeq:
+	cmpeq fp, fp
+
+	.text
+	.global maclh1
+maclh1:
+	maclh1 fp, fp
+	
+	.text
+	.global macsl0
+msblo:
+	msblo fp, fp
+	
+	.text
+	.global mulwu1
+mulwu1:
+	mulwu1 fp, fp
+	
+	.text
+	.global macwu1
+macwu1:
+	macwu1 fp, fp
+	
+	.text
+	.global sadd
+sadd:
+	sadd
+	
+	.text
+	.global satb
+satb:
+	satb fp, fp
+
+	
+	.text
+	.global mulhi
+mulhi:
+	mulhi fp, fp, a1
+	
+	.text
+	.global mullo
+mullo:
+	mullo fp, fp, a0
+	
+	.text
+	.global divh
+divh:
+	divh fp, fp
+	
+	.text
+	.global machi
+machi:
+	machi fp, fp, a1
+	
+	.text
+	.global maclo
+maclo:
+	maclo fp, fp, a0
+	
+	.text
+	.global mvfachi
+mvfachi:
+	mvfachi fp, a1
+	
+	.text
+	.global mvfacmi
+mvfacmi:
+	mvfacmi fp, a1
+	
+	.text
+	.global mvfaclo
+mvfaclo:
+	mvfaclo fp, a1
+	
+	.text
+	.global mvtachi
+mvtachi:
+	mvtachi fp, a1
+	
+	.text
+	.global mvtaclo
+mvtaclo:
+	mvtaclo fp, a0
+	
+	.text
+	.global rac
+rac:
+	rac a1
+	
+	.text
+	.global rac_ds
+rac_ds:
+	rac a1, a0
+	
+	.text
+	.global rac_dsi
+rac_dsi:
+	rac a0, a1, #1
+	
+	.text
+	.global rach
+rach:
+	rach a1
+	
+	.text
+	.global rach_ds
+rach_ds:
+	rach a0, a1
+	
+	.text
+	.global rach_dsi
+rach_dsi:
+	rach a1, a0, #2
+	
+# Test explicitly parallel and implicitly parallel instructions
+# Including apparent instruction sequence reordering.
+	.text
+	.global bc__add
+bc__add:
+	bc bcl || add fp, fp
+# Use bc.s here as bc is relaxable and thus a nop will be emitted.
+	bc.s bcl
+	add fp, fp
+
+	.text
+	.global bcl__addi
+bcl__addi:	
+	bcl bcl || addi fp, #77
+	addi fp, #77
+# Use bcl.s here as bcl is relaxable and thus the parallelization won't happen.
+	bcl.s bcl
+
+	.text
+	.global bl__addv
+bl__addv:
+	bl bcl || addv fp, fp
+	addv fp, fp
+# Use bl.s here as bl is relaxable and thus the parallelization won't happen.
+	bl.s bcl
+	
+	.text
+	.global bnc__addx
+bnc__addx:
+	bnc bcl || addx fp, fp
+# Use bnc.s here as bnc is relaxable and thus the parallelization attempt won't
+# happen.  Things still won't be parallelized, but we want this test to try.
+	bnc.s bcl
+	addx fp, fp
+
+	.text
+	.global bncl__and
+bncl__and:
+	bncl bcl || and fp, fp
+	and fp, fp
+	bncl bcl
+
+	.text
+	.global bra__cmp
+bra__cmp:
+	bra bcl || cmp fp, fp
+	cmp fp, fp
+# Use bra.s here as bra is relaxable and thus the parallelization won't happen.
+	bra.s bcl
+	
+	.text
+	.global jl__cmpeq
+jl__cmpeq:
+	jl fp || cmpeq fp, fp
+	cmpeq fp, fp
+	jl fp
+	
+	.text
+	.global jmp__cmpu
+jmp__cmpu:
+	jmp fp || cmpu fp, fp
+	cmpu fp, fp
+	jmp fp
+	
+	.text
+	.global ld__cmpz
+ld__cmpz:
+	ld fp, @fp || cmpz r1
+	cmpz r1
+	ld fp, @fp 
+	
+	.text
+	.global ld__ldi
+ld__ldi:
+	ld fp, @r1+ || ldi r2, #77
+	ld fp, @r1+ 
+	ldi r2, #77
+	
+	.text
+	.global ldb__mv
+ldb__mv:
+	ldb fp, @fp || mv r2, fp
+	ldb fp, @fp 
+	mv r2, fp
+
+	.text
+	.global ldh__neg
+ldh__neg:
+	ldh fp, @fp || neg r2, fp
+	ldh fp, @fp
+	neg r2, fp
+
+	.text
+	.global ldub__nop
+ldub__nop:
+	ldub fp, @fp || nop
+	ldub fp, @fp 
+	nop
+
+	.text
+	.global lduh__not
+lduh__not:
+	lduh fp, @fp || not r2, fp
+	lduh fp, @fp
+	not r2, fp
+
+	.text
+	.global lock__or
+lock__or:
+	lock fp, @fp || or r2, fp
+	lock fp, @fp
+	or r2, fp
+
+	.text
+	.global mvfc__sub
+mvfc__sub:
+	mvfc fp, cr1 || sub r2, fp
+	mvfc fp, cr1
+	sub r2, fp
+
+	.text
+	.global mvtc__subv
+mvtc__subv:
+	mvtc fp, cr2 || subv r2, fp
+	mvtc fp, cr2
+	subv r2, fp
+
+	.text
+	.global rte__subx
+rte__subx:
+	rte || sub r2, fp
+	rte
+	subx r2, fp
+
+	.text
+	.global sll__xor
+sll__xor:
+	sll fp, r1 || xor r2, fp
+	sll fp, r1
+	xor r2, fp
+
+	.text
+	.global slli__machi
+slli__machi:
+	slli fp, #22 || machi r2, fp
+	slli fp, #22
+	machi r2, fp
+
+	.text
+	.global sra__maclh1
+sra__maclh1:
+	sra fp, fp || maclh1 r2, fp
+	sra fp, fp
+	maclh1 r2, fp
+
+	.text
+	.global srai__maclo
+srai__maclo:
+	srai fp, #22 || maclo r2, fp
+	srai fp, #22
+	maclo r2, fp
+
+	.text
+	.global srl__macwhi
+srl__macwhi:
+	srl fp, fp || macwhi r2, fp
+	srl fp, fp
+	macwhi r2, fp
+
+	.text
+	.global srli__macwlo
+srli__macwlo:
+	srli fp, #22 || macwlo r2, fp
+	srli fp, #22
+	macwlo r2, fp
+	
+	.text
+	.global st__macwu1
+st__macwu1:
+	st fp, @fp || macwu1 r2, fp
+	st fp, @fp
+	macwu1 r2, fp
+
+	.text
+	.global st__msblo
+st__msblo:
+	st fp, @+fp || msblo r2, fp
+	st fp, @+fp 
+	msblo r2, fp
+
+	.text
+	.global st__mul
+st__mul:
+	st fp, @-fp || mul r2, fp
+	st fp, @-fp
+	mul r2, fp
+
+	.text
+	.global stb__mulhi
+stb__mulhi:
+	stb fp, @fp || mulhi r2, fp
+	stb fp, @fp
+	mulhi r2, fp
+	
+	.text
+	.global sth__mullo
+sth__mullo:
+	sth fp, @fp || mullo r2, fp
+	sth fp, @fp 
+	mullo r2, fp
+
+	.text
+	.global trap__mulwhi
+trap__mulwhi:
+	trap #2 || mulwhi r2, fp
+	trap #2
+	mulwhi r2, fp
+
+	.text
+	.global unlock__mulwlo
+unlock__mulwlo:
+	unlock fp, @fp || mulwlo r2, fp
+	unlock fp, @fp
+	mulwlo r2, fp
+
+	.text
+	.global add__mulwu1
+add__mulwu1:
+	add fp, fp || mulwu1 r2, fp
+	add fp, fp
+	mulwu1 r2, fp
+
+	.text
+	.global addi__mvfachi
+addi__mvfachi:
+	addi fp, #77 || mvfachi r2, a0
+	addi fp, #77
+	mvfachi r2, a0
+
+	.text
+	.global addv__mvfaclo
+addv__mvfaclo:
+	addv fp, fp || mvfaclo r2, a1
+	addv fp, fp
+	mvfaclo r2, a1
+
+	.text
+	.global addx__mvfacmi
+addx__mvfacmi:
+	addx fp, fp || mvfacmi r2, a0
+	addx fp, fp
+	mvfacmi r2, a0
+
+	.text
+	.global and__mvtachi
+and__mvtachi:
+	and fp, fp || mvtachi r2, a0
+	and fp, fp
+	mvtachi r2, a0
+	
+	.text
+	.global cmp__mvtaclo
+cmp__mvtaclo:
+	cmp fp, fp || mvtaclo r2, a0
+	cmp fp, fp
+	mvtaclo r2, a0
+
+	.text
+	.global cmpeq__rac
+cmpeq__rac:
+	cmpeq fp, fp || rac a1
+	cmpeq fp, fp
+	rac a1
+
+	.text
+	.global cmpu__rach
+cmpu__rach:
+	cmpu fp, fp || rach a0, a1
+	cmpu fp, fp
+	rach a1, a1, #1
+
+	.text
+	.global cmpz__sadd
+cmpz__sadd:
+	cmpz fp || sadd
+	cmpz fp
+	sadd
+
+
+	
+# Test private instructions	
+	.text
+	.global sc
+sc:
+	sc
+	sadd
+	
+	.text
+	.global snc
+snc:
+	snc
+	sadd 
+	
+	.text
+	.global jc
+jc:
+	jc fp
+	
+	.text
+	.global jnc
+jnc:
+	jnc fp
+		
+	.text
+	.global pcmpbz
+pcmpbz:
+	pcmpbz fp
+	
+	.text
+	.global sat
+sat:
+	sat fp, fp
+	
+	.text
+	.global sath
+sath:
+	sath fp, fp 
+
+
+# Test parallel versions of the private instructions
+	
+	.text
+	.global jc__pcmpbz
+jc__pcmpbz:
+	jc fp || pcmpbz fp
+	jc fp 
+	pcmpbz fp
+	
+	.text
+	.global jnc__ldi
+jnc__ldi:
+	jnc fp || ldi fp, #77
+	jnc fp
+	ldi fp, #77
+	
+	.text
+	.global sc__mv
+sc__mv:
+	sc || mv fp, r2
+	sc 
+	mv fp, r2
+
+	.text
+	.global snc__neg
+snc__neg:
+	snc || neg fp, r2
+	snc 
+	neg fp, r2
+	
+# Test automatic and explicit parallelisation of instructions
+	.text
+	.global nop__sadd
+nop__sadd:
+	nop
+	sadd
+
+	.text
+	.global sadd__nop
+sadd__nop:
+	sadd
+	nop
+
+	.text
+	.global sadd__nop_reverse
+sadd__nop_reverse:
+	sadd || nop
+
+	.text
+	.global add__not
+add__not:
+	add  r0, r1
+	not  r3, r5
+
+	.text
+	.global add__not__dest_clash
+add__not_dest_clash:
+	add  r3, r4
+	not  r3, r5
+
+	.text
+	.global add__not__src_clash
+add__not__src_clash:
+	add  r3, r4
+	not  r5, r3
+
+	.text
+	.global add__not__no_clash
+add__not__no_clash:
+	add  r3, r4
+	not  r4, r5
+
+	.text
+	.global mul__sra
+mul__sra:
+	mul  r1, r2
+	sra  r3, r4
+	
+	.text
+	.global mul__sra__reverse_src_clash
+mul__sra__reverse_src_clash:
+	mul  r1, r3
+	sra  r3, r4
+	
+	.text
+	.global bc__add_
+bc__add_:
+	bc.s label
+	add r1, r2
+
+	.text
+	.global add__bc
+add__bc:
+	add r3, r4
+	bc.s  label
+
+	.text
+	.global bc__add__forced_parallel
+bc__add__forced_parallel:
+	bc label || add r5, r6
+
+	.text
+	.global add__bc__forced_parallel
+add__bc__forced_parallel:
+	add r7, r8 || bc label
+label:
+	nop
+
+; Additional testcases.
+; These insns were added to the chip later.
+
+	.text
+mulwhi:
+	mulwhi fp, fp, a0
+	mulwhi fp, fp, a1
+	
+mulwlo:
+	mulwlo fp, fp, a0
+	mulwlo fp, fp, a1
+
+macwhi:
+	macwhi fp, fp, a0
+	macwhi fp, fp, a1
+
+macwlo:
+	macwlo fp, fp, a0
+	macwlo fp, fp, a1
diff --git a/gas/testsuite/gas/m32r/relax-2.d b/gas/testsuite/gas/m32r/relax-2.d
new file mode 100644
index 0000000..2f83e8b
--- /dev/null
+++ b/gas/testsuite/gas/m32r/relax-2.d
@@ -0,0 +1,18 @@
+#as: --m32rx
+#objdump: -dr
+#name: relax-2
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+0 <label1>:
+   0:	fd 00 00 83 	bnc 20c <label3>
+   4:	70 00 f0 00 	nop \|\| nop
+   8:	43 03 c2 02 	addi r3,[#]3 \|\| addi r2,[#]2
+
+0+0c <label2>:
+	...
+
+0+020c <label3>:
+ 20c:	70 00 f0 00 	nop \|\| nop
diff --git a/gas/testsuite/gas/m32r/relax-2.s b/gas/testsuite/gas/m32r/relax-2.s
new file mode 100644
index 0000000..179dec7
--- /dev/null
+++ b/gas/testsuite/gas/m32r/relax-2.s
@@ -0,0 +1,11 @@
+; Test whether parallel insns get inappropriately moved during relaxation.
+
+        .text
+label1:
+        bnc     label3
+        nop
+        addi    r3, #3 || addi  r2, #2
+label2:
+        .space 512
+label3:
+        nop
diff --git a/gas/testsuite/gas/m32r/wrongsize.s b/gas/testsuite/gas/m32r/wrongsize.s
new file mode 100644
index 0000000..088f478
--- /dev/null
+++ b/gas/testsuite/gas/m32r/wrongsize.s
@@ -0,0 +1,10 @@
+; Test error messages in instances where an insn of a particular size
+; is required.
+
+; { dg-do assemble { target m32r-*-* } }
+
+wrongsize:
+	cmpi r8,#10 -> ldi r0,#8  ; { dg-error "not a 16 bit instruction" }
+	ldi r0,#8 -> cmpi r8,#10  ; { dg-error "not a 16 bit instruction" }
+	cmpi r8,#10 || ldi r0,#8  ; { dg-error "not a 16 bit instruction" }
+	ldi r0,#8 || cmpi r8,#10  ; { dg-error "not a 16 bit instruction" }
diff --git a/gas/testsuite/gas/macros/irp.d b/gas/testsuite/gas/macros/irp.d
index 6733622..e6d7bcf 100644
--- a/gas/testsuite/gas/macros/irp.d
+++ b/gas/testsuite/gas/macros/irp.d
@@ -5,9 +5,9 @@
 
 RELOCATION RECORDS FOR .*
 OFFSET[ 	]+TYPE[ 	]+VALUE.*
-0+00[ 	]+[a-zA-Z0-9_]+[ 	]+r1
-0+04[ 	]+[a-zA-Z0-9_]+[ 	]+r2
-0+08[ 	]+[a-zA-Z0-9_]+[ 	]+r3
-0+0c[ 	]+[a-zA-Z0-9_]+[ 	]+s1
-0+10[ 	]+[a-zA-Z0-9_]+[ 	]+s2
-0+14[ 	]+[a-zA-Z0-9_]+[ 	]+s3
+0+00[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
+0+04[ 	]+[a-zA-Z0-9_]+[ 	]+foo2
+0+08[ 	]+[a-zA-Z0-9_]+[ 	]+foo3
+0+0c[ 	]+[a-zA-Z0-9_]+[ 	]+bar1
+0+10[ 	]+[a-zA-Z0-9_]+[ 	]+bar2
+0+14[ 	]+[a-zA-Z0-9_]+[ 	]+bar3
diff --git a/gas/testsuite/gas/macros/irp.s b/gas/testsuite/gas/macros/irp.s
index 2f9a621..f37dd54 100644
--- a/gas/testsuite/gas/macros/irp.s
+++ b/gas/testsuite/gas/macros/irp.s
@@ -1,8 +1,8 @@
 	.irp	param,1,2,3
-	.long	r\param
+	.long	foo\param
 	.endr
 
 	.irpc	param,123
-	.long	s\param
+	.long	bar\param
 	.endr
 
diff --git a/gas/testsuite/gas/macros/rept.d b/gas/testsuite/gas/macros/rept.d
index efb5d99..0022d5f 100644
--- a/gas/testsuite/gas/macros/rept.d
+++ b/gas/testsuite/gas/macros/rept.d
@@ -5,6 +5,6 @@
 
 RELOCATION RECORDS FOR .*
 OFFSET[ 	]+TYPE[ 	]+VALUE.*
-0+00[ 	]+[a-zA-Z0-9_]+[ 	]+r1
-0+04[ 	]+[a-zA-Z0-9_]+[ 	]+r1
-0+08[ 	]+[a-zA-Z0-9_]+[ 	]+r1
+0+00[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
+0+04[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
+0+08[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
diff --git a/gas/testsuite/gas/macros/rept.s b/gas/testsuite/gas/macros/rept.s
index 243cf67..571b6f8 100644
--- a/gas/testsuite/gas/macros/rept.s
+++ b/gas/testsuite/gas/macros/rept.s
@@ -1,3 +1,3 @@
 	.rept	3
-	.long	r1
+	.long	foo1
 	.endr
diff --git a/gas/testsuite/gas/macros/test2.d b/gas/testsuite/gas/macros/test2.d
index 741d734..9a7d414 100644
--- a/gas/testsuite/gas/macros/test2.d
+++ b/gas/testsuite/gas/macros/test2.d
@@ -5,6 +5,6 @@
 
 RELOCATION RECORDS FOR .*
 OFFSET[ 	]+TYPE[ 	]+VALUE.*
-0+00[ 	]+[a-zA-Z0-9_]+[ 	]+r1
-0+04[ 	]+[a-zA-Z0-9_]+[ 	]+r2
-0+08[ 	]+[a-zA-Z0-9_]+[ 	]+r3
+0+00[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
+0+04[ 	]+[a-zA-Z0-9_]+[ 	]+foo2
+0+08[ 	]+[a-zA-Z0-9_]+[ 	]+foo3
diff --git a/gas/testsuite/gas/macros/test2.s b/gas/testsuite/gas/macros/test2.s
index 838ce94..a21b011 100644
--- a/gas/testsuite/gas/macros/test2.s
+++ b/gas/testsuite/gas/macros/test2.s
@@ -6,4 +6,4 @@
 	.endif
 	.endm
 
-	m	r1,r2,r3
+	m	foo1,foo2,foo3
diff --git a/gas/testsuite/gas/macros/test3.d b/gas/testsuite/gas/macros/test3.d
index 2580f76..7680ad4 100644
--- a/gas/testsuite/gas/macros/test3.d
+++ b/gas/testsuite/gas/macros/test3.d
@@ -5,4 +5,4 @@
 
 RELOCATION RECORDS FOR .*
 OFFSET[ 	]+TYPE[ 	]+VALUE.*
-0+00[ 	]+[a-zA-Z0-9_]+[ 	]+r1
+0+00[ 	]+[a-zA-Z0-9_]+[ 	]+foo1
diff --git a/gas/testsuite/gas/macros/test3.s b/gas/testsuite/gas/macros/test3.s
index c6410ae..e80aa20 100644
--- a/gas/testsuite/gas/macros/test3.s
+++ b/gas/testsuite/gas/macros/test3.s
@@ -4,4 +4,4 @@
 	\arg2
 	.endm
 
-	m	".long r1",.garbage
+	m	".long foo1",.garbage
diff --git a/gas/testsuite/gas/mcore/allinsn.d b/gas/testsuite/gas/mcore/allinsn.d
index 913d8f5..ea4cedc 100644
--- a/gas/testsuite/gas/mcore/allinsn.d
+++ b/gas/testsuite/gas/mcore/allinsn.d
@@ -7,394 +7,393 @@
 Disassembly of section .text:
 
 0+000 <abs>:
-   0:	01 e0       	abs	r0
+   0:	01e0      	abs	r0
 
 0+002 <addc>:
-   2:	06 21       	addc	r1, r2
+   2:	0621      	addc	r1, r2
 
 0+004 <addi>:
-   4:	20 03       	addi	r3, 1
+   4:	2003      	addi	r3, 1
 
 0+006 <addu>:
-   6:	1c 54       	addu	r4, r5
+   6:	1c54      	addu	r4, r5
 
 0+008 <and>:
-   8:	16 76       	and	r6, r7
+   8:	1676      	and	r6, r7
 
 0+00a <andi>:
-   a:	2e 28       	andi	r8, 2
+   a:	2e28      	andi	r8, 2
 
 0+00c <andn>:
-   c:	1f a9       	andn	r9, r10
+   c:	1fa9      	andn	r9, r10
 
 0+00e <asr>:
-   e:	1a cb       	asr	r11, r12
+   e:	1acb      	asr	r11, r12
 
 0+010 <asrc>:
-  10:	3a 0d       	asrc	r13
+  10:	3a0d      	asrc	r13
 
 0+012 <asri>:
-  12:	3b fe       	asri	r14, 31
+  12:	3bfe      	asri	r14, 31
 
 0+014 <bclri>:
-  14:	30 0f       	bclri	r15, 0
+  14:	300f      	bclri	r15, 0
 
 0+016 <bf>:
-  16:	ef f4       	bf	0x0
+  16:	eff4      	bf	0x0
 
 0+018 <bgeni>:
-  18:	32 70       	bgeni	r0, 7
+  18:	3270      	bgeni	r0, 7
 
 0+01a <BGENI>:
-  1a:	32 80       	bgeni	r0, 8
+  1a:	3280      	bgeni	r0, 8
 
 0+01c <BGENi>:
-  1c:	33 f0       	bgeni	r0, 31
+  1c:	33f0      	bgeni	r0, 31
 
 0+01e <bgenr>:
-  1e:	13 21       	bgenr	r1, r2
+  1e:	1321      	bgenr	r1, r2
 
 0+020 <bkpt>:
 	...
 
 0+022 <bmaski>:
-  22:	2c 83       	bmaski	r3, 8
+  22:	2c83      	bmaski	r3, 8
 
 0+024 <BMASKI>:
-  24:	2d f3       	bmaski	r3, 31
+  24:	2df3      	bmaski	r3, 31
 
 0+026 <br>:
-  26:	f7 ff       	br	0x26
+  26:	f7ff      	br	0x26
 
 0+028 <brev>:
-  28:	00 f4       	brev	r4
+  28:	00f4      	brev	r4
 
 0+02a <bseti>:
-  2a:	35 e5       	bseti	r5, 30
+  2a:	35e5      	bseti	r5, 30
 
 0+02c <bsr>:
-  2c:	ff e9       	bsr	0x0
+  2c:	ffe9      	bsr	0x0
 
 0+02e <bt>:
-  2e:	e7 e8       	bt	0x0
+  2e:	e7e8      	bt	0x0
 
 0+030 <btsti>:
-  30:	37 b6       	btsti	r6, 27
+  30:	37b6      	btsti	r6, 27
 
 0+032 <clrc>:
-  32:	0f 00       	cmpne	r0, r0
+  32:	0f00      	cmpne	r0, r0
 
 0+034 <clrf>:
-  34:	01 d7       	clrf	r7
+  34:	01d7      	clrf	r7
 
 0+036 <clrt>:
-  36:	01 c8       	clrt	r8
+  36:	01c8      	clrt	r8
 
 0+038 <cmphs>:
-  38:	0c a9       	cmphs	r9, r10
+  38:	0ca9      	cmphs	r9, r10
 
 0+03a <cmplt>:
-  3a:	0d cb       	cmplt	r11, r12
+  3a:	0dcb      	cmplt	r11, r12
 
 0+03c <cmplei>:
-  3c:	22 eb       	cmplti	r11, 15
+  3c:	22eb      	cmplti	r11, 15
 
 0+03e <cmplti>:
-  3e:	23 fd       	cmplti	r13, 32
+  3e:	23fd      	cmplti	r13, 32
 
 0+040 <cmpne>:
-  40:	0f fe       	cmpne	r14, r15
+  40:	0ffe      	cmpne	r14, r15
 
 0+042 <cmpnei>:
-  42:	2a 00       	cmpnei	r0, 0
+  42:	2a00      	cmpnei	r0, 0
 
 0+044 <decf>:
-  44:	00 91       	decf	r1
+  44:	0091      	decf	r1
 
 0+046 <decgt>:
-  46:	01 a2       	decgt	r2
+  46:	01a2      	decgt	r2
 
 0+048 <declt>:
-  48:	01 83       	declt	r3
+  48:	0183      	declt	r3
 
 0+04a <decne>:
-  4a:	01 b4       	decne	r4
+  4a:	01b4      	decne	r4
 
 0+04c <dect>:
-  4c:	00 85       	dect	r5
+  4c:	0085      	dect	r5
 
 0+04e <divs>:
-  4e:	32 16       	divs	r6, r1
+  4e:	3216      	divs	r6, r1
 
 0+050 <divu>:
-  50:	2c 18       	divu	r8, r1
+  50:	2c18      	divu	r8, r1
 
 0+052 <doze>:
-  52:	00 06       	doze
+  52:	0006      	doze
 
 0+054 <ff1>:
-  54:	00 ea       	ff1	r10
+  54:	00ea      	ff1	r10
 
 0+056 <incf>:
-  56:	00 bb       	incf	r11
+  56:	00bb      	incf	r11
 
 0+058 <inct>:
-  58:	00 ac       	inct	r12
+  58:	00ac      	inct	r12
 
 0+05a <ixh>:
-  5a:	1d ed       	ixh	r13, r14
+  5a:	1ded      	ixh	r13, r14
 
 0+05c <ixw>:
-  5c:	15 0f       	ixw	r15, r0
+  5c:	150f      	ixw	r15, r0
 
 0+05e <jbf>:
-  5e:	ef d0       	bf	0x0
+  5e:	efd0      	bf	0x0
 
 0+060 <jbr>:
-  60:	f0 0e       	br	0x7e
+  60:	f00e      	br	0x7e
 
 0+062 <jbsr>:
-  62:	7f 0a       	jsri	0x.*
+  62:	7f0a      	jsri	0x.*
 
 0+064 <jbt>:
-  64:	e0 0c       	bt	0x7e
+  64:	e00c      	bt	0x7e
 
 0+066 <jmp>:
-  66:	00 c1       	jmp	r1
+  66:	00c1      	jmp	r1
 
 0+068 <jmpi>:
-  68:	70 09       	jmpi	0x.*
+  68:	7009      	jmpi	0x.*
 
 0+06a <jsr>:
-  6a:	00 d2       	jsr	r2
+  6a:	00d2      	jsr	r2
 
 0+06c <jsri>:
-  6c:	7f 08       	jsri	0x.*
+  6c:	7f08      	jsri	0x.*
 
 0+06e <ld.b>:
-  6e:	a3 04       	ldb	r3, \(r4, 0\)
+  6e:	a304      	ldb	r3, \(r4, 0\)
 
 0+070 <ld.h>:
-  70:	c5 16       	ldh	r5, \(r6, 2\)
+  70:	c516      	ldh	r5, \(r6, 2\)
 
 0+072 <ld.w>:
-  72:	87 18       	ld	r7, \(r8, 4\)
+  72:	8718      	ld	r7, \(r8, 4\)
 
 0+074 <ldb>:
-  74:	a9 fa       	ldb	r9, \(r10, 15\)
+  74:	a9fa      	ldb	r9, \(r10, 15\)
 
 0+076 <ldh>:
-  76:	cb fc       	ldh	r11, \(r12, 30\)
+  76:	cbfc      	ldh	r11, \(r12, 30\)
 
 0+078 <ld>:
-  78:	8d 5e       	ld	r13, \(r14, 20\)
+  78:	8d5e      	ld	r13, \(r14, 20\)
 
 0+07a <ldw>:
-  7a:	8d fe       	ld	r13, \(r14, 60\)
+  7a:	8dfe      	ld	r13, \(r14, 60\)
 
 0+07c <ldm>:
-  7c:	00 62       	ldm	r2-r15, \(r0\)
+  7c:	0062      	ldm	r2-r15, \(r0\)
 
 0+07e <fooloop>:
-  7e:	00 41       	ldq	r4-r7, \(r1\)
+  7e:	0041      	ldq	r4-r7, \(r1\)
 
 0+080 <loopt>:
-  80:	04 8e       	loopt	r8, 0x64
+  80:	048e      	loopt	r8, 0x64
 
 0+082 <LRW>:
-  82:	79 03       	lrw	r9, 0x.*
+  82:	7903      	lrw	r9, 0x.*
 
 0+084 <lrw>:
-  84:	79 04       	lrw	r9, 0x4321
+  84:	7904      	lrw	r9, 0x4321
 
 0+086 <foolit>:
-  86:	12 34       	mov	r4, r3
+  86:	1234      	mov	r4, r3
 
 0+088 <lsl>:
-  88:	1b ba       	lsl	r10, r11
+  88:	1bba      	lsl	r10, r11
 
 0+08a <lslc>:
-  8a:	3c 0c       	lslc	r12
+  8a:	3c0c      	lslc	r12
 
-0+08c <.XP0001>:
 	...
 			8c: ADDR32	.text
 			90: ADDR32	.text.*
-  94:	00 00       	bkpt
-  96:	43 21       	.word 0x4321
+  94:	0000      	bkpt
+  96:	4321      	.short 0x4321
 
 0+098 <lsli>:
-  98:	3d fd       	lsli	r13, 31
+  98:	3dfd      	lsli	r13, 31
 
 0+09a <lsr>:
-  9a:	0b fe       	lsr	r14, r15
+  9a:	0bfe      	lsr	r14, r15
 
 0+09c <lsrc>:
-  9c:	3e 00       	lsrc	r0
+  9c:	3e00      	lsrc	r0
 
 0+09e <lsri>:
-  9e:	3e 11       	lsri	r1, 1
+  9e:	3e11      	lsri	r1, 1
 
 0+0a0 <mclri>:
-  a0:	30 64       	bclri	r4, 6
+  a0:	3064      	bclri	r4, 6
 
 0+0a2 <mfcr>:
-  a2:	10 02       	mfcr	r2, psr
+  a2:	1002      	mfcr	r2, psr
 
 0+0a4 <mov>:
-  a4:	12 43       	mov	r3, r4
+  a4:	1243      	mov	r3, r4
 
 0+0a6 <movf>:
-  a6:	0a 65       	movf	r5, r6
+  a6:	0a65      	movf	r5, r6
 
 0+0a8 <movi>:
-  a8:	67 f7       	movi	r7, 127
+  a8:	67f7      	movi	r7, 127
 
 0+0aa <movt>:
-  aa:	02 98       	movt	r8, r9
+  aa:	0298      	movt	r8, r9
 
 0+0ac <mtcr>:
-  ac:	18 0a       	mtcr	r10, psr
+  ac:	180a      	mtcr	r10, psr
 
 0+0ae <mult>:
-  ae:	03 cb       	mult	r11, r12
+  ae:	03cb      	mult	r11, r12
 
 0+0b0 <mvc>:
-  b0:	00 2d       	mvc	r13
+  b0:	002d      	mvc	r13
 
 0+0b2 <mvcv>:
-  b2:	00 3e       	mvcv	r14
+  b2:	003e      	mvcv	r14
 
 0+0b4 <neg>:
-  b4:	28 02       	rsubi	r2, 0
+  b4:	2802      	rsubi	r2, 0
 
 0+0b6 <not>:
-  b6:	01 ff       	not	r15
+  b6:	01ff      	not	r15
 
 0+0b8 <or>:
-  b8:	1e 10       	or	r0, r1
+  b8:	1e10      	or	r0, r1
 
 0+0ba <rfi>:
-  ba:	00 03       	rfi
+  ba:	0003      	rfi
 
 0+0bc <rolc>:
-  bc:	06 66       	addc	r6, r6
+  bc:	0666      	addc	r6, r6
 
 0+0be <rori>:
-  be:	39 a9       	rotli	r9, 26
+  be:	39a9      	rotli	r9, 26
 
 0+0c0 <rotlc>:
-  c0:	06 66       	addc	r6, r6
+  c0:	0666      	addc	r6, r6
 
 0+0c2 <rotli>:
-  c2:	38 a2       	rotli	r2, 10
+  c2:	38a2      	rotli	r2, 10
 
 0+0c4 <rotri>:
-  c4:	39 a9       	rotli	r9, 26
+  c4:	39a9      	rotli	r9, 26
 
 0+0c6 <rsub>:
-  c6:	14 43       	rsub	r3, r4
+  c6:	1443      	rsub	r3, r4
 
 0+0c8 <rsubi>:
-  c8:	28 05       	rsubi	r5, 0
+  c8:	2805      	rsubi	r5, 0
 
 0+0ca <rte>:
-  ca:	00 02       	rte
+  ca:	0002      	rte
 
 0+0cc <rts>:
-  cc:	00 cf       	jmp	r15
+  cc:	00cf      	jmp	r15
 
 0+0ce <setc>:
-  ce:	0c 00       	cmphs	r0, r0
+  ce:	0c00      	cmphs	r0, r0
 
 0+0d0 <sextb>:
-  d0:	01 56       	sextb	r6
+  d0:	0156      	sextb	r6
 
 0+0d2 <sexth>:
-  d2:	01 77       	sexth	r7
+  d2:	0177      	sexth	r7
 
 0+0d4 <st.b>:
-  d4:	b8 09       	stb	r8, \(r9, 0\)
+  d4:	b809      	stb	r8, \(r9, 0\)
 
 0+0d6 <st.h>:
-  d6:	da 1b       	sth	r10, \(r11, 2\)
+  d6:	da1b      	sth	r10, \(r11, 2\)
 
 0+0d8 <st.w>:
-  d8:	9c 1d       	st	r12, \(r13, 4\)
+  d8:	9c1d      	st	r12, \(r13, 4\)
 
 0+0da <stb>:
-  da:	be ff       	stb	r14, \(r15, 15\)
+  da:	beff      	stb	r14, \(r15, 15\)
 
 0+0dc <sth>:
-  dc:	d0 f1       	sth	r0, \(r1, 30\)
+  dc:	d0f1      	sth	r0, \(r1, 30\)
 
 0+0de <stw>:
-  de:	92 f3       	st	r2, \(r3, 60\)
+  de:	92f3      	st	r2, \(r3, 60\)
 
 0+0e0 <st>:
-  e0:	94 05       	st	r4, \(r5, 0\)
+  e0:	9405      	st	r4, \(r5, 0\)
 
 0+0e2 <stm>:
-  e2:	00 7e       	stm	r14-r15, \(r0\)
+  e2:	007e      	stm	r14-r15, \(r0\)
 
 0+0e4 <stop>:
-  e4:	00 04       	stop
+  e4:	0004      	stop
 
 0+0e6 <stq>:
-  e6:	00 51       	stq	r4-r7, \(r1\)
+  e6:	0051      	stq	r4-r7, \(r1\)
 
 0+0e8 <subc>:
-  e8:	07 d7       	subc	r7, r13
+  e8:	07d7      	subc	r7, r13
 
 0+0ea <subi>:
-  ea:	25 fe       	subi	r14, 32
+  ea:	25fe      	subi	r14, 32
 
 0+0ec <subu>:
-  ec:	05 39       	subu	r9, r3
+  ec:	0539      	subu	r9, r3
 
 0+0ee <sync>:
-  ee:	00 01       	sync
+  ee:	0001      	sync
 
 0+0f0 <tstlt>:
-  f0:	37 f5       	btsti	r5, 31
+  f0:	37f5      	btsti	r5, 31
 
 0+0f2 <tstne>:
-  f2:	2a 07       	cmpnei	r7, 0
+  f2:	2a07      	cmpnei	r7, 0
 
 0+0f4 <trap>:
-  f4:	00 0a       	trap	2
+  f4:	000a      	trap	2
 
 0+0f6 <tst>:
-  f6:	0e ee       	tst	r14, r14
+  f6:	0eee      	tst	r14, r14
 
 0+0f8 <tstnbz>:
-  f8:	01 92       	tstnbz	r2
+  f8:	0192      	tstnbz	r2
 
 0+0fa <wait>:
-  fa:	00 05       	wait
+  fa:	0005      	wait
 
 0+0fc <xor>:
-  fc:	17 0f       	xor	r15, r0
+  fc:	170f      	xor	r15, r0
 
 0+0fe <xsr>:
-  fe:	38 0b       	xsr	r11
+  fe:	380b      	xsr	r11
 
 0+0100 <xtrb0>:
- 100:	01 31       	xtrb0	r1, r1
+ 100:	0131      	xtrb0	r1, r1
 
 0+0102 <xtrb1>:
- 102:	01 22       	xtrb1	r1, r2
+ 102:	0122      	xtrb1	r1, r2
 
 0+0104 <xtrb2>:
- 104:	01 10       	xtrb2	r1, r0
+ 104:	0110      	xtrb2	r1, r0
 
 0+0106 <xtrb3>:
- 106:	01 0d       	xtrb3	r1, r13
+ 106:	010d      	xtrb3	r1, r13
 
 0+0108 <zextb>:
- 108:	01 48       	zextb	r8
+ 108:	0148      	zextb	r8
 
 0+010a <zexth>:
- 10a:	01 64       	zexth	r4
- 10c:	0f 00       	cmpne	r0, r0
- 10e:	0f 00       	cmpne	r0, r0
+ 10a:	0164      	zexth	r4
+ 10c:	0f00      	cmpne	r0, r0
+ 10e:	0f00      	cmpne	r0, r0
diff --git a/gas/testsuite/gas/mips/e32-rel2.d b/gas/testsuite/gas/mips/e32-rel2.d
new file mode 100644
index 0000000..cc49416
--- /dev/null
+++ b/gas/testsuite/gas/mips/e32-rel2.d
@@ -0,0 +1,30 @@
+#objdump: -sr -j .text
+#name: MIPS ELF reloc 2 (32-bit)
+#source: elf-rel2.s
+
+# Test the GPREL and LITERAL generation.
+# FIXME: really this should check that the contents of .sdata, .lit4,
+# and .lit8 are correct too.
+
+.*:     file format elf.*mips
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET           TYPE              VALUE 
+0+0000000 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000004 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000008 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+000000c R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000010 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000014 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000018 R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+000001c R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+0000020 R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+0000024 R_MIPS_GPREL16    \.sdata\+0x0+0004000
+0+0000028 R_MIPS_GPREL16    \.sdata\+0x0+0004000
+0+000002c R_MIPS_GPREL16    \.sdata\+0x0+0004000
+
+
+Contents of section \.text:
+ 0000 c783c000 c782c004 c783c008 c782c00c  .*
+ 0010 c783c010 c782c014 c782c000 c782c004  .*
+ 0020 c782c008 8f82c000 8f82c004 8f82c008  .*
diff --git a/gas/testsuite/gas/mips/elf-rel.d b/gas/testsuite/gas/mips/elf-rel.d
new file mode 100644
index 0000000..c80bdd3
--- /dev/null
+++ b/gas/testsuite/gas/mips/elf-rel.d
@@ -0,0 +1,42 @@
+#objdump: -sr -j .text
+#name: MIPS ELF reloc
+
+# Test the HI16/LO16 generation.
+
+.*:     file format elf.*mips
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET           TYPE              VALUE 
+0+0000000 R_MIPS_HI16       \.text
+0+0000018 R_MIPS_LO16       \.text
+0+000000c R_MIPS_HI16       \.text
+0+000001c R_MIPS_LO16       \.text
+0+0000008 R_MIPS_HI16       \.text
+0+0000020 R_MIPS_LO16       \.text
+0+0000004 R_MIPS_HI16       \.text
+0+0000024 R_MIPS_LO16       \.text
+0+0000014 R_MIPS_HI16       \.text
+0+0000028 R_MIPS_LO16       \.text
+0+0000010 R_MIPS_HI16       \.text
+0+000002c R_MIPS_LO16       \.text
+0+0000030 R_MIPS_HI16       \.text
+0+0000048 R_MIPS_LO16       \.text
+0+0000034 R_MIPS_HI16       \.text
+0+000004c R_MIPS_LO16       \.text
+0+0000038 R_MIPS_HI16       \.text
+0+0000050 R_MIPS_LO16       \.text
+0+000003c R_MIPS_HI16       \.text
+0+0000054 R_MIPS_LO16       \.text
+0+0000044 R_MIPS_HI16       \.text
+0+0000058 R_MIPS_LO16       \.text
+0+0000040 R_MIPS_HI16       \.text
+0+000005c R_MIPS_LO16       \.text
+
+
+Contents of section \.text:
+ 0000 3c010000 3c010000 3c010001 3c010001  .*
+ 0010 3c010000 3c010001 20210018 2021001c  .*
+ 0020 20210018 2021001c 20218018 2021fffc  .*
+ 0030 3c010001 3c010001 3c010002 3c010002  .*
+ 0040 3c010001 3c010001 2021bffe 2021c002  .*
+ 0050 2021bffe 2021c002 20213ffe 2021bffa  .*
diff --git a/gas/testsuite/gas/mips/elf-rel.s b/gas/testsuite/gas/mips/elf-rel.s
new file mode 100644
index 0000000..4085342
--- /dev/null
+++ b/gas/testsuite/gas/mips/elf-rel.s
@@ -0,0 +1,33 @@
+	.text
+	.align 15
+l0:
+l2	= l0+49150
+
+	.set	noat
+	.set	noreorder
+	lui	$at,%hi(l1)
+	lui	$at,%hi(l1+4)
+	lui	$at,%hi(l1+0x10000)
+	lui	$at,%hi(l1+0x10004)
+	lui	$at,%hi(l0-4)
+	lui	$at,%hi(l1+0x8000)
+l1:		
+	addi	$at,$at,%lo(l1)
+	addi	$at,$at,%lo(l1+0x10004)
+	addi	$at,$at,%lo(l1+0x10000)
+	addi	$at,$at,%lo(l1+4)
+	addi	$at,$at,%lo(l1+0x8000)
+	addi	$at,$at,%lo(l0-4)
+
+	lui	$at,%hi(l2)
+	lui	$at,%hi(l2+4)
+	lui	$at,%hi(l2+0x10000)
+	lui	$at,%hi(l2+0x10004)
+	lui	$at,%hi(l2-4)
+	lui	$at,%hi(l2+0x8000)
+	addi	$at,$at,%lo(l2)
+	addi	$at,$at,%lo(l2+4)
+	addi	$at,$at,%lo(l2+0x10000)
+	addi	$at,$at,%lo(l2+0x10004)
+	addi	$at,$at,%lo(l2+0x8000)
+	addi	$at,$at,%lo(l2-4)
diff --git a/gas/testsuite/gas/mips/elf-rel2.d b/gas/testsuite/gas/mips/elf-rel2.d
new file mode 100644
index 0000000..a20facf
--- /dev/null
+++ b/gas/testsuite/gas/mips/elf-rel2.d
@@ -0,0 +1,26 @@
+#objdump: -sr -j .text
+#name: MIPS ELF reloc 2
+
+# Test the GPREL and LITERAL generation.
+# FIXME: really this should check that the contents of .sdata, .lit4,
+# and .lit8 are correct too.
+
+.*:     file format elf.*mips
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET           TYPE              VALUE 
+0+0000000 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000004 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+0000008 R_MIPS_LITERAL    \.lit8\+0x0+0004000
+0+000000c R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+0000010 R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+0000014 R_MIPS_LITERAL    \.lit4\+0x0+0004000
+0+0000018 R_MIPS_GPREL16    \.sdata\+0x0+0004000
+0+000001c R_MIPS_GPREL16    \.sdata\+0x0+0004000
+0+0000020 R_MIPS_GPREL16    \.sdata\+0x0+0004000
+
+
+Contents of section \.text:
+ 0000 d782c000 d782c008 d782c010 c782c000  .*
+ 0010 c782c004 c782c008 8f82c000 8f82c004  .*
+ 0020 8f82c008                             .*
diff --git a/gas/testsuite/gas/mips/elf-rel2.s b/gas/testsuite/gas/mips/elf-rel2.s
new file mode 100644
index 0000000..27812ca
--- /dev/null
+++ b/gas/testsuite/gas/mips/elf-rel2.s
@@ -0,0 +1,29 @@
+	.sdata
+	.align 2
+	.type w1,@object
+	.size w1,4
+w1:	.word	1
+	.type w2,@object
+	.size w2,4
+w2:	.word	2
+	.type w3,@object
+	.size w3,4
+w3:	.word	3
+	
+	.text
+	.align 2
+l0:
+	.set	noreorder
+
+        li.d    $f2,1.10000000000000000000e0
+        li.d    $f2,2.10000000000000000000e0
+        li.d    $f2,3.10000000000000000000e0
+        li.s    $f2,1.10000000000000000000e0
+        li.s    $f2,2.10000000000000000000e0
+        li.s    $f2,3.10000000000000000000e0
+
+	.set	nomacro
+	
+	lw	$2,w1
+	lw	$2,w2
+	lw	$2,w3
diff --git a/gas/testsuite/gas/mips/elf_e_flags.c b/gas/testsuite/gas/mips/elf_e_flags.c
index 17fb111..7615f9c 100644
--- a/gas/testsuite/gas/mips/elf_e_flags.c
+++ b/gas/testsuite/gas/mips/elf_e_flags.c
@@ -9,7 +9,11 @@
    We use the -m4650 flag to get the 4650-specific 'mul' instruction
    in there; the test suite wants to be sure that GAS's -m4650 flag
    will indeed cause it to generate the 4650 mul instruction, and not
-   expand it as a macro.  */
+   expand it as a macro.
+
+   Ian 10 June 1999: I tweaked the resulting assembler file so that it
+   would generate the same code when gas was configured for mips-elf
+   and for mips64-elf.  */
 
 int
 foo (int a, int b)
diff --git a/gas/testsuite/gas/mips/elf_e_flags.s b/gas/testsuite/gas/mips/elf_e_flags.s
index 5fc32ea..1eca8c4 100644
--- a/gas/testsuite/gas/mips/elf_e_flags.s
+++ b/gas/testsuite/gas/mips/elf_e_flags.s
@@ -28,11 +28,11 @@
 	.mask	0x80000000,-8
 	.fmask	0x00000000,0
 	subu	$sp,$sp,40
-	sd	$31,32($sp)
+	sw	$31,32($sp)
 	jal	__gccmain
 	move	$2,$0
-	ld	$31,32($sp)
-	#nop
+	lw	$31,32($sp)
+	nop
 	.set	noreorder
 	.set	nomacro
 	j	$31
diff --git a/gas/testsuite/gas/mips/elf_e_flags1.d b/gas/testsuite/gas/mips/elf_e_flags1.d
index 6faa7c1..a0aa2f1 100644
--- a/gas/testsuite/gas/mips/elf_e_flags1.d
+++ b/gas/testsuite/gas/mips/elf_e_flags1.d
@@ -3,7 +3,7 @@
 # objdump: -fd
 
 .*:.*file format.*mips.*
-architecture: mips:4000, flags 0x00000011:
+architecture: mips:[34][0-9]00, flags 0x00000011:
 HAS_RELOC, HAS_SYMS
 start address 0x0000000000000000
 
@@ -17,10 +17,11 @@
 
 0000000000000010 <main>:
   10:	27bdffd8 	addiu	\$sp,\$sp,-40
-  14:	ffbf0020 	sd	\$ra,32\(\$sp\)
+  14:	afbf0020 	sw	\$ra,32\(\$sp\)
   18:	0c000000 	jal	0 <foo>
   1c:	00000000 	nop
-  20:	0000102d 	move	\$v0,\$zero
-  24:	dfbf0020 	ld	\$ra,32\(\$sp\)
-  28:	03e00008 	jr	\$ra
-  2c:	27bd0028 	addiu	\$sp,\$sp,40
+  20:	0000102[1d] 	move	\$v0,\$zero
+  24:	8fbf0020 	lw	\$ra,32\(\$sp\)
+  28:	00000000 	nop
+  2c:	03e00008 	jr	\$ra
+  30:	27bd0028 	addiu	\$sp,\$sp,40
diff --git a/gas/testsuite/gas/mips/elf_e_flags2.d b/gas/testsuite/gas/mips/elf_e_flags2.d
index 50661c2..e313bd3 100644
--- a/gas/testsuite/gas/mips/elf_e_flags2.d
+++ b/gas/testsuite/gas/mips/elf_e_flags2.d
@@ -17,10 +17,11 @@
 
 000000000000000c <main>:
    c:	27bdffd8 	addiu	\$sp,\$sp,-40
-  10:	ffbf0020 	sd	\$ra,32\(\$sp\)
+  10:	afbf0020 	sw	\$ra,32\(\$sp\)
   14:	0c000000 	jal	0 <foo>
   18:	00000000 	nop
   1c:	0000102d 	move	\$v0,\$zero
-  20:	dfbf0020 	ld	\$ra,32\(\$sp\)
-  24:	03e00008 	jr	\$ra
-  28:	27bd0028 	addiu	\$sp,\$sp,40
+  20:	8fbf0020 	lw	\$ra,32\(\$sp\)
+  24:	00000000 	nop
+  28:	03e00008 	jr	\$ra
+  2c:	27bd0028 	addiu	\$sp,\$sp,40
diff --git a/gas/testsuite/gas/mips/elf_e_flags3.d b/gas/testsuite/gas/mips/elf_e_flags3.d
index aacc49e..9813491 100644
--- a/gas/testsuite/gas/mips/elf_e_flags3.d
+++ b/gas/testsuite/gas/mips/elf_e_flags3.d
@@ -17,10 +17,11 @@
 
 000000000000000c <main>:
    c:	27bdffd8 	addiu	\$sp,\$sp,-40
-  10:	ffbf0020 	sd	\$ra,32\(\$sp\)
+  10:	afbf0020 	sw	\$ra,32\(\$sp\)
   14:	0c000000 	jal	0 <foo>
   18:	00000000 	nop
   1c:	0000102d 	move	\$v0,\$zero
-  20:	dfbf0020 	ld	\$ra,32\(\$sp\)
-  24:	03e00008 	jr	\$ra
-  28:	27bd0028 	addiu	\$sp,\$sp,40
+  20:	8fbf0020 	lw	\$ra,32\(\$sp\)
+  24:	00000000 	nop
+  28:	03e00008 	jr	\$ra
+  2c:	27bd0028 	addiu	\$sp,\$sp,40
diff --git a/gas/testsuite/gas/mips/elf_e_flags4.d b/gas/testsuite/gas/mips/elf_e_flags4.d
index 5eb7050..833eba0 100644
--- a/gas/testsuite/gas/mips/elf_e_flags4.d
+++ b/gas/testsuite/gas/mips/elf_e_flags4.d
@@ -17,10 +17,11 @@
 
 000000000000000c <main>:
    c:	27bdffd8 	addiu	\$sp,\$sp,-40
-  10:	ffbf0020 	sd	\$ra,32\(\$sp\)
+  10:	afbf0020 	sw	\$ra,32\(\$sp\)
   14:	0c000000 	jal	0 <foo>
   18:	00000000 	nop
   1c:	0000102d 	move	\$v0,\$zero
-  20:	dfbf0020 	ld	\$ra,32\(\$sp\)
-  24:	03e00008 	jr	\$ra
-  28:	27bd0028 	addiu	\$sp,\$sp,40
+  20:	8fbf0020 	lw	\$ra,32\(\$sp\)
+  24:	00000000 	nop
+  28:	03e00008 	jr	\$ra
+  2c:	27bd0028 	addiu	\$sp,\$sp,40
diff --git a/gas/testsuite/gas/mips/empic.d b/gas/testsuite/gas/mips/empic.d
new file mode 100644
index 0000000..3c6b4d4
--- /dev/null
+++ b/gas/testsuite/gas/mips/empic.d
@@ -0,0 +1,155 @@
+#objdump: -rst -mmips:4000
+#name: MIPS empic
+#as: -membedded-pic -mips3
+
+# Check GNU-specific embedded relocs, for ELF.
+
+.*: +file format elf.*mips.*
+
+SYMBOL TABLE:
+0+0000000 l    d  \.text	0+0000000 
+0+0000000 l    d  \.data	0+0000000 
+0+0000000 l    d  \.bss	0+0000000 
+0+0000000 l    d  \.foo	0+0000000 
+0+0000000 l    d  \.reginfo	0+0000000 
+0+0000000 l    d  \.mdebug	0+0000000 
+0+0000004 l       \.text	0+0000000 l2
+0+0000000         \*UND\*	0+0000000 g1
+0+0000000         \*UND\*	0+0000000 g2
+0+0000100 l       \.foo	0+0000000 l1
+0+0000034 l       \.text	0+0000000 l3
+0+0000098 l       \.text	0+0000000 l5
+0+0000004 l       \.foo	0+0000000 l4
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET           TYPE              VALUE 
+0+0000004 R_MIPS_GNU_REL16_S2  g1
+0+000000c R_MIPS_GNU_REL16_S2  g2
+0+0000014 R_MIPS_GNU_REL16_S2  g2
+0+000001c R_MIPS_GNU_REL16_S2  \.foo
+0+0000024 R_MIPS_GNU_REL16_S2  \.text
+0+000002c R_MIPS_GNU_REL16_S2  \.foo
+0+0000034 R_MIPS_GNU_REL16_S2  \.text
+0+000003c R_MIPS_GNU_REL_HI16  g1
+0+0000040 R_MIPS_GNU_REL_LO16  g1
+0+0000044 R_MIPS_GNU_REL_HI16  \.foo
+0+0000048 R_MIPS_GNU_REL_LO16  \.foo
+0+0000050 R_MIPS_32         g1
+0+0000054 R_MIPS_32         \.foo
+0+0000058 R_MIPS_32         \.text
+0+000005c R_MIPS_PC32       g1
+0+0000060 R_MIPS_PC32       \.foo
+0+0000068 R_MIPS_64         g1
+0+0000070 R_MIPS_64         \.foo
+0+0000078 R_MIPS_64         \.text
+0+0000080 R_MIPS_PC64       g1
+0+0000088 R_MIPS_PC64       \.foo
+0+0000098 R_MIPS_GNU_REL16_S2  \.text
+0+000009c R_MIPS_GNU_REL16_S2  \.text
+0+00000a0 R_MIPS_GNU_REL_HI16  \.text
+0+00000a4 R_MIPS_GNU_REL_LO16  \.text
+0+00000a8 R_MIPS_GNU_REL_HI16  \.text
+0+00000ac R_MIPS_GNU_REL_LO16  \.text
+0+00000b0 R_MIPS_32         \.text
+0+00000b8 R_MIPS_64         \.text
+0+00000cc R_MIPS_GNU_REL16_S2  \.text
+0+00000d0 R_MIPS_GNU_REL16_S2  \.text
+0+00000d4 R_MIPS_GNU_REL_HI16  \.text
+0+00000d8 R_MIPS_GNU_REL_LO16  \.text
+0+00000dc R_MIPS_GNU_REL_HI16  \.text
+0+00000e0 R_MIPS_GNU_REL_LO16  \.text
+0+00000e4 R_MIPS_32         \.text
+0+00000f0 R_MIPS_64         \.text
+
+
+RELOCATION RECORDS FOR \[\.foo\]:
+OFFSET           TYPE              VALUE 
+0+0000004 R_MIPS_GNU_REL_HI16  g1
+0+0000008 R_MIPS_GNU_REL_LO16  g1
+0+000000c R_MIPS_GNU_REL_HI16  \.foo
+0+0000010 R_MIPS_GNU_REL_LO16  \.foo
+0+0000014 R_MIPS_GNU_REL_HI16  \.text
+0+0000018 R_MIPS_GNU_REL_LO16  \.text
+0+000001c R_MIPS_GNU_REL_HI16  g1
+0+0000020 R_MIPS_GNU_REL_LO16  g1
+0+0000024 R_MIPS_GNU_REL_HI16  g1
+0+0000028 R_MIPS_GNU_REL_LO16  g1
+0+000002c R_MIPS_GNU_REL_HI16  \.foo
+0+0000030 R_MIPS_GNU_REL_LO16  \.foo
+0+0000034 R_MIPS_GNU_REL_HI16  \.text
+0+0000038 R_MIPS_GNU_REL_LO16  \.text
+0+000003c R_MIPS_32         g1
+0+0000040 R_MIPS_32         \.foo
+0+0000044 R_MIPS_32         \.text
+0+0000048 R_MIPS_PC32       g1
+0+0000050 R_MIPS_PC32       \.text
+0+0000058 R_MIPS_64         g1
+0+0000060 R_MIPS_64         \.foo
+0+0000068 R_MIPS_64         \.text
+0+0000070 R_MIPS_PC64       g1
+0+0000080 R_MIPS_PC64       \.text
+0+0000088 R_MIPS_GNU_REL_HI16  g1
+0+000008c R_MIPS_GNU_REL_LO16  g1
+0+0000090 R_MIPS_GNU_REL_HI16  \.foo
+0+0000094 R_MIPS_GNU_REL_LO16  \.foo
+0+0000098 R_MIPS_GNU_REL_HI16  \.text
+0+000009c R_MIPS_GNU_REL_LO16  \.text
+0+00000a0 R_MIPS_GNU_REL_HI16  g1
+0+00000a4 R_MIPS_GNU_REL_LO16  g1
+0+00000a8 R_MIPS_GNU_REL_HI16  \.foo
+0+00000ac R_MIPS_GNU_REL_LO16  \.foo
+0+00000b0 R_MIPS_GNU_REL_HI16  \.text
+0+00000b4 R_MIPS_GNU_REL_LO16  \.text
+0+00000b8 R_MIPS_32         g1
+0+00000bc R_MIPS_32         \.foo
+0+00000c0 R_MIPS_32         \.text
+0+00000c4 R_MIPS_PC32       g1
+0+00000cc R_MIPS_PC32       \.text
+0+00000d0 R_MIPS_64         g1
+0+00000d8 R_MIPS_64         \.foo
+0+00000e0 R_MIPS_64         \.text
+0+00000e8 R_MIPS_PC64       g1
+0+00000f8 R_MIPS_PC64       \.text
+
+Contents of section \.text:
+ 0000 00000000 0411ffff 00000000 1000ffff  .*
+ 0010 00000000 1000ffff 00000000 0411003f  .*
+ 0020 00000000 04110000 00000000 10000041  .*
+ 0030 00000000 10000000 00000000 3c030000  .*
+ 0040 [26]463000c 3c030000 [26]4630114 2403ffd0  .*
+ 0050 00000000 00000100 00000004 00000028  .*
+ 0060 0000012c ffffffd0 00000000 00000000  .*
+ 0070 00000000 00000100 00000000 00000004  .*
+ 0080 00000000 0000004c 00000000 00000154  .*
+ 0090 ffffffff ffffffd0 10000032 10000033  .*
+ 00a0 3c030000 [26]46300d8 3c030000 [26]46300e8  .*
+ 00b0 000000cc 00000034 00000000 000000cc  .*
+ 00c0 00000000 00000034 00000000 10000032  .*
+ 00d0 10000033 3c030000 [26]463010c 3c030000  .*
+ 00e0 [26]463011c 000000cc 00000034 00000000  .*
+ 00f0 00000000 000000cc 00000000 00000034  .*
+Contents of section \.data:
+Contents of section \.reginfo:
+ 0000 80000008 00000000 00000000 00000000  .*
+ 0010 00000000 00000000                    .*
+Contents of section \.mdebug:
+#...
+Contents of section \.foo:
+ 0000 00000000 3c030000 [26]4630004 3c030000  .*
+ 0010 [26]463010c 3c030000 [26]4630018 3c030000  .*
+ 0020 [26]463001c 3c030000 [26]4630024 3c030000  .*
+ 0030 [26]463012c 3c030000 [26]4630038 00000000  .*
+ 0040 00000100 00000004 00000044 000000fc  .*
+ 0050 00000050 00000000 00000000 00000000  .*
+ 0060 00000000 00000100 00000000 00000004  .*
+ 0070 00000000 0000006c 00000000 000000fc  .*
+ 0080 00000000 00000080 3c030000 [26]463008c  .*
+ 0090 3c030000 [26]4630194 3c030000 [26]46300a0  .*
+ 00a0 3c030000 [26]46300a4 3c030000 [26]46301ac  .*
+ 00b0 3c030000 [26]46300b8 00000004 00000104  .*
+ 00c0 00000008 000000c4 00000100 000000d0  .*
+ 00d0 00000000 00000004 00000000 00000104  .*
+ 00e0 00000000 00000008 00000000 000000e8  .*
+ 00f0 00000000 00000100 00000000 000000fc  .*
+ 0100 00000000                             .*
diff --git a/gas/testsuite/gas/mips/empic.s b/gas/testsuite/gas/mips/empic.s
new file mode 100644
index 0000000..2c485b3
--- /dev/null
+++ b/gas/testsuite/gas/mips/empic.s
@@ -0,0 +1,112 @@
+# Check GNU-specific embedded relocs, for ELF.
+
+	.text
+	.set noreorder
+	nop
+l2:	jal	g1		# R_MIPS_GNU_REL16_S2	g1   -1
+	nop
+	b	g2		# R_MIPS_GNU_REL16_S2	g2   -1
+	nop
+	b	g2		# R_MIPS_GNU_REL16_S2	g2   -1
+	nop
+	jal	l1		# R_MIPS_GNU_REL16_S2	.foo 3F
+	nop
+	jal	l2		# R_MIPS_GNU_REL16_S2	.text 0  or -9
+	nop
+	b	l1+8		# R_MIPS_GNU_REL16_S2	.foo 41
+	nop
+l3:
+	b	l2		# R_MIPS_GNU_REL16_S2	.text 0  or -D
+	nop
+	la	$3,g1-l3	# R_MIPS_GNU_REL_HI16   g1   0
+				# R_MIPS_GNU_REL_LO16   g1   C
+	la	$3,l1-l3	# R_MIPS_GNU_REL_HI16   .foo 0
+				# R_MIPS_GNU_REL_LO16   .foo 114
+	la	$3,l2-l3	# -30
+	.word	g1		# R_MIPS_32	g1    0
+	.word	l1		# R_MIPS_32	.foo  100
+	.word	l2		# R_MIPS_32	.text 4
+	.word	g1-l3		# R_MIPS_PC32	g1    28
+	.word	l1-l3		# R_MIPS_PC32	.foo  12C
+	.word	l2-l3		# -30
+	.align 3
+	.dword	g1		# R_MIPS_64	g1    0
+	.dword	l1		# R_MIPS_64	.foo  100
+	.dword	l2		# R_MIPS_64	.text 4
+	.dword	g1-l3		# R_MIPS_PC64	g1    4C
+	.dword	l1-l3		# R_MIPS_PC64	.foo  154
+	.dword	l2-l3		# -30
+l5:
+	b	2f		# R_MIPS_GNU_REL16_S2	.text 32
+	b	2f+4		# R_MIPS_GNU_REL16_S2	.text 33
+	la	$3,2f-l5	# R_MIPS_GNU_REL_HI16	.text 0
+				# R_MIPS_GNU_REL_HI16	.text D8
+	la	$3,2f+8-l5	# R_MIPS_GNU_REL_HI16	.text 0
+				# R_MIPS_GNU_REL_HI16	.text E8
+
+	.word	2f		# R_MIPS_32	.text CC
+	.word	2f-l5		# R_MIPS_PC32	.text EC  or 34
+	.dword	2f		# R_MIPS_64	.text CC
+	.dword	2f-l5		# R_MIPS_PC64	.text F8  or 34
+	nop
+2:				# at address 0xCC.
+	b	2b		# R_MIPS_GNU_REL16_S2	.text 32
+	b	2b+4		# R_MIPS_GNU_REL16_S2	.text 33
+	la	$3,2b-l5	# R_MIPS_GNU_REL_HI16	.text 0
+				# R_MIPS_GNU_REL_HI16	.text 10C
+	la	$3,2b+8-l5	# R_MIPS_GNU_REL_HI16	.text 0
+				# R_MIPS_GNU_REL_HI16	.text 11C
+	.word	2b		# R_MIPS_32	.text CC
+	.word	2b-l5		# R_MIPS_PC32	.text 11C  or 34
+	nop
+	.dword	2b		# R_MIPS_64	.text CC
+	.dword	2b-l5		# R_MIPS_PC64	.text 98  or 34
+	
+	.section ".foo","ax",@progbits
+	nop
+l4:	
+	la	$3,g1-l4
+	la	$3,l1-l4
+	la	$3,l2-l4
+	la	$3,g1-l4
+
+	dla	$3,g1-l4
+	dla	$3,l1-l4
+	dla	$3,l2-l4
+
+	.word	g1
+	.word	l1
+	.word	l2
+	.word	g1-l4
+	.word	l1-l4
+	.word	l2-l4
+	.dword	g1
+	.dword	l1
+	.dword	l2
+	.dword	g1-l4
+	.dword	l1-l4
+	.dword	l2-l4
+
+	la	$3,g1-l4+4
+	la	$3,l1-l4+4
+	la	$3,l2-l4+4
+
+	dla	$3,g1-l4+4
+	dla	$3,l1-l4+4
+	dla	$3,l2-l4+4
+
+	.word	g1+4
+	.word	l1+4
+	.word	l2+4
+	.word	g1-l4+4
+	.word	l1-l4+4
+	.word	l2-l4+4
+	.dword	g1+4
+	.dword	l1+4
+	.dword	l2+4
+	.dword	g1-l4+4
+	.dword	l1-l4+4
+	.dword	l2-l4+4
+l1:
+
+	nop
diff --git a/gas/testsuite/gas/mips/la-svr4pic.d b/gas/testsuite/gas/mips/la-svr4pic.d
index 4e8a3d5..f4933e7 100644
--- a/gas/testsuite/gas/mips/la-svr4pic.d
+++ b/gas/testsuite/gas/mips/la-svr4pic.d
@@ -8,467 +8,464 @@
 .*: +file format .*mips.*
 
 Disassembly of section .text:
-0+0000 <[^>]*> li	\$a0,0
-0+0004 <[^>]*> li	\$a0,1
-0+0008 <[^>]*> li	\$a0,0x8000
-0+000c <[^>]*> li	\$a0,-32768
-0+0010 <[^>]*> lui	\$a0,0x1
-0+0014 <[^>]*> lui	\$a0,0x1
-0+0018 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+001c <[^>]*> li	\$a0,0
-0+0020 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0024 <[^>]*> li	\$a0,1
-0+0028 <[^>]*> addu	\$a0,\$a0,\$a1
-0+002c <[^>]*> li	\$a0,0x8000
-0+0030 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0034 <[^>]*> li	\$a0,-32768
-0+0038 <[^>]*> addu	\$a0,\$a0,\$a1
-0+003c <[^>]*> lui	\$a0,0x1
-0+0040 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0044 <[^>]*> lui	\$a0,0x1
-0+0048 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+004c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0050 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*50: R_MIPS_GOT16	.data
-0+0054 <[^>]*> nop
-0+0058 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*58: R_MIPS_LO16	.data
-0+005c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*5c: R_MIPS_GOT16	big_external_data_label
-0+0060 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*60: R_MIPS_GOT16	small_external_data_label
-0+0064 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*64: R_MIPS_GOT16	big_external_common
-0+0068 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*68: R_MIPS_GOT16	small_external_common
-0+006c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*6c: R_MIPS_GOT16	.bss
-0+0070 <[^>]*> nop
-0+0074 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*74: R_MIPS_LO16	.bss
-0+0078 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*78: R_MIPS_GOT16	.bss
-0+007c <[^>]*> nop
-0+0080 <[^>]*> addiu	\$a0,\$a0,1000
-[ 	]*80: R_MIPS_LO16	.bss
-0+0084 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*84: R_MIPS_GOT16	.data
-0+0088 <[^>]*> nop
-0+008c <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*8c: R_MIPS_LO16	.data
-0+0090 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*90: R_MIPS_GOT16	big_external_data_label
-0+0094 <[^>]*> nop
-0+0098 <[^>]*> addiu	\$a0,\$a0,1
-0+009c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*9c: R_MIPS_GOT16	small_external_data_label
-0+00a0 <[^>]*> nop
-0+00a4 <[^>]*> addiu	\$a0,\$a0,1
-0+00a8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*a8: R_MIPS_GOT16	big_external_common
-0+00ac <[^>]*> nop
-0+00b0 <[^>]*> addiu	\$a0,\$a0,1
-0+00b4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*b4: R_MIPS_GOT16	small_external_common
-0+00b8 <[^>]*> nop
-0+00bc <[^>]*> addiu	\$a0,\$a0,1
-0+00c0 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*c0: R_MIPS_GOT16	.bss
-0+00c4 <[^>]*> nop
-0+00c8 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*c8: R_MIPS_LO16	.bss
-0+00cc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*cc: R_MIPS_GOT16	.bss
-0+00d0 <[^>]*> nop
-0+00d4 <[^>]*> addiu	\$a0,\$a0,1001
-[ 	]*d4: R_MIPS_LO16	.bss
-0+00d8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*d8: R_MIPS_GOT16	.data
-0+00dc <[^>]*> lui	\$at,0x1
-0+00e0 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*e0: R_MIPS_LO16	.data
-0+00e4 <[^>]*> addu	\$a0,\$a0,\$at
-0+00e8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*e8: R_MIPS_GOT16	big_external_data_label
-0+00ec <[^>]*> lui	\$at,0x1
-0+00f0 <[^>]*> addiu	\$at,\$at,-32768
-0+00f4 <[^>]*> addu	\$a0,\$a0,\$at
-0+00f8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*f8: R_MIPS_GOT16	small_external_data_label
-0+00fc <[^>]*> lui	\$at,0x1
-0+0100 <[^>]*> addiu	\$at,\$at,-32768
-0+0104 <[^>]*> addu	\$a0,\$a0,\$at
-0+0108 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*108: R_MIPS_GOT16	big_external_common
-0+010c <[^>]*> lui	\$at,0x1
-0+0110 <[^>]*> addiu	\$at,\$at,-32768
-0+0114 <[^>]*> addu	\$a0,\$a0,\$at
-0+0118 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*118: R_MIPS_GOT16	small_external_common
-0+011c <[^>]*> lui	\$at,0x1
-0+0120 <[^>]*> addiu	\$at,\$at,-32768
-0+0124 <[^>]*> addu	\$a0,\$a0,\$at
-0+0128 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*128: R_MIPS_GOT16	.bss
-0+012c <[^>]*> lui	\$at,0x1
-0+0130 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*130: R_MIPS_LO16	.bss
-0+0134 <[^>]*> addu	\$a0,\$a0,\$at
-0+0138 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*138: R_MIPS_GOT16	.bss
-0+013c <[^>]*> lui	\$at,0x1
-0+0140 <[^>]*> addiu	\$at,\$at,-31768
-[ 	]*140: R_MIPS_LO16	.bss
-0+0144 <[^>]*> addu	\$a0,\$a0,\$at
-0+0148 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*148: R_MIPS_GOT16	.data
-0+014c <[^>]*> nop
-0+0150 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*150: R_MIPS_LO16	.data
-0+0154 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*154: R_MIPS_GOT16	big_external_data_label
-0+0158 <[^>]*> nop
-0+015c <[^>]*> addiu	\$a0,\$a0,-32768
-0+0160 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*160: R_MIPS_GOT16	small_external_data_label
-0+0164 <[^>]*> nop
-0+0168 <[^>]*> addiu	\$a0,\$a0,-32768
-0+016c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*16c: R_MIPS_GOT16	big_external_common
-0+0170 <[^>]*> nop
-0+0174 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0178 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*178: R_MIPS_GOT16	small_external_common
-0+017c <[^>]*> nop
-0+0180 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0184 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*184: R_MIPS_GOT16	.bss
-0+0188 <[^>]*> nop
-0+018c <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*18c: R_MIPS_LO16	.bss
-0+0190 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*190: R_MIPS_GOT16	.bss
-0+0194 <[^>]*> nop
-0+0198 <[^>]*> addiu	\$a0,\$a0,-31768
-[ 	]*198: R_MIPS_LO16	.bss
-0+019c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*19c: R_MIPS_GOT16	.data
-0+01a0 <[^>]*> lui	\$at,0x1
-0+01a4 <[^>]*> addiu	\$at,\$at,0
-[ 	]*1a4: R_MIPS_LO16	.data
-0+01a8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01ac <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1ac: R_MIPS_GOT16	big_external_data_label
-0+01b0 <[^>]*> lui	\$at,0x1
-0+01b4 <[^>]*> addiu	\$at,\$at,0
-0+01b8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01bc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1bc: R_MIPS_GOT16	small_external_data_label
-0+01c0 <[^>]*> lui	\$at,0x1
-0+01c4 <[^>]*> addiu	\$at,\$at,0
-0+01c8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01cc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1cc: R_MIPS_GOT16	big_external_common
-0+01d0 <[^>]*> lui	\$at,0x1
-0+01d4 <[^>]*> addiu	\$at,\$at,0
-0+01d8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01dc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1dc: R_MIPS_GOT16	small_external_common
-0+01e0 <[^>]*> lui	\$at,0x1
-0+01e4 <[^>]*> addiu	\$at,\$at,0
-0+01e8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01ec <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1ec: R_MIPS_GOT16	.bss
-0+01f0 <[^>]*> lui	\$at,0x1
-0+01f4 <[^>]*> addiu	\$at,\$at,0
-[ 	]*1f4: R_MIPS_LO16	.bss
-0+01f8 <[^>]*> addu	\$a0,\$a0,\$at
-0+01fc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1fc: R_MIPS_GOT16	.bss
-0+0200 <[^>]*> lui	\$at,0x1
-0+0204 <[^>]*> addiu	\$at,\$at,1000
-[ 	]*204: R_MIPS_LO16	.bss
-0+0208 <[^>]*> addu	\$a0,\$a0,\$at
-0+020c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*20c: R_MIPS_GOT16	.data
-0+0210 <[^>]*> lui	\$at,0x2
-0+0214 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*214: R_MIPS_LO16	.data
-0+0218 <[^>]*> addu	\$a0,\$a0,\$at
-0+021c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*21c: R_MIPS_GOT16	big_external_data_label
-0+0220 <[^>]*> lui	\$at,0x2
-0+0224 <[^>]*> addiu	\$at,\$at,-23131
-0+0228 <[^>]*> addu	\$a0,\$a0,\$at
-0+022c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*22c: R_MIPS_GOT16	small_external_data_label
-0+0230 <[^>]*> lui	\$at,0x2
-0+0234 <[^>]*> addiu	\$at,\$at,-23131
-0+0238 <[^>]*> addu	\$a0,\$a0,\$at
-0+023c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*23c: R_MIPS_GOT16	big_external_common
-0+0240 <[^>]*> lui	\$at,0x2
-0+0244 <[^>]*> addiu	\$at,\$at,-23131
-0+0248 <[^>]*> addu	\$a0,\$a0,\$at
-0+024c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*24c: R_MIPS_GOT16	small_external_common
-0+0250 <[^>]*> lui	\$at,0x2
-0+0254 <[^>]*> addiu	\$at,\$at,-23131
-0+0258 <[^>]*> addu	\$a0,\$a0,\$at
-0+025c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*25c: R_MIPS_GOT16	.bss
-0+0260 <[^>]*> lui	\$at,0x2
-0+0264 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*264: R_MIPS_LO16	.bss
-0+0268 <[^>]*> addu	\$a0,\$a0,\$at
-0+026c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*26c: R_MIPS_GOT16	.bss
-0+0270 <[^>]*> lui	\$at,0x2
-0+0274 <[^>]*> addiu	\$at,\$at,-22131
-[ 	]*274: R_MIPS_LO16	.bss
-0+0278 <[^>]*> addu	\$a0,\$a0,\$at
-0+027c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*27c: R_MIPS_GOT16	.data
-0+0280 <[^>]*> nop
-0+0284 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*284: R_MIPS_LO16	.data
-0+0288 <[^>]*> addu	\$a0,\$a0,\$a1
-0+028c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*28c: R_MIPS_GOT16	big_external_data_label
-0+0290 <[^>]*> nop
-0+0294 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0298 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*298: R_MIPS_GOT16	small_external_data_label
-0+029c <[^>]*> nop
-0+02a0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02a4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2a4: R_MIPS_GOT16	big_external_common
-0+02a8 <[^>]*> nop
-0+02ac <[^>]*> addu	\$a0,\$a0,\$a1
-0+02b0 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2b0: R_MIPS_GOT16	small_external_common
-0+02b4 <[^>]*> nop
-0+02b8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02bc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2bc: R_MIPS_GOT16	.bss
-0+02c0 <[^>]*> nop
-0+02c4 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*2c4: R_MIPS_LO16	.bss
-0+02c8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02cc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2cc: R_MIPS_GOT16	.bss
-0+02d0 <[^>]*> nop
-0+02d4 <[^>]*> addiu	\$a0,\$a0,1000
-[ 	]*2d4: R_MIPS_LO16	.bss
-0+02d8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02dc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2dc: R_MIPS_GOT16	.data
-0+02e0 <[^>]*> nop
-0+02e4 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*2e4: R_MIPS_LO16	.data
-0+02e8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02ec <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2ec: R_MIPS_GOT16	big_external_data_label
-0+02f0 <[^>]*> nop
-0+02f4 <[^>]*> addiu	\$a0,\$a0,1
-0+02f8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02fc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2fc: R_MIPS_GOT16	small_external_data_label
-0+0300 <[^>]*> nop
-0+0304 <[^>]*> addiu	\$a0,\$a0,1
-0+0308 <[^>]*> addu	\$a0,\$a0,\$a1
-0+030c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*30c: R_MIPS_GOT16	big_external_common
-0+0310 <[^>]*> nop
-0+0314 <[^>]*> addiu	\$a0,\$a0,1
-0+0318 <[^>]*> addu	\$a0,\$a0,\$a1
-0+031c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*31c: R_MIPS_GOT16	small_external_common
-0+0320 <[^>]*> nop
-0+0324 <[^>]*> addiu	\$a0,\$a0,1
-0+0328 <[^>]*> addu	\$a0,\$a0,\$a1
-0+032c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*32c: R_MIPS_GOT16	.bss
-0+0330 <[^>]*> nop
-0+0334 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*334: R_MIPS_LO16	.bss
-0+0338 <[^>]*> addu	\$a0,\$a0,\$a1
-0+033c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*33c: R_MIPS_GOT16	.bss
-0+0340 <[^>]*> nop
-0+0344 <[^>]*> addiu	\$a0,\$a0,1001
-[ 	]*344: R_MIPS_LO16	.bss
-0+0348 <[^>]*> addu	\$a0,\$a0,\$a1
-0+034c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*34c: R_MIPS_GOT16	.data
-0+0350 <[^>]*> lui	\$at,0x1
-0+0354 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*354: R_MIPS_LO16	.data
-0+0358 <[^>]*> addu	\$a0,\$a0,\$at
-0+035c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0360 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*360: R_MIPS_GOT16	big_external_data_label
-0+0364 <[^>]*> lui	\$at,0x1
-0+0368 <[^>]*> addiu	\$at,\$at,-32768
-0+036c <[^>]*> addu	\$a0,\$a0,\$at
-0+0370 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0374 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*374: R_MIPS_GOT16	small_external_data_label
-0+0378 <[^>]*> lui	\$at,0x1
-0+037c <[^>]*> addiu	\$at,\$at,-32768
-0+0380 <[^>]*> addu	\$a0,\$a0,\$at
-0+0384 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0388 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*388: R_MIPS_GOT16	big_external_common
-0+038c <[^>]*> lui	\$at,0x1
-0+0390 <[^>]*> addiu	\$at,\$at,-32768
-0+0394 <[^>]*> addu	\$a0,\$a0,\$at
-0+0398 <[^>]*> addu	\$a0,\$a0,\$a1
-0+039c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*39c: R_MIPS_GOT16	small_external_common
-0+03a0 <[^>]*> lui	\$at,0x1
-0+03a4 <[^>]*> addiu	\$at,\$at,-32768
-0+03a8 <[^>]*> addu	\$a0,\$a0,\$at
-0+03ac <[^>]*> addu	\$a0,\$a0,\$a1
-0+03b0 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3b0: R_MIPS_GOT16	.bss
-0+03b4 <[^>]*> lui	\$at,0x1
-0+03b8 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*3b8: R_MIPS_LO16	.bss
-0+03bc <[^>]*> addu	\$a0,\$a0,\$at
-0+03c0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03c4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3c4: R_MIPS_GOT16	.bss
-0+03c8 <[^>]*> lui	\$at,0x1
-0+03cc <[^>]*> addiu	\$at,\$at,-31768
-[ 	]*3cc: R_MIPS_LO16	.bss
-0+03d0 <[^>]*> addu	\$a0,\$a0,\$at
-0+03d4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03d8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3d8: R_MIPS_GOT16	.data
-0+03dc <[^>]*> nop
-0+03e0 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*3e0: R_MIPS_LO16	.data
-0+03e4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03e8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3e8: R_MIPS_GOT16	big_external_data_label
-0+03ec <[^>]*> nop
-0+03f0 <[^>]*> addiu	\$a0,\$a0,-32768
-0+03f4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03f8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3f8: R_MIPS_GOT16	small_external_data_label
-0+03fc <[^>]*> nop
-0+0400 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0404 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0408 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*408: R_MIPS_GOT16	big_external_common
-0+040c <[^>]*> nop
-0+0410 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0414 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0418 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*418: R_MIPS_GOT16	small_external_common
-0+041c <[^>]*> nop
-0+0420 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0424 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0428 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*428: R_MIPS_GOT16	.bss
-0+042c <[^>]*> nop
-0+0430 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*430: R_MIPS_LO16	.bss
-0+0434 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0438 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*438: R_MIPS_GOT16	.bss
-0+043c <[^>]*> nop
-0+0440 <[^>]*> addiu	\$a0,\$a0,-31768
-[ 	]*440: R_MIPS_LO16	.bss
-0+0444 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0448 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*448: R_MIPS_GOT16	.data
-0+044c <[^>]*> lui	\$at,0x1
-0+0450 <[^>]*> addiu	\$at,\$at,0
-[ 	]*450: R_MIPS_LO16	.data
-0+0454 <[^>]*> addu	\$a0,\$a0,\$at
-0+0458 <[^>]*> addu	\$a0,\$a0,\$a1
-0+045c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*45c: R_MIPS_GOT16	big_external_data_label
-0+0460 <[^>]*> lui	\$at,0x1
-0+0464 <[^>]*> addiu	\$at,\$at,0
-0+0468 <[^>]*> addu	\$a0,\$a0,\$at
-0+046c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0470 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*470: R_MIPS_GOT16	small_external_data_label
-0+0474 <[^>]*> lui	\$at,0x1
-0+0478 <[^>]*> addiu	\$at,\$at,0
-0+047c <[^>]*> addu	\$a0,\$a0,\$at
-0+0480 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0484 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*484: R_MIPS_GOT16	big_external_common
-0+0488 <[^>]*> lui	\$at,0x1
-0+048c <[^>]*> addiu	\$at,\$at,0
-0+0490 <[^>]*> addu	\$a0,\$a0,\$at
-0+0494 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0498 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*498: R_MIPS_GOT16	small_external_common
-0+049c <[^>]*> lui	\$at,0x1
-0+04a0 <[^>]*> addiu	\$at,\$at,0
-0+04a4 <[^>]*> addu	\$a0,\$a0,\$at
-0+04a8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04ac <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4ac: R_MIPS_GOT16	.bss
-0+04b0 <[^>]*> lui	\$at,0x1
-0+04b4 <[^>]*> addiu	\$at,\$at,0
-[ 	]*4b4: R_MIPS_LO16	.bss
-0+04b8 <[^>]*> addu	\$a0,\$a0,\$at
-0+04bc <[^>]*> addu	\$a0,\$a0,\$a1
-0+04c0 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4c0: R_MIPS_GOT16	.bss
-0+04c4 <[^>]*> lui	\$at,0x1
-0+04c8 <[^>]*> addiu	\$at,\$at,1000
-[ 	]*4c8: R_MIPS_LO16	.bss
-0+04cc <[^>]*> addu	\$a0,\$a0,\$at
-0+04d0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04d4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4d4: R_MIPS_GOT16	.data
-0+04d8 <[^>]*> lui	\$at,0x2
-0+04dc <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*4dc: R_MIPS_LO16	.data
-0+04e0 <[^>]*> addu	\$a0,\$a0,\$at
-0+04e4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04e8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4e8: R_MIPS_GOT16	big_external_data_label
-0+04ec <[^>]*> lui	\$at,0x2
-0+04f0 <[^>]*> addiu	\$at,\$at,-23131
-0+04f4 <[^>]*> addu	\$a0,\$a0,\$at
-0+04f8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04fc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4fc: R_MIPS_GOT16	small_external_data_label
-0+0500 <[^>]*> lui	\$at,0x2
-0+0504 <[^>]*> addiu	\$at,\$at,-23131
-0+0508 <[^>]*> addu	\$a0,\$a0,\$at
-0+050c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0510 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*510: R_MIPS_GOT16	big_external_common
-0+0514 <[^>]*> lui	\$at,0x2
-0+0518 <[^>]*> addiu	\$at,\$at,-23131
-0+051c <[^>]*> addu	\$a0,\$a0,\$at
-0+0520 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0524 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*524: R_MIPS_GOT16	small_external_common
-0+0528 <[^>]*> lui	\$at,0x2
-0+052c <[^>]*> addiu	\$at,\$at,-23131
-0+0530 <[^>]*> addu	\$a0,\$a0,\$at
-0+0534 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0538 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*538: R_MIPS_GOT16	.bss
-0+053c <[^>]*> lui	\$at,0x2
-0+0540 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*540: R_MIPS_LO16	.bss
-0+0544 <[^>]*> addu	\$a0,\$a0,\$at
-0+0548 <[^>]*> addu	\$a0,\$a0,\$a1
-0+054c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*54c: R_MIPS_GOT16	.bss
-0+0550 <[^>]*> lui	\$at,0x2
-0+0554 <[^>]*> addiu	\$at,\$at,-22131
-[ 	]*554: R_MIPS_LO16	.bss
-0+0558 <[^>]*> addu	\$a0,\$a0,\$at
-0+055c <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> li	\$a0,0
+[0-9a-f]+ <[^>]*> li	\$a0,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> li	\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,0
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1001
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-22131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1001
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-22131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
diff --git a/gas/testsuite/gas/mips/la-xgot.d b/gas/testsuite/gas/mips/la-xgot.d
index 6e5cd26..8daef02 100644
--- a/gas/testsuite/gas/mips/la-xgot.d
+++ b/gas/testsuite/gas/mips/la-xgot.d
@@ -8,611 +8,608 @@
 .*: +file format .*mips.*
 
 Disassembly of section .text:
-0+0000 <[^>]*> li	\$a0,0
-0+0004 <[^>]*> li	\$a0,1
-0+0008 <[^>]*> li	\$a0,0x8000
-0+000c <[^>]*> li	\$a0,-32768
-0+0010 <[^>]*> lui	\$a0,0x1
-0+0014 <[^>]*> lui	\$a0,0x1
-0+0018 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+001c <[^>]*> li	\$a0,0
-0+0020 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0024 <[^>]*> li	\$a0,1
-0+0028 <[^>]*> addu	\$a0,\$a0,\$a1
-0+002c <[^>]*> li	\$a0,0x8000
-0+0030 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0034 <[^>]*> li	\$a0,-32768
-0+0038 <[^>]*> addu	\$a0,\$a0,\$a1
-0+003c <[^>]*> lui	\$a0,0x1
-0+0040 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0044 <[^>]*> lui	\$a0,0x1
-0+0048 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+004c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0050 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*50: R_MIPS_GOT16	.data
-0+0054 <[^>]*> nop
-0+0058 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*58: R_MIPS_LO16	.data
-0+005c <[^>]*> lui	\$a0,0x0
-[ 	]*5c: R_MIPS_GOT_HI16	big_external_data_label
-0+0060 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0064 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*64: R_MIPS_GOT_LO16	big_external_data_label
-0+0068 <[^>]*> lui	\$a0,0x0
-[ 	]*68: R_MIPS_GOT_HI16	small_external_data_label
-0+006c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0070 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*70: R_MIPS_GOT_LO16	small_external_data_label
-0+0074 <[^>]*> lui	\$a0,0x0
-[ 	]*74: R_MIPS_GOT_HI16	big_external_common
-0+0078 <[^>]*> addu	\$a0,\$a0,\$gp
-0+007c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*7c: R_MIPS_GOT_LO16	big_external_common
-0+0080 <[^>]*> lui	\$a0,0x0
-[ 	]*80: R_MIPS_GOT_HI16	small_external_common
-0+0084 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0088 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*88: R_MIPS_GOT_LO16	small_external_common
-0+008c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*8c: R_MIPS_GOT16	.bss
-0+0090 <[^>]*> nop
-0+0094 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*94: R_MIPS_LO16	.bss
-0+0098 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*98: R_MIPS_GOT16	.bss
-0+009c <[^>]*> nop
-0+00a0 <[^>]*> addiu	\$a0,\$a0,1000
-[ 	]*a0: R_MIPS_LO16	.bss
-0+00a4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*a4: R_MIPS_GOT16	.data
-0+00a8 <[^>]*> nop
-0+00ac <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*ac: R_MIPS_LO16	.data
-0+00b0 <[^>]*> lui	\$a0,0x0
-[ 	]*b0: R_MIPS_GOT_HI16	big_external_data_label
-0+00b4 <[^>]*> addu	\$a0,\$a0,\$gp
-0+00b8 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*b8: R_MIPS_GOT_LO16	big_external_data_label
-0+00bc <[^>]*> nop
-0+00c0 <[^>]*> addiu	\$a0,\$a0,1
-0+00c4 <[^>]*> lui	\$a0,0x0
-[ 	]*c4: R_MIPS_GOT_HI16	small_external_data_label
-0+00c8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+00cc <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*cc: R_MIPS_GOT_LO16	small_external_data_label
-0+00d0 <[^>]*> nop
-0+00d4 <[^>]*> addiu	\$a0,\$a0,1
-0+00d8 <[^>]*> lui	\$a0,0x0
-[ 	]*d8: R_MIPS_GOT_HI16	big_external_common
-0+00dc <[^>]*> addu	\$a0,\$a0,\$gp
-0+00e0 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*e0: R_MIPS_GOT_LO16	big_external_common
-0+00e4 <[^>]*> nop
-0+00e8 <[^>]*> addiu	\$a0,\$a0,1
-0+00ec <[^>]*> lui	\$a0,0x0
-[ 	]*ec: R_MIPS_GOT_HI16	small_external_common
-0+00f0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+00f4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*f4: R_MIPS_GOT_LO16	small_external_common
-0+00f8 <[^>]*> nop
-0+00fc <[^>]*> addiu	\$a0,\$a0,1
-0+0100 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*100: R_MIPS_GOT16	.bss
-0+0104 <[^>]*> nop
-0+0108 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*108: R_MIPS_LO16	.bss
-0+010c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*10c: R_MIPS_GOT16	.bss
-0+0110 <[^>]*> nop
-0+0114 <[^>]*> addiu	\$a0,\$a0,1001
-[ 	]*114: R_MIPS_LO16	.bss
-0+0118 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*118: R_MIPS_GOT16	.data
-0+011c <[^>]*> lui	\$at,0x1
-0+0120 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*120: R_MIPS_LO16	.data
-0+0124 <[^>]*> addu	\$a0,\$a0,\$at
-0+0128 <[^>]*> lui	\$a0,0x0
-[ 	]*128: R_MIPS_GOT_HI16	big_external_data_label
-0+012c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0130 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*130: R_MIPS_GOT_LO16	big_external_data_label
-0+0134 <[^>]*> lui	\$at,0x1
-0+0138 <[^>]*> addiu	\$at,\$at,-32768
-0+013c <[^>]*> addu	\$a0,\$a0,\$at
-0+0140 <[^>]*> lui	\$a0,0x0
-[ 	]*140: R_MIPS_GOT_HI16	small_external_data_label
-0+0144 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0148 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*148: R_MIPS_GOT_LO16	small_external_data_label
-0+014c <[^>]*> lui	\$at,0x1
-0+0150 <[^>]*> addiu	\$at,\$at,-32768
-0+0154 <[^>]*> addu	\$a0,\$a0,\$at
-0+0158 <[^>]*> lui	\$a0,0x0
-[ 	]*158: R_MIPS_GOT_HI16	big_external_common
-0+015c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0160 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*160: R_MIPS_GOT_LO16	big_external_common
-0+0164 <[^>]*> lui	\$at,0x1
-0+0168 <[^>]*> addiu	\$at,\$at,-32768
-0+016c <[^>]*> addu	\$a0,\$a0,\$at
-0+0170 <[^>]*> lui	\$a0,0x0
-[ 	]*170: R_MIPS_GOT_HI16	small_external_common
-0+0174 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0178 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*178: R_MIPS_GOT_LO16	small_external_common
-0+017c <[^>]*> lui	\$at,0x1
-0+0180 <[^>]*> addiu	\$at,\$at,-32768
-0+0184 <[^>]*> addu	\$a0,\$a0,\$at
-0+0188 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*188: R_MIPS_GOT16	.bss
-0+018c <[^>]*> lui	\$at,0x1
-0+0190 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*190: R_MIPS_LO16	.bss
-0+0194 <[^>]*> addu	\$a0,\$a0,\$at
-0+0198 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*198: R_MIPS_GOT16	.bss
-0+019c <[^>]*> lui	\$at,0x1
-0+01a0 <[^>]*> addiu	\$at,\$at,-31768
-[ 	]*1a0: R_MIPS_LO16	.bss
-0+01a4 <[^>]*> addu	\$a0,\$a0,\$at
-0+01a8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*1a8: R_MIPS_GOT16	.data
-0+01ac <[^>]*> nop
-0+01b0 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*1b0: R_MIPS_LO16	.data
-0+01b4 <[^>]*> lui	\$a0,0x0
-[ 	]*1b4: R_MIPS_GOT_HI16	big_external_data_label
-0+01b8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+01bc <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*1bc: R_MIPS_GOT_LO16	big_external_data_label
-0+01c0 <[^>]*> nop
-0+01c4 <[^>]*> addiu	\$a0,\$a0,-32768
-0+01c8 <[^>]*> lui	\$a0,0x0
-[ 	]*1c8: R_MIPS_GOT_HI16	small_external_data_label
-0+01cc <[^>]*> addu	\$a0,\$a0,\$gp
-0+01d0 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*1d0: R_MIPS_GOT_LO16	small_external_data_label
-0+01d4 <[^>]*> nop
-0+01d8 <[^>]*> addiu	\$a0,\$a0,-32768
-0+01dc <[^>]*> lui	\$a0,0x0
-[ 	]*1dc: R_MIPS_GOT_HI16	big_external_common
-0+01e0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+01e4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*1e4: R_MIPS_GOT_LO16	big_external_common
-0+01e8 <[^>]*> nop
-0+01ec <[^>]*> addiu	\$a0,\$a0,-32768
-0+01f0 <[^>]*> lui	\$a0,0x0
-[ 	]*1f0: R_MIPS_GOT_HI16	small_external_common
-0+01f4 <[^>]*> addu	\$a0,\$a0,\$gp
-0+01f8 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*1f8: R_MIPS_GOT_LO16	small_external_common
-0+01fc <[^>]*> nop
-0+0200 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0204 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*204: R_MIPS_GOT16	.bss
-0+0208 <[^>]*> nop
-0+020c <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*20c: R_MIPS_LO16	.bss
-0+0210 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*210: R_MIPS_GOT16	.bss
-0+0214 <[^>]*> nop
-0+0218 <[^>]*> addiu	\$a0,\$a0,-31768
-[ 	]*218: R_MIPS_LO16	.bss
-0+021c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*21c: R_MIPS_GOT16	.data
-0+0220 <[^>]*> lui	\$at,0x1
-0+0224 <[^>]*> addiu	\$at,\$at,0
-[ 	]*224: R_MIPS_LO16	.data
-0+0228 <[^>]*> addu	\$a0,\$a0,\$at
-0+022c <[^>]*> lui	\$a0,0x0
-[ 	]*22c: R_MIPS_GOT_HI16	big_external_data_label
-0+0230 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0234 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*234: R_MIPS_GOT_LO16	big_external_data_label
-0+0238 <[^>]*> lui	\$at,0x1
-0+023c <[^>]*> addiu	\$at,\$at,0
-0+0240 <[^>]*> addu	\$a0,\$a0,\$at
-0+0244 <[^>]*> lui	\$a0,0x0
-[ 	]*244: R_MIPS_GOT_HI16	small_external_data_label
-0+0248 <[^>]*> addu	\$a0,\$a0,\$gp
-0+024c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*24c: R_MIPS_GOT_LO16	small_external_data_label
-0+0250 <[^>]*> lui	\$at,0x1
-0+0254 <[^>]*> addiu	\$at,\$at,0
-0+0258 <[^>]*> addu	\$a0,\$a0,\$at
-0+025c <[^>]*> lui	\$a0,0x0
-[ 	]*25c: R_MIPS_GOT_HI16	big_external_common
-0+0260 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0264 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*264: R_MIPS_GOT_LO16	big_external_common
-0+0268 <[^>]*> lui	\$at,0x1
-0+026c <[^>]*> addiu	\$at,\$at,0
-0+0270 <[^>]*> addu	\$a0,\$a0,\$at
-0+0274 <[^>]*> lui	\$a0,0x0
-[ 	]*274: R_MIPS_GOT_HI16	small_external_common
-0+0278 <[^>]*> addu	\$a0,\$a0,\$gp
-0+027c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*27c: R_MIPS_GOT_LO16	small_external_common
-0+0280 <[^>]*> lui	\$at,0x1
-0+0284 <[^>]*> addiu	\$at,\$at,0
-0+0288 <[^>]*> addu	\$a0,\$a0,\$at
-0+028c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*28c: R_MIPS_GOT16	.bss
-0+0290 <[^>]*> lui	\$at,0x1
-0+0294 <[^>]*> addiu	\$at,\$at,0
-[ 	]*294: R_MIPS_LO16	.bss
-0+0298 <[^>]*> addu	\$a0,\$a0,\$at
-0+029c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*29c: R_MIPS_GOT16	.bss
-0+02a0 <[^>]*> lui	\$at,0x1
-0+02a4 <[^>]*> addiu	\$at,\$at,1000
-[ 	]*2a4: R_MIPS_LO16	.bss
-0+02a8 <[^>]*> addu	\$a0,\$a0,\$at
-0+02ac <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*2ac: R_MIPS_GOT16	.data
-0+02b0 <[^>]*> lui	\$at,0x2
-0+02b4 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*2b4: R_MIPS_LO16	.data
-0+02b8 <[^>]*> addu	\$a0,\$a0,\$at
-0+02bc <[^>]*> lui	\$a0,0x0
-[ 	]*2bc: R_MIPS_GOT_HI16	big_external_data_label
-0+02c0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+02c4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*2c4: R_MIPS_GOT_LO16	big_external_data_label
-0+02c8 <[^>]*> lui	\$at,0x2
-0+02cc <[^>]*> addiu	\$at,\$at,-23131
-0+02d0 <[^>]*> addu	\$a0,\$a0,\$at
-0+02d4 <[^>]*> lui	\$a0,0x0
-[ 	]*2d4: R_MIPS_GOT_HI16	small_external_data_label
-0+02d8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+02dc <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*2dc: R_MIPS_GOT_LO16	small_external_data_label
-0+02e0 <[^>]*> lui	\$at,0x2
-0+02e4 <[^>]*> addiu	\$at,\$at,-23131
-0+02e8 <[^>]*> addu	\$a0,\$a0,\$at
-0+02ec <[^>]*> lui	\$a0,0x0
-[ 	]*2ec: R_MIPS_GOT_HI16	big_external_common
-0+02f0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+02f4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*2f4: R_MIPS_GOT_LO16	big_external_common
-0+02f8 <[^>]*> lui	\$at,0x2
-0+02fc <[^>]*> addiu	\$at,\$at,-23131
-0+0300 <[^>]*> addu	\$a0,\$a0,\$at
-0+0304 <[^>]*> lui	\$a0,0x0
-[ 	]*304: R_MIPS_GOT_HI16	small_external_common
-0+0308 <[^>]*> addu	\$a0,\$a0,\$gp
-0+030c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*30c: R_MIPS_GOT_LO16	small_external_common
-0+0310 <[^>]*> lui	\$at,0x2
-0+0314 <[^>]*> addiu	\$at,\$at,-23131
-0+0318 <[^>]*> addu	\$a0,\$a0,\$at
-0+031c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*31c: R_MIPS_GOT16	.bss
-0+0320 <[^>]*> lui	\$at,0x2
-0+0324 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*324: R_MIPS_LO16	.bss
-0+0328 <[^>]*> addu	\$a0,\$a0,\$at
-0+032c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*32c: R_MIPS_GOT16	.bss
-0+0330 <[^>]*> lui	\$at,0x2
-0+0334 <[^>]*> addiu	\$at,\$at,-22131
-[ 	]*334: R_MIPS_LO16	.bss
-0+0338 <[^>]*> addu	\$a0,\$a0,\$at
-0+033c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*33c: R_MIPS_GOT16	.data
-0+0340 <[^>]*> nop
-0+0344 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*344: R_MIPS_LO16	.data
-0+0348 <[^>]*> addu	\$a0,\$a0,\$a1
-0+034c <[^>]*> lui	\$a0,0x0
-[ 	]*34c: R_MIPS_GOT_HI16	big_external_data_label
-0+0350 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0354 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*354: R_MIPS_GOT_LO16	big_external_data_label
-0+0358 <[^>]*> nop
-0+035c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0360 <[^>]*> lui	\$a0,0x0
-[ 	]*360: R_MIPS_GOT_HI16	small_external_data_label
-0+0364 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0368 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*368: R_MIPS_GOT_LO16	small_external_data_label
-0+036c <[^>]*> nop
-0+0370 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0374 <[^>]*> lui	\$a0,0x0
-[ 	]*374: R_MIPS_GOT_HI16	big_external_common
-0+0378 <[^>]*> addu	\$a0,\$a0,\$gp
-0+037c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*37c: R_MIPS_GOT_LO16	big_external_common
-0+0380 <[^>]*> nop
-0+0384 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0388 <[^>]*> lui	\$a0,0x0
-[ 	]*388: R_MIPS_GOT_HI16	small_external_common
-0+038c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0390 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*390: R_MIPS_GOT_LO16	small_external_common
-0+0394 <[^>]*> nop
-0+0398 <[^>]*> addu	\$a0,\$a0,\$a1
-0+039c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*39c: R_MIPS_GOT16	.bss
-0+03a0 <[^>]*> nop
-0+03a4 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*3a4: R_MIPS_LO16	.bss
-0+03a8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03ac <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3ac: R_MIPS_GOT16	.bss
-0+03b0 <[^>]*> nop
-0+03b4 <[^>]*> addiu	\$a0,\$a0,1000
-[ 	]*3b4: R_MIPS_LO16	.bss
-0+03b8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03bc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*3bc: R_MIPS_GOT16	.data
-0+03c0 <[^>]*> nop
-0+03c4 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*3c4: R_MIPS_LO16	.data
-0+03c8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03cc <[^>]*> lui	\$a0,0x0
-[ 	]*3cc: R_MIPS_GOT_HI16	big_external_data_label
-0+03d0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+03d4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*3d4: R_MIPS_GOT_LO16	big_external_data_label
-0+03d8 <[^>]*> nop
-0+03dc <[^>]*> addiu	\$a0,\$a0,1
-0+03e0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03e4 <[^>]*> lui	\$a0,0x0
-[ 	]*3e4: R_MIPS_GOT_HI16	small_external_data_label
-0+03e8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+03ec <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*3ec: R_MIPS_GOT_LO16	small_external_data_label
-0+03f0 <[^>]*> nop
-0+03f4 <[^>]*> addiu	\$a0,\$a0,1
-0+03f8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+03fc <[^>]*> lui	\$a0,0x0
-[ 	]*3fc: R_MIPS_GOT_HI16	big_external_common
-0+0400 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0404 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*404: R_MIPS_GOT_LO16	big_external_common
-0+0408 <[^>]*> nop
-0+040c <[^>]*> addiu	\$a0,\$a0,1
-0+0410 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0414 <[^>]*> lui	\$a0,0x0
-[ 	]*414: R_MIPS_GOT_HI16	small_external_common
-0+0418 <[^>]*> addu	\$a0,\$a0,\$gp
-0+041c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*41c: R_MIPS_GOT_LO16	small_external_common
-0+0420 <[^>]*> nop
-0+0424 <[^>]*> addiu	\$a0,\$a0,1
-0+0428 <[^>]*> addu	\$a0,\$a0,\$a1
-0+042c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*42c: R_MIPS_GOT16	.bss
-0+0430 <[^>]*> nop
-0+0434 <[^>]*> addiu	\$a0,\$a0,1
-[ 	]*434: R_MIPS_LO16	.bss
-0+0438 <[^>]*> addu	\$a0,\$a0,\$a1
-0+043c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*43c: R_MIPS_GOT16	.bss
-0+0440 <[^>]*> nop
-0+0444 <[^>]*> addiu	\$a0,\$a0,1001
-[ 	]*444: R_MIPS_LO16	.bss
-0+0448 <[^>]*> addu	\$a0,\$a0,\$a1
-0+044c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*44c: R_MIPS_GOT16	.data
-0+0450 <[^>]*> lui	\$at,0x1
-0+0454 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*454: R_MIPS_LO16	.data
-0+0458 <[^>]*> addu	\$a0,\$a0,\$at
-0+045c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0460 <[^>]*> lui	\$a0,0x0
-[ 	]*460: R_MIPS_GOT_HI16	big_external_data_label
-0+0464 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0468 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*468: R_MIPS_GOT_LO16	big_external_data_label
-0+046c <[^>]*> lui	\$at,0x1
-0+0470 <[^>]*> addiu	\$at,\$at,-32768
-0+0474 <[^>]*> addu	\$a0,\$a0,\$at
-0+0478 <[^>]*> addu	\$a0,\$a0,\$a1
-0+047c <[^>]*> lui	\$a0,0x0
-[ 	]*47c: R_MIPS_GOT_HI16	small_external_data_label
-0+0480 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0484 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*484: R_MIPS_GOT_LO16	small_external_data_label
-0+0488 <[^>]*> lui	\$at,0x1
-0+048c <[^>]*> addiu	\$at,\$at,-32768
-0+0490 <[^>]*> addu	\$a0,\$a0,\$at
-0+0494 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0498 <[^>]*> lui	\$a0,0x0
-[ 	]*498: R_MIPS_GOT_HI16	big_external_common
-0+049c <[^>]*> addu	\$a0,\$a0,\$gp
-0+04a0 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*4a0: R_MIPS_GOT_LO16	big_external_common
-0+04a4 <[^>]*> lui	\$at,0x1
-0+04a8 <[^>]*> addiu	\$at,\$at,-32768
-0+04ac <[^>]*> addu	\$a0,\$a0,\$at
-0+04b0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04b4 <[^>]*> lui	\$a0,0x0
-[ 	]*4b4: R_MIPS_GOT_HI16	small_external_common
-0+04b8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+04bc <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*4bc: R_MIPS_GOT_LO16	small_external_common
-0+04c0 <[^>]*> lui	\$at,0x1
-0+04c4 <[^>]*> addiu	\$at,\$at,-32768
-0+04c8 <[^>]*> addu	\$a0,\$a0,\$at
-0+04cc <[^>]*> addu	\$a0,\$a0,\$a1
-0+04d0 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4d0: R_MIPS_GOT16	.bss
-0+04d4 <[^>]*> lui	\$at,0x1
-0+04d8 <[^>]*> addiu	\$at,\$at,-32768
-[ 	]*4d8: R_MIPS_LO16	.bss
-0+04dc <[^>]*> addu	\$a0,\$a0,\$at
-0+04e0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04e4 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4e4: R_MIPS_GOT16	.bss
-0+04e8 <[^>]*> lui	\$at,0x1
-0+04ec <[^>]*> addiu	\$at,\$at,-31768
-[ 	]*4ec: R_MIPS_LO16	.bss
-0+04f0 <[^>]*> addu	\$a0,\$a0,\$at
-0+04f4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+04f8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*4f8: R_MIPS_GOT16	.data
-0+04fc <[^>]*> nop
-0+0500 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*500: R_MIPS_LO16	.data
-0+0504 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0508 <[^>]*> lui	\$a0,0x0
-[ 	]*508: R_MIPS_GOT_HI16	big_external_data_label
-0+050c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0510 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*510: R_MIPS_GOT_LO16	big_external_data_label
-0+0514 <[^>]*> nop
-0+0518 <[^>]*> addiu	\$a0,\$a0,-32768
-0+051c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0520 <[^>]*> lui	\$a0,0x0
-[ 	]*520: R_MIPS_GOT_HI16	small_external_data_label
-0+0524 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0528 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*528: R_MIPS_GOT_LO16	small_external_data_label
-0+052c <[^>]*> nop
-0+0530 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0534 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0538 <[^>]*> lui	\$a0,0x0
-[ 	]*538: R_MIPS_GOT_HI16	big_external_common
-0+053c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0540 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*540: R_MIPS_GOT_LO16	big_external_common
-0+0544 <[^>]*> nop
-0+0548 <[^>]*> addiu	\$a0,\$a0,-32768
-0+054c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0550 <[^>]*> lui	\$a0,0x0
-[ 	]*550: R_MIPS_GOT_HI16	small_external_common
-0+0554 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0558 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*558: R_MIPS_GOT_LO16	small_external_common
-0+055c <[^>]*> nop
-0+0560 <[^>]*> addiu	\$a0,\$a0,-32768
-0+0564 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0568 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*568: R_MIPS_GOT16	.bss
-0+056c <[^>]*> nop
-0+0570 <[^>]*> addiu	\$a0,\$a0,-32768
-[ 	]*570: R_MIPS_LO16	.bss
-0+0574 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0578 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*578: R_MIPS_GOT16	.bss
-0+057c <[^>]*> nop
-0+0580 <[^>]*> addiu	\$a0,\$a0,-31768
-[ 	]*580: R_MIPS_LO16	.bss
-0+0584 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0588 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*588: R_MIPS_GOT16	.data
-0+058c <[^>]*> lui	\$at,0x1
-0+0590 <[^>]*> addiu	\$at,\$at,0
-[ 	]*590: R_MIPS_LO16	.data
-0+0594 <[^>]*> addu	\$a0,\$a0,\$at
-0+0598 <[^>]*> addu	\$a0,\$a0,\$a1
-0+059c <[^>]*> lui	\$a0,0x0
-[ 	]*59c: R_MIPS_GOT_HI16	big_external_data_label
-0+05a0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+05a4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*5a4: R_MIPS_GOT_LO16	big_external_data_label
-0+05a8 <[^>]*> lui	\$at,0x1
-0+05ac <[^>]*> addiu	\$at,\$at,0
-0+05b0 <[^>]*> addu	\$a0,\$a0,\$at
-0+05b4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+05b8 <[^>]*> lui	\$a0,0x0
-[ 	]*5b8: R_MIPS_GOT_HI16	small_external_data_label
-0+05bc <[^>]*> addu	\$a0,\$a0,\$gp
-0+05c0 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*5c0: R_MIPS_GOT_LO16	small_external_data_label
-0+05c4 <[^>]*> lui	\$at,0x1
-0+05c8 <[^>]*> addiu	\$at,\$at,0
-0+05cc <[^>]*> addu	\$a0,\$a0,\$at
-0+05d0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+05d4 <[^>]*> lui	\$a0,0x0
-[ 	]*5d4: R_MIPS_GOT_HI16	big_external_common
-0+05d8 <[^>]*> addu	\$a0,\$a0,\$gp
-0+05dc <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*5dc: R_MIPS_GOT_LO16	big_external_common
-0+05e0 <[^>]*> lui	\$at,0x1
-0+05e4 <[^>]*> addiu	\$at,\$at,0
-0+05e8 <[^>]*> addu	\$a0,\$a0,\$at
-0+05ec <[^>]*> addu	\$a0,\$a0,\$a1
-0+05f0 <[^>]*> lui	\$a0,0x0
-[ 	]*5f0: R_MIPS_GOT_HI16	small_external_common
-0+05f4 <[^>]*> addu	\$a0,\$a0,\$gp
-0+05f8 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*5f8: R_MIPS_GOT_LO16	small_external_common
-0+05fc <[^>]*> lui	\$at,0x1
-0+0600 <[^>]*> addiu	\$at,\$at,0
-0+0604 <[^>]*> addu	\$a0,\$a0,\$at
-0+0608 <[^>]*> addu	\$a0,\$a0,\$a1
-0+060c <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*60c: R_MIPS_GOT16	.bss
-0+0610 <[^>]*> lui	\$at,0x1
-0+0614 <[^>]*> addiu	\$at,\$at,0
-[ 	]*614: R_MIPS_LO16	.bss
-0+0618 <[^>]*> addu	\$a0,\$a0,\$at
-0+061c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0620 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*620: R_MIPS_GOT16	.bss
-0+0624 <[^>]*> lui	\$at,0x1
-0+0628 <[^>]*> addiu	\$at,\$at,1000
-[ 	]*628: R_MIPS_LO16	.bss
-0+062c <[^>]*> addu	\$a0,\$a0,\$at
-0+0630 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0634 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*634: R_MIPS_GOT16	.data
-0+0638 <[^>]*> lui	\$at,0x2
-0+063c <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*63c: R_MIPS_LO16	.data
-0+0640 <[^>]*> addu	\$a0,\$a0,\$at
-0+0644 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0648 <[^>]*> lui	\$a0,0x0
-[ 	]*648: R_MIPS_GOT_HI16	big_external_data_label
-0+064c <[^>]*> addu	\$a0,\$a0,\$gp
-0+0650 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*650: R_MIPS_GOT_LO16	big_external_data_label
-0+0654 <[^>]*> lui	\$at,0x2
-0+0658 <[^>]*> addiu	\$at,\$at,-23131
-0+065c <[^>]*> addu	\$a0,\$a0,\$at
-0+0660 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0664 <[^>]*> lui	\$a0,0x0
-[ 	]*664: R_MIPS_GOT_HI16	small_external_data_label
-0+0668 <[^>]*> addu	\$a0,\$a0,\$gp
-0+066c <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*66c: R_MIPS_GOT_LO16	small_external_data_label
-0+0670 <[^>]*> lui	\$at,0x2
-0+0674 <[^>]*> addiu	\$at,\$at,-23131
-0+0678 <[^>]*> addu	\$a0,\$a0,\$at
-0+067c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0680 <[^>]*> lui	\$a0,0x0
-[ 	]*680: R_MIPS_GOT_HI16	big_external_common
-0+0684 <[^>]*> addu	\$a0,\$a0,\$gp
-0+0688 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*688: R_MIPS_GOT_LO16	big_external_common
-0+068c <[^>]*> lui	\$at,0x2
-0+0690 <[^>]*> addiu	\$at,\$at,-23131
-0+0694 <[^>]*> addu	\$a0,\$a0,\$at
-0+0698 <[^>]*> addu	\$a0,\$a0,\$a1
-0+069c <[^>]*> lui	\$a0,0x0
-[ 	]*69c: R_MIPS_GOT_HI16	small_external_common
-0+06a0 <[^>]*> addu	\$a0,\$a0,\$gp
-0+06a4 <[^>]*> lw	\$a0,0\(\$a0\)
-[ 	]*6a4: R_MIPS_GOT_LO16	small_external_common
-0+06a8 <[^>]*> lui	\$at,0x2
-0+06ac <[^>]*> addiu	\$at,\$at,-23131
-0+06b0 <[^>]*> addu	\$a0,\$a0,\$at
-0+06b4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+06b8 <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*6b8: R_MIPS_GOT16	.bss
-0+06bc <[^>]*> lui	\$at,0x2
-0+06c0 <[^>]*> addiu	\$at,\$at,-23131
-[ 	]*6c0: R_MIPS_LO16	.bss
-0+06c4 <[^>]*> addu	\$a0,\$a0,\$at
-0+06c8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+06cc <[^>]*> lw	\$a0,0\(\$gp\)
-[ 	]*6cc: R_MIPS_GOT16	.bss
-0+06d0 <[^>]*> lui	\$at,0x2
-0+06d4 <[^>]*> addiu	\$at,\$at,-22131
-[ 	]*6d4: R_MIPS_LO16	.bss
-0+06d8 <[^>]*> addu	\$a0,\$a0,\$at
-0+06dc <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> li	\$a0,0
+[0-9a-f]+ <[^>]*> li	\$a0,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> li	\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,0
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1001
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-22131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,1001
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-32768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,-31768
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,0
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x1
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,1000
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.data
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.data
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$gp
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-23131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lw	\$a0,0\(\$gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	.bss
+[0-9a-f]+ <[^>]*> lui	\$at,0x2
+[0-9a-f]+ <[^>]*> addiu	\$at,\$at,-22131
+[ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$at
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
diff --git a/gas/testsuite/gas/mips/la.d b/gas/testsuite/gas/mips/la.d
index 25eaa1e..3983179 100644
--- a/gas/testsuite/gas/mips/la.d
+++ b/gas/testsuite/gas/mips/la.d
@@ -7,378 +7,375 @@
 .*: +file format .*mips.*
 
 Disassembly of section .text:
-0+0000 <[^>]*> li	\$a0,0
-0+0004 <[^>]*> li	\$a0,1
-0+0008 <[^>]*> li	\$a0,0x8000
-0+000c <[^>]*> li	\$a0,-32768
-0+0010 <[^>]*> lui	\$a0,0x1
-0+0014 <[^>]*> lui	\$a0,0x1
-0+0018 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+001c <[^>]*> li	\$a0,0
-0+0020 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0024 <[^>]*> li	\$a0,1
-0+0028 <[^>]*> addu	\$a0,\$a0,\$a1
-0+002c <[^>]*> li	\$a0,0x8000
-0+0030 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0034 <[^>]*> li	\$a0,-32768
-0+0038 <[^>]*> addu	\$a0,\$a0,\$a1
-0+003c <[^>]*> lui	\$a0,0x1
-0+0040 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0044 <[^>]*> lui	\$a0,0x1
-0+0048 <[^>]*> ori	\$a0,\$a0,0xa5a5
-0+004c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0050 <[^>]*> lui	\$a0,0x0
-[ 	]*50: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+0054 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*54: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0058 <[^>]*> lui	\$a0,0x0
-[ 	]*58: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+005c <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*5c: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+0060 <[^>]*> addiu	\$a0,\$gp,0
-[ 	]*60: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
-0+0064 <[^>]*> lui	\$a0,0x0
-[ 	]*64: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+0068 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*68: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+006c <[^>]*> addiu	\$a0,\$gp,0
-[ 	]*6c: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
-0+0070 <[^>]*> lui	\$a0,0x0
-[ 	]*70: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0074 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*74: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0078 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*78: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
-0+007c <[^>]*> lui	\$a0,0x0
-[ 	]*7c: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+0080 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*80: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0084 <[^>]*> lui	\$a0,0x0
-[ 	]*84: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+0088 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*88: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+008c <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
-0+0090 <[^>]*> lui	\$a0,0x0
-[ 	]*90: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+0094 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*94: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0098 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*98: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
-0+009c <[^>]*> lui	\$a0,0x0
-[ 	]*9c: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+00a0 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*a0: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+00a4 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*a4: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
-0+00a8 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*a8: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+00ac <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*ac: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+00b0 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*b0: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+00b4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*b4: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+00b8 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*b8: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+00bc <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*bc: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+00c0 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*c0: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+00c4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*c4: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+00c8 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*c8: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+00cc <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*cc: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+00d0 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*d0: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+00d4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*d4: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+00d8 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*d8: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+00dc <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*dc: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+00e0 <[^>]*> lui	\$a0,0x0
-[ 	]*e0: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+00e4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*e4: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+00e8 <[^>]*> lui	\$a0,0x0
-[ 	]*e8: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+00ec <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*ec: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+00f0 <[^>]*> lui	\$a0,0x0
-[ 	]*f0: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+00f4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*f4: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+00f8 <[^>]*> lui	\$a0,0x0
-[ 	]*f8: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+00fc <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*fc: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0100 <[^>]*> lui	\$a0,0x0
-[ 	]*100: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+0104 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*104: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+0108 <[^>]*> lui	\$a0,0x0
-[ 	]*108: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+010c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*10c: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0110 <[^>]*> lui	\$a0,0x0
-[ 	]*110: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+0114 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*114: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0118 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*118: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+011c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*11c: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0120 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*120: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+0124 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*124: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+0128 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*128: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+012c <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*12c: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+0130 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*130: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+0134 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*134: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0138 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*138: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+013c <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*13c: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+0140 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*140: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0144 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*144: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0148 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*148: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+014c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*14c: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0150 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*150: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+0154 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*154: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0158 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*158: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+015c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*15c: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+0160 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*160: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+0164 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*164: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+0168 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*168: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+016c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*16c: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0170 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*170: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+0174 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*174: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+0178 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*178: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+017c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*17c: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0180 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*180: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+0184 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*184: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0188 <[^>]*> lui	\$a0,0x0
-[ 	]*188: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+018c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*18c: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0190 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0194 <[^>]*> lui	\$a0,0x0
-[ 	]*194: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+0198 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*198: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+019c <[^>]*> addu	\$a0,\$a0,\$a1
-0+01a0 <[^>]*> addiu	\$a0,\$gp,0
-[ 	]*1a0: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
-0+01a4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01a8 <[^>]*> lui	\$a0,0x0
-[ 	]*1a8: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+01ac <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*1ac: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+01b0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01b4 <[^>]*> addiu	\$a0,\$gp,0
-[ 	]*1b4: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
-0+01b8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01bc <[^>]*> lui	\$a0,0x0
-[ 	]*1bc: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+01c0 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*1c0: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+01c4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01c8 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*1c8: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
-0+01cc <[^>]*> addu	\$a0,\$a0,\$a1
-0+01d0 <[^>]*> lui	\$a0,0x0
-[ 	]*1d0: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+01d4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*1d4: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+01d8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01dc <[^>]*> lui	\$a0,0x0
-[ 	]*1dc: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+01e0 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*1e0: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+01e4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01e8 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*1e8: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
-0+01ec <[^>]*> addu	\$a0,\$a0,\$a1
-0+01f0 <[^>]*> lui	\$a0,0x0
-[ 	]*1f0: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+01f4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*1f4: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+01f8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+01fc <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*1fc: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
-0+0200 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0204 <[^>]*> lui	\$a0,0x0
-[ 	]*204: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0208 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*208: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+020c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0210 <[^>]*> addiu	\$a0,\$gp,[-0-9]+
-[ 	]*210: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
-0+0214 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0218 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*218: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+021c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*21c: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0220 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0224 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*224: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+0228 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*228: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+022c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0230 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*230: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+0234 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*234: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+0238 <[^>]*> addu	\$a0,\$a0,\$a1
-0+023c <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*23c: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+0240 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*240: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0244 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0248 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*248: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+024c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*24c: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+0250 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0254 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*254: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0258 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*258: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+025c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0260 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*260: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+0264 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*264: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0268 <[^>]*> addu	\$a0,\$a0,\$a1
-0+026c <[^>]*> lui	\$a0,0x0
-[ 	]*26c: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+0270 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*270: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+0274 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0278 <[^>]*> lui	\$a0,0x0
-[ 	]*278: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+027c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*27c: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+0280 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0284 <[^>]*> lui	\$a0,0x0
-[ 	]*284: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+0288 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*288: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+028c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0290 <[^>]*> lui	\$a0,0x0
-[ 	]*290: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+0294 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*294: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0298 <[^>]*> addu	\$a0,\$a0,\$a1
-0+029c <[^>]*> lui	\$a0,0x0
-[ 	]*29c: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+02a0 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*2a0: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+02a4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02a8 <[^>]*> lui	\$a0,0x0
-[ 	]*2a8: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+02ac <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*2ac: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+02b0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02b4 <[^>]*> lui	\$a0,0x0
-[ 	]*2b4: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+02b8 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*2b8: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+02bc <[^>]*> addu	\$a0,\$a0,\$a1
-0+02c0 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2c0: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+02c4 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*2c4: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+02c8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02cc <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2cc: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+02d0 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*2d0: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+02d4 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02d8 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2d8: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+02dc <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*2dc: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+02e0 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02e4 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2e4: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+02e8 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*2e8: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+02ec <[^>]*> addu	\$a0,\$a0,\$a1
-0+02f0 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2f0: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+02f4 <[^>]*> addiu	\$a0,\$a0,0
-[ 	]*2f4: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+02f8 <[^>]*> addu	\$a0,\$a0,\$a1
-0+02fc <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*2fc: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0300 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*300: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0304 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0308 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*308: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+030c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*30c: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0310 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0314 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*314: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
-0+0318 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*318: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
-0+031c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0320 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*320: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
-0+0324 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*324: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
-0+0328 <[^>]*> addu	\$a0,\$a0,\$a1
-0+032c <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*32c: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
-0+0330 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*330: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
-0+0334 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0338 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*338: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
-0+033c <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*33c: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
-0+0340 <[^>]*> addu	\$a0,\$a0,\$a1
-0+0344 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*344: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
-0+0348 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*348: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
-0+034c <[^>]*> addu	\$a0,\$a0,\$a1
-0+0350 <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*350: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
-0+0354 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*354: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
-0+0358 <[^>]*> addu	\$a0,\$a0,\$a1
-0+035c <[^>]*> lui	\$a0,[-0-9x]+
-[ 	]*35c: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
-0+0360 <[^>]*> addiu	\$a0,\$a0,[-0-9]+
-[ 	]*360: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
-0+0364 <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> li	\$a0,0
+[0-9a-f]+ <[^>]*> li	\$a0,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> li	\$a0,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,0
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,1
+[0-9a-f]+ <[^>]*> li	\$a0,0x8000
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a1,-32768
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x1
+[0-9a-f]+ <[^>]*> ori	\$a0,\$a0,0xa5a5
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$gp,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*GPREL[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.data.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_data_label
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	small_external_common
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.bss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
+[0-9a-f]+ <[^>]*> lui	\$a0,[-0-9x]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addiu	\$a0,\$a0,[-0-9]+
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
+[0-9a-f]+ <[^>]*> addu	\$a0,\$a0,\$a1
 	...
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 1b5269d..6ed1c02 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -99,4 +99,19 @@
     run_dump_test "elf_e_flags2"
     run_dump_test "elf_e_flags3"
     run_dump_test "elf_e_flags4"
+    
+    if $svr4pic {
+	run_dump_test "elf-rel"
+	if [istarget mips64*-*-*] { 
+	    run_dump_test "elf-rel2" 
+	} {
+	    run_dump_test "e32-rel2" 
+	} 
+	run_dump_test "empic"
+	if { !$no_mips16 } { 
+	    run_dump_test "mips16-e" 
+	    setup_xfail "mips*-*-*"
+	    run_dump_test "mips16-f" 
+	}
+    }
 }
diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d
new file mode 100644
index 0000000..1f23f68
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-e.d
@@ -0,0 +1,41 @@
+#objdump: -rst -mips16
+#name: MIPS16 reloc
+#as: -mips16
+
+# Check MIPS16 reloc processing
+
+.*: +file format elf.*mips.*
+
+SYMBOL TABLE:
+0+0000000 l    d  \.text	0+0000000 
+0+0000000 l    d  \.data	0+0000000 
+0+0000000 l    d  \.bss	0+0000000 
+0+0000000 l    d  foo	0+0000000 
+0+0000000 l    d  \.reginfo	0+0000000 
+0+0000000 l    d  \.mdebug	0+0000000 
+0+0000002 l       \.text	0+0000000 0xf0 l1
+0+0000004 l       \.text	0+0000000 0xf0 L1.1
+0+0000000         \*UND\*	0+0000000 g1
+
+
+RELOCATION RECORDS FOR \[foo\]:
+OFFSET           TYPE              VALUE 
+0+0000000 R_MIPS_32         l1
+0+0000004 R_MIPS_32         l1
+0+0000008 R_MIPS_32         L1.1
+0+000000c R_MIPS_32         L1.1
+0+0000010 R_MIPS_32         g1
+0+0000014 R_MIPS_32         g1
+
+
+Contents of section \.text:
+ 0000 65006500 65006500                    .*
+Contents of section \.data:
+Contents of section \.reginfo:
+ 0000 00000001 00000000 00000000 00000000  .*
+ 0010 00000000 00000000                    .*
+Contents of section \.mdebug:
+#...
+Contents of section foo:
+ 0000 00000000 00000008 00000000 00000003  .*
+ 0010 00000000 00000008                    .*
diff --git a/gas/testsuite/gas/mips/mips16-e.s b/gas/testsuite/gas/mips/mips16-e.s
new file mode 100644
index 0000000..b19d020
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-e.s
@@ -0,0 +1,13 @@
+        .set noreorder
+        .text
+        nop
+l1:     nop
+1:      nop
+        nop
+        .section "foo"
+        .word   l1
+        .word   l1+8
+        .word   1b
+        .word   1b+3
+	.word	g1
+	.word	g1+8
diff --git a/gas/testsuite/gas/mips/mips16-f.d b/gas/testsuite/gas/mips/mips16-f.d
new file mode 100644
index 0000000..3a6af1b
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-f.d
@@ -0,0 +1,33 @@
+#objdump: -rst -mips16
+#name: MIPS16 reloc 2
+#as: -mips16
+
+# Check MIPS16 reloc processing
+
+.*: +file format elf.*mips.*
+
+SYMBOL TABLE:
+0+0000000 l    d  \.text	0+0000000 
+0+0000000 l    d  \.data	0+0000000 
+0+0000000 l    d  \.bss	0+0000000 
+0+0000000 l    d  foo	0+0000000 
+0+0000000 l    d  \.reginfo	0+0000000 
+0+0000000 l    d  \.mdebug	0+0000000 
+0+0000002 l       \.text	0+0000000 0xf0 l1
+
+
+RELOCATION RECORDS FOR \[foo\]:
+OFFSET           TYPE              VALUE 
+0+0000000 R_MIPS_32         l1
+
+
+Contents of section \.text:
+ 0000 65006500                             .*
+Contents of section \.data:
+Contents of section \.reginfo:
+ 0000 00000001 00000000 00000000 00000000  .*
+ 0010 00000000 00000000                    .*
+Contents of section \.mdebug:
+#...
+Contents of section foo:
+ 0000 00000003                             .*
diff --git a/gas/testsuite/gas/mips/mips16-f.s b/gas/testsuite/gas/mips/mips16-f.s
new file mode 100644
index 0000000..0b254bd
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-f.s
@@ -0,0 +1,6 @@
+        .set noreorder
+        .text
+        nop
+l1:     nop
+        .section "foo"
+        .word   l1+3
diff --git a/gas/testsuite/gas/mips/sync.d b/gas/testsuite/gas/mips/sync.d
index 9b50ea2..0b9a187 100644
--- a/gas/testsuite/gas/mips/sync.d
+++ b/gas/testsuite/gas/mips/sync.d
@@ -1,6 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: sync instructions
-#as:
+#as: -mips2
 
 .*: +file format .*mips.*
 
diff --git a/gas/testsuite/gas/mn10300/am33.s b/gas/testsuite/gas/mn10300/am33.s
new file mode 100644
index 0000000..7ed3b6c
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33.s
@@ -0,0 +1,46 @@
+	.text
+	.am33
+	call 256,[a2,a3,exreg0],9
+	call 256,[a2,a3,exreg1],9
+	call 256,[a2,a3,exother],9
+	call 256,[a2,a3,all],9
+	call 131071,[a2,a3,exreg0],9
+	call 131071,[a2,a3,exreg1],9
+	call 131071,[a2,a3,exother],9
+	call 131071,[a2,a3,all],9
+	movm (sp),[a2,a3,exreg0]
+	movm (sp),[a2,a3,exreg1]
+	movm (sp),[a2,a3,exother]
+	movm (sp),[a2,a3,all]
+	movm [a2,a3,exreg0],(sp)
+	movm [a2,a3,exreg1],(sp)
+	movm [a2,a3,exother],(sp)
+	movm [a2,a3,all],(sp)
+	movm (usp),[a2,a3,exreg0]
+	movm (usp),[a2,a3,exreg1]
+	movm (usp),[a2,a3,exother]
+	movm (usp),[a2,a3,all]
+	movm [a2,a3,exreg0],(usp)
+	movm [a2,a3,exreg1],(usp)
+	movm [a2,a3,exother],(usp)
+	movm [a2,a3,all],(usp)
+	mov usp,a0
+	mov ssp,a1
+	mov msp,a2
+	mov pc,a3
+	mov a0,usp
+	mov a1,ssp
+	mov a2,msp
+	syscall 0x4
+	mov epsw,d0
+	mov d1,epsw
+	mov a0,r1
+	mov d2,r3
+	mov r5,a1
+	mov r7,d3
+	mcst9 d0
+	mcst48 d1
+	getchx d0
+	getclx d1
+	and 131072,epsw
+	or 65535,epsw
diff --git a/gas/testsuite/gas/mn10300/am33_2.s b/gas/testsuite/gas/mn10300/am33_2.s
new file mode 100644
index 0000000..0ff2a87
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_2.s
@@ -0,0 +1,64 @@
+	.text
+	.am33
+	mov r0,r1
+	ext r2
+	extb r3,r4
+	extbu r4,r5
+	exth r6,r7
+	exthu r7,r8
+	clr r9
+	add r10,r11
+	addc r12,r13
+	sub r14,r15
+	subc r15,r14
+	inc r13
+	inc4 r12
+	cmp r11,r10
+	mov xr0, r1
+	mov r1, xr2
+	and r0,r1
+	or r2,r3
+	xor r4,r5
+	not r6
+	asr r7,r8
+	lsr r9,r10
+	asl r11,r12
+	asl2 r13
+	ror r14
+	rol r15
+	mul r1,r2
+	mulu r3,r4
+	div r5,r6
+	divu r7,r8
+	mov (r1),r2
+	mov r3,(r4)
+	movbu (r5),r6
+	movbu r7,(r8)
+	movhu (r9),r10
+	movhu r11,(r12)
+	mov (r1+),r2
+	mov r3,(r4+)
+	mov (sp),r5
+	mov r6,(sp)
+	movbu (sp),r7
+	movbu r8,(sp)
+	movhu (sp),r9
+	movhu r10,(sp)
+	movhu (r6+),r7
+	movhu r8,(r9+)
+	mac r1,r2
+	macu r3,r4
+	macb r5,r6
+	macbu r7,r8
+	mach r9,r10
+	machu r11,r12
+	dmach r13,r14
+	dmachu r15,r14
+	dmulh r13,r12
+	dmulhu r11,r10
+	sat16 r9,r8
+	mcste r7,r6
+	swap r5,r4
+	swaph r3,r2
+	swhw  r1,r0
+	bsch r1,r2
diff --git a/gas/testsuite/gas/mn10300/am33_3.s b/gas/testsuite/gas/mn10300/am33_3.s
new file mode 100644
index 0000000..0bfadb5
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_3.s
@@ -0,0 +1,44 @@
+	.text
+	.am33
+	mov 16,r1
+	movu 16,r1
+	add 16,r1
+	addc 16,r1
+	sub 16,r1
+	subc 16,r1
+	cmp 16,r1
+	mov 16,xr1
+	and 16,r1
+	or 16,r1
+	xor 16,r1
+	asr 16,r1
+	lsr 16,r1
+	asl 16,r1
+	mul 16,r1
+	mulu 16,r1
+	btst 16,r1
+	mov (16,r1),r2
+	mov r2,(16,r1)
+	movbu (16,r1),r2
+	movbu r2,(16,r1)
+	movhu (16,r1),r2
+	movhu r2,(16,r1)
+	mov (16,sp),r2
+	mov r2,(16,sp)
+	movbu (16,sp),r2
+	movbu r2,(16,sp)
+	movhu (16,sp),r2
+	movhu r2,(16,sp)
+	mac 16,r1
+	macu 16,r1
+	macb 16,r1
+	macbu 16,r1
+	mach 16,r1
+	machu 16,r1
+	mcste 16,r1
+	add r1,r2,r3
+	mov (r1+,16),r2
+	mov r1,(r2+,16)
+	movhu (r1+,16),r2
+	movhu r1,(r2+,16)
+	
diff --git a/gas/testsuite/gas/mn10300/am33_4.s b/gas/testsuite/gas/mn10300/am33_4.s
new file mode 100644
index 0000000..7490fd3
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_4.s
@@ -0,0 +1,47 @@
+	.text
+	.am33
+	mov 0x1ffeff,r2
+	movu 0x1ffeff,r2
+	add 0x1ffeff,r2
+	addc 0x1ffeff,r2
+	sub 0x1ffeff,r2
+	subc 0x1ffeff,r2
+	cmp 0x1ffeff,r2
+	mov 0x1ffeff,xr2
+	and 0x1ffeff,r2
+	or 0x1ffeff,r2
+	xor 0x1ffeff,r2
+	asr 0x1ffeff,r2
+	lsr 0x1ffeff,r2
+	asl 0x1ffeff,r2
+	mul 0x1ffeff,r2
+	mulu 0x1ffeff,r2
+	btst 0x1ffeff,r2
+	mov (0x1ffeff,r1),r2
+	mov r2,(0x1ffeff,r1)
+	movbu (0x1ffeff,r1),r2
+	movbu r2,(0x1ffeff,r1)
+	movhu (0x1ffeff,r1),r2
+	movhu r2,(0x1ffeff,r1)
+	mov (0x1ffeff,sp),r2
+	mov r2,(0x1ffeff,sp)
+	movbu (0x1ffeff,sp),r2
+	movbu r2,(0x1ffeff,sp)
+	movhu (0x1ffeff,sp),r2
+	movhu r2,(0x1ffeff,sp)
+	mac 0x1ffeff,r2
+	macu 0x1ffeff,r2
+	macb 0x1ffeff,r2
+	macbu 0x1ffeff,r2
+	mach 0x1ffeff,r2
+	machu 0x1ffeff,r2
+	mov (0x1ffeff),r2
+	mov r2,(0x1ffeff)
+	movbu (0x1ffeff),r2
+	movbu r2,(0x1ffeff)
+	movhu (0x1ffeff),r2
+	movhu r2,(0x1ffeff)
+	mov (r1+,0x1ffeff),r2
+	mov r1,(r2+,0x1ffeff)
+	movhu (r1+,0x1ffeff),r2
+	movhu r1,(r2+,0x1ffeff)
diff --git a/gas/testsuite/gas/mn10300/am33_5.s b/gas/testsuite/gas/mn10300/am33_5.s
new file mode 100644
index 0000000..a2e3a39
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_5.s
@@ -0,0 +1,65 @@
+	.text
+	.am33
+	mov 0x7ffefdfc,r2
+	movu 0x7ffefdfc,r2
+	add 0x7ffefdfc,r2
+	addc 0x7ffefdfc,r2
+	sub 0x7ffefdfc,r2
+	subc 0x7ffefdfc,r2
+	cmp 0x7ffefdfc,r2
+	mov 0x7ffefdfc,xr2
+	and 0x7ffefdfc,r2
+	or 0x7ffefdfc,r2
+	xor 0x7ffefdfc,r2
+	asr 0x7ffefdfc,r2
+	lsr 0x7ffefdfc,r2
+	asl 0x7ffefdfc,r2
+	mul 0x7ffefdfc,r2
+	mulu 0x7ffefdfc,r2
+	btst 0x7ffefdfc,r2
+	mov (0x7ffefdfc,r1),r2
+	mov r2,(0x7ffefdfc,r1)
+	movbu (0x7ffefdfc,r1),r2
+	movbu r2,(0x7ffefdfc,r1)
+	movhu (0x7ffefdfc,r1),r2
+	movhu r2,(0x7ffefdfc,r1)
+	mov (0x7ffefdfc,sp),r2
+	mov r2,(0x7ffefdfc,sp)
+	movbu (0x7ffefdfc,sp),r2
+	movbu r2,(0x7ffefdfc,sp)
+	movhu (0x7ffefdfc,sp),r2
+	movhu r2,(0x7ffefdfc,sp)
+	mac 0x7ffefdfc,r2
+	macu 0x7ffefdfc,r2
+	macb 0x7ffefdfc,r2
+	macbu 0x7ffefdfc,r2
+	mach 0x7ffefdfc,r2
+	machu 0x7ffefdfc,r2
+	dmach 0x7ffefdfc,r2
+	dmachu 0x7ffefdfc,r2
+	dmulh 0x7ffefdfc,r2
+	dmulhu 0x7ffefdfc,r2
+	mov (0x7ffefdfc),r2
+	mov r2,(0x7ffefdfc)
+	movbu (0x7ffefdfc),r2
+	movbu r2,(0x7ffefdfc)
+	movhu (0x7ffefdfc),r2
+	movhu r2,(0x7ffefdfc)
+	mul d0,d1,a0,a1
+	mulu d0,d1,a0,a1
+	mov (r1+,0x7ffefdfc),r2
+	mov r1,(r2+,0x7ffefdfc)
+	movhu (r1+,0x7ffefdfc),r2
+	movhu r1,(r2+,0x7ffefdfc)
+	mov (-16,sp),r2
+	mov r2,(-16,sp)
+	movbu (-16,sp),r2
+	movbu r2,(-16,sp)
+	movhu (-16,sp),r2
+	movhu r2,(-16,sp)
+	mov (-1024,sp),r2
+	mov r2,(-1024,sp)
+	movbu (-1024,sp),r2
+	movbu r2,(-1024,sp)
+	movhu (-1024,sp),r2
+	movhu r2,(-1024,sp)
diff --git a/gas/testsuite/gas/mn10300/am33_6.s b/gas/testsuite/gas/mn10300/am33_6.s
new file mode 100644
index 0000000..01466f3
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_6.s
@@ -0,0 +1,70 @@
+	.text
+	.am33
+	add_add r4,r1,r2,r3
+	add_add r4,r1,2,r3
+	add_sub r4,r1,r2,r3
+	add_sub r4,r1,2,r3
+	add_cmp r4,r1,r2,r3
+	add_cmp r4,r1,2,r3
+	add_mov r4,r1,r2,r3
+	add_mov r4,r1,2,r3
+	add_asr r4,r1,r2,r3
+	add_asr r4,r1,2,r3
+	add_lsr r4,r1,r2,r3
+	add_lsr r4,r1,2,r3
+	add_asl r4,r1,r2,r3
+	add_asl r4,r1,2,r3
+	cmp_add r4,r1,r2,r3
+	cmp_add r4,r1,2,r3
+	cmp_sub r4,r1,r2,r3
+	cmp_sub r4,r1,2,r3
+	cmp_mov r4,r1,r2,r3
+	cmp_mov r4,r1,2,r3
+	cmp_asr r4,r1,r2,r3
+	cmp_asr r4,r1,2,r3
+	cmp_lsr r4,r1,r2,r3
+	cmp_lsr r4,r1,2,r3
+	cmp_asl r4,r1,r2,r3
+	cmp_asl r4,r1,2,r3
+	sub_add r4,r1,r2,r3
+	sub_add r4,r1,2,r3
+	sub_sub r4,r1,r2,r3
+	sub_sub r4,r1,2,r3
+	sub_cmp r4,r1,r2,r3
+	sub_cmp r4,r1,2,r3
+	sub_mov r4,r1,r2,r3
+	sub_mov r4,r1,2,r3
+	sub_asr r4,r1,r2,r3
+	sub_asr r4,r1,2,r3
+	sub_lsr r4,r1,r2,r3
+	sub_lsr r4,r1,2,r3
+	sub_asl r4,r1,r2,r3
+	sub_asl r4,r1,2,r3
+	mov_add r4,r1,r2,r3
+	mov_add r4,r1,2,r3
+	mov_sub r4,r1,r2,r3
+	mov_sub r4,r1,2,r3
+	mov_cmp r4,r1,r2,r3
+	mov_cmp r4,r1,2,r3
+	mov_mov r4,r1,r2,r3
+	mov_mov r4,r1,2,r3
+	mov_asr r4,r1,r2,r3
+	mov_asr r4,r1,2,r3
+	mov_lsr r4,r1,r2,r3
+	mov_lsr r4,r1,2,r3
+	mov_asl r4,r1,r2,r3
+	mov_asl r4,r1,2,r3
+	add_add 4,r1,r2,r3
+	add_add 4,r1,2,r3
+	add_sub 4,r1,r2,r3
+	add_sub 4,r1,2,r3
+	add_cmp 4,r1,r2,r3
+	add_cmp 4,r1,2,r3
+	add_mov 4,r1,r2,r3
+	add_mov 4,r1,2,r3
+	add_asr 4,r1,r2,r3
+	add_asr 4,r1,2,r3
+	add_lsr 4,r1,r2,r3
+	add_lsr 4,r1,2,r3
+	add_asl 4,r1,r2,r3
+	add_asl 4,r1,2,r3
diff --git a/gas/testsuite/gas/mn10300/am33_7.s b/gas/testsuite/gas/mn10300/am33_7.s
new file mode 100644
index 0000000..eeee5f4
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_7.s
@@ -0,0 +1,71 @@
+	.text
+	.am33
+	cmp_add 4,r1,r2,r3
+	cmp_add 4,r1,2,r3
+	cmp_sub 4,r1,r2,r3
+	cmp_sub 4,r1,2,r3
+	cmp_mov 4,r1,r2,r3
+	cmp_mov 4,r1,2,r3
+	cmp_asr 4,r1,r2,r3
+	cmp_asr 4,r1,2,r3
+	cmp_lsr 4,r1,r2,r3
+	cmp_lsr 4,r1,2,r3
+	cmp_asl 4,r1,r2,r3
+	cmp_asl 4,r1,2,r3
+	sub_add 4,r1,r2,r3
+	sub_add 4,r1,2,r3
+	sub_sub 4,r1,r2,r3
+	sub_sub 4,r1,2,r3
+	sub_cmp 4,r1,r2,r3
+	sub_cmp 4,r1,2,r3
+	sub_mov 4,r1,r2,r3
+	sub_mov 4,r1,2,r3
+	sub_asr 4,r1,r2,r3
+	sub_asr 4,r1,2,r3
+	sub_lsr 4,r1,r2,r3
+	sub_lsr 4,r1,2,r3
+	sub_asl 4,r1,r2,r3
+	sub_asl 4,r1,2,r3
+	mov_add 4,r1,r2,r3
+	mov_add 4,r1,2,r3
+	mov_sub 4,r1,r2,r3
+	mov_sub 4,r1,2,r3
+	mov_cmp 4,r1,r2,r3
+	mov_cmp 4,r1,2,r3
+	mov_mov 4,r1,r2,r3
+	mov_mov 4,r1,2,r3
+	mov_asr 4,r1,r2,r3
+	mov_asr 4,r1,2,r3
+	mov_lsr 4,r1,r2,r3
+	mov_lsr 4,r1,2,r3
+	mov_asl 4,r1,r2,r3
+	mov_asl 4,r1,2,r3
+	and_add r4,r1,r2,r3
+	and_add r4,r1,2,r3
+	and_sub r4,r1,r2,r3
+	and_sub r4,r1,2,r3
+	and_cmp r4,r1,r2,r3
+	and_cmp r4,r1,2,r3
+	and_mov r4,r1,r2,r3
+	and_mov r4,r1,2,r3
+	and_asr r4,r1,r2,r3
+	and_asr r4,r1,2,r3
+	and_lsr r4,r1,r2,r3
+	and_lsr r4,r1,2,r3
+	and_asl r4,r1,r2,r3
+	and_asl r4,r1,2,r3
+	dmach_add r4,r1,r2,r3
+	dmach_add r4,r1,2,r3
+	dmach_sub r4,r1,r2,r3
+	dmach_sub r4,r1,2,r3
+	dmach_cmp r4,r1,r2,r3
+	dmach_cmp r4,r1,2,r3
+	dmach_mov r4,r1,r2,r3
+	dmach_mov r4,r1,2,r3
+	dmach_asr r4,r1,r2,r3
+	dmach_asr r4,r1,2,r3
+	dmach_lsr r4,r1,r2,r3
+	dmach_lsr r4,r1,2,r3
+	dmach_asl r4,r1,r2,r3
+	dmach_asl r4,r1,2,r3
+
diff --git a/gas/testsuite/gas/mn10300/am33_8.s b/gas/testsuite/gas/mn10300/am33_8.s
new file mode 100644
index 0000000..b2a96d9
--- /dev/null
+++ b/gas/testsuite/gas/mn10300/am33_8.s
@@ -0,0 +1,70 @@
+	.text
+	.am33
+	xor_add r4,r1,r2,r3
+	xor_add r4,r1,2,r3
+	xor_sub r4,r1,r2,r3
+	xor_sub r4,r1,2,r3
+	xor_cmp r4,r1,r2,r3
+	xor_cmp r4,r1,2,r3
+	xor_mov r4,r1,r2,r3
+	xor_mov r4,r1,2,r3
+	xor_asr r4,r1,r2,r3
+	xor_asr r4,r1,2,r3
+	xor_lsr r4,r1,r2,r3
+	xor_lsr r4,r1,2,r3
+	xor_asl r4,r1,r2,r3
+	xor_asl r4,r1,2,r3
+	swhw_add r4,r1,r2,r3
+	swhw_add r4,r1,2,r3
+	swhw_sub r4,r1,r2,r3
+	swhw_sub r4,r1,2,r3
+	swhw_cmp r4,r1,r2,r3
+	swhw_cmp r4,r1,2,r3
+	swhw_mov r4,r1,r2,r3
+	swhw_mov r4,r1,2,r3
+	swhw_asr r4,r1,r2,r3
+	swhw_asr r4,r1,2,r3
+	swhw_lsr r4,r1,r2,r3
+	swhw_lsr r4,r1,2,r3
+	swhw_asl r4,r1,r2,r3
+	swhw_asl r4,r1,2,r3
+	or_add r4,r1,r2,r3
+	or_add r4,r1,2,r3
+	or_sub r4,r1,r2,r3
+	or_sub r4,r1,2,r3
+	or_cmp r4,r1,r2,r3
+	or_cmp r4,r1,2,r3
+	or_mov r4,r1,r2,r3
+	or_mov r4,r1,2,r3
+	or_asr r4,r1,r2,r3
+	or_asr r4,r1,2,r3
+	or_lsr r4,r1,r2,r3
+	or_lsr r4,r1,2,r3
+	or_asl r4,r1,r2,r3
+	or_asl r4,r1,2,r3
+	sat16_add r4,r1,r2,r3
+	sat16_add r4,r1,2,r3
+	sat16_sub r4,r1,r2,r3
+	sat16_sub r4,r1,2,r3
+	sat16_cmp r4,r1,r2,r3
+	sat16_cmp r4,r1,2,r3
+	sat16_mov r4,r1,r2,r3
+	sat16_mov r4,r1,2,r3
+	sat16_asr r4,r1,r2,r3
+	sat16_asr r4,r1,2,r3
+	sat16_lsr r4,r1,r2,r3
+	sat16_lsr r4,r1,2,r3
+	sat16_asl r4,r1,r2,r3
+	sat16_asl r4,r1,2,r3
+	mov_llt (r1+,4),r2
+	mov_lgt (r1+,4),r2
+	mov_lge (r1+,4),r2
+	mov_lle (r1+,4),r2
+	mov_lcs (r1+,4),r2
+	mov_lhi (r1+,4),r2
+	mov_lcc (r1+,4),r2
+	mov_lls (r1+,4),r2
+	mov_leq (r1+,4),r2
+	mov_lne (r1+,4),r2
+	mov_lra (r1+,4),r2
+
diff --git a/gas/testsuite/gas/mn10300/basic.exp b/gas/testsuite/gas/mn10300/basic.exp
index 7c057b9..d0f4811 100644
--- a/gas/testsuite/gas/mn10300/basic.exp
+++ b/gas/testsuite/gas/mn10300/basic.exp
@@ -960,6 +960,780 @@
     if [expr $x==160] then { pass $testname } else { fail $testname }
 }
 
+proc do_am33_1 {} {
+    set testname "am33.s: am33 tests part 1"
+    set x 0
+
+    gas_start "am33.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 CD000134\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +3 +09\[^\n\]*\n"			{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0005 CD000132\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +4 +09\[^\n\]*\n"			{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000a CD000131\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +5 +09\[^\n\]*\n"			{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000f CD0001FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +6 +09\[^\n\]*\n"			{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 DDFFFF01\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +7 +003409\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001b DDFFFF01\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +8 +003209\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0022 DDFFFF01\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +9 +003109\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0029 DDFFFF01\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +10 +00FF09\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 CE34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0032 CE32\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 CE31\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0036 CEFF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 CF34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003a CF32\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c CF31\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003e CFFF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 F8CE34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0043 F8CE32\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0046 F8CE31\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0049 F8CEFF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c F8CF34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004f F8CF32\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0052 F8CF31\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0055 F8CFFF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 F020\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005a F025\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c F02A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005e F02F\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 F030\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0062 F035\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 F03A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0066 F0E4\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 F2EC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006a F2F5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c F501\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006e F563\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 F595\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0072 F5DF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 F630\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0076 F665\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 F6C0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007a F6D5\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c FCFC0000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +45 +0200\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0082 FCFDFFFF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +46 +0000\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==54] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_2 {} {
+    set testname "am33_2.s: am33 tests part 2"
+    set x 0
+
+    gas_start "am33_2.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 F90801\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0003 F91822\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0006 F92834\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0009 F93845\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c F94867\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000f F95878\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0012 F96899\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0015 F978AB\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 F988CD\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001b F998EF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001e F9A8FE\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0021 F9B8DD\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F9C8CC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0027 F9D8BA\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002a F9E801\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002d F9F812\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 F90901\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0033 F91923\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0036 F92945\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0039 F93966\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c F94978\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003f F9599A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0042 F969BC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0045 F979DD\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 F989EE\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004b F999FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004e F9A912\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0051 F9B934\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 F9C956\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0057 F9D978\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005a F90A21\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005d F91A34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 F92A65\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0063 F93A78\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0066 F94AA9\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0069 F95ABC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c F96A21\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006f F97A34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0072 F98A50\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0075 F99A60\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 F9AA70\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007b F9BA80\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007e F9CA90\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0081 F9DAA0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 F9EA76\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0087 F9FA89\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008a F90B12\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008d F91B34\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 F92B56\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0093 F93B78\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0096 F94B9A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0099 F95BBC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c F96BDE\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009f F97BFE\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a2 F98BDC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a5 F99BBA\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 F9AB98\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ab F9BB76\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ae F9CB54\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b1 F9DB32\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 F9EB10\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b7 F9FB12\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==62] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_3 {} {
+    set testname "am33_3.s: am33 tests part 3"
+    set x 0
+
+    gas_start "am33_3.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 FB081110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 FB181110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 FB781110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c FB881110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 FB981110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 FBA81110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 FBD81110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c FBF81110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 FB091110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 FB191110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 FB291110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c FB491110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 FB591110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 FB691110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 FBA91110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c FBB91110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 FBE91110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 FB0A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 FB1A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c FB2A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 FB3A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 FB4A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 FB5A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c FB8A2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 FB9A2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 FBAA2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 FBBA2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c FBCA2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 FBDA2010\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 FB0B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 FB1B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c FB2B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 FB3B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 FB4B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 FB5B1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c FBBB1110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 FB7C1230\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 FB6A2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 FB7A1210\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c FBEA2110\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 FBFA1210\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==41] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_4 {} {
+    set testname "am33_4.s: am33 tests part 4"
+    set x 0
+
+    gas_start "am33_4.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 FD0822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +3 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0006 FD1822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +4 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c FD7822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +5 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0012 FD8822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +6 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 FD9822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +7 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001e FDA822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +8 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 FDD822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +9 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002a FDF822FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +10 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 FD0922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +11 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0036 FD1922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +12 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c FD2922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +13 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0042 FD4922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +14 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 FD5922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +15 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004e FD6922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +16 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 FDA922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +17 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005a FDB922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +18 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 FDE922FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +19 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0066 FD0A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +20 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c FD1A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +21 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0072 FD2A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +22 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 FD3A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +23 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007e FD4A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +24 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 FD5A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +25 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008a FD8A20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +26 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 FD9A20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +27 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0096 FDAA20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +28 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c FDBA20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +29 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a2 FDCA20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +30 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 FDDA20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +31 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ae FD0B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +32 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 FD1B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +33 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ba FD2B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +34 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 FD3B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +35 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c6 FD4B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +36 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc FD5B22FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +37 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d2 FD0E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +38 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 FD1E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +39 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00de FD2E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +40 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 FD3E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +41 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ea FD4E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +42 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 FD5E20FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +43 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f6 FD6A21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +44 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc FD7A12FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +45 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0102 FDEA21FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +46 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 FDFA12FF\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +47 +FE1F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==90] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_5 {} {
+    set testname "am33_5.s: am33 tests part 5"
+    set x 0
+
+    gas_start "am33_5.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 FE0822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +3 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0007 FE1822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +4 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000e FE7822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +5 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0015 FE8822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +6 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c FE9822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +7 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0023 FEA822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +8 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002a FED822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +9 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0031 FEF822FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +10 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 FE0922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +11 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003f FE1922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +12 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0046 FE2922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +13 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004d FE4922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +14 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 FE5922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +15 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005b FE6922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +16 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0062 FEA922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +17 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0069 FEB922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +18 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 FEE922FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +19 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0077 FE0A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +20 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007e FE1A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +21 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0085 FE2A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +22 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c FE3A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +23 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0093 FE4A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +24 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009a FE5A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +25 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a1 FE8A20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +26 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 FE9A20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +27 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00af FEAA20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +28 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b6 FEBA20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +29 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bd FECA20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +30 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 FEDA20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +31 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cb FE0B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +32 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d2 FE1B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +33 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d9 FE2B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +34 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 FE3B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +35 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e7 FE4B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +36 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ee FE5B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +37 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f5 FE6B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +38 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc FE7B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +39 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0103 FE8B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +40 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010a FE9B22FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +41 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0111 FE0E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +42 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0118 FE1E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +43 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 011f FE2E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +44 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0126 FE3E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +45 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 012d FE4E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +46 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0134 FE5E20FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +47 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013b FBADCD89\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 013f FBBDCD89\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0143 FE6A21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +50 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 014a FE7A12FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +51 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0151 FEEA21FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +52 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0158 FEFA12FC\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +53 +FDFE7F\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 015f FE8A20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +54 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0166 FE9A20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +55 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 016d FEAA20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +56 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0174 FEBA20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +57 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 017b FECA20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +58 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0182 FEDA20F0\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +59 +FFFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0189 FE8A2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +60 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0190 FE9A2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +61 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0197 FEAA2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +62 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 019e FEBA2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +63 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01a5 FECA2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +64 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 01ac FEDA2000\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +65 +FCFFFF\[^\n\]*\n"		{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==124] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_6 {} {
+    set testname "am33_6.s: am33 tests part 6"
+    set x 0
+
+    gas_start "am33_6.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 F7004123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 F7104123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 F7204123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c F7304123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 F7404123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 F7504123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 F7604123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c F7704123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 F7804123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F7904123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 F7A04123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c F7B04123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 F7C04123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 F7D04123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 F7014123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c F7114123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 F7214123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 F7314123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 F7614123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c F7714123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 F7814123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 F7914123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 F7A14123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c F7B14123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 F7C14123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 F7D14123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 F7024123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c F7124123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 F7224123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 F7324123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 F7424123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c F7524123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 F7624123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 F7724123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 F7824123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c F7924123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 F7A24123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 F7B24123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 F7C24123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c F7D24123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 F7034123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 F7134123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 F7234123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac F7334123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 F7434123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 F7534123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 F7634123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc F7734123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 F7834123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 F7934123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 F7A34123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc F7B34123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 F7C34123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 F7D34123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 F7044123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc F7144123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 F7244123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 F7344123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 F7444123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec F7544123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 F7644123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 F7744123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 F7844123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc F7944123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 F7A44123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 F7B44123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 F7C44123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c F7D44123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==68] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_7 {} {
+    set testname "am33_7.s: am33 tests part 7"
+    set x 0
+
+    gas_start "am33_7.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 F7054123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 F7154123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 F7254123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c F7354123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 F7654123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 F7754123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 F7854123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c F7954123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 F7A54123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F7B54123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 F7C54123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c F7D54123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 F7064123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 F7164123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 F7264123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c F7364123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 F7464123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 F7564123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 F7664123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c F7764123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 F7864123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 F7964123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 F7A64123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c F7B64123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 F7C64123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 F7D64123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 F7074123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c F7174123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 F7274123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 F7374123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 F7474123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c F7574123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 F7674123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 F7774123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 F7874123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c F7974123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 F7A74123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 F7B74123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 F7C74123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c F7D74123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 F7084123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 F7184123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 F7284123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac F7384123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 F7484123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 F7584123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 F7684123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc F7784123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 F7884123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 F7984123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 F7A84123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc F7B84123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 F7C84123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 F7D84123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 F7094123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc F7194123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 F7294123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 F7394123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 F7494123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec F7594123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 F7694123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 F7794123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 F7894123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc F7994123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 F7A94123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 F7B94123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 F7C94123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 010c F7D94123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==68] then { pass $testname } else { fail $testname }
+}
+
+proc do_am33_8 {} {
+    set testname "am33_8.s: am33 tests part 8"
+    set x 0
+
+    gas_start "am33_8.s" "-al"
+
+    # Instead of having a variable for each match string just increment the
+    # total number of matches seen.  That's simpler when testing large numbers
+    # of instructions (as these tests to).
+    while 1 {
+	expect {
+	    -re "^ +\[0-9\]+ 0000 F70A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0004 F71A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0008 F72A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 000c F73A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0010 F74A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0014 F75A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0018 F76A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 001c F77A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0020 F78A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0024 F79A4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0028 F7AA4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 002c F7BA4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0030 F7CA4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0034 F7DA4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0038 F70B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 003c F71B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0040 F72B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0044 F73B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0048 F74B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 004c F75B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0050 F76B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0054 F77B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0058 F78B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 005c F79B4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0060 F7AB4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0064 F7BB4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0068 F7CB4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 006c F7DB4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0070 F70C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0074 F71C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0078 F72C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 007c F73C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0080 F74C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0084 F75C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0088 F76C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 008c F77C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0090 F78C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0094 F79C4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0098 F7AC4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 009c F7BC4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a0 F7CC4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a4 F7DC4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00a8 F70D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ac F71D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b0 F72D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b4 F73D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00b8 F74D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00bc F75D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c0 F76D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c4 F77D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00c8 F78D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00cc F79D4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d0 F7AD4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d4 F7BD4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00d8 F7CD4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00dc F7DD4123\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e0 F7E02140\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e4 F7E02141\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00e8 F7E02142\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00ec F7E02143\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f0 F7E02144\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f4 F7E02145\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00f8 F7E02146\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 00fc F7E02147\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0100 F7E02148\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0104 F7E02149\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "^ +\[0-9\]+ 0108 F7E0214A\[^\n\]*\n"	{ set x [expr $x+1] }
+	    -re "\[^\n\]*\n"				{ }
+	    timeout				{ perror "timeout\n"; break }
+	    eof					{ break }
+	}
+    }
+
+    # This was intended to do any cleanup necessary.  It kinda looks like it
+    # isn't needed, but just in case, please keep it in for now.
+    gas_finish
+
+    # Did we find what we were looking for?  If not, flunk it.
+    if [expr $x==67] then { pass $testname } else { fail $testname }
+}
+
 
 if [istarget mn10300*-*-*] then {
     # Test the basic instruction parser.
@@ -983,4 +1757,12 @@
     do_shift
     do_sub
     do_udf
+    do_am33_1
+    do_am33_2
+    do_am33_3
+    do_am33_4
+    do_am33_5
+    do_am33_6
+    do_am33_7
+    do_am33_8
 }
diff --git a/gas/testsuite/gas/pj/ops.d b/gas/testsuite/gas/pj/ops.d
new file mode 100644
index 0000000..3c61971
--- /dev/null
+++ b/gas/testsuite/gas/pj/ops.d
@@ -0,0 +1,407 @@
+#objdump: -dr
+#name: pj
+#as
+
+# test all the instructions
+
+.*: +file format elf32-pj
+
+Disassembly of section .text:
+
+00000000 <foo0-0x1>:
+	...
+
+00000001 <foo0>:
+	...
+
+00000002 <foo1>:
+	...
+
+00000003 <foo2>:
+	...
+
+00000004 <foo3>:
+	...
+
+00000005 <foo4>:
+	...
+
+00000006 <foo5>:
+	...
+
+00000007 <foo6>:
+	...
+
+00000008 <foo7>:
+	...
+
+00000009 <foo8>:
+	...
+
+0000000a <foo9>:
+	...
+
+0000000b <foo10>:
+	...
+
+0000000c <foo11>:
+	...
+
+0000000d <foo12>:
+	...
+
+0000000e <foo13>:
+	...
+
+0000000f <foo14>:
+	...
+
+00000010 <foo15>:
+	...
+
+00000011 <foo16>:
+	...
+
+00000012 <foo17>:
+	...
+
+00000013 <foo18>:
+	...
+
+00000014 <foo19>:
+  14:	00          	nop
+  15:	01          	aconst_null
+  16:	02          	iconst_m1
+  17:	03          	iconst_0
+  18:	04          	iconst_1
+  19:	05          	iconst_2
+  1a:	06          	iconst_3
+  1b:	07          	iconst_4
+  1c:	08          	iconst_5
+  1d:	09          	lconst_0
+  1e:	0a          	lconst_1
+  1f:	0b          	fconst_0
+  20:	0c          	fconst_1
+  21:	0d          	fconst_2
+  22:	0e          	dconst_0
+  23:	0f          	dconst_1
+  24:	10 e7       	bipush	-25
+  26:	11 a3 c6    	sipush	-23610
+  29:	12 00       	ldc
+  2b:	13 00 00    	ldc_w
+  2e:	14 00 00    	ldc2_w
+  31:	15 69       	iload	105
+  33:	16 73       	lload	115
+  35:	17 51       	fload	81
+  37:	18 ff       	dload	255
+  39:	19 4a       	aload	74
+  3b:	1a          	iload_0
+  3c:	1b          	iload_1
+  3d:	1c          	iload_2
+  3e:	1d          	iload_3
+  3f:	1e          	lload_0
+  40:	1f          	lload_1
+  41:	20          	lload_2
+  42:	21          	lload_3
+  43:	22          	fload_0
+  44:	23          	fload_1
+  45:	24          	fload_2
+  46:	25          	fload_3
+  47:	26          	dload_0
+  48:	27          	dload_1
+  49:	28          	dload_2
+  4a:	29          	dload_3
+  4b:	2a          	aload_0
+  4c:	2b          	aload_1
+  4d:	2c          	aload_2
+  4e:	2d          	aload_3
+  4f:	2e          	iaload
+  50:	2f          	laload
+  51:	30          	faload
+  52:	31          	daload
+  53:	32          	aaload
+  54:	33          	baload
+  55:	34          	caload
+  56:	35          	saload
+  57:	36 ec       	istore	236
+  59:	37 29       	lstore	41
+  5b:	38 cd       	fstore	205
+  5d:	39 ba       	dstore	186
+  5f:	3a ab       	astore	171
+  61:	3b          	istore_0
+  62:	3c          	istore_1
+  63:	3d          	istore_2
+  64:	3e          	istore_3
+  65:	3f          	lstore_0
+  66:	40          	lstore_1
+  67:	41          	lstore_2
+  68:	42          	lstore_3
+  69:	43          	fstore_0
+  6a:	44          	fstore_1
+  6b:	45          	fstore_2
+  6c:	46          	fstore_3
+  6d:	47          	dstore_0
+  6e:	48          	dstore_1
+  6f:	49          	dstore_2
+  70:	4a          	dstore_3
+  71:	4b          	astore_0
+  72:	4c          	astore_1
+  73:	4d          	astore_2
+  74:	4e          	astore_3
+  75:	4f          	iastore
+  76:	50          	lastore
+  77:	51          	fastore
+  78:	52          	dastore
+  79:	53          	aastore
+  7a:	54          	bastore
+  7b:	55          	castore
+  7c:	56          	sastore
+  7d:	57          	pop
+  7e:	58          	pop2
+  7f:	59          	dup
+  80:	5a          	dup_x1
+  81:	5b          	dup_x2
+  82:	5c          	dup2
+  83:	5d          	dup2_x1
+  84:	5e          	dup2_x2
+  85:	5f          	swap
+  86:	60          	iadd
+  87:	61          	ladd
+  88:	62          	fadd
+  89:	63          	dadd
+  8a:	64          	isub
+  8b:	65          	lsub
+  8c:	66          	fsub
+  8d:	67          	dsub
+  8e:	68          	imul
+  8f:	69          	lmul
+  90:	6a          	fmul
+  91:	6b          	dmul
+  92:	6c          	idiv
+  93:	6d          	ldiv
+  94:	6e          	fdiv
+  95:	6f          	ddiv
+  96:	70          	irem
+  97:	71          	lrem
+  98:	72          	frem
+  99:	73          	drem
+  9a:	74          	ineg
+  9b:	75          	lneg
+  9c:	76          	fneg
+  9d:	77          	dneg
+  9e:	78          	ishl
+  9f:	79          	lshl
+  a0:	7a          	ishr
+  a1:	7b          	lshr
+  a2:	7c          	iushr
+  a3:	7d          	lushr
+  a4:	7e          	iand
+  a5:	7f          	land
+  a6:	80          	ior
+  a7:	81          	lor
+  a8:	82          	ixor
+  a9:	83          	lxor
+  aa:	84 f2 7b    	iinc	242,123
+  ad:	85          	i2l
+  ae:	86          	i2f
+  af:	87          	i2d
+  b0:	88          	l2i
+  b1:	89          	l2f
+  b2:	8a          	l2d
+  b3:	8b          	f2i
+  b4:	8c          	f2l
+  b5:	8d          	f2d
+  b6:	8e          	d2i
+  b7:	8f          	d2l
+  b8:	90          	d2f
+  b9:	91          	i2b
+  ba:	92          	i2c
+  bb:	93          	i2s
+  bc:	94          	lcmp
+  bd:	95          	fcmpl
+  be:	96          	fcmpg
+  bf:	97          	dcmpl
+  c0:	98          	dcmpg
+  c1:	99 ff 41    	ifeq2 <foo1>
+  c4:	9a ff 47    	ifneb <foo10>
+  c7:	9b ff 41    	iflt8 <foo7>
+  ca:	9c ff 48    	ifge12 <foo17>
+  cd:	9d ff 39    	ifgt6 <foo5>
+  d0:	9e ff 3a    	iflea <foo9>
+  d3:	9f ff 38    	if_icmpeqb <foo10>
+  d6:	a0 ff 3a    	if_icmpne10 <foo15>
+  d9:	a1 ff 30    	if_icmplt9 <foo8>
+  dc:	a2 ff 31    	if_icmpged <foo12>
+  df:	a3 ff 29    	if_icmpgt8 <foo7>
+  e2:	a4 ff 2b    	if_icmpled <foo12>
+  e5:	a5 ff 22    	if_acmpeq7 <foo6>
+  e8:	a6 ff 20    	if_acmpne8 <foo7>
+  eb:	a7 ff 1b    	goto6 <foo5>
+  ee:	a8 00 00    	jsr
+  f1:	a9 00       	ret
+  f3:	aa ff ff ff 	tableswitch default: .*
+  f7:	0f 00 00 00 
+  fb:	01 00 00 00 
+  ff:	05 ff ff ff 
+ 103:	14 ff ff ff 
+ 107:	12 ff ff ff 
+ 10b:	1f ff ff ff 
+ 10f:	14 ff ff ff 
+ 113:	12 
+ 114:	ab 00 00 00 	lookupswitch default: .*
+ 118:	ff ff fe f2 
+ 11c:	00 00 00 02 
+ 120:	00 00 00 07 
+ 124:	ff ff fe fb 
+ 128:	00 00 00 25 
+ 12c:	ff ff fe fc 
+ 130:	ac          	ireturn
+ 131:	ad          	lreturn
+ 132:	ae          	freturn
+ 133:	af          	dreturn
+ 134:	b0          	areturn
+ 135:	b1          	return
+ 136:	b2 00 00    	getstatic
+ 139:	b3 00 00    	putstatic
+ 13c:	b4 00 00    	getfield
+ 13f:	b5 00 00    	putfield
+ 142:	b6 00 00    	invokevirtual
+ 145:	b7 00 00    	invokespecial
+ 148:	b8 00 00    	invokestatic
+ 14b:	b9 00 00 00 	invokeinterface
+ 14f:	00 
+ 150:	bb 00 00    	new
+ 153:	bc 00       	newarray
+ 155:	bd 00 00    	anewarray
+ 158:	be          	arraylength
+ 159:	bf          	athrow
+ 15a:	c0 00 00    	checkcast
+ 15d:	c1 00 00    	instanceof
+ 160:	c2          	monitorenter
+ 161:	c3          	monitorexit
+ 162:	c4          	wide
+ 163:	c5 00 00 00 	multianewarray
+ 167:	c6 00 00    	ifnull
+ 16a:	c7 00 00    	ifnonnull
+ 16d:	c8 00 00 00 	goto_w
+ 171:	00 
+ 172:	c9 00 00 00 	jsr_w
+ 176:	00 
+ 177:	ca          	breakpoint
+ 178:	cb          	bytecode
+ 179:	cc          	try
+ 17a:	cd          	endtry
+ 17b:	ce          	catch
+ 17c:	cf          	var
+ 17d:	d0          	endvar
+ 17e:	ed b0 a3    	sethi	-20317
+ 181:	ee 5a a5    	load_word_index	90,165
+ 184:	ef 5d 85    	load_short_index	93,133
+ 187:	f0 17 d8    	load_char_index	23,216
+ 18a:	f1 e9 de    	load_byte_index	233,222
+ 18d:	f2 d4 2b    	load_ubyte_index	212,43
+ 190:	f3 b2 4d    	store_word_index	178,77
+ 193:	f4 c6 1b    	na_store_word_index	198,27
+ 196:	f5 b4 d4    	store_short_index	180,212
+ 199:	f6 11 8e    	store_byte_index	17,142
+ 19c:	ff 00       	load_ubyte	
+ 19e:	ff 01       	load_byte	
+ 1a0:	ff 02       	load_char	
+ 1a2:	ff 03       	load_short	
+ 1a4:	ff 04       	load_word	
+ 1a6:	ff 05       	priv_ret_from_trap	
+ 1a8:	ff 06       	priv_read_dcache_tag	
+ 1aa:	ff 07       	priv_read_dcache_data	
+ 1ac:	ff 0a       	load_char_oe	
+ 1ae:	ff 0b       	load_short_oe	
+ 1b0:	ff 0c       	load_word_oe	
+ 1b2:	ff 0d       	return0	
+ 1b4:	ff 0e       	priv_read_icache_tag	
+ 1b6:	ff 0f       	priv_read_icache_data	
+ 1b8:	ff 10       	ncload_ubyte	
+ 1ba:	ff 11       	ncload_byte	
+ 1bc:	ff 12       	ncload_char	
+ 1be:	ff 13       	ncload_short	
+ 1c0:	ff 14       	ncload_word	
+ 1c2:	ff 15       	iucmp	
+ 1c4:	ff 16       	priv_powerdown	
+ 1c6:	ff 17       	cache_invalidate	
+ 1c8:	ff 1a       	ncload_char_oe	
+ 1ca:	ff 1b       	ncload_short_oe	
+ 1cc:	ff 1c       	ncload_word_oe	
+ 1ce:	ff 1d       	return1	
+ 1d0:	ff 1e       	cache_flush	
+ 1d2:	ff 1f       	cache_index_flush	
+ 1d4:	ff 20       	store_byte	
+ 1d6:	ff 22       	store_short	
+ 1d8:	ff 24       	store_word	
+ 1da:	ff 25       	soft_trap	
+ 1dc:	ff 26       	priv_write_dcache_tag	
+ 1de:	ff 27       	priv_write_dcache_data	
+ 1e0:	ff 2a       	store_short_oe	
+ 1e2:	ff 2c       	store_word_oe	
+ 1e4:	ff 2d       	return2	
+ 1e6:	ff 2e       	priv_write_icache_tag	
+ 1e8:	ff 2f       	priv_write_icache_data	
+ 1ea:	ff 30       	ncstore_byte	
+ 1ec:	ff 32       	ncstore_short	
+ 1ee:	ff 34       	ncstore_word	
+ 1f0:	ff 36       	priv_reset	
+ 1f2:	ff 37       	get_current_class	
+ 1f4:	ff 3a       	ncstore_short_oe	
+ 1f6:	ff 3c       	ncstore_word_oe	
+ 1f8:	ff 3d       	call	
+ 1fa:	ff 3e       	zero_line	
+ 1fc:	ff 3f       	priv_update_optop	
+ 1fe:	ff 40       	read_pc	
+ 200:	ff 41       	read_vars	
+ 202:	ff 42       	read_frame	
+ 204:	ff 43       	read_optop	
+ 206:	ff 44       	priv_read_oplim	
+ 208:	ff 45       	read_const_pool	
+ 20a:	ff 46       	priv_read_psr	
+ 20c:	ff 47       	priv_read_trapbase	
+ 20e:	ff 48       	priv_read_lockcount0	
+ 210:	ff 49       	priv_read_lockcount1	
+ 212:	ff 4c       	priv_read_lockaddr0	
+ 214:	ff 4d       	priv_read_lockaddr1	
+ 216:	ff 50       	priv_read_userrange1	
+ 218:	ff 51       	priv_read_gc_config	
+ 21a:	ff 52       	priv_read_brk1a	
+ 21c:	ff 53       	priv_read_brk2a	
+ 21e:	ff 54       	priv_read_brk12c	
+ 220:	ff 55       	priv_read_userrange2	
+ 222:	ff 57       	priv_read_versionid	
+ 224:	ff 58       	priv_read_hcr	
+ 226:	ff 59       	priv_read_sc_bottom	
+ 228:	ff 5a       	read_global0	
+ 22a:	ff 5b       	read_global1	
+ 22c:	ff 5c       	read_global2	
+ 22e:	ff 5d       	read_global3	
+ 230:	ff 60       	write_pc	
+ 232:	ff 61       	write_vars	
+ 234:	ff 62       	write_frame	
+ 236:	ff 63       	write_optop	
+ 238:	ff 64       	priv_write_oplim	
+ 23a:	ff 65       	write_const_pool	
+ 23c:	ff 66       	priv_write_psr	
+ 23e:	ff 67       	priv_write_trapbase	
+ 240:	ff 68       	priv_write_lockcount0	
+ 242:	ff 69       	priv_write_lockcount1	
+ 244:	ff 6c       	priv_write_lockaddr0	
+ 246:	ff 6d       	priv_write_lockaddr1	
+ 248:	ff 70       	priv_write_userrange1	
+ 24a:	ff 71       	priv_write_gc_config	
+ 24c:	ff 72       	priv_write_brk1a	
+ 24e:	ff 73       	priv_write_brk2a	
+ 250:	ff 74       	priv_write_brk12c	
+ 252:	ff 75       	priv_write_userrange2	
+ 254:	ff 79       	priv_write_sc_bottom	
+ 256:	ff 7a       	write_global0	
+ 258:	ff 7b       	write_global1	
+ 25a:	ff 7c       	write_global2	
+ 25c:	ff 7d       	write_global3	
+ 25e:	ff ae       	tm_putchar	
+ 260:	ff af       	tm_exit	
+ 262:	ff b0       	tm_trap	
+ 264:	ff b1       	tm_minfo	
diff --git a/gas/testsuite/gas/pj/ops.s b/gas/testsuite/gas/pj/ops.s
new file mode 100644
index 0000000..7c8109b
--- /dev/null
+++ b/gas/testsuite/gas/pj/ops.s
@@ -0,0 +1,397 @@
+.L0:	nop
+.globl foo0
+foo0:
+.L1:	nop
+.globl foo1
+foo1:
+.L2:	nop
+.globl foo2
+foo2:
+.L3:	nop
+.globl foo3
+foo3:
+.L4:	nop
+.globl foo4
+foo4:
+.L5:	nop
+.globl foo5
+foo5:
+.L6:	nop
+.globl foo6
+foo6:
+.L7:	nop
+.globl foo7
+foo7:
+.L8:	nop
+.globl foo8
+foo8:
+.L9:	nop
+.globl foo9
+foo9:
+.L10:	nop
+.globl foo10
+foo10:
+.L11:	nop
+.globl foo11
+foo11:
+.L12:	nop
+.globl foo12
+foo12:
+.L13:	nop
+.globl foo13
+foo13:
+.L14:	nop
+.globl foo14
+foo14:
+.L15:	nop
+.globl foo15
+foo15:
+.L16:	nop
+.globl foo16
+foo16:
+.L17:	nop
+.globl foo17
+foo17:
+.L18:	nop
+.globl foo18
+foo18:
+.L19:	nop
+.globl foo19
+foo19:
+	nop
+	aconst_null
+	iconst_m1
+	iconst_0
+	iconst_1
+	iconst_2
+	iconst_3
+	iconst_4
+	iconst_5
+	lconst_0
+	lconst_1
+	fconst_0
+	fconst_1
+	fconst_2
+	dconst_0
+	dconst_1
+	bipush -25
+	sipush -23610
+	ldc
+	ldc_w
+	ldc2_w
+	iload 105
+	lload 115
+	fload 81
+	dload 255
+	aload 74
+	iload_0
+	iload_1
+	iload_2
+	iload_3
+	lload_0
+	lload_1
+	lload_2
+	lload_3
+	fload_0
+	fload_1
+	fload_2
+	fload_3
+	dload_0
+	dload_1
+	dload_2
+	dload_3
+	aload_0
+	aload_1
+	aload_2
+	aload_3
+	iaload
+	laload
+	faload
+	daload
+	aaload
+	baload
+	caload
+	saload
+	istore 236
+	lstore 41
+	fstore 205
+	dstore 186
+	astore 171
+	istore_0
+	istore_1
+	istore_2
+	istore_3
+	lstore_0
+	lstore_1
+	lstore_2
+	lstore_3
+	fstore_0
+	fstore_1
+	fstore_2
+	fstore_3
+	dstore_0
+	dstore_1
+	dstore_2
+	dstore_3
+	astore_0
+	astore_1
+	astore_2
+	astore_3
+	iastore
+	lastore
+	fastore
+	dastore
+	aastore
+	bastore
+	castore
+	sastore
+	pop
+	pop2
+	dup
+	dup_x1
+	dup_x2
+	dup2
+	dup2_x1
+	dup2_x2
+	swap
+	iadd
+	ladd
+	fadd
+	dadd
+	isub
+	lsub
+	fsub
+	dsub
+	imul
+	lmul
+	fmul
+	dmul
+	idiv
+	ldiv
+	fdiv
+	ddiv
+	irem
+	lrem
+	frem
+	drem
+	ineg
+	lneg
+	fneg
+	dneg
+	ishl
+	lshl
+	ishr
+	lshr
+	iushr
+	lushr
+	iand
+	land
+	ior
+	lor
+	ixor
+	lxor
+	iinc 242, 123
+	i2l
+	i2f
+	i2d
+	l2i
+	l2f
+	l2d
+	f2i
+	f2l
+	f2d
+	d2i
+	d2l
+	d2f
+	i2b
+	i2c
+	i2s
+	lcmp
+	fcmpl
+	fcmpg
+	dcmpl
+	dcmpg
+	ifeq .L2
+	ifne .L11
+	iflt .L8
+	ifge .L18
+	ifgt .L6
+	ifle .L10
+	if_icmpeq .L11
+	if_icmpne .L16
+	if_icmplt .L9
+	if_icmpge .L13
+	if_icmpgt .L8
+	if_icmple .L13
+	if_acmpeq .L7
+	if_acmpne .L8
+	goto .L6
+	jsr
+	ret
+.Lt:	tableswitch
+
+	.align 2
+	.long .L2-.Lt
+	.long 1
+	.long 5
+	.long .L7-.Lt
+	.long .L5-.Lt
+	.long .L18-.Lt
+	.long .L7-.Lt
+	.long .L5-.Lt
+.Ll:	lookupswitch
+
+	.align 2
+	.long .L6-.Ll
+	.long 2
+	.long 7
+	.long .L15-.Ll
+	.long 37
+	.long .L16-.Ll
+	ireturn
+	lreturn
+	freturn
+	dreturn
+	areturn
+	return
+	getstatic
+	putstatic
+	getfield
+	putfield
+	invokevirtual
+	invokespecial
+	invokestatic
+	invokeinterface
+	new
+	newarray
+	anewarray
+	arraylength
+	athrow
+	checkcast
+	instanceof
+	monitorenter
+	monitorexit
+	wide
+	multianewarray
+	ifnull
+	ifnonnull
+	goto_w
+	jsr_w
+	breakpoint
+	bytecode
+	try
+	endtry
+	catch
+	var
+	endvar
+	sethi -20317
+	load_word_index 90, -91
+	load_short_index 93, -123
+	load_char_index 23, -40
+	load_byte_index 233, -34
+	load_ubyte_index 212, 43
+	store_word_index 178, 77
+	na_store_word_index 198, 27
+	store_short_index 180, -44
+	store_byte_index 17, -114
+	load_ubyte
+	load_byte
+	load_char
+	load_short
+	load_word
+	priv_ret_from_trap
+	priv_read_dcache_tag
+	priv_read_dcache_data
+	load_char_oe
+	load_short_oe
+	load_word_oe
+	return0
+	priv_read_icache_tag
+	priv_read_icache_data
+	ncload_ubyte
+	ncload_byte
+	ncload_char
+	ncload_short
+	ncload_word
+	iucmp
+	priv_powerdown
+	cache_invalidate
+	ncload_char_oe
+	ncload_short_oe
+	ncload_word_oe
+	return1
+	cache_flush
+	cache_index_flush
+	store_byte
+	store_short
+	store_word
+	soft_trap
+	priv_write_dcache_tag
+	priv_write_dcache_data
+	store_short_oe
+	store_word_oe
+	return2
+	priv_write_icache_tag
+	priv_write_icache_data
+	ncstore_byte
+	ncstore_short
+	ncstore_word
+	priv_reset
+	get_current_class
+	ncstore_short_oe
+	ncstore_word_oe
+	call
+	zero_line
+	priv_update_optop
+	read_pc
+	read_vars
+	read_frame
+	read_optop
+	priv_read_oplim
+	read_const_pool
+	priv_read_psr
+	priv_read_trapbase
+	priv_read_lockcount0
+	priv_read_lockcount1
+	priv_read_lockaddr0
+	priv_read_lockaddr1
+	priv_read_userrange1
+	priv_read_gc_config
+	priv_read_brk1a
+	priv_read_brk2a
+	priv_read_brk12c
+	priv_read_userrange2
+	priv_read_versionid
+	priv_read_hcr
+	priv_read_sc_bottom
+	read_global0
+	read_global1
+	read_global2
+	read_global3
+	write_pc
+	write_vars
+	write_frame
+	write_optop
+	priv_write_oplim
+	write_const_pool
+	priv_write_psr
+	priv_write_trapbase
+	priv_write_lockcount0
+	priv_write_lockcount1
+	priv_write_lockaddr0
+	priv_write_lockaddr1
+	priv_write_userrange1
+	priv_write_gc_config
+	priv_write_brk1a
+	priv_write_brk2a
+	priv_write_brk12c
+	priv_write_userrange2
+	priv_write_sc_bottom
+	write_global0
+	write_global1
+	write_global2
+	write_global3
+	tm_putchar
+	tm_exit
+	tm_trap
+	tm_minfo
diff --git a/gas/testsuite/gas/pj/pj.exp b/gas/testsuite/gas/pj/pj.exp
new file mode 100644
index 0000000..b8a4036
--- /dev/null
+++ b/gas/testsuite/gas/pj/pj.exp
@@ -0,0 +1,7 @@
+#
+# Some pj tests
+#
+if [istarget pj*] then {
+    run_dump_test "ops"
+}
+
diff --git a/gas/testsuite/gas/sparc/prefetch.d b/gas/testsuite/gas/sparc/prefetch.d
index 41803ed..48f4215 100644
--- a/gas/testsuite/gas/sparc/prefetch.d
+++ b/gas/testsuite/gas/sparc/prefetch.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr
 #name: sparc64 prefetch
 
diff --git a/gas/testsuite/gas/sparc/rdpr.d b/gas/testsuite/gas/sparc/rdpr.d
index 60a7b61..e36ea9b 100644
--- a/gas/testsuite/gas/sparc/rdpr.d
+++ b/gas/testsuite/gas/sparc/rdpr.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr
 #name: sparc64 rdpr
 
diff --git a/gas/testsuite/gas/sparc/reloc64.d b/gas/testsuite/gas/sparc/reloc64.d
index f4b825a..da40d0c 100644
--- a/gas/testsuite/gas/sparc/reloc64.d
+++ b/gas/testsuite/gas/sparc/reloc64.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr
 #name: sparc64 reloc64
 
@@ -10,12 +10,12 @@
    0:	03 04 8d 15 	sethi  %hi\(0x12345400\), %g1
    4:	82 10 62 78 	or  %g1, 0x278, %g1.*
    8:	01 00 00 00 	nop 
-   c:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+   c:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			c: R_SPARC_HH22	.text
   10:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			10: R_SPARC_HM10	.text
   14:	01 00 00 00 	nop 
-  18:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  18:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			18: R_SPARC_HH22	.text\+0x1234567800000000
   1c:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			1c: R_SPARC_HM10	.text\+0x1234567800000000
@@ -25,20 +25,20 @@
   2c:	05 1d 95 0c 	sethi  %hi\(0x76543000\), %g2
   30:	84 10 62 10 	or  %g1, 0x210, %g2
   34:	01 00 00 00 	nop 
-  38:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  38:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			38: R_SPARC_HH22	.text
   3c:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			3c: R_SPARC_HM10	.text
-  40:	05 00 00 00 	sethi  %hi\(0x0\), %g2
+  40:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
 			40: R_SPARC_LM22	.text
   44:	84 10 60 00 	mov  %g1, %g2
 			44: R_SPARC_LO10	.text
   48:	01 00 00 00 	nop 
-  4c:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  4c:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			4c: R_SPARC_HH22	.text\+0xfedcba9876543210
   50:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			50: R_SPARC_HM10	.text\+0xfedcba9876543210
-  54:	05 00 00 00 	sethi  %hi\(0x0\), %g2
+  54:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
 			54: R_SPARC_LM22	.text\+0xfedcba9876543210
   58:	84 10 60 00 	mov  %g1, %g2
 			58: R_SPARC_LO10	.text\+0xfedcba9876543210
@@ -47,14 +47,14 @@
   64:	82 10 61 43 	or  %g1, 0x143, %g1.*
   68:	82 10 62 10 	or  %g1, 0x210, %g1
   6c:	01 00 00 00 	nop 
-  70:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  70:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			70: R_SPARC_H44	.text
   74:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			74: R_SPARC_M44	.text
   78:	82 10 60 00 	mov  %g1, %g1
 			78: R_SPARC_L44	.text
   7c:	01 00 00 00 	nop 
-  80:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  80:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			80: R_SPARC_H44	.text\+0xa9876543210
   84:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
 			84: R_SPARC_M44	.text\+0xa9876543210
@@ -64,12 +64,12 @@
   90:	03 22 6a f3 	sethi  %hi\(0x89abcc00\), %g1
   94:	82 18 7e 10 	xor  %g1, -496, %g1
   98:	01 00 00 00 	nop 
-  9c:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  9c:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			9c: R_SPARC_HIX22	.text
   a0:	82 18 60 00 	xor  %g1, 0, %g1
 			a0: R_SPARC_LOX10	.text
   a4:	01 00 00 00 	nop 
-  a8:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  a8:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			a8: R_SPARC_HIX22	.text\+0xffffffff76543210
   ac:	82 18 60 00 	xor  %g1, 0, %g1
 			ac: R_SPARC_LOX10	.text\+0xffffffff76543210
diff --git a/gas/testsuite/gas/sparc/set64.d b/gas/testsuite/gas/sparc/set64.d
index 121beca..f16023e 100644
--- a/gas/testsuite/gas/sparc/set64.d
+++ b/gas/testsuite/gas/sparc/set64.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr
 #name: sparc64 set64
 
@@ -7,22 +7,22 @@
 Disassembly of section .text:
 
 0+ <foo>:
-   0:	05 00 00 00 	sethi  %hi\(0x0\), %g2
+   0:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
 			0: R_SPARC_HI22	.text
    4:	84 10 a0 00 	mov  %g2, %g2	! 0 <foo>
 			4: R_SPARC_LO10	.text
    8:	07 1d 95 0c 	sethi  %hi\(0x76543000\), %g3
-   c:	86 10 e2 10 	or  %g3, 0x210, %g3	! 76543210 <\*ABS\*\+(0x|)0x76543210>
+   c:	86 10 e2 10 	or  %g3, 0x210, %g3	! 76543210 <(\*ABS\*|foo)\+(0x|)0x76543210>
   10:	88 10 20 00 	clr  %g4
   14:	0b 00 00 3f 	sethi  %hi\(0xfc00\), %g5
-  18:	8a 11 63 ff 	or  %g5, 0x3ff, %g5	! ffff <\*ABS\*\+(0x|)ffff>
-  1c:	03 00 00 00 	sethi  %hi\(0x0\), %g1
+  18:	8a 11 63 ff 	or  %g5, 0x3ff, %g5	! ffff <(\*ABS\*|foo)\+(0x|)ffff>
+  1c:	03 00 00 00 	sethi  %hi\((0x|)0\), %g1
 			1c: R_SPARC_HH22	.text
-  20:	82 10 60 00 	mov  %g1, %g1	! 0 <foo>
-			20: R_SPARC_HM10	.text
-  24:	05 00 00 00 	sethi  %hi\(0x0\), %g2
-			24: R_SPARC_HI22	.text
-  28:	84 10 a0 00 	mov  %g2, %g2	! 0 <foo>
+  20:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
+			20: R_SPARC_LM22	.text
+  24:	82 10 60 00 	mov  %g1, %g1
+			24: R_SPARC_HM10	.text
+  28:	84 10 a0 00 	mov  %g2, %g2
 			28: R_SPARC_LO10	.text
   2c:	83 28 70 20 	sllx  %g1, 0x20, %g1
   30:	84 10 80 01 	or  %g2, %g1, %g2
@@ -32,57 +32,78 @@
   40:	86 10 2f ff 	mov  0xfff, %g3
   44:	07 00 00 04 	sethi  %hi\(0x1000\), %g3
   48:	86 10 30 00 	mov  -4096, %g3
-  4c:	07 3f ff fb 	sethi  %hi\(0xffffec00\), %g3
-  50:	86 10 e3 ff 	or  %g3, 0x3ff, %g3	! ffffefff <\*ABS\*\+(0x|)ffffefff>
-  54:	87 38 e0 00 	sra  %g3, 0, %g3
-  58:	07 00 00 3f 	sethi  %hi\(0xfc00\), %g3
-  5c:	86 10 e3 ff 	or  %g3, 0x3ff, %g3	! ffff <\*ABS\*\+(0x|)ffff>
-  60:	07 3f ff c0 	sethi  %hi\(0xffff0000\), %g3
-  64:	87 38 e0 00 	sra  %g3, 0, %g3
-  68:	09 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g4
-  6c:	88 11 23 ff 	or  %g4, 0x3ff, %g4	! 7fffffff <\*ABS\*\+(0x|)7fffffff>
-  70:	09 20 00 00 	sethi  %hi\(0x80000000\), %g4
-  74:	09 20 00 00 	sethi  %hi\(0x80000000\), %g4
-  78:	89 39 20 00 	sra  %g4, 0, %g4
-  7c:	82 10 3f ff 	mov  -1, %g1
-  80:	09 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g4
-  84:	88 11 23 ff 	or  %g4, 0x3ff, %g4	! 7fffffff <\*ABS\*\+(0x|)7fffffff>
-  88:	83 28 70 20 	sllx  %g1, 0x20, %g1
-  8c:	88 11 00 01 	or  %g4, %g1, %g4
-  90:	09 3f ff ff 	sethi  %hi\(0xfffffc00\), %g4
-  94:	88 11 23 ff 	or  %g4, 0x3ff, %g4	! ffffffff <\*ABS\*\+(0x|)ffffffff>
-  98:	88 10 20 01 	mov  1, %g4
-  9c:	89 29 30 20 	sllx  %g4, 0x20, %g4
-  a0:	03 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g1
-  a4:	82 10 63 ff 	or  %g1, 0x3ff, %g1	! 7fffffff <\*ABS\*\+(0x|)7fffffff>
-  a8:	0b 3f ff ff 	sethi  %hi\(0xfffffc00\), %g5
-  ac:	8a 11 63 ff 	or  %g5, 0x3ff, %g5	! ffffffff <\*ABS\*\+(0x|)ffffffff>
-  b0:	83 28 70 20 	sllx  %g1, 0x20, %g1
-  b4:	8a 11 40 01 	or  %g5, %g1, %g5
-  b8:	0b 20 00 00 	sethi  %hi\(0x80000000\), %g5
-  bc:	8b 29 70 20 	sllx  %g5, 0x20, %g5
-  c0:	8a 10 3f ff 	mov  -1, %g5
-  c4:	8b 29 70 20 	sllx  %g5, 0x20, %g5
-  c8:	0b 20 00 00 	sethi  %hi\(0x80000000\), %g5
-  cc:	8b 39 60 00 	sra  %g5, 0, %g5
+  4c:	07 00 00 04 	sethi  %hi\(0x1000\), %g3
+  50:	86 18 ff ff 	xor  %g3, -1, %g3
+  54:	07 00 00 3f 	sethi  %hi\(0xfc00\), %g3
+  58:	86 10 e3 ff 	or  %g3, 0x3ff, %g3	! ffff <(\*ABS\*|foo)\+(0x|)ffff>
+  5c:	07 00 00 3f 	sethi  %hi\(0xfc00\), %g3
+  60:	86 18 fc 00 	xor  %g3, -1024, %g3
+  64:	09 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g4
+  68:	88 11 23 ff 	or  %g4, 0x3ff, %g4	! 7fffffff <(\*ABS\*|foo)\+(0x|)7fffffff>
+  6c:	09 20 00 00 	sethi  %hi\(0x80000000\), %g4
+  70:	09 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g4
+  74:	88 19 3c 00 	xor  %g4, -1024, %g4
+  78:	09 20 00 00 	sethi  %hi\(0x80000000\), %g4
+  7c:	88 19 3f ff 	xor  %g4, -1, %g4
+  80:	09 3f ff ff 	sethi  %hi\(0xfffffc00\), %g4
+  84:	88 11 23 ff 	or  %g4, 0x3ff, %g4	! ffffffff <(\*ABS\*|foo)\+(0x|)ffffffff>
+  88:	88 10 20 01 	mov  1, %g4
+  8c:	89 29 30 20 	sllx  %g4, 0x20, %g4
+  90:	03 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g1
+  94:	0b 3f ff ff 	sethi  %hi\(0xfffffc00\), %g5
+  98:	82 10 63 ff 	or  %g1, 0x3ff, %g1
+  9c:	8a 11 63 ff 	or  %g5, 0x3ff, %g5
+  a0:	83 28 70 20 	sllx  %g1, 0x20, %g1
+  a4:	8a 11 40 01 	or  %g5, %g1, %g5
+  a8:	0b 20 00 00 	sethi  %hi\(0x80000000\), %g5
+  ac:	8b 29 70 20 	sllx  %g5, 0x20, %g5
+  b0:	0b 3f ff ff 	sethi  %hi\(0xfffffc00\), %g5
+  b4:	8a 19 7c 00 	xor  %g5, -1024, %g5
+  b8:	0b 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g5
+  bc:	8a 19 7c 00 	xor  %g5, -1024, %g5
+  c0:	03 3f ff c0 	sethi  %hi\(0xffff0000\), %g1
+  c4:	0b 3f ff c0 	sethi  %hi\(0xffff0000\), %g5
+  c8:	83 28 70 20 	sllx  %g1, 0x20, %g1
+  cc:	8a 11 40 01 	or  %g5, %g1, %g5
   d0:	03 3f ff c0 	sethi  %hi\(0xffff0000\), %g1
-  d4:	0b 3f ff c0 	sethi  %hi\(0xffff0000\), %g5
+  d4:	8a 10 20 01 	mov  1, %g5
   d8:	83 28 70 20 	sllx  %g1, 0x20, %g1
   dc:	8a 11 40 01 	or  %g5, %g1, %g5
-  e0:	03 3f ff c0 	sethi  %hi\(0xffff0000\), %g1
-  e4:	8a 10 20 01 	mov  1, %g5
-  e8:	83 28 70 20 	sllx  %g1, 0x20, %g1
-  ec:	8a 11 40 01 	or  %g5, %g1, %g5
-  f0:	82 10 20 01 	mov  1, %g1
+  e0:	0b 3f ff c0 	sethi  %hi\(0xffff0000\), %g5
+  e4:	82 10 20 01 	mov  1, %g1
+  e8:	8a 11 60 01 	or  %g5, 1, %g5
+  ec:	83 28 70 20 	sllx  %g1, 0x20, %g1
+  f0:	8a 11 40 01 	or  %g5, %g1, %g5
   f4:	0b 3f ff c0 	sethi  %hi\(0xffff0000\), %g5
-  f8:	8a 11 60 01 	or  %g5, 1, %g5	! ffff0001 <\*ABS\*\+(0x|)ffff0001>
+  f8:	82 10 20 01 	mov  1, %g1
   fc:	83 28 70 20 	sllx  %g1, 0x20, %g1
  100:	8a 11 40 01 	or  %g5, %g1, %g5
  104:	82 10 20 01 	mov  1, %g1
- 108:	0b 3f ff c0 	sethi  %hi\(0xffff0000\), %g5
+ 108:	8a 10 20 01 	mov  1, %g5
  10c:	83 28 70 20 	sllx  %g1, 0x20, %g1
  110:	8a 11 40 01 	or  %g5, %g1, %g5
- 114:	82 10 20 01 	mov  1, %g1
- 118:	8a 10 20 01 	mov  1, %g5
- 11c:	83 28 70 20 	sllx  %g1, 0x20, %g1
- 120:	8a 11 40 01 	or  %g5, %g1, %g5
+ 114:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
+			114: R_SPARC_HI22	.text
+ 118:	84 10 a0 00 	mov  %g2, %g2	! 0 <foo>
+			118: R_SPARC_LO10	.text
+ 11c:	07 1d 95 0c 	sethi  %hi\(0x76543000\), %g3
+ 120:	86 10 e2 10 	or  %g3, 0x210, %g3	! 76543210 <(\*ABS\*|foo)\+0x76543210>
+ 124:	88 10 20 00 	clr  %g4
+ 128:	0b 00 00 3f 	sethi  %hi\(0xfc00\), %g5
+ 12c:	8a 11 63 ff 	or  %g5, 0x3ff, %g5	! ffff <(\*ABS\*|foo)\+0xffff>
+ 130:	05 00 00 00 	sethi  %hi\((0x|)0\), %g2
+			130: R_SPARC_HI22	.text
+ 134:	84 10 a0 00 	mov  %g2, %g2	! 0 <foo>
+			134: R_SPARC_LO10	.text
+ 138:	85 38 80 00 	signx  %g2
+ 13c:	07 1d 95 0c 	sethi  %hi\(0x76543000\), %g3
+ 140:	86 10 e2 10 	or  %g3, 0x210, %g3	! 76543210 <(\*ABS\*|foo)\+0x76543210>
+ 144:	88 10 20 00 	clr  %g4
+ 148:	0b 00 00 3f 	sethi  %hi\(0xfc00\), %g5
+ 14c:	8a 11 63 ff 	or  %g5, 0x3ff, %g5	! ffff <(\*ABS\*|foo)\+0xffff>
+ 150:	82 10 3f ff 	mov  -1, %g1
+ 154:	05 1f ff ff 	sethi  %hi\(0x7ffffc00\), %g2
+ 158:	84 10 a3 ff 	or  %g2, 0x3ff, %g2	! 7fffffff <(\*ABS\*|foo)\+0x7fffffff>
+ 15c:	07 00 00 3f 	sethi  %hi\(0xfc00\), %g3
+ 160:	86 18 fc 00 	xor  %g3, -1024, %g3
+ 164:	88 10 3f ff 	mov  -1, %g4
diff --git a/gas/testsuite/gas/sparc/set64.s b/gas/testsuite/gas/sparc/set64.s
index 92dc931..825036d 100644
--- a/gas/testsuite/gas/sparc/set64.s
+++ b/gas/testsuite/gas/sparc/set64.s
@@ -1,5 +1,4 @@
 # sparc64 set insn handling (includes set, setuw, setsw, setx)
-# FIXME: setuw,setsw not tested for yet.
 
 foo:
 	set foo,%g2
@@ -41,3 +40,17 @@
 	setx 0x00000001ffff0001,%g1,%g5		! test hm10,hi22,lo10
 	setx 0x00000001ffff0000,%g1,%g5		! test hm10,hi22
 	setx 0x0000000100000001,%g1,%g5		! test hm10,lo10
+
+	setuw foo,%g2
+	setuw 0x76543210,%g3
+	setuw 0,%g4
+	setuw 65535,%g5
+
+	setsw foo,%g2
+	setsw 0x76543210,%g3
+	setsw 0,%g4
+	setsw 65535,%g5
+	setsw 0xffffffff,%g1
+	setsw 0x7fffffff,%g2
+	setsw 0xffff0000,%g3
+	setsw -1,%g4
diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp
index 1a79358..17dcaaa 100644
--- a/gas/testsuite/gas/sparc/sparc.exp
+++ b/gas/testsuite/gas/sparc/sparc.exp
@@ -5,20 +5,29 @@
 # disassembly.  The way to fix this is to include a hex dump of the insns
 # and test that as well.  Later.
 
-if [istarget sparc*-*-*] {
-    run_dump_test "synth"
+# Find out if these binutils are either sparc64*-*-* or
+# sparc*-*-* with --enable-targets=sparc64-*-*
+proc gas_64_check { } {
+    global NM
+    global NMFLAGS
+    global srcdir
+
+    catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
+    return [regexp "elf64\[_-\]sparc" $nm_help];
 }
 
-
-if [istarget sparc64*-*-*] {
-    run_dump_test "asi"
-    run_dump_test "membar"
-    run_dump_test "prefetch"
-    run_dump_test "set64"
-    run_dump_test "synth64"
-    run_dump_test "rdpr"
-    run_dump_test "wrpr"
-    run_dump_test "reloc64"
+if [istarget sparc*-*-*] {
+    run_dump_test "synth"
+    if [gas_64_check] {
+	run_dump_test "asi"
+	run_dump_test "membar"
+	run_dump_test "prefetch"
+	run_dump_test "set64"
+	run_dump_test "synth64"
+	run_dump_test "rdpr"
+	run_dump_test "wrpr"
+	run_dump_test "reloc64"
+    }
 }
 
 if [istarget sparclet*-*-*] {
diff --git a/gas/testsuite/gas/sparc/synth64.d b/gas/testsuite/gas/sparc/synth64.d
index a29dab7..8b6c8c8 100644
--- a/gas/testsuite/gas/sparc/synth64.d
+++ b/gas/testsuite/gas/sparc/synth64.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr --prefix-addresses
 #name: sparc64 synth64
 
@@ -17,3 +17,5 @@
 0+0024 <foo\+(0x|)20> clrx  \[ %g1 \+ 1 \]
 0+0028 <foo\+(0x|)24> clrx  \[ %g1 \+ 0x2a \]
 0+002c <foo\+(0x|)28> clrx  \[ 0x42 \]
+0+0030 <foo\+(0x|)2c> signx  %g1
+0+0034 <foo\+(0x|)30> clruw  %g2
diff --git a/gas/testsuite/gas/sparc/synth64.s b/gas/testsuite/gas/sparc/synth64.s
index 659f3c2..3cab873 100644
--- a/gas/testsuite/gas/sparc/synth64.s
+++ b/gas/testsuite/gas/sparc/synth64.s
@@ -14,3 +14,6 @@
 	clrx [%g1+1]
 	clrx [42+%g1]
 	clrx [0x42]
+
+	signx %g1
+	clruw %g2
diff --git a/gas/testsuite/gas/sparc/wrpr.d b/gas/testsuite/gas/sparc/wrpr.d
index e75dcb8..1d3c80e 100644
--- a/gas/testsuite/gas/sparc/wrpr.d
+++ b/gas/testsuite/gas/sparc/wrpr.d
@@ -1,4 +1,4 @@
-#as: -Av9
+#as: -64 -Av9
 #objdump: -dr
 #name: sparc64 wrpr
 
diff --git a/gas/testsuite/gas/vtable/vtable.exp b/gas/testsuite/gas/vtable/vtable.exp
index 5d14451..0d3e1bc 100644
--- a/gas/testsuite/gas/vtable/vtable.exp
+++ b/gas/testsuite/gas/vtable/vtable.exp
@@ -15,19 +15,29 @@
 }
 
 # Vtable bits are only supported by ELF targets.
-if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"]} then {
-
+if { ([istarget "*-*-elf*"]		
+      || [istarget "*-*-linux*"])
+     && ![istarget *-*-linux*aout*]
+     && ![istarget *-*-linux*oldld*] } then {
 
     # not supported by D30V
     if {[istarget "d30v-*-*"]} {
       return
     }
 
+    # not yet supported by i960
+    if {[istarget "i960-*-*"]} {
+      return
+    }
+
     run_dump_test "inherit0" 
     run_list_test "inherit1" "-al"
 
     # The vtable entry results are different on Rel and Rela targets.
-    if {[istarget "i*86-*-*"] || [istarget "mips*-*-*"]} then {
+    if {[istarget "i*86-*-*"] 
+	|| [istarget "mips*-*-*"] 
+	|| [istarget "strongarm*-*-*"] 
+	|| [istarget "arm*-*-*"]} then {
 
 	run_dump_test "entry0"
 
diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp
index 757718f..9cb117f 100644
--- a/gas/testsuite/lib/gas-defs.exp
+++ b/gas/testsuite/lib/gas-defs.exp
@@ -1,4 +1,5 @@
-# Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1993, 1994, 1997, 1998, 1999, 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
@@ -253,6 +254,7 @@
     }
     set opt_array [slurp_options "${file}.d"]
     if { $opt_array == -1 } {
+	perror "error reading options from $file.d"
 	unresolved $subdir/$name
 	return
     }
@@ -494,6 +496,20 @@
 		set end_2 1
 		set diff_pass 1
 		break
+	    } elseif [ string match "#..." $line_b ] {
+		if { [gets $file_b line_b] == $eof } {
+		    set end_2 1
+		    break
+		}
+		verbose "looking for \"^$line_b$\"" 3
+		while { ![regexp "^$line_b$" "$line_a"] } {
+		    verbose "skipping    \"$line_a\"" 3
+		    if { [gets $file_a line_a] == $eof } {
+			set end_1 1
+			break
+		    }
+		}
+		break
 	    }
 	    if { [gets $file_b line_b] == $eof } {
 		set end_2 1
@@ -521,7 +537,6 @@
 		send_log "regexp_diff match failure\n"
 		send_log "regexp \"^$line_b$\"\nline   \"$line_a\"\n"
 		set differences 1
-                break
             }
         }
     }
diff --git a/gas/write.c b/gas/write.c
index 18e6e10..e386ece 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1,5 +1,5 @@
 /* write.c - emit .o file
-   Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -382,7 +382,7 @@
 
 static void
 renumber_sections (abfd, sec, countparg)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      PTR countparg;
 {
@@ -433,9 +433,9 @@
 
 static void
 chain_frchains_together (abfd, section, xxx)
-     bfd *abfd;			/* unused */
+     bfd *abfd ATTRIBUTE_UNUSED;
      segT section;
-     PTR xxx;			/* unused */
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   segment_info_type *info;
 
@@ -498,8 +498,9 @@
 			  - fragP->fr_fix) / fragP->fr_var;
       if (fragP->fr_offset < 0)
 	{
-	  as_bad (_("attempt to .org/.space backwards? (%ld)"),
-		  (long) fragP->fr_offset);
+	  as_bad_where (fragP->fr_file, fragP->fr_line,
+			_("attempt to .org/.space backwards? (%ld)"),
+			(long) fragP->fr_offset);
 	}
       fragP->fr_type = rs_fill;
       break;
@@ -578,7 +579,7 @@
 relax_and_size_seg (abfd, sec, xxx)
      bfd *abfd;
      asection *sec;
-     PTR xxx;
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   flagword flags;
   fragS *fragp;
@@ -644,7 +645,7 @@
 #ifdef DEBUG2
 static void
 dump_section_relocs (abfd, sec, stream_)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      char *stream_;
 {
@@ -659,22 +660,16 @@
   while (fixp)
     {
       symbolS *s = fixp->fx_addsy;
-      if (s)
-	{
-	  fprintf (stream, "  %08x: %s(%s", fixp, S_GET_NAME (s),
-		   s->bsym->section->name);
-	  if (s->bsym->flags & BSF_SECTION_SYM)
-	    {
-	      fprintf (stream, " section sym");
-	      if (S_GET_VALUE (s))
-		fprintf (stream, "+%x", S_GET_VALUE (s));
-	    }
-	  else
-	    fprintf (stream, "+%x", S_GET_VALUE (s));
-	  fprintf (stream, ")+%x\n", fixp->fx_offset);
-	}
+
+      fprintf (stream, "  %08lx: type %d ", (unsigned long) fixp,
+	       (int) fixp->fx_r_type);
+      if (s == NULL)
+	fprintf (stream, "no sym\n");
       else
-	fprintf (stream, "  %08x: type %d no sym\n", fixp, fixp->fx_r_type);
+	{
+	  print_symbol_value_1 (stream, s);
+	  fprintf (stream, "\n");
+	}
       fixp = fixp->fx_next;
     }
 }
@@ -688,9 +683,9 @@
 
 static void
 adjust_reloc_syms (abfd, sec, xxx)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
-     PTR xxx;
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   segment_info_type *seginfo = seg_info (sec);
   fixS *fixp;
@@ -719,23 +714,23 @@
 	   point.  It is possible to see unresolved expression
 	   symbols, though, since they are not in the regular symbol
 	   table.  */
-	if (sym != NULL && ! sym->sy_resolved)
+	if (sym != NULL)
 	  resolve_symbol_value (sym, 1);
 	
-	if (fixp->fx_subsy != NULL && ! fixp->fx_subsy->sy_resolved)
+	if (fixp->fx_subsy != NULL)
 	  resolve_symbol_value (fixp->fx_subsy, 1);
 
 	/* If this symbol is equated to an undefined symbol, convert
            the fixup to being against that symbol.  */
-	if (sym != NULL && sym->sy_value.X_op == O_symbol
+	if (sym != NULL && symbol_equated_p (sym)
 	    && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
 	  {
-	    fixp->fx_offset += sym->sy_value.X_add_number;
-	    sym = sym->sy_value.X_add_symbol;
+	    fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
+	    sym = symbol_get_value_expression (sym)->X_add_symbol;
 	    fixp->fx_addsy = sym;
 	  }
 
-	if (sym != NULL && sym->sy_mri_common)
+	if (sym != NULL && symbol_mri_common_p (sym))
 	  {
 	    /* These symbols are handled specially in fixup_segment.  */
 	    goto done;
@@ -752,10 +747,10 @@
                relocation unless TC_FORCE_RELOCATION returns 1.  */
 	    if (TC_FORCE_RELOCATION (fixp))
 	      {
-		fixp->fx_addsy->sy_used_in_reloc = 1;
+		symbol_mark_used_in_reloc (fixp->fx_addsy);
 #ifdef UNDEFINED_DIFFERENCE_OK
 		if (fixp->fx_subsy != NULL)
-		  fixp->fx_subsy->sy_used_in_reloc = 1;
+		  symbol_mark_used_in_reloc (fixp->fx_subsy);
 #endif
 	      }
 	    goto done;
@@ -769,22 +764,22 @@
 	if (bfd_is_und_section (symsec)
 	    || bfd_is_com_section (symsec))
 	  {
-	    fixp->fx_addsy->sy_used_in_reloc = 1;
+	    symbol_mark_used_in_reloc (fixp->fx_addsy);
 #ifdef UNDEFINED_DIFFERENCE_OK
 	    /* We have the difference of an undefined symbol and some
 	       other symbol.  Make sure to mark the other symbol as used
 	       in a relocation so that it will always be output.  */
 	    if (fixp->fx_subsy)
-	      fixp->fx_subsy->sy_used_in_reloc = 1;
+	      symbol_mark_used_in_reloc (fixp->fx_subsy);
 #endif
 	    goto done;
 	  }
 
-	/* Don't try to reduce relocs which refer to .linkonce
-           sections.  It can lead to confusion when a debugging
-           section refers to a .linkonce section.  I hope this will
-           always be correct.  */
-	if (symsec != sec)
+	/* Don't try to reduce relocs which refer to non-local symbols
+           in .linkonce sections.  It can lead to confusion when a
+           debugging section refers to a .linkonce section.  I hope
+           this will always be correct.  */
+	if (symsec != sec && ! S_IS_LOCAL (sym))
 	  {
 	    boolean linkonce;
 
@@ -805,10 +800,10 @@
 
 	    if (linkonce)
 	      {
-		fixp->fx_addsy->sy_used_in_reloc = 1;
+		symbol_mark_used_in_reloc (fixp->fx_addsy);
 #ifdef UNDEFINED_DIFFERENCE_OK
 		if (fixp->fx_subsy != NULL)
-		  fixp->fx_subsy->sy_used_in_reloc = 1;
+		  symbol_mark_used_in_reloc (fixp->fx_subsy);
 #endif
 		goto done;
 	      }
@@ -816,9 +811,9 @@
 
 	/* Since we're reducing to section symbols, don't attempt to reduce
 	   anything that's already using one.  */
-	if (sym->bsym->flags & BSF_SECTION_SYM)
+	if (symbol_section_p (sym))
 	  {
-	    fixp->fx_addsy->sy_used_in_reloc = 1;
+	    symbol_mark_used_in_reloc (fixp->fx_addsy);
 	    goto done;
 	  }
 
@@ -829,7 +824,7 @@
            the wrong area of memory.  */
 	if (S_IS_WEAK (sym))
 	  {
-	    fixp->fx_addsy->sy_used_in_reloc = 1;
+	    symbol_mark_used_in_reloc (fixp->fx_addsy);
 	    goto done;
 	  }
 #endif
@@ -839,7 +834,7 @@
 #ifdef obj_fix_adjustable
 	if (! obj_fix_adjustable (fixp))
 	  {
-	    fixp->fx_addsy->sy_used_in_reloc = 1;
+	    symbol_mark_used_in_reloc (fixp->fx_addsy);
 	    goto done;
 	  }
 #endif
@@ -850,7 +845,7 @@
 #ifdef tc_fix_adjustable
 	if (! tc_fix_adjustable (fixp))
 	  {
-	    fixp->fx_addsy->sy_used_in_reloc = 1;
+	    symbol_mark_used_in_reloc (fixp->fx_addsy);
 	    goto done;
 	  }
 #endif
@@ -864,7 +859,11 @@
 	   the section when it calls resolve_symbol_value. */
 	fixp->fx_offset += S_GET_VALUE (sym);
 	fixp->fx_addsy = section_symbol (S_GET_SEGMENT (sym));
-	fixp->fx_addsy->sy_used_in_reloc = 1;
+	symbol_mark_used_in_reloc (fixp->fx_addsy);
+#ifdef DEBUG5
+	fprintf (stderr, "\nadjusted fixup:\n");
+	print_fixup (fixp);
+#endif
 
       done:
 	;
@@ -889,7 +888,7 @@
 write_relocs (abfd, sec, xxx)
      bfd *abfd;
      asection *sec;
-     PTR xxx;
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   segment_info_type *seginfo = seg_info (sec);
   int i;
@@ -931,17 +930,17 @@
          symbol, then use generate the reloc against the latter symbol
          rather than the former.  */
       sym = fixp->fx_addsy;
-      while (sym->sy_value.X_op == O_symbol
+      while (symbol_equated_p (sym)
 	     && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
 	{
 	  symbolS *n;
 
 	  /* We must avoid looping, as that can occur with a badly
 	     written program.  */
-	  n = sym->sy_value.X_add_symbol;
+	  n = symbol_get_value_expression (sym)->X_add_symbol;
 	  if (n == sym)
 	    break;
-	  fixp->fx_offset += sym->sy_value.X_add_number;
+	  fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
 	  sym = n;
 	}
       fixp->fx_addsy = sym;
@@ -1004,9 +1003,9 @@
          symbol, then use generate the reloc against the latter symbol
          rather than the former.  */
       sym = fixp->fx_addsy;
-      while (sym->sy_value.X_op == O_symbol
+      while (symbol_equated_p (sym)
 	     && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
-	sym = sym->sy_value.X_add_symbol;
+	sym = symbol_get_value_expression (sym)->X_add_symbol;
       fixp->fx_addsy = sym;
 
       reloc = tc_gen_reloc (sec, fixp);
@@ -1069,6 +1068,10 @@
 			   (bfd_get_section_flags (abfd, sec)
 			    & (flagword) ~SEC_RELOC));
 
+#ifdef SET_SECTION_RELOCS
+  SET_SECTION_RELOCS (sec, relocs, n);
+#endif
+
 #ifdef DEBUG3
   {
     int i;
@@ -1088,9 +1091,9 @@
 
 static void
 write_contents (abfd, sec, xxx)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
-     PTR xxx;
+     PTR xxx ATTRIBUTE_UNUSED;
 {
   segment_info_type *seginfo = seg_info (sec);
   unsigned long offset = 0;
@@ -1333,8 +1336,8 @@
       symp = symbol_rootP;
       for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
 	{
-	  asympp[i] = symp->bsym;
-	  symp->written = 1;
+	  asympp[i] = symbol_get_bfdsym (symp);
+	  symbol_mark_written (symp);
 	}
     }
   else
@@ -1372,7 +1375,8 @@
          any alignment is meaningless, and, moreover, will look weird
          if we are generating a listing.  */
       frag_align (had_errors () ? 0 : SUB_SEGMENT_ALIGN (now_seg),
-		  NOP_OPCODE, 0);
+		  subseg_text_p (now_seg) ? NOP_OPCODE : 0,
+		  0);
 
       /* frag_align will have left a new frag.
 	 Use this last frag for an empty ".fill".
@@ -1623,7 +1627,7 @@
 	    /* This is the offset from ??? to table_ptr+0 */
 	    to_addr = table_addr - S_GET_VALUE (lie->sub);
 #ifdef BFD_ASSEMBLER
-	    to_addr -= lie->sub->sy_frag->fr_address;
+	    to_addr -= symbol_get_frag (lie->sub)->fr_address;
 #endif
 	    md_number_to_chars (lie->word_goes_here, to_addr, 2);
 	    for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
@@ -1637,7 +1641,7 @@
 	    from_addr = table_addr;
 	    to_addr = S_GET_VALUE (lie->add) + lie->addnum;
 #ifdef BFD_ASSEMBLER
-	    to_addr += lie->add->sy_frag->fr_address;
+	    to_addr += symbol_get_frag (lie->add)->fr_address;
 #endif
 	    md_create_long_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
 	    table_ptr += md_long_jump_size;
@@ -1770,9 +1774,9 @@
       symbolS *symp;
 
       for (symp = symbol_rootP; symp; symp = symbol_next (symp))
-	if (!symp->sy_resolved)
-	  resolve_symbol_value (symp, 1);
+	resolve_symbol_value (symp, 1);
     }
+  resolve_local_symbol_values ();
 
   PROGRESS (1);
 
@@ -1795,7 +1799,7 @@
 	  int punt = 0;
 	  const char *name;
 
-	  if (symp->sy_mri_common)
+	  if (symbol_mri_common_p (symp))
 	    {
 	      if (S_IS_EXTERNAL (symp))
 		as_bad (_("%s: global symbols not supported in common sections"),
@@ -1817,23 +1821,11 @@
 	  /* Do it again, because adjust_reloc_syms might introduce
 	     more symbols.  They'll probably only be section symbols,
 	     but they'll still need to have the values computed.  */
-	  if (! symp->sy_resolved)
-	    {
-	      if (symp->sy_value.X_op == O_constant)
-		{
-		  /* This is the normal case; skip the call.  */
-		  S_SET_VALUE (symp,
-			       (S_GET_VALUE (symp)
-				+ symp->sy_frag->fr_address));
-		  symp->sy_resolved = 1;
-		}
-	      else
-		resolve_symbol_value (symp, 1);
-	    }
+	  resolve_symbol_value (symp, 1);
 
 	  /* Skip symbols which were equated to undefined or common
              symbols.  */
-	  if (symp->sy_value.X_op == O_symbol
+	  if (symbol_equated_p (symp)
 	      && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
 	    {
 	      symbol_remove (symp, &symbol_rootP, &symbol_lastP);
@@ -1849,15 +1841,15 @@
 	  printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
 		  S_GET_NAME (symp), symp,
 		  S_GET_VALUE (symp),
-		  symp->bsym->flags,
-		  segment_name (symp->bsym->section));
+		  symbol_get_bfdsym (symp)->flags,
+		  segment_name (S_GET_SEGMENT (symp)));
 #endif
 
 #ifdef obj_frob_symbol
 	  obj_frob_symbol (symp, punt);
 #endif
 #ifdef tc_frob_symbol
-	  if (! punt || symp->sy_used_in_reloc)
+	  if (! punt || symbol_used_in_reloc_p (symp))
 	    tc_frob_symbol (symp, punt);
 #endif
 
@@ -1867,13 +1859,13 @@
 	     and symbols that the frob_symbol macros told us to punt,
 	     but we keep such symbols if they are used in relocs.  */
 	  if ((! EMIT_SECTION_SYMBOLS
-	       && (symp->bsym->flags & BSF_SECTION_SYM) != 0)
+	       && symbol_section_p (symp))
 	      /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
 		 opposites.  Sometimes the former checks flags and the
 		 latter examines the name...  */
 	      || (!S_IS_EXTERN (symp)
 		  && (S_IS_LOCAL (symp) || punt)
-		  && ! symp->sy_used_in_reloc))
+		  && ! symbol_used_in_reloc_p (symp)))
 	    {
 	      symbol_remove (symp, &symbol_rootP, &symbol_lastP);
 	      /* After symbol_remove, symbol_next(symp) still returns
@@ -1884,16 +1876,16 @@
 	    }
 
 	  /* Make sure we really got a value for the symbol.  */
-	  if (! symp->sy_resolved)
+	  if (! symbol_resolved_p (symp))
 	    {
 	      as_bad (_("can't resolve value for symbol \"%s\""),
 		      S_GET_NAME (symp));
-	      symp->sy_resolved = 1;
+	      symbol_mark_resolved (symp);
 	    }
 
 	  /* Set the value into the BFD symbol.  Up til now the value
 	     has only been kept in the gas symbolS struct.  */
-	  symp->bsym->value = S_GET_VALUE (symp);
+	  symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
 	}
     }
 
@@ -2002,9 +1994,7 @@
 #endif
       know (!(S_GET_SEGMENT (symbolP) == absolute_section)
 	    || symbolP->sy_frag == &zero_address_frag);
-      target +=
-	S_GET_VALUE (symbolP)
-	  + symbolP->sy_frag->fr_address;
+      target +=	S_GET_VALUE (symbolP) + symbol_get_frag (symbolP)->fr_address;
 
       /* If frag has yet to be reached on this pass,
 	 assume it will move by STRETCH just as we did.
@@ -2015,8 +2005,8 @@
 
 	 There should be a faster way to do this.  */
 
-      if (symbolP->sy_frag->fr_address >= was_address
-	  && is_dnrange (fragP, symbolP->sy_frag))
+      if (symbol_get_frag (symbolP)->fr_address >= was_address
+	  && is_dnrange (fragP, symbol_get_frag (symbolP)))
 	{
 	  target += stretch;
 	}
@@ -2225,10 +2215,10 @@
 		      if (lie->added)
 			continue;
 
-		      offset = (lie->add->sy_frag->fr_address
+		      offset = (symbol_get_frag (lie->add)->fr_address
 				+ S_GET_VALUE (lie->add)
 				+ lie->addnum
-				- (lie->sub->sy_frag->fr_address
+				- (symbol_get_frag (lie->sub)->fr_address
 				   + S_GET_VALUE (lie->sub)));
 		      if (offset <= -32768 || offset >= 32767)
 			{
@@ -2250,8 +2240,10 @@
 			  for (untruth = lie->next_broken_word;
 			       untruth && untruth->dispfrag == lie->dispfrag;
 			       untruth = untruth->next_broken_word)
-			    if ((untruth->add->sy_frag == lie->add->sy_frag)
-				&& S_GET_VALUE (untruth->add) == S_GET_VALUE (lie->add))
+			    if ((symbol_get_frag (untruth->add)
+				 == symbol_get_frag (lie->add))
+				&& (S_GET_VALUE (untruth->add)
+				    == S_GET_VALUE (lie->add)))
 			      {
 				untruth->added = 2;
 				untruth->use_jump = lie;
@@ -2301,8 +2293,8 @@
 		      know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
 			    || (symbolP->sy_frag == &zero_address_frag));
 #endif
-		      target += S_GET_VALUE (symbolP)
-			+ symbolP->sy_frag->fr_address;
+		      target += (S_GET_VALUE (symbolP)
+				 + symbol_get_frag (symbolP)->fr_address);
 		    }		/* if we have a symbol */
 
 		  know (fragP->fr_next);
@@ -2313,8 +2305,16 @@
 		      /* Growth may be negative, but variable part of frag
 			 cannot have fewer than 0 chars.  That is, we can't
 			 .org backwards. */
-		      as_bad (_("attempt to .org backwards ignored"));
-		      growth = 0;
+		      as_bad_where (fragP->fr_file, fragP->fr_line,
+				    _("attempt to .org backwards ignored"));
+
+		      /* We've issued an error message.  Change the
+                         frag to avoid cascading errors.  */
+		      fragP->fr_type = rs_align;
+		      fragP->fr_subtype = 0;
+		      fragP->fr_offset = 0;
+		      fragP->fr_fix = after - address;
+		      growth = stretch;
 		    }
 
 		  growth -= stretch;	/* This is an absolute growth factor */
@@ -2325,7 +2325,7 @@
 		if (symbolP)
 		  {
 		    growth = S_GET_VALUE (symbolP);
-		    if (symbolP->sy_frag != &zero_address_frag
+		    if (symbol_get_frag (symbolP) != &zero_address_frag
 			|| S_IS_COMMON (symbolP)
 			|| ! S_IS_DEFINED (symbolP))
 		      as_bad_where (fragP->fr_file, fragP->fr_line,
@@ -2465,12 +2465,13 @@
       plt = fixP->fx_plt;
 
       if (add_symbolP != NULL
-	  && add_symbolP->sy_mri_common)
+	  && symbol_mri_common_p (add_symbolP))
 	{
 	  know (add_symbolP->sy_value.X_op == O_symbol);
 	  add_number += S_GET_VALUE (add_symbolP);
 	  fixP->fx_offset = add_number;
-	  add_symbolP = fixP->fx_addsy = add_symbolP->sy_value.X_add_symbol;
+	  add_symbolP = fixP->fx_addsy =
+	    symbol_get_value_expression (add_symbolP)->X_add_symbol;
 	}
 
       if (add_symbolP)
@@ -2682,12 +2683,14 @@
 #if !(defined (TC_V850) && defined (OBJ_ELF))
 #if !(defined (TC_M68K) && defined (OBJ_ELF))
 #if !(defined (TC_ARM)  && defined (OBJ_ELF))
+#if !(defined (TC_I960) && defined (OBJ_ELF))
 #if !defined (TC_I386) || !(defined (OBJ_ELF) || defined (OBJ_COFF)) || defined (TE_PE)
 		  add_number += S_GET_VALUE (add_symbolP);
 #endif
 #endif
 #endif
 #endif
+#endif
 		}
 	    }
 	}
@@ -2702,33 +2705,42 @@
 #else
 	      fixP->fx_addsy = section_symbol (absolute_section);
 #endif
-	      fixP->fx_addsy->sy_used_in_reloc = 1;
+	      symbol_mark_used_in_reloc (fixP->fx_addsy);
 	      ++seg_reloc_count;
 	    }
 	}
 
+      if (!fixP->fx_done)
+	{
+#ifdef MD_APPLY_FIX3
+	  md_apply_fix3 (fixP, &add_number, this_segment_type);
+#else
+#ifdef BFD_ASSEMBLER
+	  md_apply_fix (fixP, &add_number);
+#else
+	  md_apply_fix (fixP, add_number);
+#endif
+#endif
+
+#ifndef TC_HANDLES_FX_DONE
+	  /* If the tc-* files haven't been converted, assume it's handling
+	     it the old way, where a null fx_addsy means that the fix has
+	     been applied completely, and no further work is needed.  */
+	  if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
+	    fixP->fx_done = 1;
+#endif
+	}
+
       if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
 	{
 	  if ((size_t) size < sizeof (valueT))
 	    {
-	      valueT mask, hibit;
+	      valueT mask;
 
-	      /* set all bits to one */
 	      mask = 0;
-	      mask--;
-	      /* Technically, combining these produces an undefined result
-		 if size is sizeof (valueT), though I think these two
-		 half-way operations should both be defined.  And the
-		 compiler should be able to combine them if it's valid on
-		 the host architecture.  */
-	      mask <<= size * 4;
-	      mask <<= size * 4;
-	      hibit = (valueT) 1 << (size * 8 - 1);
-	      if (((add_number & mask) != 0
-		   || (fixP->fx_signed
-		       && (add_number & hibit) != 0))
-		  && ((add_number & mask) != mask
-		      || (add_number & hibit) == 0))
+	      mask--;		/* set all bits to one */
+	      mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
+	      if ((add_number & mask) != 0 && (add_number & mask) != mask)
 		{
 		  char buf[50], buf2[50];
 		  sprint_value (buf, fragP->fr_address + where);
@@ -2755,28 +2767,9 @@
 #endif
 	}			/* not a bit fix */
 
-      if (!fixP->fx_done)
-	{
-#ifdef MD_APPLY_FIX3
-	  md_apply_fix3 (fixP, &add_number, this_segment_type);
-#else
-#ifdef BFD_ASSEMBLER
-	  md_apply_fix (fixP, &add_number);
-#else
-	  md_apply_fix (fixP, add_number);
-#endif
-#endif
-
-#ifndef TC_HANDLES_FX_DONE
-	  /* If the tc-* files haven't been converted, assume it's handling
-	     it the old way, where a null fx_addsy means that the fix has
-	     been applied completely, and no further work is needed.  */
-	  if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
-	    fixP->fx_done = 1;
-#endif
-	}
 #ifdef TC_VALIDATE_FIX
-    skip: ;
+    skip:  ATTRIBUTE_UNUSED_LABEL
+      ;
 #endif
 #ifdef DEBUG5
       fprintf (stderr, "result:\n");
@@ -2824,7 +2817,7 @@
 write_print_statistics (file)
      FILE *file;
 {
-  fprintf (stderr, "fixups: %d\n", n_fixups);
+  fprintf (file, "fixups: %d\n", n_fixups);
 }
 
 /* for debugging */
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 24626c2..c4742ff 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,72 @@
+2000-03-31  Alan Modra  <alan@linuxcare.com.au>
+
+	* symtab.c (symtab_finalize): Don't use post-increment on
+	structure copy to work around a ppc gcc bug.
+
+1999-09-29  Mark Kettenis  <kettenis@gnu.org>
+
+        * hertz.h [MACH] (hertz): Remove macro.  The
+        <machine/mach_param.h> include doesn't exist on al Mach based
+        systems, and the definition of hertz breaks compilation of hertz.c
+        anyway.
+
+2000-02-22  Ian Lance Taylor  <ian@zembu.com>
+
+	From Brad Lucier <lucier@math.purdue.edu>:
+	* i386.c (i386_find_call): Add cast to ensure that printf argument
+	matches format.
+	* tahoe.c (tahoe_find_call): Likewise.
+	* vax.c (vax_find_call): Likewise.
+
+2000-01-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* utils.c (print_name_only): Don't pass error strings to
+	printf as format arg.
+
+1999-09-24  Nick Clifton  <nickc@cygnus.com>
+
+	* gmon_io.c (gmon_out_read): Make sure that sensible values
+	are extracted from a raw header.
+
+1999-08-06  Ian Lance Taylor  <ian@zembu.com>
+
+	From Brad Lucier <lucier@math.purdue.edu>:
+	* corefile.c (core_create_line_syms): Add cast for printf.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* configure.bat: Remove; obsolete.
+
+1999-07-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Bump version number to 2.9.5.
+	* configure: Rebuild.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* corefile.c (core_create_function_syms): Add ATTRIBUTED_UNUSED.
+	* sym-ids.c (non_existent_file): Fully initialize structure.
+
+1999-07-01  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Add casts in many print statements to cast bfd_vma
+	values to unsigned long when calling printf.
+	* Makefile.am ($(OBJECTS)): Add gmon.h.
+	* Makefile.in: Rebuild.
+
+Mon Jun 14 10:35:28 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* gprof.texi: Fix typo.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	From Bob Byrnes <byrnes@curl.com>:
+	* cg_dfn.c: Include "libiberty.h"
+	(DFN_INCR_DEPTH): Define instead of DFN_DEPTH.
+	(dfn_stack): Define as pointer rather than array.
+	(pre_visit): Reallocate dfn_stack as needed.
+
 1999-04-26  Tom Tromey  <tromey@cygnus.com>
 
 	* aclocal.m4, configure: Updated for new version of libtool.
diff --git a/gprof/Makefile.am b/gprof/Makefile.am
index 7ae1492..f71e4c5 100644
--- a/gprof/Makefile.am
+++ b/gprof/Makefile.am
@@ -45,7 +45,7 @@
 
 # Dependencies.
 $(OBJECTS): ../bfd/bfd.h call_graph.h cg_arcs.h cg_print.h \
-	corefile.h gmon_io.h gmon_out.h gprof.h hertz.h hist.h \
+	corefile.h gmon_io.h gmon.h gmon_out.h gprof.h hertz.h hist.h \
 	search_list.h source.h sym_ids.h symtab.h utils.h \
 	$(srcdir)/../include/libiberty.h $(srcdir)/../bfd/sysdep.h \
 	gconfig.h ../bfd/config.h
diff --git a/gprof/Makefile.in b/gprof/Makefile.in
index 4aadd88..9413ffe 100644
--- a/gprof/Makefile.in
+++ b/gprof/Makefile.in
@@ -169,7 +169,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(gprof_SOURCES)
 OBJECTS = $(gprof_OBJECTS)
@@ -568,7 +568,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -693,7 +693,7 @@
 
 # Dependencies.
 $(OBJECTS): ../bfd/bfd.h call_graph.h cg_arcs.h cg_print.h \
-	corefile.h gmon_io.h gmon_out.h gprof.h hertz.h hist.h \
+	corefile.h gmon_io.h gmon.h gmon_out.h gprof.h hertz.h hist.h \
 	search_list.h source.h sym_ids.h symtab.h utils.h \
 	$(srcdir)/../include/libiberty.h $(srcdir)/../bfd/sysdep.h \
 	gconfig.h ../bfd/config.h
diff --git a/gprof/alpha.c b/gprof/alpha.c
index ad4f22e..8aad74d 100644
--- a/gprof/alpha.c
+++ b/gprof/alpha.c
@@ -104,7 +104,8 @@
       p_highpc = s_highpc;
     }
   DBG (CALLDEBUG, printf (_("[find_call] %s: 0x%lx to 0x%lx\n"),
-			  parent->name, p_lowpc, p_highpc));
+			  parent->name, (unsigned long) p_lowpc,
+			  (unsigned long) p_highpc));
   for (pc = (alpha_Instruction *) (p_lowpc + delta);
        pc < (alpha_Instruction *) (p_highpc + delta);
        ++pc)
@@ -125,7 +126,7 @@
 	    {
 	      DBG (CALLDEBUG,
 		   printf (_("[find_call] 0x%lx: jsr%s <indirect_child>\n"),
-			   (bfd_vma) pc - delta,
+			   (unsigned long) pc - delta,
 			   pc->j.func == Jxx_FUNC_JSR ? "" : "_coroutine"));
 	      arc_add (parent, &indirect_child, (unsigned long) 0);
 	    }
@@ -133,7 +134,8 @@
 
 	case OP_BSR:
 	  DBG (CALLDEBUG,
-	       printf (_("[find_call] 0x%lx: bsr"), (bfd_vma) pc - delta));
+	       printf (_("[find_call] 0x%lx: bsr"),
+		       (unsigned long) pc - delta));
 	  /*
 	   * Regular PC relative addressing.  Check that this is the
 	   * address of a function.  The linker sometimes redirects
@@ -146,7 +148,8 @@
 	      child = sym_lookup (&symtab, dest_pc);
 	      DBG (CALLDEBUG,
 		   printf (" 0x%lx\t; name=%s, addr=0x%lx",
-			   dest_pc, child->name, child->addr));
+			   (unsigned long) dest_pc, child->name,
+			   (unsigned long) child->addr));
 	      if (child->addr == dest_pc || child->addr == dest_pc - 8)
 		{
 		  DBG (CALLDEBUG, printf ("\n"));
diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index 07b6f8d..43dd762b 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -190,7 +190,8 @@
 
 	      DBG (BBDEBUG,
 		   printf ("[bb_read_rec] 0x%lx->0x%lx (%s:%d) cnt=%lu\n",
-			   addr, sym->addr, sym->name, sym->line_num, ncalls));
+			   (unsigned long) addr, (unsigned long) sym->addr,
+			   sym->name, sym->line_num, ncalls));
 
 	      for (i = 0; i < NBBS; i++)
 		{
@@ -319,17 +320,20 @@
     {
       if (sym->ncalls > 0 || ! ignore_zeros)
 	{
+	  /* FIXME: This only works if bfd_vma is unsigned long.  */
 	  printf (_("%s:%d: (%s:0x%lx) %lu executions\n"),
 		  sym->file ? sym->file->name : _("<unknown>"), sym->line_num,
-		  sym->name, sym->addr, sym->ncalls);
+		  sym->name, (unsigned long) sym->addr, sym->ncalls);
 	}
       for (j = 0; j < NBBS && sym->bb_addr[j]; j ++)
 	{
 	  if (sym->bb_calls[j] > 0 || ! ignore_zeros)
 	    {
+	      /* FIXME: This only works if bfd_vma is unsigned long.  */
 	      printf (_("%s:%d: (%s:0x%lx) %lu executions\n"),
 		      sym->file ? sym->file->name : _("<unknown>"), sym->line_num,
-		      sym->name, sym->bb_addr[j], sym->bb_calls[j]);
+		      sym->name, (unsigned long) sym->bb_addr[j],
+		      sym->bb_calls[j]);
 	    }
 	}
     }
diff --git a/gprof/call_graph.c b/gprof/call_graph.c
index 8f12cbd..6eee251 100644
--- a/gprof/call_graph.c
+++ b/gprof/call_graph.c
@@ -76,7 +76,7 @@
   count = bfd_get_32 (core_bfd, (bfd_byte *) arc.count);
   DBG (SAMPLEDEBUG,
        printf ("[cg_read_rec] frompc 0x%lx selfpc 0x%lx count %lu\n",
-	       from_pc, self_pc, count));
+	       (unsigned long) from_pc, (unsigned long) self_pc, count));
   /* add this arc: */
   cg_tally (from_pc, self_pc, count);
 }
@@ -110,7 +110,8 @@
 	    }
 	  DBG (SAMPLEDEBUG,
 	     printf ("[cg_write_arcs] frompc 0x%lx selfpc 0x%lx count %lu\n",
-		     arc->parent->addr, arc->child->addr, arc->count));
+		     (unsigned long) arc->parent->addr,
+		     (unsigned long) arc->child->addr, arc->count));
 	}
     }
 }
diff --git a/gprof/cg_dfn.c b/gprof/cg_dfn.c
index c9e37ab..02d64e7 100644
--- a/gprof/cg_dfn.c
+++ b/gprof/cg_dfn.c
@@ -17,13 +17,14 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 #include <stdio.h>
+#include "libiberty.h"
 #include "gprof.h"
 #include "cg_arcs.h"
 #include "cg_dfn.h"
 #include "symtab.h"
 #include "utils.h"
 
-#define	DFN_DEPTH	100
+#define	DFN_INCR_DEPTH (128)
 
 typedef struct
   {
@@ -32,7 +33,8 @@
   }
 DFN_Stack;
 
-DFN_Stack dfn_stack[DFN_DEPTH];
+DFN_Stack *dfn_stack = NULL;
+int dfn_maxdepth = 0;
 int dfn_depth = 0;
 int dfn_counter = DFN_NAN;
 
@@ -194,11 +196,13 @@
 DEFUN (pre_visit, (parent), Sym * parent)
 {
   ++dfn_depth;
-  if (dfn_depth >= DFN_DEPTH)
+
+  if (dfn_depth >= dfn_maxdepth)
     {
-      fprintf (stderr, "[pre_visit] dfn_stack overflow\n");
-      done (1);
+      dfn_maxdepth += DFN_INCR_DEPTH;
+      dfn_stack = xrealloc (dfn_stack, dfn_maxdepth * sizeof *dfn_stack);
     }
+
   dfn_stack[dfn_depth].sym = parent;
   dfn_stack[dfn_depth].cycle_top = dfn_depth;
   parent->cg.top_order = DFN_BUSY;
diff --git a/gprof/configure b/gprof/configure
index 5ff5137..a47d71a 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -45,6 +45,7 @@
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -159,6 +160,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
@@ -329,6 +331,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=*)
@@ -494,12 +501,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
@@ -586,7 +597,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:590: checking host system type" >&5
+echo "configure:601: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -607,7 +618,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:611: checking target system type" >&5
+echo "configure:622: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -625,7 +636,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:629: checking build system type" >&5
+echo "configure:640: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -660,7 +671,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:664: checking for a BSD compatible install" >&5
+echo "configure:675: 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
@@ -713,7 +724,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:717: checking whether build environment is sane" >&5
+echo "configure:728: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -770,7 +781,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:774: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:785: 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
@@ -799,7 +810,7 @@
 
 PACKAGE=gprof
 
-VERSION=2.9.4
+VERSION=2.9.5
 
 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; }
@@ -816,7 +827,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:820: checking for working aclocal" >&5
+echo "configure:831: 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.
@@ -829,7 +840,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:833: checking for working autoconf" >&5
+echo "configure:844: 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.
@@ -842,7 +853,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:846: checking for working automake" >&5
+echo "configure:857: 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.
@@ -855,7 +866,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:859: checking for working autoheader" >&5
+echo "configure:870: 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.
@@ -868,7 +879,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:872: checking for working makeinfo" >&5
+echo "configure:883: 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.
@@ -954,7 +965,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:958: checking for $ac_word" >&5
+echo "configure:969: 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
@@ -984,7 +995,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:988: checking for $ac_word" >&5
+echo "configure:999: 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
@@ -1014,7 +1025,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:1018: checking for $ac_word" >&5
+echo "configure:1029: 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
@@ -1065,7 +1076,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:1069: checking for $ac_word" >&5
+echo "configure:1080: 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
@@ -1097,7 +1108,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1112: 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.
@@ -1108,12 +1119,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1112 "configure"
+#line 1123 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1128: \"$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
@@ -1139,12 +1150,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:1143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1154: 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:1148: checking whether we are using GNU C" >&5
+echo "configure:1159: 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
@@ -1153,7 +1164,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1157: \"$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:1168: \"$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
@@ -1172,7 +1183,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1176: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1187: 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
@@ -1215,7 +1226,7 @@
 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:1219: checking for ld used by GCC" >&5
+echo "configure:1230: checking for ld used by GCC" >&5
   ac_prog=`($CC -print-prog-name=ld) 2>&5`
   case "$ac_prog" in
     # Accept absolute paths.
@@ -1239,10 +1250,10 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1243: checking for GNU ld" >&5
+echo "configure:1254: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1246: checking for non-GNU ld" >&5
+echo "configure:1257: 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
@@ -1278,7 +1289,7 @@
 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:1282: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1293: 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
@@ -1294,7 +1305,7 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1298: checking for BSD-compatible nm" >&5
+echo "configure:1309: 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
@@ -1332,7 +1343,7 @@
 
 # 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
-echo "configure:1336: checking command to parse $NM output" >&5
+echo "configure:1347: checking command to parse $NM output" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1395,11 +1406,11 @@
 int main(){nm_test_var='a';nm_test_func;return 0;}
 EOF
 
-  if { (eval echo configure:1399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  if { (eval echo configure:1410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     # Now try to grab the symbols.
     ac_nlist=conftest.nm
   
-    if { (eval echo configure:1403: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
+    if { (eval echo configure:1414: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
 
       # Try sorting and uniquifying the output.
       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
@@ -1451,7 +1462,7 @@
 	  ac_save_CFLAGS="$CFLAGS"
 	  LIBS="conftestm.$ac_objext"
 	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+	  if { (eval echo configure:1466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 	    ac_pipe_works=yes
 	  else
 	    echo "configure: failed program was:" >&5
@@ -1497,7 +1508,7 @@
 echo "$ac_t""$ac_result" 1>&6
 
 echo $ac_n "checking for _ prefix in compiled symbols""... $ac_c" 1>&6
-echo "configure:1501: checking for _ prefix in compiled symbols" >&5
+echo "configure:1512: checking for _ prefix in compiled symbols" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_symbol_underscore'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1506,10 +1517,10 @@
 void nm_test_func(){}
 int main(){nm_test_func;return 0;}
 EOF
-if { (eval echo configure:1510: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   # Now try to grab the symbols.
   ac_nlist=conftest.nm
-  if { (eval echo configure:1513: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
+  if { (eval echo configure:1524: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
     # See whether the symbols have a leading underscore.
     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
       ac_cv_sys_symbol_underscore=yes
@@ -1535,7 +1546,7 @@
 USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1539: checking whether ln -s works" >&5
+echo "configure:1550: 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
@@ -1577,8 +1588,8 @@
 case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1581 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1592 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1599,19 +1610,19 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1603: checking whether the C compiler needs -belf" >&5
+echo "configure:1614: 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 1608 "configure"
+#line 1619 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1626: \"$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
@@ -1634,7 +1645,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:1638: checking for $ac_word" >&5
+echo "configure:1649: 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
@@ -1666,7 +1677,7 @@
   # Extract the first word of "dlltool", so it can be a program name with args.
 set dummy dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1670: checking for $ac_word" >&5
+echo "configure:1681: 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
@@ -1701,7 +1712,7 @@
 # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
 set dummy ${ac_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1705: checking for $ac_word" >&5
+echo "configure:1716: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1733,7 +1744,7 @@
   # Extract the first word of "as", so it can be a program name with args.
 set dummy as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1737: checking for $ac_word" >&5
+echo "configure:1748: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1871,7 +1882,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:1875: checking for $ac_word" >&5
+echo "configure:1886: 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
@@ -1901,7 +1912,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:1905: checking for $ac_word" >&5
+echo "configure:1916: 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
@@ -1952,7 +1963,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:1956: checking for $ac_word" >&5
+echo "configure:1967: 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
@@ -1984,7 +1995,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1988: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1999: 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.
@@ -1995,12 +2006,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1999 "configure"
+#line 2010 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2015: \"$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
@@ -2026,12 +2037,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:2030: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2041: 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:2035: checking whether we are using GNU C" >&5
+echo "configure:2046: 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
@@ -2040,7 +2051,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2044: \"$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:2055: \"$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
@@ -2059,7 +2070,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2063: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2074: 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
@@ -2102,7 +2113,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:2106: checking for a BSD compatible install" >&5
+echo "configure:2117: 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
@@ -2156,7 +2167,7 @@
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:2160: checking for POSIXized ISC" >&5
+echo "configure:2171: 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
@@ -2179,7 +2190,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2183: checking how to run the C preprocessor" >&5
+echo "configure:2194: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2194,13 +2205,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2198 "configure"
+#line 2209 "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:2204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2215: \"$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
   :
@@ -2211,13 +2222,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2215 "configure"
+#line 2226 "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:2221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2232: \"$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
   :
@@ -2228,13 +2239,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2232 "configure"
+#line 2243 "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:2238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2249: \"$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
   :
@@ -2259,12 +2270,12 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2263: checking for ANSI C header files" >&5
+echo "configure:2274: 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 2268 "configure"
+#line 2279 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2272,7 +2283,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2287: \"$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*
@@ -2289,7 +2300,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 2293 "configure"
+#line 2304 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2307,7 +2318,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 2311 "configure"
+#line 2322 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2328,7 +2339,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2332 "configure"
+#line 2343 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2339,7 +2350,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2363,12 +2374,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2367: checking for working const" >&5
+echo "configure:2378: 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 2372 "configure"
+#line 2383 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2417,7 +2428,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2438,21 +2449,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2442: checking for inline" >&5
+echo "configure:2453: 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 2449 "configure"
+#line 2460 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2478,12 +2489,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2482: checking for off_t" >&5
+echo "configure:2493: 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 2487 "configure"
+#line 2498 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2511,12 +2522,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2515: checking for size_t" >&5
+echo "configure:2526: 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 2520 "configure"
+#line 2531 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2546,19 +2557,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:2550: checking for working alloca.h" >&5
+echo "configure:2561: 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 2555 "configure"
+#line 2566 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2573: \"$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
@@ -2579,12 +2590,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2583: checking for alloca" >&5
+echo "configure:2594: 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 2588 "configure"
+#line 2599 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2612,7 +2623,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2627: \"$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
@@ -2644,12 +2655,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2648: checking whether alloca needs Cray hooks" >&5
+echo "configure:2659: 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 2653 "configure"
+#line 2664 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2674,12 +2685,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:2678: checking for $ac_func" >&5
+echo "configure:2689: 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 2683 "configure"
+#line 2694 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2702,7 +2713,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2717: \"$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
@@ -2729,7 +2740,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2733: checking stack direction for C alloca" >&5
+echo "configure:2744: 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
@@ -2737,7 +2748,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2741 "configure"
+#line 2752 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2756,7 +2767,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2771: \"$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
@@ -2781,17 +2792,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2785: checking for $ac_hdr" >&5
+echo "configure:2796: 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 2790 "configure"
+#line 2801 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2806: \"$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*
@@ -2820,12 +2831,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2824: checking for $ac_func" >&5
+echo "configure:2835: 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 2829 "configure"
+#line 2840 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2848,7 +2859,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2863: \"$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
@@ -2873,7 +2884,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2877: checking for working mmap" >&5
+echo "configure:2888: 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
@@ -2881,7 +2892,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2885 "configure"
+#line 2896 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3021,7 +3032,7 @@
 }
 
 EOF
-if { (eval echo configure:3025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3036: \"$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
@@ -3049,17 +3060,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3053: checking for $ac_hdr" >&5
+echo "configure:3064: 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 3058 "configure"
+#line 3069 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3074: \"$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*
@@ -3089,12 +3100,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3093: checking for $ac_func" >&5
+echo "configure:3104: 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 3098 "configure"
+#line 3109 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3117,7 +3128,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3132: \"$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
@@ -3146,12 +3157,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3150: checking for $ac_func" >&5
+echo "configure:3161: 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 3155 "configure"
+#line 3166 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3174,7 +3185,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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_func_$ac_func=yes"
 else
@@ -3208,19 +3219,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3212: checking for LC_MESSAGES" >&5
+echo "configure:3223: 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 3217 "configure"
+#line 3228 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; 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:3235: \"$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
@@ -3241,7 +3252,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3245: checking whether NLS is requested" >&5
+echo "configure:3256: 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"
@@ -3261,7 +3272,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3265: checking whether included gettext is requested" >&5
+echo "configure:3276: 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"
@@ -3280,17 +3291,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3284: checking for libintl.h" >&5
+echo "configure:3295: 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 3289 "configure"
+#line 3300 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3294: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3305: \"$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*
@@ -3307,19 +3318,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:3311: checking for gettext in libc" >&5
+echo "configure:3322: 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 3316 "configure"
+#line 3327 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3334: \"$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
@@ -3335,7 +3346,7 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3339: checking for bindtextdomain in -lintl" >&5
+echo "configure:3350: 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
@@ -3343,7 +3354,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3347 "configure"
+#line 3358 "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
@@ -3354,7 +3365,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3369: \"$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
@@ -3370,19 +3381,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:3374: checking for gettext in libintl" >&5
+echo "configure:3385: 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 3379 "configure"
+#line 3390 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3397: \"$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
@@ -3410,7 +3421,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:3414: checking for $ac_word" >&5
+echo "configure:3425: 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
@@ -3444,12 +3455,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3448: checking for $ac_func" >&5
+echo "configure:3459: 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 3453 "configure"
+#line 3464 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3472,7 +3483,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3487: \"$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
@@ -3499,7 +3510,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:3503: checking for $ac_word" >&5
+echo "configure:3514: 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
@@ -3535,7 +3546,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:3539: checking for $ac_word" >&5
+echo "configure:3550: 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
@@ -3567,7 +3578,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3571 "configure"
+#line 3582 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3575,7 +3586,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3607,7 +3618,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:3611: checking for $ac_word" >&5
+echo "configure:3622: 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
@@ -3641,7 +3652,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:3645: checking for $ac_word" >&5
+echo "configure:3656: 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
@@ -3677,7 +3688,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:3681: checking for $ac_word" >&5
+echo "configure:3692: 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
@@ -3767,7 +3778,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3771: checking for catalogs to be installed" >&5
+echo "configure:3782: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3795,17 +3806,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:3799: checking for linux/version.h" >&5
+echo "configure:3810: 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 3804 "configure"
+#line 3815 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3820: \"$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*
@@ -3868,7 +3879,7 @@
   
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:3872: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:3883: 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"
@@ -3891,12 +3902,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3895: checking for Cygwin environment" >&5
+echo "configure:3906: 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 3900 "configure"
+#line 3911 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3907,7 +3918,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:3911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -3924,19 +3935,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:3928: checking for mingw32 environment" >&5
+echo "configure:3939: 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 3933 "configure"
+#line 3944 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:3940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -3955,7 +3966,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3959: checking for executable suffix" >&5
+echo "configure:3970: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3965,7 +3976,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:3969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:3980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
diff --git a/gprof/configure.bat b/gprof/configure.bat
deleted file mode 100644
index 22ef37e..0000000
--- a/gprof/configure.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off

-echo Configuring gprof for go32

-rem This batch file assumes a unix-type "sed" program

-

-echo # Makefile generated by "configure.bat"> Makefile

-

-if exist config.sed del config.sed

-

-echo "/^###$/ i\				">>config.sed

-echo "MY_MACHINE=i386\				">>config.sed

-echo "CC=gcc					">>config.sed

-

-echo # >> config.sed

-

-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ 	]*$//" config.sed > config2.sed

-sed -f config2.sed Makefile.in >> Makefile

-del config.sed

-del config2.sed

diff --git a/gprof/configure.in b/gprof/configure.in
index b50b55d..6ab289f 100644
--- a/gprof/configure.in
+++ b/gprof/configure.in
@@ -4,7 +4,7 @@
 
 AC_CANONICAL_SYSTEM
 
-AM_INIT_AUTOMAKE(gprof, 2.9.4)
+AM_INIT_AUTOMAKE(gprof, 2.9.5)
 
 AM_PROG_LIBTOOL
 
diff --git a/gprof/corefile.c b/gprof/corefile.c
index a6e6f83..790fc28 100644
--- a/gprof/corefile.c
+++ b/gprof/corefile.c
@@ -195,8 +195,8 @@
 
   if (!core_text_space)
     {
-      fprintf (stderr, _("%s: ran out room for %ld bytes of text space\n"),
-	       whoami, core_text_sect->_raw_size);
+      fprintf (stderr, _("%s: ran out room for %lu bytes of text space\n"),
+	       whoami, (unsigned long) core_text_sect->_raw_size);
       done (1);
     }
   if (!bfd_get_section_contents (core_bfd, core_text_sect, core_text_space,
@@ -371,7 +371,7 @@
       && fname && func_name && l)
     {
       DBG (AOUTDEBUG, printf ("[get_src_info] 0x%lx -> %s:%d (%s)\n",
-			      addr, fname, l, func_name));
+			      (unsigned long) addr, fname, l, func_name));
       *filename = fname;
       *name = func_name;
       *line_num = l;
@@ -392,7 +392,8 @@
  * entered.
  */
 void
-DEFUN (core_create_function_syms, (core_bfd), bfd * core_bfd)
+core_create_function_syms (core_bfd)
+     bfd *core_bfd ATTRIBUTE_UNUSED;
 {
   bfd_vma min_vma = ~0, max_vma = 0;
   int class;
@@ -446,7 +447,8 @@
 	{
 	  DBG (AOUTDEBUG,
 	       printf ("[core_create_function_syms] rejecting: 0x%lx %s\n",
-		       core_syms[i]->value, core_syms[i]->name));
+		       (unsigned long) core_syms[i]->value,
+		       core_syms[i]->name));
 	  continue;
 	}
       /* This should be replaced with a binary search or hashed
@@ -545,7 +547,8 @@
 
       DBG (AOUTDEBUG, printf ("[core_create_function_syms] %ld %s 0x%lx\n",
 			      (long) (symtab.limit - symtab.base),
-			      symtab.limit->name, symtab.limit->addr));
+			      symtab.limit->name,
+			      (unsigned long) symtab.limit->addr));
       ++symtab.limit;
     }
 
@@ -720,9 +723,10 @@
 	  discard_underscores = 0;
 	}
 
-      DBG (AOUTDEBUG, printf ("[core_create_line_syms] %d %s 0x%lx\n",
-			      ltab.limit - ltab.base, ltab.limit->name,
-			      ltab.limit->addr));
+      DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
+			      (unsigned long) (ltab.limit - ltab.base),
+			      ltab.limit->name,
+			      (unsigned long) ltab.limit->addr));
       ++ltab.limit;
     }
 
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index ff294f5..7e0a1a0 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -242,14 +242,24 @@
       hist_num_bins = samp_bytes / sizeof (UNIT);
       DBG (SAMPLEDEBUG,
 	   printf ("[gmon_out_read] lowpc 0x%lx highpc 0x%lx ncnt %d\n",
-		   h.low_pc, h.high_pc, h.ncnt);
+		   (unsigned long) h.low_pc, (unsigned long) h.high_pc,
+		   h.ncnt);
 	   printf ("[gmon_out_read]   s_lowpc 0x%lx   s_highpc 0x%lx\n",
-		   s_lowpc, s_highpc);
+		   (unsigned long) s_lowpc, (unsigned long) s_highpc);
 	   printf ("[gmon_out_read]     lowpc 0x%lx     highpc 0x%lx\n",
-		   lowpc, highpc);
+		   (unsigned long) lowpc, (unsigned long) highpc);
 	   printf ("[gmon_out_read] samp_bytes %d hist_num_bins %d\n",
 		   samp_bytes, hist_num_bins));
 
+      /* Make sure that we have sensible values.  */
+      if (samp_bytes < 0 || lowpc > highpc)
+        {
+          fprintf (stderr, 
+	    _("%s: file '%s' does not appear to be in gmon.out format\n"),
+	    whoami, filename);
+          done (1);
+        }
+
       if (hist_num_bins)
 	{
 	  ++nhist;
@@ -286,7 +296,7 @@
 	  count = bfd_get_32 (core_bfd, (bfd_byte *) raw_arc.count);
 	  DBG (SAMPLEDEBUG,
 	     printf ("[gmon_out_read] frompc 0x%lx selfpc 0x%lx count %lu\n",
-		     from_pc, self_pc, count));
+		     (unsigned long) from_pc, (unsigned long) self_pc, count));
 	  /* add this arc: */
 	  cg_tally (from_pc, self_pc, count);
 	}
@@ -440,7 +450,8 @@
 		}
 	      DBG (SAMPLEDEBUG,
 		   printf ("[dumpsum] frompc 0x%lx selfpc 0x%lx count %lu\n",
-			   arc->parent->addr, arc->child->addr, arc->count));
+			   (unsigned long) arc->parent->addr,
+			   (unsigned long) arc->child->addr, arc->count));
 	    }
 	}
       fclose (ofp);
diff --git a/gprof/gprof.texi b/gprof/gprof.texi
index 43d8b9f..b4606b4 100644
--- a/gprof/gprof.texi
+++ b/gprof/gprof.texi
@@ -687,7 +687,7 @@
 function name is unique in a program, you must use the colon notation
 explained below to specify a function from a specific source file.
 
-Sometimes, function names contain dots.  In such cases, it is necessar
+Sometimes, function names contain dots.  In such cases, it is necessary
 to add a leading colon to the name.  For example, @samp{:.mul} selects
 function @samp{.mul}.
 
diff --git a/gprof/hertz.h b/gprof/hertz.h
index 2ea01ba..fc30a1f 100644
--- a/gprof/hertz.h
+++ b/gprof/hertz.h
@@ -10,13 +10,6 @@
  * we return HZ_WRONG, an impossible sampling frequency.
  */
 
-/* FIXME: Checking for MACH here makes no sense when for a cross
-   gprof.  */
-#ifdef MACH
-#include <machine/mach_param.h>
-#define hertz() (HZ)
-#else
 extern int hertz PARAMS ((void));
-#endif
 
 #endif /* hertz_h */
diff --git a/gprof/hist.c b/gprof/hist.c
index 5cdbbbb..56ef25a 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -130,11 +130,12 @@
 
   DBG (SAMPLEDEBUG,
        printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %d\n",
-	       n_lowpc, n_highpc, ncnt);
+	       (unsigned long) n_lowpc, (unsigned long) n_highpc, ncnt);
        printf ("[hist_read_rec] s_lowpc 0x%lx s_highpc 0x%lx nsamples %d\n",
-	       s_lowpc, s_highpc, hist_num_bins);
+	       (unsigned long) s_lowpc, (unsigned long) s_highpc,
+	       hist_num_bins);
        printf ("[hist_read_rec]   lowpc 0x%lx   highpc 0x%lx\n",
-	       lowpc, highpc));
+	       (unsigned long) lowpc, (unsigned long) highpc));
 
   if (n_lowpc != s_lowpc || n_highpc != s_highpc
       || ncnt != hist_num_bins || hz != profrate)
@@ -229,8 +230,9 @@
 	{
 	  DBG (SAMPLEDEBUG,
 	       printf ("[scale_and_align_entries] pushing 0x%lx to 0x%lx\n",
-		       sym->hist.scaled_addr,
-		       sym->hist.scaled_addr + UNITS_TO_CODE));
+		       (unsigned long) sym->hist.scaled_addr,
+		       (unsigned long) (sym->hist.scaled_addr
+					+ UNITS_TO_CODE)));
 	  sym->hist.scaled_addr += UNITS_TO_CODE;
 	}
     }
@@ -305,7 +307,8 @@
       DBG (SAMPLEDEBUG,
 	   printf (
       "[assign_samples] bin_low_pc=0x%lx, bin_high_pc=0x%lx, bin_count=%d\n",
-		    sizeof (UNIT) * bin_low_pc, sizeof (UNIT) * bin_high_pc,
+		    (unsigned long) (sizeof (UNIT) * bin_low_pc),
+		    (unsigned long) (sizeof (UNIT) * bin_high_pc),
 		    bin_count));
       total_time += time;
 
@@ -338,9 +341,10 @@
 	      DBG (SAMPLEDEBUG,
 		   printf (
 			    "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n",
-			    symtab.base[j].addr, sizeof (UNIT) * sym_high_pc,
+			    (unsigned long) symtab.base[j].addr,
+			    (unsigned long) (sizeof (UNIT) * sym_high_pc),
 			    symtab.base[j].name, overlap * time / hist_scale,
-			    overlap));
+			    (long) overlap));
 	      addr = symtab.base[j].addr;
 	      credit = overlap * time / hist_scale;
 	      /*
diff --git a/gprof/i386.c b/gprof/i386.c
index 18aad1c..760d551 100644
--- a/gprof/i386.c
+++ b/gprof/i386.c
@@ -55,7 +55,8 @@
       p_highpc = s_highpc;
     }
   DBG (CALLDEBUG, printf ("[findcall] %s: 0x%lx to 0x%lx\n",
-			  parent->name, p_lowpc, p_highpc));
+			  parent->name, (unsigned long) p_lowpc,
+			  (unsigned long) p_highpc));
 
   delta = (bfd_vma) core_text_space - core_text_sect->vma;
 
@@ -66,8 +67,8 @@
       if (i386_iscall (instructp))
 	{
 	  DBG (CALLDEBUG,
-	       printf ("[findcall]\t0x%x:call",
-		       instructp - (unsigned char *) delta));
+	       printf ("[findcall]\t0x%lx:call",
+		       (unsigned long) (instructp - (unsigned char *) delta)));
 	  /*
 	   *  regular pc relative addressing
 	   *    check that this is the address of 
@@ -85,7 +86,8 @@
 		   *      a hit
 		   */
 		  DBG (CALLDEBUG,
-		       printf ("\tdestpc 0x%lx (%s)\n", destpc, child->name));
+		       printf ("\tdestpc 0x%lx (%s)\n",
+			       (unsigned long) destpc, child->name));
 		  arc_add (parent, child, (unsigned long) 0);
 		  instructp += 4;	/* call is a 5 byte instruction */
 		  continue;
diff --git a/gprof/po/POTFILES.in b/gprof/po/POTFILES.in
index 56d8641..5ae8116 100644
--- a/gprof/po/POTFILES.in
+++ b/gprof/po/POTFILES.in
@@ -1,7 +1,6 @@
 alpha.c
 basic_blocks.c
 basic_blocks.h
-bb_exit_func.c
 call_graph.c
 call_graph.h
 cg_arcs.c
diff --git a/gprof/po/gprof.pot b/gprof/po/gprof.pot
index 36bf787..f30b1a0 100644
--- a/gprof/po/gprof.pot
+++ b/gprof/po/gprof.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1998-06-12 19:33-0400\n"
+"POT-Creation-Date: 2000-02-22 02:24-0500\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"
@@ -23,12 +23,12 @@
 msgid "[find_call] %s: 0x%lx to 0x%lx\n"
 msgstr ""
 
-#: alpha.c:127
+#: alpha.c:128
 #, c-format
 msgid "[find_call] 0x%lx: jsr%s <indirect_child>\n"
 msgstr ""
 
-#: alpha.c:136
+#: alpha.c:137
 #, c-format
 msgid "[find_call] 0x%lx: bsr"
 msgstr ""
@@ -38,21 +38,22 @@
 msgid "%s: %s: unexpected end of file\n"
 msgstr ""
 
-#: basic_blocks.c:214
+#: basic_blocks.c:215
 #, c-format
 msgid "%s: warning: ignoring basic-block exec counts (use -l or --line)\n"
 msgstr ""
 
-#: basic_blocks.c:322 basic_blocks.c:330
+#. FIXME: This only works if bfd_vma is unsigned long.
+#: basic_blocks.c:324 basic_blocks.c:333
 #, c-format
-msgid "%s:%d: (%s:0x%lx) %d executions\n"
+msgid "%s:%d: (%s:0x%lx) %lu executions\n"
 msgstr ""
 
-#: basic_blocks.c:323 basic_blocks.c:331
+#: basic_blocks.c:325 basic_blocks.c:334
 msgid "<unknown>"
 msgstr ""
 
-#: basic_blocks.c:584
+#: basic_blocks.c:596
 #, c-format
 msgid ""
 "\n"
@@ -63,43 +64,43 @@
 "\n"
 msgstr ""
 
-#: basic_blocks.c:608
+#: basic_blocks.c:620
 msgid ""
 "\n"
 "Execution Summary:\n"
 "\n"
 msgstr ""
 
-#: basic_blocks.c:609
+#: basic_blocks.c:621
 #, c-format
 msgid "%9ld   Executable lines in this file\n"
 msgstr ""
 
-#: basic_blocks.c:611
+#: basic_blocks.c:623
 #, c-format
 msgid "%9ld   Lines executed\n"
 msgstr ""
 
-#: basic_blocks.c:612
+#: basic_blocks.c:624
 #, c-format
 msgid "%9.2f   Percent of the file executed\n"
 msgstr ""
 
-#: basic_blocks.c:616
+#: basic_blocks.c:628
 #, c-format
 msgid ""
 "\n"
-"%9d   Total number of line executions\n"
+"%9lu   Total number of line executions\n"
 msgstr ""
 
-#: basic_blocks.c:617
+#: basic_blocks.c:630
 #, c-format
 msgid "%9.2f   Average executions per line\n"
 msgstr ""
 
 #: call_graph.c:48
 #, c-format
-msgid "[cg_tally] arc from %s to %s traversed %d times\n"
+msgid "[cg_tally] arc from %s to %s traversed %lu times\n"
 msgstr ""
 
 #: cg_print.c:39
@@ -114,7 +115,7 @@
 "\n"
 msgstr ""
 
-#: cg_print.c:46 hist.c:381
+#: cg_print.c:46 hist.c:385
 #, c-format
 msgid ""
 "\n"
@@ -161,7 +162,7 @@
 msgid "descendents"
 msgstr ""
 
-#: cg_print.c:67 hist.c:405
+#: cg_print.c:67 hist.c:409
 msgid "name"
 msgstr ""
 
@@ -221,7 +222,7 @@
 
 #: corefile.c:198
 #, c-format
-msgid "%s: ran out room for %ld bytes of text space\n"
+msgid "%s: ran out room for %lu bytes of text space\n"
 msgstr ""
 
 #: corefile.c:211
@@ -234,12 +235,12 @@
 msgid "%s: -c not supported on architecture %s\n"
 msgstr ""
 
-#: corefile.c:432
+#: corefile.c:433
 #, c-format
 msgid "%s: file `%s' has no symbols\n"
 msgstr ""
 
-#: corefile.c:726
+#: corefile.c:755
 #, c-format
 msgid "%s: somebody miscounted: ltab.len=%d instead of %ld\n"
 msgstr ""
@@ -249,12 +250,12 @@
 msgid "%s: bfd_vma has unexpected size of %ld bytes\n"
 msgstr ""
 
-#: gmon_io.c:87 gmon_io.c:179
+#: gmon_io.c:87 gmon_io.c:182
 #, c-format
 msgid "%s: file too short to be a gmon file\n"
 msgstr ""
 
-#: gmon_io.c:97
+#: gmon_io.c:97 gmon_io.c:215
 #, c-format
 msgid "%s: file `%s' has bad magic cookie\n"
 msgstr ""
@@ -269,46 +270,51 @@
 msgid "%s: %s: found bad tag %d (file corrupted?)\n"
 msgstr ""
 
-#: gmon_io.c:197
+#: gmon_io.c:203
 #, c-format
 msgid "%s: profiling rate incompatible with first gmon file\n"
 msgstr ""
 
-#: gmon_io.c:207
+#: gmon_io.c:232
 #, c-format
 msgid "%s: incompatible with first gmon file\n"
 msgstr ""
 
-#: gmon_io.c:245
+#: gmon_io.c:258
+#, c-format
+msgid "%s: file '%s' does not appear to be in gmon.out format\n"
+msgstr ""
+
+#: gmon_io.c:280
 #, c-format
 msgid "%s: unexpected EOF after reading %d/%d bins\n"
 msgstr ""
 
-#: gmon_io.c:280
+#: gmon_io.c:315
 msgid "time is in ticks, not seconds\n"
 msgstr ""
 
-#: gmon_io.c:286 gmon_io.c:410
+#: gmon_io.c:321 gmon_io.c:461
 #, c-format
 msgid "%s: don't know how to deal with file format %d\n"
 msgstr ""
 
-#: gmon_io.c:293
+#: gmon_io.c:328
 #, c-format
 msgid "File `%s' (version %d) contains:\n"
 msgstr ""
 
-#: gmon_io.c:295
+#: gmon_io.c:330
 #, c-format
 msgid "\t%d histogram record%s\n"
 msgstr ""
 
-#: gmon_io.c:297
+#: gmon_io.c:332
 #, c-format
 msgid "\t%d call-graph record%s\n"
 msgstr ""
 
-#: gmon_io.c:299
+#: gmon_io.c:334
 #, c-format
 msgid "\t%d basic-block count record%s\n"
 msgstr ""
@@ -346,103 +352,103 @@
 msgid "%s: debugging not supported; -d ignored\n"
 msgstr ""
 
-#: gprof.c:306
+#: gprof.c:309
 #, c-format
 msgid "%s: unknown file format %s\n"
 msgstr ""
 
 #. This output is intended to follow the GNU standards document.
-#: gprof.c:390
+#: gprof.c:393
 #, c-format
 msgid "GNU gprof %s\n"
 msgstr ""
 
-#: gprof.c:391
+#: gprof.c:394
 msgid ""
 "Based on BSD gprof, copyright 1983 Regents of the University of California.\n"
 msgstr ""
 
-#: gprof.c:392
+#: gprof.c:395
 msgid ""
 "This program is free software.  This program has absolutely no warranty.\n"
 msgstr ""
 
-#: gprof.c:438
+#: gprof.c:441
 #, c-format
 msgid ""
 "%s: Only one of --function-ordering and --file-ordering may be specified.\n"
 msgstr ""
 
-#: gprof.c:538
+#: gprof.c:541
 #, c-format
 msgid "%s: sorry, file format `prof' is not yet supported\n"
 msgstr ""
 
-#: gprof.c:599
+#: gprof.c:602
 #, c-format
 msgid "%s: gmon.out file is missing histogram\n"
 msgstr ""
 
-#: gprof.c:606
+#: gprof.c:609
 #, c-format
 msgid "%s: gmon.out file is missing call-graph data\n"
 msgstr ""
 
-#: hist.c:142
+#: hist.c:143
 #, c-format
 msgid "%s: `%s' is incompatible with first gmon file\n"
 msgstr ""
 
-#: hist.c:158
+#: hist.c:159
 #, c-format
 msgid "%s: %s: unexpected EOF after reading %d of %d samples\n"
 msgstr ""
 
-#: hist.c:377
+#: hist.c:381
 #, c-format
 msgid "%c%c/call"
 msgstr ""
 
-#: hist.c:385
+#: hist.c:389
 msgid ""
 " for %.2f%% of %.2f %s\n"
 "\n"
 msgstr ""
 
-#: hist.c:391
+#: hist.c:395
 #, c-format
 msgid ""
 "\n"
 "Each sample counts as %g %s.\n"
 msgstr ""
 
-#: hist.c:396
+#: hist.c:400
 msgid ""
 " no time accumulated\n"
 "\n"
 msgstr ""
 
-#: hist.c:402
+#: hist.c:406
 msgid "cumulative"
 msgstr ""
 
-#: hist.c:402
+#: hist.c:406
 msgid "self  "
 msgstr ""
 
-#: hist.c:402
+#: hist.c:406
 msgid "total "
 msgstr ""
 
-#: hist.c:404
+#: hist.c:408
 msgid "time"
 msgstr ""
 
-#: hist.c:404
+#: hist.c:408
 msgid "calls"
 msgstr ""
 
-#: hist.c:515
+#: hist.c:517
 msgid ""
 "\n"
 "\n"
@@ -450,7 +456,7 @@
 "flat profile:\n"
 msgstr ""
 
-#: hist.c:521
+#: hist.c:523
 msgid "Flat profile:\n"
 msgstr ""
 
diff --git a/gprof/sparc.c b/gprof/sparc.c
index ad702b1..0365827 100644
--- a/gprof/sparc.c
+++ b/gprof/sparc.c
@@ -52,7 +52,8 @@
       p_highpc = s_highpc;
     }
   DBG (CALLDEBUG, printf ("[find_call] %s: 0x%lx to 0x%lx\n",
-			  parent->name, p_lowpc, p_highpc));
+			  parent->name, (unsigned long) p_lowpc,
+			  (unsigned long) p_highpc));
   for (instr = (unsigned int *) (((p_lowpc + delta) + 3) &~ 3);
        instr < (unsigned int *) (p_highpc + delta);
        ++instr)
@@ -60,7 +61,8 @@
       if ((*instr & CALL))
 	{
 	  DBG (CALLDEBUG,
-	       printf ("[find_call] 0x%lx: callf", (bfd_vma) instr - delta));
+	       printf ("[find_call] 0x%lx: callf",
+		       (unsigned long) instr - delta));
 	  /*
 	   * Regular pc relative addressing check that this is the
 	   * address of a function.
@@ -71,7 +73,8 @@
 	      child = sym_lookup (&symtab, dest_pc);
 	      DBG (CALLDEBUG,
 		   printf ("\tdest_pc=0x%lx, (name=%s, addr=0x%lx)\n",
-			   dest_pc, child->name, child->addr));
+			   (unsigned long) dest_pc, child->name,
+			   (unsigned long) child->addr));
 	      if (child->addr == dest_pc)
 		{
 		  /* a hit:  */
diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c
index ba3ca28..412c8d4 100644
--- a/gprof/sym_ids.c
+++ b/gprof/sym_ids.c
@@ -46,7 +46,7 @@
 
 static Source_File non_existent_file =
 {
-  0, "<non-existent-file>"
+  0, "<non-existent-file>", 0, 0, 0, NULL
 };
 
 
@@ -323,11 +323,13 @@
 		       printf (
 				"[sym_id_parse]: arc %s:%s(%lx-%lx) -> %s:%s(%lx-%lx) to %s\n",
 				left->file ? left->file->name : "*",
-				left->name ? left->name : "*", left->addr,
-				left->end_addr,
+				left->name ? left->name : "*",
+				(unsigned long) left->addr,
+				(unsigned long) left->end_addr,
 				right->file ? right->file->name : "*",
-				right->name ? right->name : "*", right->addr,
-				right->end_addr,
+				right->name ? right->name : "*",
+				(unsigned long) right->addr,
+				(unsigned long) right->end_addr,
 				table_name[id->which_table]));
 		  arc_add (left, right, (unsigned long) 0);
 		}
diff --git a/gprof/symtab.c b/gprof/symtab.c
index 182c657..e4fda46 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -108,7 +108,7 @@
 			   src->is_func ? 'F' : 'f',
 			   dst[-1].name, dst[-1].is_static ? 't' : 'T',
 			   dst[-1].is_func ? 'F' : 'f');
-		   printf (" (addr=%lx)\n", src->addr));
+		   printf (" (addr=%lx)\n", (unsigned long) src->addr));
 	      dst[-1] = *src;
 	    }
 	  else
@@ -119,7 +119,7 @@
 			   dst[-1].is_func ? 'F' : 'f',
 			   src->name, src->is_static ? 't' : 'T',
 			   src->is_func ? 'F' : 'f');
-		   printf (" (addr=%lx)\n", src->addr));
+		   printf (" (addr=%lx)\n", (unsigned long) src->addr));
 	    }
 	}
       else
@@ -132,7 +132,8 @@
 	  /* retain sym only if it has a non-empty address range: */
 	  if (!src->end_addr || src->addr <= src->end_addr)
 	    {
-	      *dst++ = *src;
+	      *dst = *src;
+	      dst++;
 	      prev_addr = src->addr;
 	    }
 	}
@@ -170,7 +171,8 @@
   long low, mid, high;
   Sym *sym;
 
-  fprintf (stderr, "[dbg_sym_lookup] address 0x%lx\n", address);
+  fprintf (stderr, "[dbg_sym_lookup] address 0x%lx\n",
+	   (unsigned long) address);
 
   sym = symtab->base;
   for (low = 0, high = symtab->len - 1; low != high;)
@@ -179,7 +181,8 @@
       fprintf (stderr, "[dbg_sym_lookup] low=0x%lx, mid=0x%lx, high=0x%lx\n",
 	       low, mid, high);
       fprintf (stderr, "[dbg_sym_lookup] sym[m]=0x%lx sym[m + 1]=0x%lx\n",
-	       sym[mid].addr, sym[mid + 1].addr);
+	       (unsigned long) sym[mid].addr,
+	       (unsigned long) sym[mid + 1].addr);
       if (sym[mid].addr <= address && sym[mid + 1].addr > address)
 	{
 	  return &sym[mid];
diff --git a/gprof/tahoe.c b/gprof/tahoe.c
index d133c17..5981bc5 100644
--- a/gprof/tahoe.c
+++ b/gprof/tahoe.c
@@ -247,7 +247,8 @@
       p_highpc = s_highpc;
     }
   DBG (CALLDEBUG, printf ("[findcall] %s: 0x%lx to 0x%lx\n",
-			  parent->name, p_lowpc, p_highpc));
+			  parent->name, (unsigned long) p_lowpc,
+			  (unsigned long) p_highpc));
   for (instructp = (unsigned char *) core_text_space + p_lowpc;
        instructp < (unsigned char *) core_text_space + p_highpc;
        instructp += length)
@@ -259,8 +260,10 @@
 	   *    maybe a callf, better check it out.
 	   *      skip the count of the number of arguments.
 	   */
-	  DBG (CALLDEBUG, printf ("[findcall]\t0x%x:callf",
-				  instructp - (unsigned char *) core_text_space));
+	  DBG (CALLDEBUG, printf ("[findcall]\t0x%lx:callf",
+				  ((unsigned long)
+				   (instructp
+				    - (unsigned char *) core_text_space))));
 	  firstmode = tahoe_operandmode (instructp + length);
 	  switch (firstmode)
 	    {
@@ -310,9 +313,11 @@
 		{
 		  child = sym_lookup (&symtab, destpc);
 		  DBG (CALLDEBUG,
-		       printf ("[findcall]\tdestpc 0x%lx", destpc);
+		       printf ("[findcall]\tdestpc 0x%lx",
+			       (unsigned long) destpc);
 		       printf (" child->name %s", child->name);
-		       printf (" child->addr 0x%lx\n", child->addr);
+		       printf (" child->addr 0x%lx\n",
+			       (unsigned long) child->addr);
 		    );
 		  if (child->addr == destpc)
 		    {
diff --git a/gprof/utils.c b/gprof/utils.c
index e1f031d..c72c02e 100644
--- a/gprof/utils.c
+++ b/gprof/utils.c
@@ -69,7 +69,7 @@
 		}
 	    }
 	  sprintf (buf, " (%s:%d)", filename, self->line_num);
-	  printf (buf);
+	  printf ("%s", buf);
 	  size += strlen (buf);
 	}
       if (demangled)
diff --git a/gprof/vax.c b/gprof/vax.c
index 1a7bd8d..58e7de3 100644
--- a/gprof/vax.c
+++ b/gprof/vax.c
@@ -250,7 +250,8 @@
       p_highpc = s_highpc;
     }
   DBG (CALLDEBUG, printf ("[findcall] %s: 0x%lx to 0x%lx\n",
-			  parent->name, p_lowpc, p_highpc));
+			  parent->name, (unsigned long) p_lowpc,
+			  (unsigned long) p_highpc));
   for (instructp = (unsigned char *) core_text_space + p_lowpc;
        instructp < (unsigned char *) core_text_space + p_highpc;
        instructp += length)
@@ -263,8 +264,9 @@
 	   *      skip the count of the number of arguments.
 	   */
 	  DBG (CALLDEBUG,
-	       printf ("[findcall]\t0x%x:calls",
-		       instructp - (unsigned char *) core_text_space));
+	       printf ("[findcall]\t0x%lx:calls",
+		       ((unsigned long)
+			(instructp - (unsigned char *) core_text_space))));
 	  firstmode = vax_operandmode ((struct modebyte *) (instructp + length));
 	  switch (firstmode)
 	    {
@@ -314,9 +316,11 @@
 		{
 		  child = sym_lookup (&symtab, destpc);
 		  DBG (CALLDEBUG,
-		       printf ("[findcall]\tdestpc 0x%lx", destpc);
+		       printf ("[findcall]\tdestpc 0x%lx",
+			       (unsigned long) destpc);
 		       printf (" child->name %s", child->name);
-		       printf (" child->addr 0x%lx\n", child->addr);
+		       printf (" child->addr 0x%lx\n",
+			       (unsigned long) child->addr);
 		    );
 		  if (child->addr == destpc)
 		    {
diff --git a/include/ChangeLog b/include/ChangeLog
index 04f9f02..cb15edc 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,8 +1,99 @@
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
+
+	* dis-asm.h (print_insn_avr): Declare.
+
+2000-03-14  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+	* hashtab.h (htab_trav): Modify type so that first arg is of type
+	void **.
+	(htab_find_with_hash, htab_find_slot_with_hash): Declare new
+	functions.
+
+2000-03-09  Alex Samuel  <samuel@codesourcery.com>
+
+	* partition.h: New file.
+
+2000-03-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* hashtab.h (struct htab): Add del_f.
+	(htab_del): New type.
+	(htab_create): Add fourth argument.
+
+2000-03-08  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* hashtab.h (hash_table_t): Rename to htab_t.
+	(struct hash_table): Rename to struct htab.  Shorten element
+	names.  Reorder elements by size.
+	(htab_hash, htab_eq, htab_trav): New typedefs for the callback
+	function pointers.
+	(hash_table_entry_t): Discard; just use void * for element
+	type.
+
+2000-03-01  H.J. Lu  <hjl@gnu.org>
+
+	* bfdlink.h (bfd_link_callbacks): Add a boolean arg to
+	the undefined_symbol callback.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* dis-asm.h (print_insn_i370): Declare.
+
+2000-02-22  Chandra Chavva  <cchavva@cygnus.com>
+
+	* opcode/d30v.h (FLAG_NOT_WITH_ADDSUBppp): Redefined as operation
+	cannot be combined in parallel with ADD/SUBppp.
+
+Tue Feb 22 15:19:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-sim.h (sim_trace): Document return values.
+	(sim_set_trace): Declare.  Deprecate.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* dis-asm.h (struct disassemble_info): Change `length' param of
+	read_memory_func to unsigned.  Change type of `buffer_length' and
+	`octets_per_byte' to unsigned.
+	(buffer_read_memory): Change `length' param to unsigned.
+
+2000-02-16  Nick Clifton  <nickc@cygnus.com>
+
+	* dis-asm.h: Add prototypes for ARM register name functions.
+
+Wed Feb  9 18:45:49 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* wait.h: Delete. No longer used by GDB.
+
+Tue Feb  8 17:01:13 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-sim.h (sim_resume): Clarify use of SIGGNAL.
+	(sim_stop_reason): Clarify meaning of sim_signalled.
+
+2000-02-03  Timothy Wall <twall@redhat.com>
+
+	* dis-asm.h (struct disassemble_info): Added octets_per_byte
+	field and initialize it to one (1).
+	
+2000-01-27  Nick Clifton  <nickc@redhat.com>
+
+	* dis-asm.h: Add prototype for disassembler_usage().
+	Add prototype for arm_disassembler_options().
+	Remove prototype for arm_toggle_regnames().
+	Add prototype for parse_arm_disassembler_option().
+
 Sat Jan  1 19:06:52 2000  Hans-Peter Nilsson  <hp@bitrange.com>
 
 	* symcat.h (STRINGX) [!__STDC__ || ALMOST_STDC]: Change "?" to "s"
 	to stringify argument s.
 
+Wed Dec 15 11:22:56 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hp-symtab.h (HP_LANGUAGE_FORTRAN): New enumeration constant.
+	(HP_LANGUAGE_F77): Define using HP_LANGUAGE_FORTRAN.
+
+1999-12-15  Doug Evans  <dje@transmeta.com>
+
+	* dis-asm.h: Enclose in extern "C" ifdef __cplusplus.
+
 1999-12-05  Mark Mitchell  <mark@codesourcery.com>
 
 	* splay-tree.h (struct splay_tree_node): Rename to ...
@@ -25,16 +116,30 @@
 	(asprintf, vasprintf): Provide declarations.
 
 Wed Nov 10 12:43:21 1999  Philippe De Muyter  <phdm@macqel.be>
-                          Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+			  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* ansidecl.h: Define and test `GCC_VERSION', not `HAVE_GCC_VERSION'.
-	
+
+1999-11-04      Jimmy Guo       <guo@cup.hp.com>
+
+	* hp-symtab.h (dntt_type_fparam): Add doc_ranges, misc_kind
+	fields, change location type to CORE_ADDR from int.
+	(dntt_type_const): Name the 5th field location_type.
+
+Sun Oct 24 19:11:32 1999  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-d10v.h (SIM_D10V_TS2_DMAP_REGNUM): Define.
+
 1999-10-23 08:51 -0700  Zack Weinberg  <zack@bitmover.com>
 
 	* hashtab.h: Give hash_table_t a struct tag.  Add prototypes
 	for clear_hash_table_slot and traverse_hash_table.  Correct
 	prototype of all_hash_table_collisions.
 
+Sat Oct 23 19:00:13 1999  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-d10v.h: New file.
+
 Fri Oct 15 01:47:51 1999  Vladimir Makarov  <vmakarov@loony.cygnus.com>
 
 	* hashtab.h: New file.
@@ -43,7 +148,7 @@
 
 	* ansidecl.h (HAVE_GCC_VERSION): New macro.  Use it instead of
 	explicitly testing __GNUC__ and __GNUC_MINOR__.
-	
+
 	(ATTRIBUTE_PRINTF): Use `__format__', not `format'.
 
 1999-09-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
@@ -59,6 +164,10 @@
 
 	* libiberty.h (xmemdup): Add prototype for new function.
 
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* dis-asm.h (print_insn_pj): Declare.
+
 1999-09-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* obstack.h (obstack_grow, obstack_grow0): Move (char*) casts
@@ -79,6 +188,37 @@
 
 	* ansidecl.h: Copy attribute support macros from egcs.
 
+1999-06-22  Mark Mitchell  <mark@codesourcery.com>
+
+	* bfdlink.h (struct bfd_link_hash_entry): Add init_function and
+	fini_function.
+
+1999-06-20  Mark Mitchell  <mark@codesourcery.com>
+
+	* mips.h (Elf32_Internal_Msym): New structure.
+	(Elf32_External_Msym): Likewise.
+	(ELF32_MS_REL_INDEX): New macro.
+	(ELF32_MS_FLAGS): Likewise.
+	(ELF32_MS_INFO): Likewise.
+	
+1999-06-14  Nick Clifton  <nickc@cygnus.com>
+
+	* dis-asm.h (arm_toggle_regnames): New prototype.
+	(struct diassemble_info): New field: disassembler_options.
+
+1999-04-11  Richard Henderson  <rth@cygnus.com>
+
+	* bfdlink.h (bfd_elf_version_expr): Rename `match' to `pattern'.
+	Add `match' callback function.
+
+1999-04-10  Richard Henderson  <rth@cygnus.com>
+
+	* bfdlink.h (bfd_link_info): Add no_undefined.
+
+1999-04-08  Nick Clifton  <nickc@cygnus.com>
+
+	* dis-asm.h: Add prototype for print_insn_mcore.
+
 1999-04-02  Mark Mitchell  <mark@codesourcery.com>
 
 	* splay-tree.h (splay_tree_compare_pointers): Declare.
@@ -91,25 +231,63 @@
 
 	* libiberty.h (basename): Cygwin{,32} should have the prototype.
 
+1999-02-22  Jim Lemke  <jlemke@cygnus.com>
+
+	* bfdlink.h (bfd_link_info): add field "mpc860c0".
+
+Mon Feb  1 21:05:46 1999  Catherine Moore  <clm@cygnus.com>
+
+       * dis-asm.h (print_insn_i386_att):  Declare.
+       (print_insn_i386_intel):  Declare.
+
+998-12-30  Michael Meissner  <meissner@cygnus.com>
+
+	* dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Cast STREAM and
+	FPRINTF_FUNC to avoid compiler warnings.
+
+Wed Dec 30 16:07:14 1998  David Taylor  <taylor@texas.cygnus.com>
+
+	* dis-asm.h: change void * to PTR (two places).
+
 Mon Dec 14 09:53:31 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* demangle.h: Don't check IN_GCC anymore.
 	* splay-tree.h: Likewise.
 
-Tue Dec  8 00:30:31 1998  Elena Zannoni  <ezannoni@kwikemart.cygnus.com> 
+Tue Dec  8 00:30:31 1998  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
 
-        * demangle.h: (DMGL_EDG): new macro for Kuck and Associates
-        (DMGL_STYLE_MASK): modify to include Kuck and Assoc style
-        (demangling_styles): add new edg_demangling style
-        (EDG_DEMANGLING_STYLE_STRING): new macro
-        (EDG_DEMANGLING): new macro
+	The following changes were made by Elena Zannoni
+ 	<ezannoni@kwikemart.cygnus.com> and Edith Epstein
+ 	<eepstein@sophia.cygnus.com> as part of a project to merge in
+ 	changes made by HP; HP did not create ChangeLog entries.
 
-        * demangle.h (DMGL_HP): new macro, for HP/aCC compiler.
-        (DMGL_STYLE_MASK): modify to include new HP's style.
-        (demangling_styles): add new hp_demangling value.
-        (HP_DEMANGLING_STYLE_STRING): new macro.
-        (ARM_DEMANGLING): coerce to int.
-        (HP_DEMANGLING): new macro.
+	* dis-asm.h (struct disassemble_info): change the type of stream
+	from FILE* to void*, for use with gdb's new type GDB_FILE.
+	(fprintf_ftype): change FILE* parameter type to void*.
+
+	* demangle.h: (DMGL_EDG): new macro for Kuck and Associates
+	(DMGL_STYLE_MASK): modify to include Kuck and Assoc style
+	(demangling_styles): add new edg_demangling style
+	(EDG_DEMANGLING_STYLE_STRING): new macro
+	(EDG_DEMANGLING): new macro
+
+	* demangle.h (DMGL_HP): new macro, for HP/aCC compiler.
+	(DMGL_STYLE_MASK): modify to include new HP's style.
+	(demangling_styles): add new hp_demangling value.
+	(HP_DEMANGLING_STYLE_STRING): new macro.
+	(ARM_DEMANGLING): coerce to int.
+	(HP_DEMANGLING): new macro.
+
+	* hp-symtab.h: rewritten, from HP.
+	(quick_procedure): change type of language field to unsigned int
+	(quick_module): change type of language field to unsigned int
+	(struct dntt_type_svar): add field thread_specific.
+	(hp_language): add languages modcal and dmpascal.
+
+Mon Nov 30 15:25:58 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* elf/sh.h (elf_sh_reloc_type): Add R_SH_FIRST_INVALID_RELOC,
+	R_SH_LAST_INVALID_RELOC, R_SH_SWITCH8 and R_SH_max.
 
 Fri Nov 20 13:14:00 1998  Andrew Cagney  <cagney@b1.cygnus.com>
 
@@ -126,11 +304,19 @@
 	* demangle.h: Never define PARAMS().
 	* splay-tree.h: Likewise.
 
+Sat Nov  7 18:30:20 1998  Peter Schauer  <peter.schauer@regent.e-technik.tu-muenchen.de>
+
+	* dis-asm.h (print_insn_vax): Declare.
+
 Sat Nov  7 16:04:03 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* demangle.h: Don't include gansidecl.h.
 	* splay-tree.h: Likewise.
 
+1998-10-26 16:03  Ulrich Drepper  <drepper@cygnus.com>
+
+	* bfdlink.h (struct bfd_link_info): Add new field optimize.
+
 Thu Oct 22 19:58:00 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* splay-tree.h: Wrap function pointer parameter declarations in
@@ -157,6 +343,10 @@
 
 	* obstack.h: Update to latest FSF version.
 
+Tue May 26 20:57:43 1998  Stan Cox  <scox@equinox.cygnus.com>
+
+	* elf/sparc.h (EF_SPARC_LEDATA, R_SPARC_32LE): Added.
+
 Tue Feb 24 13:05:02 1998  Doug Evans  <devans@canuck.cygnus.com>
 
 	* dis-asm.h (disassemble_info): Member `symbol' renamed to `symbols'
@@ -429,6 +619,10 @@
 	bytes_per_chunk and display_endian to control the
 	display of raw instructions.
 
+Fri Dec 27 22:17:37 1996  Fred Fish  <fnf@cygnus.com>
+
+	* dis-asm.h (print_insn_tic80): Declare.
+
 Sun Dec  8 17:11:12 1996  Doug Evans  <dje@canuck.cygnus.com>
 
 	* callback.h (host_callback): New member `error'.
@@ -806,8 +1000,8 @@
 
 Fri Apr  1 00:38:17 1994  Jim Wilson  (wilson@mole.gnu.ai.mit.edu)
 
-        * obstack.h: Delete use of IN_GCC to control whether
-        stddef.h or gstddef.h is included.
+	* obstack.h: Delete use of IN_GCC to control whether
+	stddef.h or gstddef.h is included.
 
 Tue Mar 22 13:06:02 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 9e8a457..1030867 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -160,7 +160,6 @@
 
 #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:
 
diff --git a/include/aout/ChangeLog b/include/aout/ChangeLog
index 854cfd5..63f17ec 100644
--- a/include/aout/ChangeLog
+++ b/include/aout/ChangeLog
@@ -1,3 +1,8 @@
+1999-07-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* aout64.h (N_SHARED_LIB): Define as 0 if TEXT_START_ADDR is
+	defined as 0.
+
 Sun Jun 28 11:33:48 1998  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
 
 	* stab.def:  Add N_ALIAS from SunPro F77.
diff --git a/include/aout/aout64.h b/include/aout/aout64.h
index 76f1140..bf743c4 100644
--- a/include/aout/aout64.h
+++ b/include/aout/aout64.h
@@ -121,8 +121,12 @@
 /* Sun shared libraries, not linux.  This macro is only relevant for ZMAGIC
    files.  */
 #ifndef N_SHARED_LIB
+#if defined (TEXT_START_ADDR) && TEXT_START_ADDR == 0
+#define N_SHARED_LIB(x) (0)
+#else
 #define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR)
 #endif
+#endif
 
 /* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on
    the assumption that we are dealing with a .o file, not an
diff --git a/include/bfdlink.h b/include/bfdlink.h
index a055fa0..bb827a3 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -237,6 +237,13 @@
   MPC860 C0 (or earlier) should be checked for and modified.  It gives the
   number of bytes that should be checked at the end of each text page. */
   int mpc860c0;
+
+  /* The function to call when the executable or shared object is
+     loaded.  */
+  const char *init_function;
+  /* The function to call when the executable or shared object is
+     unloaded.  */
+  const char *fini_function;
 };
 
 /* This structures holds a set of callback functions.  These are
@@ -322,10 +329,13 @@
   /* A function which is called when a relocation is attempted against
      an undefined symbol.  NAME is the symbol which is undefined.
      ABFD, SECTION and ADDRESS identify the location from which the
-     reference is made.  In some cases SECTION may be NULL.  */
+     reference is made. FATAL indicates whether an undefined symbol is
+     a fatal error or not. In some cases SECTION may be NULL.  */
   boolean (*undefined_symbol) PARAMS ((struct bfd_link_info *,
 				       const char *name, bfd *abfd,
-				       asection *section, bfd_vma address));
+				       asection *section,
+				       bfd_vma address,
+				       boolean fatal));
   /* A function which is called when a reloc overflow occurs.  NAME is
      the name of the symbol or section the reloc is against,
      RELOC_NAME is the name of the relocation, and ADDEND is any
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index 8ad6e0c..76b52c0 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,82 @@
+2000-03-15  Kazu Hirata  <kazu@hxi.com>
+
+	* internal.h: Fix a typo in the comment for R_MOVL2.
+
+2000-02-28  Nick Clifton  <nickc@cygnus.com>
+
+	* mipspe.h (MIPS_PE_MAGIC): Define.
+	* sh.h (SH_PE_MAGIC): Define.
+
+2000-02-22  Nick Clifton  <nickc@cygnus.com>  DJ Delorie <dj@cygnus.com>
+
+	* sh.h: Add Windows CE definitions.
+	* arm.h: Add Windows CE definitions.
+	* mipspe.h: New file: Windows CE definitions for MIPS.
+	* pe.h: Add constants for ILF support.
+	
+2000-01-05  Nick Clifton  <nickc@cygnus.com>
+
+	* pe.h: Fix formatting of comments.
+	(IMAGE_FILE_AGGRESSIVE_WS_TRIM): Define.
+	(IMAGE_FILE_LARGE_ADDRESS_AWARE): Define.
+	(IMAGE_FILE_16BIT_MACHINE): Define.
+	(IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP): Define.
+	(IMAGE_FILE_UP_SYSTEM_ONLY): Define.
+	(IMAGE_FILE_MACHINE_UNKNOWN): Define.
+	(IMAGE_FILE_MACHINE_ALPHA): Define.
+	(IMAGE_FILE_MACHINE_ALPHA64): Define.
+	(IMAGE_FILE_MACHINE_I386): Define.
+	(IMAGE_FILE_MACHINE_IA64): Define.
+	(IMAGE_FILE_MACHINE_M68K): Define.
+	(IMAGE_FILE_MACHINE_MIPS16): Define.
+	(IMAGE_FILE_MACHINE_MIPSFPU): Define.
+	(IMAGE_FILE_MACHINE_MIPSFPU16): Define.
+	(IMAGE_FILE_MACHINE_POWERPC): Define.
+	(IMAGE_FILE_MACHINE_R3000): Define.
+	(IMAGE_FILE_MACHINE_R4000): Define.
+	(IMAGE_FILE_MACHINE_R10000): Define.
+	(IMAGE_FILE_MACHINE_SH3): Define.
+	(IMAGE_FILE_MACHINE_SH4): Define.
+	(IMAGE_FILE_MACHINE_THUMB): Define.
+
+1999-09-20  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* internal.h: Delete bogus R_PCLONG, duplicate R_RELBYTE and
+	R_RELWORD, and rewrite some R_* as decimal.
+
+1999-09-06  Donn Terry  <donn@interix.com>
+
+	* internal.h (DTYPE): Define.
+	* pe.h (struct external_PEI_filehdr): Rename from
+	external_PE_filehdr.  Define even if COFF_IMAGE_WITH_PE is not
+	defined.
+
+1999-07-17  Nick Clifton  <nickc@cygnus.com>
+
+	* arm.h (F_SOFT_FLOAT): Rename from F_SOFTFLOAT.
+
+1999-06-21  Philip Blundell  <pb@nexus.co.uk>
+
+	* arm.h (F_SOFTFLOAT): Define.
+
+1999-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* arm.h (F_ARM_5): Define.
+
+Wed Jun  2 18:08:18 1999  Richard Henderson  <rth@cygnus.com>
+
+	* internal.h (BEOS_EXE_IMAGE_BASE, BEOS_DLL_IMAGE_BASE): New.
+
+Mon May 17 13:35:35 1999  Stan Cox  <scox@cygnus.com>
+
+	* coff/arm.h (F_PIC, F_ARM_2, F_ARM_2a, F_ARM_3, F_ARM_3M,
+	F_ARM_4, F_ARM_4T, F_APCS26): Changed values to distinguish
+	F_ARM_2a, F_ARM_3M, F_ARM_4T.
+
+1999-05-15  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore.h (IMAGE_REL_MCORE_RVA): Define.
+
 1999-04-21  Nick Clifton  <nickc@cygnus.com>
 
 	* mcore.h (GET_LINENO_LNNO): New macro.
@@ -5,7 +84,7 @@
 
 1999-04-08  Nick Clifton  <nickc@cygnus.com>
 
-	* mcore.h: New header file.  Defines for Motorolla's MCore
+	* mcore.h: New header file.  Defines for Motorola's MCore
 	processor. 
 
 Sun Dec  6 21:36:37 1998  Mark Elbrecht  <snowball3@usa.net>
diff --git a/include/coff/arm.h b/include/coff/arm.h
index dd578b1..7ca9329 100644
--- a/include/coff/arm.h
+++ b/include/coff/arm.h
@@ -1,10 +1,28 @@
-/*** coff information for the ARM */
+/* ARM COFF support for BFD.
+   Copyright (C) 1998, 1999 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 COFFARM 1
 
 /********************** FILE HEADER **********************/
 
-struct external_filehdr {
+struct external_filehdr
+{
 	char f_magic[2];	/* magic number			*/
 	char f_nscns[2];	/* number of sections		*/
 	char f_timdat[4];	/* time & date stamp		*/
@@ -26,6 +44,7 @@
  *	F_AR32WR	file has byte ordering of an AR32WR machine (e.g. vax)
  *	F_APCS_26	file uses 26 bit ARM Procedure Calling Standard
  *	F_APCS_SET	the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised
+ *	F_SOFT_FLOAT	code does not use floating point instructions
  */
 
 #define F_RELFLG	(0x0001)
@@ -40,20 +59,22 @@
 #define	F_AR32WR	(0x0100)
 #define F_APCS_26	(0x0400)
 #define F_APCS_SET	(0x0800)
+#define F_SOFT_FLOAT	(0x2000)
 
 /* Bits stored in flags field of the internal_f structure */
 
 #define F_INTERWORK	(0x0010)
-#define F_PIC_INT	(0x0020)
 #define F_APCS_FLOAT	(0x0040)
-#define F_ARM_ARCHITECTURE_MASK	(0x0c00)
-#define F_ARM_2		(0x0000)
-#define F_ARM_2a	(0x0000)
-#define F_ARM_3		(0x0400)
-#define F_ARM_3M	(0x0400)
-#define F_ARM_4		(0x0800)
-#define F_ARM_4T	(0x0c00)
-#define F_APCS26	(0x4000)
+#define F_PIC		(0x0080)
+#define F_APCS26	(0x1000)
+#define F_ARM_ARCHITECTURE_MASK (0x4000+0x0800+0x0400)
+#define F_ARM_2		(0x0400)
+#define F_ARM_2a	(0x0800)
+#define F_ARM_3		(0x0c00)
+#define F_ARM_3M	(0x4000)
+#define F_ARM_4		(0x4400)
+#define F_ARM_4T	(0x4800)
+#define F_ARM_5		(0x4c00)
 
 /*
  * ARMMAGIC ought to encoded the procesor type,
@@ -64,10 +85,16 @@
  * XXX - NC 5/6/97
  */
 
-#define	ARMMAGIC	0xa00  /* I just made this up */ 
+#define	ARMMAGIC	0xa00  /* I just made this up */
 
 #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC))
 
+#define	ARMPEMAGIC	0x1c0
+#define	THUMBPEMAGIC	0x1c2
+
+#undef  ARMBADMAG
+#define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC))
+
 #define	FILHDR	struct external_filehdr
 #define	FILHSZ	20
 
@@ -85,8 +112,6 @@
   char	entry[4];		/* entry pt.				*/
   char 	text_start[4];		/* base of text used for this file */
   char 	data_start[4];		/* base of data used for this file */
-
-
 }
 AOUTHDR;
 
@@ -108,9 +133,8 @@
 #define NT_DEF_COMMIT        0x1000
 
 /********************** SECTION HEADER **********************/
-
-
-struct external_scnhdr {
+struct external_scnhdr
+{
 	char		s_name[8];	/* section name			*/
 	char		s_paddr[4];	/* physical address, aliased s_nlib */
 	char		s_vaddr[4];	/* virtual address		*/
@@ -145,8 +169,10 @@
  * grouping will have l_lnno = 0 and in place of physical address will be the
  * symbol table index of the function name.
  */
-struct external_lineno {
-	union {
+struct external_lineno
+{
+	union
+	{
 		char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
 		char l_paddr[4];	/* (physical) address of line number	*/
 	} l_addr;
@@ -166,9 +192,11 @@
 
 struct external_syment 
 {
-  union {
+  union
+  {
     char e_name[E_SYMNMLEN];
-    struct {
+    struct
+    {
       char e_zeroes[4];
       char e_offset[4];
     } e;
@@ -185,37 +213,47 @@
 #define N_BTSHFT	(4)
 #define N_TSHIFT	(2)
 
-union external_auxent {
-	struct {
+union external_auxent
+{
+	struct
+	{
 		char x_tagndx[4];	/* str, un, or enum tag indx */
-		union {
-			struct {
+		union
+		{
+			struct
+			{
 			    char  x_lnno[2]; /* declaration line number */
 			    char  x_size[2]; /* str/union/array size */
 			} x_lnsz;
 			char x_fsize[4];	/* size of function */
 		} x_misc;
-		union {
-			struct {		/* if ISFCN, tag, or .bb */
+		union
+		{
+			struct 			/* if ISFCN, tag, or .bb */
+			{
 			    char x_lnnoptr[4];	/* ptr to fcn line # */
 			    char x_endndx[4];	/* entry ndx past block end */
 			} x_fcn;
-			struct {		/* if ISARY, up to 4 dimen. */
+			struct 			/* if ISARY, up to 4 dimen. */
+			{
 			    char x_dimen[E_DIMNUM][2];
 			} x_ary;
 		} x_fcnary;
 		char x_tvndx[2];		/* tv index */
 	} x_sym;
 
-	union {
+	union
+	{
 		char x_fname[E_FILNMLEN];
-		struct {
+		struct
+		{
 			char x_zeroes[4];
 			char x_offset[4];
 		} x_n;
 	} x_file;
 
-	struct {
+	struct
+	{
 		char x_scnlen[4];	/* section length */
 		char x_nreloc[2];	/* # relocation entries */
 		char x_nlinno[2];	/* # line numbers */
@@ -224,13 +262,12 @@
 		char x_comdat[1];	/* COMDAT selection number */
 	} x_scn;
 
-        struct {
+        struct
+	{
 		char x_tvfill[4];	/* tv fill value */
 		char x_tvlen[2];	/* length of .tv */
 		char x_tvran[2][2];	/* tv range */
 	} x_tv;		/* info about .tv section (in auxent of symbol .tv)) */
-
-
 };
 
 #define	SYMENT	struct external_syment
@@ -238,21 +275,29 @@
 #define	AUXENT	union external_auxent
 #define	AUXESZ	18
 
-
-#	define _ETEXT	"etext"
-
+#define _ETEXT	"etext"
 
 /********************** RELOCATION DIRECTIVES **********************/
+#ifdef ARM_WINCE
+struct external_reloc
+{
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+};
 
+#define RELOC struct external_reloc
+#define RELSZ 10
 
-
-struct external_reloc {
+#else
+struct external_reloc
+{
   char r_vaddr[4];
   char r_symndx[4];
   char r_type[2];
   char r_offset[4];
 };
 
-
 #define RELOC struct external_reloc
 #define RELSZ 14
+#endif
diff --git a/include/coff/internal.h b/include/coff/internal.h
index d5ea951..e89b528 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -89,10 +89,14 @@
 }  IMAGE_DATA_DIRECTORY;
 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES  16
 
-/* default image base for NT */
+/* Default image base for NT.  */
 #define NT_EXE_IMAGE_BASE 0x400000
 #define NT_DLL_IMAGE_BASE 0x10000000
 
+/* Default image base for BeOS. */
+#define BEOS_EXE_IMAGE_BASE 0x80000000
+#define BEOS_DLL_IMAGE_BASE 0x10000000
+
 /* Extra stuff in a PE aouthdr */
 
 #define PE_DEF_SECTION_ALIGNMENT 0x1000
@@ -417,6 +421,7 @@
 #define DT_ARY		(3)	/* array */
 
 #define BTYPE(x)	((x) & N_BTMASK)
+#define DTYPE(x)	(((x) & N_TMASK) >> N_BTSHFT)
 
 #define ISPTR(x) \
   (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_PTR << N_BTSHFT))
@@ -585,33 +590,28 @@
   unsigned long r_offset;	/* Used by Alpha ECOFF, SPARC, others */
 };
 
-#define R_RELBYTE	017
-#define R_RELWORD	020
-#define R_PCRBYTE	022
-#define R_PCRWORD	023
-#define R_PCRLONG	024
+#define R_DIR16 	 1
+#define R_DIR32 	 6
+#define R_IMAGEBASE	 7
+#define R_RELBYTE	15
+#define R_RELWORD	16
+#define R_RELLONG	17
+#define R_PCRBYTE	18
+#define R_PCRWORD	19
+#define R_PCRLONG	20
+#define R_IPRSHORT	24
+#define R_IPRLONG	26
+#define R_GETSEG	29
+#define R_GETPA 	30
+#define R_TAGWORD	31
+#define R_JUMPTARG	32	/* strange 29k 00xx00xx reloc */
 
-#define	R_DIR16		01
-#define R_DIR32		06
-#define	R_PCLONG	020
-#define R_RELBYTE	017
-#define R_RELWORD	020
-#define R_IMAGEBASE     07
-
-
-#define R_PCR16L 128
-#define R_PCR26L 129
-#define R_VRT16  130
-#define R_HVRT16 131
-#define R_LVRT16 132
-#define R_VRT32  133
-#define R_RELLONG	(0x11)	/* Direct 32-bit relocation */
-#define R_IPRSHORT	(0x18)
-#define R_IPRLONG	(0x1a)
-#define R_GETSEG	(0x1d)
-#define R_GETPA		(0x1e)
-#define R_TAGWORD	(0x1f)
-#define R_JUMPTARG	0x20	/* strange 29k 00xx00xx reloc */
+#define R_PCR16L       128
+#define R_PCR26L       129
+#define R_VRT16        130
+#define R_HVRT16       131
+#define R_LVRT16       132
+#define R_VRT32        133
 
 
 /* This reloc identifies mov.b instructions with a 16bit absolute
@@ -671,7 +671,7 @@
 #define R_MOVL1    	0x4c
 
 /* This reloc identifies mov.[wl] insns which formerlly had
-   a 32/24bit absolute address and how have a 16bit absolute address.  */
+   a 32/24bit absolute address and now have a 16bit absolute address.  */
 #define R_MOVL2 	0x4d
 
 /* This reloc identifies a bCC:8 which will have it's condition
diff --git a/include/coff/mcore.h b/include/coff/mcore.h
index 974b62e..0fa319c 100644
--- a/include/coff/mcore.h
+++ b/include/coff/mcore.h
@@ -1,4 +1,4 @@
-/* Motorolla MCore support for BFD.
+/* Motorola MCore support for BFD.
    Copyright (C) 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -32,6 +32,7 @@
 #define IMAGE_REL_MCORE_PCREL_IMM4BY2		0x0004
 #define IMAGE_REL_MCORE_PCREL_32		0x0005
 #define IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2	0x0006
+#define IMAGE_REL_MCORE_RVA			0x0007
 
 #define PEMCORE
 
diff --git a/include/coff/mipspe.h b/include/coff/mipspe.h
new file mode 100644
index 0000000..1927d99
--- /dev/null
+++ b/include/coff/mipspe.h
@@ -0,0 +1,223 @@
+/*** coff information for Windows CE with MIPS VR4111 */
+
+/********************** FILE HEADER **********************/
+
+struct external_filehdr {
+	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			*/
+};
+
+
+
+#define MIPS_ARCH_MAGIC_WINCE	0x0166  /* Windows CE - little endian */
+#define MIPS_PE_MAGIC		0x010b
+
+#define MIPSBADMAG(x) \
+ ((x).f_magic!=MIPS_ARCH_MAGIC_WINCE)
+
+#define	FILHDR	struct external_filehdr
+#define	FILHSZ	20
+
+
+/********************** AOUT "OPTIONAL HEADER" **********************/
+
+
+typedef struct 
+{
+  char 	magic[2];		/* type of file				*/
+  char	vstamp[2];		/* version stamp			*/
+  char	tsize[4];		/* text size in bytes, padded to FW bdry*/
+  char	dsize[4];		/* initialized data "  "		*/
+  char	bsize[4];		/* uninitialized data "   "		*/
+  char	entry[4];		/* entry pt.				*/
+  char 	text_start[4];		/* base of text used for this file */
+  char 	data_start[4];		/* base of data used for this file */
+}
+AOUTHDR;
+
+
+#define AOUTHDRSZ 28
+#define AOUTSZ 28
+
+
+
+
+/* define some NT default values */
+/*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
+#define NT_SECTION_ALIGNMENT 0x1000
+#define NT_FILE_ALIGNMENT    0x200
+#define NT_DEF_RESERVE       0x100000
+#define NT_DEF_COMMIT        0x1000
+
+/********************** SECTION HEADER **********************/
+
+
+struct external_scnhdr {
+	char		s_name[8];	/* section name			*/
+	char		s_paddr[4];	/* physical address, aliased s_nlib */
+	char		s_vaddr[4];	/* virtual address		*/
+	char		s_size[4];	/* section size			*/
+	char		s_scnptr[4];	/* file ptr to raw data for section */
+	char		s_relptr[4];	/* file ptr to relocation	*/
+	char		s_lnnoptr[4];	/* file ptr to line numbers	*/
+	char		s_nreloc[2];	/* number of relocation entries	*/
+	char		s_nlnno[2];	/* number of line number entries*/
+	char		s_flags[4];	/* flags			*/
+};
+
+/*
+ * names of "special" sections
+ */
+#define _TEXT	".text"
+#define _DATA	".data"
+#define _BSS	".bss"
+
+
+#define	SCNHDR	struct external_scnhdr
+#define	SCNHSZ	40
+
+
+/********************** LINE NUMBERS **********************/
+
+/* 1 line number entry for every "breakpointable" source line in a section.
+ * Line numbers are grouped on a per function basis; first entry in a function
+ * grouping will have l_lnno = 0 and in place of physical address will be the
+ * symbol table index of the function name.
+ */
+struct external_lineno {
+	union {
+		char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
+		char l_paddr[4];	/* (physical) address of line number	*/
+	} l_addr;
+	char l_lnno[2];	/* line number		*/
+};
+
+#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
+
+#define	LINENO	struct external_lineno
+#define	LINESZ	6
+
+
+/********************** SYMBOLS **********************/
+
+#define E_SYMNMLEN	8	/* # characters in a symbol name	*/
+#define E_FILNMLEN	14	/* # characters in a file name		*/
+#define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
+
+struct external_syment 
+{
+  union {
+    char e_name[E_SYMNMLEN];
+    struct {
+      char e_zeroes[4];
+      char e_offset[4];
+    } e;
+  } e;
+  char e_value[4];
+  char e_scnum[2];
+  char e_type[2];
+  char e_sclass[1];
+  char e_numaux[1];
+};
+
+
+
+#define N_BTMASK	(017)
+#define N_TMASK		(060)
+#define N_BTSHFT	(4)
+#define N_TSHIFT	(2)
+  
+
+union external_auxent {
+	struct {
+		char x_tagndx[4];	/* str, un, or enum tag indx */
+		union {
+			struct {
+			    char  x_lnno[2]; /* declaration line number */
+			    char  x_size[2]; /* str/union/array size */
+			} x_lnsz;
+			char x_fsize[4];	/* size of function */
+		} x_misc;
+		union {
+			struct {		/* if ISFCN, tag, or .bb */
+			    char x_lnnoptr[4];	/* ptr to fcn line # */
+			    char x_endndx[4];	/* entry ndx past block end */
+			} x_fcn;
+			struct {		/* if ISARY, up to 4 dimen. */
+			    char x_dimen[E_DIMNUM][2];
+			} x_ary;
+		} x_fcnary;
+		char x_tvndx[2];		/* tv index */
+	} x_sym;
+
+	union {
+		char x_fname[E_FILNMLEN];
+		struct {
+			char x_zeroes[4];
+			char x_offset[4];
+		} x_n;
+	} x_file;
+
+	struct {
+		char x_scnlen[4];			/* section length */
+		char x_nreloc[2];	/* # relocation entries */
+		char x_nlinno[2];	/* # line numbers */
+		char x_checksum[4];	/* section COMDAT checksum */
+		char x_associated[2];	/* COMDAT associated section index */
+		char x_comdat[1];	/* COMDAT selection number */
+	} x_scn;
+
+        struct {
+		char x_tvfill[4];	/* tv fill value */
+		char x_tvlen[2];	/* length of .tv */
+		char x_tvran[2][2];	/* tv range */
+	} x_tv;		/* info about .tv section (in auxent of symbol .tv)) */
+
+
+};
+
+#define	SYMENT	struct external_syment
+#define	SYMESZ	18	
+#define	AUXENT	union external_auxent
+#define	AUXESZ	18
+
+
+
+/********************** RELOCATION DIRECTIVES **********************/
+
+/* The external reloc has an offset field, because some of the reloc
+   types on the h8 don't have room in the instruction for the entire
+   offset - eg the strange jump and high page addressing modes */
+
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+};
+
+
+#define RELOC struct external_reloc
+#define RELSZ 10
+
+/* MIPS PE relocation types. */
+
+#define	MIPS_R_ABSOLUTE	0 /* ignored */
+#define	MIPS_R_REFHALF	1
+#define	MIPS_R_REFWORD	2
+#define	MIPS_R_JMPADDR	3
+#define	MIPS_R_REFHI	4 /* PAIR follows */
+#define	MIPS_R_REFLO	5
+#define	MIPS_R_GPREL	6
+#define	MIPS_R_LITERAL	7 /* same as GPREL */
+#define	MIPS_R_SECTION	10
+#define	MIPS_R_SECREL	11
+#define	MIPS_R_SECRELLO	12
+#define	MIPS_R_SECRELHI	13 /* PAIR follows */
+#define	MIPS_R_RVA	34 /* 0x22 */
+#define	MIPS_R_PAIR	37 /* 0x25 - symndx is really a signed 16-bit addend */
diff --git a/include/coff/pe.h b/include/coff/pe.h
index 7e676a5..6932ee8 100644
--- a/include/coff/pe.h
+++ b/include/coff/pe.h
@@ -3,29 +3,32 @@
 #ifndef _PE_H
 #define _PE_H
 
-/* NT specific file attributes */
+/* NT specific file attributes.  */
 #define IMAGE_FILE_RELOCS_STRIPPED           0x0001
 #define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
 #define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
+#define IMAGE_FILE_AGGRESSIVE_WS_TRIM        0x0010
+#define IMAGE_FILE_LARGE_ADDRESS_AWARE       0x0020
+#define IMAGE_FILE_16BIT_MACHINE             0x0040
 #define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
 #define IMAGE_FILE_32BIT_MACHINE             0x0100
 #define IMAGE_FILE_DEBUG_STRIPPED            0x0200
+#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP   0x0400
 #define IMAGE_FILE_SYSTEM                    0x1000
 #define IMAGE_FILE_DLL                       0x2000
+#define IMAGE_FILE_UP_SYSTEM_ONLY            0x4000
 #define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
 
-/* additional flags to be set for section headers to allow the NT loader to
+/* Additional flags to be set for section headers to allow the NT loader to
    read and write to the section data (to replace the addresses of data in
-   dlls for one thing); also to execute the section in .text's case */
+   dlls for one thing); also to execute the section in .text's case.  */
 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
 #define IMAGE_SCN_MEM_EXECUTE     0x20000000
 #define IMAGE_SCN_MEM_READ        0x40000000
 #define IMAGE_SCN_MEM_WRITE       0x80000000
 
-/*
- * Section characteristics added for ppc-nt
- */
+/* Section characteristics added for ppc-nt.  */
 
 #define IMAGE_SCN_TYPE_NO_PAD                0x00000008  /* Reserved. */
 
@@ -53,7 +56,6 @@
 #define IMAGE_SCN_ALIGN_32BYTES              0x00600000
 #define IMAGE_SCN_ALIGN_64BYTES              0x00700000
 
-
 #define IMAGE_SCN_LNK_NRELOC_OVFL            0x01000000  /* Section contains extended relocations. */
 #define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  /* Section is not cachable.               */
 #define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  /* Section is not pageable.               */
@@ -67,6 +69,26 @@
 #define IMAGE_COMDAT_SELECT_EXACT_MATCH	     (4) /* Warn if different.  */
 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE	     (5) /* Base on other section.  */
 
+/* Machine numbers.  */
+
+#define IMAGE_FILE_MACHINE_UNKNOWN           0x0
+#define IMAGE_FILE_MACHINE_ALPHA             0x184
+#define IMAGE_FILE_MACHINE_ARM               0x1c0
+#define IMAGE_FILE_MACHINE_ALPHA64           0x284
+#define IMAGE_FILE_MACHINE_I386              0x14c
+#define IMAGE_FILE_MACHINE_IA64              0x200
+#define IMAGE_FILE_MACHINE_M68K              0x268
+#define IMAGE_FILE_MACHINE_MIPS16            0x266
+#define IMAGE_FILE_MACHINE_MIPSFPU           0x366
+#define IMAGE_FILE_MACHINE_MIPSFPU16         0x466
+#define IMAGE_FILE_MACHINE_POWERPC           0x1f0
+#define IMAGE_FILE_MACHINE_R3000             0x162
+#define IMAGE_FILE_MACHINE_R4000             0x166
+#define IMAGE_FILE_MACHINE_R10000            0x168
+#define IMAGE_FILE_MACHINE_SH3               0x1a2
+#define IMAGE_FILE_MACHINE_SH4               0x1a6
+#define IMAGE_FILE_MACHINE_THUMB             0x1c2
+                                                                           
 /* Magic values that are true for all dos/nt implementations */
 #define DOSMAGIC       0x5a4d  
 #define NT_SIGNATURE   0x00004550
@@ -76,12 +98,7 @@
 #undef  FILNMLEN
 #define FILNMLEN	18	/* # characters in a file name		*/
 
-
-#ifdef COFF_IMAGE_WITH_PE
-/* The filehdr is only weired in images */
-
-#undef FILHDR
-struct external_PE_filehdr
+struct external_PEI_filehdr
 {
   /* DOS header fields */
   char e_magic[2];		/* Magic number, 0x5a4d */
@@ -108,7 +125,6 @@
 
   /* From standard header */  
 
-
   char f_magic[2];		/* magic number			*/
   char f_nscns[2];		/* number of sections		*/
   char f_timdat[4];		/* time & date stamp		*/
@@ -119,12 +135,16 @@
 
 };
 
+#ifdef COFF_IMAGE_WITH_PE
 
-#define FILHDR struct external_PE_filehdr
-#undef FILHSZ
+/* The filehdr is only weird in images.  */
+
+#undef  FILHDR
+#define FILHDR struct external_PEI_filehdr
+#undef  FILHSZ
 #define FILHSZ 152
 
-#endif
+#endif /* COFF_IMAGE_WITH_PE */
 
 typedef struct 
 {
@@ -163,7 +183,16 @@
 
 #undef  E_FILNMLEN
 #define E_FILNMLEN	18	/* # characters in a file name		*/
-#endif
 
+/* Import Tyoes fot ILF format object files..  */
+#define IMPORT_CODE	0
+#define IMPORT_DATA	1
+#define IMPORT_CONST	2
 
+/* Import Name Tyoes for ILF format object files.  */
+#define IMPORT_ORDINAL		0
+#define IMPORT_NAME		1
+#define IMPORT_NAME_NOPREFIX	2
+#define IMPORT_NAME_UNDECORATE	3
 
+#endif /* _PE_H */
diff --git a/include/coff/sh.h b/include/coff/sh.h
index 41957df..f7271f2 100644
--- a/include/coff/sh.h
+++ b/include/coff/sh.h
@@ -16,10 +16,13 @@
 
 #define	SH_ARCH_MAGIC_BIG	0x0500
 #define	SH_ARCH_MAGIC_LITTLE	0x0550  /* Little endian SH */
+#define SH_ARCH_MAGIC_WINCE	0x01a2  /* Windows CE - little endian */
+#define SH_PE_MAGIC		0x010b
 
 
 #define SHBADMAG(x) \
  (((x).f_magic!=SH_ARCH_MAGIC_BIG) && \
+  ((x).f_magic!=SH_ARCH_MAGIC_WINCE) && \
   ((x).f_magic!=SH_ARCH_MAGIC_LITTLE))
 
 #define	FILHDR	struct external_filehdr
@@ -48,6 +51,12 @@
 
 
 
+/* Define some NT default values.  */
+/*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
+#define NT_SECTION_ALIGNMENT 0x1000
+#define NT_FILE_ALIGNMENT    0x200
+#define NT_DEF_RESERVE       0x100000
+#define NT_DEF_COMMIT        0x1000
 
 /********************** SECTION HEADER **********************/
 
@@ -89,14 +98,26 @@
 		char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
 		char l_paddr[4];	/* (physical) address of line number	*/
 	} l_addr;
+#ifdef COFF_WITH_PE
+	char l_lnno[2];	/* line number		*/
+#else
 	char l_lnno[4];	/* line number		*/
+#endif
 };
 
 #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno));
 #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val,  (bfd_byte *) (ext->l_lnno));
 
 #define	LINENO	struct external_lineno
+#ifdef COFF_WITH_PE
+#define	LINESZ	6
+#undef GET_LINENO_LNNO
+#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#undef PUT_LINENO_LNNO
+#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
+#else
 #define	LINESZ	8
+#endif
 
 
 /********************** SYMBOLS **********************/
@@ -163,6 +184,9 @@
 		char x_scnlen[4];			/* section length */
 		char x_nreloc[2];	/* # relocation entries */
 		char x_nlinno[2];	/* # line numbers */
+		char x_checksum[4];	/* section COMDAT checksum */
+		char x_associated[2];	/* COMDAT associated section index */
+		char x_comdat[1];	/* COMDAT selection number */
 	} x_scn;
 
         struct {
@@ -187,6 +211,7 @@
    types on the h8 don't have room in the instruction for the entire
    offset - eg the strange jump and high page addressing modes */
 
+#ifndef COFF_WITH_PE
 struct external_reloc {
   char r_vaddr[4];
   char r_symndx[4];
@@ -194,14 +219,26 @@
   char r_type[2];
   char r_stuff[2];
 };
+#else
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+};
+#endif
 
 
 #define RELOC struct external_reloc
+#ifdef COFF_WITH_PE
+#define RELSZ 10
+#else
 #define RELSZ 16
+#endif
 
 /* SH relocation types.  Not all of these are actually used.  */
 
 #define R_SH_UNUSED	0		/* only used internally */
+#define R_SH_IMM32CE	2		/* 32 bit immediate for WinCE */
 #define R_SH_PCREL8 	3		/*  8 bit pcrel 	*/
 #define R_SH_PCREL16 	4		/* 16 bit pcrel 	*/
 #define R_SH_HIGH8  	5		/* high 8 bits of 24 bit address */
@@ -213,6 +250,7 @@
 #define R_SH_PCDISP     12  		/* 12 bit branch */
 #define R_SH_IMM32      14    		/* 32 bit immediate */
 #define R_SH_IMM8   	16		/* 8 bit immediate */
+#define R_SH_IMAGEBASE	16		/* Windows CE */
 #define R_SH_IMM8BY2    17		/* 8 bit immediate *2 */
 #define R_SH_IMM8BY4    18		/* 8 bit immediate *4 */
 #define R_SH_IMM4   	19		/* 4 bit immediate */
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 666ed69..6e6c04b 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -9,6 +9,10 @@
 #ifndef DIS_ASM_H
 #define DIS_ASM_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdio.h>
 #include "bfd.h"
 
@@ -74,7 +78,7 @@
      INFO is a pointer to this struct.
      Returns an errno value or 0 for success.  */
   int (*read_memory_func)
-    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, int length,
+    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
 	     struct disassemble_info *info));
 
   /* Function which should be called if we get an error that we can't
@@ -101,7 +105,7 @@
   /* These are for buffer_read_memory.  */
   bfd_byte *buffer;
   bfd_vma buffer_vma;
-  int buffer_length;
+  unsigned int buffer_length;
 
   /* This variable may be set by the instruction decoder.  It suggests
       the number of bytes objdump should display on a single line.  If
@@ -117,6 +121,11 @@
   int bytes_per_chunk;
   enum bfd_endian display_endian;
 
+  /* Number of octets per incremented target address 
+     Normally one, but some DSPs have byte sizes of 16 or 32 bits
+   */
+  unsigned int octets_per_byte;
+
   /* Results from instruction decoders.  Not all decoders yet support
      this information.  This info is set each time an instruction is
      decoded, and is only valid for the last such instruction.
@@ -133,6 +142,9 @@
 				   zero if unknown.  */
   bfd_vma target2;		/* Second target address for dref2 */
 
+  /* Command line options specific to the target disassembler.  */
+  char * disassembler_options;
+
 } disassemble_info;
 
 
@@ -145,6 +157,7 @@
 extern int print_insn_little_mips	PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_i386_att		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_i386_intel	PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i370		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*));
@@ -180,10 +193,21 @@
 extern int print_insn_tic30		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_vax		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_tic80		PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pj		PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_avr		PARAMS ((bfd_vma, disassemble_info*));
+
+extern void print_arm_disassembler_options PARAMS ((FILE *));
+extern void parse_arm_disassembler_option  PARAMS ((char *));
+extern int  get_arm_regname_num_options    PARAMS ((void));
+extern int  set_arm_regname_option         PARAMS ((int));
+extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
 
 /* Fetch the disassembler for a given BFD, if that support is available.  */
 extern disassembler_ftype disassembler	PARAMS ((bfd *));
 
+/* Document any target specific options available from the disassembler.  */
+extern void disassembler_usage          PARAMS ((FILE *));
+
 
 /* This block of definitions is for particular callers who read instructions
    into a buffer before calling the instruction decoder.  */
@@ -191,7 +215,7 @@
 /* Here is a function which callers may wish to use for read_memory_func.
    It gets bytes from a buffer.  */
 extern int buffer_read_memory
-  PARAMS ((bfd_vma, bfd_byte *, int, struct disassemble_info *));
+  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
 
 /* This function goes with buffer_read_memory.
    It prints a message using info->fprintf_func and info->stream.  */
@@ -215,6 +239,7 @@
   (INFO).arch = bfd_arch_unknown, \
   (INFO).mach = 0, \
   (INFO).endian = BFD_ENDIAN_UNKNOWN, \
+  (INFO).octets_per_byte = 1, \
   INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
 
 /* Call this macro to initialize only the internal variables for the
@@ -240,4 +265,8 @@
   (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \
   (INFO).insn_info_valid = 0
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* ! defined (DIS_ASM_H) */
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index deaccd4..e1f68c3 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,244 @@
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
+
+	* avr.h: New file.  AVR ELF support for BFD.
+	* common.h: Add AVR magic number.
+
+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.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* i370.h: New file.
+
+2000-02-22  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h (ELF_ST_OTHER): Remove definition.
+	(ELF32_ST_OTHER): Remove definition.
+	(ELF64_ST_OTHER): Remove definition.
+
+2000-02-22  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (ELFOSABI_LINUX): Define.
+
+Thu Feb 17 00:18:33 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* sh.h: (EF_SH_MACH_MASK, EF_SH_UNKNOWN, EF_SH1, EF_SH2): New macros.
+	(EF_SH3, EF_SH_HAS_DSP, EF_SH_DSP, EF_SH3_DSP): Likewise.
+	(EF_SH_HAS_FP, EF_SH3E, EF_SH4, EF_SH_MERGE_MACH): Likewise.
+
+2000-02-03  H.J. Lu  <hjl@gnu.org>
+
+	* arm-oabi.h: Duplicate changes made to arm.h on Jan. 27,
+	2000 by Thomas de Lellis  <tdel@windriver.com>.
+
+2000-01-27  Thomas de Lellis  <tdel@windriver.com>
+
+        * 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.
+
+2000-01-20  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h (EM_MCORE): Fix spelling of Motorola.
+	* mcore.h (EM_MCORE): Fix spelling of Motorola.
+
+2000-01-13  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h (EM_S370): Change comment - this is now the IBM
+	System/370.
+	(EM_IA_64): Change comment - this is now the IA-64.
+
+2000-01-11  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h (DT_ENCODING): Fix definition of this value.
+	(DT_LOOS): Fix definition of this value.
+	(DT_HIOS): Fix definition of this value.
+	(OLD_DT_LOOS): Value of DT_LOOS before Oct 4, 1999 draft
+	of ELF spec changed it.
+	(OLD_DT_HIOS): Value of DT_HIOS before Oct 4, 1999 draft
+	of ELF spec changed it.
+
+2000-01-10  Egor Duda  <deo@logos-m.ru>
+
+	* 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. 
+
+1999-12-27  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h: Upgrade to match Oct4, 1999 Draft ELF ABI Spec.
+	(EM_MIPS_RS3_LE): New machine number.
+	(EM_RCE): New machine number.
+	(EM_MMA): New machine number.
+	(EM_PCP): New machine number.
+	(EM_NCPU): New machine number.
+	(EM_NDR1): New machine number.
+	(EM_STARCORE): New machine number.
+	(EM_ME16): New machine number.
+	(EM_ST100): New machine number.
+	(EM_TINYJ): New machine number.
+	(EM_FX66): New machine number.
+	(EM_ST9PLUS): New machine number.
+	(EM_ST7): New machine number.
+	(EM_68HC16): New machine number.
+	(EM_68HC11): New machine number.
+	(EM_68HC08): New machine number.
+	(EM_68HC05): New machine number.
+	(EM_SVX): New machine number.
+	(EM_VAX): New machine number.
+	(PF_MASKOS): Change value.
+	(SHT_INIT_ARRAY): New value for sh_type field.
+	(SHT_FINI_ARRAY): New value for sh_type field.
+	(SHT_PREINIT_ARRAY): New value for sh_type field.
+	(SHT_HIUSER): Change value.
+	(SHF_MERGE): New valye for sh_flags field.
+	(SHF_STRINGS): New valye for sh_flags field.
+	(SHF_INFO_LINK): New valye for sh_flags field.
+	(SHF_OS_NONCONFORMING): New valye for sh_flags field.
+	(SHF_MASKOS): Change value.
+	(ELF_ST_VISIBILITY): New macro.
+	(ELF_ST_OTHER): New macro.
+	(STT_COMMON): New symbol type.
+	(STV_DEFAULT): Value for symbol visibility.
+	(STV_INTERNAL): Value for symbol visibility.
+	(STV_HIDDEN): Value for symbol visibility.
+	(STV_PROTECTED): Value for symbol visibility.
+	(DT_RUNPATH): New dynamic section tag.
+	(DT_FLAGS): New dynamic section tag.
+	(DT_ENCODING): New dynamic section tag.
+	(DT_PREINIT_ARRAY): New dynamic section tag.
+	(DT_PREINIT_ARRAYSZ): New dynamic section tag.
+	(DT_LOPROC): New dynamic section tag index.
+	(DT_HIPROC): New dynamic section tag index.
+	(DF_ORIGIN): Value for dynamic section flag.
+	(DF_SYMBOLIC): Value for dynamic section flag.
+	(DF_TEXTREL): Value for dynamic section flag.
+	(DF_BIND_NOW): Value for dynamic section flag.
+
+1999-12-09  Fred Fish  <fnf@cygnus.com>
+
+	* 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.
+
+Wed Dec  1 03:02:15 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* mn10300.h (E_MN10300_MACH_AM33): Define.
+
+Mon Oct 11 22:42:37 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (PF_HP_PAGE_SIZE): Define.
+	(PF_HP_FAR_SHARED, PF_HP_NEAR_SHARED, PF_HP_CODE): Likewise.
+	(PF_HP_MODIFY, PF_HP_LAZYSWAP, PF_HP_SBP): Likewise.
+
+Mon Oct  4 17:42:38 1999  Doug Evans  <devans@canuck.cygnus.com>
+
+	* m32r.h (E_M32RX_ARCH): Define.
+
+1999-09-15  Ulrich Drepper  <drepper@cygnus.com>
+
+	* hppa.h: Add DT_HP_GST_SIZE, DT_HP_GST_VERSION, and DT_HP_GST_HASHVAL.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* pj.h: New file.
+	* common.h (EM_PJ): Define.
+
+1999-09-02  Ulrich Drepper  <drepper@cygnus.com>
+
+	* hppa.h: Add HPUX specific symbol type definitions.
+
+	* hppa.h: Add HPUX specific dynamic and program header table
+	specific definitions.
+
+1999-08-31  Scott Bambrough <scottb@netwinder.org>
+
+	* common.h (NT_TASKSTRUCT): Define.
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc.h (EF_SPARC_SUN_US3): Define in Cheetah extensions
+	flag (as per SCD2.4.1).
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc.h (ELF64_R_TYPE_DATA): Only use ELF64_R_TYPE bits, not
+	ELF64_R_SYM bits.
+
+1999-06-21  Philip Blundell  <pb@nexus.co.uk>
+
+	* arm.h (EF_SOFT_FLOAT, F_SOFT_FLOAT): Define.
+
+1999-07-13  Andreas Schwab  <schwab@suse.de>
+
+	* m68k.h (EF_CPU32): Move definition inside multiple inclusion
+	guard.
+
+1999-07-08  Richard Henderson  <rth@cygnus.com>
+
+	* sparc.h (ELF64_R_TYPE_DATA): Sign extend the value.
+	(ELF64_R_TYPE_INFO): Mask out all but low 24 bits of data.
+	(DT_SPARC_PLTFMT): Delete.
+	Based on a patch from Jakub Jelinek.
+
+Mon Jun 21 16:36:02 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (elf_hppa_reloc_type): Renamed from elf32_hppa_reloc_type.
+
+1999-06-10  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc.h (R_SPARC_max_std): Define.
+
+Wed Jun  9 15:16:34 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h: Update with various changes from newest PA ELF
+	specifications.
+
+1999-06-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* common.h (EM_PPC64): Define.
+
+1999-06-02  Stu Grossman  <grossman@babylon-5.cygnus.com>
+
+	* dwarf.h: Add LANG_JAVA.
+	* dwarf2.h: Add DW_LANG_Java.
+
+1999-05-29  Nick Clifton  <nickc@cygnus.com>
+
+	* common.h (ELFOSABI_ARM): Define.
+
+1999-05-28  Nick Clifton  <nickc@cygnus.com>
+
+	* reloc-macros.h: Update comment.
+
+1999-05-28  Ian Lance Taylor  <ian@zembu.com>
+
+	* i960.h: New file.
+
+1999-05-16  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore.h (R_MCORE_COPY): Define.
+	(R_MCORE_GLOB_DAT): Define.
+	(R_MCORE_JUMP_SLOT): Define.
+
+1999-05-15  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore.h (R_MCORE_RELATIVE): Define.
+
+999-05-05  Catherine Moore  <clm@cygnus.com>
+
+        * m68k.h (EF_CPU32): Define.
+
 1999-04-21  Nick Clifton  <nickc@cygnus.com>
 
 	* reloc-macros.h (START_RELOC_NUMBERS): Prepend an underscore to
@@ -10,22 +251,22 @@
 
 1999-04-08  Nick Clifton  <nickc@cygnus.com>
 
-	* mcore.h: New header file.  Defines for Motorolla's MCore
-	processor. 
+	* mcore.h: New header file.  Defines for Motorola's MCore
+	processor.
 
 1999-04-08  Nick Clifton  <nickc@cygnus.com>
 
 	* common.h: Add new constants defined in: "System V Application
-	Binary Interface - DRAFT - April 29, 1998" found at the web site: 
+	Binary Interface - DRAFT - April 29, 1998" found at the web site:
 	http://www.sco.com/developer/gabi/contents.html
 
 	(EM_MMA): Removed.  Replaced with EM_MCORE as Motorolla own this
-	value. 
+	value.
 
 1999-03-31  Nick Clifton  <nickc@cygnus.com>
 
 	* reloc-macros.h: Fixed to not generate an enum with a trailing
-	comma. 
+	comma.
 
 1999-03-16  Gavin Romig-Koch  <gavin@cygnus.com>
 
diff --git a/include/elf/arm-oabi.h b/include/elf/arm-oabi.h
index 6109842..da5e731 100644
--- a/include/elf/arm-oabi.h
+++ b/include/elf/arm-oabi.h
@@ -1,5 +1,5 @@
 /* ARM ELF support for BFD.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -29,7 +29,7 @@
 #define EF_APCS_26         0x08
 #define EF_APCS_FLOAT      0x10
 #define EF_PIC             0x20
-#define EF_ALIGN8	   0x40		/* 8-bit structure alignment is in use */
+#define EF_ALIGN8	   0x40		/* 8-bit structure alignment is in use.  */
 #define EF_NEW_ABI         0x80
 #define EF_OLD_ABI         0x100
 
@@ -39,15 +39,16 @@
 #define F_APCS_FLOAT	   EF_APCS_FLOAT
 #define F_PIC              EF_PIC
 
-/* Additional symbol types for Thumb */
-#define STT_ARM_TFUNC     0xd
+/* Additional symbol types for Thumb.  */
+#define STT_ARM_TFUNC      STT_LOPROC   /* A Thumb function.  */
+#define STT_ARM_16BIT      STT_HIPROC   /* A Thumb label.  */
 
-/* ARM-specific values for sh_flags */
-#define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point */
-#define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step */
+/* ARM-specific values for sh_flags.  */
+#define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point.  */
+#define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step.  */
 
-/* ARM-specific program header flags */
-#define PF_ARM_SB          0x10000000   /* Segment contains the location addressed by the static base */
+/* ARM-specific program header flags.  */
+#define PF_ARM_SB          0x10000000   /* Segment contains the location addressed by the static base.  */
 
 /* Relocation types.  */
 START_RELOC_NUMBERS (elf_arm_reloc_type)
@@ -62,18 +63,18 @@
   RELOC_NUMBER (R_ARM_THM_PC22,     8)
   RELOC_NUMBER (R_ARM_SBREL32,      9)
   RELOC_NUMBER (R_ARM_AMP_VCALL9,  10)
-  RELOC_NUMBER (R_ARM_THM_PC11,    11)       /* cygnus extension to abi: thumb unconditional branch */
-  RELOC_NUMBER (R_ARM_THM_PC9,     12)       /* cygnus extension to abi: thumb conditional branch */
+  RELOC_NUMBER (R_ARM_THM_PC11,    11)       /* Cygnus extension to abi: Thumb unconditional branch.  */
+  RELOC_NUMBER (R_ARM_THM_PC9,     12)       /* Cygnus extension to abi: Thumb conditional branch.  */
   RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 13)
   RELOC_NUMBER (R_ARM_GNU_VTENTRY, 14)
-  RELOC_NUMBER (R_ARM_COPY,        20)       /* copy symbol at runtime */
-  RELOC_NUMBER (R_ARM_GLOB_DAT,    21)       /* create GOT entry */
-  RELOC_NUMBER (R_ARM_JUMP_SLOT,   22)       /* create PLT entry */
-  RELOC_NUMBER (R_ARM_RELATIVE,    23)       /* adjust by program base */
-  RELOC_NUMBER (R_ARM_GOTOFF,      24)       /* 32 bit offset to GOT */
-  RELOC_NUMBER (R_ARM_GOTPC,       25)       /* 32 bit PC relative offset to GOT */
-  RELOC_NUMBER (R_ARM_GOT32,       26)       /* 32 bit GOT entry */
-  RELOC_NUMBER (R_ARM_PLT32,       27)       /* 32 bit PLT address */
+  RELOC_NUMBER (R_ARM_COPY,        20)       /* Copy symbol at runtime.  */
+  RELOC_NUMBER (R_ARM_GLOB_DAT,    21)       /* Create GOT entry.  */
+  RELOC_NUMBER (R_ARM_JUMP_SLOT,   22)       /* Create PLT entry.  */
+  RELOC_NUMBER (R_ARM_RELATIVE,    23)       /* Adjust by program base.  */
+  RELOC_NUMBER (R_ARM_GOTOFF,      24)       /* 32 bit offset to GOT.  */
+  RELOC_NUMBER (R_ARM_GOTPC,       25)       /* 32 bit PC relative offset to GOT.  */
+  RELOC_NUMBER (R_ARM_GOT32,       26)       /* 32 bit GOT entry.  */
+  RELOC_NUMBER (R_ARM_PLT32,       27)       /* 32 bit PLT address.  */
   FAKE_RELOC   (FIRST_INVALID_RELOC, 28)
   FAKE_RELOC   (LAST_INVALID_RELOC,  249)
   RELOC_NUMBER (R_ARM_RSBREL32,   250)
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 2c94b13..4d3405d 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -1,5 +1,5 @@
 /* ARM ELF support for BFD.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -29,25 +29,28 @@
 #define EF_APCS_26         0x08
 #define EF_APCS_FLOAT      0x10
 #define EF_PIC             0x20
-#define EF_ALIGN8	   0x40		/* 8-bit structure alignment is in use */
+#define EF_ALIGN8	   0x40		/* 8-bit structure alignment is in use.  */
 #define EF_NEW_ABI         0x80
 #define EF_OLD_ABI         0x100
+#define EF_SOFT_FLOAT      0x200
 
 /* Local aliases for some flags to match names used by COFF port.  */
 #define F_INTERWORK	   EF_INTERWORK
 #define F_APCS26	   EF_APCS_26
 #define F_APCS_FLOAT	   EF_APCS_FLOAT
 #define F_PIC              EF_PIC
+#define F_SOFT_FLOAT	   EF_SOFT_FLOAT
 
-/* Additional symbol types for Thumb */
-#define STT_ARM_TFUNC     0xd
+/* Additional symbol types for Thumb.  */
+#define STT_ARM_TFUNC      STT_LOPROC   /* A Thumb function.  */
+#define STT_ARM_16BIT      STT_HIPROC   /* A Thumb label.  */
 
-/* ARM-specific values for sh_flags */
-#define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point */
-#define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step */
+/* ARM-specific values for sh_flags.  */
+#define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point.  */
+#define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step.  */
 
-/* ARM-specific program header flags */
-#define PF_ARM_SB          0x10000000   /* Segment contains the location addressed by the static base */
+/* ARM-specific program header flags.  */
+#define PF_ARM_SB          0x10000000   /* Segment contains the location addressed by the static base.  */
 
 /* Relocation types.  */
 START_RELOC_NUMBERS (elf_arm_reloc_type)
@@ -80,8 +83,8 @@
   FAKE_RELOC   (LAST_INVALID_RELOC1,  99)
   RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100)
   RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101)
-  RELOC_NUMBER (R_ARM_THM_PC11,    102)       /* cygnus extension to abi: thumb unconditional branch */
-  RELOC_NUMBER (R_ARM_THM_PC9,     103)       /* cygnus extension to abi: thumb conditional branch */
+  RELOC_NUMBER (R_ARM_THM_PC11,    102)       /* Cygnus extension to abi: Thumb unconditional branch */
+  RELOC_NUMBER (R_ARM_THM_PC9,     103)       /* Cygnus extension to abi: Thumb conditional branch */
   FAKE_RELOC   (FIRST_INVALID_RELOC2, 104)
   FAKE_RELOC   (LAST_INVALID_RELOC2,  248)
   RELOC_NUMBER (R_ARM_RXPC25,     249)
diff --git a/include/elf/avr.h b/include/elf/avr.h
new file mode 100644
index 0000000..1527455
--- /dev/null
+++ b/include/elf/avr.h
@@ -0,0 +1,58 @@
+/* AVR ELF support for BFD.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Denis Chertykov <denisc@overta.ru>
+
+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_AVR_H
+#define _ELF_AVR_H
+
+#include "elf/reloc-macros.h"
+
+/* Processor specific flags for the ELF header e_flags field.  */
+#define EF_AVR_MACH 0xf
+
+#define E_AVR_MACH_AVR1 1
+#define E_AVR_MACH_AVR2 2
+#define E_AVR_MACH_AVR3 3
+#define E_AVR_MACH_AVR4 4
+
+/* Relocations.  */
+START_RELOC_NUMBERS (elf_avr_reloc_type)
+     RELOC_NUMBER (R_AVR_NONE,			0)
+     RELOC_NUMBER (R_AVR_32,			1)
+     RELOC_NUMBER (R_AVR_7_PCREL,		2)
+     RELOC_NUMBER (R_AVR_13_PCREL,		3)
+     RELOC_NUMBER (R_AVR_16, 			4)
+     RELOC_NUMBER (R_AVR_16_PM, 		5)
+     RELOC_NUMBER (R_AVR_LO8_LDI,		6)
+     RELOC_NUMBER (R_AVR_HI8_LDI,		7)
+     RELOC_NUMBER (R_AVR_HH8_LDI,		8)
+     RELOC_NUMBER (R_AVR_LO8_LDI_NEG,		9)
+     RELOC_NUMBER (R_AVR_HI8_LDI_NEG,	       10)
+     RELOC_NUMBER (R_AVR_HH8_LDI_NEG,	       11)
+     RELOC_NUMBER (R_AVR_LO8_LDI_PM,	       12)
+     RELOC_NUMBER (R_AVR_HI8_LDI_PM,	       13)
+     RELOC_NUMBER (R_AVR_HH8_LDI_PM,	       14)
+     RELOC_NUMBER (R_AVR_LO8_LDI_PM_NEG,       15)
+     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
+
+#endif /* _ELF_AVR_H */
diff --git a/include/elf/common.h b/include/elf/common.h
index cda3ba0..fe8c216 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -1,5 +1,6 @@
 /* ELF support for BFD.
-   Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 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
@@ -59,7 +60,9 @@
 #define EI_OSABI        7       /* Operating System/ABI indication */
 #define ELFOSABI_SYSV   0       /* UNIX System V ABI */
 #define ELFOSABI_HPUX   1       /* HP-UX operating system */
+#define ELFOSABI_LINUX  3       /* GNU/Linux */
 #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+#define ELFOSABI_ARM   97		/* ARM */
 
 #define EI_ABIVERSION   8       /* ABI version */
 
@@ -89,19 +92,23 @@
 #define EM_486		6	/* Intel 80486 */
 #define EM_860		7	/* Intel 80860 */
 #define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */
-#define EM_S370		9	/* Amdahl */
-#define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */
+#define EM_S370		9	/* IBM System/370 */
+#define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */ /* Depreciated */
+#define EM_MIPS_RS3_LE 10	/* MIPS R3000 little-endian (Oct 4 1999 Draft)*/ /* Depreciated */
 
 #define EM_PARISC      15	/* HPPA */
+
 #define EM_VPP550      17       /* Fujitsu VPP500 */
 #define EM_SPARC32PLUS 18	/* Sun's "v8plus" */
 #define EM_960         19       /* Intel 80960 */
 #define EM_PPC	       20	/* PowerPC */
+#define EM_PPC64       21	/* 64-bit PowerPC */
 
 #define EM_V800        36	/* NEC V800 series */
 #define EM_FR20	       37	/* Fujitsu FR20 */
 #define EM_RH32	       38       /* TRW RH32 */
-#define EM_MCORE       39       /* Motorolla MCore */ /* May also be taken by Fujitsu MMA */
+#define EM_MCORE       39       /* Motorola M*Core */ /* May also be taken by Fujitsu MMA */
+#define EM_RCE         39       /* Old name for MCore */
 #define EM_ARM	       40	/* ARM */
 #define EM_OLD_ALPHA   41	/* Digital Alpha */
 #define EM_SH	       42	/* Hitachi SH */
@@ -112,10 +119,31 @@
 #define EM_H8_300H     47       /* Hitachi H8/300H */
 #define EM_H8S         48       /* Hitachi H8S */
 #define EM_H8_500      49       /* Hitachi H8/500 */
-#define EM_IA_64       50       /* Intel MercedTM Processor */
+#define EM_IA_64       50       /* Intel IA-64 Processor */
 #define EM_MIPS_X      51       /* Stanford MIPS-X */
 #define EM_COLDFIRE    52       /* Motorola Coldfire */
 #define EM_68HC12      53       /* Motorola M68HC12 */
+#define EM_MMA	       54	/* Fujitsu Multimedia Accelerator */
+#define EM_PCP	       55	/* Siemens PCP */
+#define EM_NCPU	       56	/* Sony nCPU embedded RISC processor */
+#define EM_NDR1	       57	/* Denso NDR1 microprocesspr */
+#define EM_STARCORE    58	/* Motorola Star*Core processor */
+#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_FX66	       66	/* Siemens FX66 microcontroller */
+#define EM_ST9PLUS     67	/* STMicroelectronics ST9+ 8/16 bit microcontroller */
+#define EM_ST7	       68	/* STMicroelectronics ST7 8-bit microcontroller */
+#define EM_68HC16      69	/* Motorola MC68HC16 Microcontroller */
+#define EM_68HC11      70	/* Motorola MC68HC11 Microcontroller */
+#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_VAX         75	/* Digital VAX */
+
+#define EM_PJ          99       /* picoJava */
 
 /* If it is necessary to assign new unofficial EM_* values, please pick large
    random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
@@ -161,6 +189,10 @@
 /* FR30 magic number - no EABI available.  */
 #define EM_CYGNUS_FR30		0x3330
 
+/* AVR magic number
+   Written in the absense of an ABI.  */
+#define EM_AVR			0x1057
+
 /* See the above comment before you add a new EM_* value here.  */
 
 /* Values for e_version */
@@ -187,7 +219,8 @@
 #define PF_X		(1 << 0)	/* Segment is executable */
 #define PF_W		(1 << 1)	/* Segment is writable */
 #define PF_R		(1 << 2)	/* Segment is readable */
-#define PF_MASKOS	0x0F000000	/* OS-specific reserved bits */
+/* #define PF_MASKOS	0x0F000000    *//* OS-specific reserved bits */
+#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 */
@@ -205,6 +238,10 @@
 #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_LOOS        0x60000000      /* Operating system specific semantics, lo */
 #define SHT_HIOS        0x6fffffff      /* Operating system specific semantics, hi */
 
@@ -222,14 +259,22 @@
 #define SHT_LOPROC	0x70000000	/* Processor-specific semantics, lo */
 #define SHT_HIPROC	0x7FFFFFFF	/* Processor-specific semantics, hi */
 #define SHT_LOUSER	0x80000000	/* Application-specific semantics */
-#define SHT_HIUSER	0x8FFFFFFF	/* Application-specific semantics */
+/* #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 */
 
 #define SHF_WRITE	(1 << 0)	/* Writable data during execution */
 #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
 #define SHF_EXECINSTR	(1 << 2)	/* Executable machine instructions */
-#define SHF_MASKOS	0x0F000000	/* OS-specific semantics */
+#define SHF_MERGE	(1 << 4)	/* Data in this section can be merged */
+#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_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. */
@@ -237,6 +282,9 @@
 #define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
 #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
 #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
+#define NT_TASKSTRUCT	4		/* Contains copy of task struct */
+#define NT_PRXFPREG     0x46e62b7f	/* Contains a user_xfpregs_struct; */
+					/*   note name must be "LINUX".  */
 
 /* Note segments for core files on dir-style procfs systems. */
 
@@ -245,6 +293,7 @@
 #define NT_PSINFO	13		/* Has a struct psinfo */
 #define NT_LWPSTATUS	16		/* Has a struct lwpstatus_t */
 #define NT_LWPSINFO	17		/* Has a struct lwpsinfo_t */
+#define NT_WIN32PSTATUS	18		/* Has a struct win32_pstatus */
 
 /* Values of note segment descriptor types for object files.  */
 /* (Only for hppa right now.  Should this be moved elsewhere?)  */
@@ -259,6 +308,26 @@
 #define ELF_ST_TYPE(val)		((val) & 0xF)
 #define ELF_ST_INFO(bind,type)		(((bind) << 4) + ((type) & 0xF))
 
+/* The 64bit and 32bit versions of these macros are identical, but
+   the ELF spec defines them, so here they are.  */
+#define ELF32_ST_BIND  ELF_ST_BIND
+#define ELF32_ST_TYPE  ELF_ST_TYPE
+#define ELF32_ST_INFO  ELF_ST_INFO
+#define ELF64_ST_BIND  ELF_ST_BIND
+#define ELF64_ST_TYPE  ELF_ST_TYPE
+#define ELF64_ST_INFO  ELF_ST_INFO
+
+/* This macro disassembles and assembles a symbol's visibility into
+   the st_other field.  The STV_ defines specificy the actual visibility.  */
+
+#define ELF_ST_VISIBILITY(v)		((v) & 0x3)
+/* The remaining bits in the st_other field are not currently used.
+   They should be set to zero.  */
+
+#define ELF32_ST_VISIBILITY  ELF_ST_VISIBILITY
+#define ELF64_ST_VISIBILITY  ELF_ST_VISIBILITY
+
+
 #define STN_UNDEF	0		/* undefined symbol index */
 
 #define STB_LOCAL	0		/* Symbol not visible outside obj */
@@ -274,6 +343,7 @@
 #define STT_FUNC	2		/* Symbol is a code object */
 #define STT_SECTION	3		/* Symbol associated with a section */
 #define STT_FILE	4		/* Symbol gives a file name */
+#define STT_COMMON	5		/* An uninitialised common block */
 #define STT_LOOS        10		/* OS-specific semantics */
 #define STT_HIOS        12		/* OS-specific semantics */
 #define STT_LOPROC	13		/* Application-specific semantics */
@@ -292,6 +362,15 @@
 #define SHN_COMMON	0xFFF2		/* Associated symbol is in common */
 #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.  */
+					   
+#define STV_DEFAULT	0		/* Visibility is specified by binding type */
+#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 */
 
 #define ELF32_R_SYM(i)		((i) >> 8)
@@ -333,12 +412,28 @@
 #define DT_FINI_ARRAY   26
 #define DT_INIT_ARRAYSZ 27
 #define DT_FINI_ARRAYSZ 28
+#define DT_RUNPATH      29
+#define DT_FLAGS        30
 
-#define DT_LOOS         0x60000000
-#define DT_HIOS         0x6fffffff
+#define DT_ENCODING     32
+#define DT_PREINIT_ARRAY   32
+#define DT_PREINIT_ARRAYSZ 33
+
+/* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
+   for DT_LOOS and DT_HIOS.  Some implementations however, use
+   values outside of the new range (see below).  */
+#define OLD_DT_LOOS	0x60000000
+#define DT_LOOS         0x6000000d
+#define DT_HIOS         0x6fff0000
+#define OLD_DT_HIOS     0x6fffffff
+
+#define DT_LOPROC       0x70000000
+#define DT_HIPROC       0x7fffffff
 
 /* The next four dynamic tags are used on Solaris.  We support them
-   everywhere.  */
+   everywhere.  Note these values lie outside of the (new) range for
+   OS specific values.  This is a deliberate special case and we
+   maintain it for backwards compatability.  */
 #define DT_VALRNGLO	0x6ffffd00
 #define DT_PLTPADSZ	0x6ffffdf9
 #define DT_MOVEENT	0x6ffffdfa
@@ -394,6 +489,12 @@
 #define DF_1_TRANS	0x00000200
 #define DF_1_INTERPOSE	0x00000400
 
+/* Flag values for the DT_FLAGS entry.  */
+#define DF_ORIGIN	(1 << 0)
+#define DF_SYMBOLIC	(1 << 1)
+#define DF_TEXTREL	(1 << 2)
+#define DF_BIND_NOW	(1 << 3)
+
 /* These constants are used for the version number of a Elf32_Verdef
    structure.  */
 
diff --git a/include/elf/dwarf.h b/include/elf/dwarf.h
index 4333d5e..1e72cd7 100644
--- a/include/elf/dwarf.h
+++ b/include/elf/dwarf.h
@@ -3,7 +3,7 @@
 
    Written by Ron Guilmette (rfg@ncd.com)
 
-Copyright (C) 1992 Free Software Foundation, Inc.
+Copyright (C) 1992, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -301,7 +301,8 @@
 
     /* GNU extensions */
 
-    LANG_CHILL		= 0x00009af3	/* random value for GNU Chill */
+    LANG_CHILL		= 0x00009af3,	/* random value for GNU Chill */
+    LANG_JAVA		= 0x00009af4    /* random value + 1 for GNU Java */
 };
 
 #define LANG_lo_user	0x00008000  /* implementation-defined range start */
diff --git a/include/elf/dwarf2.h b/include/elf/dwarf2.h
index b2cbb24..1bd4fa6 100644
--- a/include/elf/dwarf2.h
+++ b/include/elf/dwarf2.h
@@ -616,6 +616,7 @@
     DW_LANG_Fortran90 = 0x0008,
     DW_LANG_Pascal83 = 0x0009,
     DW_LANG_Modula2 = 0x000a,
+    DW_LANG_Java = 0x9af4,
     DW_LANG_Mips_Assembler = 0x8001
   };
 
diff --git a/include/elf/hppa.h b/include/elf/hppa.h
index 2952e23..0e45d74 100644
--- a/include/elf/hppa.h
+++ b/include/elf/hppa.h
@@ -1,5 +1,5 @@
 /* HPPA ELF support for BFD.
-   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -25,87 +25,92 @@
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
-/* Target processor IDs to be placed in the low 16 bits of the flags
-   field.  Note these names are shared with SOM, and therefore do not
-   follow ELF naming conventions.  */
-
-/* PA 1.0 big endian.  */
-#ifndef CPU_PA_RISC1_0
-#define CPU_PA_RISC1_0		0x0000020b
-#endif
-
-/* PA 1.1 big endian.  */
-#ifndef CPU_PA_RISC1_1
-#define CPU_PA_RISC1_1		0x00000210
-#endif
-
-/* PA 1.0 little endian (unsupported) is 0x0000028b.  */
-/* PA 1.1 little endian (unsupported) is 0x00000290.  */
-
 /* Trap null address dereferences.  */
-#define ELF_PARISC_TRAPNIL	0x00010000
+#define EF_PARISC_TRAPNIL	0x00010000
 
 /* .PARISC.archext section is present.  */
 #define EF_PARISC_EXT		0x00020000
 
+/* Program expects little-endian mode.  */
+#define EF_PARISC_LSB		0x00040000
+
+/* Program expects wide mode.  */
+#define EF_PARISC_WIDE		0x00080000
+
+/* Do not allow kernel-assisted branch prediction.  */
+#define EF_PARISC_NO_KABP	0x00100000
+
+/* Allow lazy swap for dynamically allocated program segments.  */
+#define EF_PARISC_LAZYSWAP	0x00400000
+
+/* Architecture version */
+#define EF_PARISC_ARCH		0x0000ffff
+
+#define EFA_PARISC_1_0			0x020b
+#define EFA_PARISC_1_1			0x0210
+#define EFA_PARISC_2_0			0x0214
+
+/* Special section indices.  */
+/* A symbol that has been declared as a tentative definition in an ANSI C
+   compilation.  */
+#define SHN_PARISC_ANSI_COMMON 	0xff00
+
+/* A symbol that has been declared as a common block using the
+   huge memory model.  */
+#define SHN_PARISC_HUGE_COMMON	0xff01
+
 /* Processor specific section types.  */
 
-/* Holds the global offset table, a table of pointers to external
-   data.  */
-#define SHT_PARISC_GOT		SHT_LOPROC+0
+/* Section contains product specific extension bits.  */
+#define SHT_PARISC_EXT		0x70000000
 
-/* Nonloadable section containing information in architecture
-   extensions used by the code.  */
-#define SHT_PARISC_ARCH		SHT_LOPROC+1
+/* Section contains unwind table entries.  */
+#define SHT_PARISC_UNWIND	0x70000001
 
-/* Section in which $global$ is defined.  */
-#define SHT_PARISC_GLOBAL	SHT_LOPROC+2
+/* Section contains debug information for optimized code.  */
+#define SHT_PARISC_DOC		0x70000002
 
-/* Section holding millicode routines (mul, div, rem, dyncall, etc.  */
-#define SHT_PARISC_MILLI	SHT_LOPROC+3
+/* Section contains code annotations.  */
+#define SHT_PARISC_ANNOT	0x70000003
 
-/* Section holding unwind information for use by debuggers.  */
-#define SHT_PARISC_UNWIND	SHT_LOPROC+4
-
-/* Section holding the procedure linkage table.  */
-#define SHT_PARISC_PLT		SHT_LOPROC+5
-
-/* Short initialized and uninitialized data.  */
-#define SHT_PARISC_SDATA	SHT_LOPROC+6
-#define SHT_PARISC_SBSS		SHT_LOPROC+7
-
+/* These are strictly for compatibility with the older elf32-hppa
+   implementation.  Hopefully we can eliminate them in the future.  */
 /* Optional section holding argument location/relocation info.  */
-#define SHT_PARISC_SYMEXTN	SHT_LOPROC+8
+#define SHT_PARISC_SYMEXTN    SHT_LOPROC+8
 
 /* Option section for linker stubs.  */
-#define SHT_PARISC_STUBS	SHT_LOPROC+9
+#define SHT_PARISC_STUBS      SHT_LOPROC+9
 
 /* Processor specific section flags.  */
 
-/* This section is near the global data pointer and thus allows short
-   addressing modes to be used.  */
-#define SHF_PARISC_SHORT        0x20000000
+/* Section contains code compiled for static branch prediction.  */
+#define SHF_PARISC_SBP		0x80000000
 
-/* Processor specific symbol types.  */
+/* Section should be allocated from from GP.  */
+#define SHF_PARISC_HUGE		0x40000000
 
-/* Millicode function entry point.  */
-#define STT_PARISC_MILLICODE	STT_LOPROC+0
+/* Section should go near GP.  */
+#define SHF_PARISC_SHORT	0x20000000
 
 
+/* Identifies the entry point of a millicode routine.  */
+#define STT_PARISC_MILLI	13
+
 /* ELF/HPPA relocation types */
 
-#include "reloc-macros.h"
+/* Note: PA-ELF is defined to use only RELA relocations.  */
+#include "elf/reloc-macros.h"
 
-START_RELOC_NUMBERS (elf32_hppa_reloc_type)
+START_RELOC_NUMBERS (elf_hppa_reloc_type)
      RELOC_NUMBER (R_PARISC_NONE,      0)	/* No reloc */
-     
+
      /* These relocation types do simple base + offset relocations.  */
 
-     RELOC_NUMBER (R_PARISC_DIR32,  0x01)
-     RELOC_NUMBER (R_PARISC_DIR21L, 0x02)
-     RELOC_NUMBER (R_PARISC_DIR17R, 0x03)
-     RELOC_NUMBER (R_PARISC_DIR17F, 0x04)
-     RELOC_NUMBER (R_PARISC_DIR14R, 0x06)
+     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)
 
     /* PC-relative relocation types
        Typically used for calls.
@@ -113,25 +118,28 @@
        PCREL17C never reports a relocation error.
 
        When supporting argument relocations, function calls must be
-       accompanied by parameter relocation information.  This information is 
+       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.
 
-       Note the code to build argument relocations depends on the 
+       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_PCREL21L, 0x0a)
-     RELOC_NUMBER (R_PARISC_PCREL17R, 0x0b)
-     RELOC_NUMBER (R_PARISC_PCREL17F, 0x0c)
-     RELOC_NUMBER (R_PARISC_PCREL17C, 0x0d)
-     RELOC_NUMBER (R_PARISC_PCREL14R, 0x0e)
-     RELOC_NUMBER (R_PARISC_PCREL14F, 0x0f)
+
+    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)
 
     /* DP-relative relocation types.  */
-     RELOC_NUMBER (R_PARISC_DPREL21L, 0x12)
-     RELOC_NUMBER (R_PARISC_DPREL14R, 0x16)
-     RELOC_NUMBER (R_PARISC_DPREL14F, 0x17)
+    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)
 
     /* Data linkage table (DLT) relocation types
 
@@ -139,49 +147,190 @@
        from position-independent code within shared libraries.  They are
        similar to the GOT relocation types in some SVR4 implementations.  */
 
-     RELOC_NUMBER (R_PARISC_DLTREL21L, 0x1a)
-     RELOC_NUMBER (R_PARISC_DLTREL14R, 0x1e)
-     RELOC_NUMBER (R_PARISC_DLTREL14F, 0x1f)
+    RELOC_NUMBER (R_PARISC_DLTREL21L, 26)
+    RELOC_NUMBER (R_PARISC_DLTREL14R, 30)
+    RELOC_NUMBER (R_PARISC_DLTREL14F, 31)
 
     /* DLT indirect relocation types  */
-     RELOC_NUMBER (R_PARISC_DLTIND21L, 0x22)
-     RELOC_NUMBER (R_PARISC_DLTIND14R, 0x26)
-     RELOC_NUMBER (R_PARISC_DLTIND14F, 0x27)
+    RELOC_NUMBER (R_PARISC_DLTIND21L, 34)
+    RELOC_NUMBER (R_PARISC_DLTIND14R, 38)
+    RELOC_NUMBER (R_PARISC_DLTIND14F, 39)
 
     /* Base relative relocation types.  Ugh.  These imply lots of state */
-     RELOC_NUMBER (R_PARISC_SETBASE,    0x28)
-     RELOC_NUMBER (R_PARISC_BASEREL32,  0x29)
-     RELOC_NUMBER (R_PARISC_BASEREL21L, 0x2a)
-     RELOC_NUMBER (R_PARISC_BASEREL17R, 0x2b)
-     RELOC_NUMBER (R_PARISC_BASEREL17F, 0x2c)
-     RELOC_NUMBER (R_PARISC_BASEREL14R, 0x2e)
-     RELOC_NUMBER (R_PARISC_BASEREL14F, 0x2f)
+    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)
 
     /* Segment relative relocation types.  */
-     RELOC_NUMBER (R_PARISC_TEXTREL32, 0x31)
-     RELOC_NUMBER (R_PARISC_DATAREL32, 0x39)
+    RELOC_NUMBER (R_PARISC_SEGBASE, 48)
+    RELOC_NUMBER (R_PARISC_SEGREL32, 49)
+
+    /* 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_LTOFF_FPTR32, 57)
+    RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 58)
+    RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 62)
+
+    RELOC_NUMBER (R_PARISC_FPTR64, 64)
 
     /* Plabel relocation types.  */
-     RELOC_NUMBER (R_PARISC_PLABEL32,  0x41)
-     RELOC_NUMBER (R_PARISC_PLABEL21L, 0x42)
-     RELOC_NUMBER (R_PARISC_PLABEL14R, 0x46)
+    RELOC_NUMBER (R_PARISC_PLABEL32, 65)
+    RELOC_NUMBER (R_PARISC_PLABEL21L, 66)
+    RELOC_NUMBER (R_PARISC_PLABEL14R, 70)
 
-    /* PLT relocations.  */
-     RELOC_NUMBER (R_PARISC_PLTIND21L, 0x82)
-     RELOC_NUMBER (R_PARISC_PLTIND14R, 0x86)
-     RELOC_NUMBER (R_PARISC_PLTIND14F, 0x87)
+    /* 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)
 
-    /* Misc relocation types.  */
-     RELOC_NUMBER (R_PARISC_COPY,     0x88)
-     RELOC_NUMBER (R_PARISC_GLOB_DAT, 0x89)
-     RELOC_NUMBER (R_PARISC_JMP_SLOT, 0x8a)
-     RELOC_NUMBER (R_PARISC_RELATIVE, 0x8b)
-     
-     EMPTY_RELOC (R_PARISC_UNIMPLEMENTED)
+
+    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)
+
+    RELOC_NUMBER (R_PARISC_GPREL64, 88)
+
+    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_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)
+
+    RELOC_NUMBER (R_PARISC_SECREL64, 104)
+
+    RELOC_NUMBER (R_PARISC_BASEREL14WR, 107)
+    RELOC_NUMBER (R_PARISC_BASEREL14DR, 108)
+
+    RELOC_NUMBER (R_PARISC_SEGREL64, 112)
+
+    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_COPY, 128)
+    RELOC_NUMBER (R_PARISC_IPLT, 129)
+    RELOC_NUMBER (R_PARISC_EPLT, 130)
+
+    RELOC_NUMBER (R_PARISC_TPREL32, 153)
+    RELOC_NUMBER (R_PARISC_TPREL21L, 154)
+    RELOC_NUMBER (R_PARISC_TPREL14R, 158)
+
+    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_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
 
 #ifndef RELOC_MACROS_GEN_FUNC
-typedef enum elf32_hppa_reloc_type elf32_hppa_reloc_type;
+typedef enum elf_hppa_reloc_type elf_hppa_reloc_type;
 #endif
 
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+#define PF_PARISC_SBP		0x08000000
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+/* 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)
+
+/* Values for DT_HP_DLD_FLAGS.  */
+#define DT_HP_DEBUG_PRIVATE		0x0001 /* Map text private */
+#define DT_HP_DEBUG_CALLBACK		0x0002 /* Callback */
+#define DT_HP_DEBUG_CALLBACK_BOR	0x0004 /* BOR callback */
+#define DT_HP_NO_ENVVAR			0x0008 /* No env var */
+#define DT_HP_BIND_NOW			0x0010 /* Bind now */
+#define DT_HP_BIND_NONFATAL		0x0020 /* Bind non-fatal */
+#define DT_HP_BIND_VERBOSE		0x0040 /* Bind verbose */
+#define DT_HP_BIND_RESTRICTED		0x0080 /* Bind restricted */
+#define DT_HP_BIND_SYMBOLIC		0x0100 /* Bind symbolic */
+#define DT_HP_RPATH_FIRST		0x0200 /* RPATH first */
+#define DT_HP_BIND_DEPTH_FIRST		0x0400 /* Bind depth-first */
+
+/* Program header extensions.  */
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+
+/* Additional symbol types.  */
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
 #endif /* _ELF_HPPA_H */
diff --git a/include/elf/i370.h b/include/elf/i370.h
new file mode 100644
index 0000000..9c021f0
--- /dev/null
+++ b/include/elf/i370.h
@@ -0,0 +1,46 @@
+/* i370 ELF support for BFD.
+   Copyright (C) 1995, 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.  */
+
+/* This file holds definitions specific to the i370 ELF ABI.  Note
+   that most of this is not actually implemented by BFD.  */
+
+#ifndef _ELF_I370_H
+#define _ELF_I370_H
+
+/* Processor specific section headers, sh_type field */
+
+#define SHT_ORDERED		SHT_HIPROC	/* Link editor is to sort the \
+						   entries in this section \
+						   based on the address \
+						   specified in the associated \
+						   symbol table entry.  */
+
+#define	EF_I370_RELOCATABLE	0x00010000	/* i370 -mrelocatable flag */
+#define	EF_I370_RELOCATABLE_LIB	0x00008000	/* i370 -mrelocatable-lib flag */
+/* Processor specific section flags, sh_flags field */
+
+#define SHF_EXCLUDE		0x80000000	/* Link editor is to exclude \
+						   this section from executable \
+						   and shared objects that it \
+						   builds when those objects \
+						   are not to be furhter \
+						   relocated.  */
+#endif /* _ELF_I370_H */
+
+
diff --git a/include/elf/i386.h b/include/elf/i386.h
index 219f105..0586661 100644
--- a/include/elf/i386.h
+++ b/include/elf/i386.h
@@ -20,7 +20,7 @@
 #ifndef _ELF_I386_H
 #define _ELF_I386_H
 
-#include "reloc-macros.h"
+#include "elf/reloc-macros.h"
 
 START_RELOC_NUMBERS (elf_i386_reloc_type)
      RELOC_NUMBER (R_386_NONE,      0)	/* No reloc */
diff --git a/include/elf/i960.h b/include/elf/i960.h
new file mode 100644
index 0000000..3e60289
--- /dev/null
+++ b/include/elf/i960.h
@@ -0,0 +1,38 @@
+/* Intel 960 ELF support for BFD.
+   Copyright (C) 1999 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_I960_H
+#define _ELF_I960_H
+
+#include "elf/reloc-macros.h"
+
+
+START_RELOC_NUMBERS (elf_i960_reloc_type)
+     RELOC_NUMBER (R_960_NONE,	    0)
+     RELOC_NUMBER (R_960_12,	    1)
+     RELOC_NUMBER (R_960_32,	    2)
+     RELOC_NUMBER (R_960_IP24,	    3)
+     RELOC_NUMBER (R_960_SUB,	    4)
+     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
+
+#endif /* _ELF_I960_H */
diff --git a/include/elf/m32r.h b/include/elf/m32r.h
index 0537d13..a12ae16 100644
--- a/include/elf/m32r.h
+++ b/include/elf/m32r.h
@@ -62,5 +62,7 @@
 
 /* m32r code.  */
 #define E_M32R_ARCH		0x00000000
+/* m32rx code.  */
+#define E_M32RX_ARCH		0x10000000
 
 #endif
diff --git a/include/elf/m68k.h b/include/elf/m68k.h
index db31cdcd..e2d51ef 100644
--- a/include/elf/m68k.h
+++ b/include/elf/m68k.h
@@ -53,4 +53,6 @@
   EMPTY_RELOC  (R_68K_max)   
 END_RELOC_NUMBERS
 
+#define EF_CPU32    0x00810000
+
 #endif
diff --git a/include/elf/mcore.h b/include/elf/mcore.h
index a7c4dad..62a88c9 100644
--- a/include/elf/mcore.h
+++ b/include/elf/mcore.h
@@ -1,4 +1,4 @@
-/* Motorolla MCore support for BFD.
+/* Motorola MCore support for BFD.
    Copyright (C) 1995, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -34,6 +34,10 @@
   RELOC_NUMBER (R_MCORE_PCRELJSR_IMM11BY2, 6)
   RELOC_NUMBER (R_MCORE_GNU_VTINHERIT, 7)
   RELOC_NUMBER (R_MCORE_GNU_VTENTRY, 8)
+  RELOC_NUMBER (R_MCORE_RELATIVE, 9)
+  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
 
diff --git a/include/elf/mips.h b/include/elf/mips.h
index c967248..1e2a9f9 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -75,6 +75,12 @@
   /* These relocs are used for the mips16.  */
   RELOC_NUMBER (R_MIPS16_26, 100)
   RELOC_NUMBER (R_MIPS16_GPREL, 101)
+  /* These are GNU extensions to handle embedded-pic.  */
+  RELOC_NUMBER (R_MIPS_PC32, 248)
+  RELOC_NUMBER (R_MIPS_PC64, 249)
+  RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250)
+  RELOC_NUMBER (R_MIPS_GNU_REL_LO16, 251)
+  RELOC_NUMBER (R_MIPS_GNU_REL_HI16, 252)
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
   RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
@@ -617,10 +623,10 @@
 /* Special values for the st_other field in the symbol table.  These
    are used in an Irix 5 dynamic symbol table.  */
 
-#define STO_DEFAULT		0x00
-#define STO_INTERNAL		0x01
-#define STO_HIDDEN		0x02
-#define STO_PROTECTED		0x03
+#define STO_DEFAULT		STV_DEFAULT
+#define STO_INTERNAL		STV_INTERNAL
+#define STO_HIDDEN		STV_HIDDEN
+#define STO_PROTECTED		STV_PROTECTED
 
 /* This value is used for a mips16 .text symbol.  */
 #define STO_MIPS16		0xf0
@@ -816,6 +822,40 @@
   bfd_vma ri_gp_value;
 } Elf64_Internal_RegInfo;
 
+typedef struct
+{
+  /* The hash value computed from the name of the corresponding
+     dynamic symbol.  */
+  unsigned char ms_hash_value[4];
+  /* Contains both the dynamic relocation index and the symbol flags
+     field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
+     to access the individual values.  The dynamic relocation index
+     identifies the first entry in the .rel.dyn section that
+     references the dynamic symbol corresponding to this msym entry.
+     If the index is 0, no dynamic relocations are associated with the
+     symbol.  The symbol flags field is reserved for future use.  */
+  unsigned char ms_info[4];
+} Elf32_External_Msym;
+
+typedef struct
+{
+  /* The hash value computed from the name of the corresponding
+     dynamic symbol.  */
+  unsigned long ms_hash_value;
+  /* Contains both the dynamic relocation index and the symbol flags
+     field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
+     to access the individual values.  The dynamic relocation index
+     identifies the first entry in the .rel.dyn section that
+     references the dynamic symbol corresponding to this msym entry.
+     If the index is 0, no dynamic relocations are associated with the
+     symbol.  The symbol flags field is reserved for future use.  */
+  unsigned long ms_info;
+} Elf32_Internal_Msym;
+
+#define ELF32_MS_REL_INDEX(i) ((i) >> 8)
+#define ELF32_MS_FLAGS(i)     (i) & 0xff)
+#define ELF32_MS_INFO(r, f)   (((r) << 8) + ((f) & 0xff))
+
 /* MIPS ELF reginfo swapping routines.  */
 extern void bfd_mips_elf64_swap_reginfo_in
   PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *));
diff --git a/include/elf/mn10300.h b/include/elf/mn10300.h
index 64a0750..1b90a13 100644
--- a/include/elf/mn10300.h
+++ b/include/elf/mn10300.h
@@ -50,4 +50,5 @@
    the rest are open. */
 
 #define E_MN10300_MACH_MN10300	0x00810000
+#define E_MN10300_MACH_AM33	0x00820000
 #endif /* _ELF_MN10300_H */
diff --git a/include/elf/pj.h b/include/elf/pj.h
new file mode 100644
index 0000000..6bb8306
--- /dev/null
+++ b/include/elf/pj.h
@@ -0,0 +1,45 @@
+/* picoJava ELF support for BFD.
+   Copyright (C) 1999 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_PJ_H
+#define _ELF_PJ_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocations.  */
+
+START_RELOC_NUMBERS (elf_pj_reloc_type)
+  RELOC_NUMBER (R_PJ_NONE, 0)
+  RELOC_NUMBER (R_PJ_DATA_DIR32, 1)
+  RELOC_NUMBER (R_PJ_CODE_REL32, 2)
+  RELOC_NUMBER (R_PJ_CODE_REL16, 3) 
+  RELOC_NUMBER (R_PJ_CODE_DIR32, 6)
+  RELOC_NUMBER (R_PJ_CODE_DIR16, 7)  
+  RELOC_NUMBER (R_PJ_CODE_LO16, 13)
+  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
+
+#define EF_PICOJAVA_ARCH     0x0000000f
+#define EF_PICOJAVA_NEWCALLS 0x00000010
+#define EF_PICOJAVA_GNUCALLS 0x00000020  /* The (currently) non standard GNU calling convention */
+
+#endif
diff --git a/include/elf/reloc-macros.h b/include/elf/reloc-macros.h
index 9762291..42174ca 100644
--- a/include/elf/reloc-macros.h
+++ b/include/elf/reloc-macros.h
@@ -46,8 +46,8 @@
    If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
    following function will be generated:
 
-   	static char * foo PARAMS ((unsigned long rtype));
-   	static char *
+   	static const char * foo PARAMS ((unsigned long rtype));
+   	static const char *
    	foo (rtype)
    	    unsigned long rtype;
    	{
diff --git a/include/elf/sh.h b/include/elf/sh.h
index 4a47667..faee509 100644
--- a/include/elf/sh.h
+++ b/include/elf/sh.h
@@ -20,6 +20,33 @@
 #ifndef _ELF_SH_H
 #define _ELF_SH_H
 
+/* Processor specific flags for the ELF header e_flags field.  */
+
+#define EF_SH_MACH_MASK	0x1f
+#define EF_SH_UNKNOWN	   0 /* For backwards compatibility.  */
+#define EF_SH1		   1
+#define EF_SH2		   2
+#define EF_SH3		   3
+#define EF_SH_HAS_DSP(flags) ((flags) & 4)
+#define EF_SH_DSP	   4
+#define EF_SH3_DSP	   5
+#define EF_SH_HAS_FP(flags) ((flags) & 8)
+#define EF_SH3E		   8
+#define EF_SH4		   9
+
+#define EF_SH_MERGE_MACH(mach1, mach2) \
+  (((((mach1) == EF_SH3 || (mach1) == EF_SH_UNKNOWN) && (mach2) == EF_SH_DSP) \
+    || ((mach1) == EF_SH_DSP \
+	&& ((mach2) == EF_SH3 || (mach2) == EF_SH_UNKNOWN))) \
+   ? EF_SH3_DSP \
+   : (((mach1) < EF_SH3 && (mach2) == EF_SH_UNKNOWN) \
+      || ((mach2) < EF_SH3 && (mach1) == EF_SH_UNKNOWN)) \
+   ? EF_SH3 \
+   : (((mach1) == EF_SH3E && (mach2) == EF_SH_UNKNOWN) \
+      || ((mach2) == EF_SH3E && (mach1) == EF_SH_UNKNOWN)) \
+   ? EF_SH4 \
+   : ((mach1) > (mach2) ? (mach1) : (mach2)))
+
 #include "elf/reloc-macros.h"
 
 /* Relocations.  */
diff --git a/include/elf/sparc.h b/include/elf/sparc.h
index c9e4cdd..390e4a8 100644
--- a/include/elf/sparc.h
+++ b/include/elf/sparc.h
@@ -29,6 +29,7 @@
 #define EF_SPARC_32PLUS		0x000100	/* generic V8+ features */
 #define EF_SPARC_SUN_US1	0x000200	/* Sun UltraSPARC1 extensions */
 #define EF_SPARC_HAL_R1		0x000400	/* HAL R1 extensions */
+#define EF_SPARC_SUN_US3	0x000800	/* Sun UltraSPARCIII extensions */
 
 #define EF_SPARC_LEDATA         0x800000	/* little endian data */
 
@@ -128,6 +129,8 @@
   /* little endian data relocs */
   RELOC_NUMBER (R_SPARC_REV32, 56)
 
+  EMPTY_RELOC  (R_SPARC_max_std)
+
   RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250)
   RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251)
 
@@ -136,21 +139,15 @@
 
 /* Relocation macros.  */
 
-#define ELF64_R_TYPE_DATA(info)		(((bfd_vma) (info) << 32) >> 40)
-#define ELF64_R_TYPE_ID(info)		(((bfd_vma) (info) << 56) >> 56)
-#define ELF64_R_TYPE_INFO(data, type)	(((bfd_vma) (data) << 8) \
-					 + (bfd_vma) (type))
+#define ELF64_R_TYPE_DATA(info) \
+  (((bfd_signed_vma)(ELF64_R_TYPE(info) >> 8) ^ 0x800000) - 0x800000)
+#define ELF64_R_TYPE_ID(info) \
+  ((info) & 0xff)
+#define ELF64_R_TYPE_INFO(data, type) \
+  (((bfd_vma) ((data) & 0xffffff) << 8) | (bfd_vma) (type))
+
+/* Values for Elf64_Dyn.d_tag.  */
 
 #define DT_SPARC_REGISTER	0x70000001
 
-/*
- * FIXME: NOT ABI -- GET RID OF THIS
- * Defines the format used by the .plt.  Currently defined values are
- *   0 -- reserved to SI
- *   1 -- absolute address in .got.plt
- *   2 -- got-relative address in .got.plt
- */
-
-#define DT_SPARC_PLTFMT		0x70000001
-
 #endif /* _ELF_SPARC_H */
diff --git a/include/hashtab.h b/include/hashtab.h
index 3990c14..5fe2393 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -38,69 +38,88 @@
 
 #include <ansidecl.h>
 
-/* The hash table element is represented by the following type. */
+/* Callback function pointer types.  */
 
-typedef const void *hash_table_entry_t;
+/* Calculate hash of a table entry.  */
+typedef unsigned int (*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
+   different type (but in this case htab_find and htab_find_slot
+   cannot be used; instead the variants that accept a hash value
+   must be used).  */
+typedef int (*htab_eq) PARAMS ((const void *, const void *));
+
+/* Cleanup function called whenever a live element is removed from
+   the hash table.  */
+typedef void (*htab_del) PARAMS ((void *));
+  
+/* Function called by htab_traverse for each live element.  The first
+   arg is the slot of the element (which can be passed to htab_clear_slot
+   if desired), the second arg is the auxiliary pointer handed to
+   htab_traverse.  Return 1 to continue scan, 0 to stop.  */
+typedef int (*htab_trav) PARAMS ((void **, void *));
 
 /* Hash tables are of the following type.  The structure
    (implementation) of this type is not needed for using the hash
    tables.  All work with hash table should be executed only through
    functions mentioned below. */
 
-typedef struct hash_table
+struct htab
 {
+  /* Pointer to hash function.  */
+  htab_hash hash_f;
+
+  /* Pointer to comparison function.  */
+  htab_eq eq_f;
+
+  /* Pointer to cleanup function.  */
+  htab_del del_f;
+
+  /* Table itself.  */
+  void **entries;
+
   /* Current size (in entries) of the hash table */
   size_t size;
+
   /* Current number of elements including also deleted elements */
-  size_t number_of_elements;
+  size_t n_elements;
+
   /* Current number of deleted elements in the table */
-  size_t number_of_deleted_elements;
+  size_t n_deleted;
+
   /* The following member is used for debugging. Its value is number
-     of all calls of `find_hash_table_entry' for the hash table. */
-  int searches;
+     of all calls of `htab_find_slot' for the hash table. */
+  unsigned int searches;
+
   /* The following member is used for debugging.  Its value is number
      of collisions fixed for time of work with the hash table. */
-  int collisions;
-  /* Pointer to function for evaluation of hash value (any unsigned value).
-     This function has one parameter of type hash_table_entry_t. */
-  unsigned (*hash_function) PARAMS ((hash_table_entry_t));
-  /* Pointer to function for test on equality of hash table elements (two
-     parameter of type hash_table_entry_t. */
-  int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t));
-  /* Table itself */
-  hash_table_entry_t *entries;
-} *hash_table_t;
+  unsigned int collisions;
+};
 
+typedef struct htab *htab_t;
 
 /* The prototypes of the package functions. */
 
-extern hash_table_t create_hash_table
-  PARAMS ((size_t, unsigned (*) (hash_table_entry_t),
-	   int (*) (hash_table_entry_t, hash_table_entry_t)));
+extern htab_t	htab_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 delete_hash_table PARAMS ((hash_table_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 void	htab_clear_slot	PARAMS ((htab_t, void **));
+extern void	htab_remove_elt	PARAMS ((htab_t, void *));
 
-extern void empty_hash_table PARAMS ((hash_table_t));
+extern void	htab_traverse	PARAMS ((htab_t, htab_trav, void *));
 
-extern hash_table_entry_t *find_hash_table_entry
-  PARAMS ((hash_table_t, hash_table_entry_t, int));
-
-extern void remove_element_from_hash_table_entry PARAMS ((hash_table_t,
-							  hash_table_entry_t));
-
-extern void clear_hash_table_slot PARAMS ((hash_table_t, hash_table_entry_t *));
-
-extern void traverse_hash_table PARAMS ((hash_table_t,
-					 int (*) (hash_table_entry_t, void *),
-					 void *));
-    
-extern size_t hash_table_size PARAMS ((hash_table_t));
-
-extern size_t hash_table_elements_number PARAMS ((hash_table_t));
-
-extern int hash_table_collisions PARAMS ((hash_table_t));
-
-extern int all_hash_table_collisions PARAMS ((void));
+extern size_t	htab_size	PARAMS ((htab_t));
+extern size_t	htab_elements	PARAMS ((htab_t));
+extern double	htab_collisions	PARAMS ((htab_t));
 
 #ifdef __cplusplus
 }
diff --git a/include/hp-symtab.h b/include/hp-symtab.h
index fff5668..cf626c0 100644
--- a/include/hp-symtab.h
+++ b/include/hp-symtab.h
@@ -88,7 +88,8 @@
 {
   HP_LANGUAGE_UNKNOWN,
   HP_LANGUAGE_C,
-  HP_LANGUAGE_F77,
+  HP_LANGUAGE_FORTRAN,
+  HP_LANGUAGE_F77 = HP_LANGUAGE_FORTRAN,
   HP_LANGUAGE_PASCAL,
   HP_LANGUAGE_MODCAL,
   HP_LANGUAGE_COBOL,
@@ -485,9 +486,11 @@
   unsigned int longaddr:	1;
   unsigned int copyparam:	1;
   unsigned int dflt:		1;
-  unsigned int unused:		16;
+  unsigned int doc_ranges:	1;
+  unsigned int misc_kind:       1;
+  unsigned int unused:		14;
   vtpointer name;
-  int location;
+  CORE_ADDR location;
   dnttpointer type;
   dnttpointer nextparam;
   int misc;
@@ -595,7 +598,7 @@
   unsigned int kind:		10;
   unsigned int global:		1;
   unsigned int indirect:	1;
-  unsigned int:			3;
+  unsigned int location_type:	3;
   unsigned int classmem:	1;
   unsigned int unused:		15;
   vtpointer name;
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 79bc3cc..7452c2b 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,307 @@
+2000-03-27  Nick Clifton  <nickc@cygnus.com>
+
+	* d30v.h (SHORT_A1): Fix value.
+	(SHORT_AR): Renumber so that it is at the end of the list of short
+	instructions, not the end of the list of long instructions.
+
+2000-03-26  Alan Modra  <alan@linuxcare.com>
+
+	* i386.h: (UNIXWARE_COMPAT): Rename to SYSV386_COMPAT as the
+	problem isn't really specific to Unixware.
+	(OLDGCC_COMPAT): Define.
+	(i386_optab): If !OLDGCC_COMPAT, don't handle fsubp etc. with
+	destination %st(0).
+	Fix lots of comments.
+
+2000-03-02  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+        * d30v.h:
+        (SHORT_B2r, SHORT_B3, SHORT_B3r, SHORT_B3b, SHORT_B3br): Updated.
+        (SHORT_D1r, SHORT_D2, SHORT_D2r, SHORT_D2Br, SHORT_U): Updated.
+        (SHORT_F, SHORT_AF, SHORT_T, SHORT_A5, SHORT_CMP, SHORT_CMPU): Updated.
+        (SHORT_A1, SHORT_AA, SHORT_RA, SHORT_MODINC, SHORT_MODDEC): Updated.
+        (SHORT_C1, SHORT_C2, SHORT_UF, SHORT_A2, SHORT_NONE, LONG): Updated.
+        (LONG_U, LONG_Ur, LONG_CMP, LONG_M, LONG_M2, LONG_2, LONG_2r): Updated.
+        (LONG_2b, LONG_2br, LONG_D, LONG_Dr, LONG_Dbr): Updated.
+
+2000-02-25  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h (fild, fistp): Change intel d_Suf form to fildd and
+	fistpd without suffix.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* cgen.h (cgen_cpu_desc): Rename field 'flags' to
+        'signed_overflow_ok_p'.
+	Delete prototypes for cgen_set_flags() and cgen_get_flags().
+
+2000-02-24  Andrew Haley  <aph@cygnus.com>
+
+	* cgen.h (CGEN_INSN_MACH_HAS_P): New macro.
+	(CGEN_CPU_TABLE): flags: new field.
+	Add prototypes for new functions.
+	
+2000-02-24  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Add some more UNIXWARE_COMPAT comments.
+
+2000-02-23  Linas Vepstas <linas@linas.org>
+
+	* i370.h: New file.
+
+2000-02-22  Andrew Haley  <aph@cygnus.com>
+
+	* mips.h: (OPCODE_IS_MEMBER): Add comment.
+
+1999-12-30  Andrew Haley  <aph@cygnus.com>
+
+	* mips.h (OPCODE_IS_MEMBER): Add gp32 arg, which determines
+	whether synthetic opcodes (e.g. move) generate 32-bit or 64-bit
+	insns.
+
+2000-01-15  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Qualify intel mode far call and jmp with x_Suf.
+
+1999-12-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Add JumpAbsolute qualifier to all non-intel mode
+	indirect jumps and calls.  Add FF/3 call for intel mode.
+
+Wed Dec  1 03:05:25 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* mn10300.h: Add new operand types.  Add new instruction formats.
+
+Wed Nov 24 20:28:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Correctly handle immediate for PA2.0 "bb"
+	instruction.
+
+1999-11-18  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* mips.h (INSN_ISA5): New.
+
+1999-11-01  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* mips.h (OPCODE_IS_MEMBER): New.
+
+1999-10-29  Nick Clifton  <nickc@cygnus.com>
+
+	* d30v.h (SHORT_AR): Define.
+
+1999-10-18  Michael Meissner  <meissner@cygnus.com>
+
+	* alpha.h (alpha_num_opcodes): Convert to unsigned.
+	(alpha_num_operands): Ditto.
+
+Sun Oct 10 01:46:56 1999  Jerry Quinn <jerry.quinn.adv91@alum.dartmouth.org>
+
+	* hppa.h (pa_opcodes):  Add load and store cache control to
+	instructions.  Add ordered access load and store.
+
+	* hppa.h (pa_opcode): Add new entries for addb and addib.
+
+	* hppa.h (pa_opcodes): Fix cmpb and cmpib entries.
+
+	* hppa.h (pa_opcodes):  Add entries for cmpb and cmpib.
+
+Thu Oct  7 00:12:25 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* d10v.h: Add flag RESTRICTED_NUM3 for imm3 operands.
+
+Thu Sep 23 07:08:38 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa.h (pa_opcodes): Add "call" and "ret".  Clean up "b", "bve"
+	and "be" using completer prefixes.
+
+	* hppa.h (pa_opcodes): Add initializers to silence compiler.
+
+	* hppa.h: Update comments about character usage.
+
+Mon Sep 20 03:55:31 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Fix minor thinkos introduced while cleaning
+	up the new fstw & bve instructions.
+
+Sun Sep 19 10:40:59 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Add remaining PA2.0 integer load/store
+	instructions.
+
+	* hppa.h (pa_opcodes): Add remaining PA2.0 FP load/store instructions.
+
+	* hppa.h (pa_opcodes): Add long offset double word load/store
+	instructions.
+
+	* hppa.h (pa_opcodes): Add FLAG_STRICT variants of FP loads and
+	stores.
+
+	* hppa.h (pa_opcodes): Handle PA2.0 fcnv, fcmp and ftest insns.
+
+	* hppa.h (pa_opcodes): Finish support for PA2.0 "b" instructions.
+
+	* hppa.h (pa_opcodes): Handle PA2.0 "bve" instructions.
+
+	* hppa.h (pa_opcodes): Add new syntax "be" instructions.
+
+	* hppa.h (pa_opcodes): Note use of 'M' and 'L'.
+
+	* hppa.h (pa_opcodes): Add support for "b,l".
+
+	* hppa.h (pa_opcodes): Add support for "b,gate".
+
+Sat Sep 18 11:41:16 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Use 'fX' for first register operand
+	in xmpyu.  
+
+	* hppa.h (pa_opcodes): Fix mask for probe and probei.
+
+	* hppa.h (pa_opcodes): Fix mask for depwi.
+
+Tue Sep  7 13:44:25 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Add "addil" variant which has the %r1 as
+	an explicit output argument.
+
+Mon Sep  6 04:41:42 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h: Add strict variants of PA1.0/PA1.1 loads and stores.
+	Add a few PA2.0 loads and store variants.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* pj.h: New file.
+
+1999-08-29  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h (i386_regtab): Move %st to top of table, and split off
+	other fp reg entries.
+	(i386_float_regtab): To here.
+
+Sat Aug 28 00:25:25 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa.h (pa_opcodes): Replace 'f' by 'v'.  Prefix float register args
+	by 'f'.
+
+	* hppa.h (pa_opcodes): Add extrd, extrw, depd, depdi, depw, depwi.
+	Add supporting args.
+
+	* hppa.h:  Document new completers and args.
+	* hppa.h (pa_opcodes):  Add 64 bit patterns and pa2.0 syntax for uxor,
+	uaddcm, dcor, addi, add, sub, subi, shladd, rfi, and probe.  Add pa2.0
+	extensions for ssm, rsm, pdtlb, pitlb.  Add performance instructions
+	pmenb and pmdis.
+
+	* hppa.h (pa_opcodes):  Add pa2.0 instructions hadd, hshl,
+	hshr, hsub, mixh, mixw, permh.
+
+	* hppa.h (pa_opcodes): Change completers in instructions to
+	use 'c' prefix.
+
+	* hppa.h (pa_opcodes):  Add popbts, new forms of bb, havg,
+	hshladd, hshradd, shrpd, and shrpw instructions.  Update arg comments.
+
+	* hppa.h (pa_opcodes):  Change fmpyfadd, fmpynfadd, fneg,
+	fnegabs to use 'I' instead of 'F'.
+
+1999-08-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Add AMD athlon instructions, pfnacc, pfpnacc, pswapd.
+	Document pf2iw and pi2fw as athlon insns.  Remove pswapw.
+	Alphabetically sort PIII insns.
+
+Wed Aug 18 18:14:40 1999  Doug Evans  <devans@canuck.cygnus.com>
+
+	* cgen.h (CGEN_INSN_MACH_HAS_P): New macro.
+
+Fri Aug  6 09:46:35 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa.h (pa_opcodes): Add 64 bit versions of or, xor, and,
+	and andcm.  Add 32 and 64 bit version of cmpclr, cmpiclr.
+
+	* hppa.h:  Document 64 bit condition completers.
+
+Thu Aug  5 16:56:07 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa.h (pa_opcodes): Change condition args to use '?' prefix.
+
+1999-08-04  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h (i386_optab): Add DefaultSize modifier to all insns
+	that implicitly modify %esp.  #undef d_Suf, x_suf, sld_suf,
+	sldx_suf, bwld_Suf, d_FP, x_FP, sld_FP, sldx_FP at end of table.
+
+Wed Jul 28 02:04:24 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+			  Jeff Law <law@cygnus.com>
+
+	* hppa.h (pa_opcodes): Add "pushnom" and "pushbts".
+
+	* hppa.h (pa_opcodes): Mark all PA2.0 opcodes with FLAG_STRICT.
+
+	* hppa.h (pa_opcodes):  Change xmpyu, fmpyfadd, 
+	and fmpynfadd to use 'J' and 'K' instead of 'E' and 'X'.
+
+1999-07-13  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Add "undocumented" AMD 3DNow! pf2iw, pi2fw, pswapw insns.
+
+Thu Jul  1 00:17:24 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (struct pa_opcode): Add new field "flags".
+	(FLAGS_STRICT): Define.
+
+Fri Jun 25 04:22:04 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+			  Jeff Law <law@cygnus.com>
+
+	* hppa.h (pa_opcodes): Add pa2.0 clrbts instruction.
+
+	* hppa.h (pa_opcodes): Add entries for mfia and mtsarcm instructions.
+
+1999-06-23  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386.h: Allow `l' suffix on bswap.  Allow `w' suffix on arpl,
+	lldt, lmsw, ltr, str, verr, verw.  Add FP flag to fcmov*.  Add FP
+	flag to fcomi and friends.
+
+Fri May 28 15:26:11 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Move integer arithmetic instructions after
+	integer logical instructions.  
+
+1999-05-28  Linus Nordberg  <linus.nordberg@canit.se>
+
+	* m68k.h: Document new formats `E', `G', `H' and new places `N',
+	`n', `o'.
+
+	* m68k.h: Define mcf5206e, mcf5307, mcf.  Document new format `u'
+	and new places `m', `M', `h'.
+
+Thu May 27 04:13:54 1999  Joel Sherrill (joel@OARcorp.com
+
+	* hppa.h (pa_opcodes): Add several processor specific system
+	instructions.
+
+Wed May 26 16:57:44 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (pa_opcodes): Add second entry for "comb", "comib", 
+	"addb", and "addib" to be used by the disassembler.
+
+1999-05-12  Alan Modra  <alan@apri.levels.unisa.edu.au>
+
+	* i386.h (ReverseModrm): Remove all occurences.
+	(InvMem): Add to control/debug/test mov insns, movhlps, movlhps,
+	movmskps, pextrw, pmovmskb, maskmovq.
+	Change NoSuf to FP on all MMX, XMM and AMD insns as these all
+	ignore the data size prefix.
+
+	* i386.h (i386_optab, i386_regtab): Add support for PIII SIMD.
+	Mostly stolen from Doug Ledford <dledford@redhat.com>
+
+Sat May  8 23:27:35 1999  Richard Henderson  <rth@cygnus.com>
+
+	* ppc.h (PPC_OPCODE_64_BRIDGE): New.
+
 1999-04-14  Doug Evans  <devans@casey.cygnus.com>
 
 	* cgen.h (CGEN_ATTR): Delete member num_nonbools.
diff --git a/include/opcode/alpha.h b/include/opcode/alpha.h
index d18eb04..6f31e9a 100644
--- a/include/opcode/alpha.h
+++ b/include/opcode/alpha.h
@@ -54,7 +54,7 @@
    in the order in which the disassembler should consider
    instructions.  */
 extern const struct alpha_opcode alpha_opcodes[];
-extern const int alpha_num_opcodes;
+extern const unsigned alpha_num_opcodes;
 
 /* Values defined for the flags field of a struct alpha_opcode.  */
 
@@ -135,7 +135,7 @@
    the operands field of the alpha_opcodes table.  */
 
 extern const struct alpha_operand alpha_operands[];
-extern const int alpha_num_operands;
+extern const unsigned alpha_num_operands;
 
 /* Values defined for the flags field of a struct alpha_operand.  */
 
diff --git a/include/opcode/cgen.h b/include/opcode/cgen.h
index 84542a3..0cff7c8 100644
--- a/include/opcode/cgen.h
+++ b/include/opcode/cgen.h
@@ -1,6 +1,6 @@
 /* Header file for targets using CGEN: Cpu tools GENerator.
 
-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 GDB, the GNU debugger, and the GNU Binutils.
 
@@ -1037,6 +1037,12 @@
 /* Return value of base part of INSN.  */
 #define CGEN_INSN_BASE_VALUE(insn) \
   CGEN_OPCODE_BASE_VALUE (CGEN_INSN_OPCODE (insn))
+
+/* Standard way to test whether INSN is supported by MACH.
+   MACH is one of enum mach_attr.
+   The "|1" is because the base mach is always selected.  */
+#define CGEN_INSN_MACH_HAS_P(insn, mach) \
+((CGEN_INSN_ATTR_VALUE ((insn), CGEN_INSN_MACH) & ((1 << (mach)) | 1)) != 0)
 
 /* Macro instructions.
    Macro insns aren't real insns, they map to one or more real insns.
@@ -1275,6 +1281,10 @@
   /* Disassembler instruction hash table.  */
   CGEN_INSN_LIST **dis_hash_table;
   CGEN_INSN_LIST *dis_hash_table_entries;
+
+  /* This field could be turned into a bitfield if room for other flags is needed.  */
+  unsigned int signed_overflow_ok_p;
+       
 } CGEN_CPU_TABLE;
 
 /* wip */
@@ -1377,4 +1387,13 @@
 extern const char * cgen_read_cpu_file
      PARAMS ((CGEN_CPU_DESC, const char * filename_));
 
+/* Allow signed overflow of instruction fields.  */
+extern void cgen_set_signed_overflow_ok PARAMS ((CGEN_CPU_DESC));
+
+/* Generate an error message if a signed field in an instruction overflows.  */
+extern void cgen_clear_signed_overflow_ok PARAMS ((CGEN_CPU_DESC));
+
+/* Will an error message be generated if a signed field in an instruction overflows ? */
+extern unsigned int cgen_signed_overflow_ok_p PARAMS ((CGEN_CPU_DESC));
+
 #endif /* CGEN_H */
diff --git a/include/opcode/d10v.h b/include/opcode/d10v.h
index 4b74c98..7c6d32d 100644
--- a/include/opcode/d10v.h
+++ b/include/opcode/d10v.h
@@ -176,6 +176,10 @@
 /* general purpose register */
 #define OPERAND_GPR	(0x40000)
 
+/* special imm3 values with range restricted to -2 <= imm3 <= 3 */
+/* needed for rac/rachi */
+#define RESTRICTED_NUM3	(0x80000)
+
 /* Structure to hold information about predefined registers.  */
 struct pd_reg
 {
diff --git a/include/opcode/d30v.h b/include/opcode/d30v.h
index b828dab..f90b7a4 100644
--- a/include/opcode/d30v.h
+++ b/include/opcode/d30v.h
@@ -1,5 +1,5 @@
 /* d30v.h -- Header file for D30V opcode table
-   Copyright 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
    Written by Martin Hunt (hunt@cygnus.com), Cygnus Solutions
 
 This file is part of GDB, GAS, and the GNU binutils.
@@ -85,39 +85,46 @@
 #define SHORT_A		9
 #define SHORT_B1	11
 #define SHORT_B2	12
-#define SHORT_B3	13
-#define SHORT_B3b	15
-#define SHORT_D1	17
-#define SHORT_D2	19
-#define SHORT_D2B	21
-#define SHORT_U		23	/* unary SHORT_A.  ABS for example */
-#define SHORT_F		25	/* SHORT_A with flag registers */
-#define SHORT_AF	27	/* SHORT_A with only the first register a flag register */
-#define SHORT_T		29	/* for trap instruction */
-#define SHORT_A5	30	/* SHORT_A with a 5-bit immediate instead of 6 */
-#define SHORT_CMP	32	/* special form for CMPcc */
-#define SHORT_CMPU	34	/* special form for CMPUcc */
-#define SHORT_A1	36	/* special form of SHORT_A for MACa opcodes where a=1 */
-#define SHORT_AA	38	/* SHORT_A with the first register an accumulator */
-#define SHORT_RA	40	/* SHORT_A with the second register an accumulator */
-#define SHORT_MODINC	42	
-#define SHORT_MODDEC	43
-#define SHORT_C1	44
-#define SHORT_C2	45
-#define SHORT_UF	46
-#define SHORT_A2	47
-#define SHORT_A5S	49
-#define SHORT_NONE	51	/* no operands */
-#define LONG		52
-#define LONG_U		53	/* unary LONG */
-#define LONG_AF		54	/* LONG with the first register a flag register */
-#define LONG_CMP	55	/* special form for CMPcc and CMPUcc */
-#define LONG_M		56	/* Memory long for ldb, stb */
-#define LONG_M2		57	/* Memory long for ld2w, st2w */
-#define LONG_2		58	/* LONG with 2 operands; bratnz */
-#define LONG_2b		59	/* LONG_2 with modifier of 3 */
-#define LONG_D		60	/* for DBRAI*/
-#define LONG_Db		61	/* for repeati*/
+#define SHORT_B2r     13
+#define SHORT_B3      14
+#define SHORT_B3r     16
+#define SHORT_B3b     18
+#define SHORT_B3br    20
+#define SHORT_D1r     22
+#define SHORT_D2      24
+#define SHORT_D2r     26
+#define SHORT_D2Br    28
+#define SHORT_U       30      /* unary SHORT_A.  ABS for example */
+#define SHORT_F       31      /* SHORT_A with flag registers */
+#define SHORT_AF      33      /* SHORT_A with only the first register a flag register */
+#define SHORT_T       35      /* for trap instruction */
+#define SHORT_A5      36      /* SHORT_A with a 5-bit immediate instead of 6 */
+#define SHORT_CMP     38      /* special form for CMPcc */
+#define SHORT_CMPU    40      /* special form for CMPUcc */
+#define SHORT_A1      42      /* special form of SHORT_A for MACa opcodes where a=1 */
+#define SHORT_AA      44      /* SHORT_A with the first register an accumulator */
+#define SHORT_RA      46      /* SHORT_A with the second register an accumulator */
+#define SHORT_MODINC  48      
+#define SHORT_MODDEC  49
+#define SHORT_C1      50
+#define SHORT_C2      51
+#define SHORT_UF      52
+#define SHORT_A2      53
+#define SHORT_NONE    55      /* no operands */
+#define SHORT_AR      56      /* like SHORT_AA but only accept register as third parameter  */
+#define LONG          57
+#define LONG_U        58      /* unary LONG */
+#define LONG_Ur       59      /* LONG pc-relative */
+#define LONG_CMP      60      /* special form for CMPcc and CMPUcc */
+#define LONG_M        61      /* Memory long for ldb, stb */
+#define LONG_M2       62      /* Memory long for ld2w, st2w */
+#define LONG_2        63      /* LONG with 2 operands; jmptnz */
+#define LONG_2r       64      /* LONG with 2 operands; bratnz */
+#define LONG_2b       65      /* LONG_2 with modifier of 3 */
+#define LONG_2br      66      /* LONG_2r with modifier of 3 */
+#define LONG_D        67      /* for DJMPI */
+#define LONG_Dr       68      /* for DBRAI */
+#define LONG_Dbr      69      /* for repeati */
 
   /* the execution unit(s) used */
   int unit;
@@ -146,7 +153,9 @@
 #define FLAG_JMP	(1L<<13)	/* instruction is a branch */
 #define FLAG_JSR	(1L<<14)	/* subroutine call.  must be aligned */
 #define FLAG_MEM	(1L<<15)	/* reads/writes memory */
-#define FLAG_2WORD	(1L<<16)	/* 2 word/4 byte operation */
+#define FLAG_NOT_WITH_ADDSUBppp	 (1L<<16) /* Old meaning: a 2 word 4 byter operation
+					   New meaning: operation cannot be 
+					   combined in parallel with ADD/SUBppp. */
 #define FLAG_MUL16	(1L<<17)	/* 16 bit multiply */
 #define FLAG_MUL32	(1L<<18)	/* 32 bit multiply */
 #define FLAG_ADDSUBppp	(1L<<19)	/* ADDppp or SUBppp */
@@ -246,6 +255,10 @@
 /* let the optimizer know that two registers are affected */
 #define OPERAND_2REG	(0x10000)
 
+/* This operand is pc-relative.  Note that repeati can have two immediate
+   operands, one of which is pcrel, the other (the IMM6U one) is not.  */
+#define OPERAND_PCREL	(0x20000)
+
 /* The format table is an array of struct d30v_format.  */
 struct d30v_format
 {
diff --git a/include/opcode/hppa.h b/include/opcode/hppa.h
index 30ccb6c..1c41ff0 100644
--- a/include/opcode/hppa.h
+++ b/include/opcode/hppa.h
@@ -43,8 +43,12 @@
     unsigned long int mask;	/* ... in these bits. */
     char *args;
     enum pa_arch arch;
+    char flags;
 };
 
+/* Enable/disable strict syntax checking.  Not currently used, but will
+   be necessary for PA2.0 support in the future.  */
+#define FLAG_STRICT 0x1
 
 /*
    All hppa opcodes are 32 bits.
@@ -53,8 +57,9 @@
    particular opcode in order for an instruction to be an instance
    of that opcode.
 
-   The args component is a string containing one character
-   for each operand of the instruction.
+   The args component is a string containing one character for each operand of
+   the instruction.  Characters used as a prefix allow any second character to
+   be used without conflicting with the main operand characters.
 
    Bit positions in this description follow HP usage of lsb = 31,
    "at" is lsb of field.
@@ -65,9 +70,9 @@
 
    In the args field, the following characters are unused:
 
-	'  "#$%    *+- ./          :;    '
-	'                          [\]  '
-	'                          { } '
+	'  "   &     -  /   34 6789:;< > @'
+	'  C         M             [\]  '
+	'    e g    l            y   } '
 
    Here are all the characters:
 
@@ -79,20 +84,10 @@
    x    integer register field at 15.
    b    integer register field at 10.
    t    integer register field at 31.
-   y    floating point register field at 31
+   a	integer register field at 10 and 15 (for PERMH)
    5    5 bit immediate at 15.
    s    2 bit space specifier at 17.
    S    3 bit space specifier at 18.
-   c    indexed load completer.
-   C    short load and store completer.
-   Y	Store Bytes Short completer
-   <    non-negated compare/subtract conditions.
-   a	compare/subtract conditions
-   d    non-negated add conditions
-   &    logical instruction conditions
-   U    unit instruction conditions
-   >    shift/extract/deposit conditions.
-   ~    bvb,bb conditions
    V    5 bit immediate value at 31
    i    11 bit immediate value at 31
    j    14 bit immediate value at 31
@@ -101,20 +96,28 @@
    N	nullification for spop and copr instructions
    w    12 bit branch displacement
    W    17 bit branch displacement (PC relative)
+   X    22 bit branch displacement (PC relative)
    z    17 bit branch displacement (just a number, not an address)
 
 Also these:
 
+   .    2 bit shift amount at 25
+   *    4 bit shift amount at 25
    p    5 bit shift count at 26 (to support the SHD instruction) encoded as
         31-p
+   ~    6 bit shift count at 20,22:26 encoded as 63-~.
    P    5 bit bit position at 26
+   q    6 bit bit position at 20,22:26
    T    5 bit field length at 31 (encoded as 32-T)
+   %	6 bit field length at 23,27:31 (variable extract/deposit)
+   |	6 bit field length at 19,27:31 (fixed extract/deposit)
    A    13 bit immediate at 18 (to support the BREAK instruction)
    ^	like b, but describes a control register
-   Z    System Control Completer (to support LPA, LHA, etc.)
+   !    sar (cr11) register
    D    26 bit immediate at 31 (to support the DIAG instruction)
+   $    9 bit immediate at 28 (to support POPBTS)
 
-   f    3 bit Special Function Unit identifier at 25
+   v    3 bit Special Function Unit identifier at 25
    O    20 bit Special Function Unit operation split between 15 bits at 20
         and 5 bits at 31
    o    15 bit Special Function Unit operation at 20
@@ -129,37 +132,126 @@
    I    Source Floating Point Operand Format Completer encoded 1 bits at 20
 	(for 0xe format FP instructions)
    G    Destination Floating Point Operand Format Completer encoded 2 bits at 18
-   M    Floating-Point Compare Conditions (encoded as 5 bits at 31)
-   ?    non-negated/negated compare/subtract conditions.
-   @    non-negated/negated add conditions.
-   !    non-negated add conditions.
+   H    Floating Point Operand Format at 26 for 'fmpyadd' and 'fmpysub'
+        (very similar to 'F')
 
-   s    2 bit space specifier at 17.
-   b    register field at 10.
    r	5 bit immediate value at 31 (for the break instruction)
 	(very similar to V above, except the value is unsigned instead of
 	low_sign_ext)
    R	5 bit immediate value at 15 (for the ssm, rsm, probei instructions)
 	(same as r above, except the value is in a different location)
+   U	10 bit immediate value at 15 (for SSM, RSM on pa2.0)
    Q	5 bit immediate value at 10 (a bit position specified in
 	the bb instruction. It's the same as r above, except the
         value is in a different location)
-   |	shift/extract/deposit conditions when used in a conditional branch
+   B	5 bit immediate value at 10 (a bit position specified in
+	the bb instruction. Similar to Q, but 64bit handling is
+	different.
+   Z    %r1 -- implicit target of addil instruction.
+   L    ,%r2 completer for new syntax branch
+   {    Source format completer for fcnv
+   _    Destination format completer for fcnv
+   h    cbit for fcmp
+   =    gfx tests for ftest
+   d    14bit offset for single precision FP long load/store.
+   #    14bit offset for double precision FP load long/store.
+   J    Yet another 14bit offset with an unusual encoding.
+   K    Yet another 14bit offset with an unusual encoding.
+   Y    %sr0,%r31 -- implicit target of be,l instruction.
+   @	implicit immediate value of 0
 
-And these (PJH) for PA-89 F.P. registers and instructions:
+Completer operands all have 'c' as the prefix:
 
-   v    a 't' operand type extended to handle L/R register halves.
-   E    a 'b' operand type extended to handle L/R register halves.
-   X    an 'x' operand type extended to handle L/R register halves.
-   J    a 'b' operand type further extended to handle extra 1.1 registers
-   K    a 'x' operand type further extended to handle extra 1.1 registers
-   4    a variation of the 'b' operand type for 'fmpyadd' and 'fmpysub'
-   6    a variation of the 'x' operand type for 'fmpyadd' and 'fmpysub'
-   7    a variation of the 't' operand type for 'fmpyadd' and 'fmpysub'
-   8    5 bit register field at 20 (used in 'fmpyadd' and 'fmpysub')
-   9    5 bit register field at 25 (used in 'fmpyadd' and 'fmpysub')
-   H    Floating Point Operand Format at 26 for 'fmpyadd' and 'fmpysub'
-        (very similar to 'F')
+   cx   indexed load completer.
+   cm   short load and store completer.
+   cq   long load and store completer (like cm, but inserted into a
+	different location in the target instruction).
+   cs   store bytes short completer.
+   ce   long load/store completer for LDW/STW with a different encoding than the
+	others
+   cc   load cache control hint
+   cd   load and clear cache control hint
+   cC   store cache control hint
+   co	ordered access
+
+   cp	branch link and push completer
+   cP	branch pop completer
+   cl	branch link completer
+   cg	branch gate completer
+
+   cw	read/write completer for PROBE
+   cW	wide completer for MFCTL
+   cL	local processor completer for cache control
+   cZ   System Control Completer (to support LPA, LHA, etc.)
+
+   ci	correction completer for DCOR
+   ca	add completer
+   cy	32 bit add carry completer
+   cY	64 bit add carry completer
+   cv	signed overflow trap completer
+   ct	trap on condition completer for ADDI, SUB
+   cT	trap on condition completer for UADDCM
+   cb	32 bit borrow completer for SUB
+   cB	64 bit borrow completer for SUB
+
+   ch	left/right half completer
+   cH	signed/unsigned saturation completer
+   cS	signed/unsigned completer at 21
+   c*	permutation completer
+
+Condition operands all have '?' as the prefix:
+
+   ?f   Floating point compare conditions (encoded as 5 bits at 31)
+
+   ?a	add conditions
+   ?A	64 bit add conditions
+   ?@   add branch conditions followed by nullify
+   ?d	non-negated add branch conditions
+   ?D	negated add branch conditions
+   ?w	wide mode non-negated add branch conditions
+   ?W	wide mode negated add branch conditions
+
+   ?s   compare/subtract conditions
+   ?S	64 bit compare/subtract conditions
+   ?t   non-negated compare and branch conditions
+   ?n   32 bit compare and branch conditions followed by nullify
+   ?N   64 bit compare and branch conditions followed by nullify
+   ?Q	64 bit compare and branch conditions for CMPIB instruction
+
+   ?l   logical conditions
+   ?L	64 bit logical conditions
+
+   ?b   branch on bit conditions
+   ?B	64 bit branch on bit conditions
+
+   ?x   shift/extract/deposit conditions
+   ?X	64 bit shift/extract/deposit conditions
+   ?y   shift/extract/deposit conditions followed by nullify for conditional
+        branches
+
+   ?u   unit conditions
+   ?U   64 bit unit conditions
+
+Floating point registers all have 'f' as a prefix:
+
+   ft	target register at 31
+   fT	target register with L/R halves at 31
+   fa	operand 1 register at 10
+   fA   operand 1 register with L/R halves at 10
+   fX   Same as fA, except prints a space before register during disasm
+   fb	operand 2 register at 15
+   fB   operand 2 register with L/R halves at 15
+   fC   operand 3 register with L/R halves at 16:18,21:23
+   fe   Like fT, but encoding is different.
+
+Float registers for fmpyadd and fmpysub:
+
+   fi	mult operand 1 register at 10
+   fj	mult operand 2 register at 15
+   fk	mult target register at 20
+   fl	add/sub operand register at 25
+   fm	add/sub target register at 31
+
 */
 
 
@@ -178,299 +270,562 @@
 static const struct pa_opcode pa_opcodes[] =
 {
 
-
 /* pseudo-instructions */
 
-{ "b",		0xe8000000, 0xffe0e000, "nW", pa10}, /* bl foo,r0 */
-{ "ldi",	0x34000000, 0xffe0c000, "j,x", pa10},	/* ldo val(r0),r */
-{ "comib", 	0x84000000, 0xfc000000, "?n5,b,w", pa10}, /* comib{tf}*/
-{ "comb",	0x80000000, 0xfc000000, "?nx,b,w", pa10}, /* comb{tf} */
-{ "addb",	0xa0000000, 0xfc000000, "@nx,b,w", pa10}, /* addb{tf} */
-{ "addib",	0xa4000000, 0xfc000000, "@n5,b,w", pa10}, /* addib{tf}*/
-{ "nop",        0x08000240, 0xffffffff, "", pa10},      /* or 0,0,0 */
-{ "copy",       0x08000240, 0xffe0ffe0, "x,t", pa10},   /* or r,0,t */
-{ "mtsar",      0x01601840, 0xffe0ffff, "x", pa10}, /* mtctl r,cr11 */
+{ "ldi",	0x34000000, 0xffe0c000, "j,x", pa10, 0},/* ldo val(r0),r */
+
+{ "call",	0xe800f000, 0xfc1ffffd, "n(b)", pa20, FLAG_STRICT},
+{ "call",	0xe800a000, 0xffe0e000, "nW", pa10, FLAG_STRICT},
+{ "ret",	0xe840d000, 0xfffffffd, "n", pa20, FLAG_STRICT},
+
+{ "cmpib", 	0xec000000, 0xfc000000, "?Qn5,b,w", pa20, FLAG_STRICT},
+{ "cmpib", 	0x84000000, 0xf4000000, "?nn5,b,w", pa10, FLAG_STRICT},
+{ "comib", 	0x84000000, 0xfc000000, "?nn5,b,w", pa10, 0}, /* comib{tf}*/
+/* This entry is for the disassembler only.  It will never be used by
+   assembler.  */
+{ "comib", 	0x8c000000, 0xfc000000, "?nn5,b,w", pa10, 0}, /* comib{tf}*/
+{ "cmpb",	0x9c000000, 0xdc000000, "?Nnx,b,w", pa20, FLAG_STRICT},
+{ "cmpb",	0x80000000, 0xf4000000, "?nnx,b,w", pa10, FLAG_STRICT},
+{ "comb",	0x80000000, 0xfc000000, "?nnx,b,w", pa10, 0}, /* comb{tf} */
+/* This entry is for the disassembler only.  It will never be used by
+   assembler.  */
+{ "comb",	0x88000000, 0xfc000000, "?nnx,b,w", pa10, 0}, /* comb{tf} */
+{ "addb",	0xa0000000, 0xf4000000, "?Wnx,b,w", pa20, FLAG_STRICT},
+{ "addb",	0xa0000000, 0xfc000000, "?@nx,b,w", pa10, 0}, /* addb{tf} */
+/* This entry is for the disassembler only.  It will never be used by
+   assembler.  */
+{ "addb",	0xa8000000, 0xfc000000, "?@nx,b,w", pa10, 0},
+{ "addib",	0xa4000000, 0xf4000000, "?Wn5,b,w", pa20, FLAG_STRICT},
+{ "addib",	0xa4000000, 0xfc000000, "?@n5,b,w", pa10, 0}, /* addib{tf}*/
+/* This entry is for the disassembler only.  It will never be used by
+   assembler.  */
+{ "addib",	0xac000000, 0xfc000000, "?@n5,b,w", pa10, 0}, /* addib{tf}*/
+{ "nop",        0x08000240, 0xffffffff, "", pa10, 0},      /* or 0,0,0 */
+{ "copy",       0x08000240, 0xffe0ffe0, "x,t", pa10, 0},   /* or r,0,t */
+{ "mtsar",      0x01601840, 0xffe0ffff, "x", pa10, 0}, /* mtctl r,cr11 */
 
 /* Loads and Stores for integer registers.  */
-{ "ldw",        0x48000000, 0xfc000000, "j(s,b),x", pa10},
-{ "ldw",        0x48000000, 0xfc000000, "j(b),x", pa10},
-{ "ldh",        0x44000000, 0xfc000000, "j(s,b),x", pa10},
-{ "ldh",        0x44000000, 0xfc000000, "j(b),x", pa10},
-{ "ldb",        0x40000000, 0xfc000000, "j(s,b),x", pa10},
-{ "ldb",        0x40000000, 0xfc000000, "j(b),x", pa10},
-{ "stw",        0x68000000, 0xfc000000, "x,j(s,b)", pa10},
-{ "stw",        0x68000000, 0xfc000000, "x,j(b)", pa10},
-{ "sth",        0x64000000, 0xfc000000, "x,j(s,b)", pa10},
-{ "sth",        0x64000000, 0xfc000000, "x,j(b)", pa10},
-{ "stb",        0x60000000, 0xfc000000, "x,j(s,b)", pa10},
-{ "stb",        0x60000000, 0xfc000000, "x,j(b)", pa10},
-{ "ldwm",       0x4c000000, 0xfc000000, "j(s,b),x", pa10},
-{ "ldwm",       0x4c000000, 0xfc000000, "j(b),x", pa10},
-{ "stwm",       0x6c000000, 0xfc000000, "x,j(s,b)", pa10},
-{ "stwm",       0x6c000000, 0xfc000000, "x,j(b)", pa10},
-{ "ldwx",       0x0c000080, 0xfc001fc0, "cx(s,b),t", pa10},
-{ "ldwx",       0x0c000080, 0xfc001fc0, "cx(b),t", pa10},
-{ "ldhx",       0x0c000040, 0xfc001fc0, "cx(s,b),t", pa10},
-{ "ldhx",       0x0c000040, 0xfc001fc0, "cx(b),t", pa10},
-{ "ldbx",       0x0c000000, 0xfc001fc0, "cx(s,b),t", pa10},
-{ "ldbx",       0x0c000000, 0xfc001fc0, "cx(b),t", pa10},
-{ "ldwax",      0x0c000180, 0xfc00dfc0, "cx(b),t", pa10},
-{ "ldcwx",      0x0c0001c0, 0xfc001fc0, "cx(s,b),t", pa10},
-{ "ldcwx",      0x0c0001c0, 0xfc001fc0, "cx(b),t", pa10},
-{ "ldws",	0x0c001080, 0xfc001fc0, "C5(s,b),t", pa10},
-{ "ldws",	0x0c001080, 0xfc001fc0, "C5(b),t", pa10},
-{ "ldhs",	0x0c001040, 0xfc001fc0, "C5(s,b),t", pa10},
-{ "ldhs",	0x0c001040, 0xfc001fc0, "C5(b),t", pa10},
-{ "ldbs",	0x0c001000, 0xfc001fc0, "C5(s,b),t", pa10},
-{ "ldbs",	0x0c001000, 0xfc001fc0, "C5(b),t", pa10},
-{ "ldwas",	0x0c001180, 0xfc00dfc0, "C5(b),t", pa10},
-{ "ldcws",	0x0c0011c0, 0xfc001fc0, "C5(s,b),t", pa10},
-{ "ldcws",	0x0c0011c0, 0xfc001fc0, "C5(b),t", pa10},
-{ "stws",	0x0c001280, 0xfc001fc0, "Cx,V(s,b)", pa10},
-{ "stws",	0x0c001280, 0xfc001fc0, "Cx,V(b)", pa10},
-{ "sths",	0x0c001240, 0xfc001fc0, "Cx,V(s,b)", pa10},
-{ "sths",	0x0c001240, 0xfc001fc0, "Cx,V(b)", pa10},
-{ "stbs",	0x0c001200, 0xfc001fc0, "Cx,V(s,b)", pa10},
-{ "stbs",	0x0c001200, 0xfc001fc0, "Cx,V(b)", pa10},
-{ "stwas",	0x0c001380, 0xfc00dfc0, "Cx,V(b)", pa10},
-{ "stbys",	0x0c001300, 0xfc001fc0, "Yx,V(s,b)", pa10},
-{ "stbys",	0x0c001300, 0xfc001fc0, "Yx,V(b)", pa10},
+
+{ "ldd",	0x0c0010e0, 0xfc1f33e0, "cocc@(s,b),t", pa20, FLAG_STRICT},
+{ "ldd",	0x0c0010e0, 0xfc1f33e0, "cocc@(b),t", pa20, FLAG_STRICT},
+{ "ldd",        0x0c0000c0, 0xfc0013c0, "cxccx(s,b),t", pa20, FLAG_STRICT},
+{ "ldd",        0x0c0000c0, 0xfc0013c0, "cxccx(b),t", pa20, FLAG_STRICT},
+{ "ldd",	0x0c0010c0, 0xfc0013c0, "cmcc5(s,b),t", pa20, FLAG_STRICT},
+{ "ldd",	0x0c0010c0, 0xfc0013c0, "cmcc5(b),t", pa20, FLAG_STRICT},
+{ "ldd",        0x50000000, 0xfc000002, "cq#(s,b),x", pa20, FLAG_STRICT},
+{ "ldd",        0x50000000, 0xfc000002, "cq#(b),x", pa20, FLAG_STRICT},
+{ "ldw",        0x0c000080, 0xfc0013c0, "cxccx(s,b),t", pa10, FLAG_STRICT},
+{ "ldw",        0x0c000080, 0xfc0013c0, "cxccx(b),t", pa10, FLAG_STRICT},
+{ "ldw",	0x0c0010a0, 0xfc1f33e0, "cocc@(s,b),t", pa20, FLAG_STRICT},
+{ "ldw",	0x0c0010a0, 0xfc1f33e0, "cocc@(b),t", pa20, FLAG_STRICT},
+{ "ldw",	0x0c001080, 0xfc0013c0, "cmcc5(s,b),t", pa10, FLAG_STRICT},
+{ "ldw",	0x0c001080, 0xfc0013c0, "cmcc5(b),t", pa10, FLAG_STRICT},
+{ "ldw",        0x4c000000, 0xfc000000, "ceJ(s,b),x", pa10, FLAG_STRICT},
+{ "ldw",        0x4c000000, 0xfc000000, "ceJ(b),x", pa10, FLAG_STRICT},
+{ "ldw",        0x5c000004, 0xfc000006, "ceK(s,b),x", pa20, FLAG_STRICT},
+{ "ldw",        0x5c000004, 0xfc000006, "ceK(b),x", pa20, FLAG_STRICT},
+{ "ldw",        0x48000000, 0xfc000000, "j(s,b),x", pa10, 0},
+{ "ldw",        0x48000000, 0xfc000000, "j(s,b),x", pa10, 0},
+{ "ldw",        0x48000000, 0xfc000000, "j(b),x", pa10, 0},
+{ "ldh",        0x0c000040, 0xfc0013c0, "cxccx(s,b),t", pa10, FLAG_STRICT},
+{ "ldh",        0x0c000040, 0xfc0013c0, "cxccx(b),t", pa10, FLAG_STRICT},
+{ "ldh",	0x0c001060, 0xfc1f33e0, "cocc@(s,b),t", pa20, FLAG_STRICT},
+{ "ldh",	0x0c001060, 0xfc1f33e0, "cocc@(b),t", pa20, FLAG_STRICT},
+{ "ldh",	0x0c001040, 0xfc0013c0, "cmcc5(s,b),t", pa10, FLAG_STRICT},
+{ "ldh",	0x0c001040, 0xfc0013c0, "cmcc5(b),t", pa10, FLAG_STRICT},
+{ "ldh",        0x44000000, 0xfc000000, "j(s,b),x", pa10, 0},
+{ "ldh",        0x44000000, 0xfc000000, "j(b),x", pa10, 0},
+{ "ldb",        0x0c000000, 0xfc0013c0, "cxccx(s,b),t", pa10, FLAG_STRICT},
+{ "ldb",        0x0c000000, 0xfc0013c0, "cxccx(b),t", pa10, FLAG_STRICT},
+{ "ldb",	0x0c001020, 0xfc1f33e0, "cocc@(s,b),t", pa20, FLAG_STRICT},
+{ "ldb",	0x0c001020, 0xfc1f33e0, "cocc@(b),t", pa20, FLAG_STRICT},
+{ "ldb",	0x0c001000, 0xfc0013c0, "cmcc5(s,b),t", pa10, FLAG_STRICT},
+{ "ldb",	0x0c001000, 0xfc0013c0, "cmcc5(b),t", pa10, FLAG_STRICT},
+{ "ldb",        0x40000000, 0xfc000000, "j(s,b),x", pa10, 0},
+{ "ldb",        0x40000000, 0xfc000000, "j(b),x", pa10, 0},
+{ "std",	0x0c0012e0, 0xfc0033ff, "cocCx,@(s,b)", pa20, FLAG_STRICT},
+{ "std",	0x0c0012e0, 0xfc0033ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "std",	0x0c0012c0, 0xfc0013c0, "cmcCx,V(s,b)", pa20, FLAG_STRICT},
+{ "std",	0x0c0012c0, 0xfc0013c0, "cmcCx,V(b)", pa20, FLAG_STRICT},
+{ "std",        0x70000000, 0xfc000002, "cqx,#(s,b)", pa20, FLAG_STRICT},
+{ "std",        0x70000000, 0xfc000002, "cqx,#(b)", pa20, FLAG_STRICT},
+{ "stw",	0x0c0012a0, 0xfc0013ff, "cocCx,@(s,b)", pa20, FLAG_STRICT},
+{ "stw",	0x0c0012a0, 0xfc0013ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "stw",	0x0c001280, 0xfc0013c0, "cmcCx,V(s,b)", pa10, FLAG_STRICT},
+{ "stw",	0x0c001280, 0xfc0013c0, "cmcCx,V(b)", pa10, FLAG_STRICT},
+{ "stw",        0x6c000000, 0xfc000000, "cex,J(s,b)", pa10, FLAG_STRICT},
+{ "stw",        0x6c000000, 0xfc000000, "cex,J(b)", pa10, FLAG_STRICT},
+{ "stw",        0x7c000004, 0xfc000006, "cex,K(s,b)", pa20, FLAG_STRICT},
+{ "stw",        0x7c000004, 0xfc000006, "cex,K(b)", pa20, FLAG_STRICT},
+{ "stw",        0x68000000, 0xfc000000, "x,j(s,b)", pa10, 0},
+{ "stw",        0x68000000, 0xfc000000, "x,j(b)", pa10, 0},
+{ "sth",	0x0c001260, 0xfc0033ff, "cocCx,@(s,b)", pa20, FLAG_STRICT},
+{ "sth",	0x0c001260, 0xfc0033ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "sth",	0x0c001240, 0xfc0013c0, "cmcCx,V(s,b)", pa10, FLAG_STRICT},
+{ "sth",	0x0c001240, 0xfc0013c0, "cmcCx,V(b)", pa10, FLAG_STRICT},
+{ "sth",        0x64000000, 0xfc000000, "x,j(s,b)", pa10, 0},
+{ "sth",        0x64000000, 0xfc000000, "x,j(b)", pa10, 0},
+{ "stb",	0x0c001220, 0xfc0033ff, "cocCx,@(s,b)", pa20, FLAG_STRICT},
+{ "stb",	0x0c001220, 0xfc0033ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "stb",	0x0c001200, 0xfc0013c0, "cmcCx,V(s,b)", pa10, FLAG_STRICT},
+{ "stb",	0x0c001200, 0xfc0013c0, "cmcCx,V(b)", pa10, FLAG_STRICT},
+{ "stb",        0x60000000, 0xfc000000, "x,j(s,b)", pa10, 0},
+{ "stb",        0x60000000, 0xfc000000, "x,j(b)", pa10, 0},
+{ "ldwm",       0x4c000000, 0xfc000000, "j(s,b),x", pa10, 0},
+{ "ldwm",       0x4c000000, 0xfc000000, "j(b),x", pa10, 0},
+{ "stwm",       0x6c000000, 0xfc000000, "x,j(s,b)", pa10, 0},
+{ "stwm",       0x6c000000, 0xfc000000, "x,j(b)", pa10, 0},
+{ "ldwx",       0x0c000080, 0xfc001fc0, "cxx(s,b),t", pa10, 0},
+{ "ldwx",       0x0c000080, 0xfc001fc0, "cxx(b),t", pa10, 0},
+{ "ldhx",       0x0c000040, 0xfc001fc0, "cxx(s,b),t", pa10, 0},
+{ "ldhx",       0x0c000040, 0xfc001fc0, "cxx(b),t", pa10, 0},
+{ "ldbx",       0x0c000000, 0xfc001fc0, "cxx(s,b),t", pa10, 0},
+{ "ldbx",       0x0c000000, 0xfc001fc0, "cxx(b),t", pa10, 0},
+{ "ldwa",       0x0c000180, 0xfc00d3c0, "cxccx(b),t", pa10, FLAG_STRICT},
+{ "ldwa",	0x0c001180, 0xfc00d3c0, "cmcc5(b),t", pa10, FLAG_STRICT},
+{ "ldcw",       0x0c0001c0, 0xfc0013c0, "cxcdx(s,b),t", pa10, FLAG_STRICT},
+{ "ldcw",       0x0c0001c0, 0xfc0013c0, "cxcdx(b),t", pa10, FLAG_STRICT},
+{ "ldcw",	0x0c0011c0, 0xfc0013c0, "cmcd5(s,b),t", pa10, FLAG_STRICT},
+{ "ldcw",	0x0c0011c0, 0xfc0013c0, "cmcd5(b),t", pa10, FLAG_STRICT},
+{ "stwa",	0x0c0013a0, 0xfc00d3ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "stwa",	0x0c001380, 0xfc00d3c0, "cmcCx,V(b)", pa10, FLAG_STRICT},
+{ "stby",	0x0c001300, 0xfc0013c0, "cscCx,V(s,b)", pa10, FLAG_STRICT},
+{ "stby",	0x0c001300, 0xfc0013c0, "cscCx,V(b)", pa10, FLAG_STRICT},
+{ "ldda",       0x0c000100, 0xfc00d3c0, "cxccx(b),t", pa20, FLAG_STRICT},
+{ "ldda",	0x0c001100, 0xfc00d3c0, "cmcc5(b),t", pa20, FLAG_STRICT},
+{ "ldcd",       0x0c000140, 0xfc0013c0, "cxcdx(s,b),t", pa20, FLAG_STRICT},
+{ "ldcd",       0x0c000140, 0xfc0013c0, "cxcdx(b),t", pa20, FLAG_STRICT},
+{ "ldcd",	0x0c001140, 0xfc0013c0, "cmcd5(s,b),t", pa20, FLAG_STRICT},
+{ "ldcd",	0x0c001140, 0xfc0013c0, "cmcd5(b),t", pa20, FLAG_STRICT},
+{ "stda",	0x0c0013e0, 0xfc0033ff, "cocCx,@(s,b)", pa20, FLAG_STRICT},
+{ "stda",	0x0c0013e0, 0xfc0033ff, "cocCx,@(b)", pa20, FLAG_STRICT},
+{ "stda",	0x0c0013c0, 0xfc0013c0, "cmcCx,V(s,b)", pa20, FLAG_STRICT},
+{ "stda",	0x0c0013c0, 0xfc0013c0, "cmcCx,V(b)", pa20, FLAG_STRICT},
+{ "ldwax",      0x0c000180, 0xfc00dfc0, "cxx(b),t", pa10, 0},
+{ "ldcwx",      0x0c0001c0, 0xfc001fc0, "cxx(s,b),t", pa10, 0},
+{ "ldcwx",      0x0c0001c0, 0xfc001fc0, "cxx(b),t", pa10, 0},
+{ "ldws",	0x0c001080, 0xfc001fc0, "cm5(s,b),t", pa10, 0},
+{ "ldws",	0x0c001080, 0xfc001fc0, "cm5(b),t", pa10, 0},
+{ "ldhs",	0x0c001040, 0xfc001fc0, "cm5(s,b),t", pa10, 0},
+{ "ldhs",	0x0c001040, 0xfc001fc0, "cm5(b),t", pa10, 0},
+{ "ldbs",	0x0c001000, 0xfc001fc0, "cm5(s,b),t", pa10, 0},
+{ "ldbs",	0x0c001000, 0xfc001fc0, "cm5(b),t", pa10, 0},
+{ "ldwas",	0x0c001180, 0xfc00dfc0, "cm5(b),t", pa10, 0},
+{ "ldcws",	0x0c0011c0, 0xfc001fc0, "cm5(s,b),t", pa10, 0},
+{ "ldcws",	0x0c0011c0, 0xfc001fc0, "cm5(b),t", pa10, 0},
+{ "stws",	0x0c001280, 0xfc001fc0, "cmx,V(s,b)", pa10, 0},
+{ "stws",	0x0c001280, 0xfc001fc0, "cmx,V(b)", pa10, 0},
+{ "sths",	0x0c001240, 0xfc001fc0, "cmx,V(s,b)", pa10, 0},
+{ "sths",	0x0c001240, 0xfc001fc0, "cmx,V(b)", pa10, 0},
+{ "stbs",	0x0c001200, 0xfc001fc0, "cmx,V(s,b)", pa10, 0},
+{ "stbs",	0x0c001200, 0xfc001fc0, "cmx,V(b)", pa10, 0},
+{ "stwas",	0x0c001380, 0xfc00dfc0, "cmx,V(b)", pa10, 0},
+{ "stdby",	0x0c001340, 0xfc0013c0, "cscCx,V(s,b)", pa20, FLAG_STRICT},
+{ "stdby",	0x0c001340, 0xfc0013c0, "cscCx,V(b)", pa20, FLAG_STRICT},
+{ "stbys",	0x0c001300, 0xfc001fc0, "csx,V(s,b)", pa10, 0},
+{ "stbys",	0x0c001300, 0xfc001fc0, "csx,V(b)", pa10, 0},
 
 /* Immediate instructions.  */
-{ "ldo",	0x34000000, 0xfc00c000, "j(b),x", pa10},
-{ "ldil",	0x20000000, 0xfc000000, "k,b", pa10},
-{ "addil",	0x28000000, 0xfc000000, "k,b", pa10},
+{ "ldo",	0x34000000, 0xfc00c000, "j(b),x", pa10, 0},
+{ "ldil",	0x20000000, 0xfc000000, "k,b", pa10, 0},
+{ "addil",	0x28000000, 0xfc000000, "k,b,Z", pa10, 0},
+{ "addil",	0x28000000, 0xfc000000, "k,b", pa10, 0},
 
 /* Branching instructions. */
-{ "bl",		0xe8000000, 0xfc00e000, "nW,b", pa10},
-{ "gate",	0xe8002000, 0xfc00e000, "nW,b", pa10},
-{ "blr",	0xe8004000, 0xfc00e001, "nx,b", pa10},
-{ "bv",		0xe800c000, 0xfc00fffd, "nx(b)", pa10},
-{ "bv",		0xe800c000, 0xfc00fffd, "n(b)", pa10},
-{ "be",		0xe0000000, 0xfc000000, "nz(S,b)", pa10},
-{ "ble",	0xe4000000, 0xfc000000, "nz(S,b)", pa10},
-{ "movb",	0xc8000000, 0xfc000000, "|nx,b,w", pa10},
-{ "movib",	0xcc000000, 0xfc000000, "|n5,b,w", pa10},
-{ "combt",	0x80000000, 0xfc000000, "<nx,b,w", pa10},
-{ "combf",	0x88000000, 0xfc000000, "<nx,b,w", pa10},
-{ "comibt",	0x84000000, 0xfc000000, "<n5,b,w", pa10},
-{ "comibf",	0x8c000000, 0xfc000000, "<n5,b,w", pa10},
-{ "addbt",	0xa0000000, 0xfc000000, "!nx,b,w", pa10},
-{ "addbf",	0xa8000000, 0xfc000000, "!nx,b,w", pa10},
-{ "addibt",	0xa4000000, 0xfc000000, "!n5,b,w", pa10},
-{ "addibf",	0xac000000, 0xfc000000, "!n5,b,w", pa10},
-{ "bb",		0xc4004000, 0xfc004000, "~nx,Q,w", pa10}, 
-{ "bvb",	0xc0004000, 0xffe04000, "~nx,w", pa10},
+{ "b",		0xe8008000, 0xfc00e000, "cpnXL", pa20, FLAG_STRICT},
+{ "b",		0xe800a000, 0xfc00e000, "clnXL", pa20, FLAG_STRICT},
+{ "b",		0xe8000000, 0xfc00e000, "clnW,b", pa10, FLAG_STRICT},
+{ "b",		0xe8002000, 0xfc00e000, "cgnW,b", pa10, FLAG_STRICT},
+{ "b",		0xe8000000, 0xffe0e000, "nW", pa10, 0},  /* b,l foo,r0 */
+{ "bl",		0xe8000000, 0xfc00e000, "nW,b", pa10, 0},
+{ "gate",	0xe8002000, 0xfc00e000, "nW,b", pa10, 0},
+{ "blr",	0xe8004000, 0xfc00e001, "nx,b", pa10, 0},
+{ "bv",		0xe800c000, 0xfc00fffd, "nx(b)", pa10, 0},
+{ "bv",		0xe800c000, 0xfc00fffd, "n(b)", pa10, 0},
+{ "bve",	0xe800f001, 0xfc1ffffd, "cpn(b)L", pa20, FLAG_STRICT},
+{ "bve",	0xe800f000, 0xfc1ffffd, "cln(b)L", pa20, FLAG_STRICT},
+{ "bve",	0xe800d001, 0xfc1ffffd, "cPn(b)", pa20, FLAG_STRICT},
+{ "bve",	0xe800d000, 0xfc1ffffd, "n(b)", pa20, FLAG_STRICT},
+{ "be",		0xe4000000, 0xfc000000, "clnz(S,b),Y", pa10, FLAG_STRICT},
+{ "be",		0xe4000000, 0xfc000000, "clnz(b),Y", pa10, FLAG_STRICT},
+{ "be",		0xe0000000, 0xfc000000, "nz(S,b)", pa10, 0},
+{ "be",		0xe0000000, 0xfc000000, "nz(b)", pa10, 0},
+{ "ble",	0xe4000000, 0xfc000000, "nz(S,b)", pa10, 0},
+{ "movb",	0xc8000000, 0xfc000000, "?ynx,b,w", pa10, 0},
+{ "movib",	0xcc000000, 0xfc000000, "?yn5,b,w", pa10, 0},
+{ "combt",	0x80000000, 0xfc000000, "?tnx,b,w", pa10, 0},
+{ "combf",	0x88000000, 0xfc000000, "?tnx,b,w", pa10, 0},
+{ "comibt",	0x84000000, 0xfc000000, "?tn5,b,w", pa10, 0},
+{ "comibf",	0x8c000000, 0xfc000000, "?tn5,b,w", pa10, 0},
+{ "addbt",	0xa0000000, 0xfc000000, "?dnx,b,w", pa10, 0},
+{ "addbf",	0xa8000000, 0xfc000000, "?dnx,b,w", pa10, 0},
+{ "addibt",	0xa4000000, 0xfc000000, "?dn5,b,w", pa10, 0},
+{ "addibf",	0xac000000, 0xfc000000, "?dn5,b,w", pa10, 0},
+{ "bb",		0xc0006000, 0xffe06000, "?Bnx,!,w", pa20, FLAG_STRICT}, 
+{ "bb",		0xc4004000, 0xfc004000, "?Bnx,B,w", pa20, FLAG_STRICT}, 
+{ "bb",		0xc0004000, 0xffe06000, "?bnx,!,w", pa10, FLAG_STRICT}, 
+{ "bb",		0xc4004000, 0xfc004000, "?bnx,Q,w", pa10, 0}, 
+{ "bvb",	0xc0004000, 0xffe04000, "?bnx,w", pa10, 0},
+{ "clrbts",	0xe8004005, 0xffffffff, "", pa20, FLAG_STRICT},
+{ "popbts",	0xe8004005, 0xfffff007, "$", pa20, FLAG_STRICT},
+{ "pushnom",	0xe8004001, 0xffffffff, "", pa20, FLAG_STRICT},
+{ "pushbts",	0xe8004001, 0xffe0ffff, "x", pa20, FLAG_STRICT},
 
 /* Computation Instructions */
 
-{ "add",        0x08000600, 0xfc000fe0, "dx,b,t", pa10},
-{ "addl",       0x08000a00, 0xfc000fe0, "dx,b,t", pa10},
-{ "addo",       0x08000e00, 0xfc000fe0, "dx,b,t", pa10},
-{ "addc",       0x08000700, 0xfc000fe0, "dx,b,t", pa10},
-{ "addco",      0x08000f00, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh1add",     0x08000640, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh1addl",    0x08000a40, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh1addo",    0x08000e40, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh2add",     0x08000680, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh2addl",    0x08000a80, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh2addo",    0x08000e80, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh3add",     0x080006c0, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh3addl",    0x08000ac0, 0xfc000fe0, "dx,b,t", pa10},
-{ "sh3addo",    0x08000ec0, 0xfc000fe0, "dx,b,t", pa10},
-{ "sub",        0x08000400, 0xfc000fe0, "ax,b,t", pa10},
-{ "subo",       0x08000c00, 0xfc000fe0, "ax,b,t", pa10},
-{ "subb",       0x08000500, 0xfc000fe0, "ax,b,t", pa10},
-{ "subbo",      0x08000d00, 0xfc000fe0, "ax,b,t", pa10},
-{ "subt",       0x080004c0, 0xfc000fe0, "ax,b,t", pa10},
-{ "subto",      0x08000cc0, 0xfc000fe0, "ax,b,t", pa10},
-{ "ds",         0x08000440, 0xfc000fe0, "ax,b,t", pa10},
-{ "comclr",     0x08000880, 0xfc000fe0, "ax,b,t", pa10},
-{ "or",         0x08000240, 0xfc000fe0, "&x,b,t", pa10},
-{ "xor",        0x08000280, 0xfc000fe0, "&x,b,t", pa10},
-{ "and",        0x08000200, 0xfc000fe0, "&x,b,t", pa10},
-{ "andcm",      0x08000000, 0xfc000fe0, "&x,b,t", pa10},
-{ "uxor",       0x08000380, 0xfc000fe0, "Ux,b,t", pa10},
-{ "uaddcm",     0x08000980, 0xfc000fe0, "Ux,b,t", pa10},
-{ "uaddcmt",    0x080009c0, 0xfc000fe0, "Ux,b,t", pa10},
-{ "dcor",       0x08000b80, 0xfc1f0fe0, "Ub,t",   pa10},
-{ "idcor",      0x08000bc0, 0xfc1f0fe0, "Ub,t",   pa10},
-{ "addi",       0xb4000000, 0xfc000800, "di,b,x", pa10},
-{ "addio",      0xb4000800, 0xfc000800, "di,b,x", pa10},
-{ "addit",      0xb0000000, 0xfc000800, "di,b,x", pa10},
-{ "addito",     0xb0000800, 0xfc000800, "di,b,x", pa10},
-{ "subi",       0x94000000, 0xfc000800, "ai,b,x", pa10},
-{ "subio",      0x94000800, 0xfc000800, "ai,b,x", pa10},
-{ "comiclr",    0x90000000, 0xfc000800, "ai,b,x", pa10},
+{ "cmpclr",     0x080008a0, 0xfc000fe0, "?Sx,b,t", pa20, FLAG_STRICT},
+{ "cmpclr",     0x08000880, 0xfc000fe0, "?sx,b,t", pa10, FLAG_STRICT},
+{ "comclr",     0x08000880, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "or",         0x08000260, 0xfc000fe0, "?Lx,b,t", pa20, FLAG_STRICT},
+{ "or",         0x08000240, 0xfc000fe0, "?lx,b,t", pa10, 0},
+{ "xor",        0x080002a0, 0xfc000fe0, "?Lx,b,t", pa20, FLAG_STRICT},
+{ "xor",        0x08000280, 0xfc000fe0, "?lx,b,t", pa10, 0},
+{ "and",        0x08000220, 0xfc000fe0, "?Lx,b,t", pa20, FLAG_STRICT},
+{ "and",        0x08000200, 0xfc000fe0, "?lx,b,t", pa10, 0},
+{ "andcm",      0x08000020, 0xfc000fe0, "?Lx,b,t", pa20, FLAG_STRICT},
+{ "andcm",      0x08000000, 0xfc000fe0, "?lx,b,t", pa10, 0},
+{ "uxor",       0x080003a0, 0xfc000fe0, "?Ux,b,t", pa20, FLAG_STRICT},
+{ "uxor",       0x08000380, 0xfc000fe0, "?ux,b,t", pa10, 0},
+{ "uaddcm",     0x080009a0, 0xfc000fa0, "cT?Ux,b,t", pa20, FLAG_STRICT},
+{ "uaddcm",     0x08000980, 0xfc000fa0, "cT?ux,b,t", pa10, FLAG_STRICT},
+{ "uaddcm",     0x08000980, 0xfc000fe0, "?ux,b,t", pa10, 0},
+{ "uaddcmt",    0x080009c0, 0xfc000fe0, "?ux,b,t", pa10, 0},
+{ "dcor",       0x08000ba0, 0xfc1f0fa0, "ci?Ub,t", pa20, FLAG_STRICT},
+{ "dcor",       0x08000b80, 0xfc1f0fa0, "ci?ub,t", pa10, FLAG_STRICT},
+{ "dcor",       0x08000b80, 0xfc1f0fe0, "?ub,t",   pa10, 0},
+{ "idcor",      0x08000bc0, 0xfc1f0fe0, "?ub,t",   pa10, 0},
+{ "addi",       0xb0000000, 0xfc000000, "ct?ai,b,x", pa10, FLAG_STRICT},
+{ "addi",       0xb4000000, 0xfc000000, "cv?ai,b,x", pa10, FLAG_STRICT},
+{ "addi",       0xb4000000, 0xfc000800, "?ai,b,x", pa10, 0},
+{ "addio",      0xb4000800, 0xfc000800, "?ai,b,x", pa10, 0},
+{ "addit",      0xb0000000, 0xfc000800, "?ai,b,x", pa10, 0},
+{ "addito",     0xb0000800, 0xfc000800, "?ai,b,x", pa10, 0},
+{ "add",        0x08000720, 0xfc0007e0, "cY?Ax,b,t", pa20, FLAG_STRICT},
+{ "add",        0x08000700, 0xfc0007e0, "cy?ax,b,t", pa10, FLAG_STRICT},
+{ "add",        0x08000220, 0xfc0003e0, "ca?Ax,b,t", pa20, FLAG_STRICT},
+{ "add",        0x08000200, 0xfc0003e0, "ca?ax,b,t", pa10, FLAG_STRICT},
+{ "add",        0x08000600, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "addl",       0x08000a00, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "addo",       0x08000e00, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "addc",       0x08000700, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "addco",      0x08000f00, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sub",        0x080004e0, 0xfc0007e0, "ct?Sx,b,t", pa20, FLAG_STRICT},
+{ "sub",        0x080004c0, 0xfc0007e0, "ct?sx,b,t", pa10, FLAG_STRICT},
+{ "sub",        0x08000520, 0xfc0007e0, "cB?Sx,b,t", pa20, FLAG_STRICT},
+{ "sub",        0x08000500, 0xfc0007e0, "cb?sx,b,t", pa10, FLAG_STRICT},
+{ "sub",        0x08000420, 0xfc0007e0, "cv?Sx,b,t", pa20, FLAG_STRICT},
+{ "sub",        0x08000400, 0xfc0007e0, "cv?sx,b,t", pa10, FLAG_STRICT},
+{ "sub",        0x08000400, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subo",       0x08000c00, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subb",       0x08000500, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subbo",      0x08000d00, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subt",       0x080004c0, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subto",      0x08000cc0, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "ds",         0x08000440, 0xfc000fe0, "?sx,b,t", pa10, 0},
+{ "subi",       0x94000000, 0xfc000000, "cv?si,b,x", pa10, FLAG_STRICT},
+{ "subi",       0x94000000, 0xfc000800, "?si,b,x", pa10, 0},
+{ "subio",      0x94000800, 0xfc000800, "?si,b,x", pa10, 0},
+{ "cmpiclr",    0x90000800, 0xfc000800, "?Si,b,x", pa20, FLAG_STRICT},
+{ "cmpiclr",    0x90000000, 0xfc000800, "?si,b,x", pa10, FLAG_STRICT},
+{ "comiclr",    0x90000000, 0xfc000800, "?si,b,x", pa10, 0},
+{ "shladd",     0x08000220, 0xfc000320, "ca?Ax,.,b,t", pa20, FLAG_STRICT},
+{ "shladd",     0x08000200, 0xfc000320, "ca?ax,.,b,t", pa10, FLAG_STRICT},
+{ "sh1add",     0x08000640, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh1addl",    0x08000a40, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh1addo",    0x08000e40, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh2add",     0x08000680, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh2addl",    0x08000a80, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh2addo",    0x08000e80, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh3add",     0x080006c0, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh3addl",    0x08000ac0, 0xfc000fe0, "?ax,b,t", pa10, 0},
+{ "sh3addo",    0x08000ec0, 0xfc000fe0, "?ax,b,t", pa10, 0},
+
+/* Subword Operation Instructions */
+
+{ "hadd",       0x08000300, 0xfc00ff20, "cHx,b,t", pa20, FLAG_STRICT},
+{ "havg",       0x080002c0, 0xfc00ffe0, "x,b,t", pa20, FLAG_STRICT},
+{ "hshl",       0xf8008800, 0xffe0fc20, "x,*,t", pa20, FLAG_STRICT},
+{ "hshladd",    0x08000700, 0xfc00ff20, "x,.,b,t", pa20, FLAG_STRICT},
+{ "hshr",       0xf800c800, 0xfc1ff820, "cSb,*,t", pa20, FLAG_STRICT},
+{ "hshradd",    0x08000500, 0xfc00ff20, "x,.,b,t", pa20, FLAG_STRICT},
+{ "hsub",       0x08000100, 0xfc00ff20, "cHx,b,t", pa20, FLAG_STRICT},
+{ "mixh",       0xf8008400, 0xfc009fe0, "chx,b,t", pa20, FLAG_STRICT},
+{ "mixw",       0xf8008000, 0xfc009fe0, "chx,b,t", pa20, FLAG_STRICT},
+{ "permh",      0xf8000000, 0xfc009020, "c*a,t", pa20, FLAG_STRICT},
+
 
 /* Extract and Deposit Instructions */
 
-{ "vshd",       0xd0000000, 0xfc001fe0, ">x,b,t", pa10},
-{ "shd",        0xd0000800, 0xfc001c00, ">x,b,p,t", pa10},
-{ "vextru",     0xd0001000, 0xfc001fe0, ">b,T,x", pa10},
-{ "vextrs",     0xd0001400, 0xfc001fe0, ">b,T,x", pa10},
-{ "extru",      0xd0001800, 0xfc001c00, ">b,P,T,x", pa10},
-{ "extrs",      0xd0001c00, 0xfc001c00, ">b,P,T,x", pa10},
-{ "zvdep",      0xd4000000, 0xfc001fe0, ">x,T,b", pa10},
-{ "vdep",       0xd4000400, 0xfc001fe0, ">x,T,b", pa10},
-{ "zdep",       0xd4000800, 0xfc001c00, ">x,p,T,b", pa10},
-{ "dep",        0xd4000c00, 0xfc001c00, ">x,p,T,b", pa10},
-{ "zvdepi",     0xd4001000, 0xfc001fe0, ">5,T,b", pa10},
-{ "vdepi",      0xd4001400, 0xfc001fe0, ">5,T,b", pa10},
-{ "zdepi",      0xd4001800, 0xfc001c00, ">5,p,T,b", pa10},
-{ "depi",       0xd4001c00, 0xfc001c00, ">5,p,T,b", pa10},
+{ "shrpd",      0xd0000200, 0xfc001fe0, "?Xx,b,!,t", pa20, FLAG_STRICT},
+{ "shrpd",      0xd0000400, 0xfc001400, "?Xx,b,~,t", pa20, FLAG_STRICT},
+{ "shrpw",      0xd0000000, 0xfc001fe0, "?xx,b,!,t", pa10, FLAG_STRICT},
+{ "shrpw",      0xd0000800, 0xfc001c00, "?xx,b,p,t", pa10, FLAG_STRICT},
+{ "vshd",       0xd0000000, 0xfc001fe0, "?xx,b,t", pa10, 0},
+{ "shd",        0xd0000800, 0xfc001c00, "?xx,b,p,t", pa10, 0},
+{ "extrd",      0xd0001200, 0xfc001ae0, "cS?Xb,!,%,x", pa20, FLAG_STRICT},
+{ "extrd",      0xd8000000, 0xfc000000, "cS?Xb,q,|,x", pa20, FLAG_STRICT},
+{ "extrw",      0xd0001000, 0xfc001be0, "cS?xb,!,T,x", pa10, FLAG_STRICT},
+{ "extrw",      0xd0001800, 0xfc001800, "cS?xb,P,T,x", pa10, FLAG_STRICT},
+{ "vextru",     0xd0001000, 0xfc001fe0, "?xb,T,x", pa10, 0},
+{ "vextrs",     0xd0001400, 0xfc001fe0, "?xb,T,x", pa10, 0},
+{ "extru",      0xd0001800, 0xfc001c00, "?xb,P,T,x", pa10, 0},
+{ "extrs",      0xd0001c00, 0xfc001c00, "?xb,P,T,x", pa10, 0},
+{ "depd",       0xd4000200, 0xfc001ae0, "cz?Xx,!,%,b", pa20, FLAG_STRICT},
+{ "depd",       0xf0000000, 0xfc000000, "cz?Xx,~,|,b", pa20, FLAG_STRICT},
+{ "depdi",      0xd4001200, 0xfc001ae0, "cz?X5,!,%,b", pa20, FLAG_STRICT},
+{ "depdi",      0xf4000000, 0xfc000000, "cz?X5,~,|,b", pa20, FLAG_STRICT},
+{ "depw",       0xd4000000, 0xfc001be0, "cz?xx,!,T,b", pa10, FLAG_STRICT},
+{ "depw",       0xd4000800, 0xfc001800, "cz?xx,p,T,b", pa10, FLAG_STRICT},
+{ "depwi",      0xd4001000, 0xfc001be0, "cz?x5,!,T,b", pa10, FLAG_STRICT},
+{ "depwi",      0xd4001800, 0xfc001800, "cz?x5,p,T,b", pa10, FLAG_STRICT},
+{ "zvdep",      0xd4000000, 0xfc001fe0, "?xx,T,b", pa10, 0},
+{ "vdep",       0xd4000400, 0xfc001fe0, "?xx,T,b", pa10, 0},
+{ "zdep",       0xd4000800, 0xfc001c00, "?xx,p,T,b", pa10, 0},
+{ "dep",        0xd4000c00, 0xfc001c00, "?xx,p,T,b", pa10, 0},
+{ "zvdepi",     0xd4001000, 0xfc001fe0, "?x5,T,b", pa10, 0},
+{ "vdepi",      0xd4001400, 0xfc001fe0, "?x5,T,b", pa10, 0},
+{ "zdepi",      0xd4001800, 0xfc001c00, "?x5,p,T,b", pa10, 0},
+{ "depi",       0xd4001c00, 0xfc001c00, "?x5,p,T,b", pa10, 0},
 
 /* System Control Instructions */
 
-{ "break",      0x00000000, 0xfc001fe0, "r,A", pa10},
-{ "rfi",        0x00000c00, 0xffffffff, "", pa10},
-{ "rfir",       0x00000ca0, 0xffffffff, "", pa11},
-{ "ssm",        0x00000d60, 0xffe0ffe0, "R,t", pa10},
-{ "rsm",        0x00000e60, 0xffe0ffe0, "R,t", pa10},
-{ "mtsm",       0x00001860, 0xffe0ffff, "x", pa10},
-{ "ldsid",      0x000010a0, 0xfc1f3fe0, "(s,b),t", pa10},
-{ "ldsid",      0x000010a0, 0xfc1f3fe0, "(b),t", pa10},
-{ "mtsp",       0x00001820, 0xffe01fff, "x,S", pa10},
-{ "mtctl",      0x00001840, 0xfc00ffff, "x,^", pa10},
-{ "mfsp",       0x000004a0, 0xffff1fe0, "S,t", pa10},
-{ "mfctl",      0x000008a0, 0xfc1fffe0, "^,t", pa10},
-{ "sync",       0x00000400, 0xffffffff, "", pa10},
-{ "syncdma",    0x00100400, 0xffffffff, "", pa10},
-{ "prober",     0x04001180, 0xfc003fe0, "(s,b),x,t", pa10},
-{ "prober",     0x04001180, 0xfc003fe0, "(b),x,t", pa10},
-{ "proberi",    0x04003180, 0xfc003fe0, "(s,b),R,t", pa10},
-{ "proberi",    0x04003180, 0xfc003fe0, "(b),R,t", pa10},
-{ "probew",     0x040011c0, 0xfc003fe0, "(s,b),x,t", pa10},
-{ "probew",     0x040011c0, 0xfc003fe0, "(b),x,t", pa10},
-{ "probewi",    0x040031c0, 0xfc003fe0, "(s,b),R,t", pa10},
-{ "probewi",    0x040031c0, 0xfc003fe0, "(b),R,t", pa10},
-{ "lpa",        0x04001340, 0xfc003fc0, "Zx(s,b),t", pa10},
-{ "lpa",        0x04001340, 0xfc003fc0, "Zx(b),t", pa10},
-{ "lha",        0x04001300, 0xfc003fc0, "Zx(s,b),t", pa10},
-{ "lha",        0x04001300, 0xfc003fc0, "Zx(b),t", pa10},
-{ "lci",        0x04001300, 0xfc003fe0, "x(s,b),t", pa10},
-{ "lci",        0x04001300, 0xfc003fe0, "x(b),t", pa10},
-{ "pdtlb",      0x04001200, 0xfc003fdf, "Zx(s,b)", pa10},
-{ "pdtlb",      0x04001200, 0xfc003fdf, "Zx(b)", pa10},
-{ "pitlb",      0x04000200, 0xfc001fdf, "Zx(S,b)", pa10},
-{ "pitlb",      0x04000200, 0xfc001fdf, "Zx(b)", pa10},
-{ "pdtlbe",     0x04001240, 0xfc003fdf, "Zx(s,b)", pa10},
-{ "pdtlbe",     0x04001240, 0xfc003fdf, "Zx(b)", pa10},
-{ "pitlbe",     0x04000240, 0xfc001fdf, "Zx(S,b)", pa10},
-{ "pitlbe",     0x04000240, 0xfc001fdf, "Zx(b)", pa10},
-{ "idtlba",     0x04001040, 0xfc003fff, "x,(s,b)", pa10},
-{ "idtlba",     0x04001040, 0xfc003fff, "x,(b)", pa10},
-{ "iitlba",     0x04000040, 0xfc001fff, "x,(S,b)", pa10},
-{ "iitlba",     0x04000040, 0xfc001fff, "x,(b)", pa10},
-{ "idtlbp",     0x04001000, 0xfc003fff, "x,(s,b)", pa10},
-{ "idtlbp",     0x04001000, 0xfc003fff, "x,(b)", pa10},
-{ "iitlbp",     0x04000000, 0xfc001fff, "x,(S,b)", pa10},
-{ "iitlbp",     0x04000000, 0xfc001fff, "x,(b)", pa10},
-{ "pdc",        0x04001380, 0xfc003fdf, "Zx(s,b)", pa10},
-{ "pdc",        0x04001380, 0xfc003fdf, "Zx(b)", pa10},
-{ "fdc",        0x04001280, 0xfc003fdf, "Zx(s,b)", pa10},
-{ "fdc",        0x04001280, 0xfc003fdf, "Zx(b)", pa10},
-{ "fic",        0x04000280, 0xfc001fdf, "Zx(S,b)", pa10},
-{ "fic",        0x04000280, 0xfc001fdf, "Zx(b)", pa10},
-{ "fdce",       0x040012c0, 0xfc003fdf, "Zx(s,b)", pa10},
-{ "fdce",       0x040012c0, 0xfc003fdf, "Zx(b)", pa10},
-{ "fice",       0x040002c0, 0xfc001fdf, "Zx(S,b)", pa10},
-{ "fice",       0x040002c0, 0xfc001fdf, "Zx(b)", pa10},
-{ "diag",       0x14000000, 0xfc000000, "D", pa10},
+{ "break",      0x00000000, 0xfc001fe0, "r,A", pa10, 0},
+{ "rfi",        0x00000c00, 0xffffff1f, "cr", pa10, FLAG_STRICT},
+{ "rfi",        0x00000c00, 0xffffffff, "", pa10, 0},
+{ "rfir",       0x00000ca0, 0xffffffff, "", pa11, 0},
+{ "ssm",        0x00000d60, 0xfc00ffe0, "U,t", pa20, FLAG_STRICT},
+{ "ssm",        0x00000d60, 0xffe0ffe0, "R,t", pa10, 0},
+{ "rsm",        0x00000e60, 0xfc00ffe0, "U,t", pa20, FLAG_STRICT},
+{ "rsm",        0x00000e60, 0xffe0ffe0, "R,t", pa10, 0},
+{ "mtsm",       0x00001860, 0xffe0ffff, "x", pa10, 0},
+{ "ldsid",      0x000010a0, 0xfc1f3fe0, "(s,b),t", pa10, 0},
+{ "ldsid",      0x000010a0, 0xfc1f3fe0, "(b),t", pa10, 0},
+{ "mtsp",       0x00001820, 0xffe01fff, "x,S", pa10, 0},
+{ "mtctl",      0x00001840, 0xfc00ffff, "x,^", pa10, 0},
+{ "mtsarcm",    0x016018C0, 0xffe0ffff, "x", pa20, FLAG_STRICT},
+{ "mfia",       0x000014A0, 0xffffffe0, "t", pa20, FLAG_STRICT},
+{ "mfsp",       0x000004a0, 0xffff1fe0, "S,t", pa10, 0},
+{ "mfctl",      0x016048a0, 0xffffffe0, "cW!,t", pa20, FLAG_STRICT},
+{ "mfctl",      0x000008a0, 0xfc1fffe0, "^,t", pa10, 0},
+{ "sync",       0x00000400, 0xffffffff, "", pa10, 0},
+{ "syncdma",    0x00100400, 0xffffffff, "", pa10, 0},
+{ "probe",      0x04001180, 0xfc003fa0, "cw(s,b),x,t", pa10, FLAG_STRICT},
+{ "probe",      0x04001180, 0xfc003fa0, "cw(b),x,t", pa10, FLAG_STRICT},
+{ "probei",     0x04003180, 0xfc003fa0, "cw(s,b),R,t", pa10, FLAG_STRICT},
+{ "probei",     0x04003180, 0xfc003fa0, "cw(b),R,t", pa10, FLAG_STRICT},
+{ "prober",     0x04001180, 0xfc003fe0, "(s,b),x,t", pa10, 0},
+{ "prober",     0x04001180, 0xfc003fe0, "(b),x,t", pa10, 0},
+{ "proberi",    0x04003180, 0xfc003fe0, "(s,b),R,t", pa10, 0},
+{ "proberi",    0x04003180, 0xfc003fe0, "(b),R,t", pa10, 0},
+{ "probew",     0x040011c0, 0xfc003fe0, "(s,b),x,t", pa10, 0},
+{ "probew",     0x040011c0, 0xfc003fe0, "(b),x,t", pa10, 0},
+{ "probewi",    0x040031c0, 0xfc003fe0, "(s,b),R,t", pa10, 0},
+{ "probewi",    0x040031c0, 0xfc003fe0, "(b),R,t", pa10, 0},
+{ "lpa",        0x04001340, 0xfc003fc0, "cZx(s,b),t", pa10, 0},
+{ "lpa",        0x04001340, 0xfc003fc0, "cZx(b),t", pa10, 0},
+{ "lha",        0x04001300, 0xfc003fc0, "cZx(s,b),t", pa10, 0},
+{ "lha",        0x04001300, 0xfc003fc0, "cZx(b),t", pa10, 0},
+{ "lci",        0x04001300, 0xfc003fe0, "x(s,b),t", pa10, 0},
+{ "lci",        0x04001300, 0xfc003fe0, "x(b),t", pa10, 0},
+{ "pdtlb",      0x04001600, 0xfc003fdf, "cLcZx(s,b)", pa20, FLAG_STRICT},
+{ "pdtlb",      0x04001600, 0xfc003fdf, "cLcZx(b)", pa20, FLAG_STRICT},
+{ "pdtlb",      0x04001200, 0xfc003fdf, "cZx(s,b)", pa10, 0},
+{ "pdtlb",      0x04001200, 0xfc003fdf, "cZx(b)", pa10, 0},
+{ "pitlb",      0x04000600, 0xfc001fdf, "cLcZx(S,b)", pa20, FLAG_STRICT},
+{ "pitlb",      0x04000600, 0xfc001fdf, "cLcZx(b)", pa20, FLAG_STRICT},
+{ "pitlb",      0x04000200, 0xfc001fdf, "cZx(S,b)", pa10, 0},
+{ "pitlb",      0x04000200, 0xfc001fdf, "cZx(b)", pa10, 0},
+{ "pdtlbe",     0x04001240, 0xfc003fdf, "cZx(s,b)", pa10, 0},
+{ "pdtlbe",     0x04001240, 0xfc003fdf, "cZx(b)", pa10, 0},
+{ "pitlbe",     0x04000240, 0xfc001fdf, "cZx(S,b)", pa10, 0},
+{ "pitlbe",     0x04000240, 0xfc001fdf, "cZx(b)", pa10, 0},
+{ "idtlba",     0x04001040, 0xfc003fff, "x,(s,b)", pa10, 0},
+{ "idtlba",     0x04001040, 0xfc003fff, "x,(b)", pa10, 0},
+{ "iitlba",     0x04000040, 0xfc001fff, "x,(S,b)", pa10, 0},
+{ "iitlba",     0x04000040, 0xfc001fff, "x,(b)", pa10, 0},
+{ "idtlbp",     0x04001000, 0xfc003fff, "x,(s,b)", pa10, 0},
+{ "idtlbp",     0x04001000, 0xfc003fff, "x,(b)", pa10, 0},
+{ "iitlbp",     0x04000000, 0xfc001fff, "x,(S,b)", pa10, 0},
+{ "iitlbp",     0x04000000, 0xfc001fff, "x,(b)", pa10, 0},
+{ "pdc",        0x04001380, 0xfc003fdf, "cZx(s,b)", pa10, 0},
+{ "pdc",        0x04001380, 0xfc003fdf, "cZx(b)", pa10, 0},
+{ "fdc",        0x04001280, 0xfc003fdf, "cZx(s,b)", pa10, 0},
+{ "fdc",        0x04001280, 0xfc003fdf, "cZx(b)", pa10, 0},
+{ "fic",        0x04000280, 0xfc001fdf, "cZx(S,b)", pa10, 0},
+{ "fic",        0x04000280, 0xfc001fdf, "cZx(b)", pa10, 0},
+{ "fdce",       0x040012c0, 0xfc003fdf, "cZx(s,b)", pa10, 0},
+{ "fdce",       0x040012c0, 0xfc003fdf, "cZx(b)", pa10, 0},
+{ "fice",       0x040002c0, 0xfc001fdf, "cZx(S,b)", pa10, 0},
+{ "fice",       0x040002c0, 0xfc001fdf, "cZx(b)", pa10, 0},
+{ "diag",       0x14000000, 0xfc000000, "D", pa10, 0},
+{ "idtlbt",     0x04001800, 0xfc00ffff, "x,b", pa20, FLAG_STRICT},
+{ "iitlbt",     0x04000800, 0xfc00ffff, "x,b", pa20, FLAG_STRICT},
+
+/* These may be specific to certain versions of the PA.  Joel claimed
+   they were 72000 (7200?) specific.  However, I'm almost certain the
+   mtcpu/mfcpu were undocumented, but available in the older 700 machines.  */
+{ "mtcpu",      0x14001600, 0xfc00ffff, "x,^", pa10, 0},
+{ "mfcpu",      0x14001A00, 0xfc00ffff, "^,x", pa10, 0},
+{ "tocen",      0x14403600, 0xffffffff, "", pa10, 0},
+{ "tocdis",     0x14401620, 0xffffffff, "", pa10, 0},
+{ "shdwgr",     0x14402600, 0xffffffff, "", pa10, 0},
+{ "grshdw",     0x14400620, 0xffffffff, "", pa10, 0},
 
 /* gfw and gfr are not in the HP PA 1.1 manual, but they are in either
    the Timex FPU or the Mustang ERS (not sure which) manual.  */
-{ "gfw",	0x04001680, 0xfc003fdf, "Zx(s,b)", pa11},
-{ "gfw",	0x04001680, 0xfc003fdf, "Zx(b)", pa11},
-{ "gfr",	0x04001a80, 0xfc003fdf, "Zx(s,b)", pa11},
-{ "gfr",	0x04001a80, 0xfc003fdf, "Zx(b)", pa11},
+{ "gfw",	0x04001680, 0xfc003fdf, "cZx(s,b)", pa11, 0},
+{ "gfw",	0x04001680, 0xfc003fdf, "cZx(b)", pa11, 0},
+{ "gfr",	0x04001a80, 0xfc003fdf, "cZx(s,b)", pa11, 0},
+{ "gfr",	0x04001a80, 0xfc003fdf, "cZx(b)", pa11, 0},
 
 /* Floating Point Coprocessor Instructions */
-  
-{ "fldwx",      0x24000000, 0xfc001f80, "cx(s,b),v", pa10},
-{ "fldwx",      0x24000000, 0xfc001f80, "cx(b),v", pa10},
-{ "flddx",      0x2c000000, 0xfc001fc0, "cx(s,b),y", pa10},
-{ "flddx",      0x2c000000, 0xfc001fc0, "cx(b),y", pa10},
-{ "fstwx",      0x24000200, 0xfc001f80, "cv,x(s,b)", pa10},
-{ "fstwx",      0x24000200, 0xfc001f80, "cv,x(b)", pa10},
-{ "fstdx",      0x2c000200, 0xfc001fc0, "cy,x(s,b)", pa10},
-{ "fstdx",      0x2c000200, 0xfc001fc0, "cy,x(b)", pa10},
-{ "fstqx",      0x3c000200, 0xfc001fc0, "cy,x(s,b)", pa10},
-{ "fstqx",      0x3c000200, 0xfc001fc0, "cy,x(b)", pa10},
-{ "fldws",      0x24001000, 0xfc001f80, "C5(s,b),v", pa10},
-{ "fldws",      0x24001000, 0xfc001f80, "C5(b),v", pa10},
-{ "fldds",      0x2c001000, 0xfc001fc0, "C5(s,b),y", pa10},
-{ "fldds",      0x2c001000, 0xfc001fc0, "C5(b),y", pa10},
-{ "fstws",      0x24001200, 0xfc001f80, "Cv,5(s,b)", pa10},
-{ "fstws",      0x24001200, 0xfc001f80, "Cv,5(b)", pa10},
-{ "fstds",      0x2c001200, 0xfc001fc0, "Cy,5(s,b)", pa10},
-{ "fstds",      0x2c001200, 0xfc001fc0, "Cy,5(b)", pa10},
-{ "fstqs",      0x3c001200, 0xfc001fc0, "Cy,5(s,b)", pa10},
-{ "fstqs",      0x3c001200, 0xfc001fc0, "Cy,5(b)", pa10},
-{ "fadd",       0x30000600, 0xfc00e7e0, "FE,X,v", pa10},
-{ "fadd",       0x38000600, 0xfc00e720, "IJ,K,v", pa10},
-{ "fsub",       0x30002600, 0xfc00e7e0, "FE,X,v", pa10},
-{ "fsub",       0x38002600, 0xfc00e720, "IJ,K,v", pa10},
-{ "fmpy",       0x30004600, 0xfc00e7e0, "FE,X,v", pa10},
-{ "fmpy",       0x38004600, 0xfc00e720, "IJ,K,v", pa10},
-{ "fdiv",       0x30006600, 0xfc00e7e0, "FE,X,v", pa10},
-{ "fdiv",       0x38006600, 0xfc00e720, "IJ,K,v", pa10},
-{ "fsqrt",      0x30008000, 0xfc1fe7e0, "FE,v", pa10},
-{ "fsqrt",      0x38008000, 0xfc1fe720, "FJ,v", pa10},
-{ "fabs",       0x30006000, 0xfc1fe7e0, "FE,v", pa10},
-{ "fabs",       0x38006000, 0xfc1fe720, "FJ,v", pa10},
-{ "frem",       0x30008600, 0xfc00e7e0, "FE,X,v", pa10},
-{ "frem",       0x38008600, 0xfc00e720, "FJ,K,v", pa10},
-{ "frnd",       0x3000a000, 0xfc1fe7e0, "FE,v", pa10},
-{ "frnd",       0x3800a000, 0xfc1fe720, "FJ,v", pa10},
-{ "fcpy",       0x30004000, 0xfc1fe7e0, "FE,v", pa10},
-{ "fcpy",       0x38004000, 0xfc1fe720, "FJ,v", pa10},
-{ "fcnvff",     0x30000200, 0xfc1f87e0, "FGE,v", pa10},
-{ "fcnvff",     0x38000200, 0xfc1f8720, "FGJ,v", pa10},
-{ "fcnvxf",     0x30008200, 0xfc1f87e0, "FGE,v", pa10},
-{ "fcnvxf",     0x38008200, 0xfc1f8720, "FGJ,v", pa10},
-{ "fcnvfx",     0x30010200, 0xfc1f87e0, "FGE,v", pa10},
-{ "fcnvfx",     0x38010200, 0xfc1f8720, "FGJ,v", pa10},
-{ "fcnvfxt",    0x30018200, 0xfc1f87e0, "FGE,v", pa10},
-{ "fcnvfxt",    0x38018200, 0xfc1f8720, "FGJ,v", pa10},
-{ "fmpyfadd",   0xb8000000, 0xfc000020, "FE,X,3,v", pa20},
-{ "fmpynfadd",  0xb8000020, 0xfc000020, "FE,X,3,v", pa20},
-{ "fneg",       0x3000c000, 0xfc1fe7e0, "FE,v", pa20},
-{ "fneg",       0x3800c000, 0xfc1fe720, "FJ,v", pa20},
-{ "fnegabs",    0x3000e000, 0xfc1fe7e0, "FE,v", pa20},
-{ "fnegabs",    0x3800e000, 0xfc1fe720, "FJ,v", pa20},
-{ "fcmp",       0x30000400, 0xfc00e7e0, "FME,X", pa10},
-{ "fcmp",       0x38000400, 0xfc00e720, "IMJ,K", pa10},
-{ "xmpyu",	0x38004700, 0xfc00e720, "E,X,v", pa11},
-{ "fmpyadd",	0x18000000, 0xfc000000, "H4,6,7,9,8", pa11},
-{ "fmpysub",	0x98000000, 0xfc000000, "H4,6,7,9,8", pa11},
-{ "ftest",      0x30002420, 0xffffffff, "", pa10},
-{ "fid",        0x30000000, 0xffffffff, "", pa11},
+ 
+{ "fldw",       0x24001020, 0xfc1f33a0, "cocc@(s,b),fT", pa20, FLAG_STRICT},
+{ "fldw",       0x24001020, 0xfc1f33a0, "cocc@(b),fT", pa20, FLAG_STRICT},
+{ "fldw",       0x24000000, 0xfc001380, "cxccx(s,b),fT", pa10, FLAG_STRICT},
+{ "fldw",       0x24000000, 0xfc001380, "cxccx(b),fT", pa10, FLAG_STRICT},
+{ "fldw",       0x24001000, 0xfc001380, "cmcc5(s,b),fT", pa10, FLAG_STRICT},
+{ "fldw",       0x24001000, 0xfc001380, "cmcc5(b),fT", pa10, FLAG_STRICT},
+{ "fldw",       0x5c000000, 0xfc000004, "d(s,b),fe", pa20, FLAG_STRICT},
+{ "fldw",       0x5c000000, 0xfc000004, "d(b),fe", pa20, FLAG_STRICT},
+{ "fldw",       0x58000000, 0xfc000004, "cJd(s,b),fe", pa20, FLAG_STRICT},
+{ "fldw",       0x58000000, 0xfc000004, "cJd(b),fe", pa20, FLAG_STRICT},
+{ "fldd",       0x2c001020, 0xfc1f33e0, "cocc@(s,b),ft", pa20, FLAG_STRICT},
+{ "fldd",       0x2c001020, 0xfc1f33e0, "cocc@(b),ft", pa20, FLAG_STRICT},
+{ "fldd",       0x2c000000, 0xfc0013c0, "cxccx(s,b),ft", pa10, FLAG_STRICT},
+{ "fldd",       0x2c000000, 0xfc0013c0, "cxccx(b),ft", pa10, FLAG_STRICT},
+{ "fldd",       0x2c001000, 0xfc0013c0, "cmcc5(s,b),ft", pa10, FLAG_STRICT},
+{ "fldd",       0x2c001000, 0xfc0013c0, "cmcc5(b),ft", pa10, FLAG_STRICT},
+{ "fldd",       0x50000002, 0xfc000002, "cq#(s,b),x", pa20, FLAG_STRICT},
+{ "fldd",       0x50000002, 0xfc000002, "cq#(b),x", pa20, FLAG_STRICT},
+{ "fstw",       0x24001220, 0xfc1f33a0, "cocCfT,@(s,b)", pa10, FLAG_STRICT},
+{ "fstw",       0x24001220, 0xfc1f33a0, "cocCfT,@(b)", pa10, FLAG_STRICT},
+{ "fstw",       0x24000200, 0xfc001380, "cxcCfT,x(s,b)", pa10, FLAG_STRICT},
+{ "fstw",       0x24000200, 0xfc001380, "cxcCfT,x(b)", pa10, FLAG_STRICT},
+{ "fstw",       0x24001200, 0xfc001380, "cmcCfT,5(s,b)", pa10, FLAG_STRICT},
+{ "fstw",       0x24001200, 0xfc001380, "cmcCfT,5(b)", pa10, FLAG_STRICT},
+{ "fstw",       0x7c000000, 0xfc000004, "fe,d(s,b)", pa20, FLAG_STRICT},
+{ "fstw",       0x7c000000, 0xfc000004, "fe,d(b)", pa20, FLAG_STRICT},
+{ "fstw",       0x78000000, 0xfc000004, "cJfe,d(s,b)", pa20, FLAG_STRICT},
+{ "fstw",       0x78000000, 0xfc000004, "cJfe,d(b)", pa20, FLAG_STRICT},
+{ "fstd",       0x2c001220, 0xfc1f33e0, "cocCft,@(s,b)", pa10, FLAG_STRICT},
+{ "fstd",       0x2c001220, 0xfc1f33e0, "cocCft,@(b)", pa10, FLAG_STRICT},
+{ "fstd",       0x2c000200, 0xfc0013c0, "cxcCft,x(s,b)", pa10, FLAG_STRICT},
+{ "fstd",       0x2c000200, 0xfc0013c0, "cxcCft,x(b)", pa10, FLAG_STRICT},
+{ "fstd",       0x2c001200, 0xfc0013c0, "cmcCft,5(s,b)", pa10, FLAG_STRICT},
+{ "fstd",       0x2c001200, 0xfc0013c0, "cmcCft,5(b)", pa10, FLAG_STRICT},
+{ "fstd",       0x70000002, 0xfc000002, "cqx,#(s,b)", pa20, FLAG_STRICT},
+{ "fstd",       0x70000002, 0xfc000002, "cqx,#(b)", pa20, FLAG_STRICT},
+{ "fldwx",      0x24000000, 0xfc001f80, "cxx(s,b),fT", pa10, 0},
+{ "fldwx",      0x24000000, 0xfc001f80, "cxx(b),fT", pa10, 0},
+{ "flddx",      0x2c000000, 0xfc001fc0, "cxx(s,b),ft", pa10, 0},
+{ "flddx",      0x2c000000, 0xfc001fc0, "cxx(b),ft", pa10, 0},
+{ "fstwx",      0x24000200, 0xfc001f80, "cxfT,x(s,b)", pa10, 0},
+{ "fstwx",      0x24000200, 0xfc001f80, "cxfT,x(b)", pa10, 0},
+{ "fstdx",      0x2c000200, 0xfc001fc0, "cxft,x(s,b)", pa10, 0},
+{ "fstdx",      0x2c000200, 0xfc001fc0, "cxft,x(b)", pa10, 0},
+{ "fstqx",      0x3c000200, 0xfc001fc0, "cxft,x(s,b)", pa10, 0},
+{ "fstqx",      0x3c000200, 0xfc001fc0, "cxft,x(b)", pa10, 0},
+{ "fldws",      0x24001000, 0xfc001f80, "cm5(s,b),fT", pa10, 0},
+{ "fldws",      0x24001000, 0xfc001f80, "cm5(b),fT", pa10, 0},
+{ "fldds",      0x2c001000, 0xfc001fc0, "cm5(s,b),ft", pa10, 0},
+{ "fldds",      0x2c001000, 0xfc001fc0, "cm5(b),ft", pa10, 0},
+{ "fstws",      0x24001200, 0xfc001f80, "cmfT,5(s,b)", pa10, 0},
+{ "fstws",      0x24001200, 0xfc001f80, "cmfT,5(b)", pa10, 0},
+{ "fstds",      0x2c001200, 0xfc001fc0, "cmft,5(s,b)", pa10, 0},
+{ "fstds",      0x2c001200, 0xfc001fc0, "cmft,5(b)", pa10, 0},
+{ "fstqs",      0x3c001200, 0xfc001fc0, "cmft,5(s,b)", pa10, 0},
+{ "fstqs",      0x3c001200, 0xfc001fc0, "cmft,5(b)", pa10, 0},
+{ "fadd",       0x30000600, 0xfc00e7e0, "Ffa,fb,fT", pa10, 0},
+{ "fadd",       0x38000600, 0xfc00e720, "IfA,fB,fT", pa10, 0},
+{ "fsub",       0x30002600, 0xfc00e7e0, "Ffa,fb,fT", pa10, 0},
+{ "fsub",       0x38002600, 0xfc00e720, "IfA,fB,fT", pa10, 0},
+{ "fmpy",       0x30004600, 0xfc00e7e0, "Ffa,fb,fT", pa10, 0},
+{ "fmpy",       0x38004600, 0xfc00e720, "IfA,fB,fT", pa10, 0},
+{ "fdiv",       0x30006600, 0xfc00e7e0, "Ffa,fb,fT", pa10, 0},
+{ "fdiv",       0x38006600, 0xfc00e720, "IfA,fB,fT", pa10, 0},
+{ "fsqrt",      0x30008000, 0xfc1fe7e0, "Ffa,fT", pa10, 0},
+{ "fsqrt",      0x38008000, 0xfc1fe720, "FfA,fT", pa10, 0},
+{ "fabs",       0x30006000, 0xfc1fe7e0, "Ffa,fT", pa10, 0},
+{ "fabs",       0x38006000, 0xfc1fe720, "FfA,fT", pa10, 0},
+{ "frem",       0x30008600, 0xfc00e7e0, "Ffa,fb,fT", pa10, 0},
+{ "frem",       0x38008600, 0xfc00e720, "FfA,fB,fT", pa10, 0},
+{ "frnd",       0x3000a000, 0xfc1fe7e0, "Ffa,fT", pa10, 0},
+{ "frnd",       0x3800a000, 0xfc1fe720, "FfA,fT", pa10, 0},
+{ "fcpy",       0x30004000, 0xfc1fe7e0, "Ffa,fT", pa10, 0},
+{ "fcpy",       0x38004000, 0xfc1fe720, "FfA,fT", pa10, 0},
+{ "fcnvff",     0x30000200, 0xfc1f87e0, "FGfa,fT", pa10, 0},
+{ "fcnvff",     0x38000200, 0xfc1f8720, "FGfA,fT", pa10, 0},
+{ "fcnvxf",     0x30008200, 0xfc1f87e0, "FGfa,fT", pa10, 0},
+{ "fcnvxf",     0x38008200, 0xfc1f8720, "FGfA,fT", pa10, 0},
+{ "fcnvfx",     0x30010200, 0xfc1f87e0, "FGfa,fT", pa10, 0},
+{ "fcnvfx",     0x38010200, 0xfc1f8720, "FGfA,fT", pa10, 0},
+{ "fcnvfxt",    0x30018200, 0xfc1f87e0, "FGfa,fT", pa10, 0},
+{ "fcnvfxt",    0x38018200, 0xfc1f8720, "FGfA,fT", pa10, 0},
+{ "fmpyfadd",   0xb8000000, 0xfc000020, "IfA,fB,fC,fT", pa20, FLAG_STRICT},
+{ "fmpynfadd",  0xb8000020, 0xfc000020, "IfA,fB,fC,fT", pa20, FLAG_STRICT},
+{ "fneg",       0x3000c000, 0xfc1fe7e0, "Ffa,fT", pa20, FLAG_STRICT},
+{ "fneg",       0x3800c000, 0xfc1fe720, "IfA,fT", pa20, FLAG_STRICT},
+{ "fnegabs",    0x3000e000, 0xfc1fe7e0, "Ffa,fT", pa20, FLAG_STRICT},
+{ "fnegabs",    0x3800e000, 0xfc1fe720, "IfA,fT", pa20, FLAG_STRICT},
+{ "fcnv",       0x30000200, 0xfc1c0720, "{_fa,fT", pa20, FLAG_STRICT},
+{ "fcnv",       0x38000200, 0xfc1c0720, "FGfA,fT", pa20, FLAG_STRICT},
+{ "fcmp",       0x30000400, 0xfc0007e0, "F?ffa,fb,h", pa20, FLAG_STRICT},
+{ "fcmp",       0x38000400, 0xfc000720, "I?ffA,fB,h", pa20, FLAG_STRICT},
+{ "fcmp",       0x30000400, 0xfc00e7e0, "F?ffa,fb", pa10, 0},
+{ "fcmp",       0x38000400, 0xfc00e720, "I?ffA,fB", pa10, 0},
+{ "xmpyu",	0x38004700, 0xfc00e720, "fX,fB,fT", pa11, 0},
+{ "fmpyadd",	0x18000000, 0xfc000000, "Hfi,fj,fk,fl,fm", pa11, 0},
+{ "fmpysub",	0x98000000, 0xfc000000, "Hfi,fj,fk,fl,fm", pa11, 0},
+{ "ftest",      0x30002420, 0xffffffe0, ",=", pa20, FLAG_STRICT},
+{ "ftest",      0x30000420, 0xffff1fff, "m", pa20, FLAG_STRICT},
+{ "ftest",      0x30002420, 0xffffffff, "", pa10, 0},
+{ "fid",        0x30000000, 0xffffffff, "", pa11, 0},
 
+/* Performance Monitor Instructions */
+
+{ "pmdis",	0x30000280, 0xffffffdf, "N", pa20, FLAG_STRICT},
+{ "pmenb",	0x30000680, 0xffffffff, "", pa20, FLAG_STRICT},
 
 /* Assist Instructions */
 
-{ "spop0",      0x10000000, 0xfc000600, "f,ON", pa10},
-{ "spop1",      0x10000200, 0xfc000600, "f,oNt", pa10},
-{ "spop2",      0x10000400, 0xfc000600, "f,1Nb", pa10},
-{ "spop3",      0x10000600, 0xfc000600, "f,0Nx,b", pa10},
-{ "copr",       0x30000000, 0xfc000000, "u,2N", pa10},
-{ "cldwx",      0x24000000, 0xfc001e00, "ucx(s,b),t", pa10},
-{ "cldwx",      0x24000000, 0xfc001e00, "ucx(b),t", pa10},
-{ "clddx",      0x2c000000, 0xfc001e00, "ucx(s,b),t", pa10},
-{ "clddx",      0x2c000000, 0xfc001e00, "ucx(b),t", pa10},
-{ "cstwx",      0x24000200, 0xfc001e00, "uct,x(s,b)", pa10},
-{ "cstwx",      0x24000200, 0xfc001e00, "uct,x(b)", pa10},
-{ "cstdx",      0x2c000200, 0xfc001e00, "uct,x(s,b)", pa10},
-{ "cstdx",      0x2c000200, 0xfc001e00, "uct,x(b)", pa10},
-{ "cldws",      0x24001000, 0xfc001e00, "uC5(s,b),t", pa10},
-{ "cldws",      0x24001000, 0xfc001e00, "uC5(b),t", pa10},
-{ "cldds",      0x2c001000, 0xfc001e00, "uC5(s,b),t", pa10},
-{ "cldds",      0x2c001000, 0xfc001e00, "uC5(b),t", pa10},
-{ "cstws",      0x24001200, 0xfc001e00, "uCt,5(s,b)", pa10},
-{ "cstws",      0x24001200, 0xfc001e00, "uCt,5(b)", pa10},
-{ "cstds",      0x2c001200, 0xfc001e00, "uCt,5(s,b)", pa10},
-{ "cstds",      0x2c001200, 0xfc001e00, "uCt,5(b)", pa10},
+{ "spop0",      0x10000000, 0xfc000600, "v,ON", pa10, 0},
+{ "spop1",      0x10000200, 0xfc000600, "v,oNt", pa10, 0},
+{ "spop2",      0x10000400, 0xfc000600, "v,1Nb", pa10, 0},
+{ "spop3",      0x10000600, 0xfc000600, "v,0Nx,b", pa10, 0},
+{ "copr",       0x30000000, 0xfc000000, "u,2N", pa10, 0},
+{ "cldwx",      0x24000000, 0xfc001e00, "ucxx(s,b),t", pa10, 0},
+{ "cldwx",      0x24000000, 0xfc001e00, "ucxx(b),t", pa10, 0},
+{ "clddx",      0x2c000000, 0xfc001e00, "ucxx(s,b),t", pa10, 0},
+{ "clddx",      0x2c000000, 0xfc001e00, "ucxx(b),t", pa10, 0},
+{ "cstwx",      0x24000200, 0xfc001e00, "ucxt,x(s,b)", pa10, 0},
+{ "cstwx",      0x24000200, 0xfc001e00, "ucxt,x(b)", pa10, 0},
+{ "cstdx",      0x2c000200, 0xfc001e00, "ucxt,x(s,b)", pa10, 0},
+{ "cstdx",      0x2c000200, 0xfc001e00, "ucxt,x(b)", pa10, 0},
+{ "cldws",      0x24001000, 0xfc001e00, "ucm5(s,b),t", pa10, 0},
+{ "cldws",      0x24001000, 0xfc001e00, "ucm5(b),t", pa10, 0},
+{ "cldds",      0x2c001000, 0xfc001e00, "ucm5(s,b),t", pa10, 0},
+{ "cldds",      0x2c001000, 0xfc001e00, "ucm5(b),t", pa10, 0},
+{ "cstws",      0x24001200, 0xfc001e00, "ucmt,5(s,b)", pa10, 0},
+{ "cstws",      0x24001200, 0xfc001e00, "ucmt,5(b)", pa10, 0},
+{ "cstds",      0x2c001200, 0xfc001e00, "ucmt,5(s,b)", pa10, 0},
+{ "cstds",      0x2c001200, 0xfc001e00, "ucmt,5(b)", pa10, 0},
+{ "cldw",       0x24000000, 0xfc001e00, "ucxx(s,b),t", pa10, FLAG_STRICT},
+{ "cldw",       0x24000000, 0xfc001e00, "ucxx(b),t", pa10, FLAG_STRICT},
+{ "cldw",       0x24001000, 0xfc001e00, "ucm5(s,b),t", pa10, FLAG_STRICT},
+{ "cldw",       0x24001000, 0xfc001e00, "ucm5(b),t", pa10, FLAG_STRICT},
+{ "cldd",       0x2c000000, 0xfc001e00, "ucxx(s,b),t", pa10, FLAG_STRICT},
+{ "cldd",       0x2c000000, 0xfc001e00, "ucxx(b),t", pa10, FLAG_STRICT},
+{ "cldd",       0x2c001000, 0xfc001e00, "ucm5(s,b),t", pa10, FLAG_STRICT},
+{ "cldd",       0x2c001000, 0xfc001e00, "ucm5(b),t", pa20, FLAG_STRICT},
+{ "cstw",       0x24000200, 0xfc001e00, "ucxt,x(s,b)", pa10, FLAG_STRICT},
+{ "cstw",       0x24000200, 0xfc001e00, "ucxt,x(b)", pa10, FLAG_STRICT},
+{ "cstw",       0x24001200, 0xfc001e00, "ucmt,5(s,b)", pa10, FLAG_STRICT},
+{ "cstw",       0x24001200, 0xfc001e00, "ucmt,5(b)", pa10, FLAG_STRICT},
+{ "cstd",       0x2c000200, 0xfc001e00, "ucxt,x(s,b)", pa10, FLAG_STRICT},
+{ "cstd",       0x2c000200, 0xfc001e00, "ucxt,x(b)", pa10, FLAG_STRICT},
+{ "cstd",       0x2c001200, 0xfc001e00, "ucmt,5(s,b)", pa10, FLAG_STRICT},
+{ "cstd",       0x2c001200, 0xfc001e00, "ucmt,5(b)", pa10, FLAG_STRICT},
 };
 
 #define NUMOPCODES ((sizeof pa_opcodes)/(sizeof pa_opcodes[0]))
diff --git a/include/opcode/i370.h b/include/opcode/i370.h
new file mode 100644
index 0000000..f2049e7
--- /dev/null
+++ b/include/opcode/i370.h
@@ -0,0 +1,265 @@
+/* i370.h -- Header file for S/390 opcode table
+   Copyright 1994, 95, 98, 99, 2000 Free Software Foundation, Inc.
+   PowerPC version written by Ian Lance Taylor, Cygnus Support
+   Rewritten for i370 ESA/390 support, Linas Vepstas <linas@linas.org>
+
+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 I370_H
+#define I370_H
+
+/* The opcode table is an array of struct i370_opcode.  */
+typedef union
+{
+   unsigned int   i[2];
+   unsigned short s[4];
+   unsigned char  b[8];
+}  i370_insn_t;
+
+struct i370_opcode
+{
+  /* The opcode name.  */
+  const char *name;
+
+  /* the length of the instruction */
+  char len;
+
+  /* The opcode itself.  Those bits which will be filled in with
+     operands are zeroes.  */
+  i370_insn_t opcode;
+
+  /* The opcode mask.  This is used by the disassembler.  This is a
+     mask containing ones indicating those bits which must match the
+     opcode field, and zeroes indicating those bits which need not
+     match (and are presumably filled in by operands).  */
+  i370_insn_t mask;
+
+  /* One bit flags for the opcode.  These are used to indicate which
+     specific processors support the instructions.  The defined values
+     are listed below.  */
+  unsigned long flags;
+
+  /* An array of operand codes.  Each code is an index into the
+     operand table.  They appear in the order which the operands must
+     appear in assembly code, and are terminated by a zero.  */
+  unsigned char operands[8];
+};
+
+/* The table itself is sorted by major opcode number, and is otherwise
+   in the order in which the disassembler should consider
+   instructions.  */
+extern const struct i370_opcode i370_opcodes[];
+extern const int i370_num_opcodes;
+
+/* Values defined for the flags field of a struct i370_opcode.  */
+
+/* Opcode is defined for the original 360 architecture.  */
+#define I370_OPCODE_360 (0x01)
+
+/* Opcode is defined for the 370 architecture.  */
+#define I370_OPCODE_370 (0x02)
+
+/* Opcode is defined for the 370-XA architecture.  */
+#define I370_OPCODE_370_XA (0x04)
+
+/* Opcode is defined for the ESA/370 architecture.  */
+#define I370_OPCODE_ESA370 (0x08)
+
+/* Opcode is defined for the ESA/390 architecture.  */
+#define I370_OPCODE_ESA390 (0x10)
+
+/* Opcode is defined for the ESA/390 w/ BFP facility.  */
+#define I370_OPCODE_ESA390_BF (0x20)
+
+/* Opcode is defined for the ESA/390 w/ branch & set authority facility.  */
+#define I370_OPCODE_ESA390_BS (0x40)
+
+/* Opcode is defined for the ESA/390 w/ checksum facility.  */
+#define I370_OPCODE_ESA390_CK (0x80)
+
+/* Opcode is defined for the ESA/390 w/ compare & move extended facility.  */
+#define I370_OPCODE_ESA390_CM (0x100)
+
+/* Opcode is defined for the ESA/390 w/ flt.pt. support extensions facility. */
+#define I370_OPCODE_ESA390_FX (0x200)
+
+/* Opcode is defined for the ESA/390 w/ HFP facility. */
+#define I370_OPCODE_ESA390_HX (0x400)
+
+/* Opcode is defined for the ESA/390 w/ immediate & relative facility.  */
+#define I370_OPCODE_ESA390_IR (0x800)
+
+/* Opcode is defined for the ESA/390 w/ move-inverse facility.  */
+#define I370_OPCODE_ESA390_MI (0x1000)
+
+/* Opcode is defined for the ESA/390 w/ program-call-fast facility.  */
+#define I370_OPCODE_ESA390_PC (0x2000)
+
+/* Opcode is defined for the ESA/390 w/ perform-locked-op facility.  */
+#define I370_OPCODE_ESA390_PL (0x4000)
+
+/* Opcode is defined for the ESA/390 w/ square-root facility.  */
+#define I370_OPCODE_ESA390_QR (0x8000)
+
+/* Opcode is defined for the ESA/390 w/ resume-program facility.  */
+#define I370_OPCODE_ESA390_RP (0x10000)
+
+/* Opcode is defined for the ESA/390 w/ set-address-space-fast facility.  */
+#define I370_OPCODE_ESA390_SA (0x20000)
+
+/* Opcode is defined for the ESA/390 w/ subspace group facility.  */
+#define I370_OPCODE_ESA390_SG (0x40000)
+
+/* Opcode is defined for the ESA/390 w/ string facility.  */
+#define I370_OPCODE_ESA390_SR (0x80000)
+
+/* Opcode is defined for the ESA/390 w/ trap facility.  */
+#define I370_OPCODE_ESA390_TR (0x100000)
+
+#define I370_OPCODE_ESA390_SUPERSET (0x1fffff)
+
+
+/* The operands table is an array of struct i370_operand.  */
+
+struct i370_operand
+{
+  /* The number of bits in the operand.  */
+  int bits;
+
+  /* How far the operand is left shifted in the instruction.  */
+  int shift;
+
+  /* Insertion function.  This is used by the assembler.  To insert an
+     operand value into an instruction, check this field.
+
+     If it is NULL, execute
+         i |= (op & ((1 << o->bits) - 1)) << o->shift;
+     (i is the instruction which we are filling in, o is a pointer to
+     this structure, and op is the opcode value; this assumes twos
+     complement arithmetic).
+
+     If this field is not NULL, then simply call it with the
+     instruction and the operand value.  It will return the new value
+     of the instruction.  If the ERRMSG argument is not NULL, then if
+     the operand value is illegal, *ERRMSG will be set to a warning
+     string (the operand will be inserted in any case).  If the
+     operand value is legal, *ERRMSG will be unchanged (most operands
+     can accept any value).  */
+  i370_insn_t (*insert) PARAMS ((i370_insn_t instruction, long op,
+				   const char **errmsg));
+
+  /* Extraction function.  This is used by the disassembler.  To
+     extract this operand type from an instruction, check this field.
+
+     If it is NULL, compute
+         op = ((i) >> o->shift) & ((1 << o->bits) - 1);
+	 if ((o->flags & I370_OPERAND_SIGNED) != 0
+           && (op & (1 << (o->bits - 1))) != 0)
+	   op -= 1 << o->bits;
+     (i is the instruction, o is a pointer to this structure, and op
+     is the result; this assumes twos complement arithmetic).
+
+     If this field is not NULL, then simply call it with the
+     instruction value.  It will return the value of the operand.  If
+     the INVALID argument is not NULL, *INVALID will be set to
+     non-zero if this operand type can not actually be extracted from
+     this operand (i.e., the instruction does not match).  If the
+     operand is valid, *INVALID will not be changed.  */
+  long (*extract) PARAMS ((i370_insn_t instruction, int *invalid));
+
+  /* One bit syntax flags.  */
+  unsigned long flags;
+
+  /* name -- handy for debugging, otherwise pointless */
+  char * name;
+};
+
+/* Elements in the table are retrieved by indexing with values from
+   the operands field of the i370_opcodes table.  */
+
+extern const struct i370_operand i370_operands[];
+
+/* Values defined for the flags field of a struct i370_operand.  */
+
+/* This operand should be wrapped in parentheses rather than
+   separated from the previous by a comma.  This is used for S, RS and
+   SS form instructions which want their operands to look like
+   reg,displacement(basereg) */
+#define I370_OPERAND_SBASE (0x01)
+
+/* This operand is a base register.  It may or may not appear next
+   to an index register, i.e. either of the two forms
+   reg,displacement(basereg)
+   reg,displacement(index,basereg) */
+#define I370_OPERAND_BASE (0x02)
+
+/* This pair of operands should be wrapped in parentheses rather than
+   separated from the last by a comma.  This is used for the RX form
+   instructions which want their operands to look like
+   reg,displacement(index,basereg) */
+#define I370_OPERAND_INDEX (0x04)
+
+/* This operand names a register.  The disassembler uses this to print
+   register names with a leading 'r'.  */
+#define I370_OPERAND_GPR (0x08)
+
+/* This operand names a floating point register.  The disassembler
+   prints these with a leading 'f'.  */
+#define I370_OPERAND_FPR (0x10)
+
+/* This operand is a displacement.  */
+#define I370_OPERAND_RELATIVE (0x20)
+
+/* This operand is a length, such as that in SS form instructions.  */
+#define I370_OPERAND_LENGTH (0x40)
+
+/* This operand is optional, and is zero if omitted.  This is used for
+   the optional B2 field in the shift-left, shift-right instructions.  The
+   assembler must count the number of operands remaining on the line,
+   and the number of operands remaining for the opcode, and decide
+   whether this operand is present or not.  The disassembler should
+   print this operand out only if it is not zero.  */
+#define I370_OPERAND_OPTIONAL (0x80)
+
+
+/* Define some misc macros.  We keep them with the operands table
+   for simplicity.  The macro table is an array of struct i370_macro.  */
+
+struct i370_macro
+{
+  /* The macro name.  */
+  const char *name;
+
+  /* The number of operands the macro takes.  */
+  unsigned int operands;
+
+  /* One bit flags for the opcode.  These are used to indicate which
+     specific processors support the instructions.  The values are the
+     same as those for the struct i370_opcode flags field.  */
+  unsigned long flags;
+
+  /* A format string to turn the macro into a normal instruction.
+     Each %N in the string is replaced with operand number N (zero
+     based).  */
+  const char *format;
+};
+
+extern const struct i370_macro i370_macros[];
+extern const int i370_num_macros;
+
+
+#endif /* I370_H */
diff --git a/include/opcode/i386.h b/include/opcode/i386.h
index ef8fece..d399f4e 100644
--- a/include/opcode/i386.h
+++ b/include/opcode/i386.h
@@ -17,32 +17,38 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* The UnixWare assembler, and probably other AT&T derived ix86 Unix
-   assemblers, generate floating point instructions with reversed
-   source and destination registers in certain cases.  Unfortunately,
-   gcc and possibly many other programs use this reversed syntax, so
-   we're stuck with it.
+/* The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
+   ix86 Unix assemblers, generate floating point instructions with
+   reversed source and destination registers in certain cases.
+   Unfortunately, gcc and possibly many other programs use this
+   reversed syntax, so we're stuck with it.
 
-   eg. `fsub %st(3),%st' results in st <- st - st(3) as expected, but
-   `fsub %st,%st(3)' results in st(3) <- st - st(3), rather than
-   the expected st(3) <- st(3) - st !
+   eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
+   `fsub %st,%st(3)' results in st(3) = st - st(3), rather than
+   the expected st(3) = st(3) - st
 
    This happens with all the non-commutative arithmetic floating point
    operations with two register operands, where the source register is
-   %st, and destination register is %st(i).  Look for FloatDR below.  */
+   %st, and destination register is %st(i).  See FloatDR below.
 
-#ifndef UNIXWARE_COMPAT
+   The affected opcode map is dceX, dcfX, deeX, defX.  */
+
+#ifndef SYSV386_COMPAT
 /* Set non-zero for broken, compatible instructions.  Set to zero for
-   non-broken opcodes at your peril.  gcc generates UnixWare
+   non-broken opcodes at your peril.  gcc generates SystemV/386
    compatible instructions.  */
-#define UNIXWARE_COMPAT 1
+#define SYSV386_COMPAT 1
 #endif
-
+#ifndef OLDGCC_COMPAT
+/* Set non-zero to cater for old (<= 2.8.1) versions of gcc that could
+   generate nonsense fsubp, fsubrp, fdivp and fdivrp with operands
+   reversed.  */
+#define OLDGCC_COMPAT SYSV386_COMPAT
+#endif
 
 static const template i386_optab[] = {
 
 #define X None
-#define ReverseModrm (ReverseRegRegmem|Modrm)
 #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)
@@ -64,13 +70,16 @@
 #define sl_FP (sl_Suf|IgnoreSize)
 #define sld_FP (sld_Suf|IgnoreSize)
 #define sldx_FP (sldx_Suf|IgnoreSize)
-#if UNIXWARE_COMPAT
+#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
+   destination being swapped *and* the direction being reversed.  */
 #define FloatDR FloatD
 #else
 #define FloatDR (FloatD|FloatR)
 #endif
 
-/* move instructions */
+/* Move instructions.  */
 #define MOV_AX_DISP32 0xa0
 { "mov",   2,	0xa0, X, bwl_Suf|D|W,			{ Disp16|Disp32, Acc, 0 } },
 { "mov",   2,	0x88, X, bwl_Suf|D|W|Modrm,		{ Reg, Reg|AnyMem, 0 } },
@@ -83,55 +92,53 @@
    the implementation defined value is zero).  */
 { "mov",   2,	0x8c, X, wl_Suf|Modrm,			{ SReg3|SReg2, WordReg|WordMem, 0 } },
 { "mov",   2,	0x8e, X, wl_Suf|Modrm|IgnoreSize,	{ WordReg|WordMem, SReg3|SReg2, 0 } },
-/* move to/from control debug registers */
-{ "mov",   2, 0x0f20, X, l_Suf|D|Modrm|IgnoreSize,	{ Control, Reg32, 0} },
-{ "mov",   2, 0x0f21, X, l_Suf|D|Modrm|IgnoreSize,	{ Debug, Reg32, 0} },
-{ "mov",   2, 0x0f24, X, l_Suf|D|Modrm|IgnoreSize,	{ Test, Reg32, 0} },
+/* Move to/from control debug registers.  */
+{ "mov",   2, 0x0f20, X, l_Suf|D|Modrm|IgnoreSize,	{ Control, Reg32|InvMem, 0} },
+{ "mov",   2, 0x0f21, X, l_Suf|D|Modrm|IgnoreSize,	{ Debug, Reg32|InvMem, 0} },
+{ "mov",   2, 0x0f24, X, l_Suf|D|Modrm|IgnoreSize,	{ Test, Reg32|InvMem, 0} },
 
-/* move with sign extend */
+/* Move with sign extend.  */
 /* "movsbl" & "movsbw" must not be unified into "movsb" to avoid
    conflict with the "movs" string move instruction.  */
-{"movsbl", 2, 0x0fbe, X, NoSuf|ReverseModrm,	{ Reg8|ByteMem, Reg32, 0} },
-{"movsbw", 2, 0x0fbe, X, NoSuf|ReverseModrm,	{ Reg8|ByteMem, Reg16, 0} },
-{"movswl", 2, 0x0fbf, X, NoSuf|ReverseModrm,	{ Reg16|ShortMem, Reg32, 0} },
+{"movsbl", 2, 0x0fbe, X, NoSuf|Modrm,			{ Reg8|ByteMem, Reg32, 0} },
+{"movsbw", 2, 0x0fbe, X, NoSuf|Modrm,			{ Reg8|ByteMem, Reg16, 0} },
+{"movswl", 2, 0x0fbf, X, NoSuf|Modrm,			{ Reg16|ShortMem, Reg32, 0} },
 /* Intel Syntax */
-{"movsx",  2, 0x0fbf, X, w_Suf|ReverseModrm|IgnoreSize,    { Reg16|ShortMem, Reg32, 0} },
-{"movsx",  2, 0x0fbe, X, b_Suf|ReverseModrm,    { Reg8|ByteMem, WordReg, 0} },
+{"movsx",  2, 0x0fbf, X, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
+{"movsx",  2, 0x0fbe, X, b_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
 
-/* move with zero extend */
-{"movzb",  2, 0x0fb6, X, wl_Suf|ReverseModrm,	{ Reg8|ByteMem, WordReg, 0} },
-{"movzwl", 2, 0x0fb7, X, NoSuf|ReverseModrm,	{ Reg16|ShortMem, Reg32, 0} },
+/* Move with zero extend.  */
+{"movzb",  2, 0x0fb6, X, wl_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
+{"movzwl", 2, 0x0fb7, X, NoSuf|Modrm,			{ Reg16|ShortMem, Reg32, 0} },
 /* Intel Syntax */
-{"movzx",  2, 0x0fb7, X, w_Suf|ReverseModrm|IgnoreSize,  { Reg16|ShortMem, Reg32, 0} },
-{"movzx",  2, 0x0fb6, X, b_Suf|ReverseModrm,   { Reg8|ByteMem, WordReg, 0} },
+{"movzx",  2, 0x0fb7, X, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
+{"movzx",  2, 0x0fb6, X, b_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
 
-/* push instructions */
-{"push",   1,	0x50, X, wl_Suf|ShortForm,	{ WordReg,0,0 } },
-{"push",   1,	0xff, 6, wl_Suf|Modrm,		{ WordReg|WordMem, 0, 0 } },
-{"push",   1,	0x6a, X, wl_Suf,		{ Imm8S, 0, 0} },
-{"push",   1,	0x68, X, wl_Suf,		{ Imm16|Imm32, 0, 0} },
-{"push",   1,	0x06, X, wl_Suf|Seg2ShortForm,	{ SReg2,0,0 } },
-{"push",   1, 0x0fa0, X, wl_Suf|Seg3ShortForm,	{ SReg3,0,0 } },
-/* push all */
-{"pusha",  0,	0x60, X, wl_Suf,		{ 0, 0, 0 } },
+/* Push instructions.  */
+{"push",   1,	0x50, X, wl_Suf|ShortForm|DefaultSize,	{ WordReg, 0, 0 } },
+{"push",   1,	0xff, 6, wl_Suf|Modrm|DefaultSize,	{ WordReg|WordMem, 0, 0 } },
+{"push",   1,	0x6a, X, wl_Suf|DefaultSize,		{ Imm8S, 0, 0} },
+{"push",   1,	0x68, X, wl_Suf|DefaultSize,		{ Imm16|Imm32, 0, 0} },
+{"push",   1,	0x06, X, wl_Suf|Seg2ShortForm|DefaultSize, { SReg2, 0, 0 } },
+{"push",   1, 0x0fa0, X, wl_Suf|Seg3ShortForm|DefaultSize, { SReg3, 0, 0 } },
+{"pusha",  0,	0x60, X, wl_Suf|DefaultSize,		{ 0, 0, 0 } },
 
-/* pop instructions */
-{"pop",	   1,	0x58, X, wl_Suf|ShortForm,	{ WordReg,0,0 } },
-{"pop",	   1,	0x8f, 0, wl_Suf|Modrm,		{ WordReg|WordMem, 0, 0 } },
+/* Pop instructions.  */
+{"pop",	   1,	0x58, X, wl_Suf|ShortForm|DefaultSize,	{ WordReg, 0, 0 } },
+{"pop",	   1,	0x8f, 0, wl_Suf|Modrm|DefaultSize,	{ WordReg|WordMem, 0, 0 } },
 #define POP_SEG_SHORT 0x07
-{"pop",	   1,	0x07, X, wl_Suf|Seg2ShortForm,	{ SReg2,0,0 } },
-{"pop",	   1, 0x0fa1, X, wl_Suf|Seg3ShortForm,	{ SReg3,0,0 } },
-/* pop all */
-{"popa",   0,	0x61, X, wl_Suf,		{ 0, 0, 0 } },
+{"pop",	   1,	0x07, X, wl_Suf|Seg2ShortForm|DefaultSize, { SReg2, 0, 0 } },
+{"pop",	   1, 0x0fa1, X, wl_Suf|Seg3ShortForm|DefaultSize, { SReg3, 0, 0 } },
+{"popa",   0,	0x61, X, wl_Suf|DefaultSize,		{ 0, 0, 0 } },
 
-/* xchg exchange instructions
-   xchg commutes:  we allow both operand orders */
+/* Exchange instructions.
+   xchg commutes:  we allow both operand orders.  */
 {"xchg",   2,	0x90, X, wl_Suf|ShortForm,	{ WordReg, Acc, 0 } },
 {"xchg",   2,	0x90, X, wl_Suf|ShortForm,	{ Acc, WordReg, 0 } },
 {"xchg",   2,	0x86, X, bwl_Suf|W|Modrm,	{ Reg, Reg|AnyMem, 0 } },
 {"xchg",   2,	0x86, X, bwl_Suf|W|Modrm,	{ Reg|AnyMem, Reg, 0 } },
 
-/* in/out from ports */
+/* In/out from ports.  */
 {"in",	   2,	0xe4, X, bwl_Suf|W,		{ Imm8, Acc, 0 } },
 {"in",	   2,	0xec, X, bwl_Suf|W,		{ InOutPortReg, Acc, 0 } },
 {"in",	   1,	0xe4, X, bwl_Suf|W,		{ Imm8, 0, 0 } },
@@ -141,17 +148,17 @@
 {"out",	   1,	0xe6, X, bwl_Suf|W,		{ Imm8, 0, 0 } },
 {"out",	   1,	0xee, X, bwl_Suf|W,		{ InOutPortReg, 0, 0 } },
 
-/* load effective address */
+/* Load effective address.  */
 {"lea",	   2, 0x8d,   X, wl_Suf|Modrm,		{ WordMem, WordReg, 0 } },
 
-/* load segment registers from memory */
+/* Load segment registers from memory.  */
 {"lds",	   2,	0xc5, X, wl_Suf|Modrm,		{ WordMem, WordReg, 0} },
 {"les",	   2,	0xc4, X, wl_Suf|Modrm,		{ WordMem, WordReg, 0} },
 {"lfs",	   2, 0x0fb4, X, wl_Suf|Modrm,		{ WordMem, WordReg, 0} },
 {"lgs",	   2, 0x0fb5, X, wl_Suf|Modrm,		{ WordMem, WordReg, 0} },
 {"lss",	   2, 0x0fb2, X, wl_Suf|Modrm,		{ WordMem, WordReg, 0} },
 
-/* flags register instructions */
+/* Flags register instructions.  */
 {"clc",	   0,	0xf8, X, NoSuf,			{ 0, 0, 0} },
 {"cld",	   0,	0xfc, X, NoSuf,			{ 0, 0, 0} },
 {"cli",	   0,	0xfa, X, NoSuf,			{ 0, 0, 0} },
@@ -159,13 +166,13 @@
 {"cmc",	   0,	0xf5, X, NoSuf,			{ 0, 0, 0} },
 {"lahf",   0,	0x9f, X, NoSuf,			{ 0, 0, 0} },
 {"sahf",   0,	0x9e, X, NoSuf,			{ 0, 0, 0} },
-{"pushf",  0,	0x9c, X, wl_Suf,		{ 0, 0, 0} },
-{"popf",   0,	0x9d, X, wl_Suf,		{ 0, 0, 0} },
+{"pushf",  0,	0x9c, X, wl_Suf|DefaultSize,	{ 0, 0, 0} },
+{"popf",   0,	0x9d, X, wl_Suf|DefaultSize,	{ 0, 0, 0} },
 {"stc",	   0,	0xf9, X, NoSuf,			{ 0, 0, 0} },
 {"std",	   0,	0xfd, X, NoSuf,			{ 0, 0, 0} },
 {"sti",	   0,	0xfb, X, NoSuf,			{ 0, 0, 0} },
 
-/* arithmetic */
+/* Arithmetic.  */
 {"add",	   2,	0x00, X, bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"add",	   2,	0x83, 0, wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
 {"add",	   2,	0x04, X, bwl_Suf|W,		{ Imm, Acc, 0} },
@@ -212,7 +219,7 @@
 {"xor",	   2,	0x34, X, bwl_Suf|W,		{ Imm, Acc, 0} },
 {"xor",	   2,	0x80, 6, bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
 
-/* iclr with 1 operand is really xor with 2 operands. */
+/* iclr with 1 operand is really xor with 2 operands.  */
 {"clr",	   1,	0x30, X, bwl_Suf|W|Modrm|regKludge,	{ Reg, 0, 0 } },
 
 {"adc",	   2,	0x10, X, bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
@@ -232,13 +239,13 @@
 {"aam",	   0, 0xd40a, X, NoSuf,			{ 0, 0, 0} },
 {"aam",	   1,   0xd4, X, NoSuf,			{ Imm8S, 0, 0} },
 
-/* conversion insns */
-/* conversion:	intel naming */
+/* Conversion insns.  */
+/* Intel naming */
 {"cbw",	   0,	0x98, X, NoSuf|Size16,		{ 0, 0, 0} },
 {"cwde",   0,	0x98, X, NoSuf|Size32,		{ 0, 0, 0} },
 {"cwd",	   0,	0x99, X, NoSuf|Size16,		{ 0, 0, 0} },
 {"cdq",	   0,	0x99, X, NoSuf|Size32,		{ 0, 0, 0} },
-/*  att naming */
+/* AT&T naming */
 {"cbtw",   0,	0x98, X, NoSuf|Size16,		{ 0, 0, 0} },
 {"cwtl",   0,	0x98, X, NoSuf|Size32,		{ 0, 0, 0} },
 {"cwtd",   0,	0x99, X, NoSuf|Size16,		{ 0, 0, 0} },
@@ -250,9 +257,9 @@
    These multiplies can only be selected with single operand forms.  */
 {"mul",	   1,	0xf6, 4, bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
 {"imul",   1,	0xf6, 5, bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
-{"imul",   2, 0x0faf, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"imul",   3,	0x6b, X, wl_Suf|ReverseModrm,	{ Imm8S, WordReg|WordMem, WordReg} },
-{"imul",   3,	0x69, X, wl_Suf|ReverseModrm,	{ Imm16|Imm32, WordReg|WordMem, WordReg} },
+{"imul",   2, 0x0faf, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"imul",   3,	0x6b, X, wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, WordReg} },
+{"imul",   3,	0x69, X, wl_Suf|Modrm,		{ Imm16|Imm32, WordReg|WordMem, WordReg} },
 /* imul with 2 operands mimics imul with 3 by putting the register in
    both i.rm.reg & i.rm.regmem fields.  regKludge enables this
    transformation.  */
@@ -311,31 +318,34 @@
 {"sar",	   2,	0xd2, 7, bwl_Suf|W|Modrm,	{ ShiftCount, Reg|AnyMem, 0} },
 {"sar",	   1,	0xd0, 7, bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
 
-/* control transfer instructions */
-{"call",   1,	0xe8, X, wl_Suf|JumpDword,	{ Disp16|Disp32, 0, 0} },
-{"call",   1,	0xff, 2, wl_Suf|Modrm,		{ WordReg|WordMem|JumpAbsolute, 0, 0} },
+/* Control transfer instructions.  */
+{"call",   1,	0xe8, X, wl_Suf|JumpDword|DefaultSize,	{ Disp16|Disp32, 0, 0} },
+{"call",   1,	0xff, 2, wl_Suf|Modrm|DefaultSize,	{ WordReg|WordMem|JumpAbsolute, 0, 0} },
 /* Intel Syntax */
-{"call",   2, 0x9a, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} },
-{"lcall",  2,	0x9a, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} },
-{"lcall",  1,	0xff, 3, wl_Suf|Modrm,		{ WordMem, 0, 0} },
+{"call",   2,	0x9a, X, wl_Suf|JumpInterSegment|DefaultSize, { Imm16, Imm16|Imm32, 0} },
+/* Intel Syntax */
+{"call",   1,	0xff, 3, x_Suf|Modrm|DefaultSize,	{ WordMem, 0, 0} },
+{"lcall",  2,	0x9a, X, wl_Suf|JumpInterSegment|DefaultSize, { Imm16, Imm16|Imm32, 0} },
+{"lcall",  1,	0xff, 3, wl_Suf|Modrm|DefaultSize,	{ WordMem|JumpAbsolute, 0, 0} },
 
 #define JUMP_PC_RELATIVE 0xeb
 {"jmp",	   1,	0xeb, X, NoSuf|Jump,		{ Disp, 0, 0} },
 {"jmp",	   1,	0xff, 4, wl_Suf|Modrm,		{ WordReg|WordMem|JumpAbsolute, 0, 0} },
 /* Intel Syntax */
-{"jmp",   2,	0xea, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} },
-{"jmp",   1,	0xff, 5, wl_Suf|Modrm,		{ WordMem, 0, 0} },
+{"jmp",    2,	0xea, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} },
+/* Intel Syntax */
+{"jmp",    1,	0xff, 5, x_Suf|Modrm,		{ WordMem, 0, 0} },
 {"ljmp",   2,	0xea, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} },
-{"ljmp",   1,	0xff, 5, wl_Suf|Modrm,		{ WordMem, 0, 0} },
+{"ljmp",   1,	0xff, 5, wl_Suf|Modrm,		{ WordMem|JumpAbsolute, 0, 0} },
 
-{"ret",	   0,	0xc3, X, wl_Suf,		{ 0, 0, 0} },
-{"ret",	   1,	0xc2, X, wl_Suf,		{ Imm16, 0, 0} },
-{"lret",   0,	0xcb, X, wl_Suf,		{ 0, 0, 0} },
-{"lret",   1,	0xca, X, wl_Suf,		{ Imm16, 0, 0} },
-{"enter",  2,	0xc8, X, wl_Suf,		{ Imm16, Imm8, 0} },
-{"leave",  0,	0xc9, X, wl_Suf,		{ 0, 0, 0} },
+{"ret",	   0,	0xc3, X, wl_Suf|DefaultSize,	{ 0, 0, 0} },
+{"ret",	   1,	0xc2, X, wl_Suf|DefaultSize,	{ Imm16, 0, 0} },
+{"lret",   0,	0xcb, X, wl_Suf|DefaultSize,	{ 0, 0, 0} },
+{"lret",   1,	0xca, X, wl_Suf|DefaultSize,	{ Imm16, 0, 0} },
+{"enter",  2,	0xc8, X, wl_Suf|DefaultSize,	{ Imm16, Imm8, 0} },
+{"leave",  0,	0xc9, X, wl_Suf|DefaultSize,	{ 0, 0, 0} },
 
-/* conditional jumps */
+/* Conditional jumps.  */
 {"jo",	   1,	0x70, X, NoSuf|Jump,		{ Disp, 0, 0} },
 {"jno",	   1,	0x71, X, NoSuf|Jump,		{ Disp, 0, 0} },
 {"jb",	   1,	0x72, X, NoSuf|Jump,		{ Disp, 0, 0} },
@@ -381,7 +391,7 @@
 {"loopnz", 1,	0xe0, X, wl_Suf|JumpByte,	{ Disp, 0, 0} },
 {"loopne", 1,	0xe0, X, wl_Suf|JumpByte,	{ Disp, 0, 0} },
 
-/* set byte on flag instructions */
+/* Set byte on flag instructions.  */
 {"seto",   1, 0x0f90, 0, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
 {"setno",  1, 0x0f91, 0, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
 {"setb",   1, 0x0f92, 0, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
@@ -413,7 +423,7 @@
 {"setnle", 1, 0x0f9f, 0, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
 {"setg",   1, 0x0f9f, 0, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
 
-/* string manipulation */
+/* String manipulation.  */
 {"cmps",   0,	0xa6, X, bwld_Suf|W|IsString,	{ 0, 0, 0} },
 {"cmps",   2,	0xa6, X, bwld_Suf|W|IsString,	{ AnyMem|EsSeg, AnyMem, 0} },
 {"scmp",   0,	0xa6, X, bwld_Suf|W|IsString,	{ 0, 0, 0} },
@@ -447,9 +457,9 @@
 {"xlat",   0,	0xd7, X, b_Suf|IsString,	{ 0, 0, 0} },
 {"xlat",   1,	0xd7, X, b_Suf|IsString,	{ AnyMem, 0, 0} },
 
-/* bit manipulation */
-{"bsf",	   2, 0x0fbc, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"bsr",	   2, 0x0fbd, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
+/* Bit manipulation.  */
+{"bsf",	   2, 0x0fbc, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"bsr",	   2, 0x0fbd, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
 {"bt",	   2, 0x0fa3, X, wl_Suf|Modrm,		{ WordReg, WordReg|WordMem, 0} },
 {"bt",	   2, 0x0fba, 4, wl_Suf|Modrm,		{ Imm8, WordReg|WordMem, 0} },
 {"btc",	   2, 0x0fbb, X, wl_Suf|Modrm,		{ WordReg, WordReg|WordMem, 0} },
@@ -459,44 +469,44 @@
 {"bts",	   2, 0x0fab, X, wl_Suf|Modrm,		{ WordReg, WordReg|WordMem, 0} },
 {"bts",	   2, 0x0fba, 5, wl_Suf|Modrm,		{ Imm8, WordReg|WordMem, 0} },
 
-/* interrupts & op. sys insns */
+/* Interrupts & op. sys insns.  */
 /* See gas/config/tc-i386.c for conversion of 'int $3' into the special
-   int 3 insn. */
+   int 3 insn.  */
 #define INT_OPCODE 0xcd
 #define INT3_OPCODE 0xcc
 {"int",	   1,	0xcd, X, NoSuf,			{ Imm8, 0, 0} },
 {"int3",   0,	0xcc, X, NoSuf,			{ 0, 0, 0} },
 {"into",   0,	0xce, X, NoSuf,			{ 0, 0, 0} },
 {"iret",   0,	0xcf, X, wl_Suf,		{ 0, 0, 0} },
-/* i386sl, i486sl, later 486, and Pentium */
+/* i386sl, i486sl, later 486, and Pentium.  */
 {"rsm",	   0, 0x0faa, X, NoSuf,			{ 0, 0, 0} },
 
 {"bound",  2,	0x62, X, wl_Suf|Modrm,		{ WordReg, WordMem, 0} },
 
 {"hlt",	   0,	0xf4, X, NoSuf,			{ 0, 0, 0} },
-/* nop is actually 'xchgl %eax, %eax' */
+/* nop is actually 'xchgl %eax, %eax'.  */
 {"nop",	   0,	0x90, X, NoSuf,			{ 0, 0, 0} },
 
-/* protection control */
-{"arpl",   2,	0x63, X, NoSuf|Modrm|IgnoreSize,{ Reg16, Reg16|ShortMem, 0} },
-{"lar",	   2, 0x0f02, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
+/* Protection control.  */
+{"arpl",   2,	0x63, X, w_Suf|Modrm|IgnoreSize,{ Reg16, Reg16|ShortMem, 0} },
+{"lar",	   2, 0x0f02, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
 {"lgdt",   1, 0x0f01, 2, wl_Suf|Modrm,		{ WordMem, 0, 0} },
 {"lidt",   1, 0x0f01, 3, wl_Suf|Modrm,		{ WordMem, 0, 0} },
-{"lldt",   1, 0x0f00, 2, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
-{"lmsw",   1, 0x0f01, 6, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
-{"lsl",	   2, 0x0f03, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"ltr",	   1, 0x0f00, 3, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"lldt",   1, 0x0f00, 2, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"lmsw",   1, 0x0f01, 6, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"lsl",	   2, 0x0f03, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"ltr",	   1, 0x0f00, 3, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
 
 {"sgdt",   1, 0x0f01, 0, wl_Suf|Modrm,		{ WordMem, 0, 0} },
 {"sidt",   1, 0x0f01, 1, wl_Suf|Modrm,		{ WordMem, 0, 0} },
 {"sldt",   1, 0x0f00, 0, wl_Suf|Modrm,		{ WordReg|WordMem, 0, 0} },
 {"smsw",   1, 0x0f01, 4, wl_Suf|Modrm,		{ WordReg|WordMem, 0, 0} },
-{"str",	   1, 0x0f00, 1, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"str",	   1, 0x0f00, 1, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
 
-{"verr",   1, 0x0f00, 4, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
-{"verw",   1, 0x0f00, 5, NoSuf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"verr",   1, 0x0f00, 4, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
+{"verw",   1, 0x0f00, 5, w_Suf|Modrm|IgnoreSize,{ Reg16|ShortMem, 0, 0} },
 
-/* floating point instructions */
+/* Floating point instructions.  */
 
 /* load */
 {"fld",	   1, 0xd9c0, X, FP|ShortForm,		{ FloatReg, 0, 0} }, /* register */
@@ -506,7 +516,7 @@
 {"fld",    1,	0xdb, 5, x_FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 <-- mem efloat */
 {"fild",   1,	0xdf, 0, sl_Suf|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} }, /* %st0 <-- mem word(16)/dword(32) */
 /* Intel Syntax */
-{"fild",  1,	0xdf, 5, d_Suf|IgnoreSize|Modrm,{ LLongMem, 0, 0} }, /* %st0 <-- mem qword (64) */
+{"fildd",  1,	0xdf, 5, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 <-- mem qword (64) */
 {"fildq",  1,	0xdf, 5, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 <-- mem qword (64) */
 {"fildll", 1,	0xdf, 5, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 <-- mem qword (64) */
 {"fldt",   1,	0xdb, 5, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 <-- mem efloat */
@@ -526,7 +536,7 @@
 {"fstp",   1,	0xdb, 7, x_FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem efloat */
 {"fistp",  1,	0xdf, 3, sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} }, /* %st0 --> mem word(16)/dword(32) */
 /* Intel Syntax */
-{"fistp", 1,	0xdf, 7, d_FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem qword (64) */
+{"fistpd", 1,	0xdf, 7, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem qword (64) */
 {"fistpq", 1,	0xdf, 7, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem qword (64) */
 {"fistpll",1,	0xdf, 7, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem qword (64) */
 {"fstpt",  1,	0xdb, 7, FP|Modrm,		{ LLongMem, 0, 0} }, /* %st0 --> mem efloat */
@@ -575,7 +585,7 @@
 /* add */
 {"fadd",   2, 0xd8c0, X, FP|ShortForm|FloatD,	{ FloatReg, FloatAcc, 0} },
 {"fadd",   1, 0xd8c0, X, FP|ShortForm,		{ FloatReg, 0, 0} }, /* alias for fadd %st(i), %st */
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fadd",   0, 0xdec1, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for faddp */
 #endif
 {"fadd",   1,	0xd8, 0, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
@@ -589,17 +599,19 @@
 /* subtract */
 {"fsub",   2, 0xd8e0, X, FP|ShortForm|FloatDR,	{ FloatReg, FloatAcc, 0} },
 {"fsub",   1, 0xd8e0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fsub",   0, 0xdee1, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for fsubp */
 #endif
 {"fsub",   1,	0xd8, 4, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fisub",  1,	0xde, 4, sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fsubp",  2, 0xdee0, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fsubp",  1, 0xdee0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
 {"fsubp",  0, 0xdee1, X, FP,			{ 0, 0, 0} },
+#if OLDGCC_COMPAT
 {"fsubp",  2, 0xdee0, X, FP|ShortForm|Ugh,	{ FloatReg, FloatAcc, 0} },
+#endif
 #else
 {"fsubp",  2, 0xdee8, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fsubp",  1, 0xdee8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -609,17 +621,19 @@
 /* subtract reverse */
 {"fsubr",  2, 0xd8e8, X, FP|ShortForm|FloatDR,	{ FloatReg, FloatAcc, 0} },
 {"fsubr",  1, 0xd8e8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fsubr",  0, 0xdee9, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for fsubrp */
 #endif
 {"fsubr",  1,	0xd8, 5, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fisubr", 1,	0xde, 5, sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fsubrp", 2, 0xdee8, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fsubrp", 1, 0xdee8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
 {"fsubrp", 0, 0xdee9, X, FP,			{ 0, 0, 0} },
+#if OLDGCC_COMPAT
 {"fsubrp", 2, 0xdee8, X, FP|ShortForm|Ugh,	{ FloatReg, FloatAcc, 0} },
+#endif
 #else
 {"fsubrp", 2, 0xdee0, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fsubrp", 1, 0xdee0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -629,7 +643,7 @@
 /* multiply */
 {"fmul",   2, 0xd8c8, X, FP|ShortForm|FloatD,	{ FloatReg, FloatAcc, 0} },
 {"fmul",   1, 0xd8c8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fmul",   0, 0xdec9, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for fmulp */
 #endif
 {"fmul",   1,	0xd8, 1, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
@@ -643,17 +657,19 @@
 /* divide */
 {"fdiv",   2, 0xd8f0, X, FP|ShortForm|FloatDR,	{ FloatReg, FloatAcc, 0} },
 {"fdiv",   1, 0xd8f0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fdiv",   0, 0xdef1, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for fdivp */
 #endif
 {"fdiv",   1,	0xd8, 6, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fidiv",  1,	0xde, 6, sld_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fdivp",  2, 0xdef0, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fdivp",  1, 0xdef0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
 {"fdivp",  0, 0xdef1, X, FP,			{ 0, 0, 0} },
+#if OLDGCC_COMPAT
 {"fdivp",  2, 0xdef0, X, FP|ShortForm|Ugh,	{ FloatReg, FloatAcc, 0} },
+#endif
 #else
 {"fdivp",  2, 0xdef8, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fdivp",  1, 0xdef8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -663,17 +679,19 @@
 /* divide reverse */
 {"fdivr",  2, 0xd8f8, X, FP|ShortForm|FloatDR,	{ FloatReg, FloatAcc, 0} },
 {"fdivr",  1, 0xd8f8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fdivr",  0, 0xdef9, X, FP|Ugh,		{ 0, 0, 0} },	     /* alias for fdivrp */
 #endif
 {"fdivr",  1,	0xd8, 7, sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fidivr", 1,	0xde, 7, sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
-#if UNIXWARE_COMPAT
+#if SYSV386_COMPAT
 {"fdivrp", 2, 0xdef8, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fdivrp", 1, 0xdef8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
 {"fdivrp", 0, 0xdef9, X, FP,			{ 0, 0, 0} },
+#if OLDGCC_COMPAT
 {"fdivrp", 2, 0xdef8, X, FP|ShortForm|Ugh,	{ FloatReg, FloatAcc, 0} },
+#endif
 #else
 {"fdivrp", 2, 0xdef0, X, FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fdivrp", 1, 0xdef0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -713,8 +731,7 @@
 {"fstsw",  0, 0xdfe0, X, FP|FWait,		{ 0, 0, 0} },
 {"fnclex", 0, 0xdbe2, X, FP,			{ 0, 0, 0} },
 {"fclex",  0, 0xdbe2, X, FP|FWait,		{ 0, 0, 0} },
-/* Short forms of fldenv, fstenv use data size prefix.
-   FIXME: Are these the right suffixes?  */
+/* Short forms of fldenv, fstenv use data size prefix.  */
 {"fnstenv",1,	0xd9, 6, sl_Suf|Modrm,		{ LLongMem, 0, 0} },
 {"fstenv", 1,	0xd9, 6, sl_Suf|FWait|Modrm,	{ LLongMem, 0, 0} },
 {"fldenv", 1,	0xd9, 4, sl_Suf|Modrm,		{ LLongMem, 0, 0} },
@@ -729,9 +746,8 @@
 #define FWAIT_OPCODE 0x9b
 {"fwait",  0,	0x9b, X, FP,			{ 0, 0, 0} },
 
-/*
-  opcode prefixes; we allow them as seperate insns too
-*/
+/* Opcode prefixes; we allow them as separate insns too.  */
+
 #define ADDR_PREFIX_OPCODE 0x67
 {"addr16", 0,	0x67, X, NoSuf|IsPrefix|Size16|IgnoreSize,	{ 0, 0, 0} },
 {"addr32", 0,	0x67, X, NoSuf|IsPrefix|Size32|IgnoreSize,	{ 0, 0, 0} },
@@ -765,202 +781,305 @@
 {"repne",  0,	0xf2, X, NoSuf|IsPrefix,	{ 0, 0, 0} },
 {"repnz",  0,	0xf2, X, NoSuf|IsPrefix,	{ 0, 0, 0} },
 
-/* 486 extensions */
+/* 486 extensions.  */
 
-{"bswap",   1, 0x0fc8, X, NoSuf|ShortForm,	{ Reg32,0,0 } },
+{"bswap",   1, 0x0fc8, X, l_Suf|ShortForm,	{ Reg32, 0, 0 } },
 {"xadd",    2, 0x0fc0, X, bwl_Suf|W|Modrm,	{ Reg, Reg|AnyMem, 0 } },
 {"cmpxchg", 2, 0x0fb0, X, bwl_Suf|W|Modrm,	{ Reg, Reg|AnyMem, 0 } },
 {"invd",    0, 0x0f08, X, NoSuf,		{ 0, 0, 0} },
 {"wbinvd",  0, 0x0f09, X, NoSuf,		{ 0, 0, 0} },
 {"invlpg",  1, 0x0f01, 7, NoSuf|Modrm,		{ AnyMem, 0, 0} },
 
-/* 586 and late 486 extensions */
+/* 586 and late 486 extensions.  */
 {"cpuid",   0, 0x0fa2, X, NoSuf,		{ 0, 0, 0} },
 
-/* Pentium extensions */
+/* Pentium extensions.  */
 {"wrmsr",   0, 0x0f30, X, NoSuf,		{ 0, 0, 0} },
 {"rdtsc",   0, 0x0f31, X, NoSuf,		{ 0, 0, 0} },
 {"rdmsr",   0, 0x0f32, X, NoSuf,		{ 0, 0, 0} },
 {"cmpxchg8b",1,0x0fc7, 1, NoSuf|Modrm,		{ LLongMem, 0, 0} },
-{"sysenter", 0, 0x0f34, X, NoSuf,		{ 0, 0, 0} },
-{"sysexit",  0, 0x0f35, X, NoSuf,		{ 0, 0, 0} },
-{"fxsave",   1,	0x0fae, 0, FP|Modrm,		{ LLongMem, 0, 0} },
-{"fxrstor",  1,	0x0fae, 1, FP|Modrm,		{ LLongMem, 0, 0} },
+{"sysenter",0, 0x0f34, X, NoSuf,		{ 0, 0, 0} },
+{"sysexit", 0, 0x0f35, X, NoSuf,		{ 0, 0, 0} },
+{"fxsave",  1, 0x0fae, 0, FP|Modrm,		{ LLongMem, 0, 0} },
+{"fxrstor", 1, 0x0fae, 1, FP|Modrm,		{ LLongMem, 0, 0} },
 
-/* Pentium Pro extensions */
+/* Pentium Pro extensions.  */
 {"rdpmc",   0, 0x0f33, X, NoSuf,		{ 0, 0, 0} },
 
 {"ud2",	    0, 0x0f0b, X, NoSuf,		{ 0, 0, 0} }, /* official undefined instr. */
 {"ud2a",    0, 0x0f0b, X, NoSuf,		{ 0, 0, 0} }, /* alias for ud2 */
 {"ud2b",    0, 0x0fb9, X, NoSuf,		{ 0, 0, 0} }, /* 2nd. official undefined instr. */
 
-{"cmovo",   2, 0x0f40, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovno",  2, 0x0f41, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovb",   2, 0x0f42, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovc",   2, 0x0f42, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnae", 2, 0x0f42, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovae",  2, 0x0f43, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnc",  2, 0x0f43, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnb",  2, 0x0f43, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmove",   2, 0x0f44, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovz",   2, 0x0f44, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovne",  2, 0x0f45, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnz",  2, 0x0f45, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovbe",  2, 0x0f46, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovna",  2, 0x0f46, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmova",   2, 0x0f47, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnbe", 2, 0x0f47, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovs",   2, 0x0f48, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovns",  2, 0x0f49, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovp",   2, 0x0f4a, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnp",  2, 0x0f4b, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovl",   2, 0x0f4c, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnge", 2, 0x0f4c, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovge",  2, 0x0f4d, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnl",  2, 0x0f4d, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovle",  2, 0x0f4e, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovng",  2, 0x0f4e, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovg",   2, 0x0f4f, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
-{"cmovnle", 2, 0x0f4f, X, wl_Suf|ReverseModrm,	{ WordReg|WordMem, WordReg, 0} },
+{"cmovo",   2, 0x0f40, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovno",  2, 0x0f41, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovb",   2, 0x0f42, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovc",   2, 0x0f42, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnae", 2, 0x0f42, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovae",  2, 0x0f43, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnc",  2, 0x0f43, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnb",  2, 0x0f43, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmove",   2, 0x0f44, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovz",   2, 0x0f44, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovne",  2, 0x0f45, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnz",  2, 0x0f45, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovbe",  2, 0x0f46, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovna",  2, 0x0f46, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmova",   2, 0x0f47, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnbe", 2, 0x0f47, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovs",   2, 0x0f48, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovns",  2, 0x0f49, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovp",   2, 0x0f4a, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnp",  2, 0x0f4b, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovl",   2, 0x0f4c, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnge", 2, 0x0f4c, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovge",  2, 0x0f4d, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnl",  2, 0x0f4d, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovle",  2, 0x0f4e, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovng",  2, 0x0f4e, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovg",   2, 0x0f4f, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
+{"cmovnle", 2, 0x0f4f, X, wl_Suf|Modrm,		{ WordReg|WordMem, WordReg, 0} },
 
-{"fcmovb",  2, 0xdac0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovnae",2, 0xdac0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmove",  2, 0xdac8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovbe", 2, 0xdad0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovna", 2, 0xdad0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovu",  2, 0xdad8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovae", 2, 0xdbc0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovnb", 2, 0xdbc0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovne", 2, 0xdbc8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmova",  2, 0xdbd0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovnbe",2, 0xdbd0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcmovnu", 2, 0xdbd8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
+{"fcmovb",  2, 0xdac0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovnae",2, 0xdac0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmove",  2, 0xdac8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovbe", 2, 0xdad0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovna", 2, 0xdad0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovu",  2, 0xdad8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovae", 2, 0xdbc0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovnb", 2, 0xdbc0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovne", 2, 0xdbc8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmova",  2, 0xdbd0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovnbe",2, 0xdbd0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcmovnu", 2, 0xdbd8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
 
-{"fcomi",   2, 0xdbf0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcomi",   0, 0xdbf1, X, NoSuf|ShortForm,	{ 0, 0, 0} },
-{"fcomi",   1, 0xdbf0, X, NoSuf|ShortForm,	{ FloatReg, 0, 0} },
-{"fucomi",  2, 0xdbe8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fucomi",  0, 0xdbe9, X, NoSuf|ShortForm,	{ 0, 0, 0} },
-{"fucomi",  1, 0xdbe8, X, NoSuf|ShortForm,	{ FloatReg, 0, 0} },
-{"fcomip",  2, 0xdff0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcompi",  2, 0xdff0, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fcompi",  0, 0xdff1, X, NoSuf|ShortForm,	{ 0, 0, 0} },
-{"fcompi",  1, 0xdff0, X, NoSuf|ShortForm,	{ FloatReg, 0, 0} },
-{"fucomip", 2, 0xdfe8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fucompi", 2, 0xdfe8, X, NoSuf|ShortForm,	{ FloatReg, FloatAcc, 0} },
-{"fucompi", 0, 0xdfe9, X, NoSuf|ShortForm,	{ 0, 0, 0} },
-{"fucompi", 1, 0xdfe8, X, NoSuf|ShortForm,	{ FloatReg, 0, 0} },
+{"fcomi",   2, 0xdbf0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcomi",   0, 0xdbf1, X, FP|ShortForm,		{ 0, 0, 0} },
+{"fcomi",   1, 0xdbf0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
+{"fucomi",  2, 0xdbe8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fucomi",  0, 0xdbe9, X, FP|ShortForm,		{ 0, 0, 0} },
+{"fucomi",  1, 0xdbe8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
+{"fcomip",  2, 0xdff0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcompi",  2, 0xdff0, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fcompi",  0, 0xdff1, X, FP|ShortForm,		{ 0, 0, 0} },
+{"fcompi",  1, 0xdff0, X, FP|ShortForm,		{ FloatReg, 0, 0} },
+{"fucomip", 2, 0xdfe8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fucompi", 2, 0xdfe8, X, FP|ShortForm,		{ FloatReg, FloatAcc, 0} },
+{"fucompi", 0, 0xdfe9, X, FP|ShortForm,		{ 0, 0, 0} },
+{"fucompi", 1, 0xdfe8, X, FP|ShortForm,		{ FloatReg, 0, 0} },
 
 /* MMX instructions.  */
 
-{"emms",     0, 0x0f77, X, NoSuf,		{ 0, 0, 0 } },
-{"movd",     2, 0x0f6e, X, NoSuf|Modrm,		{ Reg32|LongMem, RegMMX, 0 } },
-{"movd",     2, 0x0f7e, X, NoSuf|Modrm,		{ RegMMX, Reg32|LongMem, 0 } },
-{"movq",     2, 0x0f6f, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"movq",     2, 0x0f7f, X, NoSuf|Modrm,		{ RegMMX, RegMMX|LongMem, 0 } },
-{"packssdw", 2, 0x0f6b, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"packsswb", 2, 0x0f63, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"packuswb", 2, 0x0f67, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddb",    2, 0x0ffc, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddw",    2, 0x0ffd, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddd",    2, 0x0ffe, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddsb",   2, 0x0fec, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddsw",   2, 0x0fed, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddusb",  2, 0x0fdc, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"paddusw",  2, 0x0fdd, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pand",     2, 0x0fdb, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pandn",    2, 0x0fdf, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpeqb",  2, 0x0f74, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpeqw",  2, 0x0f75, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpeqd",  2, 0x0f76, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpgtb",  2, 0x0f64, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpgtw",  2, 0x0f65, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pcmpgtd",  2, 0x0f66, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pmaddwd",  2, 0x0ff5, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pmulhw",   2, 0x0fe5, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pmullw",   2, 0x0fd5, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"por",	     2, 0x0feb, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psllw",    2, 0x0ff1, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psllw",    2, 0x0f71, 6, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"pslld",    2, 0x0ff2, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pslld",    2, 0x0f72, 6, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psllq",    2, 0x0ff3, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psllq",    2, 0x0f73, 6, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psraw",    2, 0x0fe1, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psraw",    2, 0x0f71, 4, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psrad",    2, 0x0fe2, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psrad",    2, 0x0f72, 4, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psrlw",    2, 0x0fd1, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psrlw",    2, 0x0f71, 2, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psrld",    2, 0x0fd2, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psrld",    2, 0x0f72, 2, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psrlq",    2, 0x0fd3, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psrlq",    2, 0x0f73, 2, NoSuf|Modrm,		{ Imm8, RegMMX, 0 } },
-{"psubb",    2, 0x0ff8, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubw",    2, 0x0ff9, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubd",    2, 0x0ffa, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubsb",   2, 0x0fe8, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubsw",   2, 0x0fe9, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubusb",  2, 0x0fd8, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"psubusw",  2, 0x0fd9, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpckhbw",2, 0x0f68, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpckhwd",2, 0x0f69, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpckhdq",2, 0x0f6a, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpcklbw",2, 0x0f60, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpcklwd",2, 0x0f61, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"punpckldq",2, 0x0f62, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
-{"pxor",     2, 0x0fef, X, NoSuf|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"emms",     0, 0x0f77, X, FP,			{ 0, 0, 0 } },
+{"movd",     2, 0x0f6e, X, FP|Modrm,		{ Reg32|LongMem, RegMMX, 0 } },
+{"movd",     2, 0x0f7e, X, FP|Modrm,		{ RegMMX, Reg32|LongMem, 0 } },
+{"movq",     2, 0x0f6f, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"movq",     2, 0x0f7f, X, FP|Modrm,		{ RegMMX, RegMMX|LongMem, 0 } },
+{"packssdw", 2, 0x0f6b, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"packsswb", 2, 0x0f63, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"packuswb", 2, 0x0f67, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddb",    2, 0x0ffc, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddw",    2, 0x0ffd, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddd",    2, 0x0ffe, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddsb",   2, 0x0fec, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddsw",   2, 0x0fed, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddusb",  2, 0x0fdc, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"paddusw",  2, 0x0fdd, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pand",     2, 0x0fdb, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pandn",    2, 0x0fdf, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpeqb",  2, 0x0f74, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpeqw",  2, 0x0f75, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpeqd",  2, 0x0f76, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpgtb",  2, 0x0f64, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpgtw",  2, 0x0f65, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pcmpgtd",  2, 0x0f66, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pmaddwd",  2, 0x0ff5, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pmulhw",   2, 0x0fe5, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pmullw",   2, 0x0fd5, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"por",	     2, 0x0feb, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psllw",    2, 0x0ff1, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psllw",    2, 0x0f71, 6, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"pslld",    2, 0x0ff2, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pslld",    2, 0x0f72, 6, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psllq",    2, 0x0ff3, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psllq",    2, 0x0f73, 6, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psraw",    2, 0x0fe1, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psraw",    2, 0x0f71, 4, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psrad",    2, 0x0fe2, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psrad",    2, 0x0f72, 4, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psrlw",    2, 0x0fd1, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psrlw",    2, 0x0f71, 2, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psrld",    2, 0x0fd2, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psrld",    2, 0x0f72, 2, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psrlq",    2, 0x0fd3, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psrlq",    2, 0x0f73, 2, FP|Modrm,		{ Imm8, RegMMX, 0 } },
+{"psubb",    2, 0x0ff8, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubw",    2, 0x0ff9, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubd",    2, 0x0ffa, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubsb",   2, 0x0fe8, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubsw",   2, 0x0fe9, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubusb",  2, 0x0fd8, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"psubusw",  2, 0x0fd9, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpckhbw",2, 0x0f68, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpckhwd",2, 0x0f69, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpckhdq",2, 0x0f6a, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpcklbw",2, 0x0f60, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpcklwd",2, 0x0f61, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"punpckldq",2, 0x0f62, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
+{"pxor",     2, 0x0fef, X, FP|Modrm,		{ RegMMX|LongMem, RegMMX, 0 } },
 
-  
-/* AMD 3DNow! instructions */
-#define AMD_3DNOW_OPCODE 0x0f0f
 
-{"prefetch", 1, 0x0f0d,	   0, NoSuf|Modrm,	{ ByteMem, 0, 0 } },
-{"prefetchw",1, 0x0f0d,	   1, NoSuf|Modrm,	{ ByteMem, 0, 0 } },
-{"femms",    0, 0x0f0e,	   X, NoSuf,		{ 0, 0, 0 } },
-{"pavgusb",  2, 0x0f0f, 0xbf, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pf2id",    2, 0x0f0f, 0x1d, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfacc",    2, 0x0f0f, 0xae, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfadd",    2, 0x0f0f, 0x9e, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfcmpeq",  2, 0x0f0f, 0xb0, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfcmpge",  2, 0x0f0f, 0x90, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfcmpgt",  2, 0x0f0f, 0xa0, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfmax",    2, 0x0f0f, 0xa4, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfmin",    2, 0x0f0f, 0x94, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfmul",    2, 0x0f0f, 0xb4, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfrcp",    2, 0x0f0f, 0x96, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfrcpit1", 2, 0x0f0f, 0xa6, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfrcpit2", 2, 0x0f0f, 0xb6, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfrsqit1", 2, 0x0f0f, 0xa7, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfrsqrt",  2, 0x0f0f, 0x97, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfsub",    2, 0x0f0f, 0x9a, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pfsubr",   2, 0x0f0f, 0xaa, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pi2fd",    2, 0x0f0f, 0x0d, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
-{"pmulhrw",  2, 0x0f0f, 0xb7, NoSuf|Modrm,	{ RegMMX|LongMem, RegMMX, 0 } },
+/* PIII Katmai New Instructions / SIMD instructions.  */
+
+{"addps",     2, 0x0f58,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"addss",     2, 0xf30f58,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"andnps",    2, 0x0f55,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"andps",     2, 0x0f54,    X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpeqps",   2, 0x0fc2,    0, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpeqss",   2, 0xf30fc2,  0, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpleps",   2, 0x0fc2,    2, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpless",   2, 0xf30fc2,  2, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpltps",   2, 0x0fc2,    1, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpltss",   2, 0xf30fc2,  1, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpneqps",  2, 0x0fc2,    4, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpneqss",  2, 0xf30fc2,  4, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpnleps",  2, 0x0fc2,    6, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpnless",  2, 0xf30fc2,  6, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpnltps",  2, 0x0fc2,    5, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpnltss",  2, 0xf30fc2,  5, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpordps",  2, 0x0fc2,    7, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpordss",  2, 0xf30fc2,  7, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpunordps",2, 0x0fc2,    3, FP|Modrm|ImmExt,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"cmpunordss",2, 0xf30fc2,  3, FP|Modrm|ImmExt,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cmpps",     3, 0x0fc2,    X, FP|Modrm,	{ Imm8, RegXMM|LLongMem, RegXMM } },
+{"cmpss",     3, 0xf30fc2,  X, FP|Modrm,	{ Imm8, RegXMM|WordMem, RegXMM } },
+{"comiss",    2, 0x0f2f,    X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"cvtpi2ps",  2, 0x0f2a,    X, FP|Modrm,	{ RegMMX|LLongMem, RegXMM, 0 } },
+{"cvtps2pi",  2, 0x0f2d,    X, FP|Modrm,	{ RegXMM|LLongMem, RegMMX, 0 } },
+{"cvtsi2ss",  2, 0xf30f2a,  X, FP|Modrm,	{ Reg32|WordMem, RegXMM, 0 } },
+{"cvtss2si",  2, 0xf30f2d,  X, FP|Modrm,	{ RegXMM|WordMem, Reg32, 0 } },
+{"cvttps2pi", 2, 0x0f2c,    X, FP|Modrm,	{ RegXMM|LLongMem, RegMMX, 0 } },
+{"cvttss2si", 2, 0xf30f2c,  X, FP|Modrm,	{ RegXMM|WordMem, Reg32, 0 } },
+{"divps",     2, 0x0f5e,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"divss",     2, 0xf30f5e,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"ldmxcsr",   1, 0x0fae,    2, FP|Modrm, 	{ WordMem, 0, 0 } },
+{"maskmovq",  2, 0x0ff7,    X, FP|Modrm,	{ RegMMX|InvMem, RegMMX, 0 } },
+{"maxps",     2, 0x0f5f,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"maxss",     2, 0xf30f5f,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"minps",     2, 0x0f5d,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"minss",     2, 0xf30f5d,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"movaps",    2, 0x0f28,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"movaps",    2, 0x0f29,    X, FP|Modrm,	{ RegXMM, RegXMM|LLongMem, 0 } },
+{"movhlps",   2, 0x0f12,    X, FP|Modrm,	{ RegXMM|InvMem, RegXMM, 0 } },
+{"movhps",    2, 0x0f16,    X, FP|Modrm,	{ LLongMem, RegXMM, 0 } },
+{"movhps",    2, 0x0f17,    X, FP|Modrm,	{ RegXMM, LLongMem, 0 } },
+{"movlhps",   2, 0x0f16,    X, FP|Modrm,	{ RegXMM|InvMem, RegXMM, 0 } },
+{"movlps",    2, 0x0f12,    X, FP|Modrm,	{ LLongMem, RegXMM, 0 } },
+{"movlps",    2, 0x0f13,    X, FP|Modrm,	{ RegXMM, LLongMem, 0 } },
+{"movmskps",  2, 0x0f50,    X, FP|Modrm,	{ RegXMM|InvMem, Reg32, 0 } },
+{"movntps",   2, 0x0f2b,    X, FP|Modrm, 	{ RegXMM, LLongMem, 0 } },
+{"movntq",    2, 0x0fe7,    X, FP|Modrm, 	{ RegMMX, LLongMem, 0 } },
+{"movss",     2, 0xf30f10,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"movss",     2, 0xf30f11,  X, FP|Modrm,	{ RegXMM, RegXMM|WordMem, 0 } },
+{"movups",    2, 0x0f10,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"movups",    2, 0x0f11,    X, FP|Modrm,	{ RegXMM, RegXMM|LLongMem, 0 } },
+{"mulps",     2, 0x0f59,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"mulss",     2, 0xf30f59,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"orps",      2, 0x0f56,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"pavgb",     2, 0x0fe0,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pavgw",     2, 0x0fe3,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pextrw",    3, 0x0fc5,    X, FP|Modrm,	{ Imm8, RegMMX, Reg32|InvMem } },
+{"pinsrw",    3, 0x0fc4,    X, FP|Modrm,	{ Imm8, Reg32|ShortMem, RegMMX } },
+{"pmaxsw",    2, 0x0fee,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pmaxub",    2, 0x0fde,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pminsw",    2, 0x0fea,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pminub",    2, 0x0fda,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pmovmskb",  2, 0x0fd7,    X, FP|Modrm,	{ RegMMX, Reg32|InvMem, 0 } },
+{"pmulhuw",   2, 0x0fe4,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"prefetchnta", 1, 0x0f18,  0, FP|Modrm, 	{ LLongMem, 0, 0 } },
+{"prefetcht0",  1, 0x0f18,  1, FP|Modrm, 	{ LLongMem, 0, 0 } },
+{"prefetcht1",  1, 0x0f18,  2, FP|Modrm, 	{ LLongMem, 0, 0 } },
+{"prefetcht2",  1, 0x0f18,  3, FP|Modrm, 	{ LLongMem, 0, 0 } },
+{"psadbw",    2, 0x0ff6,    X, FP|Modrm,	{ RegMMX|LLongMem, RegMMX, 0 } },
+{"pshufw",    3, 0x0f70,    X, FP|Modrm,	{ Imm8, RegMMX|LLongMem, RegMMX } },
+{"rcpps",     2, 0x0f53,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"rcpss",     2, 0xf30f53,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"rsqrtps",   2, 0x0f52,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"rsqrtss",   2, 0xf30f52,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"sfence",    0, 0x0faef8,  X, FP,		{ 0, 0, 0 } },
+{"shufps",    3, 0x0fc6,    X, FP|Modrm,	{ Imm8, RegXMM|LLongMem, RegXMM } },
+{"sqrtps",    2, 0x0f51,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"sqrtss",    2, 0xf30f51,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"stmxcsr",   1, 0x0fae,    3, FP|Modrm, 	{ WordMem, 0, 0 } },
+{"subps",     2, 0x0f5c,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"subss",     2, 0xf30f5c,  X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"ucomiss",   2, 0x0f2e,    X, FP|Modrm,	{ RegXMM|WordMem, RegXMM, 0 } },
+{"unpckhps",  2, 0x0f15,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"unpcklps",  2, 0x0f14,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+{"xorps",     2, 0x0f57,    X, FP|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
+
+/* AMD 3DNow! instructions.  */
+
+{"prefetch", 1, 0x0f0d,	   0, FP|Modrm,		{ ByteMem, 0, 0 } },
+{"prefetchw",1, 0x0f0d,	   1, FP|Modrm,		{ ByteMem, 0, 0 } },
+{"femms",    0, 0x0f0e,	   X, FP,		{ 0, 0, 0 } },
+{"pavgusb",  2, 0x0f0f, 0xbf, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pf2id",    2, 0x0f0f, 0x1d, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pf2iw",    2, 0x0f0f, 0x1c, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } }, /* Athlon */
+{"pfacc",    2, 0x0f0f, 0xae, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfadd",    2, 0x0f0f, 0x9e, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfcmpeq",  2, 0x0f0f, 0xb0, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfcmpge",  2, 0x0f0f, 0x90, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfcmpgt",  2, 0x0f0f, 0xa0, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfmax",    2, 0x0f0f, 0xa4, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfmin",    2, 0x0f0f, 0x94, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfmul",    2, 0x0f0f, 0xb4, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfnacc",   2, 0x0f0f, 0x8a, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } }, /* Athlon */
+{"pfpnacc",  2, 0x0f0f, 0x8e, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } }, /* Athlon */
+{"pfrcp",    2, 0x0f0f, 0x96, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfrcpit1", 2, 0x0f0f, 0xa6, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfrcpit2", 2, 0x0f0f, 0xb6, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfrsqit1", 2, 0x0f0f, 0xa7, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfrsqrt",  2, 0x0f0f, 0x97, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfsub",    2, 0x0f0f, 0x9a, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pfsubr",   2, 0x0f0f, 0xaa, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pi2fd",    2, 0x0f0f, 0x0d, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pi2fw",    2, 0x0f0f, 0x0c, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } }, /* Athlon */
+{"pmulhrw",  2, 0x0f0f, 0xb7, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } },
+{"pswapd",   2, 0x0f0f, 0xbb, FP|Modrm|ImmExt,	{ RegMMX|LongMem, RegMMX, 0 } }, /* Athlon */
 
 {NULL, 0, 0, 0, 0, { 0, 0, 0} }	/* sentinel */
 };
 #undef X
-#undef ReverseModrm
 #undef NoSuf
 #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 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 */
 
 
-/* 386 register table */
+/* 386 register table.  */
 
 static const reg_entry i386_regtab[] = {
+  /* make %st first as we test for it */
+  {"st", FloatReg|FloatAcc, 0},
   /* 8 bit regs */
   {"al", Reg8|Acc, 0},
   {"cl", Reg8|ShiftCount, 1},
@@ -1030,16 +1149,7 @@
   {"tr5", Test, 5},
   {"tr6", Test, 6},
   {"tr7", Test, 7},
-  /* float registers */
-  {"st(0)", FloatReg|FloatAcc, 0},
-  {"st", 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},
+  /* mmx and simd registers */
   {"mm0", RegMMX, 0},
   {"mm1", RegMMX, 1},
   {"mm2", RegMMX, 2},
@@ -1047,7 +1157,26 @@
   {"mm4", RegMMX, 4},
   {"mm5", RegMMX, 5},
   {"mm6", RegMMX, 6},
-  {"mm7", RegMMX, 7}
+  {"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}
+};
+
+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}
 };
 
 #define MAX_REG_NAME_SIZE 8	/* for parsing register names from input */
diff --git a/include/opcode/m68k.h b/include/opcode/m68k.h
index ecb3f95..3208b77 100644
--- a/include/opcode/m68k.h
+++ b/include/opcode/m68k.h
@@ -1,5 +1,5 @@
 /* Opcode table header for m680[01234]0/m6888[12]/m68851.
-   Copyright 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation.
+   Copyright 1989, 91, 92, 93, 94, 95, 96, 97, 1999 Free Software Foundation.
 
 This file is part of GDB, GAS, and the GNU binutils.
 
@@ -36,6 +36,8 @@
 #define	m68851  0x080
 #define cpu32	0x100	/* e.g., 68332 */
 #define mcf5200 0x200
+#define mcf5206e 0x400
+#define mcf5307 0x800
 
  /* handy aliases */
 #define	m68040up  (m68040 | m68060)
@@ -43,6 +45,7 @@
 #define	m68020up  (m68020 | m68030up)
 #define	m68010up  (m68010 | cpu32 | m68020up)
 #define	m68000up  (m68000 | m68010up)
+#define mcf       (mcf5200 | mcf5206e | mcf5307)
 
 #define	mfloat  (m68881 | m68882 | m68040 | m68060)
 #define	mmmu    (m68851 | m68030 | m68040 | m68060)
@@ -87,7 +90,7 @@
    operand; the second, the place it is stored.  */
 
 /* Kinds of operands:
-   Characters used: AaBCcDdFfIJkLlMmnOopQqRrSsTtUVvWXYZ0123|*~%;@!&$?/<>#^+-
+   Characters used: AaBCcDdEFfGHIJkLlMmnOopQqRrSsTtU VvWXYZ0123|*~%;@!&$?/<>#^+-
 
    D  data register only.  Stored as 3 bits.
    A  address register only.  Stored as 3 bits.
@@ -121,6 +124,9 @@
    C  the CCR.  No need to store it; this is just for filtering validity.
    S  the SR.  No need to store, just as with CCR.
    U  the USP.  No need to store, just as with CCR.
+   E  the ACC.  No need to store, just as with CCR.
+   G  the MACSR.  No need to store, just as with CCR.
+   H  the MASK.  No need to store, just as with CCR.
 
    I  Coprocessor ID.   Not printed if 1.   The Coprocessor ID is always
       extracted from the 'd' field of word one, which means that an extended
@@ -170,6 +176,9 @@
        for both caches.  Used in cinv and cpush.  Always
        stored in position "d".
 
+    u  Any register, with ``upper'' or ``lower'' specification.  Used
+       in the mac instructions with size word.
+
  The remainder are all stored as 6 bits using an address mode and a
  register number; they differ in which addressing modes they match.
 
@@ -260,6 +269,8 @@
 */
 
 /* Places to put an operand, for non-general operands:
+   Characters used: BbCcDdghijkLlMmNnostWw123456789
+
    s  source, low bits of first word.
    d  dest, shifted 9 in first word
    1  second word, shifted 12
@@ -293,6 +304,24 @@
    C  floating point coprocessor constant - 7 bits.  Also used for static
       K-factors...
    j  Movec register #, stored in 12 low bits of second word.
+   m  For M[S]ACx; 4 bits split with MSB shifted 6 bits in first word
+      and remaining 3 bits of register shifted 9 bits in first word.
+      Indicate upper/lower in 1 bit shifted 7 bits in second word.
+      Use with `R' or `u' format.
+   n  `m' withouth upper/lower indication. (For M[S]ACx; 4 bits split
+      with MSB shifted 6 bits in first word and remaining 3 bits of
+      register shifted 9 bits in first word.  No upper/lower
+      indication is done.)  Use with `R' or `u' format.
+   o  For M[S]ACw; 4 bits shifted 12 in second word (like `1').
+      Indicate upper/lower in 1 bit shifted 7 bits in second word.
+      Use with `R' or `u' format.
+   M  For M[S]ACw; 4 bits in low bits of first word.  Indicate
+      upper/lower in 1 bit shifted 6 bits in second word.  Use with
+      `R' or `u' format.
+   N  For M[S]ACw; 4 bits in low bits of second word.  Indicate
+      upper/lower in 1 bit shifted 6 bits in second word.  Use with
+      `R' or `u' format.
+   h  shift indicator (scale factor), 1 bit shifted 10 in second word
 
  Places to put operand, for general operands:
    d  destination, shifted 6 bits in first word
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index f0a8c7e..68fe57a 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -308,6 +308,7 @@
 #define INSN_ISA3		    0x00000003
 /* MIPS ISA 4 instruction (R8000).  */
 #define INSN_ISA4		    0x00000004
+#define INSN_ISA5		    0x00000005
 
 /* Chip specific instructions.  These are bitmasks.  */
 /* MIPS R4650 instruction.  */
@@ -319,6 +320,31 @@
 /* Toshiba R3900 instruction.  */
 #define INSN_3900                   0x00000080
 
+/* 32-bit code running on a ISA3+ CPU. */
+#define INSN_GP32                   0x00001000
+
+/* Test for membership in an ISA including chip specific ISAs.
+   INSN is pointer to an element of the opcode table; ISA is the
+   specified ISA to test against; and CPU is the CPU specific ISA
+   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. */
+
+#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))
 
 /* This is a list of macro expanded instructions.
  *
diff --git a/include/opcode/mn10300.h b/include/opcode/mn10300.h
index 34e4b0b..12f0367 100644
--- a/include/opcode/mn10300.h
+++ b/include/opcode/mn10300.h
@@ -117,6 +117,23 @@
 
 #define MN10300_OPERAND_RELAX 0x4000
 
+#define MN10300_OPERAND_USP 0x8000
+
+#define MN10300_OPERAND_SSP 0x10000
+
+#define MN10300_OPERAND_MSP 0x20000
+
+#define MN10300_OPERAND_PC 0x40000
+
+#define MN10300_OPERAND_EPSW 0x80000
+
+#define MN10300_OPERAND_RREG 0x100000
+
+#define MN10300_OPERAND_XRREG 0x200000
+
+#define MN10300_OPERAND_PLUS 0x400000
+
+#define MN10300_OPERAND_24BIT 0x800000
 
 /* Opcode Formats.  */
 #define FMT_S0 1
@@ -129,10 +146,16 @@
 #define FMT_D2 8
 #define FMT_D4 9
 #define FMT_D5 10
+#define FMT_D6 11
+#define FMT_D7 12
+#define FMT_D8 13
+#define FMT_D9 14
+#define FMT_D10 15
 
 /* Variants of the mn10300 which have additional opcodes.  */
 #define MN103 300
 #define AM30  300
 
+#define AM33 330
 
 #endif /* MN10300_H */
diff --git a/include/opcode/pj.h b/include/opcode/pj.h
new file mode 100644
index 0000000..8759b62
--- /dev/null
+++ b/include/opcode/pj.h
@@ -0,0 +1,46 @@
+/* Definitions for decoding the picoJava opcode table.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   Contributed by Steve Chamberlain of Transmeta (sac@pobox.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.  */
+
+
+/* Names used to describe the type of instruction arguments, used by
+   the assembler and disassembler.  Attributes are encoded in various fields. */
+
+/*            reloc  size pcrel    uns */
+#define O_N    0
+#define O_16  (1<<4 | 2 | (0<<6) | (0<<3))
+#define O_U16 (1<<4 | 2 | (0<<6) | (1<<3))
+#define O_R16 (2<<4 | 2 | (1<<6) | (0<<3))
+#define O_8   (3<<4 | 1 | (0<<6) | (0<<3))
+#define O_U8  (3<<4 | 1 | (0<<6) | (1<<3))
+#define O_R8  (4<<4 | 1 | (0<<6) | (0<<3))
+#define O_R32 (5<<4 | 4 | (1<<6) | (0<<3))
+#define O_32  (6<<4 | 4 | (0<<6) | (0<<3))
+
+#define ASIZE(x)  ((x) & 0x7)
+#define PCREL(x)  (!!((x) & (1<<6)))
+#define UNS(x)    (!!((x) & (1<<3)))
+
+                  
+typedef struct 
+{
+  short opcode;
+  short opcode_next;
+  char len;
+  unsigned char arg[2];
+  const char *name;
+} pj_opc_info_t;
diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
index a9e3b24..974f0df 100644
--- a/include/opcode/ppc.h
+++ b/include/opcode/ppc.h
@@ -85,6 +85,9 @@
    for the assembler's -many option, and it eliminates duplicates).  */
 #define PPC_OPCODE_ANY (0200)
 
+/* Opcode is supported as part of the 64-bit bridge.  */
+#define PPC_OPCODE_64_BRIDGE (0400)
+
 /* A macro to extract the major opcode from an instruction.  */
 #define PPC_OP(i) (((i) >> 26) & 0x3f)
 
diff --git a/include/partition.h b/include/partition.h
new file mode 100644
index 0000000..f49d67a
--- /dev/null
+++ b/include/partition.h
@@ -0,0 +1,81 @@
+/* List implentation of a partition of consecutive integers.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by CodeSourcery, LLC.
+
+   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.  */
+
+/* This package implements a partition of consecutive integers.  The
+   elements are partitioned into classes.  Each class is represented
+   by one of its elements, the canonical element, which is chosen
+   arbitrarily from elements in the class.  The principal operations
+   on a partition are FIND, which takes an element, determines its
+   class, and returns the canonical element for that class, and UNION,
+   which unites the two classes that contain two given elements into a
+   single class.
+
+   The list implementation used here provides constant-time finds.  By
+   storing the size of each class with the class's canonical element,
+   it is able to perform unions over all the classes in the partition
+   in O (N log N) time.  */
+
+#ifndef _PARTITION_H
+#define _PARTITION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ansidecl.h>
+#include <stdio.h>
+
+struct partition_elem
+{
+  /* The canonical element that represents the class containing this
+     element.  */
+  int class_element;
+  /* The next element in this class.  Elements in each class form a
+     circular list.  */
+  struct partition_elem* next;
+  /* The number of elements in this class.  Valid only if this is the
+     canonical element for its class.  */
+  unsigned class_count;
+};
+
+typedef struct partition_def 
+{
+  /* The number of elements in this partition.  */
+  int num_elements;
+  /* The elements in the partition.  */
+  struct partition_elem elements[1];
+} *partition;
+
+extern partition partition_new          PARAMS((int));
+extern void partition_delete            PARAMS((partition));
+extern int partition_union              PARAMS((partition,
+						int,
+						int));
+extern void partition_print             PARAMS((partition,
+						FILE*));
+
+/* Returns the canonical element corresponding to the class containing
+   ELEMENT__ in PARTITION__.  */
+
+#define partition_find(partition__, element__) \
+    ((partition__)->elements[(element__)].class_element)
+
+#endif /* _PARTITION_H */
diff --git a/include/remote-sim.h b/include/remote-sim.h
index a4480b4..b32f93f 100644
--- a/include/remote-sim.h
+++ b/include/remote-sim.h
@@ -211,7 +211,27 @@
 void sim_info PARAMS ((SIM_DESC sd, int verbose));
 
 
-/* Run (or resume) the simulated program.  */
+/* Run (or resume) the simulated program.
+
+   STEP, when non-zero indicates that only a single simulator cycle
+   should be emulated.
+
+   SIGGNAL, if non-zero is a (HOST) SIGRC value indicating the type of
+   event (hardware interrupt, signal) to be delivered to the simulated
+   program.
+
+   Hardware simulator: If the SIGRC value returned by
+   sim_stop_reason() is passed back to the simulator via SIGGNAL then
+   the hardware simulator shall correctly deliver the hardware event
+   indicated by that signal.  If a value of zero is passed in then the
+   simulation will continue as if there were no outstanding signal.
+   The effect of any other SIGGNAL value is is implementation
+   dependant.
+
+   Process simulator: If SIGRC is non-zero then the corresponding
+   signal is delivered to the simulated program and execution is then
+   continued.  A zero SIGRC value indicates that the program should
+   continue as normal. */
 
 void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal));
 
@@ -234,13 +254,13 @@
    (SIGTRAP); a completed single step (SIGTRAP); an internal error
    condition (SIGABRT); an illegal instruction (SIGILL); Access to an
    undefined memory region (SIGSEGV); Mis-aligned memory access
-   (SIGBUS).
+   (SIGBUS).  For some signals information in addition to the signal
+   number may be retained by the simulator (e.g. offending address),
+   that information is not directly accessable via this interface.
 
-   SIM_SIGNALLED: The program has stopped. The simulator has
-   encountered target code that requires the (HOST) signal SIGRC to be
-   delivered to the simulated program.  Ex: `kill (getpid (),
-   TARGET_SIGxxx)'.  Where TARGET_SIGxxx has been translated into a
-   host signal.  FIXME: This is not always possible..
+   SIM_SIGNALLED: The program has been terminated by a signal. The
+   simulator has encountered target code that causes the the program
+   to exit with signal SIGRC.
 
    SIM_RUNNING, SIM_POLLING: The return of one of these values
    indicates a problem internal to the simulator. */
@@ -288,15 +308,27 @@
 void sim_size PARAMS ((int i));
 
 
-/* Run a simulation with tracing enabled.
+/* Single-step simulator with tracing enabled.
    THIS PROCEDURE IS DEPRECIATED.
+   THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE
    GDB and NRUN do not use this interface.
-   This procedure does not take a SIM_DESC argument as it is
-   used before sim_open. */
+   This procedure returns: ``0'' indicating that the simulator should
+   be continued using sim_trace() calls; ``1'' indicating that the
+   simulation has finished. */
 
 int sim_trace PARAMS ((SIM_DESC sd));
 
 
+/* Enable tracing.
+   THIS PROCEDURE IS DEPRECIATED.
+   GDB and NRUN do not use this interface.
+   This procedure returns: ``0'' indicating that the simulator should
+   be continued using sim_trace() calls; ``1'' indicating that the
+   simulation has finished. */
+
+void sim_set_trace PARAMS ((void));
+
+
 /* Configure the size of the profile buffer.
    THIS PROCEDURE IS DEPRECIATED.
    GDB and NRUN do not use this interface.
diff --git a/include/sim-d10v.h b/include/sim-d10v.h
new file mode 100644
index 0000000..84eab2a
--- /dev/null
+++ b/include/sim-d10v.h
@@ -0,0 +1,103 @@
+/* This file defines the interface between the d10v simulator and gdb.
+   Copyright (C) 1999 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.  */
+
+#if !defined (SIM_D10V_H)
+#define SIM_D10V_H
+
+#ifdef __cplusplus
+extern "C" { // }
+#endif
+
+/* GDB interprets addresses as:
+
+   0x00xxxxxx: Physical unified memory segment     (Unified memory)
+   0x01xxxxxx: Physical instruction memory segment (On-chip insn memory)
+   0x02xxxxxx: Physical data memory segment        (On-chip data memory)
+   0x10xxxxxx: Logical data address segment        (DMAP translated memory)
+   0x11xxxxxx: Logical instruction address segment (IMAP translated memory)
+
+   The remote d10v board interprets addresses as:
+
+   0x00xxxxxx: Physical unified memory segment     (Unified memory)
+   0x01xxxxxx: Physical instruction memory segment (On-chip insn memory)
+   0x02xxxxxx: Physical data memory segment        (On-chip data memory)
+
+   The following translate a virtual DMAP/IMAP offset into a physical
+   memory segment assigning the translated address to PHYS.  Since a
+   memory access may cross a page boundrary the number of bytes for
+   which the translation is applicable (or 0 for an invalid virtual
+   offset) is returned. */
+
+enum
+  {
+    SIM_D10V_MEMORY_UNIFIED = 0x00000000,
+    SIM_D10V_MEMORY_INSN = 0x01000000,
+    SIM_D10V_MEMORY_DATA = 0x02000000,
+    SIM_D10V_MEMORY_DMAP = 0x10000000,
+    SIM_D10V_MEMORY_IMAP = 0x11000000
+  };
+
+extern unsigned long sim_d10v_translate_dmap_addr
+  (unsigned long offset,
+   int nr_bytes,
+   unsigned long *phys,
+   unsigned long (*dmap_register) (int reg_nr));
+
+extern unsigned long sim_d10v_translate_imap_addr
+  (unsigned long offset,
+   int nr_bytes,
+   unsigned long *phys,
+   unsigned long (*imap_register) (int reg_nr));
+
+extern unsigned long sim_d10v_translate_addr
+  (unsigned long vaddr,
+   int nr_bytes,
+   unsigned long *phys,
+   unsigned long (*dmap_register) (int reg_nr),
+   unsigned long (*imap_register) (int reg_nr));
+
+
+/* The simulator makes use of the following register information. */
+
+enum
+  {
+    SIM_D10V_R0_REGNUM = 0,
+    SIM_D10V_CR0_REGNUM = 16,
+    SIM_D10V_A0_REGNUM = 32,
+    SIM_D10V_SPI_REGNUM = 34,
+    SIM_D10V_SPU_REGNUM = 35,
+    SIM_D10V_IMAP0_REGNUM = 36,
+    SIM_D10V_DMAP0_REGNUM = 38,
+    SIM_D10V_TS2_DMAP_REGNUM = 40
+  };
+
+enum
+  {
+    SIM_D10V_NR_R_REGS = 16,
+    SIM_D10V_NR_A_REGS = 2,
+    SIM_D10V_NR_IMAP_REGS = 2,
+    SIM_D10V_NR_DMAP_REGS = 4,
+    SIM_D10V_NR_CR_REGS = 16
+  };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/wait.h b/include/wait.h
deleted file mode 100644
index fa3c9cc..0000000
--- a/include/wait.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Define how to access the int that the wait system call stores.
-   This has been compatible in all Unix systems since time immemorial,
-   but various well-meaning people have defined various different
-   words for the same old bits in the same old int (sometimes claimed
-   to be a struct).  We just know it's an int and we use these macros
-   to access the bits.  */
-
-/* The following macros are defined equivalently to their definitions
-   in POSIX.1.  We fail to define WNOHANG and WUNTRACED, which POSIX.1
-   <sys/wait.h> defines, since our code does not use waitpid().  We
-   also fail to declare wait() and waitpid().  */   
-
-#ifndef	WIFEXITED
-#define WIFEXITED(w)	(((w)&0377) == 0)
-#endif
-
-#ifndef	WIFSIGNALED
-#define WIFSIGNALED(w)	(((w)&0377) != 0177 && ((w)&~0377) == 0)
-#endif
-
-#ifndef	WIFSTOPPED
-#ifdef IBM6000
-
-/* Unfortunately, the above comment (about being compatible in all Unix 
-   systems) is not quite correct for AIX, sigh.  And AIX 3.2 can generate
-   status words like 0x57c (sigtrap received after load), and gdb would
-   choke on it. */
-
-#define WIFSTOPPED(w)	((w)&0x40)
-
-#else
-#define WIFSTOPPED(w)	(((w)&0377) == 0177)
-#endif
-#endif
-
-#ifndef	WEXITSTATUS
-#define WEXITSTATUS(w)	(((w) >> 8) & 0377) /* same as WRETCODE */
-#endif
-
-#ifndef	WTERMSIG
-#define WTERMSIG(w)	((w) & 0177)
-#endif
-
-#ifndef	WSTOPSIG
-#define WSTOPSIG	WEXITSTATUS
-#endif
-
-/* These are not defined in POSIX, but are used by our programs.  */
-
-#define WAITTYPE	int
-
-#ifndef	WCOREDUMP
-#define WCOREDUMP(w)	(((w)&0200) != 0)
-#endif
-
-#ifndef	WSETEXIT
-#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
-#endif
-
-#ifndef	WSETSTOP
-#define WSETSTOP(w,sig)	   ((w) = (0177 | ((sig) << 8)))
-#endif
-
diff --git a/intl/ChangeLog.Cygnus b/intl/ChangeLog.Cygnus
deleted file mode 100644
index 6d32da6..0000000
--- a/intl/ChangeLog.Cygnus
+++ /dev/null
@@ -1,30 +0,0 @@
-Tue May 26 18:29:09 1998  Ian Lance Taylor  <ian@cygnus.com>
-
-	* Makefile.in (distclean): Remove config.log.
-
-Sun May 10 22:35:54 1998  Jeffrey A Law  (law@cygnus.com)
-
-        * po/Makefile.in (install-info): New target.
-
-Sun Apr 19 19:20:00 1998  Tom Tromey  <tromey@cygnus.com>
-
-	* aclocal.m4, configure: Rebuilt.
-	* configure.in: Call AC_LINK_FILES so that <libintl.h> will
-	always exist.
-
-Fri Mar 27 16:37:25 1998  Tom Tromey  <tromey@cygnus.com>
-
-	* aclocal.m4, configure: Rebuilt with new cygettext.m4.
-
-Wed Mar 25 15:00:14 1998  Tom Tromey  <tromey@cygnus.com>
-
-	* configure.in: Build config.h from config.in.
-	* config.h.in: Removed.
-	* config.in: New file.
-
-	* config.h.in: New file.
-
-	* configure.in, configure, acconfig.h, aclocal.m4: New files.
-	* Makefile.in (OBJECTS): Depend on config.h, not ../config.h.
-	(Makefile): Rebuild Makefile here, not in `..'.
-
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2302da3..b1e37f6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,20 +1,1049 @@
-1999-04-29  Nick Clifton  <nickc@cygnus.com>
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
 
-	* emulparams/elf32mcore.sh (OTHER_BSS_SYMBOLS): Define.
-	(OTHER_BSS_END_SYMBOLS): Define.
+	* configure.tgt (avr-*-*): New target support.
+	* Makefile.am: Likewise.
+	* scripttempl/elf32avr.sc: New script file.
+	* emulparams/avr1200.sh: New file.
+	* emulparams/avr23xx.sh: New file.
+	* emulparams/avr4433.sh New file.
+	* emulparams/avr44x4.sh New file.
+	* emulparams/avr85xx.sh New file.
+	* emulparams/avrmega103.sh New file.
+	* emulparams/avrmega161.sh New file.
+	* emulparams/avrmega603.sh New file.
+	* Makefile.in: Regenerate.
 
-	* scripttempl/mcorepe.sc: New file: Duplicte of pe.sc with stack
-	section added.
+2000-03-09  Andreas Jaeger  <aj@suse.de>
+
+	* Makefile.am (check-DEJAGNU): Also unset LANG.
+	* Makefile.in: Rebuild.
+
+2000-03-06  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldfile.c (ldfile_try_open_bfd): Don't crash if we see an empty
+	archive.
+
+2000-03-02  H.J. Lu  <hjl@gnu.org>
+
+	* emulparams/elf32mcore.sh: Include "getopt.h".
+
+2000-03-01  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.tgt: Remove *-*-aout, *-*-coff, and *-*-netware.
+
+2000-03-01  H.J. Lu  <hjl@gnu.org>
+
+	* emulparams/mipspe.sh: Add SUBSYSTEM and INITIAL_SYMBOL_CHAR.
+	* emulparams/shpe.sh: Likewise.
+
+2000-03-01  Nick Clifton  <nickc@cygnus.com>
+
+	* pe-dll.c: Remove unused variables and add ATTRIBUTE_UNUSED
+	to unused parameters.
+
+	* emultempl/pe.em: Add "#ifdef DLL_SUPPORT" around static
+	functions only used by DLL code.
+	(_place_orphan): Initialise 'dollar'.
+
+2000-03-01  H.J. Lu  <hjl@gnu.org>
+
+	* ldmain.c (undefined_symbol): Take one more arg, fatal, to
+	indicate if the undefined symbol is a fatal error or not.
+	Don't delete the output file if "fatal" is false.
+
+2000-02-29  H.J. Lu  <hjl@gnu.org>
+
+	* Makefile.am (check-DEJAGNU): Also pass LIBS="$(LIBS)". 
+	Set LC_COLLATE and LC_ALL to null and export them. It is for
+	sort which expects the C locale.
+	Add $(LIBS) to all $(HOSTING_LIBS).
+	* Makefile.in: Rebuild.
+
+2000-02-29  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* emultempl/{aix.em, armcoff.em, armelf.em, armelf_oabi.em,
+	beos.em, elf32.em, generic.em, gld960.em, gld960c.em, hppaelf.em,
+	linux.em, lnk960.em, mipsecoff.em, sunos.em, vanilla.em}
+	(ld_emulation_xfer_struct): Add missing NULL initialiser for
+	find_potential_libraries.
+
+2000-02-28  Jim Blandy  <jimb@redhat.com>
+
+	* ldgram.y (exclude_name_list): Don't require a comma to separate
+ 	list entries; the lexer considers commas to be valid part of a
+	filename, so in something like `foo, bar' the comma is considered
+	part of the first filename, `foo,'.
+	* ld.texinfo: Update section on EXCLUDE_FILE lists.
+
+2000-02-27  Loren J. Rittle  <ljrittle@acm.org>
+
+	* configure.host: Added HOSTING_CRT0, HOSTING_LIBS for
+	host "i[3456]86-*-freebsdelf*".
+
+2000-02-27  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* scripttempl/i386go32.sc: Move misplaced semicolons.
+
+2000-02-25  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am (ALL_EMULATIONS): Remove ehppaelf.o.
+	(ALL_64_EMULATIONS): Remove eelf64hppa.o.
+	(eelf64hppa.c, ehppaelf.c): Remove targets.
+	* Makefile.in: Rebuild.
+
+2000-02-25  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+	* configure.tgt (targ_extra_ofiles): Enable elf64_sparc on
+	GNU/Linux/sparc, but keep the default as 32.
+
+	* configure.tgt: Enable elf64_sparc on Solaris7+/sparc.  And make
+	it default if sparcv9 or sparc64.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.am: Add rules to build emipspe.o and earmpe.o.
+	* Makefile.in: Regenerate.
+	* configure.tgt: Add targets for arm-wince, sh-pe and mips-pe.
+
+	* ldemul.h (ld_emulation_xfer_struct): Add new field:
+	find_potential_libraries.
+	* ldemul.c (ldemul_find_potential_libraries): New function.
+
+	* ldfile.c (ldfile_open_file_search): Allow function to be
+	exported. 
+	(ldfile_open_file): Call ldemul_find_potential_libraries.
+	* ldfile.h: Add prototype for ldfile_open_file_search.
+
+	* pe-dll.c: Add support for ARM, MIPS and SH targets.
+
+	* emulparams/mipspe.sh: New file.  Parameters for mips-pe target.
+	* emulparams/shpe.sh: New file.  Parameters for sh-pe target.
+
+	* emultempl/pe.em: Add support for ARM, MIPS and SH DLLs.
+	(gld_X_find_potential_libraries): New function.  Search for
+	libraries called "*.lib".
+
+	* scriptempl/pe.sc: Add .pdata section.
+
+2000-02-23  Richard Henderson  <rth@cygnus.com>
+
+	* scripttempl/elfd10v.sc: Remove dynamic linking hooks.
+	Add and use memory regions.
+
+2000-02-23  Linas Vepstas (linas@linas.org)
+
+	* emulparams/elf32i370.sh, scripttempl/elfi370.sc: New.
+
+	* Makefile.am: Add support for Linux/IBM 370.
+	* configure.tgt: Likewise.
+
+	* Makefile.in: Regenerate.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* ldlang.c (print_input_section, print_data_statement,
+	print_reloc_statement, print_padding_statement, insert_pad,
+	size_input_section, lang_check_section_addresses,
+	lang_size_sections, lang_do_assignments, lang_set_startof,
+	lang_one_common): Change `opb' to unsigned. 
+	(lang_do_assignments): Also change `size' to unsigned.
+
+2000-02-16  Richard Henderson  <rth@cygnus.com>
+
+	* scripttempl/elf.sc: Place OTHER_PLT_RELOC_SECTION.
+
+2000-02-16  Timothy Wall  <twall@cygnus.com>
+
+	* mri.c (mri_draw_tree): Add default LMA region argument to call
+	to lang_leave_output_section_statement.
+	* ldlang.h: Update prototypes with LMA region arguments.
+	* ldlang.c (lang_size_sections): Encapsulate region bounds
+	checking in os_check_region call.
+	(os_check_region): New function.
+	(lang_output_section_statement_lookup): Initialize lma_region.
+	(lang_leave_output_section_statement): Add LMA region argument.
+	(lang_leave_overlay): Ditto.
+	* ldgram.y: Handle LMA region syntax.
+	* ld.texinfo (Output Section Description): Describe LMA region usage.
+	* emultempl/armelf.em (gld$place_orphan): Add default value for
+	lma region in call to lang_leave_output_statement.
+	* emultempl/elf32.em (gld$place_orphan): Add default value for
+	lma region in call to lang_leave_output_statement.
+	* emultempl/pe.em (gld$place_orphan): Add default value for
+	lma region in call to lang_leave_output_statement.
+	
+	
+2000-02-04  Timothy Wall  <twall@redhat.com>
+
+	* ldlang.c (lang_check_section_addresses): Use bytes instead of
+	octets when calculating section end addresses.
+
+2000-02-04  Timothy Wall  <twall@redhat.com>
+
+	* ldlang.c (lang_size_sections): Fix typo in ALIGN_N invocation.
+
+2000-02-03  Timothy Wall <twall@redhat.com>
+
+	* ld/ldexp.c (fold_name): Make SIZEOF operator return byte count, not
+	octet count.
+	* ld/ldlang.c (print_input_section, print_data_statement,
+	print_reloc_statement, print_padding_statement): Print target
+	address values and section sizes as bytes, not octets.
+	(insert_pad) Calculate padding size in octets, and adjust "dot"
+	by bytes.
+	(size_input_section) Always adjust "dot" by bytes, not octets.
+	(lang_check_section_addresses, lang_do_assignments) Adjust
+	"dot" by bytes, not octets.  Use the larger of the directive size
+	or octets_per_byte for the number of octets actually allocated in
+	the output section.
+	(lang_set_startof) Make sure STARTOF returns a target address.
+	(lang_one_common) Record size changes in octets.
+	(lang_abs_symbol_at_end_of) Section end symbol's value is
+	recorded in target bytes.
+	* ld.texinfo:   Updated description of BYTE, SHORT, LONG, etc.
+	to be clear about behavior when an octet is smaller than one byte.
+	
+2000-01-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* ldcref.c (output_cref): Don't pass message strings to printf
+	as format arg.
+	Update copyright.
+
+	* ldmisc.c (vfinfo): Same here.
+	Update copyright.
+
+2000-01-23  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* emultempl/{armcoff.em,armelf.em,armelf_oabi.em,beos.em,
+	generic.em,gld960.em,gld960c.em,hppaelf.em,linux.em,lnk960.em,
+	mipsecoff.em,sunos.em,vanilla.em} (ld_emulation_xfer_struct):
+	Add missing NULL initialisers, and comments.
+
+	* testsuite/ld-srec/sr3.cc (__rethrow): New.
+
+2000-01-21  Nick Clifton  <nickc@cygnus.com>
+
+	* ldlang.c (lang_size_sections): Fix typo in comment.
+
+2000-01-18  H.J. Lu  <hjl@gnu.org>
+
+	* ldlang.c (lang_size_sections): Also update the current
+	address of a region if the SEC_NEVER_LOAD bit is not set.
+
+2000-01-10  Philip Blundell  <pb@futuretv.com>
+
+	* configure.tgt (arm*-*-conix*): New target.
+
+2000-01-07  Nick Clifton  <nickc@cygnus.com>
+
+	* ld.texinfo (Options): Remind users to preceed linker command
+	line switches with -Wl, (or whatever is appropriate) if it is
+	being invoked by a comnpiler driver program.
+	Fix description of the behaviour of the -n command line switch. 
+
+Wed Jan  5 08:02:12 2000  Catherine Moore  <clm@cygnus.com>
+
+	* ld.h (wildcard_spec):  Change exclude_name to exclude_name_list.
+	(name_list): New.
+	* ld.texinfo (EXCLUDE_FILE): Update documentation.
+	* ldgram.y (wildcard_spec): Support a list of excluded_files.
+	(exclude_name_list): New.
+	ldlang.c (walk_wild_section): Support list of excluded files.
+	(print_wild_statement): Likewise.
+	(lang_add_wild): Likewise.
+	* ldlang.h (lang_wild_statement_type): Likewise.
+	* scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
+	
+2000-01-04  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* pe-dll.c (pe_dll_warn_dup_exports): New variable.
+	(process_def_file): Use.
+	(pe_dll_compat_implib): New variable.
+	(make_one): Use.
+	
+	* pe-dll.h: Add exports of pe_dll_warn_dup_exports and
+	pe_dll_compat_implib.
+	
+	* emultempl/pe.em (longopts): Add warn-duplicate-exports and 
+	compat-implib options.
+	(gld_${EMULATION_NAME}_list_options): List new options.
+	(gld_${EMULATION_NAME}_parse_args): Handle.
+
+	* pe-dll.c (pe_dll_generate_implib): Use the correct name for output 
+	dll.
+	
+        * deffilep.y (opt_name): Allow "." in name.
+
+1999-12-02  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.am: Fix arm-epoc-pe dependencies.
+	* Makefile.in: Regenerate.
+	
+	* emulparams/arm_epoc_pe.sh (SCRIPT_NAME): Set to epocpe.
+
+	* scripttempl/epocpe.sc: New file: copy of pe.sc, customised for
+	EPOC by placing .rdata into .text.
+
+1999-11-26  Andreas Schwab  <schwab@suse.de>
+
+	* configure.in: Put AC_MSG_CHECKING/AC_MSG_RESULT around check for
+	STRINGIFY.  Use yes/no instead of true/false as value for cache
+	variable.
+	* configure: Regenerate.
+
+1999-11-24  Nick Clifton  <nickc@cygnus.com>
+
+	* ldlang.c (IGNORE_SECTION): Section must have both ALLOC and LOAD
+	attributes in order to be checked.
+
+1999-11-22  Nick Clifton  <nickc@cygnus.com>
+
+	* ldlang.c (lang_check_section_addresses): Fix test to determine
+	if a section should be tested.
+	(IGNORE_SECTION): New macro.
+
+Wed Nov  3 23:31:19 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+	Clean up code to use EXTRA_SHLIB_EXTENSION.
+
+1999-11-03  Nick Clifton  <nickc@cygnus.com>
+
+	* emulparams/elf32mcore.sh (OUTPUT_FORMAT): Change to little endian.
+	* emulparams/mcorepe.sh (OUTPUT_FORMAT): Change to little endian.
+
+1999-11-01  Steve Chamberlain  <sac@pobox.com>
+
+	* ldlang.c (section_already_linked): Rework to use hash table.
+	(already_linked_newfunc): New function.
+	(already_linked_table_init): New function.
+	(already_linked_table_free): New function.
+	(lang_process): Initialize and free the already_linked hash table.
+
+1999-10-27  Andreas Jaeger  <aj@suse.de>
+
+	* ld/configure.host: Added HOSTING_CRT0, HOSTING_LIBS for 
+	target "mips*-*-linux-gnu*".
+
+1999-10-27  Scott Bambrough  <scottb@netwinder.org>
+
+	* emultempl/armelf.em: Include ctype.h to prevent compile time
+	warnings. 
+
+1999-10-26  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/armcoff.em (gld{}_finish): Remove extraneous
+	underscore from prototype.
+	* emultempl/armelf.em (gld{}_finish): Remove extraneous
+	underscore from prototype.
+
+1999-10-07  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocs
+	being .rel.sdata, .rel.sdata.*, .rel.gnu.linkonce.s*.
+	(.rela.sdata): Likewise for .rela.sdata.* and .rela.gnu.linkonce.s*.
+	(.rel.sbss): Make like .rel.bss.
+	(.rela.sbss): Make like .rel.bss.
+	(.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when
+	ld -r.
+	(.sbss): Do the same things as for .bss: include SDATA_START_SYMBOLS,
+	.dynsbss.
+
+1999-09-29  Andrew Haley  <aph@cygnus.com>
+
+	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Defer
+	merging sections when not relocating.
+
+1999-09-28  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* pe-dll.c (process_def_file): Move the offset lookup from here to
+	(fill_exported_offsets): here. New static function.
+	(fill_edata): Use.
+	
+1999-09-28  Mumit Khan  <khan@xraylith.wisc.edu>
+
+	* deffilep.y (tokens): Add upper and lower case versions of DATA,
+	CONSTANT, NONAME and PRIVATE tokens.
+	(command): Use DATAU.
+	(expline): Allow for drectve syntax as well.
+	(exp_opt_list): Likewise.
+	(exp_opt): Likewise.
+	* pe-dll.c (make_one): Only generate the idata entries for data
+	symbols.
+
+1999-09-28  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
+	in .sdata too.
+
+1999-09-26  Nick Clifton  <nickc@cygnus.com>
+
+	* scripttempl/elf.sc (.bss): Accept sections named .bss.*
+	(.sbss): Accept sections names .sbss.*
+
+1999-09-22  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.am: Add earm_epoc_pe.c build target. 
+
+Sat Sep 18 07:57:10 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (OTHER_READONLY_SYMBOLS): Remove ".stubs",
+	they've been renamed to ".stub", which is handled automatically
+	by elf.sc.
+
+Fri Sep 17 11:00:33 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (TEXT_START_SYMBOLS): Kill completely.
+	(DATA_START_SYMBOLS): Kill __hp_load_map definition
+
+Thu Sep 16 10:59:56 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+	Use the same filename extension for the bfd_elf_dt_needed_name call
+	as we did for finding the library.
+
+	* emulparms/elf64hppa.sh (DATA_START_SYMBOLS): Define.
+	(OTHER_READWRITE_SECTIONS): No longer define __hp_load_map.
+
+	* emulparms/elf64hppa.sh (TEXT_START_SYMBOLS): Define.
+
+Wed Sep 15 02:47:43 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (SHLIB_TEXT_START_ADDR): Define.
+	(SHLIB_DATA_ADDR): Likewise.
+
+	* emulparms/elf64hppa.sh (TEXT_DYNAMIC): Define.
+
+	* emulparms/elf64hppa.h (OTHER_READWRITE_SECTIONS):  No longer combine
+	the .plt, .dlt, .opd  into a single output section.  Provide values
+	for __gp and __hp_load_map.
+
+1999-09-14  Michael Meissner  <meissner@cygnus.com>
+
+	* configure.in (Canonicalization of target names): Remove adding
+	${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+	generates $ac_config_sub with a ${CONFIG_SHELL} already.
+	* configure: Regenerate.
+
+1999-09-14  Donn Terry  <donn@interix.com>
+
+	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): allow for 
+	terminating null.
+
+1999-09-14  Ulrich Drepper  <drepper@cygnus.com>
+
+	* configure.in: Define EXTRA_SHLIB_EXTENSION to ".sl" for HP target.
+	* config.in: Add EXTRA_SHLIB_EXTENSION.
+
+	* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+	Search for second shared lib extension only if EXTRA_SHLIB_EXTENSION
+	is defined.
+
+1999-09-14  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.in: Add earm_epoc_pe.c build target.
+
+Tue Sep 14 05:26:34 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.dlt.
+
+1999-09-13  Donn Terry  <donn@interix.com>
+
+	* emultempl/pe.em: Remove the output file at the start, in case it
+	is not writable.
+
+Mon Sep 13 00:17:18 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+	Search for file with .sl extension if no file with a .so extension
+	is found.
+
+	* emulparms/elf64hppa.sh (OTHER_READWRITE_SECTIONS): Put .plt
+	at the start of the .dlt output section.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* pe.em: Don't include "../bfd/libbfd.h".
+	(gld_${EMULATION_NAME}_after_open): Use xmalloc rather than
+	bfd_alloc.
+
+	* pe-dll.h: New file.
+	* pe-dll.c: Include "pe-dll.h".  Mark unused arguments as needed
+	to avoid warnings.
+	(edata_sz, reloc_sz): Change from int to size_t.
+	(pe_details_type): Change type of imagebase_reloc from int to
+	unsigned int.
+	(pe_detail_list): Fully initialize last entry.
+	(pe_dll_id_target): Change parameter to const.
+	(pe_dll_generate_def_file): Likewise.
+	(pe_dll_generate_implib): Likewise.
+	(pe_implied_import_dll): Likewise.  Change dll_name to const.
+	* emultempl/pe.em: Include "pe-dll.h".  Remove declarations now in
+	pe-dll.h.
+	(init): Fully initialize __dll__ entry.
+	(gld_${EMULATION_NAME}_after_open): Remove unused variables
+	sequence, elt, and i.
+	* deffile.h: Add preprocessor guard.
+	* deffilep.y (def_debug): Remove.
+	* Makefile.am: Rebuild dependencies.
+	(HFILES): Add pe-dll.h.
+
+1999-09-12  Donn Terry  <donn@interix.com>
+
+	* ld.h (ld_abort): Declare.
+	(abort): Define.
+	* ldmisc.c (ld_abort): Define.
+
+	* scripttempl/pe.sc: Use ${ENTRY} rather than _mainCRTStartup.
+	Move .bss section after .rdata.  Move .reloc section after .rsrc.
+
+	* lexsup.c (parse_args): Use strtoul for --split-by-reloc
+	argument.
+
+	* lexsup.c (parse_args): If we get an unrecognized argument,
+	mention --help.
+
+	* ldlang.c (section_already_linked): Use comdat information if it
+	is available.
+
+	* emultempl/pe.em (PE_DEF_SECTION_ALIGNMENT): If
+	OVERRIDE_SECTION_ALIGNMENT is defined, change to that.
+	(gld_${EMULATION_NAME}_before_parse): Use EXECUTABLE_NAME if it is
+	defined, rather than a.exe.
+	(init): Define __subsystem__ as ${SUBSYSTEM}.
+	(set_pe_subsystem): Add ${INITIAL_SYMBOL_CHAR} before entry symbol
+	name.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldlang.c (open_output): Change local variable desired_endian
+	from int to enum bfd_endian.
+
+	* emulparams/arm_epoc_pe.sh: Define ENTRY, SUBSYSTEM and
+	INITIAL_SYMBOL_CHAR.
+	* emulparams/armpe.sh: Likewise.
+	* emulparams/morepe.sh: Likewise.
+	* emulparams/ppcpe.sh: Likewise.
+	* emulparams/i386pe.sh (ENTRY): Define as _mainCRTStartup.
+	(SUBSYSTEM): Define as PE_DEF_SUBSYSTEM.
+
+Fri Sep 10 00:22:50 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (LIB_PATH): Define.
+
+	* emulparms/elf64hppa.sh (OTHER_READONLY_SECTIONS): Put stubs before
+	unwinders so that they are closer to the text section.
+	(OTHER_BSS_SECTIONS): Define.
+	(EXECUTABLE_SYMBOLS): Provide __SYSTEM_ID and _FPU_STATUS.
+	(INIT_START, INIT_END): Define.
+	(FINI_START, FINI_END): Define.
+	* scripttempl/elf.sc: Add support for INIT_START, INIT_END,
+	FINI_START, FINI_END and OTHER_BSS_SECTIONS.
+
+Thu Sep  9 21:43:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (TEXT_START_ADDR): Move up one page.
+	(DATA_ADDR): Define.
+
+1999-09-09  Stan Shebs  <shebs@andros.cygnus.com>
+
+	* emulparams/d10velf.sh (READONLY_START_ADDR): Set to 0x2000004.
+
+1999-09-09  Andreas Schwab  <schwab@suse.de>
+
+	* ld.texinfo: Fix arguments of @var to not contain punctuation.
+
+Thu Sep  9 05:52:34 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (OTHER_READWRITE_SECTIONS): Define.
+
+1999-09-08  Ulrich Drepper  <drepper@cygnus.com>
+
+	* emulparams/elf64hppa.sh (ELFSIZE): New.  Set to 64.
+
+Wed Sep  8 00:07:39 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparms/elf64hppa.sh (ENTRY): Define to main.
+
+1999-09-03  Scott Bambrough  <scottb@netwinder.org>
+
+	* ld/configure.host: Added HOSTING_CRT0, HOSTING_LIBS for 
+	target "arm*-*-linux-gnu*"
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* configure.tgt (pjl-*-*, pj-*-*): New targets.
+	* emulparams/pjelf.sh: New file.
+	* emulparams/pjlelf.sh: New file.
+	* scripttempl/pj.sc: New file.	
+	* Makefile.am (ALL_EMULATIONS): Add epjelf.o and epjlelf.o.
+	(epjelf.o, epjlelf.o): New targets.
+	* Makefile.in: Rebuild.
+
+Fri Sep  3 20:17:08 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparams/elf64hppa.sh (MAXPAGESIZE): Define.
+	(OTHER_READONLY_SECTIONS, DATA_PLT): Likewise.
+
+Thu Sep  2 14:32:03 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* emulparams/elf64hppa.sh: New file.
+	* configure.tgt (hppa*w-*-*): Use elf64hppa emulation.
+	* Makefile.am (ALL_64_EMULATIONS): Add eelf64hppa.o
+	(eelf64hppa.c): Add dependencies.
+	* Makefile.in: Rebuilt.
+
+1999-08-25  Philip Blundell  <pb@nexus.co.uk>
+
+	* emulparams/armelf.sh (OTHER_BSS_SYMBOLS): Add __end__.
+	* emulparams/armelf_linux.sh: Likewise.
+	* emulparams/armelf_linux26.sh: Likewise.
+
+1999-08-24  Nick Clifton  <nickc@cygnus.com>
+
+	From a patch submitted by Roland McGrath  <roland@baalperazim.frob.com>
+
+	* configure.tgt (arm-*-netbsd*): New target.
+	* Makefile.am (ALL_EMULATIONS): Add earmnbsd.o.
+	(earmnbsd.c): New rule with deps.
+	* Makefile.on: Regenerate.
+	* emulparams/armnbsd.sh: New file.
+
+1999-08-23  Nick Clifton  <nickc@cygnus.com>
+
+	* emulparams/elf32mcore.sh (PARSE_AND_LIST_ARGS): Define.
+	Implement --base-file command line switch.
+
+	* emultempl/elf32.em: Add ability for individual targets to have
+	their own command line switches by defining PARSE_AND_LIST_ARGS.
+
+1999-08-19  Andreas Schwab  <schwab@suse.de>
+
+	* configure.host: Use ${CC} instead of gcc for finding compiler
+	related files.
+
+1999-08-11  Nick Clifton  <nickc@cygnus.com>
+
+	* scripttempl/mcorepe.sc (OUTPUT_FORMAT): Fix typo.
+
+1999-08-09  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* scripttempl/i386go32.sc: Handle g++ exception sections.
+
+1999-08-09  Ian Lance Taylor  <ian@zembu.com>
+
+	From Wally Iimura <iimura@microunity.com>:
+	* ldlang.c (lang_size_sections): When checking whether an address
+	is within a region, don't get confused by wrapping around at the
+	end of the address space.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldlang.c (wild_doit): Update for renaming of SEC_SHORT to
+	SEC_SMALL_DATA.
+
+	* Makefile.am: Rename .dep* files to DEP*.  Change DEP variable to
+	MKDEP.  Rebuild dependencies.
+	* Makefile.in: Rebuild.
+
+1999-08-08  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* configure.host (sparc-*-linux-gnu*): New host.
+	(sparc64-*-linux-gnu*): New host.
+
+1999-08-06  Ian Lance Taylor  <ian@zembu.com>
+
+	* lexsup.c (is_num): Reindent.
+	(parse_args): Mention program name in error message.
+
+	* emultempl/ostring.sed: Rename from stringify.sed.
+	* emultempl/astring.sed: New file.
+	* Makefile.am (stringify.sed): New target.
+	(GEN_DEPENDS): Change $(srcdir)/emultempl/stringify.sed to
+	stringify.sed.
+	* configure.in: Define and substitute STRINGIFY.
+	* emultempl/*.em: Use stringify.sed from build directory rather
+	than source directory.
+	* emultempl/elf32.em: Use stringify.sed rather than inline sed
+	script.
+	* emultempl/gld960.em, emultempl/gld960c.em: Likewise.
+	* emultempl/hppaelf.em, emultempl/linux.em: Likewise.
+	* emultempl/lnk960.em, emultempl/sunos.em: Likewise.
+	* configure, Makefile.in: Rebuild.
+
+1999-08-05  Donn Terry  <donn@interix.com>
+
+	* emulparams/i386pe.sh: Define ENTRY, SUBSYSTEM, and
+	INITIAL_SYMBOL_CHAR.
+	* emulparams/i386pe_posix.sh: New file.
+	* Makefile.am (YACC): If bison is not in the source tree, use
+	@YACC@ rather than bison -y.
+	(LEX): If flex is not in the source tree, use @LEX@ rather than
+	flex.
+	(ALL_EMULATIONS): Add ei386pe_posix.o.
+	(ei386pe_posix.c): New target.
+	* configure.tgt (i[3456]86-*-interix*): New target.
+	* configure.host (i[3456]86-pc-interix*): New host.
+	* Makefile.in: Rebuild.
+
+1999-08-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* emulparams/elf32ppc.sh (MAXPAGESIZE): Change to 0x10000.
+	* emulparams/elf32ppclinux.sh (MAXPAGESIZE): Likewise.
+
+1999-08-03  H.J. Lu  <hjl@gnu.org>
+
+	* Makefile.am (ALL_EMULATIONS): Remove ego32.o.
+	(ego32.c): Remove.
+	* Makefile.in: Rebuild.
+
+1999-07-22  Philip Blundell  <pb@nexus.co.uk>
+
+	* emulparams/armelf_linux26.sh (DATA_START_SYMBOLS): Define.
+	(OTHER_BSS_SYMBOLS, OTHER_BSS_END_SYMBOLS): Likewise.
+	* emulparams/armelf_linux.sh (DATA_START_SYMBOLS): Define.
+
+	* configure.tgt (arm*-*-uclinux*, thumb-*-uclinux*,
+	thumb-*-linux-gnu*): New targets.
+
+1999-07-21  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* scripttempl/i386go32.sc: Add handling of linkonce sections.
+
+	* configure.bat: Remove; obsolete.
+	* emulparams/go32.sh: Remove; obsolete.
+	* scripttempl/go32coff.sc: Remove; obsolete.
+
+1999-07-21  H.J. Lu  <hjl@gnu.org>
+
+	* configure.tgt (mips*el-*-vxworks*): New target.
+
+1999-07-21  Brad M. Garcia  <bgarcia@fore.com>
+
+	* configure.tgt (i[3456]86-*-vxworks*): New target.
+
+Tue Jul 20 15:18:46 1999  Bob Manson  <manson@charmed.cygnus.com>
+
+	* ldlang.c (lang_gc_sections): Only handle the start symbol
+	specially if there is one.
+
+Mon Jul 19 14:19:14 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* emulparams/elf32bmipn32.sh (OTHER_RELOCATING_SECTIONS): Add
+	.MIPS.events and .MIPS.content handling.
+	* emulparams/elf64bmip.sh (OTHER_RELOCATING_SECTIONS): Likewise.
+
+1999-07-17  Nick Clifton  <nickc@cygnus.com>
+
+	* ldlang.c (get_target): New function: Return true iff the
+	given target is the target being sought.
+	(stricpy): New function:  Like strcpy but convert to lower
+	case as well.
+	(strcut): New function:  Like strstr but remove the located
+	substring as well.
+	(name_compare): New function: Compute a compatability rating
+	for two target names.
+	(winner): New variable: Best target found by
+	closest_target_match() so far.
+	(closest_target_match): New function: Find the target which is
+	the closest match to the original target.
+	(get_first_input_target): New function: Find the target format
+	of the first of the linker's input file.
+	(open_output): Be more clever about deciding the output target
+	format. 
+
+1999-07-16  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* emulparams/elf64_sparc.sh: Add 64-bit directories to native LIB_PATH.
+
+Thu Jul 15 15:55:15 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* configure.host: Set up HOSTING_CRT0 and HOSTING_LIBS for IRIX6.
+
+1999-07-15  Ian Lance Taylor  <ian@zembu.com>
+
+	* configure.in: Bump version number to 2.9.5.
+	* configure: Rebuild.
+
+1999-07-14  Richard Henderson  <rth@cygnus.com>
+
+	* ldlang.c (wild_doit): Copy SEC_SHORT to output section.
+
+	* scripttempl/elf.sc: Re-order .rel[a].foo outputs to the
+	same order seen for the main sections.  Add
+	OTHER_READONLY_RELOC_SECTIONS and OTHER_GOT_RELOC_SECTIONS.
+
+1999-07-12  Andreas Schwab  <schwab@suse.de>
+
+	* emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Fill in
+	structure initializations.
+
+	* emultempl/elf32.em (ld_${EMULATION_NAME}_emulation): Add missing
+	comma in initializer.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+	as appropriate.  Fill in structure initializations.
+
+1999-07-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldfile.c: Revert patch of 1999-07-08.
+	(ldfile_try_open_bfd): If we are searching for the file, skip
+	files with an incompatible architecture.
+
+1999-07-09  Nick Clifton  <nickc@cygnus.com>
+
+	* scripttempl/armcoff.sc (OUTPUT_FORMAT): Include big endian and
+	little endian formats.
+
+1999-07-08  Felix Lee  <flee@cygnus.com>
+
+	* scripttempl/mcorepe.sc: fix quoting problem, for bash 2.x
+
+1999-07-08  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* ldfile.c (ldfile_open_file_search): Skip libraries made for
+	incompatible architectures in the search path. Let the user know
+	about any such skips.
+
+Thu Jul  8 12:32:23 1999  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+        * configure.tgt (hppa*-linux-gnu*): New target.
+
+1999-07-07  Mark Mitchell  <mark@codesourcery.com>
+
+	* Makefile.am (ALL_64_EMULATIONS): Add eelf64bmip.
+	(eelf64bmip): New target.
+	* Makefile.in: Regenerated.
+	* configure.tgt (mips-sgi-irix6*): Add 64-bit emulation.
+	* emulparams/elf64bmip.sh: New file.
+
+1999-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/pe.em (after_open): Abort if input format is ARM and
+	output format is not. 
+	* emultempl/armcoff.em (after_open): Abort if input format is ARM
+	and output format is not. 
+	* emultempl/armelf.em (after_open): Abort if input format is ARM
+	and output format is not. 
+
+1999-07-02  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldlang.c: Revert change of 1999-06-23.
+
+1999-06-30  Mark Mitchell  <mark@codesourcery.com>
+
+	* Makefile.am (ALL_EMULATIONS): Add eelf32bmipn32.o.
+	(eelf32bmipn32.c): New target.
+	* Makefile.in: Regenerated.
+	* configure.tgt (mips-sgi-irix6*): Make n32 the default
+	emulation.
+	* emulparams/elf32bmipn32.sh: New file.
+	
+1999-06-28  Jim Pick <jim@jimpick.com>
+
+	* emultempl/armelf.em: Added code so that .xs linker scripts are
+	called so that ARM shared libraries are built correctly.
+
+1999-06-22  Mark Mitchell  <mark@codesourcery.com>
+
+	* ldmain.c (main): Initialize link_info.init_function and
+	link_info.fini_function.
+	* lexsup.c (OPTION_INIT): New macro.
+	(OPTION_FINI): Likewise.
+	(ld_options): Add descriptions for them.
+	(parse_args): Handle them.
+
+1999-06-23  Ian Lance Taylor  <ian@zembu.com>
+
+	* ldlang.c (section_already_linked): Only discard link once
+	sections if we are building constructors.
+
+1999-06-22  Nick Clifton  <nickc@cygnus.com>
+
+	* ld.texinfo (Location Counter): Describe behaviour of
+	location counter inside section statements.
+
+1999-06-20  Mark Mitchell  <mark@codesourcery.com>
+
+	* scripttempl/elf.sc (WRITABLE_RODATA): New variable for
+	controlling whether or not .rodata is in the data segment or the
+	text segment.
+
+1999-06-18  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/pe.em: Add new command line switch --thumb-entry.
+	* emultempl/armelf.em: Add new command line switch --thumb-entry.
+	* emultempl/armcoff.em: Add new command line switch --thumb-entry.
+	* ld.texinfo: Document new ARM command line switch: --thumb-entry.	
+1999-06-20  H.J. Lu  <hjl@gnu.org>
+
+	* configure.in (all_libpath): Accumulate across all enabled targets.
+
+Sun Jun 20 14:10:33 1999  Richard Henderson  <rth@cygnus.com>
+
+	* emultempl/armelf.em: Watch EMULATION_LIBPATH instead of
+	DEFAULT_EMULATION.
+	* emultempl/elf32.em: Likewise.
+	* emultempl/sunos.em: Likewise.
+
+Fri Jun 18 15:24:48 1999  Richard Henderson  <rth@cygnus.com>
+
+	* Makefile.am (GENSCRIPTS): Pass EMULATION_LIBPATH, not EMUL.
+	* configure.in (all_emuls): Add targ_extra_libpath.
+	(all_libpath, EMULATION_LIBPATH): Define.
+	* configure.tgt (powerpc-*-linux-gnu*): Define targ_extra_libpath.
+	* genscripts.sh (LIB_PATH): Define if emulation in EMULATION_LIBPATH.
+
+Mon Jun 14 10:38:36 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* ld.texinfo: Fix use of @item vs. @itemx.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	From Thomas Zenker <thz@lennartz-electronic.de>:
+	* ldgram.y (attributes_opt): Use attributes_list instead of NAME.
+	(attributes_list, attributes_string): New nonterminals.
+	* ldlang.c (lang_set_flags): Add invert parameter.  Don't handle
+	'!'.
+	* ldlang.c (lang_set_flags): Update declaration.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* emultempl/pe.em (gld_${EMULATION_NAME}_after_parse): Don't add
+	entry_symbol as an undefined symbol when doing a relocateable
+	link.  From <jeffdb@goodnet.com>.
+
+1999-06-12  David O'Brien  <obrien@freebsd.org>
+
+	* configure.tgt: (i[3456]86-*-freebsd*): Now defaults to ELF.
+
+1999-06-09  Nick Clifton  <nickc@cygnus.com>
+
+	* lexsup.c (help): Restore previous format of output.
+
+1999-06-04  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/pe.em: If compiling for arm_epoc_pe rename
+	interworking functions to avoid a name space clash.
+
+1999-06-02  Jason Merrill  <jason@yorick.cygnus.com>
+
+	* scripttempl/v850.sc: Add initp support.
+
+1999-06-02  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/pe.em: Rename global arm interworking functions to
+	avoid name collision when all targets BFD is built.
+
+1999-05-30  Cort Dougan  <cort@attis.cs.nmt.edu>
+
+	* Makefile.am (ALL_EMULATIONS): Add eelf32ppclinux.o.
+	* configure.tgt (powerpc-*-linux-gnu): Use it.
+	* emulparams/elf32ppclinux.sh: New file.
+
+1999-05-29  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld.texinfo (Options): Clarify that options which refer to files
+	must be properly ordered.
+
+1999-05-29  Nick Clifton  <nickc@cygnus.com>
+
+	* emultempl/armelf.em (..._parse_args): New function: Parse
+	command line option.  Accept arm-elf specific command line option
+	'-p' or '--no-pipeline-knowledge'.
+	(..._list_options): New function: Describe the new command line
+	option.
+	(..._before_allocation): Pass the value of the new variable
+	no_pipeline_knowledge to bfd_elf32_arm_process_before_allocation.
+	
+	* emultemp/armelf_oabi.em (..._before_allocation): Pass zero as
+	the third parameter to bfd_elf32_arm_process_before_allocation.
+
+1999-05-28  Nick Clifton  <nickc@cygnus.com>
+
+	* lexsup.c (help): Minor formatting changes.
+
+1999-05-28  Martin Dorey  <mdorey@madge.com>
+
+	* configure.tgt (i960-*-elf*): New target.
+	* emulparams/elf32_i960.sh: New file.
+	* Makefile.am (ALL_EMULATIONS): Add eelf32_i960.o.
+	(eelf32_i960.c): New target.
+	* Makefile.in: Rebuild.
+
+1999-05-26  Nick Clifton  <nickc@cygnus.com>
+
+	* emulparams/armelf_oabi.sh (TEMPLATE_NAME): Set to armelf_oabi. 
+
+1999-05-24  Philip Blundell  <philb@gnu.org>
+
+	* emultempl/armelf.em (before_parse): Set config.dynamic_link and
+ 	config.has_shared.
+	* emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT): Define.
+	* emulparams/armelf_linux.sh (GENERATE_SHLIB_SCRIPT): Likewise.
+
+1999-04-13  Philip Blundell  <philb@gnu.org>
+
+	* emultempl/armelf.em: Add definitions related to shared objects
+	(copied from elf32.em).
+
+Wed May 19 12:44:26 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* Makefile.am (ALL_EMULATIONS): Remove earmlinux.o and
+	earm26linux.o, add earmelf_linux.o and earmelf_linux26.o.
+	* Makefile.in: Regenerated.
+
+1999-05-16  Nick Clifton  <nickc@cygnus.com>
+
+	* emulparams/elf32mcore.sh (GENERATE_SHLIB_SCRIPT): Define.
+	(TEMPLATE_NAME): Define.
+
+Thu May 13 09:48:09 1999  Joel Sherrill (joel@OARcorp.com)
+
+	* configure.tgt (i386-*-rtemself*, sh-*-rtemself*): New targets.
+	(mips*el-*-rtems*, powerpcle-*-rtems*): New targets.
+
+1999-05-10  DJ Delorie  <dj@cygnus.com>
+
+	* scripttempl/pe.sc: Specify the output arch, which Ian says is
+	the Right Thing to do.
+
+	* emultempl/pe.em: various changes to parameterize the
+	target-specific information.
+	(gld_i386pe_after_open): Detect and fix MS import libraries
+	by renaming the member objects (which are all named the same).
+
+	* pe-dll.c: various changes to parameterize the target-specific
+	information.
+	(generate_reloc): support relocs more generically to allow for
+	expansion.
+	(pe_exe_build_sections): new; used to add .relocs to .exes
+	(pe_exe_fill_sections): ditto
+
+1999-05-10  Catherine Moore  <clm@cygnus.com>
+
+	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open):
+	Check for TARGET_IS_arm_epoc_pe.
+	(gld_${EMULATION_NAME}_before_allocation): Likewise.
+
+1999-05-12  Anthony Green  <green@cygnus.com>
+
+	* ldlang.c (walk_wild, walk_wild_file, walk_wild_section,
+	output_section_callback, gc_section_callback): New functions for
+	generic section walks.
+	(wild, lang_gc_wild): Use walk_wild.
+	(wild_file, lang_gc_wild_file): Deleted. Common logic moved to
+	walk_wild_file.
+	(wild_section, lang_gc_wild_section): Deleted. Common logic moved
+	to walk_fild_section.  Unique logic moved into callbacks
+	output_section_callback and gc_section_callback.
 
 1999-04-26  Tom Tromey  <tromey@cygnus.com>
 
 	* aclocal.m4, configure: Updated for new version of libtool.
 
-1999-04-22  Nick Clifton  <nickc@cygnus.com>
-
-	* emulparams/elf32mcore.sh (OTHER_RELOCATING_SECTIONS): Define to
-	generate _stack section.
-
 1999-04-12  Philip Blundell  <pb@nexus.co.uk>
 
 	* emulparams/armelf_linux.sh: New file.  Support for ARM 
@@ -57,17 +1086,6 @@
 	* ldmain.c (main): Init link_info.no_undefined.
 	* lexsup.c: Add command-line option --no-undefined.
 
-1999-04-08  Nick Clifton  <nickc@cygnus.com>
-
-	* configure.tgt: Add support for MCore targets.
-	* Makefile.am: Add support for MCore targets.
-	* Makefile.in: Regenerate.
-	
-	* emulparams/elf32mcore.sh: New file:  Definitions for mcore-elf
-	target. 
-	* emulparams/mcorepe.sh: New file:  Definitions for mcore-pe
-	target.  
-
 1999-04-06  Ian Lance Taylor  <ian@zembu.com>
 
 	* ld.h (LC_MESSAGES): Never define.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 1f02098..0351b54 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -9,9 +9,9 @@
 
 tooldir = $(exec_prefix)/$(target_alias)
 
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L$(srcdir)/../bison/ ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
 YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
 
 # We put the scripts in the directory $(scriptdir)/ldscripts.
 # We can't put the scripts in $(datadir) because the SEARCH_DIR
@@ -33,7 +33,7 @@
 BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
 INCDIR	= $(BASEDIR)/include
-DEP = mkdep
+MKDEP = mkdep
 
 # What version of the manual to build
 DOCVER = gen
@@ -103,12 +103,22 @@
 	earcelf.o \
 	earmelf.o \
 	earmelf_oabi.o \
-	earmlinux.o \
-	earm26linux.o \
+	earmelf_linux.o \
+	earmelf_linux26.o \
 	earmaoutb.o \
 	earmaoutl.o \
 	earmcoff.o \
+	earmnbsd.o \
 	earmpe.o \
+	earm_epoc_pe.o \
+	eavr1200.o \
+	eavr23xx.o \
+	eavr44x4.o \
+	eavr4433.o \
+	eavr85xx.o \
+	eavrmega603.o \
+	eavrmega103.o \
+	eavrmega161.o \
 	ecoff_sparc.o \
 	ed10velf.o \
 	ed30velf.o \
@@ -117,21 +127,24 @@
 	edelta68.o \
 	eebmon29k.o \
 	eelf32_sparc.o \
+	eelf32_i960.o \
 	eelf32b4300.o \
 	eelf32bmip.o \
 	eelf32ebmip.o \
 	eelf32elmip.o \
+	eelf32bmipn32.o \
+	eelf32i370.o \
 	eelf32l4300.o \
 	eelf32lmip.o \
 	eelf32lppc.o \
 	eelf32ppc.o \
+	eelf32ppclinux.o \
 	eelf_i386.o \
 	eelf_i386_be.o \
 	egld960.o \
 	egld960coff.o \
 	eelf32fr30.o \
 	eelf32mcore.o \
-	ego32.o \
 	eh8300.o \
 	eh8300h.o \
 	eh8300s.o \
@@ -142,7 +155,6 @@
 	eh8500s.o \
 	ehp300bsd.o \
 	ehp3hpux.o \
-	ehppaelf.o \
 	ei386aout.o \
 	ei386beos.o \
 	ei386bsd.o \
@@ -156,6 +168,7 @@
 	ei386nbsd.o \
 	ei386nw.o \
 	ei386pe.o \
+	ei386pe_posix.o \
 	elnk960.o \
 	em68k4knbsd.o \
 	em68kaout.o \
@@ -174,7 +187,10 @@
 	emipsidtl.o \
 	emipslit.o \
 	emipslnews.o \
+	emipspe.o \
 	enews.o \
+	epjelf.o \
+	epjlelf.o \
 	ens32knbsd.o \
 	epc532macha.o \
 	eppcmacos.o \
@@ -186,6 +202,7 @@
 	eshelf.o \
 	eshlelf.o \
 	eshl.o \
+	eshpe.o \
 	esparcaout.o \
 	esparclinux.o \
 	esparclynx.o \
@@ -205,7 +222,8 @@
 
 ALL_64_EMULATIONS = \
 	eelf64_sparc.o \
-	eelf64alpha.o
+	eelf64alpha.o \
+	eelf64bmip.o
 
 ALL_EMUL_EXTRA_OFILES = \
 	pe-dll.o \
@@ -217,7 +235,7 @@
 
 HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
 	ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
-	ldwrite.h mri.h deffile.h
+	ldwrite.h mri.h deffile.h pe-dll.h
 
 GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
 GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.h
@@ -256,10 +274,13 @@
 	echo "  0") >ldemul-tmp.h
 	mv ldemul-tmp.h ldemul-list.h
 
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+	  cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
+
 # These all start with e so 'make clean' can find them.
 
-GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@"
-GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
+GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
+GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
 @TDIRS@
 
 ea29k.c: $(srcdir)/emulparams/a29k.sh \
@@ -298,9 +319,47 @@
 earmcoff.c:	$(srcdir)/emulparams/armcoff.sh \
   $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armcoff "$(tdir_armcoff)"
+earmnbsd.c:	$(srcdir)/emulparams/armnbsd.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
+earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
 earmpe.c: $(srcdir)/emulparams/armpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armpe "$(tdir_armpe)"
+eavr85xx.c: $(srcdir)/emulparams/avr85xx.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr85xx "$(tdir_avr85xx)"
+eavr1200.c: $(srcdir)/emulparams/avr1200.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr1200 "$(tdir_avr85xx)"
+eavr23xx.c: $(srcdir)/emulparams/avr23xx.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr23xx "$(tdir_avr85xx)"
+eavr44x4.c: $(srcdir)/emulparams/avr44x4.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr44x4 "$(tdir_avr85xx)"
+eavr4433.c: $(srcdir)/emulparams/avr4433.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr4433 "$(tdir_avr85xx)"
+eavrmega603.c: $(srcdir)/emulparams/avrmega603.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega603 "$(tdir_avr85xx)"
+eavrmega103.c: $(srcdir)/emulparams/avrmega103.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega103 "$(tdir_avr85xx)"
+eavrmega161.c: $(srcdir)/emulparams/avrmega161.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega161 "$(tdir_avr85xx)"
 ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)"
@@ -334,6 +393,9 @@
 eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)"
+eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
 eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)"
@@ -349,6 +411,9 @@
 eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)"
+eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)"
 eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)"
@@ -364,12 +429,21 @@
 eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)"
+eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)"
+eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfi370.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32i370 "$(tdir_elf32i370)"
 eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)"
 eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)"
+eelf64bmip.c: $(srcdir)/emulparams/elf64bmip.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf64bmip "$(tdir_elf64bmip)"
 eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)"
@@ -382,9 +456,6 @@
 egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \
   $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} gld960coff "$(tdir_gld960coff)"
-ego32.c: $(srcdir)/emulparams/go32.sh \
-  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} go32 "$(tdir_go32)"
 eh8300.c: $(srcdir)/emulparams/h8300.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8300 "$(tdir_h8300)"
@@ -415,9 +486,6 @@
 ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)"
-ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \
-  $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} hppaelf "$(tdir_hppaelf)"
 ei386aout.c: $(srcdir)/emulparams/i386aout.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386aout "$(tdir_i386aout)"
@@ -457,6 +525,9 @@
 ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386pe "$(tdir_i386pe)"
+ei386pe_posix.c: $(srcdir)/emulparams/i386pe_posix.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} i386pe_posix "$(tdir_i386pe_posix)"
 elnk960.c: $(srcdir)/emulparams/lnk960.sh \
   $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} lnk960 "$(tdir_lnk960)"
@@ -511,6 +582,9 @@
 emipslnews.c:  $(srcdir)/emulparams/mipslnews.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} mipslnews
+emipspe.c: $(srcdir)/emulparams/mipspe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} mipspe "$(tdir_mips)"
 emn10300.c: $(srcdir)/emulparams/mn10300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} mn10300 "$(tdir_mn10300)"
@@ -526,6 +600,12 @@
 epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} pc532macha "$(tdir_pc532macha)"
+epjelf.c: $(srcdir)/emulparams/pjelf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} pjelf "$(tdir_pjelf)"
+epjlelf.c: $(srcdir)/emulparams/pjlelf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} pjlelf "$(tdir_pjlelf)"
 eppcmacos.c:	$(srcdir)/emulparams/ppcmacos.sh \
   $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)"
@@ -553,6 +633,9 @@
 eshl.c: $(srcdir)/emulparams/shl.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} shl "$(tdir_shl)"
+eshpe.c: $(srcdir)/emulparams/shpe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} shpe "$(tdir_shl)"
 esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
@@ -621,6 +704,7 @@
 check-DEJAGNU: site.exp
 	srcroot=`cd $(srcdir) && pwd`; export srcroot; \
 	r=`pwd`; export r; \
+	LC_COLLATE=; LC_ALL=; LANG=; export LC_COLLATE LC_ALL LANG; \
 	EXPECT=$(EXPECT); export EXPECT; \
 	if [ -f $(top_builddir)/../expect/expect ]; then \
 	  TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
@@ -633,7 +717,7 @@
 		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
-		LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" \
+		LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" LIBS="$(LIBS)" \
 		$(RUNTESTFLAGS); \
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
@@ -645,16 +729,16 @@
 ld-partial.o: ld-new$(EXEEXT)
 	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
 ld1$(EXEEXT): ld-partial.o
-	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld1-full$(EXEEXT): ld-new
-	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld2$(EXEEXT): ld1$(EXEEXT)
-	./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld3$(EXEEXT): ld2$(EXEEXT)
-	./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 bootstrap: ld3$(EXEEXT)
 	cmp ld2$(EXEEXT) ld3$(EXEEXT)
@@ -723,7 +807,7 @@
 	ldemul-list.h crtbegin.o crtend.o ld.log ld.sum
 mostlyclean-local:
 	-rm -rf tmpdir
-CLEANFILES = dep.sed .dep .dep1
+CLEANFILES = dep.sed DEP DEP1
 
 .PHONY: install-exec-local install-data-local
 
@@ -758,37 +842,37 @@
 	rm -rf ldscripts
 
 # Targets to rebuild dependencies in this Makefile.
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(GENERATED_CFILES)
-	rm -f .dep2
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	$(DEP) -f .dep2 $(INCLUDES) $?
-	$(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES) $(GENERATED_CFILES)
+	rm -f DEP2
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	$(MKDEP) -f DEP2 $(INCLUDES) $?
+	$(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
 		-e 's!@INCDIR@!$(INCDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -815,7 +899,7 @@
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
   ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \
-  ldctor.h ldfile.h $(INCDIR)/fnmatch.h
+  ldctor.h ldfile.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h
 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
@@ -848,7 +932,7 @@
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \
   ldmisc.h ldgram.h ldmain.h ldemul.h $(INCDIR)/coff/internal.h \
-  ../bfd/libcoff.h deffile.h
+  ../bfd/libcoff.h deffile.h pe-dll.h
 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
   ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index e5961ae..b1ea84b 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -70,6 +70,7 @@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
+EMULATION_LIBPATH = @EMULATION_LIBPATH@
 EXEEXT = @EXEEXT@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
 GMOFILES = @GMOFILES@
@@ -81,7 +82,6 @@
 INSTOBJEXT = @INSTOBJEXT@
 INTLDEPS = @INTLDEPS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
@@ -89,14 +89,14 @@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
 NATIVE_LIB_DIRS = @NATIVE_LIB_DIRS@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
 RANLIB = @RANLIB@
+STRINGIFY = @STRINGIFY@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 l = @l@
 
@@ -108,9 +108,9 @@
 
 tooldir = $(exec_prefix)/$(target_alias)
 
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L$(srcdir)/../bison/ ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
 YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
 
 # We put the scripts in the directory $(scriptdir)/ldscripts.
 # We can't put the scripts in $(datadir) because the SEARCH_DIR
@@ -132,7 +132,7 @@
 BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
 INCDIR = $(BASEDIR)/include
-DEP = mkdep
+MKDEP = mkdep
 
 # What version of the manual to build
 DOCVER = gen
@@ -206,12 +206,22 @@
 	earcelf.o \
 	earmelf.o \
 	earmelf_oabi.o \
-	earmlinux.o \
-	earm26linux.o \
+	earmelf_linux.o \
+	earmelf_linux26.o \
 	earmaoutb.o \
 	earmaoutl.o \
 	earmcoff.o \
+	earmnbsd.o \
 	earmpe.o \
+	earm_epoc_pe.o \
+	eavr1200.o \
+	eavr23xx.o \
+	eavr44x4.o \
+	eavr4433.o \
+	eavr85xx.o \
+	eavrmega603.o \
+	eavrmega103.o \
+	eavrmega161.o \
 	ecoff_sparc.o \
 	ed10velf.o \
 	ed30velf.o \
@@ -220,21 +230,24 @@
 	edelta68.o \
 	eebmon29k.o \
 	eelf32_sparc.o \
+	eelf32_i960.o \
 	eelf32b4300.o \
 	eelf32bmip.o \
 	eelf32ebmip.o \
 	eelf32elmip.o \
+	eelf32bmipn32.o \
+	eelf32i370.o \
 	eelf32l4300.o \
 	eelf32lmip.o \
 	eelf32lppc.o \
 	eelf32ppc.o \
+	eelf32ppclinux.o \
 	eelf_i386.o \
 	eelf_i386_be.o \
 	egld960.o \
 	egld960coff.o \
 	eelf32fr30.o \
 	eelf32mcore.o \
-	ego32.o \
 	eh8300.o \
 	eh8300h.o \
 	eh8300s.o \
@@ -245,7 +258,6 @@
 	eh8500s.o \
 	ehp300bsd.o \
 	ehp3hpux.o \
-	ehppaelf.o \
 	ei386aout.o \
 	ei386beos.o \
 	ei386bsd.o \
@@ -259,6 +271,7 @@
 	ei386nbsd.o \
 	ei386nw.o \
 	ei386pe.o \
+	ei386pe_posix.o \
 	elnk960.o \
 	em68k4knbsd.o \
 	em68kaout.o \
@@ -277,7 +290,10 @@
 	emipsidtl.o \
 	emipslit.o \
 	emipslnews.o \
+	emipspe.o \
 	enews.o \
+	epjelf.o \
+	epjlelf.o \
 	ens32knbsd.o \
 	epc532macha.o \
 	eppcmacos.o \
@@ -289,6 +305,7 @@
 	eshelf.o \
 	eshlelf.o \
 	eshl.o \
+	eshpe.o \
 	esparcaout.o \
 	esparclinux.o \
 	esparclynx.o \
@@ -309,7 +326,8 @@
 
 ALL_64_EMULATIONS = \
 	eelf64_sparc.o \
-	eelf64alpha.o
+	eelf64alpha.o \
+	eelf64bmip.o
 
 
 ALL_EMUL_EXTRA_OFILES = \
@@ -324,7 +342,7 @@
 
 HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
 	ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
-	ldwrite.h mri.h deffile.h
+	ldwrite.h mri.h deffile.h pe-dll.h
 
 
 GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
@@ -345,8 +363,8 @@
 
 # These all start with e so 'make clean' can find them.
 
-GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@"
-GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
+GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
+GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
 
 ld_new_SOURCES = ldgram.y ldlex.l lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
 	ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c
@@ -362,7 +380,7 @@
 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
 	ldemul-list.h crtbegin.o crtend.o ld.log ld.sum
 
-CLEANFILES = dep.sed .dep .dep1
+CLEANFILES = dep.sed DEP DEP1
 
 # Stuff that should be included in a distribution.  The diststuff
 # target is run by the taz target in ../Makefile.in.
@@ -407,7 +425,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(ld_new_SOURCES)
 OBJECTS = $(ld_new_OBJECTS)
@@ -795,7 +813,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -959,6 +977,9 @@
 	done;\
 	echo "  0") >ldemul-tmp.h
 	mv ldemul-tmp.h ldemul-list.h
+
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+	  cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
 @TDIRS@
 
 ea29k.c: $(srcdir)/emulparams/a29k.sh \
@@ -997,9 +1018,47 @@
 earmcoff.c:	$(srcdir)/emulparams/armcoff.sh \
   $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armcoff "$(tdir_armcoff)"
+earmnbsd.c:	$(srcdir)/emulparams/armnbsd.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
+earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
 earmpe.c: $(srcdir)/emulparams/armpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armpe "$(tdir_armpe)"
+eavr85xx.c: $(srcdir)/emulparams/avr85xx.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr85xx "$(tdir_avr85xx)"
+eavr1200.c: $(srcdir)/emulparams/avr1200.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr1200 "$(tdir_avr85xx)"
+eavr23xx.c: $(srcdir)/emulparams/avr23xx.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr23xx "$(tdir_avr85xx)"
+eavr44x4.c: $(srcdir)/emulparams/avr44x4.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr44x4 "$(tdir_avr85xx)"
+eavr4433.c: $(srcdir)/emulparams/avr4433.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avr4433 "$(tdir_avr85xx)"
+eavrmega603.c: $(srcdir)/emulparams/avrmega603.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega603 "$(tdir_avr85xx)"
+eavrmega103.c: $(srcdir)/emulparams/avrmega103.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega103 "$(tdir_avr85xx)"
+eavrmega161.c: $(srcdir)/emulparams/avrmega161.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+  ${GEN_DEPENDS}
+	${GENSCRIPTS} avrmega161 "$(tdir_avr85xx)"
 ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)"
@@ -1033,6 +1092,9 @@
 eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)"
+eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
 eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)"
@@ -1048,6 +1110,9 @@
 eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)"
+eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)"
 eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)"
@@ -1063,12 +1128,21 @@
 eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)"
+eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)"
+eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfi370.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32i370 "$(tdir_elf32i370)"
 eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)"
 eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)"
+eelf64bmip.c: $(srcdir)/emulparams/elf64bmip.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf64bmip "$(tdir_elf64bmip)"
 eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)"
@@ -1081,9 +1155,6 @@
 egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \
   $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} gld960coff "$(tdir_gld960coff)"
-ego32.c: $(srcdir)/emulparams/go32.sh \
-  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} go32 "$(tdir_go32)"
 eh8300.c: $(srcdir)/emulparams/h8300.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8300 "$(tdir_h8300)"
@@ -1114,9 +1185,6 @@
 ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)"
-ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \
-  $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} hppaelf "$(tdir_hppaelf)"
 ei386aout.c: $(srcdir)/emulparams/i386aout.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386aout "$(tdir_i386aout)"
@@ -1156,6 +1224,9 @@
 ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386pe "$(tdir_i386pe)"
+ei386pe_posix.c: $(srcdir)/emulparams/i386pe_posix.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} i386pe_posix "$(tdir_i386pe_posix)"
 elnk960.c: $(srcdir)/emulparams/lnk960.sh \
   $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} lnk960 "$(tdir_lnk960)"
@@ -1210,6 +1281,9 @@
 emipslnews.c:  $(srcdir)/emulparams/mipslnews.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} mipslnews
+emipspe.c: $(srcdir)/emulparams/mipspe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} mipspe "$(tdir_mips)"
 emn10300.c: $(srcdir)/emulparams/mn10300.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} mn10300 "$(tdir_mn10300)"
@@ -1225,6 +1299,12 @@
 epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} pc532macha "$(tdir_pc532macha)"
+epjelf.c: $(srcdir)/emulparams/pjelf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} pjelf "$(tdir_pjelf)"
+epjlelf.c: $(srcdir)/emulparams/pjlelf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} pjlelf "$(tdir_pjlelf)"
 eppcmacos.c:	$(srcdir)/emulparams/ppcmacos.sh \
   $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)"
@@ -1252,6 +1332,9 @@
 eshl.c: $(srcdir)/emulparams/shl.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} shl "$(tdir_shl)"
+eshpe.c: $(srcdir)/emulparams/shpe.sh \
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} shpe "$(tdir_shl)"
 esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
@@ -1312,6 +1395,7 @@
 check-DEJAGNU: site.exp
 	srcroot=`cd $(srcdir) && pwd`; export srcroot; \
 	r=`pwd`; export r; \
+	LC_COLLATE=; LC_ALL=; LANG=; export LC_COLLATE LC_ALL LANG; \
 	EXPECT=$(EXPECT); export EXPECT; \
 	if [ -f $(top_builddir)/../expect/expect ]; then \
 	  TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
@@ -1324,7 +1408,7 @@
 		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
-		LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" \
+		LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" LIBS="$(LIBS)" \
 		$(RUNTESTFLAGS); \
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
@@ -1336,16 +1420,16 @@
 ld-partial.o: ld-new$(EXEEXT)
 	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
 ld1$(EXEEXT): ld-partial.o
-	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld1-full$(EXEEXT): ld-new
-	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld2$(EXEEXT): ld1$(EXEEXT)
-	./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 ld3$(EXEEXT): ld2$(EXEEXT)
-	./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+	./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
 
 bootstrap: ld3$(EXEEXT)
 	cmp ld2$(EXEEXT) ld3$(EXEEXT)
@@ -1437,37 +1521,37 @@
 	rm -rf ldscripts
 
 # Targets to rebuild dependencies in this Makefile.
-# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
-.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed <.dep1 >.dep
+# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
+DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed <DEP1 >DEP
 
 # This rule really wants a mkdep that runs "gcc -MM".
-.dep1: $(CFILES) $(GENERATED_CFILES)
-	rm -f .dep2
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	$(DEP) -f .dep2 $(INCLUDES) $?
-	$(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES) $(GENERATED_CFILES)
+	rm -f DEP2
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	$(MKDEP) -f DEP2 $(INCLUDES) $?
+	$(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
 		-e 's!@INCDIR@!$(INCDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -1494,7 +1578,7 @@
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
   ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \
-  ldctor.h ldfile.h $(INCDIR)/fnmatch.h
+  ldctor.h ldfile.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h
 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
   $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
@@ -1527,7 +1611,7 @@
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \
   ldmisc.h ldgram.h ldmain.h ldemul.h $(INCDIR)/coff/internal.h \
-  ../bfd/libcoff.h deffile.h
+  ../bfd/libcoff.h deffile.h pe-dll.h
 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
   ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \
diff --git a/ld/NEWS b/ld/NEWS
index aa2e845..2c2340f 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -14,11 +14,21 @@
 
 * Added ASSERT to the linker script language.
 
+* Added EXCLUDE_FILE to the linker script language for further control over
+  wildcard file names.
+
 * Added -O option to optimize linker output (as of this writing, this only
 affects ELF shared library generation).
 
 * The -e option now accepts a number as well as a symbol name.
 
+* Added --no-undefined option to disallow undefined symbols when creating a
+  shared library.
+
+* The linker now issues a warning, not an error, for an undefined symbol when
+  using -Bsymbolic; use the new --no-undefined option to get the old
+  behaviour.
+
 * Added --demangle and --no-demangle options.
 
 Changes in version 2.9:
diff --git a/ld/aclocal.m4 b/ld/aclocal.m4
index 11934b0..8bebfa0 100644
--- a/ld/aclocal.m4
+++ b/ld/aclocal.m4
@@ -105,7 +105,7 @@
 AC_SUBST($1)])
 
 
-# serial 35 AC_PROG_LIBTOOL
+# serial 40 AC_PROG_LIBTOOL
 AC_DEFUN(AC_PROG_LIBTOOL,
 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
 
@@ -114,10 +114,11 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$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
@@ -146,24 +147,33 @@
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_LD])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -195,33 +205,28 @@
   fi
   ;;
 
-*-*-cygwin*)
-  AC_SYS_LIBTOOL_CYGWIN
+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
-
-# enable the --disable-libtool-lock switch
-
-AC_ARG_ENABLE(libtool-lock,
-[  --disable-libtool-lock  force libtool not to do file locking],
-need_locks=$enableval,
-need_locks=yes)
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
 ])
 
-# AC_LIBTOOL_DLOPEN - check for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
+# 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,
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -246,15 +251,15 @@
 ])
 
 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED,
-[AC_ENABLE_SHARED(no)])
+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,
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -279,16 +284,16 @@
 ])
 
 # AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC,
-[AC_ENABLE_STATIC(no)])
+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,
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -313,9 +318,8 @@
 ])
 
 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL,
-[AC_ENABLE_FAST_INSTALL(no)])
-
+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,
@@ -333,7 +337,7 @@
   case "$ac_prog" in
     # Accept absolute paths.
 changequote(,)dnl
-    /* | [A-Za-z]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
 changequote([,])dnl
       # Canonicalize the path of ld
@@ -359,10 +363,10 @@
 fi
 AC_CACHE_VAL(ac_cv_path_LD,
 [if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -385,7 +389,6 @@
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
 AC_PROG_LD_GNU
 ])
 
@@ -407,10 +410,10 @@
   # Let the user override the test.
   ac_cv_path_NM="$NM"
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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; then
+    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
@@ -431,230 +434,24 @@
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
-])
-
-# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
-# by C symbol name from nm.
-AC_DEFUN(AC_SYS_NM_PARSE,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output])
-AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
-[# These are sane defaults that work on at least a few old systems.
-# {They come from Ultrix.  What could be older than Ultrix?!! ;)}
-
-changequote(,)dnl
-# Character class describing NM global symbol codes.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-changequote([,])dnl
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($ac_symcode\)[ 	][ 	]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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;
-}
-changequote(,)dnl
-lt_preloaded_symbols[] =
-changequote([,])dnl
-{
-EOF
-	sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&AC_FD_CC
-	    cat conftest.c >&AC_FD_CC
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-    fi
-  else
-    echo "$progname: failed program was:" >&AC_FD_CC
-    cat conftest.c >&AC_FD_CC
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-AC_MSG_RESULT($ac_result)
-])
-
-# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
-AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-AC_CHECK_TOOL(AS, as, false)
-])
-
-# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
-#                            with an underscore?
-AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
-[AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_MSG_CHECKING([for _ prefix in compiled symbols])
-AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
-[ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if AC_TRY_EVAL(ac_compile); then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-  fi
-else
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.c >&AC_FD_CC
-fi
-rm -rf conftest*
-])
-AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
 ])
 
 # AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM, [
-AC_CHECK_LIB(mw, _mwvalidcheckl)
-AC_CHECK_LIB(m, cos)
+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
@@ -665,13 +462,14 @@
 # '${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_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
@@ -683,16 +481,23 @@
 # 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_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
-    case "$enable_ltdl_install" in
-    no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
-    "") enable_ltdl_install=yes
-        ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
-    esac
+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"no"; then
+  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
 ])
 
@@ -704,9 +509,9 @@
 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
-AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
-AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
-AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])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.
 
diff --git a/ld/config.in b/ld/config.in
index a415046..5e17bdc 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -169,3 +169,6 @@
 /* Define if environ is not declared in system header files. */
 #undef NEED_DECLARATION_ENVIRON
 
+/* Additional extension a shared object might have. */
+#undef EXTRA_SHLIB_EXTENSION
+
diff --git a/ld/configure b/ld/configure
index 9d573b2..707add1 100755
--- a/ld/configure
+++ b/ld/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
+# Generated automatically using autoconf version 2.13.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -20,7 +20,7 @@
 ac_help="$ac_help
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
 ac_help="$ac_help
-  --disable-libtool-lock  force libtool not to do file locking"
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
   --enable-targets        alternative target configurations"
 ac_help="$ac_help
@@ -354,7 +354,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
+    echo "configure generated by autoconf version 2.13.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -514,7 +514,7 @@
 
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -558,9 +558,130 @@
 if test -z "$ac_aux_dir"; then
   { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:568: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_host_alias=$host
+  case "$ac_cv_host_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      if ac_cv_host_alias=`$ac_config_guess`; then :
+      else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+      fi ;;
+    *) ac_cv_host_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+  ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:609: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_target_alias=$target
+  case "$ac_cv_target_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_target_alias=$host_alias ;;
+
+    *) ac_cv_target_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+  ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:649: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_build_alias=$build
+  case "$ac_cv_build_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_build_alias=$host_alias ;;
+
+    *) ac_cv_build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+  ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
 
 
 # Do some error checking and defaulting for the host and target type.
@@ -583,69 +704,6 @@
 *) { 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:594: 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:615: 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:633: 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, &&
@@ -664,9 +722,9 @@
 # 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:668: checking for a BSD compatible install" >&5
+echo "configure:726: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -684,6 +742,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -712,12 +774,12 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:721: checking whether build environment is sane" >&5
+echo "configure:783: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -765,18 +827,18 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:778: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:840: 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
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
@@ -803,7 +865,7 @@
 
 PACKAGE=ld
 
-VERSION=2.9.4
+VERSION=2.9.5
 
 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; }
@@ -820,7 +882,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:824: checking for working aclocal" >&5
+echo "configure:886: 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.
@@ -833,7 +895,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:837: checking for working autoconf" >&5
+echo "configure:899: 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.
@@ -846,7 +908,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:850: checking for working automake" >&5
+echo "configure:912: 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.
@@ -859,7 +921,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:863: checking for working autoheader" >&5
+echo "configure:925: 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.
@@ -872,7 +934,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:876: checking for working makeinfo" >&5
+echo "configure:938: 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.
@@ -958,8 +1020,8 @@
 # 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:962: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1024: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -988,8 +1050,8 @@
 # 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:992: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1054: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1018,8 +1080,8 @@
   # 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:1022: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1084: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1065,12 +1127,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:1073: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1135: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1100,8 +1162,8 @@
   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:1105: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1167: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1112,12 +1174,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1116 "configure"
+#line 1178 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1183: \"$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
@@ -1142,14 +1204,14 @@
 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:1147: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1209: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:1152: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:1214: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -1157,7 +1219,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1161: \"$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:1223: \"$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
@@ -1176,8 +1238,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1180: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:1242: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -1219,11 +1281,11 @@
 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:1223: checking for ld used by GCC" >&5
+echo "configure:1285: 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]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
@@ -1243,19 +1305,19 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1247: checking for GNU ld" >&5
+echo "configure:1309: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1250: checking for non-GNU ld" >&5
+echo "configure:1312: checking for non-GNU ld" >&5
 fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -1280,10 +1342,9 @@
   echo "$ac_t""no" 1>&6
 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:1286: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+echo "configure:1347: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
@@ -1298,18 +1359,18 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1302: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+echo "configure:1363: checking for BSD-compatible nm" >&5
+if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   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}:"
+  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; then
+    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
@@ -1333,214 +1394,9 @@
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
-# 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
-echo "configure:1340: checking command to parse $NM output" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  # 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.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* 	\($ac_symcode\) 	 	*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if { (eval echo configure:1403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if { (eval echo configure:1407: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&5
-	    cat conftest.c >&5
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&5
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.c >&5
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-
-fi
-
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-echo "$ac_t""$ac_result" 1>&6
-
-echo $ac_n "checking for _ prefix in compiled symbols""... $ac_c" 1>&6
-echo "configure:1505: checking for _ prefix in compiled symbols" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_symbol_underscore'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if { (eval echo configure:1514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if { (eval echo configure:1517: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&5
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&5
-  fi
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.c >&5
-fi
-rm -rf conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_sys_symbol_underscore" 1>&6
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1543: checking whether ln -s works" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+echo "configure:1399: checking whether ln -s works" >&5
+if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftestdata
@@ -1559,30 +1415,37 @@
   echo "$ac_t""no" 1>&6
 fi
 
-if test $host != $build; then
-  ac_tool_prefix=${host_alias}-
-else
-  ac_tool_prefix=
-fi
 
+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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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"
 
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1585 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1586: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1448 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1603,19 +1466,19 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1607: checking whether the C compiler needs -belf" >&5
-if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+echo "configure:1470: checking whether the C compiler needs -belf" >&5
+if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1612 "configure"
+#line 1475 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1482: \"$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
@@ -1634,161 +1497,9 @@
   fi
   ;;
 
-*-*-cygwin*)
-  # 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:1642: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1674: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  DLLTOOL="false"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1709: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1741: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  AS="false"
-fi
-fi
-
-
-  ;;
 
 esac
 
-# enable the --disable-libtool-lock switch
-
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval="$enable_libtool_lock"
-  need_locks=$enableval
-else
-  need_locks=yes
-fi
-
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
-
 
 # Save cache, so that ltconfig can load it
 cat > confcache <<\EOF
@@ -1841,16 +1552,17 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -1906,8 +1618,8 @@
 # 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:1910: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1622: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1936,8 +1648,8 @@
   # 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:1940: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1652: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -1983,12 +1695,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:1991: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1703: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2018,8 +1730,8 @@
   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:2023: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1735: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2030,12 +1742,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2034 "configure"
+#line 1746 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1751: \"$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
@@ -2060,14 +1772,14 @@
 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:2065: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1777: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:2070: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:1782: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -2075,7 +1787,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2079: \"$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:1791: \"$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
@@ -2094,8 +1806,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2098: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:1810: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -2137,9 +1849,9 @@
 # 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:2141: checking for a BSD compatible install" >&5
+echo "configure:1853: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -2157,6 +1869,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -2185,20 +1901,20 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2196: checking how to run the C preprocessor" >&5
+echo "configure:1912: 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
+if eval "test \"\${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
@@ -2207,13 +1923,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2211 "configure"
+#line 1927 "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:2217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1933: \"$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
   :
@@ -2224,13 +1940,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2228 "configure"
+#line 1944 "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:2234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1950: \"$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
   :
@@ -2241,13 +1957,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2245 "configure"
+#line 1961 "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:2251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1967: \"$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
   :
@@ -2272,7 +1988,7 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:2276: checking for POSIXized ISC" >&5
+echo "configure:1992: 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
@@ -2293,12 +2009,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2297: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+echo "configure:2013: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2302 "configure"
+#line 2018 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2306,7 +2022,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2026: \"$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*
@@ -2323,7 +2039,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 2327 "configure"
+#line 2043 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2341,7 +2057,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 2345 "configure"
+#line 2061 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2362,7 +2078,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2366 "configure"
+#line 2082 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2373,7 +2089,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2397,12 +2113,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2401: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+echo "configure:2117: checking for working const" >&5
+if eval "test \"\${ac_cv_c_const+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2406 "configure"
+#line 2122 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2451,7 +2167,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2472,21 +2188,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2476: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+echo "configure:2192: checking for inline" >&5
+if eval "test \"\${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 2483 "configure"
+#line 2199 "configure"
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2512,12 +2228,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2516: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+echo "configure:2232: checking for off_t" >&5
+if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2521 "configure"
+#line 2237 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2528,29 +2244,31 @@
 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
+  eval "ac_cv_type_off_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_off_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'off_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define off_t long
 EOF
 
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2549: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+echo "configure:2267: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2554 "configure"
+#line 2272 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2561,17 +2279,19 @@
 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
+  eval "ac_cv_type_size_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_size_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define size_t unsigned
 EOF
 
@@ -2580,19 +2300,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:2584: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+echo "configure:2304: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2589 "configure"
+#line 2309 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2316: \"$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
@@ -2613,12 +2333,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2617: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+echo "configure:2337: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2622 "configure"
+#line 2342 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2646,7 +2366,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2370: \"$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
@@ -2678,12 +2398,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2682: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+echo "configure:2402: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2687 "configure"
+#line 2407 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2708,12 +2428,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:2712: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2432: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2717 "configure"
+#line 2437 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2722,6 +2442,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2731,12 +2452,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:2740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2461: \"$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
@@ -2763,15 +2484,15 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2767: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo "configure:2488: checking stack direction for C alloca" >&5
+if eval "test \"\${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 2775 "configure"
+#line 2496 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2790,7 +2511,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2515: \"$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
@@ -2815,17 +2536,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2819: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:2540: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2824 "configure"
+#line 2545 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2550: \"$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*
@@ -2854,12 +2575,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2858: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2579: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2863 "configure"
+#line 2584 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2868,6 +2589,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2877,12 +2599,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:2886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2608: \"$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
@@ -2907,15 +2629,15 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2911: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+echo "configure:2633: checking for working mmap" >&5
+if eval "test \"\${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 2919 "configure"
+#line 2641 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3055,7 +2777,7 @@
 }
 
 EOF
-if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2781: \"$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
@@ -3083,17 +2805,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3087: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:2809: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3092 "configure"
+#line 2814 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3097: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2819: \"$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*
@@ -3123,12 +2845,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3127: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2849: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3132 "configure"
+#line 2854 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3137,6 +2859,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3146,12 +2869,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2878: \"$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
@@ -3180,12 +2903,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3184: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2907: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3189 "configure"
+#line 2912 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3194,6 +2917,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3203,12 +2927,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2936: \"$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
@@ -3242,19 +2966,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3246: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+echo "configure:2970: checking for LC_MESSAGES" >&5
+if eval "test \"\${am_cv_val_LC_MESSAGES+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3251 "configure"
+#line 2975 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2982: \"$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
@@ -3275,7 +2999,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3279: checking whether NLS is requested" >&5
+echo "configure:3003: 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"
@@ -3295,7 +3019,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3299: checking whether included gettext is requested" >&5
+echo "configure:3023: 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"
@@ -3314,17 +3038,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3318: checking for libintl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3042: checking for libintl.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3323 "configure"
+#line 3047 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3052: \"$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*
@@ -3341,19 +3065,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:3345: checking for gettext in libc" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+echo "configure:3069: checking for gettext in libc" >&5
+if eval "test \"\${gt_cv_func_gettext_libc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3350 "configure"
+#line 3074 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3081: \"$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
@@ -3369,15 +3093,15 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3373: 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 "configure:3097: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 3381 "configure"
+#line 3105 "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
@@ -3388,7 +3112,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3116: \"$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
@@ -3404,19 +3128,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:3408: checking for gettext in libintl" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+echo "configure:3132: checking for gettext in libintl" >&5
+if eval "test \"\${gt_cv_func_gettext_libintl+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3413 "configure"
+#line 3137 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3144: \"$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
@@ -3444,8 +3168,8 @@
 	      # 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:3448: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3172: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3478,12 +3202,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3482: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3206: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3487 "configure"
+#line 3211 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3492,6 +3216,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3501,12 +3226,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3235: \"$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
@@ -3533,8 +3258,8 @@
 		# 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:3537: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3262: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3569,8 +3294,8 @@
 		# 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:3573: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3298: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3601,7 +3326,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3605 "configure"
+#line 3330 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3609,7 +3334,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3641,8 +3366,8 @@
         # 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:3645: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3370: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3675,8 +3400,8 @@
         # 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:3679: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3404: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3711,8 +3436,8 @@
         # 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:3715: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3440: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3801,7 +3526,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3805: checking for catalogs to be installed" >&5
+echo "configure:3530: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3829,17 +3554,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:3833: checking for linux/version.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3558: checking for linux/version.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3838 "configure"
+#line 3563 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3568: \"$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*
@@ -3902,12 +3627,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3906: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+echo "configure:3631: checking for Cygwin environment" >&5
+if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3911 "configure"
+#line 3636 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3918,7 +3643,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:3922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -3928,26 +3653,25 @@
   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:3939: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+echo "configure:3663: checking for mingw32 environment" >&5
+if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3944 "configure"
+#line 3668 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:3951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -3957,29 +3681,57 @@
   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 EMX OS/2 environment""... $ac_c" 1>&6
+echo "configure:3691: checking for EMX OS/2 environment" >&5
+if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3696 "configure"
+#include "confdefs.h"
+
+int main() {
+return __EMX__;
+; return 0; }
+EOF
+if { (eval echo configure:3703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_emxos2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_emxos2=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_emxos2" 1>&6
+EMXOS2=
+test "$ac_cv_emxos2" = yes && EMXOS2=yes
+
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3970: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+echo "configure:3722: checking for executable suffix" >&5
+if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = 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:3980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:3732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.C | *.o | *.obj | *.xcoff) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -4002,8 +3754,8 @@
 # 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:4006: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+echo "configure:3758: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_YACC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$YACC"; then
@@ -4038,8 +3790,8 @@
 # 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:4042: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+echo "configure:3794: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_LEX+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LEX"; then
@@ -4071,8 +3823,8 @@
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4075: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+echo "configure:3827: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_LEX+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LEX"; then
@@ -4105,15 +3857,15 @@
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:4109: checking for yywrap in -l$ac_lib" >&5
-ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo "configure:3861: checking for yywrap in -l$ac_lib" >&5
+ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4117 "configure"
+#line 3869 "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
@@ -4124,7 +3876,7 @@
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:4128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3880: \"$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
@@ -4147,8 +3899,8 @@
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:4151: checking lex output file root" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
+echo "configure:3903: checking lex output file root" >&5
+if eval "test \"\${ac_cv_prog_lex_root+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # The minimal lex program is just a single line: %%.  But some broken lexes
@@ -4168,8 +3920,8 @@
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:4172: checking whether yytext is a pointer" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
+echo "configure:3924: checking whether yytext is a pointer" >&5
+if eval "test \"\${ac_cv_prog_lex_yytext_pointer+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
@@ -4180,14 +3932,14 @@
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 4184 "configure"
+#line 3936 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
@@ -4210,7 +3962,7 @@
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4214: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:3966: 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"
@@ -4244,17 +3996,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4248: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:4000: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4253 "configure"
+#line 4005 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4010: \"$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*
@@ -4283,12 +4035,12 @@
 for ac_func in sbrk
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4287: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:4039: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4292 "configure"
+#line 4044 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4297,6 +4049,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -4306,12 +4059,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4068: \"$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
@@ -4340,12 +4093,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:4344: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+echo "configure:4097: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4349 "configure"
+#line 4102 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4353,7 +4106,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4378,15 +4131,15 @@
 # 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:4382: 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 "configure:4135: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4390 "configure"
+#line 4143 "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
@@ -4397,7 +4150,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4154: \"$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
@@ -4419,15 +4172,15 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4423: 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 "configure:4176: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4431 "configure"
+#line 4184 "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
@@ -4438,7 +4191,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4195: \"$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
@@ -4463,7 +4216,7 @@
 
 
 case "${host}" in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
   cat >> confdefs.h <<\EOF
 #define USE_BINARY_FOPEN 1
 EOF
@@ -4471,12 +4224,12 @@
 esac
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4475: checking whether strstr must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
+echo "configure:4228: checking whether strstr must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_strstr+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4480 "configure"
+#line 4233 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4497,7 +4250,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:4501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -4518,12 +4271,12 @@
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4522: checking whether free must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
+echo "configure:4275: checking whether free must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_free+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4527 "configure"
+#line 4280 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4544,7 +4297,7 @@
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:4548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -4565,12 +4318,12 @@
 fi
 
 echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
-echo "configure:4569: checking whether sbrk must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then
+echo "configure:4322: checking whether sbrk must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_sbrk+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4574 "configure"
+#line 4327 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4591,7 +4344,7 @@
 char *(*pfn) = (char *(*)) sbrk
 ; return 0; }
 EOF
-if { (eval echo configure:4595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_sbrk=no
 else
@@ -4612,12 +4365,12 @@
 fi
 
 echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4616: checking whether getenv must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
+echo "configure:4369: checking whether getenv must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_getenv+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4621 "configure"
+#line 4374 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4638,7 +4391,7 @@
 char *(*pfn) = (char *(*)) getenv
 ; return 0; }
 EOF
-if { (eval echo configure:4642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_getenv=no
 else
@@ -4659,12 +4412,12 @@
 fi
 
 echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6
-echo "configure:4663: checking whether environ must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then
+echo "configure:4416: checking whether environ must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_environ+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4668 "configure"
+#line 4421 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4685,7 +4438,7 @@
 char *(*pfn) = (char *(*)) environ
 ; return 0; }
 EOF
-if { (eval echo configure:4689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_environ=no
 else
@@ -4706,12 +4459,52 @@
 fi
 
 
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise.  This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+echo $ac_n "checking whether ANSI C string concatenation works""... $ac_c" 1>&6
+echo "configure:4470: checking whether ANSI C string concatenation works" >&5
+if eval "test \"\${ld_cv_string_concatenation+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4475 "configure"
+#include "confdefs.h"
+
+int main() {
+char *a = "a" "a";
+; return 0; }
+EOF
+if { (eval echo configure:4482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ld_cv_string_concatenation=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ld_cv_string_concatenation=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ld_cv_string_concatenation" 1>&6
+if test "$ld_cv_string_concatenation" = "yes"; then
+  STRINGIFY=astring.sed
+else
+  STRINGIFY=ostring.sed
+fi
+
+
 # target-specific stuff:
 
 all_targets=
 EMUL=
 all_emuls=
 all_emul_extras=
+all_libpath=
 
 rm -f tdirs
 
@@ -4721,7 +4514,7 @@
     all_targets=true
   else
     # Canonicalize the secondary target names.
-    result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null`
+    result=`$ac_config_sub $targ_alias 2>/dev/null`
     if test -n "$result"; then
 	targ=$result
     else
@@ -4734,7 +4527,7 @@
       EMUL=$targ_emul
     fi
 
-    for i in $targ_emul $targ_extra_emuls; do
+    for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
 	case " $all_emuls " in
 	*" e${i}.o "*) ;;
 	*)
@@ -4746,6 +4539,19 @@
 	esac
     done
 
+    for i in $targ_emul $targ_extra_libpath; do
+	case " $all_libpath " in
+	*" ${i} "*) ;;
+	*)
+	  if test -z "$all_libpath"; then
+	    all_libpath=${i}
+	  else
+	    all_libpath="$all_libpath ${i}"
+	  fi
+	  ;;
+	esac
+    done
+
     for i in $targ_extra_ofiles; do
 	case " $all_emul_extras " in
 	*" ${i} "*) ;;
@@ -4776,6 +4582,9 @@
 
 
 
+EMULATION_LIBPATH=$all_libpath
+
+
 if test x${enable_static} = xno; then
   TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
 else
@@ -4783,6 +4592,18 @@
 fi
 
 
+target_vendor=${target_vendor=$host_vendor}
+case "$target_vendor" in
+  hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
+  *)  EXTRA_SHLIB_EXTENSION= ;;
+esac
+if test x${EXTRA_SHLIB_EXTENSION} != x ; then
+  cat >> confdefs.h <<EOF
+#define EXTRA_SHLIB_EXTENSION "$EXTRA_SHLIB_EXTENSION"
+EOF
+
+fi
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -4873,7 +4694,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.13"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -4944,12 +4765,7 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
-s%@USE_SYMBOL_UNDERSCORE@%$USE_SYMBOL_UNDERSCORE%g
 s%@LN_S@%$LN_S%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@AS@%$AS%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@CPP@%$CPP%g
 s%@ALLOCA@%$ALLOCA%g
@@ -4985,11 +4801,13 @@
 s%@HOSTING_CRT0@%$HOSTING_CRT0%g
 s%@HOSTING_LIBS@%$HOSTING_LIBS%g
 s%@NATIVE_LIB_DIRS@%$NATIVE_LIB_DIRS%g
+s%@STRINGIFY@%$STRINGIFY%g
 s%@EMUL@%$EMUL%g
 /@TDIRS@/r $TDIRS
 s%@TDIRS@%%g
 s%@EMULATION_OFILES@%$EMULATION_OFILES%g
 s%@EMUL_EXTRA_OFILES@%$EMUL_EXTRA_OFILES%g
+s%@EMULATION_LIBPATH@%$EMULATION_LIBPATH%g
 s%@TESTBFDLIB@%$TESTBFDLIB%g
 
 CEOF
@@ -5210,5 +5028,5 @@
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
 
diff --git a/ld/configure.bat b/ld/configure.bat
deleted file mode 100644
index 4643bdb..0000000
--- a/ld/configure.bat
+++ /dev/null
@@ -1,72 +0,0 @@
-@echo off

-echo Configuring ld for go32

-echo This makefile will be built for GNUISH make

-rem This batch file assumes a unix-type "sed" program

-

-update ..\bfd\hosts\go32.h sysdep.h

-

-echo # Makefile generated by "configure.bat"> Makefile

-echo LONGARGS = gcc:ar >> Makefile

-echo CC=gcc >> Makefile

-echo host_alias=go32 >> Makefile

-echo target_alias=go32 >> Makefile

-

-update ../bfd/hosts/go32.h sysdep.h

-

-if exist config.sed del config.sed

-

-echo "s/^	\$(srcdir)\/move-if-change/	update/	">> config.sed

-echo "s/:\([^ 	]\)/: \1/g				">> config.sed

-echo "s/^	\ *\.\//	go32 /			">> config.sed

-echo "s/`echo \$(srcdir)\///g				">> config.sed

-echo "s/ | sed 's,\^\\\.\/,,'`//g			">> config.sed

-echo "s/^	cd \$(srcdir)[ 	]*;//			">> config.sed

-

-echo "/^####$/ i\					">> config.sed

-echo "CC = gcc\						">> config.sed

-echo "EMUL=go32\					">> config.sed

-echo "EMULATION_OFILES=ego32.o ei386aout.o		">> config.sed

-

-echo "/^SHELL *=/ d					">> config.sed

-echo "s/$(SHELL)/sh.exe/g				">> config.sed

-

-echo "s/'"/\\"/g					">> config.sed

-echo "s/"'/\\"/g					">> config.sed

-

-echo "/^ldmain.o: ldmain.c/,/fi/ {			">> config.sed

-echo "  s/; *\\$//					">> config.sed

-echo "  s/-DSCRIPTDIR[^ 	]*/-DSCRIPTDIR=\\".\\"/	">> config.sed

-echo "  s/config.status//				">> config.sed

-echo "  /ldmain.o:/ p					">> config.sed

-echo "  /(CC)/ p					">> config.sed

-echo "  d						">> config.sed

-echo "}							">> config.sed

-

-echo "s/^SHELL.*$/SHELL=sh.exe/				">> config.sed

-echo "s/genscripts.sh/genscripts.dos/g			">> config.sed

-

-echo "s/^ldemul-list.h/not-ldemul-list.h/		">> config.sed

-

-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ 	]*$//" config.sed > config2.sed

-sed -f config2.sed Makefile.in >> Makefile

-del config.sed

-del config2.sed

-

-echo set -a > genscripts.dj

-sed -e "/^[a-zA-Z0-9_]*=/ s/^/export /" -e "s/(. \(.*\))/sh \1/" -e "/\.em/ d" genscripts.sh >> genscripts.dj

-type emultempl\generic.em >> genscripts.dj

-update genscripts.dj genscripts.dos

-

-echo extern ld_emulation_xfer_type ld_go32_emulation; > ldemul-list.h2

-echo extern ld_emulation_xfer_type ld_i386aout_emulation; >> ldemul-list.h2

-echo #define EMULATION_LIST \>>ldemul-list.h2

-echo   &ld_go32_emulation,\>>ldemul-list.h2

-echo   &ld_i386aout_emulation,\>>ldemul-list.h2

-echo 0>>ldemul-list.h2

-

-update ldemul-list.h2 ldemul-list.h

-

-if exist ldscripts\dostest goto ldscripts

-mkdir ldscripts

-dir > ldscripts\dostest

-:ldscripts

diff --git a/ld/configure.host b/ld/configure.host
index 88eb311..38ad347 100644
--- a/ld/configure.host
+++ b/ld/configure.host
@@ -11,14 +11,14 @@
 
 HDEFINES=
 HOSTING_CRT0=/lib/crt0.o
-HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc'
+HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc'
 NATIVE_LIB_DIRS=
 
 case "${host}" in
 
 alpha*-*-linux-gnu*)
-  HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`gcc --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*.so..\).*,\1,"` `gcc --print-file-name=crt1.o` `gcc --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -L`dirname \`gcc --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` `gcc --print-file-name=crtn.o`'
+  HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
   ;;
 
 alpha*-*-netbsd*)
@@ -35,6 +35,25 @@
   NATIVE_LIB_DIRS=/usr/ccs/lib
   ;;
 
+arm*-*-linux-gnu*)
+  HOSTING_CRT0='-p -dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+  ;;
+
+i[3456]86-*-freebsdelf*)
+  # The new BSD `make' has a bug: it doesn't pass empty arguments in
+  # shell commands.  So we need to make this value non-empty in order
+  # for the genscripts.sh call to work.  There's nothing magic about
+  # the value `/lib'; it's just a dummy.
+  NATIVE_LIB_DIRS=/lib
+  # Older versions of gcc do not use a specs file.  In those cases,
+  # gcc -print-file-name=specs will simply print specs.  We create a
+  # dummy specs files to handle this.
+  echo "-dynamic-linker /usr/libexec/ld-elf.so.1" > specs
+  HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+  ;;
+
 i[3456]86-*-bsd* | i[3456]86-*-freebsd* | i[3456]86-*-netbsd*)
   # The new BSD `make' has a bug: it doesn't pass empty arguments in
   # shell commands.  So we need to make this value non-empty in order
@@ -45,24 +64,24 @@
   ;;
 
 i[3456]86-*-sysv4*)
-  HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
+  HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
   NATIVE_LIB_DIRS=/usr/ccs/lib
   ;;
 
 i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
-  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi`'
+  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
   ;;
 
 i[3456]86-*-sysv*)
   HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
   ;;
 
 i[3456]86-*-solaris*)
-  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`'
+  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
   NATIVE_LIB_DIRS=/usr/ccs/lib
   ;;
 
@@ -77,8 +96,8 @@
   echo "int dummy_crteng () { return 0; }" > crtend.c
   ${CC} -c crtend.c -o crtend.o
   rm -f crtend.c
-  HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /lib/crtn.o'
+  HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
   ;;
 
 i[3456]86-*-linux*aout* | i[3456]86-*-linuxoldld)
@@ -86,18 +105,24 @@
   ;;
 
 i[3456]86-*-linux*libc1*)
-  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
   ;;
 
 i[3456]86-*-linux-gnu*)
-  HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`gcc --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld-linux.so..\).*,\1,"` `gcc --print-file-name=crt1.o` `gcc --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -L`dirname \`gcc --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` `gcc --print-file-name=crtn.o`'
+  HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
   ;;
 
 i[3456]86-*-lynxos*)
   HOSTING_CRT0=/lib/init1.o
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+  ;;
+
+i[3456]86-pc-interix*)
+  HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
+  NATIVE_LIB_DIRS='$$INTERIX_ROOT/usr/lib/'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L $$X/local_bin -L $$INTERIX_ROOT/usr/lib -lc -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
   ;;
 
 mips*-dec-bsd*)
@@ -106,12 +131,22 @@
 
 mips*-sgi-irix4*)
   HOSTING_CRT0=/usr/lib/crt1.o
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
   ;;
 
-mips*-sgi-irix[56]*)
+mips*-sgi-irix5*)
   HOSTING_CRT0=/usr/lib/crt1.o
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
+  ;;
+
+mips*-sgi-irix6*)
+  HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L/usr/lib32 -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors'
+  ;;
+
+mips*-*-linux-gnu*)
+  HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
   ;;
 
 m68*-*-linux*aout*)
@@ -119,23 +154,23 @@
   ;;
 
 m68*-*-linux*libc1*)
-  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
   ;;
 
 m68*-*-linux-gnu*)
-  HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+  HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
   ;;
 
 m68*-*-lynxos*)
   HOSTING_CRT0=/lib/init1.o
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
   ;;
 
 m68*-motorola-sysv)
-  HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`gcc -print-file-name=\`crt0.o ]; then echo \`gcc -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`'
+  HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
   ;;
 
 m68*-sun-*)
@@ -149,13 +184,13 @@
   ;;
 
 m88*-motorola-sysv3)
-  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`'
+  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
   ;;
 
 powerpc*-*-linux-gnu*)
-  HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+  HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
   ;;
 
 romp-*-*)
@@ -163,9 +198,19 @@
   ;;
 
 sparc*-*-solaris2*)
-  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
-  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`'
+  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
   NATIVE_LIB_DIRS=/usr/ccs/lib
   ;;
 
+sparc-*-linux-gnu*)
+  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+  ;;
+
+sparc64-*-linux-gnu*)
+  HOSTING_CRT0='-dynamic-linker /lib64/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+  ;;
+
 esac
diff --git a/ld/configure.in b/ld/configure.in
index 7f3c1da..32fc5f6 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -5,7 +5,7 @@
 
 AC_CANONICAL_SYSTEM
 
-AM_INIT_AUTOMAKE(ld, 2.9.4)
+AM_INIT_AUTOMAKE(ld, 2.9.5)
 
 AM_PROG_LIBTOOL
 
@@ -68,12 +68,32 @@
 BFD_NEED_DECLARATION(getenv)
 BFD_NEED_DECLARATION(environ)
 
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise.  This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+AC_MSG_CHECKING([whether ANSI C string concatenation works])
+AC_CACHE_VAL(ld_cv_string_concatenation,
+[AC_TRY_COMPILE(,[char *a = "a" "a";],
+  [ld_cv_string_concatenation=yes],
+  [ld_cv_string_concatenation=no])])
+AC_MSG_RESULT($ld_cv_string_concatenation)
+if test "$ld_cv_string_concatenation" = "yes"; then
+  STRINGIFY=astring.sed
+else
+  STRINGIFY=ostring.sed
+fi
+AC_SUBST(STRINGIFY)
+
 # target-specific stuff:
 
 all_targets=
 EMUL=
 all_emuls=
 all_emul_extras=
+all_libpath=
 
 dnl We need to get an arbitrary number of tdir definitions into
 dnl Makefile.  We can't do it using AC_SUBST, because autoconf does
@@ -87,7 +107,7 @@
     all_targets=true
   else
     # Canonicalize the secondary target names.
-    result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null`
+    result=`$ac_config_sub $targ_alias 2>/dev/null`
     if test -n "$result"; then
 	targ=$result
     else
@@ -100,7 +120,7 @@
       EMUL=$targ_emul
     fi
 
-    for i in $targ_emul $targ_extra_emuls; do
+    for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
 	case " $all_emuls " in
 	*" e${i}.o "*) ;;
 	*)
@@ -112,6 +132,19 @@
 	esac
     done
 
+    for i in $targ_emul $targ_extra_libpath; do
+	case " $all_libpath " in
+	*" ${i} "*) ;;
+	*)
+	  if test -z "$all_libpath"; then
+	    all_libpath=${i}
+	  else
+	    all_libpath="$all_libpath ${i}"
+	  fi
+	  ;;
+	esac
+    done
+
     for i in $targ_extra_ofiles; do
 	case " $all_emul_extras " in
 	*" ${i} "*) ;;
@@ -145,6 +178,9 @@
 AC_SUBST(EMULATION_OFILES)
 AC_SUBST(EMUL_EXTRA_OFILES)
 
+EMULATION_LIBPATH=$all_libpath
+AC_SUBST(EMULATION_LIBPATH)
+
 if test x${enable_static} = xno; then
   TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
 else
@@ -152,5 +188,15 @@
 fi
 AC_SUBST(TESTBFDLIB)
 
+target_vendor=${target_vendor=$host_vendor}
+case "$target_vendor" in
+  hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
+  *)  EXTRA_SHLIB_EXTENSION= ;;
+esac
+if test x${EXTRA_SHLIB_EXTENSION} != x ; then
+  AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
+   [Additional extension a shared object might have.])
+fi
+
 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
 [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
diff --git a/ld/configure.tgt b/ld/configure.tgt
index d0555ce..52715f4 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -7,6 +7,7 @@
 # following shell variables:
 #  targ_emul		name of linker emulation to use
 #  targ_extra_emuls	additional linker emulations to provide
+#  targ_extra_libpath	additional linker emulations using LIB_PATH
 #  targ_extra_ofiles	additional objects needed by the emulation
 
 targ_extra_emuls=
@@ -15,9 +16,13 @@
 case "${targ}" in
 arm-epoc-pe)		targ_emul=arm_epoc_pe ;
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+arm-*-wince)		targ_emul=armpe ;
+			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 arm-*-pe)		targ_emul=armpe ;
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 arc-*-elf*)		targ_emul=arcelf ;;
+avr-*-*)		targ_emul=avr85xx
+			targ_extra_emuls="avr1200 avr23xx avr44x4 avr4433 avrmega603 avrmega103 avrmega161" ;;
 d10v-*-*)		targ_emul=d10velf ;;
 d30v-*-*ext*)		targ_emul=d30v_e; targ_extra_emuls="d30velf d30v_o" ;;
 d30v-*-*onchip*)	targ_emul=d30v_o; targ_extra_emuls="d30velf d30v_e" ;;
@@ -44,12 +49,26 @@
 			tdir_sun4=sparc-sun-sunos4
 			;;
 sparc*-*-linux-gnu*)	targ_emul=elf32_sparc
-			targ_extra_emuls="sparclinux sun4"
+			targ_extra_emuls="sparclinux elf64_sparc sun4"
 			tdir_sparclinux=${targ_alias}aout
+			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
 			tdir_sun4=sparc-sun-sunos4
 			;;
 sparc*-*-lynxos*)	targ_emul=sparclynx ;;
 sparc*-*-netbsd*)	targ_emul=sparcnbsd ;;
+sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
+			targ_emul=elf32_sparc ;;
+sparc-*-solaris2*)	targ_emul=elf32_sparc
+			targ_extra_emuls="elf64_sparc"
+			targ_extra_libpath=$targ_extra_emuls
+			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
+			;;
+sparcv9-*-solaris2* | sparc64-*-solaris2*)
+			targ_emul=elf64_sparc
+			targ_extra_emuls="elf32_sparc"
+			targ_extra_libpath=$targ_extra_emuls
+			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
+			;;
 sparc*-*-solaris2*)	targ_emul=elf32_sparc ;;
 sparc*-wrs-vxworks*)	targ_emul=sparcaout ;;
 sparc*-*-rtems*)	targ_emul=sparcaout ;;
@@ -59,12 +78,15 @@
 i960-*-coff)		targ_emul=gld960coff ;;
 i960-intel-nindy)	targ_emul=gld960 ;;
 i960-*-rtems*)		targ_emul=gld960coff ;;
+i960-*-elf*)		targ_emul=elf32_i960 ;;
 m32r-*-*)		targ_emul=m32relf ;;
 m68*-sun-sunos[34]*)	targ_emul=sun3 ;;
 m68*-wrs-vxworks*)	targ_emul=sun3 ;;
 m68*-ericsson-ose)	targ_emul=sun3 ;;
 m68*-apple-aux*)	targ_emul=m68kaux ;;
 *-tandem-none)		targ_emul=st2000 ;;
+i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
+i370-*-mvs*) 		targ_emul=mvs ;;
 i[3456]86-*-vsta)	targ_emul=vsta ;;
 i[3456]86-go32-rtems*)	targ_emul=i386go32 ;;
 i[3456]86-*-go32)	targ_emul=i386go32 ;;
@@ -74,6 +96,7 @@
 i[3456]86-*-isc*)	targ_emul=i386coff ;;
 i[3456]86-*-lynxos*)	targ_emul=i386lynx ;;
 i[3456]86-*-coff)	targ_emul=i386coff ;;
+i[3456]86-*-rtemself*)  targ_emul=elf_i386 ;;
 i[3456]86-*-rtems*)	targ_emul=i386coff ;;
 i[3456]86-*-bsd)	targ_emul=i386bsd ;;
 i[3456]86-*-bsd386)	targ_emul=i386bsd ;;
@@ -95,8 +118,9 @@
 i[3456]86-*-netbsd*)	targ_emul=i386nbsd ;;
 i[3456]86-*-netware)	targ_emul=i386nw ;;
 i[3456]86-*-elf*)	targ_emul=elf_i386 ;;
-i[3456]86-*-freebsdelf*) targ_emul=elf_i386 ;;
-i[3456]86-*-freebsd*)	targ_emul=i386bsd ;;
+i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | i[3456]86-*-freebsd[12])
+			targ_emul=i386bsd ;;
+i[3456]86-*-freebsd*)	targ_emul=elf_i386 ;;
 i[3456]86-*-sysv*)	targ_emul=i386coff ;;
 i[3456]86-*-ptx*)	targ_emul=i386coff ;;
 i[3456]86-*-mach*)	targ_emul=i386mach ;;
@@ -111,8 +135,11 @@
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 i[3456]86-*-mingw32*)	targ_emul=i386pe ;
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-interix*)	targ_emul=i386pe_posix;
+ 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 i[3456]86-*-beospe*)    targ_emul=i386beos ;;
 i[3456]86-*-beos*)	targ_emul=elf_i386_be ;;
+i[3456]86-*-vxworks*)	targ_emul=i386aout ;;
 m8*-*-*)		targ_emul=m88kbcs ;;
 a29k-*-udi)		targ_emul=sa29200 ;;
 a29k-*-ebmon)		targ_emul=ebmon29k ;;
@@ -121,9 +148,13 @@
 arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
 armeb-*-aout)		targ_emul=armaoutb ;;
 arm-*-coff)		targ_emul=armcoff ;;
+arm-*-netbsd*)		targ_emul=armnbsd ;;
 arm-*-elf)		targ_emul=armelf ;;
-arm-*-oabi)             targ_emul=armelf_oabi ;;
-arm*-*-linux-gnu*)	targ_emul=armelf_linux; targ_extra_emuls="armelf_linux26 armelf";;
+arm-*-oabi)		targ_emul=armelf_oabi ;;
+arm*-*-linux-gnu*)	targ_emul=armelf_linux; targ_extra_emuls="armelf_linux26 armelf" ;;
+arm*-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+arm*-*-conix*)		targ_emul=armelf ;;
+thumb-*-linux-gnu* | thumb-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
 strongarm-*-coff)	targ_emul=armcoff ;;
 strongarm-*-elf)	targ_emul=armelf ;;
 thumb-*-coff)		targ_emul=armcoff ;;
@@ -140,9 +171,12 @@
 			targ_emul=h8500
 			targ_extra_emuls="h8500s h8500b h8500m h8500c"
 			;;
-sh-*-elf*)		targ_emul=shelf
+sh-*-elf* | sh-*-rtemself*)
+			targ_emul=shelf
 			targ_extra_emuls="shlelf sh shl"
 			;;
+sh-*-pe)		targ_emul=shpe ;
+			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 sh-*-*|sh-*-rtems*)	targ_emul=sh; targ_extra_emuls=shl ;;
 m68k-sony-*)		targ_emul=news ;;
 m68k-hp-bsd*)		targ_emul=hp300bsd ;;
@@ -165,13 +199,20 @@
 m68*-*-netbsd*)		targ_emul=m68knbsd ;;
 m68*-*-psos*)		targ_emul=m68kpsos ;;
 m68*-*-rtems*)		targ_emul=m68kcoff ;;
+hppa*w*-*)		targ_emul=elf64hppa ;;
 hppa*-*-*elf*)		targ_emul=hppaelf ;;
+hppa*-*-linux-gnu*)	targ_emul=hppaelf ;;
 hppa*-*-lites*)		targ_emul=hppaelf ;;
 hppa*-*-rtems*)		targ_emul=hppaelf ;;
 vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
+mips*-*-pe)		targ_emul=mipspe ;
+			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 mips*-dec-ultrix*)	targ_emul=mipslit ;;
 mips*-dec-osf*)		targ_emul=mipslit ;;
-mips*-sgi-irix[56]*)	targ_emul=elf32bsmip ;;
+mips*-sgi-irix5*)	targ_emul=elf32bsmip ;;
+mips*-sgi-irix6*)	targ_emul=elf32bmipn32
+	                targ_extra_emuls="elf32bsmip elf64bmip"
+	                ;;
 mips*-sgi-irix*)	targ_emul=mipsbig ;;
 mips*el-*-ecoff*)	targ_emul=mipsidtl ;;
 mips*-*-ecoff*)		targ_emul=mipsidt ;;
@@ -186,7 +227,9 @@
 mips*vr5000-*-elf*)	targ_emul=elf32b4300 ;;
 mips*el-*-elf*)		targ_emul=elf32elmip ;;
 mips*-*-elf*)		targ_emul=elf32ebmip ;;
+mips*el-*-rtems*)	targ_emul=elf32elmip ;;
 mips*-*-rtems*)		targ_emul=elf32ebmip ;;
+mips*el-*-vxworks*)	targ_emul=elf32elmip ;;
 mips*-*-vxworks*)	targ_emul=elf32ebmip ;;
 mips*el-*-linux-gnu*)	targ_emul=elf32lsmip
 			targ_extra_emuls="elf32bsmip mipslit mipsbig"
@@ -210,12 +253,17 @@
 z8k-*-coff) 		targ_emul=z8002; targ_extra_emuls=z8001 ;;
 ns32k-pc532-mach* | ns32k-pc532-ux*)	targ_emul=pc532macha ;;
 ns32k-pc532-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;;
-powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-linux-gnu* | powerpc-*-sysv* \
+powerpc-*-linux-gnu*)	targ_emul=elf32ppclinux; targ_extra_emuls=elf32ppc;
+			targ_extra_libpath=elf32ppc ;;
+pjl*-*-*)	        targ_emul=pjlelf ; targ_extra_emuls="elf_i386" ;;
+pj*-*-*)	        targ_emul=pjelf ;;
+powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-sysv* \
   | powerpc-*-netbsd* | powerpc-*-vxworks*)
 	targ_emul=elf32ppc ;;
 powerpcle-*-elf* | powerpcle-*-eabi* | powerpcle-*-solaris* \
   | powerpcle-*-sysv* | powerpcle-*-vxworks*)
 	targ_emul=elf32lppc ;;
+powerpcle-*-rtems*)	targ_emul=elf32leppc ;;
 powerpc-*-rtems*)	targ_emul=elf32ppc ;;
 powerpc-*-macos*)	targ_emul=ppcmacos ;;
 powerpc-*-netware*)	targ_emul=ppcnw ;;
@@ -236,9 +284,6 @@
 mcore-*-pe)		targ_emul=mcorepe ;
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 mcore-*-elf)		targ_emul=elf32mcore ;;
-*-*-aout)		targ_emul=${target_cpu}-${target_vendor} ;;
-*-*-coff)		targ_emul=${target_cpu}-${target_vendor} ;;
-*-*-netware)		targ_emul=${target_cpu}-nw ;;
 *-*-ieee*)		targ_emul=vanilla ;;
 
 *)
diff --git a/ld/deffile.h b/ld/deffile.h
index 3c6c1ce..e2c710d 100644
--- a/ld/deffile.h
+++ b/ld/deffile.h
@@ -19,6 +19,9 @@
    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+#ifndef DEFFILE_H
+#define DEFFILE_H
+
 #include "ansidecl.h"
 
 /* DEF storage definitions.  Note that any ordinal may be zero, and
@@ -121,3 +124,5 @@
 extern void def_file_print PARAMS ((FILE * _file,
 				    def_file * _def));
 #endif
+
+#endif /* DEFFILE_H */
diff --git a/ld/deffilep.y b/ld/deffilep.y
index aacde6b..760167b 100644
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -1,6 +1,6 @@
 %{ /* deffilep.y - parser for .def files */
 
-/*   Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/*   Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -93,7 +93,6 @@
 static void def_directive PARAMS ((char *));
 static int def_parse PARAMS ((void));
 static int def_error PARAMS ((const char *));
-static int def_debug;
 static int def_lex PARAMS ((void));
 
 static int lex_forced_token = 0;
@@ -107,9 +106,10 @@
   int number;
 };
 
-%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
-%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT, PRIVATE
-%token READ WRITE EXECUTE SHARED NONAME DIRECTIVE
+%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATAU, DATAL
+%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANTU, CONSTANTL
+%token PRIVATEU, PRIVATEL
+%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
 %token <id> ID
 %token <number> NUMBER
 %type  <number> opt_base opt_ordinal
@@ -129,7 +129,7 @@
 	|	STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
 	|	HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
 	|	CODE attr_list { def_section ("CODE", $2);}
-	|	DATA attr_list  { def_section ("DATA", $2);}
+	|	DATAU attr_list  { def_section ("DATA", $2);}
 	|	SECTIONS seclist
 	|	EXPORTS explist 
 	|	IMPORTS implist
@@ -146,18 +146,28 @@
 	;
 
 expline:
-		ID opt_equal_name opt_ordinal exp_opt_list
-			{ def_exports ($1, $2, $3, $4); }
+		/* The opt_comma is necessary to support both the usual
+		  DEF file syntax as well as .drectve syntax which
+		  mandates <expsym>,<expoptlist>.  */
+		ID opt_equal_name opt_ordinal opt_comma exp_opt_list
+			{ def_exports ($1, $2, $3, $5); }
 	;
 exp_opt_list:
-		exp_opt exp_opt_list { $$ = $1 | $2; }
+		/* The opt_comma is necessary to support both the usual
+		   DEF file syntax as well as .drectve syntax which
+		   allows for comma separated opt list.  */
+		exp_opt opt_comma exp_opt_list { $$ = $1 | $3; }
 	|	{ $$ = 0; }
 	;
 exp_opt:
-		NONAME		{ $$ = 1; }
-	|	CONSTANT	{ $$ = 2; }
-	|	DATA		{ $$ = 4; }
-	|	PRIVATE		{ $$ = 8; }
+		NONAMEU		{ $$ = 1; }
+	|	NONAMEL		{ $$ = 1; }
+	|	CONSTANTU	{ $$ = 2; }
+	|	CONSTANTL	{ $$ = 2; }
+	|	DATAU		{ $$ = 4; }
+	|	DATAL		{ $$ = 4; }
+	|	PRIVATEU	{ $$ = 8; }
+	|	PRIVATEL	{ $$ = 8; }
 	;
 implist:	
 		implist impline
@@ -204,7 +214,13 @@
 	;
 
 opt_name: ID		{ $$ = $1; }
-	|		{ $$ = 0; }
+	| ID '.' ID	
+	  { 
+	    char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+	    sprintf (name, "%s.%s", $1, $3);
+	    $$ = name;
+	  }
+	|		{ $$ = ""; }
 	;
 
 opt_ordinal: 
@@ -828,8 +844,10 @@
 {
   { "BASE", BASE },
   { "CODE", CODE },
-  { "CONSTANT", CONSTANT },
-  { "DATA", DATA },
+  { "CONSTANT", CONSTANTU },
+  { "constant", CONSTANTL },
+  { "DATA", DATAU },
+  { "data", DATAL },
   { "DESCRIPTION", DESCRIPTION },
   { "DIRECTIVE", DIRECTIVE },
   { "EXECUTE", EXECUTE },
@@ -838,8 +856,10 @@
   { "IMPORTS", IMPORTS },
   { "LIBRARY", LIBRARY },
   { "NAME", NAME },
-  { "NONAME", NONAME },
-  { "PRIVATE", PRIVATE },
+  { "NONAME", NONAMEU },
+  { "noname", NONAMEL },
+  { "PRIVATE", PRIVATEU },
+  { "private", PRIVATEL },
   { "READ", READ },
   { "SECTIONS", SECTIONS },
   { "SEGMENTS", SECTIONS },
diff --git a/ld/emulparams/arm_epoc_pe.sh b/ld/emulparams/arm_epoc_pe.sh
index 816fa2a..04fa22d 100644
--- a/ld/emulparams/arm_epoc_pe.sh
+++ b/ld/emulparams/arm_epoc_pe.sh
@@ -1,6 +1,9 @@
 ARCH=arm
-SCRIPT_NAME=pe
+SCRIPT_NAME=epocpe
 OUTPUT_FORMAT="epoc-pei-arm-little"
 LITTLE_OUTPUT_FORMAT="epoc-pei-arm-little"
 BIG_OUTPUT_FORMAT="epoc-pei-arm-big"
 TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh
index 2b8b02b..8c79b64 100644
--- a/ld/emulparams/armelf.sh
+++ b/ld/emulparams/armelf.sh
@@ -7,8 +7,9 @@
 TEMPLATE_NAME=armelf
 OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
 OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
 
+GENERATE_SHLIB_SCRIPT=yes
 
 ARCH=arm
 MACHINE=
diff --git a/ld/emulparams/armelf_linux.sh b/ld/emulparams/armelf_linux.sh
index 2d7d57b..a85e8bd 100644
--- a/ld/emulparams/armelf_linux.sh
+++ b/ld/emulparams/armelf_linux.sh
@@ -5,13 +5,15 @@
 LITTLE_OUTPUT_FORMAT="elf32-littlearm"
 MAXPAGESIZE=0x8000
 TEMPLATE_NAME=armelf
+GENERATE_SHLIB_SCRIPT=yes
 
+DATA_START_SYMBOLS='__data_start = . ;';
 OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
 OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
 
 # This needs to be high enough so that we can load ld.so below it,
-# yet low enough to stay away from the mmap area 0x40000000.
+# yet low enough to stay away from the mmap area at 0x40000000.
 # Also, it is small enough so that relocs which are pointing
 # at absolute 0 will still be fixed up.
 TEXT_START_ADDR=0x02000000
diff --git a/ld/emulparams/armelf_linux26.sh b/ld/emulparams/armelf_linux26.sh
index 7153ddc..36d1b0e 100644
--- a/ld/emulparams/armelf_linux26.sh
+++ b/ld/emulparams/armelf_linux26.sh
@@ -7,6 +7,10 @@
 TEMPLATE_NAME=armelf
 GENERATE_SHLIB_SCRIPT=yes
 
+DATA_START_SYMBOLS='__data_start = . ;';
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
 # This needs to be high enough so that we can load ld.so below it,
 # yet low enough to stay away from the mmap area at 0x01100000.
 # Also, it is small enough so that relocs which are pointing
diff --git a/ld/emulparams/armelf_oabi.sh b/ld/emulparams/armelf_oabi.sh
index 257753e..d568328 100644
--- a/ld/emulparams/armelf_oabi.sh
+++ b/ld/emulparams/armelf_oabi.sh
@@ -4,7 +4,7 @@
 BIG_OUTPUT_FORMAT="elf32-bigarm-oabi"
 LITTLE_OUTPUT_FORMAT="elf32-littlearm-oabi"
 TEXT_START_ADDR=0x8000
-TEMPLATE_NAME=armelf
+TEMPLATE_NAME=armelf_oabi
 OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
 OTHER_BSS_SYMBOLS='__bss_start__ = .;'
 OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
diff --git a/ld/emulparams/armnbsd.sh b/ld/emulparams/armnbsd.sh
new file mode 100644
index 0000000..fc27791
--- /dev/null
+++ b/ld/emulparams/armnbsd.sh
@@ -0,0 +1,7 @@
+SCRIPT_NAME=aout
+TEXT_START_ADDR=0x1020
+OUTPUT_FORMAT="a.out-arm-netbsd"
+TARGET_PAGE_SIZE=0x1000
+ARCH=arm
+EXECUTABLE_SYMBOLS='__DYNAMIC = 0;'
+NONPAGED_TEXT_START_ADDR=0x1000
diff --git a/ld/emulparams/armpe.sh b/ld/emulparams/armpe.sh
index 2246805..257c9de 100644
--- a/ld/emulparams/armpe.sh
+++ b/ld/emulparams/armpe.sh
@@ -4,3 +4,6 @@
 LITTLE_OUTPUT_FORMAT="pei-arm-little"
 BIG_OUTPUT_FORMAT="pei-arm-big"
 TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/avr1200.sh b/ld/emulparams/avr1200.sh
new file mode 100644
index 0000000..5f833ad
--- /dev/null
+++ b/ld/emulparams/avr1200.sh
@@ -0,0 +1,11 @@
+ARCH=avr:1
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=1K
+DATA_LENGTH=0
+EEPROM_LENGTH=64
diff --git a/ld/emulparams/avr23xx.sh b/ld/emulparams/avr23xx.sh
new file mode 100644
index 0000000..d8e45df
--- /dev/null
+++ b/ld/emulparams/avr23xx.sh
@@ -0,0 +1,12 @@
+ARCH=avr:2
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=2K
+DATA_LENGTH=128
+EEPROM_LENGTH=128
+
diff --git a/ld/emulparams/avr4433.sh b/ld/emulparams/avr4433.sh
new file mode 100644
index 0000000..125a203
--- /dev/null
+++ b/ld/emulparams/avr4433.sh
@@ -0,0 +1,12 @@
+ARCH=avr:2
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=4K
+DATA_LENGTH=128
+EEPROM_LENGTH=256
+
diff --git a/ld/emulparams/avr44x4.sh b/ld/emulparams/avr44x4.sh
new file mode 100644
index 0000000..fb36aec
--- /dev/null
+++ b/ld/emulparams/avr44x4.sh
@@ -0,0 +1,12 @@
+ARCH=avr:2
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=4K
+DATA_LENGTH=256
+EEPROM_LENGTH=256
+
diff --git a/ld/emulparams/avr85xx.sh b/ld/emulparams/avr85xx.sh
new file mode 100644
index 0000000..fef3979
--- /dev/null
+++ b/ld/emulparams/avr85xx.sh
@@ -0,0 +1,12 @@
+ARCH=avr:2
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=8K
+DATA_LENGTH=512
+EEPROM_LENGTH=512
+
diff --git a/ld/emulparams/avrmega103.sh b/ld/emulparams/avrmega103.sh
new file mode 100644
index 0000000..e727e8b
--- /dev/null
+++ b/ld/emulparams/avrmega103.sh
@@ -0,0 +1,12 @@
+ARCH=avr:3
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=128K
+DATA_LENGTH=4K
+EEPROM_LENGTH=4K
+
diff --git a/ld/emulparams/avrmega161.sh b/ld/emulparams/avrmega161.sh
new file mode 100644
index 0000000..6319892
--- /dev/null
+++ b/ld/emulparams/avrmega161.sh
@@ -0,0 +1,12 @@
+ARCH=avr:4
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=16K
+DATA_LENGTH=1K
+EEPROM_LENGTH=512
+
diff --git a/ld/emulparams/avrmega603.sh b/ld/emulparams/avrmega603.sh
new file mode 100644
index 0000000..1b7d14b
--- /dev/null
+++ b/ld/emulparams/avrmega603.sh
@@ -0,0 +1,12 @@
+ARCH=avr:3
+MACHINE=
+SCRIPT_NAME=elf32avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+TEXT_LENGTH=64K
+DATA_LENGTH=4K
+EEPROM_LENGTH=2K
+
diff --git a/ld/emulparams/d10velf.sh b/ld/emulparams/d10velf.sh
index bcce51f..c8c4214 100644
--- a/ld/emulparams/d10velf.sh
+++ b/ld/emulparams/d10velf.sh
@@ -2,7 +2,7 @@
 SCRIPT_NAME=elfd10v
 OUTPUT_FORMAT="elf32-d10v"
 TEXT_START_ADDR=0x01000000
-READONLY_START_ADDR=0x00000004
+READONLY_START_ADDR=0x02000004
 ARCH=d10v
 MAXPAGESIZE=32
 EMBEDDED=t
diff --git a/ld/emulparams/elf32_i960.sh b/ld/emulparams/elf32_i960.sh
new file mode 100644
index 0000000..10ec3fa
--- /dev/null
+++ b/ld/emulparams/elf32_i960.sh
@@ -0,0 +1,8 @@
+SCRIPT_NAME=elf
+TEMPLATE_NAME=elf32
+OUTPUT_FORMAT="elf32-i960"
+ARCH=i960
+MACHINE=
+TEXT_START_ADDR=0
+EMBEDDED=yes
+MAXPAGESIZE=0x2000
diff --git a/ld/emulparams/elf32bmipn32.sh b/ld/emulparams/elf32bmipn32.sh
new file mode 100755
index 0000000..56f42a9
--- /dev/null
+++ b/ld/emulparams/elf32bmipn32.sh
@@ -0,0 +1,75 @@
+# This is an ELF platform.
+SCRIPT_NAME=elf
+
+# Handle both big- and little-ended 32-bit MIPS objects.
+ARCH=mips
+OUTPUT_FORMAT="elf32-bigmips"
+BIG_OUTPUT_FORMAT="elf32-bigmips"
+LITTLE_OUTPUT_FORMAT="elf32-littlemips"
+
+TEMPLATE_NAME=elf32
+
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x100000
+ENTRY=__start
+
+# GOT-related settings.  
+OTHER_GOT_SYMBOLS='
+  _gp = ALIGN(16) + 0x7ff0;
+'
+OTHER_GOT_SECTIONS='
+  .lit8 : { *(.lit8) }
+  .lit4 : { *(.lit4) }
+  .srdata : { *(.srdata) }
+'
+
+# Magic symbols.
+TEXT_START_SYMBOLS='_ftext = . ;'
+DATA_START_SYMBOLS='_fdata = . ;'
+OTHER_BSS_SYMBOLS='_fbss = .;'
+# IRIX6 defines these symbols.  0x34 is the size of the ELF header.
+EXECUTABLE_SYMBOLS="
+  __dso_displacement = 0;
+  __elf_header = ${TEXT_START_ADDR};
+  __program_header_table = ${TEXT_START_ADDR} + 0x34;
+"
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
+
+OTHER_RELOCATING_SECTIONS='
+  .MIPS.events.text :
+    {
+       *(.MIPS.events.text)
+       *(.MIPS.events.gnu.linkonce.t*)
+    }
+  .MIPS.content.text : 
+    {
+       *(.MIPS.content.text)
+       *(.MIPS.content.gnu.linkonce.t*)
+    }
+  .MIPS.events.data : 
+    {
+       *(.MIPS.events.data)
+       *(.MIPS.events.gnu.linkonce.d*)
+    }
+  .MIPS.content.data : 
+    {
+       *(.MIPS.content.data)
+       *(.MIPS.content.gnu.linkonce.d*)
+    }
+  .MIPS.events.rodata : 
+    {
+       *(.MIPS.events.rodata)
+       *(.MIPS.events.gnu.linkonce.r*)
+    }
+  .MIPS.content.rodata : 
+    {
+       *(.MIPS.content.rodata)
+       *(.MIPS.content.gnu.linkonce.r*)
+    }
+'
diff --git a/ld/emulparams/elf32i370.sh b/ld/emulparams/elf32i370.sh
new file mode 100644
index 0000000..d9d5d85
--- /dev/null
+++ b/ld/emulparams/elf32i370.sh
@@ -0,0 +1,8 @@
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+SCRIPT_NAME=elfi370
+OUTPUT_FORMAT="elf32-i370"
+TEXT_START_ADDR=0x01800000
+MAXPAGESIZE=0x40000
+ARCH=i370
+MACHINE=
diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index 47d960f..b1f7b8c 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -1,5 +1,5 @@
 SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-mcore-big"
+OUTPUT_FORMAT="elf32-mcore-little"
 BIG_OUTPUT_FORMAT="elf32-mcore-big"
 LITTLE_OUTPUT_FORMAT="elf32-mcore-little"
 PAGE_SIZE=0x1000
@@ -8,13 +8,92 @@
 TEXT_START_ADDR=0
 NONPAGED_TEXT_START_ADDR=0
 ARCH=mcore
-# 1211 == mov r1,r1
-NOP=0x1211
 EMBEDDED=yes
 
+# There is a problem with the NOP value - it must work for both
+# big endian and little endian systems.  Unfortunately there is
+# no symmetrical mcore opcode that functions as a noop.  The
+# chosen solution is to use "tst r0, r14".  This is a symetrical
+# value, and apart from the corruption of the C bit, it has no other
+# side effects.  Since the carry bit is never tested without being
+# explicitly set first, and since the NOP code is only used as a
+# fill value between independantly viable peices of code, it should
+# not matter.
+NOP=0x0e0e
+
 OTHER_BSS_SYMBOLS="__bss_start__ = . ;"
 OTHER_BSS_END_SYMBOLS="__bss_end__ = . ;"
 
 # Hmmm, there's got to be a better way.  This sets the stack to the
 # top of the simulator memory (2^19 bytes).
 OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }'
+
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+
+# This code gets inserted into the generic elf32.sc linker script
+# and allows us to define our own command line switches.
+PARSE_AND_LIST_ARGS='
+
+#define OPTION_BASE_FILE		300
+
+#include "getopt.h"
+
+static struct option longopts[] =
+{
+  {"base-file", required_argument, NULL, OPTION_BASE_FILE},
+  {NULL, no_argument, NULL, 0}
+};
+
+static void
+gld_elf32mcore_list_options (file)
+     FILE * file;
+{
+  fprintf (file, _("  --base_file <basefile>      Generate a base file for relocatable DLLs\n"));
+}
+
+static int
+gld_elf32mcore_parse_args (argc, argv)
+     int argc;
+     char ** argv;
+{
+  int        longind;
+  int        optc;
+  int        prevoptind = optind;
+  int        prevopterr = opterr;
+  int        wanterror;
+  static int lastoptind = -1;
+
+  if (lastoptind != optind)
+    opterr = 0;
+  
+  wanterror  = opterr;
+  lastoptind = optind;
+
+  optc   = getopt_long_only (argc, argv, "-", longopts, & longind);
+  opterr = prevopterr;
+
+  switch (optc)
+    {
+    default:
+      if (wanterror)
+	xexit (1);
+      optind =  prevoptind;
+      return 0;
+
+    case OPTION_BASE_FILE:
+      link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
+      if (link_info.base_file == NULL)
+	{
+	  /* xgettext:c-format */
+	  fprintf (stderr, _("%s: Cannot open base file %s\n"),
+		   program_name, optarg);
+	  xexit (1);
+	}
+      break;
+    }
+  
+  return 1;
+}
+
+'
diff --git a/ld/emulparams/elf32ppc.sh b/ld/emulparams/elf32ppc.sh
index 8af42f1..3e3880c 100644
--- a/ld/emulparams/elf32ppc.sh
+++ b/ld/emulparams/elf32ppc.sh
@@ -3,6 +3,6 @@
 SCRIPT_NAME=elfppc
 OUTPUT_FORMAT="elf32-powerpc"
 TEXT_START_ADDR=0x01800000
-MAXPAGESIZE=0x40000
+MAXPAGESIZE=0x10000
 ARCH=powerpc
 MACHINE=
diff --git a/ld/emulparams/elf32ppclinux.sh b/ld/emulparams/elf32ppclinux.sh
new file mode 100644
index 0000000..9996c7b
--- /dev/null
+++ b/ld/emulparams/elf32ppclinux.sh
@@ -0,0 +1,8 @@
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+SCRIPT_NAME=elfppc
+OUTPUT_FORMAT="elf32-powerpc"
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x10000
+ARCH=powerpc
+MACHINE=
diff --git a/ld/emulparams/elf64_sparc.sh b/ld/emulparams/elf64_sparc.sh
index d0fbdfd..2ab2e4f 100644
--- a/ld/emulparams/elf64_sparc.sh
+++ b/ld/emulparams/elf64_sparc.sh
@@ -10,3 +10,37 @@
 DATA_PLT=
 GENERATE_SHLIB_SCRIPT=yes
 NOP=0x01000000
+
+if [ "x${host}" = "x${target}" ]; then
+  case " $EMULATION_LIBPATH " in
+    *" ${EMULATION_NAME} "*)
+      # Native, and default or emulation requesting LIB_PATH.
+
+      # Linux and Solaris modify the default library search path
+      # to first include a 64-bit specific directory.  It's put
+      # in slightly different places on the two systems.
+      case "$target" in
+        sparc*-linux*)
+          suffix=64 ;;
+        sparc*-solaris*)
+          suffix=/sparcv9 ;;
+      esac
+
+      if [ -n "${suffix}" ]; then
+
+	LIB_PATH=/lib${suffix}:/lib
+	LIB_PATH=${LIB_PATH}:/usr/lib${suffix}:/usr/lib
+	if [ -n "${NATIVE_LIB_DIRS}" ]; then
+	  LIB_PATH=${LIB_PATH}:`echo ${NATIVE_LIB_DIRS} | sed s/:/${suffix}:/g`${suffix}:${NATIVE_LIB_DIRS}
+	fi
+	if [ "${libdir}" != /usr/lib ]; then
+	  LIB_PATH=${LIB_PATH}:${libdir}${suffix}:${libdir}
+	fi
+	if [ "${libdir}" != /usr/local/lib ]; then
+	  LIB_PATH=${LIB_PATH}:/usr/local/lib${suffix}:/usr/local/lib
+	fi
+
+      fi
+    ;;
+  esac
+fi
diff --git a/ld/emulparams/elf64bmip.sh b/ld/emulparams/elf64bmip.sh
new file mode 100755
index 0000000..a4852d5
--- /dev/null
+++ b/ld/emulparams/elf64bmip.sh
@@ -0,0 +1,79 @@
+# This is an ELF platform.
+SCRIPT_NAME=elf
+
+# Handle both big- and little-ended 32-bit MIPS objects.
+ARCH=mips
+OUTPUT_FORMAT="elf64-bigmips"
+BIG_OUTPUT_FORMAT="elf64-bigmips"
+LITTLE_OUTPUT_FORMAT="elf64-littlemips"
+
+# Note that the elf32 template is used for 64-bit emulations as well 
+# as 32-bit emulations.
+ELFSIZE=64
+TEMPLATE_NAME=elf32
+
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x100000
+ENTRY=__start
+
+# GOT-related settings.  
+OTHER_GOT_SYMBOLS='
+  _gp = ALIGN(16) + 0x7ff0;
+'
+OTHER_GOT_SECTIONS='
+  .lit8 : { *(.lit8) }
+  .lit4 : { *(.lit4) }
+  .srdata : { *(.srdata) }
+'
+
+# Magic symbols.
+TEXT_START_SYMBOLS='_ftext = . ;'
+DATA_START_SYMBOLS='_fdata = . ;'
+OTHER_BSS_SYMBOLS='_fbss = .;'
+# IRIX6 defines these symbols.  0x40 is the size of the ELF header.
+EXECUTABLE_SYMBOLS="
+  __dso_displacement = 0;
+  __elf_header = ${TEXT_START_ADDR};
+  __program_header_table = ${TEXT_START_ADDR} + 0x40;
+"
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
+
+
+OTHER_RELOCATING_SECTIONS='
+  .MIPS.events.text :
+    {
+       *(.MIPS.events.text)
+       *(.MIPS.events.gnu.linkonce.t*)
+    }
+  .MIPS.content.text : 
+    {
+       *(.MIPS.content.text)
+       *(.MIPS.content.gnu.linkonce.t*)
+    }
+  .MIPS.events.data : 
+    {
+       *(.MIPS.events.data)
+       *(.MIPS.events.gnu.linkonce.d*)
+    }
+  .MIPS.content.data : 
+    {
+       *(.MIPS.content.data)
+       *(.MIPS.content.gnu.linkonce.d*)
+    }
+  .MIPS.events.rodata : 
+    {
+       *(.MIPS.events.rodata)
+       *(.MIPS.events.gnu.linkonce.r*)
+    }
+  .MIPS.content.rodata : 
+    {
+       *(.MIPS.content.rodata)
+       *(.MIPS.content.gnu.linkonce.r*)
+    }
+'
diff --git a/ld/emulparams/elf64hppa.sh b/ld/emulparams/elf64hppa.sh
new file mode 100755
index 0000000..829ad43
--- /dev/null
+++ b/ld/emulparams/elf64hppa.sh
@@ -0,0 +1,56 @@
+SCRIPT_NAME=elf
+ELFSIZE=64
+OUTPUT_FORMAT="elf64-hppa"
+LIB_PATH=/usr/lib/pa20_64:/opt/langtools/lib/pa20_64
+TEXT_START_ADDR=0x4000000000001000
+DATA_ADDR=0x8000000000001000
+
+# The HP dynamic linker actually requires you set the start of text and
+# data to some reasonable value.  Of course nobody knows what reasoanble
+# really is, so we just use the same values that HP's linker uses.
+SHLIB_TEXT_START_ADDR=0x4000000000001000
+SHLIB_DATA_ADDR=0x8000000000001000
+
+TARGET_PAGE_SIZE=4096
+MAXPAGESIZE=4096
+ARCH=hppa
+MACHINE=hppa2.0w
+ENTRY="main"
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+# We really want multiple .stub sections, one for each input .text section,
+# but for now this is good enough.
+OTHER_READONLY_SECTIONS='.PARISC.unwind : { *(.PARISC.unwind) } '
+
+# The PA64 ELF port treats .plt sections differently than most.  We also have
+# to create a .opd section.  What most systems call the .got, we call the .dlt
+OTHER_READWRITE_SECTIONS='.opd : { *(.opd) } PROVIDE (__gp = .); .plt : { *(.plt) } .dlt : { *(.dlt) }'
+
+# The PA64 ELF port has two additional bss sections. huge bss and thread bss.
+# Make sure they end up in the appropriate location.  We also have to set
+# __TLS_SIZE to the size of the thread bss section.
+OTHER_BSS_SECTIONS='.hbss : { *(.hbss) } .tbss : { *(.tbss) }'
+#OTHER_BSS_END_SYMBOLS='PROVIDE (__TLS_SIZE = SIZEOF (.tbss));'
+OTHER_BSS_END_SYMBOLS='PROVIDE (__TLS_SIZE = 0);'
+
+# HPs use .dlt where systems use .got.  Sigh.
+OTHER_GOT_RELOC_SECTIONS='.rela.dlt : { *(.rela.dlt) }'
+
+# We're not actually providing a symbol anymore (due to the inability to be
+# safe in regards to shared libraries). So we just allocate the hunk of space
+# unconditionally, but do not mess around with the symbol table.
+DATA_START_SYMBOLS='. += 16;'
+
+# The linker is required to define these two symbols.
+EXECUTABLE_SYMBOLS='PROVIDE (__SYSTEM_ID = 0x214); PROVIDE (_FPU_STATUS = 0x0);'
+DATA_PLT=
+
+# .dynamic should be at the start of the .text segment.
+TEXT_DYNAMIC=
+
+# The PA64 ELF port needs two additional initializer sections and also wants
+# a start/end symbol pair for the .init and .fini sections.
+INIT_START='KEEP (*(.HP.init)); PROVIDE (__preinit_start = .); KEEP (*(.preinit)); PROVIDE (__preinit_end = .); PROVIDE (__init_start = .);'
+INIT_END='PROVIDE (__init_end = .);'
+FINI_START='PROVIDE (__fini_start = .);'
+FINI_END='PROVIDE (__fini_end = .);'
diff --git a/ld/emulparams/go32.sh b/ld/emulparams/go32.sh
deleted file mode 100644
index d13357f..0000000
--- a/ld/emulparams/go32.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-SCRIPT_NAME=go32coff
-OUTPUT_FORMAT="coff-go32"
-TEXT_START_ADDR=0x10a8
-TARGET_PAGE_SIZE=0x1000
-SEGMENT_SIZE=0x1000
-NONPAGED_TEXT_START_ADDR=0x0
-ARCH=i386
diff --git a/ld/emulparams/i386pe.sh b/ld/emulparams/i386pe.sh
index 188a8ad..a8add23 100644
--- a/ld/emulparams/i386pe.sh
+++ b/ld/emulparams/i386pe.sh
@@ -3,3 +3,6 @@
 OUTPUT_FORMAT="pei-i386"
 RELOCATEABLE_OUTPUT_FORMAT="pe-i386"
 TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/i386pe_posix.sh b/ld/emulparams/i386pe_posix.sh
new file mode 100644
index 0000000..37f51b5
--- /dev/null
+++ b/ld/emulparams/i386pe_posix.sh
@@ -0,0 +1,9 @@
+ARCH=i386
+SCRIPT_NAME=pe
+OUTPUT_FORMAT="pei-i386"
+RELOCATEABLE_OUTPUT_FORMAT="pe-i386"
+TEMPLATE_NAME=pe
+ENTRY="___PosixProcessStartup"
+SUBSYSTEM=7
+EXECUTABLE_NAME=a.out
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/mcorepe.sh b/ld/emulparams/mcorepe.sh
index b5baee9..3c19e02 100644
--- a/ld/emulparams/mcorepe.sh
+++ b/ld/emulparams/mcorepe.sh
@@ -1,6 +1,9 @@
 ARCH=mcore
 SCRIPT_NAME=mcorepe
-OUTPUT_FORMAT="pei-mcore-big"
+OUTPUT_FORMAT="pei-mcore-little"
 LITTLE_OUTPUT_FORMAT="pei-mcore-little"
 BIG_OUTPUT_FORMAT="pei-mcore-big"
 TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/mipspe.sh b/ld/emulparams/mipspe.sh
new file mode 100644
index 0000000..3467452
--- /dev/null
+++ b/ld/emulparams/mipspe.sh
@@ -0,0 +1,8 @@
+ARCH=mips
+SCRIPT_NAME=pe
+OUTPUT_FORMAT="pei-mips"
+OUTPUT_ARCH="mips"
+RELOCATEABLE_OUTPUT_FORMAT="ecoff-littlemips"
+TEMPLATE_NAME=pe
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/pjelf.sh b/ld/emulparams/pjelf.sh
new file mode 100644
index 0000000..acfd2b3
--- /dev/null
+++ b/ld/emulparams/pjelf.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-pj"
+TEXT_START_ADDR=0x1000000
+MAXPAGESIZE=0x1000
+ARCH=pj
diff --git a/ld/emulparams/pjlelf.sh b/ld/emulparams/pjlelf.sh
new file mode 100644
index 0000000..35958fd
--- /dev/null
+++ b/ld/emulparams/pjlelf.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-pjl"
+TEXT_START_ADDR=0x1000000
+MAXPAGESIZE=0x1000
+ARCH=pj
diff --git a/ld/emulparams/ppcpe.sh b/ld/emulparams/ppcpe.sh
index 655282d..a2d09ef 100644
--- a/ld/emulparams/ppcpe.sh
+++ b/ld/emulparams/ppcpe.sh
@@ -2,3 +2,6 @@
 SCRIPT_NAME=ppcpe
 OUTPUT_FORMAT="pei-powerpcle"
 TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emulparams/shpe.sh b/ld/emulparams/shpe.sh
new file mode 100644
index 0000000..2f8664c
--- /dev/null
+++ b/ld/emulparams/shpe.sh
@@ -0,0 +1,6 @@
+ARCH=sh
+SCRIPT_NAME=pe
+OUTPUT_FORMAT="pei-shl"
+TEMPLATE_NAME=pe
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index c77857f..dd81b5f 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -4,7 +4,7 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* AIX emulation code for ${EMULATION_NAME}
-   Copyright (C) 1991, 93, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    AIX support by Ian Lance Taylor <ian@cygnus.com>
 
@@ -985,7 +985,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -1049,6 +1049,7 @@
   0,	/* place_orphan */
   0,	/* set_symbols */
   gld${EMULATION_NAME}_parse_args,
-  gld${EMULATION_NAME}_unrecognized_file
+  gld${EMULATION_NAME}_unrecognized_file,
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 9955fda..d73b3d1 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -4,7 +4,7 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* emulate the original gld for the given ${EMULATION_NAME}
-   Copyright (C) 1991, 93, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
 This file is part of GLD, the Gnu Linker.
@@ -43,18 +43,22 @@
 static void gld${EMULATION_NAME}_before_allocation PARAMS ((void));
 static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
 static int  gld${EMULATION_NAME}_parse_args PARAMS((int, char **));
-static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static void gld${EMULATION_NAME}_finish PARAMS ((void));
 
 /* If true, then interworking stubs which support calls to old, non-interworking
    aware ARM code should be generated.  */
 
 static int support_old_code = 0;
+static char * thumb_entry_symbol = NULL;
 
 #define OPTION_SUPPORT_OLD_CODE		300
+#define OPTION_THUMB_ENTRY		301
 
 static struct option longopts[] =
 {
   {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
+  {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
   {NULL, no_argument, NULL, 0}
 };
 
@@ -63,6 +67,7 @@
      FILE * file;
 {
   fprintf (file, _("  --support-old-code   Support interworking with old code\n"));
+  fprintf (file, _("  --thumb-entry=<sym>  Set the entry point to be Thumb symbol <sym>\n"));
 }
 
 static int
@@ -97,6 +102,10 @@
     case OPTION_SUPPORT_OLD_CODE:
       support_old_code = 1;
       break;
+
+    case OPTION_THUMB_ENTRY:
+      thumb_entry_symbol = optarg;
+      break;
     }
   
   return 1;
@@ -139,11 +148,66 @@
 static void
 gld${EMULATION_NAME}_after_open ()
 {
-  LANG_FOR_EACH_INPUT_STATEMENT (is)
+  if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
     {
-      if (bfd_arm_get_bfd_for_interworking (is->the_bfd, & link_info))
-	break;
+      /* The arm backend needs special fields in the output hash structure.
+	 These will only be created if the output format is an arm format,
+	 hence we do not support linking and changing output formats at the
+	 same time.  Use a link followed by objcopy to change output formats.  */
+      einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+      return;
     }
+  
+  {
+    LANG_FOR_EACH_INPUT_STATEMENT (is)
+      {
+	if (bfd_arm_get_bfd_for_interworking (is->the_bfd, & link_info))
+	  break;
+      }
+  }
+}
+
+static void
+gld${EMULATION_NAME}_finish PARAMS((void))
+{
+  struct bfd_link_hash_entry * h;
+
+  if (thumb_entry_symbol == NULL)
+    return;
+  
+  h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, false, false, true);
+
+  if (h != (struct bfd_link_hash_entry *) NULL
+      && (h->type == bfd_link_hash_defined
+	  || h->type == bfd_link_hash_defweak)
+      && h->u.def.section->output_section != NULL)
+    {
+      static char buffer[32];
+      bfd_vma val;
+      
+      /* Special procesing is required for a Thumb entry symbol.  The
+	 bottom bit of its address must be set.  */
+      val = (h->u.def.value
+	     + bfd_get_section_vma (output_bfd,
+				    h->u.def.section->output_section)
+	     + h->u.def.section->output_offset);
+      
+      val |= 1;
+
+      /* Now convert this value into a string and store it in entry_symbol
+         where the lang_finish() function will pick it up.  */
+      buffer[0] = '0';
+      buffer[1] = 'x';
+      
+      sprintf_vma (buffer + 2, val);
+
+      if (entry_symbol != NULL && entry_from_cmdline)
+	einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+	       thumb_entry_symbol, entry_symbol);
+      entry_symbol = buffer;
+    }
+  else
+    einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
 }
 
 static char *
@@ -156,7 +220,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -214,13 +278,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL, /* finish */
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
+  gld${EMULATION_NAME}_finish,
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
   gld${EMULATION_NAME}_parse_args,
-  NULL, /* unrecognised file */
-  gld${EMULATION_NAME}_list_options
+  NULL,	/* unrecognised file */
+  gld${EMULATION_NAME}_list_options,
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index d9409f2..9abf7f1 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -1,10 +1,11 @@
 # This shell script emits a C file. -*- C -*-
 # It does some substitutions.
+ELFSIZE=32
 cat >e${EMULATION_NAME}.c <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* emulate the original gld for the given ${EMULATION_NAME}
-   Copyright (C) 1991, 93, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
 This file is part of GLD, the Gnu Linker.
@@ -27,6 +28,9 @@
 
 #include "bfd.h"
 #include "sysdep.h"
+
+#include <ctype.h>
+
 #include "bfdlink.h"
 #include "getopt.h"
 
@@ -38,10 +42,96 @@
 
 #include "ldexp.h"
 #include "ldlang.h"
+#include "ldgram.h"
 
+static boolean gld${EMULATION_NAME}_open_dynamic_archive
+  PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *));
+static void gld${EMULATION_NAME}_after_open PARAMS ((void));
+static void gld${EMULATION_NAME}_check_needed
+  PARAMS ((lang_input_statement_type *));
+static void gld${EMULATION_NAME}_stat_needed
+  PARAMS ((lang_input_statement_type *));
+static boolean gld${EMULATION_NAME}_search_needed
+  PARAMS ((const char *, const char *, int));
+static boolean gld${EMULATION_NAME}_try_needed PARAMS ((const char *, int));
+static void gld${EMULATION_NAME}_vercheck
+  PARAMS ((lang_input_statement_type *));
+static void gld${EMULATION_NAME}_find_statement_assignment
+  PARAMS ((lang_statement_union_type *));
+static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *));
+static boolean gld${EMULATION_NAME}_place_orphan
+  PARAMS ((lang_input_statement_type *, asection *));
+static void gld${EMULATION_NAME}_place_section
+  PARAMS ((lang_statement_union_type *));
 static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
 static void gld${EMULATION_NAME}_before_allocation PARAMS ((void));
 static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
+static int  gld${EMULATION_NAME}_parse_args PARAMS((int, char **));
+static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static void gld${EMULATION_NAME}_finish PARAMS ((void));
+
+
+static int no_pipeline_knowledge = 0;
+static char * thumb_entry_symbol = NULL;
+
+#define OPTION_THUMB_ENTRY		301
+
+static struct option longopts[] =
+{
+  { "no-pipeline-knowledge", no_argument, NULL, 'p'},
+  { "thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+  { NULL, no_argument, NULL, 0 }
+};
+
+static void
+gld${EMULATION_NAME}_list_options (file)
+     FILE * file;
+{
+  fprintf (file, _("  -p --no-pipeline-knowledge  Stop the linker knowing about the pipeline length\n"));
+  fprintf (file, _("     --thumb-entry=<sym>      Set the entry point to be Thumb symbol <sym>\n"));
+}
+
+static int
+gld${EMULATION_NAME}_parse_args (argc, argv)
+     int     argc;
+     char ** argv;
+{
+  int        longind;
+  int        optc;
+  int        prevoptind = optind;
+  int        prevopterr = opterr;
+  int        wanterror;
+  static int lastoptind = -1;
+
+  if (lastoptind != optind)
+    opterr = 0;
+  
+  wanterror  = opterr;
+  lastoptind = optind;
+
+  optc   = getopt_long_only (argc, argv, "-p", longopts, & longind);
+  opterr = prevopterr;
+
+  switch (optc)
+    {
+    default:
+      if (wanterror)
+	xexit (1);
+      optind =  prevoptind;
+      return 0;
+
+    case 'p':
+      no_pipeline_knowledge = 1;
+      break;
+
+    case OPTION_THUMB_ENTRY:
+      thumb_entry_symbol = optarg;
+      break;
+    }
+  
+  return 1;
+}
+
 
 static void
 gld${EMULATION_NAME}_before_parse ()
@@ -49,6 +139,934 @@
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("`echo ${ARCH}`");
 #endif /* not TARGET_ */
+  config.dynamic_link = ${DYNAMIC_LINK-true};
+  config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
+}
+
+/* Try to open a dynamic archive.  This is where we know that ELF
+   dynamic libraries have an extension of .so.  */
+
+static boolean
+gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
+     const char *arch;
+     search_dirs_type *search;
+     lang_input_statement_type *entry;
+{
+  const char *filename;
+  char *string;
+
+  if (! entry->is_archive)
+    return false;
+
+  filename = entry->filename;
+
+  string = (char *) xmalloc (strlen (search->name)
+			     + strlen (filename)
+			     + strlen (arch)
+			     + sizeof "/lib.so");
+
+  sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
+
+  if (! ldfile_try_open_bfd (string, entry))
+    {
+      free (string);
+      return false;
+    }
+
+  entry->filename = string;
+
+  /* We have found a dynamic object to include in the link.  The ELF
+     backend linker will create a DT_NEEDED entry in the .dynamic
+     section naming this file.  If this file includes a DT_SONAME
+     entry, it will be used.  Otherwise, the ELF linker will just use
+     the name of the file.  For an archive found by searching, like
+     this one, the DT_NEEDED entry should consist of just the name of
+     the file, without the path information used to find it.  Note
+     that we only need to do this if we have a dynamic object; an
+     archive will never be referenced by a DT_NEEDED entry.
+
+     FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
+     very pretty.  I haven't been able to think of anything that is
+     pretty, though.  */
+  if (bfd_check_format (entry->the_bfd, bfd_object)
+      && (entry->the_bfd->flags & DYNAMIC) != 0)
+    {
+      char *needed_name;
+
+      ASSERT (entry->is_archive && entry->search_dirs_flag);
+      needed_name = (char *) xmalloc (strlen (filename)
+				      + strlen (arch)
+				      + sizeof "lib.so");
+      sprintf (needed_name, "lib%s%s.so", filename, arch);
+      bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
+    }
+
+  return true;
+}
+
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+
+/* For a native linker, check the file /etc/ld.so.conf for directories
+   in which we may find shared libraries.  /etc/ld.so.conf is really
+   only meaningful on Linux, but we check it on other systems anyhow.  */
+
+static boolean gld${EMULATION_NAME}_check_ld_so_conf
+  PARAMS ((const char *, int));
+
+static boolean
+gld${EMULATION_NAME}_check_ld_so_conf (name, force)
+     const char *name;
+     int force;
+{
+  static boolean initialized;
+  static char *ld_so_conf;
+
+  if (! initialized)
+    {
+      FILE *f;
+
+      f = fopen ("/etc/ld.so.conf", FOPEN_RT);
+      if (f != NULL)
+	{
+	  char *b;
+	  size_t len, alloc;
+	  int c;
+
+	  len = 0;
+	  alloc = 100;
+	  b = (char *) xmalloc (alloc);
+
+	  while ((c = getc (f)) != EOF)
+	    {
+	      if (len + 1 >= alloc)
+		{
+		  alloc *= 2;
+		  b = (char *) xrealloc (b, alloc);
+		}
+	      if (c != ':'
+		  && c != ' '
+		  && c != '\t'
+		  && c != '\n'
+		  && c != ',')
+		{
+		  b[len] = c;
+		  ++len;
+		}
+	      else
+		{
+		  if (len > 0 && b[len - 1] != ':')
+		    {
+		      b[len] = ':';
+		      ++len;
+		    }
+		}
+	    }
+
+	  if (len > 0 && b[len - 1] == ':')
+	    --len;
+
+	  if (len > 0)
+	    b[len] = '\0';
+	  else
+	    {
+	      free (b);
+	      b = NULL;
+	    }
+
+	  fclose (f);
+
+	  ld_so_conf = b;
+	}
+
+      initialized = true;
+    }
+
+  if (ld_so_conf == NULL)
+    return false;
+
+  return gld${EMULATION_NAME}_search_needed (ld_so_conf, name, force);
+}
+
+EOF
+  ;;
+  esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+
+/* These variables are required to pass information back and forth
+   between after_open and check_needed and stat_needed and vercheck.  */
+
+static struct bfd_link_needed_list *global_needed;
+static struct stat global_stat;
+static boolean global_found;
+static struct bfd_link_needed_list *global_vercheck_needed;
+static boolean global_vercheck_failed;
+
+static void
+gld${EMULATION_NAME}_after_open ()
+{
+  struct bfd_link_needed_list *needed, *l;
+
+  if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+    {
+      /* The arm backend needs special fields in the output hash structure.
+	 These will only be created if the output format is an arm format,
+	 hence we do not support linking and changing output formats at the
+	 same time.  Use a link followed by objcopy to change output formats.  */
+      einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+      return;
+    }
+
+  {
+    LANG_FOR_EACH_INPUT_STATEMENT (is)
+      {
+	/* The interworking bfd must be the last one to be processed */
+	if (!is->next)
+	  bfd_elf32_arm_get_bfd_for_interworking (is->the_bfd, & link_info);
+      }
+  }
+
+  /* We only need to worry about this when doing a final link.  */
+  if (link_info.relocateable || link_info.shared)
+    return;
+
+  /* Get the list of files which appear in DT_NEEDED entries in
+     dynamic objects included in the link (often there will be none).
+     For each such file, we want to track down the corresponding
+     library, and include the symbol table in the link.  This is what
+     the runtime dynamic linker will do.  Tracking the files down here
+     permits one dynamic object to include another without requiring
+     special action by the person doing the link.  Note that the
+     needed list can actually grow while we are stepping through this
+     loop.  */
+  needed = bfd_elf_get_needed_list (output_bfd, &link_info);
+  for (l = needed; l != NULL; l = l->next)
+    {
+      struct bfd_link_needed_list *ll;
+      int force;
+
+      /* If we've already seen this file, skip it.  */
+      for (ll = needed; ll != l; ll = ll->next)
+	if (strcmp (ll->name, l->name) == 0)
+	  break;
+      if (ll != l)
+	continue;
+
+      /* See if this file was included in the link explicitly.  */
+      global_needed = l;
+      global_found = false;
+      lang_for_each_input_file (gld${EMULATION_NAME}_check_needed);
+      if (global_found)
+	continue;
+
+      /* We need to find this file and include the symbol table.  We
+	 want to search for the file in the same way that the dynamic
+	 linker will search.  That means that we want to use
+	 rpath_link, rpath, then the environment variable
+	 LD_LIBRARY_PATH (native only), then the linker script
+	 LIB_SEARCH_DIRS.  We do not search using the -L arguments.
+
+	 We search twice.  The first time, we skip objects which may
+	 introduce version mismatches.  The second time, we force
+	 their use.  See gld${EMULATION_NAME}_vercheck comment.  */
+      for (force = 0; force < 2; force++)
+	{
+	  const char *lib_path;
+	  size_t len;
+	  search_dirs_type *search;
+
+	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
+						  l->name, force))
+	    break;
+	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
+						  l->name, force))
+	    break;
+	  if (command_line.rpath_link == NULL
+	      && command_line.rpath == NULL)
+	    {
+	      lib_path = (const char *) getenv ("LD_RUN_PATH");
+	      if (gld${EMULATION_NAME}_search_needed (lib_path, l->name,
+						      force))
+		break;
+	    }
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+	  lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
+	  if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
+	    break;
+EOF
+  ;;
+  esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+	  len = strlen (l->name);
+	  for (search = search_head; search != NULL; search = search->next)
+	    {
+	      char *filename;
+
+	      if (search->cmdline)
+		continue;
+	      filename = (char *) xmalloc (strlen (search->name) + len + 2);
+	      sprintf (filename, "%s/%s", search->name, l->name);
+	      if (gld${EMULATION_NAME}_try_needed (filename, force))
+		break;
+	      free (filename);
+	    }
+	  if (search != NULL)
+	    break;
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+	    break;
+EOF
+  ;;
+  esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+	}
+
+      if (force < 2)
+	continue;
+
+      einfo ("%P: warning: %s, needed by %B, not found (try using --rpath)\n",
+	     l->name, l->by);
+    }
+}
+
+/* Search for a needed file in a path.  */
+
+static boolean
+gld${EMULATION_NAME}_search_needed (path, name, force)
+     const char *path;
+     const char *name;
+     int force;
+{
+  const char *s;
+  size_t len;
+
+  if (path == NULL || *path == '\0')
+    return false;
+  len = strlen (name);
+  while (1)
+    {
+      char *filename, *sset;
+
+      s = strchr (path, ':');
+      if (s == NULL)
+	s = path + strlen (path);
+
+      filename = (char *) xmalloc (s - path + len + 2);
+      if (s == path)
+	sset = filename;
+      else
+	{
+	  memcpy (filename, path, s - path);
+	  filename[s - path] = '/';
+	  sset = filename + (s - path) + 1;
+	}
+      strcpy (sset, name);
+
+      if (gld${EMULATION_NAME}_try_needed (filename, force))
+	return true;
+
+      free (filename);
+
+      if (*s == '\0')
+	break;
+      path = s + 1;
+    }
+
+  return false;	  
+}
+
+/* This function is called for each possible name for a dynamic object
+   named by a DT_NEEDED entry.  The FORCE parameter indicates whether
+   to skip the check for a conflicting version.  */
+
+static boolean
+gld${EMULATION_NAME}_try_needed (name, force)
+     const char *name;
+     int force;
+{
+  bfd *abfd;
+
+  abfd = bfd_openr (name, bfd_get_target (output_bfd));
+  if (abfd == NULL)
+    return false;
+  if (! bfd_check_format (abfd, bfd_object))
+    {
+      (void) bfd_close (abfd);
+      return false;
+    }
+  if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
+    {
+      (void) bfd_close (abfd);
+      return false;
+    }
+
+  /* Check whether this object would include any conflicting library
+     versions.  If FORCE is set, then we skip this check; we use this
+     the second time around, if we couldn't find any compatible
+     instance of the shared library.  */
+
+  if (! force)
+    {
+      struct bfd_link_needed_list *needed;
+
+      if (! bfd_elf_get_bfd_needed_list (abfd, &needed))
+	einfo ("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n", abfd);
+
+      if (needed != NULL)
+	{
+	  global_vercheck_needed = needed;
+	  global_vercheck_failed = false;
+	  lang_for_each_input_file (gld${EMULATION_NAME}_vercheck);
+	  if (global_vercheck_failed)
+	    {
+	      (void) bfd_close (abfd);
+	      /* Return false to force the caller to move on to try
+                 another file on the search path.  */
+	      return false;
+	    }
+
+	  /* But wait!  It gets much worse.  On Linux, if a shared
+             library does not use libc at all, we are supposed to skip
+             it the first time around in case we encounter a shared
+             library later on with the same name which does use the
+             version of libc that we want.  This is much too horrible
+             to use on any system other than Linux.  */
+
+EOF
+case ${target} in
+  *-*-linux-gnu*)
+    cat >>e${EMULATION_NAME}.c <<EOF
+	  {
+	    struct bfd_link_needed_list *l;
+
+	    for (l = needed; l != NULL; l = l->next)
+	      if (strncmp (l->name, "libc.so", 7) == 0)
+		break;
+	    if (l == NULL)
+	      {
+		(void) bfd_close (abfd);
+		return false;
+	      }
+	  }
+
+EOF
+    ;;
+esac
+cat >>e${EMULATION_NAME}.c <<EOF
+	}
+    }
+
+  /* We've found a dynamic object matching the DT_NEEDED entry.  */
+
+  /* We have already checked that there is no other input file of the
+     same name.  We must now check again that we are not including the
+     same file twice.  We need to do this because on many systems
+     libc.so is a symlink to, e.g., libc.so.1.  The SONAME entry will
+     reference libc.so.1.  If we have already included libc.so, we
+     don't want to include libc.so.1 if they are the same file, and we
+     can only check that using stat.  */
+
+  if (bfd_stat (abfd, &global_stat) != 0)
+    einfo ("%F%P:%B: bfd_stat failed: %E\n", abfd);
+  global_found = false;
+  lang_for_each_input_file (gld${EMULATION_NAME}_stat_needed);
+  if (global_found)
+    {
+      /* Return true to indicate that we found the file, even though
+         we aren't going to do anything with it.  */
+      return true;
+    }
+
+  /* Tell the ELF backend that don't want the output file to have a
+     DT_NEEDED entry for this file.  */
+  bfd_elf_set_dt_needed_name (abfd, "");
+
+  /* Add this file into the symbol table.  */
+  if (! bfd_link_add_symbols (abfd, &link_info))
+    einfo ("%F%B: could not read symbols: %E\n", abfd);
+
+  return true;
+}
+
+/* See if an input file matches a DT_NEEDED entry by name.  */
+
+static void
+gld${EMULATION_NAME}_check_needed (s)
+     lang_input_statement_type *s;
+{
+  if (global_found)
+    return;
+
+  if (s->filename != NULL
+      && strcmp (s->filename, global_needed->name) == 0)
+    {
+      global_found = true;
+      return;
+    }
+
+  if (s->the_bfd != NULL)
+    {
+      const char *soname;
+
+      soname = bfd_elf_get_dt_soname (s->the_bfd);
+      if (soname != NULL
+	  && strcmp (soname, global_needed->name) == 0)
+	{
+	  global_found = true;
+	  return;
+	}
+    }
+	  
+  if (s->search_dirs_flag
+      && s->filename != NULL
+      && strchr (global_needed->name, '/') == NULL)
+    {
+      const char *f;
+
+      f = strrchr (s->filename, '/');
+      if (f != NULL
+	  && strcmp (f + 1, global_needed->name) == 0)
+	{
+	  global_found = true;
+	  return;
+	}
+    }
+}
+
+/* See if an input file matches a DT_NEEDED entry by running stat on
+   the file.  */
+
+static void
+gld${EMULATION_NAME}_stat_needed (s)
+     lang_input_statement_type *s;
+{
+  struct stat st;
+  const char *suffix;
+  const char *soname;
+  const char *f;
+
+  if (global_found)
+    return;
+  if (s->the_bfd == NULL)
+    return;
+
+  if (bfd_stat (s->the_bfd, &st) != 0)
+    {
+      einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd);
+      return;
+    }
+
+  if (st.st_dev == global_stat.st_dev
+      && st.st_ino == global_stat.st_ino)
+    {
+      global_found = true;
+      return;
+    }
+
+  /* We issue a warning if it looks like we are including two
+     different versions of the same shared library.  For example,
+     there may be a problem if -lc picks up libc.so.6 but some other
+     shared library has a DT_NEEDED entry of libc.so.5.  This is a
+     hueristic test, and it will only work if the name looks like
+     NAME.so.VERSION.  FIXME: Depending on file names is error-prone.
+     If we really want to issue warnings about mixing version numbers
+     of shared libraries, we need to find a better way.  */
+
+  if (strchr (global_needed->name, '/') != NULL)
+    return;
+  suffix = strstr (global_needed->name, ".so.");
+  if (suffix == NULL)
+    return;
+  suffix += sizeof ".so." - 1;
+
+  soname = bfd_elf_get_dt_soname (s->the_bfd);
+  if (soname == NULL)
+    soname = s->filename;
+
+  f = strrchr (soname, '/');
+  if (f != NULL)
+    ++f;
+  else
+    f = soname;
+
+  if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0)
+    einfo ("%P: warning: %s, needed by %B, may conflict with %s\n",
+	   global_needed->name, global_needed->by, f);
+}
+
+/* On Linux, it's possible to have different versions of the same
+   shared library linked against different versions of libc.  The
+   dynamic linker somehow tags which libc version to use in
+   /etc/ld.so.cache, and, based on the libc that it sees in the
+   executable, chooses which version of the shared library to use.
+
+   We try to do a similar check here by checking whether this shared
+   library needs any other shared libraries which may conflict with
+   libraries we have already included in the link.  If it does, we
+   skip it, and try to find another shared library farther on down the
+   link path.
+
+   This is called via lang_for_each_input_file.
+   GLOBAL_VERCHECK_NEEDED is the list of objects needed by the object
+   which we ar checking.  This sets GLOBAL_VERCHECK_FAILED if we find
+   a conflicting version.  */
+
+static void
+gld${EMULATION_NAME}_vercheck (s)
+     lang_input_statement_type *s;
+{
+  const char *soname, *f;
+  struct bfd_link_needed_list *l;
+
+  if (global_vercheck_failed)
+    return;
+  if (s->the_bfd == NULL
+      || (bfd_get_file_flags (s->the_bfd) & DYNAMIC) == 0)
+    return;
+
+  soname = bfd_elf_get_dt_soname (s->the_bfd);
+  if (soname == NULL)
+    soname = bfd_get_filename (s->the_bfd);
+
+  f = strrchr (soname, '/');
+  if (f != NULL)
+    ++f;
+  else
+    f = soname;
+
+  for (l = global_vercheck_needed; l != NULL; l = l->next)
+    {
+      const char *suffix;
+
+      if (strcmp (f, l->name) == 0)
+	{
+	  /* Probably can't happen, but it's an easy check.  */
+	  continue;
+	}
+
+      if (strchr (l->name, '/') != NULL)
+	continue;
+
+      suffix = strstr (l->name, ".so.");
+      if (suffix == NULL)
+	continue;
+
+      suffix += sizeof ".so." - 1;
+
+      if (strncmp (f, l->name, suffix - l->name) == 0)
+	{
+	  /* Here we know that S is a dynamic object FOO.SO.VER1, and
+             the object we are considering needs a dynamic object
+             FOO.SO.VER2, and VER1 and VER2 are different.  This
+             appears to be a version mismatch, so we tell the caller
+             to try a different version of this library.  */
+	  global_vercheck_failed = true;
+	  return;
+	}
+    }
+}
+
+/* Place an orphan section.  We use this to put random SHF_ALLOC
+   sections in the right segment.  */
+
+static asection *hold_section;
+static lang_output_section_statement_type *hold_use;
+static lang_output_section_statement_type *hold_text;
+static lang_output_section_statement_type *hold_rodata;
+static lang_output_section_statement_type *hold_data;
+static lang_output_section_statement_type *hold_bss;
+static lang_output_section_statement_type *hold_rel;
+static lang_output_section_statement_type *hold_interp;
+
+/*ARGSUSED*/
+static boolean
+gld${EMULATION_NAME}_place_orphan (file, s)
+     lang_input_statement_type *file;
+     asection *s;
+{
+  lang_output_section_statement_type *place;
+  asection *snew, **pps;
+  lang_statement_list_type *old;
+  lang_statement_list_type add;
+  etree_type *address;
+  const char *secname, *ps;
+  const char *outsecname;
+  lang_output_section_statement_type *os;
+
+  if ((s->flags & SEC_ALLOC) == 0)
+    return false;
+
+  /* Look through the script to see where to place this section.  */
+  hold_section = s;
+  hold_use = NULL;
+  lang_for_each_statement (gld${EMULATION_NAME}_place_section);
+
+  if (hold_use != NULL)
+    {
+      /* We have already placed a section with this name.  */
+      wild_doit (&hold_use->children, s, hold_use, file);
+      return true;
+    }
+
+  secname = bfd_get_section_name (s->owner, s);
+
+  /* If this is a final link, then always put .gnu.warning.SYMBOL
+     sections into the .text section to get them out of the way.  */
+  if (! link_info.shared
+      && ! link_info.relocateable
+      && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
+      && hold_text != NULL)
+    {
+      wild_doit (&hold_text->children, s, hold_text, file);
+      return true;
+    }
+
+  /* Decide which segment the section should go in based on the
+     section name and section flags.  We put loadable .note sections
+     right after the .interp section, so that the PT_NOTE segment is
+     stored right after the program headers where the OS can read it
+     in the first page.  */
+  place = NULL;
+  if (s->flags & SEC_EXCLUDE)
+    return false;
+  else if ((s->flags & SEC_LOAD) != 0
+      && strncmp (secname, ".note", 4) == 0
+      && hold_interp != NULL)
+    place = hold_interp;
+  else if ((s->flags & SEC_HAS_CONTENTS) == 0
+	   && hold_bss != NULL)
+    place = hold_bss;
+  else if ((s->flags & SEC_READONLY) == 0
+	   && hold_data != NULL)
+    place = hold_data;
+  else if (strncmp (secname, ".rel", 4) == 0
+	   && hold_rel != NULL)
+    place = hold_rel;
+  else if ((s->flags & SEC_CODE) == 0
+	   && (s->flags & SEC_READONLY) != 0
+	   && hold_rodata != NULL)
+    place = hold_rodata;
+  else if ((s->flags & SEC_READONLY) != 0
+	   && hold_text != NULL)
+    place = hold_text;
+  if (place == NULL)
+    return false;
+
+  /* Choose a unique name for the section.  This will be needed if the
+     same section name appears in the input file with different
+     loadable or allocateable characteristics.  */
+  outsecname = secname;
+  if (bfd_get_section_by_name (output_bfd, outsecname) != NULL)
+    {
+      unsigned int len;
+      char *newname;
+      unsigned int i;
+
+      len = strlen (outsecname);
+      newname = xmalloc (len + 5);
+      strcpy (newname, outsecname);
+      i = 0;
+      do
+	{
+	  sprintf (newname + len, "%d", i);
+	  ++i;
+	}
+      while (bfd_get_section_by_name (output_bfd, newname) != NULL);
+
+      outsecname = newname;
+    }
+
+  /* Create the section in the output file, and put it in the right
+     place.  This shuffling is to make the output file look neater.  */
+  snew = bfd_make_section (output_bfd, outsecname);
+  if (snew == NULL)
+      einfo ("%P%F: output format %s cannot represent section called %s\n",
+	     output_bfd->xvec->name, outsecname);
+  if (place->bfd_section != NULL)
+    {
+      for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
+	;
+      *pps = snew->next;
+      snew->next = place->bfd_section->next;
+      place->bfd_section->next = snew;
+    }
+
+  /* Start building a list of statements for this section.  */
+  old = stat_ptr;
+  stat_ptr = &add;
+  lang_list_init (stat_ptr);
+
+  /* If the name of the section is representable in C, then create
+     symbols to mark the start and the end of the section.  */
+  for (ps = outsecname; *ps != '\0'; ps++)
+    if (! isalnum ((unsigned char) *ps) && *ps != '_')
+      break;
+  if (*ps == '\0' && config.build_constructors)
+    {
+      char *symname;
+
+      symname = (char *) xmalloc (ps - outsecname + sizeof "__start_");
+      sprintf (symname, "__start_%s", outsecname);
+      lang_add_assignment (exp_assop ('=', symname,
+				      exp_unop (ALIGN_K,
+						exp_intop ((bfd_vma) 1
+							   << s->alignment_power))));
+    }
+
+  if (! link_info.relocateable)
+    address = NULL;
+  else
+    address = exp_intop ((bfd_vma) 0);
+
+  lang_enter_output_section_statement (outsecname, address, 0,
+				       (bfd_vma) 0,
+				       (etree_type *) NULL,
+				       (etree_type *) NULL,
+				       (etree_type *) NULL);
+
+  os = lang_output_section_statement_lookup (outsecname);
+  wild_doit (&os->children, s, os, file);
+
+  lang_leave_output_section_statement
+    ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL,
+     "*default*");
+  stat_ptr = &add;
+
+  if (*ps == '\0' && config.build_constructors)
+    {
+      char *symname;
+
+      symname = (char *) xmalloc (ps - outsecname + sizeof "__stop_");
+      sprintf (symname, "__stop_%s", outsecname);
+      lang_add_assignment (exp_assop ('=', symname,
+				      exp_nameop (NAME, ".")));
+    }
+
+  /* Now stick the new statement list right after PLACE.  */
+  *add.tail = place->header.next;
+  place->header.next = add.head;
+
+  stat_ptr = old;
+
+  return true;
+}
+
+static void
+gld${EMULATION_NAME}_place_section (s)
+     lang_statement_union_type *s;
+{
+  lang_output_section_statement_type *os;
+
+  if (s->header.type != lang_output_section_statement_enum)
+    return;
+
+  os = &s->output_section_statement;
+
+  if (strcmp (os->name, hold_section->name) == 0
+      && os->bfd_section != NULL
+      && ((hold_section->flags & (SEC_LOAD | SEC_ALLOC))
+	  == (os->bfd_section->flags & (SEC_LOAD | SEC_ALLOC))))
+    hold_use = os;
+
+  if (strcmp (os->name, ".text") == 0)
+    hold_text = os;
+  else if (strcmp (os->name, ".rodata") == 0)
+    hold_rodata = os;
+  else if (strcmp (os->name, ".data") == 0)
+    hold_data = os;
+  else if (strcmp (os->name, ".bss") == 0)
+    hold_bss = os;
+  else if (hold_rel == NULL
+	   && os->bfd_section != NULL
+	   && (os->bfd_section->flags & SEC_ALLOC) != 0
+	   && strncmp (os->name, ".rel", 4) == 0)
+    hold_rel = os;
+  else if (strcmp (os->name, ".interp") == 0)
+    hold_interp = os;
+}
+
+/* Look through an expression for an assignment statement.  */
+
+static void
+gld${EMULATION_NAME}_find_exp_assignment (exp)
+     etree_type *exp;
+{
+  struct bfd_link_hash_entry *h;
+
+  switch (exp->type.node_class)
+    {
+    case etree_provide:
+      h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
+				false, false, false);
+      if (h == NULL)
+	break;
+
+      /* We call record_link_assignment even if the symbol is defined.
+	 This is because if it is defined by a dynamic object, we
+	 actually want to use the value defined by the linker script,
+	 not the value from the dynamic object (because we are setting
+	 symbols like etext).  If the symbol is defined by a regular
+	 object, then, as it happens, calling record_link_assignment
+	 will do no harm.  */
+
+      /* Fall through.  */
+    case etree_assign:
+      if (strcmp (exp->assign.dst, ".") != 0)
+	{
+	  if (! (bfd_elf${ELFSIZE}_record_link_assignment
+		 (output_bfd, &link_info, exp->assign.dst,
+		  exp->type.node_class == etree_provide ? true : false)))
+	    einfo ("%P%F: failed to record assignment to %s: %E\n",
+		   exp->assign.dst);
+	}
+      gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src);
+      break;
+
+    case etree_binary:
+      gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs);
+      gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs);
+      break;
+
+    case etree_trinary:
+      gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond);
+      gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs);
+      gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs);
+      break;
+
+    case etree_unary:
+      gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child);
+      break;
+
+    default:
+      break;
+    }
+}
+
+/* This is called by the before_allocation routine via
+   lang_for_each_statement.  It locates any assignment statements, and
+   tells the ELF backend about them, in case they are assignments to
+   symbols which are referred to by dynamic objects.  */
+
+static void
+gld${EMULATION_NAME}_find_statement_assignment (s)
+     lang_statement_union_type *s;
+{
+  if (s->header.type == lang_assignment_statement_enum)
+    gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp);
 }
 
 /* This is called after the sections have been attached to output
@@ -57,6 +1075,73 @@
 static void
 gld${EMULATION_NAME}_before_allocation ()
 {
+  const char *rpath;
+  asection *sinterp;
+
+  /* If we are going to make any variable assignments, we need to let
+     the ELF backend know about them in case the variables are
+     referred to by dynamic objects.  */
+  lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
+
+  /* Let the ELF backend work out the sizes of any sections required
+     by dynamic linking.  */
+  rpath = command_line.rpath;
+  if (rpath == NULL)
+    rpath = (const char *) getenv ("LD_RUN_PATH");
+  if (! (bfd_elf${ELFSIZE}_size_dynamic_sections
+         (output_bfd, command_line.soname, rpath,
+	  command_line.export_dynamic, command_line.filter_shlib,
+	  (const char * const *) command_line.auxiliary_filters,
+	  &link_info, &sinterp, lang_elf_version_info)))
+    einfo ("%P%F: failed to set dynamic section sizes: %E\n");
+
+  /* Let the user override the dynamic linker we are using.  */
+  if (command_line.interpreter != NULL
+      && sinterp != NULL)
+    {
+      sinterp->contents = (bfd_byte *) command_line.interpreter;
+      sinterp->_raw_size = strlen (command_line.interpreter) + 1;
+    }
+
+  /* Look for any sections named .gnu.warning.  As a GNU extensions,
+     we treat such sections as containing warning messages.  We print
+     out the warning message, and then zero out the section size so
+     that it does not get copied into the output file.  */
+
+  {
+    LANG_FOR_EACH_INPUT_STATEMENT (is)
+      {
+	asection *s;
+	bfd_size_type sz;
+	char *msg;
+	boolean ret;
+
+	if (is->just_syms_flag)
+	  continue;
+
+	s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
+	if (s == NULL)
+	  continue;
+
+	sz = bfd_section_size (is->the_bfd, s);
+	msg = xmalloc ((size_t) sz + 1);
+	if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz))
+	  einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n",
+		 is->the_bfd);
+	msg[sz] = '\0';
+	ret = link_info.callbacks->warning (&link_info, msg,
+					    (const char *) NULL,
+					    is->the_bfd, (asection *) NULL,
+					    (bfd_vma) 0);
+	ASSERT (ret);
+	free (msg);
+
+	/* Clobber the section size, so that we don't waste copying the
+	   warning into the output file.  */
+	s->_raw_size = 0;
+      }
+  }
+
   /* we should be able to set the size of the interworking stub section */
 
   /* Here we rummage through the found bfds to collect glue information */
@@ -64,7 +1149,8 @@
   {
     LANG_FOR_EACH_INPUT_STATEMENT (is)
       {
-	if (!bfd_elf32_arm_process_before_allocation (is->the_bfd, &link_info))
+	if (!bfd_elf32_arm_process_before_allocation (is->the_bfd, & link_info,
+						      no_pipeline_knowledge))
 	  {
 	    /* xgettext:c-format */
 	    einfo (_("Errors encountered processing file %s"), is->filename);
@@ -77,15 +1163,46 @@
 }
 
 static void
-gld${EMULATION_NAME}_after_open ()
+gld${EMULATION_NAME}_finish PARAMS((void))
 {
+  struct bfd_link_hash_entry * h;
 
-  LANG_FOR_EACH_INPUT_STATEMENT (is)
+  if (thumb_entry_symbol == NULL)
+    return;
+  
+  h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, false, false, true);
+
+  if (h != (struct bfd_link_hash_entry *) NULL
+      && (h->type == bfd_link_hash_defined
+	  || h->type == bfd_link_hash_defweak)
+      && h->u.def.section->output_section != NULL)
     {
-      /* The interworking bfd must be the last one to be processed */
-      if (!is->next)
-         bfd_elf32_arm_get_bfd_for_interworking (is->the_bfd, & link_info);
+      static char buffer[32];
+      bfd_vma val;
+      
+      /* Special procesing is required for a Thumb entry symbol.  The
+	 bottom bit of its address must be set.  */
+      val = (h->u.def.value
+	     + bfd_get_section_vma (output_bfd,
+				    h->u.def.section->output_section)
+	     + h->u.def.section->output_offset);
+      
+      val |= 1;
+
+      /* Now convert this value into a string and store it in entry_symbol
+         where the lang_finish() function will pick it up.  */
+      buffer[0] = '0';
+      buffer[1] = 'x';
+      
+      sprintf_vma (buffer + 2, val);
+
+      if (entry_symbol != NULL && entry_from_cmdline)
+	einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+	       thumb_entry_symbol, entry_symbol);
+      entry_symbol = buffer;
     }
+  else
+    einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
 }
 
 static char *
@@ -98,7 +1215,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -114,6 +1231,10 @@
 sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
 echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_SHLIB_SCRIPT" ; then
+        echo '  ; else if (link_info.shared) return'       >> e${EMULATION_NAME}.c
+        sed $sc ldscripts/${EMULATION_NAME}.xs             >> e${EMULATION_NAME}.c
+fi
 echo '  ; else return'                                     >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
 echo '; }'                                                 >> e${EMULATION_NAME}.c
@@ -133,6 +1254,8 @@
     return "ldscripts/${EMULATION_NAME}.xbn";
   else if (!config.magic_demand_paged)
     return "ldscripts/${EMULATION_NAME}.xn";
+  else if (link_info.shared)
+    return "ldscripts/${EMULATION_NAME}.xs";
   else
     return "ldscripts/${EMULATION_NAME}.x";
 }
@@ -156,13 +1279,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL, /* finish */
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL,
-  NULL, /* unrecognised file */
-  NULL
+  gld${EMULATION_NAME}_finish,
+  NULL,	/* create output section statements */
+  gld${EMULATION_NAME}_open_dynamic_archive,
+  gld${EMULATION_NAME}_place_orphan,
+  NULL,	/* set symbols */
+  gld${EMULATION_NAME}_parse_args,
+  NULL,	/* unrecognized file */
+  gld${EMULATION_NAME}_list_options,
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/armelf_oabi.em b/ld/emultempl/armelf_oabi.em
index c0526e5..d8ca87a 100644
--- a/ld/emultempl/armelf_oabi.em
+++ b/ld/emultempl/armelf_oabi.em
@@ -71,7 +71,7 @@
   {
     LANG_FOR_EACH_INPUT_STATEMENT (is)
       {
-	if (!bfd_elf32_arm_process_before_allocation (is->the_bfd, &link_info))
+	if (!bfd_elf32_arm_process_before_allocation (is->the_bfd, &link_info, 0))
 	  {
 	    /* xgettext:c-format */
 	    einfo (_("Errors encountered processing file %s"), is->filename);
@@ -105,7 +105,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -163,13 +163,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL, /* finish */
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL,
-  NULL, /* unrecognised file */
-  NULL
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/astring.sed b/ld/emultempl/astring.sed
new file mode 100644
index 0000000..08bd8a6
--- /dev/null
+++ b/ld/emultempl/astring.sed
@@ -0,0 +1,13 @@
+s/["\\]/\\&/g
+s/$/\\n\\/
+1 s/^/"/
+25s/\\$/"/
+26s/^/"/
+50s/\\$/"/
+51s/^/"/
+75s/\\$/"/
+76s/^/"/
+100s/\\$/"/
+101s/^/"/
+$ s/$/n"/
+$ s/\\n"n"$/\\n"/
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index c2b3ec2..2c14fbc 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -2,7 +2,7 @@
 # It does some substitutions.
 cat >e${EMULATION_NAME}.c <<EOF
 /* This file is part of GLD, the Gnu Linker.
-   Copyright 1995, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1995, 96, 97, 98, 1999 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
@@ -790,7 +790,7 @@
 EOF
 # Scripts compiled in.
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -832,6 +832,10 @@
   NULL, /* open dynamic archive */
   gld${EMULATION_NAME}_place_orphan,
   gld_${EMULATION_NAME}_set_symbols,
-  gld_${EMULATION_NAME}_parse_args
+  gld_${EMULATION_NAME}_parse_args,
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 0358676..2913ecf 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -7,7 +7,8 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
-   Copyright (C) 1991, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    ELF support by Ian Lance Taylor <ian@cygnus.com>
 
@@ -77,7 +78,8 @@
 }
 
 /* Try to open a dynamic archive.  This is where we know that ELF
-   dynamic libraries have an extension of .so.  */
+   dynamic libraries have an extension of .so (or .sl on oddball systems
+   like hpux).  */
 
 static boolean
 gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
@@ -93,13 +95,27 @@
 
   filename = entry->filename;
 
+  /* This allocates a few bytes too many when EXTRA_SHLIB_EXTENSION
+     is defined, but it does not seem worth the headache to optimize
+     away those two bytes of space.  */
   string = (char *) xmalloc (strlen (search->name)
 			     + strlen (filename)
 			     + strlen (arch)
+#ifdef EXTRA_SHLIB_EXTENSION
+			     + strlen (EXTRA_SHLIB_EXTENSION)
+#endif
 			     + sizeof "/lib.so");
 
   sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
 
+#ifdef EXTRA_SHLIB_EXTENSION
+  /* Try the .so extension first.  If that fails build a new filename
+     using EXTRA_SHLIB_EXTENSION.  */
+  if (! ldfile_try_open_bfd (string, entry))
+    sprintf (string, "%s/lib%s%s%s", search->name,
+	     filename, arch, EXTRA_SHLIB_EXTENSION);
+#endif
+
   if (! ldfile_try_open_bfd (string, entry))
     {
       free (string);
@@ -127,10 +143,16 @@
       char *needed_name;
 
       ASSERT (entry->is_archive && entry->search_dirs_flag);
-      needed_name = (char *) xmalloc (strlen (filename)
-				      + strlen (arch)
-				      + sizeof "lib.so");
-      sprintf (needed_name, "lib%s%s.so", filename, arch);
+
+      /* Rather than duplicating the logic above.  Just use the
+	 filename we recorded earlier.
+
+	 First strip off everything before the last '/'.  */
+      filename = strrchr (entry->filename, '/');
+      filename++;
+
+      needed_name = (char *) xmalloc (strlen (filename) + 1);
+      strcpy (needed_name, filename);
       bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
     }
 
@@ -139,7 +161,8 @@
 
 EOF
 if [ "x${host}" = "x${target}" ] ; then
-  if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
 
 /* For a native linker, check the file /etc/ld.so.conf for directories
@@ -224,7 +247,8 @@
 }
 
 EOF
-  fi
+  ;;
+  esac
 fi
 cat >>e${EMULATION_NAME}.c <<EOF
 
@@ -309,13 +333,15 @@
 	    }
 EOF
 if [ "x${host}" = "x${target}" ] ; then
-  if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
 	  lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
 	  if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
 	    break;
 EOF
-  fi
+  ;;
+  esac
 fi
 cat >>e${EMULATION_NAME}.c <<EOF
 	  len = strlen (l->name);
@@ -335,12 +361,14 @@
 	    break;
 EOF
 if [ "x${host}" = "x${target}" ] ; then
-  if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
 	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
 	    break;
 EOF
-  fi
+  ;;
+  esac
 fi
 cat >>e${EMULATION_NAME}.c <<EOF
 	}
@@ -996,7 +1024,8 @@
   wild_doit (&os->children, s, os, file);
 
   lang_leave_output_section_statement
-    ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL);
+    ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL,
+     "*default*");
   stat_ptr = &add;
 
   if (*ps == '\0' && config.build_constructors)
@@ -1062,38 +1091,31 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
 
 if test -n "$GENERATE_SHLIB_SCRIPT" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
-  else if (link_info.shared)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xs`;
-EOF
+echo '  ; else if (link_info.shared) return'		   >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xs                     >> e${EMULATION_NAME}.c
 fi
 
-cat >>e${EMULATION_NAME}.c <<EOF
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
-EOF
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -1119,6 +1141,22 @@
 
 fi
 
+if test -n "$PARSE_AND_LIST_ARGS" ; then
+cat >>e${EMULATION_NAME}.c <<EOF
+static int  gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
+static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE * file));
+
+ $PARSE_AND_LIST_ARGS
+EOF
+else
+
+cat >>e${EMULATION_NAME}.c <<EOF
+#define gld_${EMULATION_NAME}_parse_args   NULL
+#define gld_${EMULATION_NAME}_list_options NULL
+EOF
+
+fi
+
 cat >>e${EMULATION_NAME}.c <<EOF
 
 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = 
@@ -1135,9 +1173,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL,
-  NULL,
+  NULL, 	/* finish */
+  NULL, 	/* create output section statements */
   gld${EMULATION_NAME}_open_dynamic_archive,
-  gld${EMULATION_NAME}_place_orphan
+  gld${EMULATION_NAME}_place_orphan,
+  NULL,		/* set_symbols */
+  gld_${EMULATION_NAME}_parse_args,
+  NULL,		/* unrecognized_file */
+  gld_${EMULATION_NAME}_list_options,
+  NULL,		/* recognized_file */
+  NULL		/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index 1c0c8eb..6635e09 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -4,7 +4,7 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* emulate the original gld for the given ${EMULATION_NAME}
-   Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
 This file is part of GLD, the Gnu Linker.
@@ -56,7 +56,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -113,6 +113,16 @@
   before_allocation_default,
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}"
+  "${OUTPUT_FORMAT}",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index df998fb..ad8e5bf 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -1,7 +1,7 @@
 # This shell script emits a C file. -*- C -*-
 # It does some substitutions.
 cat >e${EMULATION_NAME}.c <<EOF
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 1999 Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
 
@@ -111,28 +111,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -171,6 +168,16 @@
   before_allocation_default,
   gld960_get_script,
   "960",
-  ""
+  "",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index 20cb5ed..c7f1624 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -1,7 +1,7 @@
 # This shell script emits a C file. -*- C -*-
 # It does some substitutions.
 cat >e${EMULATION_NAME}.c <<EOF
-/* Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
 
@@ -127,28 +127,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -187,6 +184,16 @@
   before_allocation_default,
   gld960_get_script,
   "960coff",
-  ""
+  "",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index c0ca113..fde4362 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -2,7 +2,7 @@
 # It does some substitutions.
 cat >e${EMULATION_NAME}.c <<EOF
 /* An emulation for HP PA-RISC ELF linkers.
-   Copyright (C) 1991, 93, 94, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
 This file is part of GLD, the Gnu Linker.
@@ -216,28 +216,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -279,5 +276,13 @@
   "elf32-hppa",
   hppaelf_finish,
   hppaelf_create_output_section_statements,
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index dc0855d..dfa855e 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -4,7 +4,7 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* Linux a.out emulation code for ${EMULATION_NAME}
-   Copyright (C) 1991, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    Linux support by Eric Youngdale <ericy@cais.cais.com>
 
@@ -140,28 +140,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -201,8 +198,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL,
+  NULL,	/* finish */
   gld${EMULATION_NAME}_create_output_section_statements,
-  gld${EMULATION_NAME}_open_dynamic_archive
+  gld${EMULATION_NAME}_open_dynamic_archive,
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index 066d46b..a4c3257 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -2,7 +2,7 @@
 # It does some substitutions.
 cat >e${EMULATION_NAME}.c <<EOF
 /* intel coff loader emulation specific stuff
-   Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
 This file is part of GLD, the Gnu Linker.
@@ -263,27 +263,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
+{			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -322,6 +320,16 @@
   lnk960_before_allocation,
   lnk960_get_script,
   "lnk960",
-  ""
+  "",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em
index d1200c4..4c932a1 100644
--- a/ld/emultempl/mipsecoff.em
+++ b/ld/emultempl/mipsecoff.em
@@ -4,7 +4,7 @@
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* Handle embedded relocs for MIPS.
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 95, 97, 1999 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em.
 
 This file is part of GLD, the Gnu Linker.
@@ -167,7 +167,7 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -224,6 +224,16 @@
   before_allocation_default,
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}"
+  "${OUTPUT_FORMAT}",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/stringify.sed b/ld/emultempl/ostring.sed
similarity index 100%
rename from ld/emultempl/stringify.sed
rename to ld/emultempl/ostring.sed
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 46ebbe9..d13bb40 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1,8 +1,10 @@
 # This shell script emits a C file. -*- C -*-
 # It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+rm -f e${EMULATION_NAME}.c
+(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
+cat >>e${EMULATION_NAME}.c <<EOF
 /* This file is part of GLD, the Gnu Linker.
-   Copyright 1995, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1995, 96, 97, 98, 99, 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
@@ -41,11 +43,58 @@
 #include "ldctor.h"
 #include "ldfile.h"
 #include "coff/internal.h"
+
+/* FIXME: This is a BFD internal header file, and we should not be
+   using it here.  */
 #include "../bfd/libcoff.h"
+
 #include "deffile.h"
+#include "pe-dll.h"
 
 #define TARGET_IS_${EMULATION_NAME}
 
+/* Permit the emulation parameters to override the default section
+   alignment by setting OVERRIDE_SECTION_ALIGNMENT.  FIXME: This makes
+   it seem that include/coff/internal.h should not define
+   PE_DEF_SECTION_ALIGNMENT.  */
+#if PE_DEF_SECTION_ALIGNMENT != ${OVERRIDE_SECTION_ALIGNMENT:-PE_DEF_SECTION_ALIGNMENT}
+#undef PE_DEF_SECTION_ALIGNMENT
+#define PE_DEF_SECTION_ALIGNMENT ${OVERRIDE_SECTION_ALIGNMENT}
+#endif
+
+#if defined(TARGET_IS_i386pe)
+#define DLL_SUPPORT
+#endif
+#if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe) || defined(TARGET_IS_armpe)
+#define DLL_SUPPORT
+#endif
+
+#if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT)
+#define	PE_DEF_SUBSYSTEM		3
+#else
+#undef NT_EXE_IMAGE_BASE
+#undef PE_DEF_SECTION_ALIGNMENT
+#undef PE_DEF_FILE_ALIGNMENT
+#define NT_EXE_IMAGE_BASE		0x00010000
+#ifdef TARGET_IS_armpe
+#define PE_DEF_SECTION_ALIGNMENT	0x00001000
+#define	PE_DEF_SUBSYSTEM		9
+#else
+#define PE_DEF_SECTION_ALIGNMENT	0x00000400
+#define	PE_DEF_SUBSYSTEM		2
+#endif
+#define PE_DEF_FILE_ALIGNMENT		0x00000200
+#endif
+
+#ifdef TARGET_IS_arm_epoc_pe
+#define bfd_arm_pe_allocate_interworking_sections \
+	bfd_arm_epoc_pe_allocate_interworking_sections
+#define bfd_arm_pe_get_bfd_for_interworking \
+	bfd_arm_epoc_pe_get_bfd_for_interworking
+#define bfd_arm_pe_process_before_allocation \
+	bfd_arm_epoc_pe_process_before_allocation
+#endif
+
 static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void));
 static void gld_${EMULATION_NAME}_after_open PARAMS ((void));
 static void gld_${EMULATION_NAME}_before_parse PARAMS ((void));
@@ -57,29 +106,37 @@
   PARAMS ((lang_statement_union_type *));
 static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *));
 static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
+static void gld_${EMULATION_NAME}_finish PARAMS ((void));
 
 static struct internal_extra_pe_aouthdr pe;
 static int dll;
 static int support_old_code = 0;
-extern def_file *pe_def_file;
+static char * thumb_entry_symbol = NULL;
 static lang_assignment_statement_type *image_base_statement = 0;
 
-static char *pe_out_def_filename = 0;
-extern int pe_dll_export_everything;
-extern int pe_dll_kill_ats;
-extern int pe_dll_stdcall_aliases;
 static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable */
+#ifdef DLL_SUPPORT
+static char *pe_out_def_filename = 0;
 static char *pe_implib_filename = 0;
+#endif
 
 extern const char *output_filename;
 
 static void
 gld_${EMULATION_NAME}_before_parse()
 {
-  output_filename = "a.exe";
+  output_filename = "${EXECUTABLE_NAME:-a.exe}";
   ldfile_output_architecture = bfd_arch_${ARCH};
-#ifdef TARGET_IS_i386pe
+#ifdef DLL_SUPPORT
   config.has_shared = 1;
+
+#if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
+#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
+  lang_add_entry ("WinMainCRTStartup", 1);
+#else
+  lang_add_entry ("_WinMainCRTStartup", 1);
+#endif
+#endif
 #endif
 }
 
@@ -109,6 +166,9 @@
 #define OPTION_ENABLE_STDCALL_FIXUP	(OPTION_STDCALL_ALIASES + 1)
 #define OPTION_DISABLE_STDCALL_FIXUP	(OPTION_ENABLE_STDCALL_FIXUP + 1)
 #define OPTION_IMPLIB_FILENAME		(OPTION_DISABLE_STDCALL_FIXUP + 1)
+#define OPTION_THUMB_ENTRY		(OPTION_IMPLIB_FILENAME + 1)
+#define OPTION_WARN_DUPLICATE_EXPORTS	(OPTION_THUMB_ENTRY + 1)
+#define OPTION_IMP_COMPAT		(OPTION_WARN_DUPLICATE_EXPORTS + 1)
 
 static struct option longopts[] =
 {
@@ -128,7 +188,8 @@
   {"stack", required_argument, NULL, OPTION_STACK},
   {"subsystem", required_argument, NULL, OPTION_SUBSYSTEM},
   {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
-#ifdef TARGET_IS_i386pe
+  {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+#ifdef DLL_SUPPORT
   /* getopt allows abbreviations, so we do this to stop it from treating -o
      as an abbreviation for this option */
   {"output-def", required_argument, NULL, OPTION_OUT_DEF},
@@ -140,6 +201,8 @@
   {"enable-stdcall-fixup", no_argument, NULL, OPTION_ENABLE_STDCALL_FIXUP},
   {"disable-stdcall-fixup", no_argument, NULL, OPTION_DISABLE_STDCALL_FIXUP},
   {"out-implib", required_argument, NULL, OPTION_IMPLIB_FILENAME},
+  {"warn-duplicate-exports", no_argument, NULL, OPTION_WARN_DUPLICATE_EXPORTS},
+  {"compat-implib", no_argument, NULL, OPTION_IMP_COMPAT},
 #endif
   {NULL, no_argument, NULL, 0}
 };
@@ -165,16 +228,20 @@
 #define IMAGEBASEOFF 0
   D(ImageBase,"__image_base__", NT_EXE_IMAGE_BASE),
 #define DLLOFF 1
-  {&dll, sizeof(dll), 0, "__dll__"},
+  {&dll, sizeof(dll), 0, "__dll__", 0},
   D(SectionAlignment,"__section_alignment__", PE_DEF_SECTION_ALIGNMENT),
   D(FileAlignment,"__file_alignment__", PE_DEF_FILE_ALIGNMENT),
   D(MajorOperatingSystemVersion,"__major_os_version__", 4),
   D(MinorOperatingSystemVersion,"__minor_os_version__", 0),
   D(MajorImageVersion,"__major_image_version__", 1),
   D(MinorImageVersion,"__minor_image_version__", 0),
+#ifdef TARGET_IS_armpe
+  D(MajorSubsystemVersion,"__major_subsystem_version__", 2),
+#else
   D(MajorSubsystemVersion,"__major_subsystem_version__", 4),
+#endif
   D(MinorSubsystemVersion,"__minor_subsystem_version__", 0),
-  D(Subsystem,"__subsystem__", 3),
+  D(Subsystem,"__subsystem__", ${SUBSYSTEM}),
   D(SizeOfStackReserve,"__size_of_stack_reserve__", 0x2000000),
   D(SizeOfStackCommit,"__size_of_stack_commit__", 0x1000),
   D(SizeOfHeapReserve,"__size_of_heap_reserve__", 0x100000),
@@ -202,7 +269,8 @@
   fprintf (file, _("  --stack <size>                     Set size of the initial stack\n"));
   fprintf (file, _("  --subsystem <name>[:<version>]     Set required OS subsystem [& version]\n"));
   fprintf (file, _("  --support-old-code                 Support interworking with old code\n"));
-#ifdef TARGET_IS_i386pe
+  fprintf (file, _("  --thumb-entry=<symbol>             Set the entry point to be Thumb <symbol>\n"));
+#ifdef DLL_SUPPORT
   fprintf (file, _("  --add-stdcall-alias                Export symbols with and without @nn\n"));
   fprintf (file, _("  --disable-stdcall-fixup            Don't link _sym to _sym@nn\n"));
   fprintf (file, _("  --enable-stdcall-fixup             Link _sym to _sym@nn without warnings\n"));
@@ -211,6 +279,9 @@
   fprintf (file, _("  --kill-at                          Remove @nn from exported symbols\n"));
   fprintf (file, _("  --out-implib <file>                Generate import library\n"));
   fprintf (file, _("  --output-def <file>                Generate a .DEF file for the built DLL\n"));
+  fprintf (file, _("  --warn-duplicate-exports           Warn about duplicate exports.\n"));
+  fprintf (file, _("  --compat-implib                    Create backward compatible import libs;\n"));
+  fprintf (file, _("                                       create __imp_<SYMBOL> as well.\n"));
 #endif
 }
 
@@ -248,14 +319,19 @@
     }
   v[] =
     {
-      { "native", 1, "_NtProcessStartup" },
-      { "windows", 2, "_WinMainCRTStartup" },
-      { "console", 3, "_mainCRTStartup" },
+      { "native", 1, "NtProcessStartup" },
+#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
+      { "windows", 2, "WinMainCRTStartup" },
+#else
+      { "windows", 2, "WinMainCRTStartup" },
+#endif
+      { "console", 3, "mainCRTStartup" },
 #if 0
       /* The Microsoft linker does not recognize this.  */
       { "os2", 5, "" },
 #endif
-      { "posix", 7, "___PosixProcessStartup"},
+      { "posix", 7, "__PosixProcessStartup"},
+      { "wince", 9, "_WinMainCRTStartup" },
       { 0, 0, 0 }
     };
 
@@ -281,9 +357,29 @@
       if (strncmp (optarg, v[i].name, len) == 0
 	  && v[i].name[len] == '\0')
 	{
+	  const char *initial_symbol_char;
+	  const char *entry;
+
 	  set_pe_name ("__subsystem__", v[i].value);
 
-	  lang_add_entry (v[i].entry, 1);
+	  initial_symbol_char = ${INITIAL_SYMBOL_CHAR};
+	  if (*initial_symbol_char == '\0')
+	    entry = v[i].entry;
+	  else
+	    {
+	      char *alc_entry;
+
+	      /* lang_add_entry expects its argument to be permanently
+		 allocated, so we don't free this string.  */
+	      alc_entry = xmalloc (strlen (initial_symbol_char)
+				   + strlen (v[i].entry)
+				   + 1);
+	      strcpy (alc_entry, initial_symbol_char);
+	      strcat (alc_entry, v[i].entry);
+	      entry = alc_entry;
+	    }
+
+	  lang_add_entry (entry, 1);
 
 	  return;
 	}
@@ -410,6 +506,10 @@
     case OPTION_SUPPORT_OLD_CODE:
       support_old_code = 1;
       break;
+    case OPTION_THUMB_ENTRY:
+      thumb_entry_symbol = optarg;
+      break;
+#ifdef DLL_SUPPORT
     case OPTION_OUT_DEF:
       pe_out_def_filename = xstrdup (optarg);
       break;
@@ -417,9 +517,7 @@
       pe_dll_export_everything = 1;
       break;
     case OPTION_EXCLUDE_SYMBOLS:
-#ifdef TARGET_IS_i386pe
       pe_dll_add_excludes (optarg);
-#endif
       break;
     case OPTION_KILL_ATS:
       pe_dll_kill_ats = 1;
@@ -436,6 +534,13 @@
     case OPTION_IMPLIB_FILENAME:
       pe_implib_filename = xstrdup (optarg);
       break;
+    case OPTION_WARN_DUPLICATE_EXPORTS:
+      pe_dll_warn_dup_exports = 1;
+      break;
+    case OPTION_IMP_COMPAT:
+      pe_dll_compat_implib = 1;
+      break;
+#endif
     }
   return 1;
 }
@@ -517,7 +622,7 @@
      opened, so registering the symbol as undefined will make a
      difference.  */
 
-  if (entry_symbol)
+  if (! link_info.relocateable && entry_symbol != NULL)
     ldlang_add_undef (entry_symbol);
 }
 
@@ -539,6 +644,7 @@
   return true;
 }
 
+#ifdef DLL_SUPPORT
 static void
 pe_fixup_stdcalls ()
 {
@@ -603,6 +709,7 @@
       }
     }
 }
+#endif /* DLL_SUPPORT */
 
 static void
 gld_${EMULATION_NAME}_after_open ()
@@ -617,25 +724,105 @@
   pe_data (output_bfd)->pe_opthdr = pe;
   pe_data (output_bfd)->dll = init[DLLOFF].value;
 
-#ifdef TARGET_IS_i386pe
+#ifdef DLL_SUPPORT
   if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */
     pe_fixup_stdcalls ();
 
   pe_process_import_defs(output_bfd, &link_info);
   if (link_info.shared)
     pe_dll_build_sections (output_bfd, &link_info);
+
+#ifndef TARGET_IS_i386pe
+#ifndef TARGET_IS_armpe
+  else
+    pe_exe_build_sections (output_bfd, &link_info);
+#endif
+#endif
 #endif
 
-#ifdef TARGET_IS_armpe
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+  if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+    {
+      /* The arm backend needs special fields in the output hash structure.
+	 These will only be created if the output format is an arm format,
+	 hence we do not support linking and changing output formats at the
+	 same time.  Use a link followed by objcopy to change output formats.  */
+      einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+      return;
+    }
   {
     /* Find a BFD that can hold the interworking stubs.  */
     LANG_FOR_EACH_INPUT_STATEMENT (is)
       {
-	if (bfd_arm_get_bfd_for_interworking (is->the_bfd, & link_info))
+	if (bfd_arm_pe_get_bfd_for_interworking (is->the_bfd, & link_info))
 	  break;
       }
   }
 #endif
+
+  {
+    int is_ms_arch = 0;
+    bfd *cur_arch = 0;
+    lang_input_statement_type *is2;
+
+    /* Careful - this is a shell script.  Watch those dollar signs! */
+    /* Microsoft import libraries have every member named the same,
+       and not in the right order for us to link them correctly.  We
+       must detect these and rename the members so that they'll link
+       correctly.  There are three types of objects: the head, the
+       thunks, and the sentinel(s).  The head is easy; it's the one
+       with idata2.  We assume that the sentinels won't have relocs,
+       and the thunks will.  It's easier than checking the symbol
+       table for external references.  */
+    LANG_FOR_EACH_INPUT_STATEMENT (is)
+      {
+	if (is->the_bfd->my_archive)
+	  {
+	    bfd *arch = is->the_bfd->my_archive;
+	    if (cur_arch != arch)
+	      {
+		cur_arch = arch;
+		is_ms_arch = 1;
+		for (is2 = is;
+		     is2 && is2->the_bfd->my_archive == arch;
+		     is2 = (lang_input_statement_type *)is2->next)
+		  {
+		    if (strcmp (is->the_bfd->filename, is2->the_bfd->filename))
+		      is_ms_arch = 0;
+		  }
+	      }
+
+	    if (is_ms_arch)
+	      {
+		int idata2 = 0, reloc_count=0;
+		asection *sec;
+		char *new_name, seq;
+
+		for (sec = is->the_bfd->sections; sec; sec = sec->next)
+		  {
+		    if (strcmp (sec->name, ".idata\$2") == 0)
+		      idata2 = 1;
+		    reloc_count += sec->reloc_count;
+		  }
+
+		if (idata2) /* .idata2 is the TOC */
+		  seq = 'a';
+		else if (reloc_count > 0) /* thunks */
+		  seq = 'b';
+		else /* sentinel */
+		  seq = 'c';
+
+		new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
+		sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
+		is->the_bfd->filename = new_name;
+
+		new_name = xmalloc (strlen(is->filename) + 3);
+		sprintf (new_name, "%s.%c", is->filename, seq);
+		is->filename = new_name;
+	      }
+	  }
+      }
+  }
 }
 
 static void  
@@ -658,7 +845,7 @@
   ppc_allocate_toc_section (&link_info);
 #endif /* TARGET_IS_ppcpe */
 
-#ifdef TARGET_IS_armpe
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
   /* FIXME: we should be able to set the size of the interworking stub
      section.
 
@@ -668,7 +855,7 @@
   {
     LANG_FOR_EACH_INPUT_STATEMENT (is)
       {
-	if (! bfd_arm_process_before_allocation
+	if (! bfd_arm_pe_process_before_allocation
 	    (is->the_bfd, & link_info, support_old_code))
 	  {
 	    /* xgettext:c-format */
@@ -679,14 +866,14 @@
   }
 
   /* We have seen it all. Allocate it, and carry on */
-  bfd_arm_allocate_interworking_sections (& link_info);
+  bfd_arm_pe_allocate_interworking_sections (& link_info);
 #endif /* TARGET_IS_armpe */
 }
 
 
 /* This is called when an input file isn't recognized as a BFD.  We
    check here for .DEF files and pull them in automatically. */
-
+#ifdef DLL_SUPPORT
 static int
 saw_option(char *option)
 {
@@ -696,12 +883,13 @@
       return init[i].inited;
   return 0;
 }
+#endif
 
 static boolean
 gld_${EMULATION_NAME}_unrecognized_file(entry)
-  lang_input_statement_type *entry;
+     lang_input_statement_type *entry ATTRIBUTE_UNUSED;
 {
-#ifdef TARGET_IS_i386pe
+#ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
 
   if (strcmp (ext, ".def") == 0 || strcmp (ext, ".DEF") == 0)
@@ -784,9 +972,21 @@
 
 static boolean
 gld_${EMULATION_NAME}_recognized_file(entry)
-  lang_input_statement_type *entry;
+  lang_input_statement_type *entry ATTRIBUTE_UNUSED;
 {
+#ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
+  pe_dll_id_target ("pei-i386");
+#endif
+#ifdef TARGET_IS_shpe
+  pe_dll_id_target ("pei-shl");
+#endif
+#ifdef TARGET_IS_mipspe
+  pe_dll_id_target ("pei-mips");
+#endif
+#ifdef TARGET_IS_armpe
+  pe_dll_id_target ("pei-arm-little");
+#endif
   if (bfd_get_format (entry->the_bfd) == bfd_object)
     {
       const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -800,13 +1000,61 @@
 static void
 gld_${EMULATION_NAME}_finish ()
 {
-#ifdef TARGET_IS_i386pe
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+  struct bfd_link_hash_entry * h;
+
+  if (thumb_entry_symbol != NULL)
+    {
+      h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, false, false, true);
+      
+      if (h != (struct bfd_link_hash_entry *) NULL
+	  && (h->type == bfd_link_hash_defined
+	      || h->type == bfd_link_hash_defweak)
+	  && h->u.def.section->output_section != NULL)
+	{
+	  static char buffer[32];
+	  bfd_vma val;
+	  
+	  /* Special procesing is required for a Thumb entry symbol.  The
+	     bottom bit of its address must be set.  */
+	  val = (h->u.def.value
+		 + bfd_get_section_vma (output_bfd,
+					h->u.def.section->output_section)
+		 + h->u.def.section->output_offset);
+	  
+	  val |= 1;
+	  
+	  /* Now convert this value into a string and store it in entry_symbol
+	     where the lang_finish() function will pick it up.  */
+	  buffer[0] = '0';
+	  buffer[1] = 'x';
+	  
+	  sprintf_vma (buffer + 2, val);
+	  
+	  if (entry_symbol != NULL && entry_from_cmdline)
+	    einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+		   thumb_entry_symbol, entry_symbol);
+	  entry_symbol = buffer;
+	}
+      else
+	einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
+    }
+#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
+
+#ifdef DLL_SUPPORT
   if (link_info.shared)
     {
       pe_dll_fill_sections (output_bfd, &link_info);
       if (pe_implib_filename)
 	pe_dll_generate_implib (pe_def_file, pe_implib_filename);
     }
+#if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe)
+  else
+    {
+      pe_exe_fill_sections (output_bfd, &link_info);
+    }
+#endif
+  
   if (pe_out_def_filename)
     pe_dll_generate_def_file (pe_out_def_filename);
 #endif
@@ -844,7 +1092,7 @@
      asection *s;
 {
   const char *secname;
-  char *dollar;
+  char *dollar = NULL;
 
   if ((s->flags & SEC_ALLOC) == 0)
     return false;
@@ -856,9 +1104,12 @@
   hold_section = s;
 
   hold_section_name = xstrdup (secname);
-  dollar = strchr (hold_section_name, '$');
-  if (dollar != NULL)
-    *dollar = '\0';
+  if (!link_info.relocateable)
+    {
+      dollar = strchr (hold_section_name, '$');
+      if (dollar != NULL)
+	*dollar = '\0';
+    }
 
   hold_use = NULL;
   lang_for_each_statement (gld${EMULATION_NAME}_place_section);
@@ -958,7 +1209,8 @@
 
       lang_leave_output_section_statement
 	((bfd_vma) 0, "*default*",
-	 (struct lang_output_section_phdr_list *) NULL);
+	 (struct lang_output_section_phdr_list *) NULL,
+	"*default*");
 
       /* Now stick the new statement list right after PLACE.  */
       if (place != NULL)
@@ -1047,6 +1299,14 @@
   else if (strcmp (os->name, ".bss") == 0)
     hold_bss = os;
 }
+
+static int
+gld_${EMULATION_NAME}_find_potential_libraries (name, entry)
+     char * name;
+     lang_input_statement_type * entry;
+{
+  return ldfile_open_file_search (name, entry, "", ".lib");
+}
 
 static char *
 gld_${EMULATION_NAME}_get_script(isfile)
@@ -1054,7 +1314,7 @@
 EOF
 # Scripts compiled in.
 # sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
@@ -1099,6 +1359,7 @@
   gld_${EMULATION_NAME}_parse_args,
   gld_${EMULATION_NAME}_unrecognized_file,
   gld_${EMULATION_NAME}_list_options,
-  gld_${EMULATION_NAME}_recognized_file
+  gld_${EMULATION_NAME}_recognized_file,
+  gld_${EMULATION_NAME}_find_potential_libraries
 };
 EOF
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 8e9599c..a571b6b 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -100,7 +100,8 @@
 {
 EOF
 if [ "x${host}" = "x${target}" ] ; then
-  if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
   const char *env;
 
@@ -125,7 +126,8 @@
 	}
     }
 EOF
-  fi
+  ;;
+  esac
 fi
 cat >>e${EMULATION_NAME}.c <<EOF
 }
@@ -464,7 +466,8 @@
 	}
 EOF
 if [ "x${host}" = "x${target}" ] ; then
-  if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
       {
 	const char *lib_path;
@@ -474,7 +477,8 @@
 	  continue;
       }
 EOF
-  fi
+  ;;
+  esac
 fi
 cat >>e${EMULATION_NAME}.c <<EOF
       if (command_line.rpath != NULL)
@@ -967,28 +971,25 @@
 # Scripts compiled in.
 
 # sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
 
 cat >>e${EMULATION_NAME}.c <<EOF
 {			     
   *isfile = 0;
 
   if (link_info.relocateable == true && config.build_constructors == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
-  else if (link_info.relocateable == true)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
-  else if (!config.text_read_only)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
-  else if (!config.magic_demand_paged)
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
-  else
-    return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+    return
 EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
+echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
+echo '  ; else return'                                     >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
+echo '; }'                                                 >> e${EMULATION_NAME}.c
 
 else
 # Scripts read from the filesystem.
@@ -1028,10 +1029,15 @@
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  NULL, /* finish */
+  NULL,	/* finish */
   gld${EMULATION_NAME}_create_output_section_statements,
-  NULL, /* open_dynamic_library */
-  NULL, /* place_orphan */
-  gld${EMULATION_NAME}_set_symbols
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  gld${EMULATION_NAME}_set_symbols,
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
index 04e36fb..0a74abd 100644
--- a/ld/emultempl/vanilla.em
+++ b/ld/emultempl/vanilla.em
@@ -64,6 +64,16 @@
   before_allocation_default,
   vanilla_get_script,
   "vanilla",
-  "a.out-sunos-big"
+  "a.out-sunos-big",
+  NULL,	/* finish */
+  NULL,	/* create output section statements */
+  NULL,	/* open dynamic archive */
+  NULL,	/* place orphan */
+  NULL,	/* set symbols */
+  NULL,	/* parse args */
+  NULL,	/* unrecognized file */
+  NULL,	/* list options */
+  NULL,	/* recognized file */
+  NULL 	/* find_potential_libraries */
 };
 EOF
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index eea5401..8294af7 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -14,7 +14,7 @@
 host=$3
 target=$4
 target_alias=$5
-DEFAULT_EMULATION=$6
+EMULATION_LIBPATH=$6
 NATIVE_LIB_DIRS=$7
 EMULATION_NAME=$8
 tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib
@@ -36,26 +36,24 @@
 # To force a logically empty LIB_PATH, do LIBPATH=":".
 
 if [ "x${LIB_PATH}" = "x" ] ; then
+  # Cross, or native non-default emulation not requesting LIB_PATH.
+  LIB_PATH=
+
   if [ "x${host}" = "x${target}" ] ; then
-    if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
-      # Native.
-      LIB_PATH=/lib:/usr/lib
-      if [ -n "${NATIVE_LIB_DIRS}" ]; then
-	LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
-      fi
-      if [ "${libdir}" != /usr/lib ]; then
-	LIB_PATH=${LIB_PATH}:${libdir}
-      fi
-      if [ "${libdir}" != /usr/local/lib ] ; then
-	LIB_PATH=${LIB_PATH}:/usr/local/lib
-      fi
-    else
-      # Native, but not default emulation.
-      LIB_PATH=
-    fi
-  else
-    # Cross.
-    LIB_PATH=
+    case " $EMULATION_LIBPATH " in
+      *" ${EMULATION_NAME} "*)
+        # Native, and default or emulation requesting LIB_PATH.
+        LIB_PATH=/lib:/usr/lib
+        if [ -n "${NATIVE_LIB_DIRS}" ]; then
+	  LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
+        fi
+        if [ "${libdir}" != /usr/lib ]; then
+	  LIB_PATH=${LIB_PATH}:${libdir}
+        fi
+        if [ "${libdir}" != /usr/local/lib ] ; then
+	  LIB_PATH=${LIB_PATH}:/usr/local/lib
+        fi
+    esac
   fi
 fi
 
@@ -127,7 +125,9 @@
     ldscripts/${EMULATION_NAME}.xs
 fi
 
-test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true
+for i in $EMULATION_LIBPATH ; do
+  test "$i" = "$EMULATION_NAME" && COMPILE_IN=true
+done
 
 # Generate e${EMULATION_NAME}.c.
 . ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em
diff --git a/ld/ld.h b/ld/ld.h
index bca7462..3c53b98 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -1,5 +1,5 @@
 /* ld.h -- general linker header file
-   Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GLD, the Gnu Linker.
@@ -56,13 +56,20 @@
    discarded.  */
 #define DISCARD_SECTION_NAME "/DISCARD/"
 
+/* A file name list */
+typedef struct name_list
+{
+   const char *name;
+   struct name_list *next;
+} name_list;
+
 /* A wildcard specification.  This is only used in ldgram.y, but it
    winds up in ldgram.h, so we need to define it outside.  */
 
 struct wildcard_spec
 {
   const char *name;
-  const char *exclude_name;
+  struct name_list *exclude_name_list;
   boolean sorted;
 };
 
@@ -223,4 +230,15 @@
 extern void output_cref PARAMS ((FILE *));
 extern void check_nocrossrefs PARAMS ((void));
 
+extern void ld_abort PARAMS ((const char *, int, const char *))
+     ATTRIBUTE_NORETURN;
+
+/* If gcc, we can give a function name, too.  */
+#if !defined (__GNUC__) || __GNUC_MINOR__ <= 5
+#define __PRETTY_FUNCTION__  ((char*) NULL)
+#endif
+
+#undef abort
+#define abort() ld_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
 #endif
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 027f196..6662ca3 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -18,7 +18,7 @@
 @ifinfo
 This file documents the @sc{gnu} linker LD version @value{VERSION}.
 
-Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 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
@@ -179,18 +179,21 @@
 the library @code{libc.a}, which will come from the standard search
 directories.  (See the discussion of the @samp{-l} option below.)
 
-The command-line options to @code{ld} may be specified in any order, and
-may be repeated at will.  Repeating most options with a different
-argument will either have no further effect, or override prior
+Some of the command-line options to @code{ld} may be specified at any
+point in the command line.  However, options which refer to files, such
+as @samp{-l} or @samp{-T}, cause the file to be read at the point at
+which the option appears in the command line, relative to the object
+files and other file options.  Repeating non-file options with a
+different argument will either have no further effect, or override prior
 occurrences (those further to the left on the command line) of that
 option.  Options which may be meaningfully specified more than once are
 noted in the descriptions below.
 
 @cindex object files
-Non-option arguments are objects files which are to be linked together.
-They may follow, precede, or be mixed in with command-line options,
-except that an object file argument may not be placed between an option
-and its argument.
+Non-option arguments are object files or archives which are to be linked
+together.  They may follow, precede, or be mixed in with command-line
+options, except that an object file argument may not be placed between
+an option and its argument.
 
 Usually the linker is invoked with at least one object file, but you can
 specify other forms of binary input files using @samp{-l}, @samp{-R},
@@ -225,6 +228,21 @@
 @samp{--oformat=srec} are equivalent.  Unique abbreviations of the names
 of multiple-letter options are accepted.
 
+Note - if the linker is being invoked indirectly, via a compiler driver
+(eg @samp{gcc}) then all the linker command line options should be
+prefixed by @samp{-Wl,} (or whatever is appropriate for the particular
+compiler driver) like this:
+
+@smallexample
+  gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup
+@end smallexample
+
+This is important, because otherwise the compiler driver program may
+silently drop the linker options, resulting in a bad link.
+
+Here is a table of the generic command line switches accepted by the GNU
+linker:
+
 @table @code
 @kindex -a@var{keyword}
 @item -a@var{keyword}
@@ -401,6 +419,14 @@
 environment variable.  The @sc{gnu} linker will ignore the @code{-F}
 option when not creating an ELF shared object.
 
+@cindex finalization function
+@kindex -fini
+@item -fini @var{name}
+When creating an ELF executable or shared object, call NAME when the
+executable or shared object is unloaded, by setting DT_FINI to the
+address of the function.  By default, the linker uses @code{_fini} as
+the function to call.
+
 @kindex -g
 @item -g
 Ignored.  Provided for compatibility with other tools.
@@ -431,6 +457,14 @@
 @item -i
 Perform an incremental link (same as option @samp{-r}).
 
+@cindex initialization function
+@kindex -init
+@item -init @var{name}
+When creating an ELF executable or shared object, call NAME when the
+executable or shared object is loaded, by setting DT_INIT to the address
+of the function.  By default, the linker uses @code{_init} as the
+function to call.
+
 @cindex archive files, from cmd line
 @kindex -l@var{archive}
 @kindex --library=@var{archive}
@@ -525,8 +559,8 @@
 @kindex --nmagic
 @item -n
 @itemx --nmagic
-Set the text segment to be read only, and mark the output as
-@code{NMAGIC} if possible.
+Turn off page alignment of sections, and mark the output as
+@code{NMAGIC} if possible. 
 
 @kindex -N
 @kindex --omagic
@@ -754,7 +788,7 @@
 @kindex --check-sections
 @kindex --no-check-sections
 @item --check-sections
-@item --no-check-sections
+@itemx --no-check-sections
 Asks the linker @emph{not} to check section addresses after they have
 been assigned to see if there any overlaps.  Normally the linker will
 perform this check, and if it finds any overlaps it will produce
@@ -1115,7 +1149,7 @@
 @kindex --verbose
 @cindex verbose
 @item --dll-verbose
-@item --verbose
+@itemx --verbose
 Display the version number for @code{ld} and list the linker emulations
 supported.  Display which input files can and cannot be opened.  Display
 the linker script if using a default builtin script.
@@ -1363,7 +1397,7 @@
 exported.
 
 @kindex --exclude-symbols
-@item --exclude-symbols @var{symbol,symbol,...}
+@item --exclude-symbols @var{symbol},@var{symbol},...
 Specifies a list of symbols which should not be automatically
 exported.  The symbol names may be delimited by commas or colons.
 
@@ -2093,7 +2127,7 @@
     @var{output-section-command}
     @var{output-section-command}
     @dots{}
-  @} [>@var{region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
+  @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
 @end group
 @end smallexample
 
@@ -2216,13 +2250,15 @@
 *(.text)
 @end smallexample
 @noindent
-Here the @samp{*} is a wildcard which matches any file name.  To exclude a file
-from matching the file name wildcard, EXCLUDE_FILE may be used to match all files
-except the one specified by EXCLUDE_FILE.  For example:
+Here the @samp{*} is a wildcard which matches any file name.  To exclude a list
+of files from matching the file name wildcard, EXCLUDE_FILE may be used to
+match all files except the ones specified in the EXCLUDE_FILE list.  For
+example:
 @smallexample
-(*(EXCLUDE_FILE (*crtend.o) .ctors))
+(*(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors))
 @end smallexample
-will cause all .ctors sections from all files except crtend.o to be included.
+will cause all .ctors sections from all files except @file{crtend.o} and
+@file{otherfile.o} to be included.
 
 There are two ways to include more than one section:
 @smallexample
@@ -2596,7 +2632,7 @@
     @var{output-section-command}
     @var{output-section-command}
     @dots{}
-  @} [>@var{region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
+  @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
 @end group
 @end smallexample
 We've already described @var{section}, @var{address}, and
@@ -2650,6 +2686,7 @@
 
 @node Output Section LMA
 @subsubsection Output section LMA
+@kindex AT>@var{lma_region}
 @kindex AT(@var{lma})
 @cindex load address
 @cindex section load address
@@ -2660,7 +2697,9 @@
 
 The linker will normally set the LMA equal to the VMA.  You can change
 that by using the @code{AT} keyword.  The expression @var{lma} that
-follows the @code{AT} keyword specifies the load address of the section.
+follows the @code{AT} keyword specifies the load address of the
+section.  Alternatively, with @samp{AT>@var{lma_region}} expression,
+you may specify a memory region for the section's load address. @xref{MEMORY}.
 
 @cindex ROM initialized data
 @cindex initialized data in ROM
@@ -3407,6 +3446,39 @@
 @samp{.text} section from @file{file3}.  The notation @samp{= 0x1234}
 specifies what data to write in the gaps (@pxref{Output Section Fill}).
 
+@cindex dot inside sections
+Note: @code{.} actually refers to the byte offset from the start of the
+current containing object.  Normally this is the @code{SECTIONS}
+statement, whoes start address is 0, hence @code{.} can be used as an
+absolute address.  If @code{.} is used inside a section description
+however, it refers to the byte offset from the start of that section,
+not an absolute address.  Thus in a script like this:
+
+@smallexample
+SECTIONS
+@{
+    . = 0x100
+    .text: @{
+      *(.text)
+      . = 0x200
+    @}
+    . = 0x500
+    .data: @{
+      *(.data)
+      . += 0x600
+    @}
+@}
+@end smallexample
+
+The @samp{.text} section will be assigned a starting address of 0x100
+and a size of exactly 0x200 bytes, even if there is not enough data in
+the @samp{.text} input sections to fill this area.  (If there is too
+much data, an error will be produced because this would be an attempt to
+move @code{.} backwards).  The @samp{.data} section will start at 0x500
+and it will have an extra 0x600 bytes worth of space after the end of
+the values from the @samp{.data} input sections and before the end of
+the @samp{.data} output section itself.
+
 @need 2000
 @node Operators
 @subsection Operators
@@ -3876,7 +3948,7 @@
 @section @code{ld}'s support for interworking between ARM and Thumb code
 
 @cindex ARM interworking support
-@cindex --support-old-code
+@kindex --support-old-code
 For the ARM, @code{ld} will generate code stubs to allow functions calls
 betweem ARM and Thumb code.  These stubs only work with code that has
 been compiled and assembled with the @samp{-mthumb-interwork} command
@@ -3888,6 +3960,15 @@
 the linker does not support generating stubs for function calls to
 non-interworking aware Thumb code.
 
+@cindex thumb entry point
+@cindex entry point, thumb
+@kindex --thumb-entry=@var{entry}
+The @samp{--thumb-entry} switch is a duplicate of the generic
+@samp{--entry} switch, in that it sets the program's starting address.  
+But it also sets the bottom bit of the address, so that it can be
+branched to using a BX instruction, and the program will start
+executing in Thumb mode straight away.
+
 @ifclear GENERIC
 @lowersections
 @end ifclear
diff --git a/ld/ldcref.c b/ld/ldcref.c
index 96e0d2d..e208106 100644
--- a/ld/ldcref.c
+++ b/ld/ldcref.c
@@ -1,5 +1,5 @@
 /* ldcref.c -- output a cross reference table
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 97, 98, 99, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>
 
 This file is part of GLD, the Gnu Linker.
@@ -151,7 +151,7 @@
      const char *name;
      bfd *abfd;
      asection *section;
-     bfd_vma value;
+     bfd_vma value ATTRIBUTE_UNUSED;
 {
   struct cref_hash_entry *h;
   struct cref_ref *r;
@@ -238,7 +238,7 @@
 
   fprintf (fp, _("\nCross Reference Table\n\n"));
   msg = _("Symbol");
-  fprintf (fp, msg);
+  fprintf (fp, "%s", msg);
   len = strlen (msg);
   while (len < FILECOL)
     {
@@ -354,7 +354,7 @@
 static boolean
 check_nocrossref (h, ignore)
      struct cref_hash_entry *h;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   struct bfd_link_hash_entry *hl;
   asection *defsec;
diff --git a/ld/ldemul.c b/ld/ldemul.c
index eab0432..08a4e47 100644
--- a/ld/ldemul.c
+++ b/ld/ldemul.c
@@ -1,5 +1,6 @@
 /* ldemul.c -- clearing house for ld emulation states
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
 
@@ -218,7 +219,7 @@
 /*ARGSUSED*/
 void
 syslib_default(ignore)
-     char  *ignore;
+     char  *ignore ATTRIBUTE_UNUSED;
 {
   info_msg (_("%S SYSLIB ignored\n"));
 }
@@ -226,7 +227,7 @@
 /*ARGSUSED*/
 void
 hll_default(ignore)
-     char  *ignore;
+     char  *ignore ATTRIBUTE_UNUSED;
 {
   info_msg (_("%S HLL ignored\n"));
 }
@@ -296,3 +297,14 @@
   if (! options_found)
     fprintf (f, _("  no emulation specific options.\n"));
 }
+
+int
+ldemul_find_potential_libraries (name, entry)
+     char * name;
+     lang_input_statement_type * entry;
+{
+  if (ld_emulation->find_potential_libraries)
+    return ld_emulation->find_potential_libraries (name, entry);
+
+  return 0;
+}
diff --git a/ld/ldemul.h b/ld/ldemul.h
index 350de06..b2d9103 100644
--- a/ld/ldemul.h
+++ b/ld/ldemul.h
@@ -1,5 +1,5 @@
 /* ld-emul.h - Linker emulation header file
-   Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GLD, the Gnu Linker.
 
@@ -55,6 +55,8 @@
 extern void set_output_arch_default PARAMS ((void));
 extern void syslib_default PARAMS ((char*));
 extern void hll_default PARAMS ((char*));
+extern int  ldemul_find_potential_libraries
+  PARAMS ((char *, struct lang_input_statement_struct *));
 
 typedef struct ld_emulation_xfer_struct
 {
@@ -135,6 +137,13 @@
   boolean (*recognized_file)
     PARAMS ((struct lang_input_statement_struct *));
 
+  /* Called when looking for libraries in a directory specified
+     via a linker command line option or linker script option.
+     Files that match the pattern "lib*.a" have already been scanned.
+     (For VMS files matching ":lib*.a" have also been scanned).  */
+  int (* find_potential_libraries)
+    PARAMS ((char *, struct lang_input_statement_struct *));
+  
 } ld_emulation_xfer_type;
 
 typedef enum 
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 6c9d726..0c38314 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1,6 +1,7 @@
 /* This module handles expression trees.
-Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
-Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com).
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
+   Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com).
 
 This file is part of GLD, the Gnu Linker.
 
@@ -455,11 +456,12 @@
       case SIZEOF:
 	if (allocation_done != lang_first_phase_enum)
 	  {
+            int opb = bfd_octets_per_byte (output_bfd);
 	    lang_output_section_statement_type *os;
 
 	    os = lang_output_section_find (tree->name.name);
 	    check (os, tree->name.name, "SIZEOF");
-	    result = new_abs (os->bfd_section->_raw_size);
+	    result = new_abs (os->bfd_section->_raw_size / opb);
 	  }
 	else
 	  result = invalid ();
@@ -967,7 +969,7 @@
 bfd_vma
 exp_get_abs_int (tree, def, name, allocation_done)
      etree_type *tree;
-     int def;
+     int def ATTRIBUTE_UNUSED;
      char *name;
      lang_phase_type allocation_done;
 {
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 1dfa31f..9613c07 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -1,4 +1,6 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 98, 1999 Free Software Foundation, Inc.
+/* Linker file opening and searching.
+   Copyright (C) 1991, 92, 93, 94, 95, 98, 99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
 
@@ -74,9 +76,6 @@
 static search_arch_type *search_arch_head;
 static search_arch_type **search_arch_tail_ptr = &search_arch_head;
  
-static boolean ldfile_open_file_search
-  PARAMS ((const char *arch, lang_input_statement_type *,
-	   const char *lib, const char *suffix));
 static FILE *try_open PARAMS ((const char *name, const char *exten));
 
 void
@@ -111,20 +110,49 @@
 	info_msg (_("attempt to open %s succeeded\n"), attempt);
     }
 
-  if (entry->the_bfd != NULL)
-    return true;
-  else
+  if (entry->the_bfd == NULL)
     {
       if (bfd_get_error () == bfd_error_invalid_target)
 	einfo (_("%F%P: invalid BFD target `%s'\n"), entry->target);
       return false;
     }
+
+  /* If we are searching for this file, see if the architecture is
+     compatible with the output file.  If it isn't, keep searching.
+     If we can't open the file as an object file, stop the search
+     here.  */
+
+  if (entry->search_dirs_flag)
+    {
+      bfd *check;
+
+      if (bfd_check_format (entry->the_bfd, bfd_archive))
+	check = bfd_openr_next_archived_file (entry->the_bfd, NULL);
+      else
+	check = entry->the_bfd;
+
+      if (check != NULL)
+	{
+	  if (! bfd_check_format (check, bfd_object))
+	    return true;
+	  if (bfd_arch_get_compatible (check, output_bfd) == NULL)
+	    {
+	      einfo (_("%P: skipping incompatible %s when searching for %s"),
+		     attempt, entry->local_sym_name);
+	      bfd_close (entry->the_bfd);
+	      entry->the_bfd = NULL;
+	      return false;
+	    }
+	}
+    }
+
+  return true;
 }
 
 /* Search for and open the file specified by ENTRY.  If it is an
    archive, use ARCH, LIB and SUFFIX to modify the file name.  */
 
-static boolean
+boolean
 ldfile_open_file_search (arch, entry, lib, suffix)
      const char *arch;
      lang_input_statement_type *entry;
@@ -221,6 +249,8 @@
 	  if (ldfile_open_file_search (arch->name, entry, ":lib", ".a"))
 	    return;
 #endif
+	  if (ldemul_find_potential_libraries (arch->name, entry))
+	    return;
 	}
       einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name);
     }
diff --git a/ld/ldfile.h b/ld/ldfile.h
index f33c9ce..9c9a4d6 100644
--- a/ld/ldfile.h
+++ b/ld/ldfile.h
@@ -51,3 +51,6 @@
 extern FILE *ldfile_find_command_file
   PARAMS ((const char *name, const char *extend));
 extern void ldfile_set_output_arch PARAMS ((CONST char *));
+extern boolean ldfile_open_file_search
+  PARAMS ((const char *arch, struct lang_input_statement_struct *,
+	   const char *lib, const char *suffix));
diff --git a/ld/ldgram.y b/ld/ldgram.y
index a1f3ed6..806ea1c 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -1,5 +1,5 @@
 /* A YACC grammer to parse a superset of the AT&T linker scripting languaue.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
 
@@ -70,6 +70,7 @@
   char *name;
   const char *cname;
   struct wildcard_spec wildcard;
+  struct name_list *name_list;
   int token;
   union etree_union *etree;
   struct phdr_info
@@ -89,7 +90,9 @@
 %type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
 %type <etree> opt_exp_without_type
 %type <integer> fill_opt
+%type <name_list> exclude_name_list
 %type <name> memspec_opt casesymlist
+%type <name> memspec_at_opt
 %type <cname> wildcard_name
 %type <wildcard> wildcard_spec
 %token <integer> INT  
@@ -132,7 +135,7 @@
 %token ORIGIN FILL
 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
 %token ALIGNMOD AT PROVIDE
-%type <token> assign_op atype
+%type <token> assign_op atype attributes_opt
 %type <name>  filename
 %token CHIP LIST SECT ABSOLUTE  LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
@@ -392,43 +395,64 @@
 			{
 			  $$.name = $1;
 			  $$.sorted = false;
-			  $$.exclude_name = NULL;
+			  $$.exclude_name_list = NULL;
 			}
-	| 	EXCLUDE_FILE '(' wildcard_name ')' wildcard_name
+	| 	EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
 			{
 			  $$.name = $5;
 			  $$.sorted = false;
-			  $$.exclude_name = $3;
+			  $$.exclude_name_list = $3;
 			}
 	|	SORT '(' wildcard_name ')'
 			{
 			  $$.name = $3;
 			  $$.sorted = true;
-			  $$.exclude_name = NULL;
+			  $$.exclude_name_list = NULL;
 			}
-	|	SORT '(' EXCLUDE_FILE '(' wildcard_name ')' wildcard_name ')'
+	|	SORT '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
 			{
 			  $$.name = $7;
 			  $$.sorted = true;
-			  $$.exclude_name = $5;
+			  $$.exclude_name_list = $5;
 			}
 	;
 
 
+
+exclude_name_list:
+		exclude_name_list wildcard_name
+			{
+			  struct name_list *tmp;
+			  tmp = (struct name_list *) xmalloc (sizeof *tmp);
+			  tmp->name = $2;
+			  tmp->next = $1;
+			  $$ = tmp;	
+			}
+	|
+		wildcard_name
+			{
+			  struct name_list *tmp;
+			  tmp = (struct name_list *) xmalloc (sizeof *tmp);
+			  tmp->name = $1;
+			  tmp->next = NULL;
+			  $$ = tmp;
+			}
+	;
+
 file_NAME_list:
 		wildcard_spec
 			{
 			  lang_add_wild ($1.name, $1.sorted,
 					 current_file.name,
 					 current_file.sorted,
-					 ldgram_had_keep, $1.exclude_name);
+					 ldgram_had_keep, $1.exclude_name_list);
 			}
 	|	file_NAME_list opt_comma wildcard_spec
 			{
 			  lang_add_wild ($3.name, $3.sorted,
 					 current_file.name,
 					 current_file.sorted,
-					 ldgram_had_keep, $3.exclude_name);
+					 ldgram_had_keep, $3.exclude_name_list);
 			}
 	;
 
@@ -610,15 +634,24 @@
 					       "length",
 					       lang_first_phase_enum);
 		}
-	
+	;
 
 attributes_opt:
-		  '(' NAME ')'
-			{
-			lang_set_flags(region, $2);
-			}
-	|
-  
+		/* empty */
+		  { /* dummy action to avoid bison 1.25 error message */ }
+	|	'(' attributes_list ')'
+	;
+
+attributes_list:
+		attributes_string
+	|	attributes_list attributes_string
+	;
+
+attributes_string:
+		NAME
+		  { lang_set_flags (region, $1, 0); }
+	|	'!' NAME
+		  { lang_set_flags (region, $2, 1); }
 	;
 
 startup:
@@ -767,6 +800,11 @@
 	;
 
 
+memspec_at_opt:
+                AT '>' NAME { $$ = $3; }
+        |       { $$ = "*default*"; }
+        ;
+
 opt_at:
 		AT '(' exp ')' { $$ = $3; }
 	|	{ $$ = 0; }
@@ -783,10 +821,10 @@
 			}
 		statement_list_opt 	
  		'}' { ldlex_popstate (); ldlex_expression (); }
-		memspec_opt phdr_opt fill_opt
+		memspec_opt memspec_at_opt phdr_opt fill_opt
 		{
 		  ldlex_popstate ();
-		  lang_leave_output_section_statement ($13, $11, $12);
+		  lang_leave_output_section_statement ($14, $11, $13, $12);
 		}
 		opt_comma
 	|	OVERLAY
@@ -800,10 +838,10 @@
 		overlay_section
 		'}'
 			{ ldlex_popstate (); ldlex_expression (); }
-		memspec_opt phdr_opt fill_opt
+		memspec_opt memspec_at_opt phdr_opt fill_opt
 			{
 			  ldlex_popstate ();
-			  lang_leave_overlay ($14, $12, $13);
+			  lang_leave_overlay ($15, $12, $14, $13);
 			}
 		opt_comma
 	|	/* The GROUP case is just enough to support the gcc
diff --git a/ld/ldlang.c b/ld/ldlang.c
index aa5c681..d40ff07 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1,5 +1,5 @@
 /* Linker command language support.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
@@ -73,20 +73,18 @@
 static void init_os PARAMS ((lang_output_section_statement_type *s));
 static void exp_init_os PARAMS ((etree_type *));
 static void section_already_linked PARAMS ((bfd *, asection *, PTR));
+static struct bfd_hash_entry *already_linked_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
+	   const char *string));
+static void already_linked_table_init PARAMS ((void));
+static void already_linked_table_free PARAMS ((void));
 static boolean wildcardp PARAMS ((const char *));
 static lang_statement_union_type *wild_sort
   PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
 	   asection *));
-static void wild_section PARAMS ((lang_wild_statement_type *ptr,
-				  const char *section,
-				  lang_input_statement_type *file,
-				  lang_output_section_statement_type *output));
 static lang_input_statement_type *lookup_name PARAMS ((const char *name));
 static void load_symbols PARAMS ((lang_input_statement_type *entry,
 				  lang_statement_list_type *));
-static void wild_file PARAMS ((lang_wild_statement_type *, const char *,
-			       lang_input_statement_type *,
-			       lang_output_section_statement_type *));
 static void wild PARAMS ((lang_wild_statement_type *s,
 			  const char *section, const char *file,
 			  const char *target,
@@ -142,24 +140,34 @@
 static void lang_set_startof PARAMS ((void));
 static void reset_memory_regions PARAMS ((void));
 static void lang_record_phdrs PARAMS ((void));
-static void lang_gc_wild_section
-  PARAMS ((lang_wild_statement_type *, const char *,
-	   lang_input_statement_type *));
-static void lang_gc_wild_file
-  PARAMS ((lang_wild_statement_type *, const char *,
-	   lang_input_statement_type *));
 static void lang_gc_wild
   PARAMS ((lang_wild_statement_type *, const char *, const char *));
 static void lang_gc_sections_1 PARAMS ((lang_statement_union_type *));
 static void lang_gc_sections PARAMS ((void));
 static void lang_do_version_exports_section PARAMS ((void));
 static void lang_check_section_addresses PARAMS ((void));
-					
 
+typedef void (*callback_t) PARAMS ((lang_wild_statement_type *,
+				    asection *, lang_input_statement_type *,
+				    void *));
+static void walk_wild_section
+  PARAMS ((lang_wild_statement_type *, const char *,
+	   lang_input_statement_type *, callback_t, void *));
+static void walk_wild_file
+  PARAMS ((lang_wild_statement_type *, const char *,
+	   lang_input_statement_type *, callback_t, void *));
+
+static int    get_target PARAMS ((const bfd_target *, void *));
+static void   stricpy PARAMS ((char *, char *));
+static void   strcut PARAMS ((char *, char *));
+static int    name_compare PARAMS ((char *, char *));
+static int    closest_target_match PARAMS ((const bfd_target *, void *));
+static char * get_first_input_target PARAMS ((void));
+					
 /* EXPORTS */
 lang_output_section_statement_type *abs_output_section;
 lang_statement_list_type *stat_ptr = &statement_list;
-lang_statement_list_type file_chain = { 0 };
+lang_statement_list_type file_chain = { NULL, NULL };
 const char *entry_symbol = NULL;
 boolean entry_from_cmdline;
 boolean lang_has_input_file = false;
@@ -193,6 +201,142 @@
 }
 
 /*----------------------------------------------------------------------
+  Generic traversal routines for finding matching sections.
+*/
+
+static void
+walk_wild_section (ptr, section, file, callback, data)
+     lang_wild_statement_type *ptr;
+     const char *section;
+     lang_input_statement_type *file;
+     callback_t callback;
+     void *data;
+{
+  /* Don't process sections from files which were excluded. */
+  if (ptr->exclude_filename_list != NULL)
+    {
+      struct name_list *list_tmp;
+      for (list_tmp = ptr->exclude_filename_list; list_tmp; list_tmp = list_tmp->next)
+        {
+	  boolean match;
+
+	  if (wildcardp (list_tmp->name))
+	    match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
+	  else
+	    match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
+
+	  if (match)
+	    return;
+	}
+    }
+
+  if (file->just_syms_flag == false)
+    {
+      register asection *s;
+      boolean wildcard;
+
+      if (section == NULL)
+	wildcard = false;
+      else
+	wildcard = wildcardp (section);
+
+      for (s = file->the_bfd->sections; s != NULL; s = s->next)
+	{
+	  boolean match;
+
+	  if (section == NULL)
+	    match = true;
+	  else
+	    {
+	      const char *name;
+
+	      name = bfd_get_section_name (file->the_bfd, s);
+	      if (wildcard)
+		match = fnmatch (section, name, 0) == 0 ? true : false;
+	      else
+		match = strcmp (section, name) == 0 ? true : false;
+	    }
+
+	  if (match)
+	    (*callback) (ptr, s, file, data);
+	}
+    }
+}
+
+/* Handle a wild statement for a single file F.  */
+
+static void
+walk_wild_file (s, section, f, callback, data)
+     lang_wild_statement_type *s;
+     const char *section;
+     lang_input_statement_type *f;
+     callback_t callback;
+     void *data;
+{
+  if (f->the_bfd == NULL
+      || ! bfd_check_format (f->the_bfd, bfd_archive))
+    walk_wild_section (s, section, f, callback, data);
+  else
+    {
+      bfd *member;
+
+      /* This is an archive file.  We must map each member of the
+	 archive separately.  */
+      member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
+      while (member != NULL)
+	{
+	  /* When lookup_name is called, it will call the add_symbols
+	     entry point for the archive.  For each element of the
+	     archive which is included, BFD will call ldlang_add_file,
+	     which will set the usrdata field of the member to the
+	     lang_input_statement.  */
+	  if (member->usrdata != NULL)
+	    {
+	      walk_wild_section (s, section,
+				 (lang_input_statement_type *) member->usrdata,
+				 callback, data);
+	    }
+
+	  member = bfd_openr_next_archived_file (f->the_bfd, member);
+	}
+    }
+}
+
+static void
+walk_wild (s, section, file, callback, data)
+     lang_wild_statement_type *s;
+     const char *section;
+     const char *file;
+     callback_t callback;
+     void *data;
+{
+  if (file == (char *) NULL)
+    {
+      /* Perform the iteration over all files in the list.  */
+      LANG_FOR_EACH_INPUT_STATEMENT (f)
+	{
+	  walk_wild_file (s, section, f, callback, data);
+	}
+    }
+  else if (wildcardp (file))
+    {
+      LANG_FOR_EACH_INPUT_STATEMENT (f)
+	{
+	  if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
+	    walk_wild_file (s, section, f, callback, data);
+	}
+    }
+  else
+    {
+      lang_input_statement_type *f;
+
+      /* Perform the iteration over a single file.  */
+      f = lookup_name (file);
+      walk_wild_file (s, section, f, callback, data);
+    }
+}  
+     
+/*----------------------------------------------------------------------
   lang_for_each_statement walks the parse tree and calls the provided
   function for each node
 */
@@ -538,6 +682,7 @@
       lookup = (lang_output_section_statement_type *)
 	new_stat (lang_output_section_statement, stat_ptr);
       lookup->region = (lang_memory_region_type *) NULL;
+      lookup->lma_region = (lang_memory_region_type *) NULL;
       lookup->fill = 0;
       lookup->block_value = 1;
       lookup->name = name;
@@ -723,13 +868,36 @@
       break;
     }
 }
-
+
 /* Sections marked with the SEC_LINK_ONCE flag should only be linked
-   once into the output.  This routine checks each sections, and
-   arranges to discard it if a section of the same name has already
-   been linked.  This code assumes that all relevant sections have the
-   SEC_LINK_ONCE flag set; that is, it does not depend solely upon the
-   section name.  This is called via bfd_map_over_sections.  */
+   once into the output.  This routine checks each section, and
+   arrange to discard it if a section of the same name has already
+   been linked.  If the section has COMDAT information, then it uses
+   that to decide whether the section should be included.  This code
+   assumes that all relevant sections have the SEC_LINK_ONCE flag set;
+   that is, it does not depend solely upon the section name.
+   section_already_linked is called via bfd_map_over_sections.  */
+
+/* This is the shape of the elements inside the already_linked hash
+   table. It maps a name onto a list of already_linked elements with
+   the same name.  It's possible to get more than one element in a
+   list if the COMDAT sections have different names.  */
+
+struct already_linked_hash_entry 
+{
+  struct bfd_hash_entry root;
+  struct already_linked *entry;
+};
+
+struct already_linked 
+{
+  struct already_linked *next;
+  asection *sec;
+};
+
+/* The hash table.  */
+
+static struct bfd_hash_table already_linked_table;
 
 /*ARGSUSED*/
 static void
@@ -739,15 +907,10 @@
      PTR data;
 {
   lang_input_statement_type *entry = (lang_input_statement_type *) data;
-  struct sec_link_once
-    {
-      struct sec_link_once *next;
-      asection *sec;
-    };
-  static struct sec_link_once *sec_link_once_list;
   flagword flags;
   const char *name;
-  struct sec_link_once *l;
+  struct already_linked *l;
+  struct already_linked_hash_entry *already_linked_list;
 
   /* If we are only reading symbols from this object, then we want to
      discard all sections.  */
@@ -763,11 +926,34 @@
   if ((flags & SEC_LINK_ONCE) == 0)
     return;
 
+  /* FIXME: When doing a relocateable link, we may have trouble
+     copying relocations in other sections that refer to local symbols
+     in the section being discarded.  Those relocations will have to
+     be converted somehow; as of this writing I'm not sure that any of
+     the backends handle that correctly.
+
+     It is tempting to instead not discard link once sections when
+     doing a relocateable link (technically, they should be discarded
+     whenever we are building constructors).  However, that fails,
+     because the linker winds up combining all the link once sections
+     into a single large link once section, which defeats the purpose
+     of having link once sections in the first place.
+
+     Also, not merging link once sections in a relocateable link
+     causes trouble for MIPS ELF, which relies in link once semantics
+     to handle the .reginfo section correctly.  */
+
   name = bfd_get_section_name (abfd, sec);
 
-  for (l = sec_link_once_list; l != NULL; l = l->next)
+  already_linked_list = 
+    ((struct already_linked_hash_entry *)
+     bfd_hash_lookup (&already_linked_table, name, true, false));
+
+  for (l = already_linked_list->entry;  l != NULL; l = l->next)
     {
-      if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0)
+      if (sec->comdat == NULL
+	  || l->sec->comdat == NULL
+	  || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
 	{
 	  /* The section has already been linked.  See if we should
              issue a warning.  */
@@ -780,8 +966,12 @@
 	      break;
 
 	    case SEC_LINK_DUPLICATES_ONE_ONLY:
-	      einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
-		     abfd, name);
+	      if (sec->comdat == NULL)
+		einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
+		       abfd, name);
+	      else
+		einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
+		       abfd, name, sec->comdat->name);
 	      break;
 
 	    case SEC_LINK_DUPLICATES_SAME_CONTENTS:
@@ -800,19 +990,59 @@
 	    }
 
 	  /* Set the output_section field so that wild_doit does not
-	     create a lang_input_section structure for this section.  */
+	     create a lang_input_section structure for this section.
+	     Since there might be a symbol in the section being
+	     discarded, we must retain a pointer to the section which
+	     we are really going to use.  */
 	  sec->output_section = bfd_abs_section_ptr;
+	  if (sec->comdat != NULL)
+	    sec->comdat->sec = l->sec;
 
 	  return;
 	}
     }
 
-  /* This is the first section with this name.  Record it.  */
+  /* This is the first section with this name.  Record it.  Allocate
+     the memory from the same obstack as the hash table is kept in.  */
 
-  l = (struct sec_link_once *) xmalloc (sizeof *l);
+  l = ((struct already_linked *) 
+       bfd_hash_allocate (&already_linked_table, sizeof *l));
+
   l->sec = sec;
-  l->next = sec_link_once_list;
-  sec_link_once_list = l;
+  l->next = already_linked_list->entry;
+  already_linked_list->entry = l;
+}
+
+/* Support routines for the hash table used by section_already_linked,
+   initialize the table, fill in an entry and remove the table.  */
+
+static struct bfd_hash_entry *
+already_linked_newfunc (entry, table, string)
+     struct bfd_hash_entry *entry ATTRIBUTE_UNUSED;
+     struct bfd_hash_table *table;
+     const char *string ATTRIBUTE_UNUSED;
+{
+  struct already_linked_hash_entry *ret = 
+    bfd_hash_allocate (table, sizeof (struct already_linked_hash_entry));
+
+  ret->entry = NULL;
+
+  return (struct bfd_hash_entry *) ret;
+}
+
+static void
+already_linked_table_init ()
+{
+  if (! bfd_hash_table_init_n (&already_linked_table,
+			       already_linked_newfunc,
+			       42))
+    einfo (_("%P%F: Failed to create hash table\n"));
+}
+
+static void
+already_linked_table_free ()
+{
+  bfd_hash_table_free (&already_linked_table);
 }
 
 /* The wild routines.
@@ -956,6 +1186,10 @@
 	  break;
 	}
 
+      /* Copy over SEC_SMALL_DATA.  */
+      if (section->flags & SEC_SMALL_DATA)
+	section->output_section->flags |= SEC_SMALL_DATA;
+
       if (section->alignment_power > output->bfd_section->alignment_power)
 	output->bfd_section->alignment_power = section->alignment_power;
 
@@ -1070,104 +1304,53 @@
    NULL, in which case it is a wild card.  */
 
 static void
-wild_section (ptr, section, file, output)
+output_section_callback (ptr, section, file, output)
      lang_wild_statement_type *ptr;
-     const char *section;
+     asection *section;
      lang_input_statement_type *file;
-     lang_output_section_statement_type *output;
+     void *output;
 {
-
-  /* Don't process sections from files which were excluded. */
-  if (ptr->exclude_filename != NULL)
+  lang_statement_union_type *before;
+  
+  /* If the wild pattern was marked KEEP, the member sections
+     should be as well.  */
+  if (ptr->keep_sections)
+    section->flags |= SEC_KEEP;
+  
+  before = wild_sort (ptr, file, section);
+  
+  /* Here BEFORE points to the lang_input_section which
+     should follow the one we are about to add.  If BEFORE
+     is NULL, then the section should just go at the end
+     of the current list.  */
+  
+  if (before == NULL)
+    wild_doit (&ptr->children, section, 
+	       (lang_output_section_statement_type *) output, 
+	       file);
+  else
     {
-      boolean match;
-
-      if (wildcardp (ptr->exclude_filename))
-         match = fnmatch (ptr->exclude_filename, file->filename, 0) == 0 ? true : false;
-      else
-         match = strcmp (ptr->exclude_filename, file->filename) == 0 ? true : false;
-
-      if (match)
-        return;
-    }
-
-  if (file->just_syms_flag == false)
-    {
-      register asection *s;
-      boolean wildcard;
-
-      if (section == NULL)
-	wildcard = false;
-      else
-	wildcard = wildcardp (section);
-
-      for (s = file->the_bfd->sections; s != NULL; s = s->next)
+      lang_statement_list_type list;
+      lang_statement_union_type **pp;
+      
+      lang_list_init (&list);
+      wild_doit (&list, section, 
+		 (lang_output_section_statement_type *) output, 
+		 file);
+      
+      /* If we are discarding the section, LIST.HEAD will
+	 be NULL.  */
+      if (list.head != NULL)
 	{
-	  boolean match;
-
-	  /* Attach all sections named SECTION.  If SECTION is NULL,
-	     then attach all sections.
-
-	     Previously, if SECTION was NULL, this code did not call
-	     wild_doit if the SEC_IS_COMMON flag was set for the
-	     section.  I did not understand that, and I took it out.
-	     --ian@cygnus.com.  */
-
-	  if (section == NULL)
-	    match = true;
-	  else
-	    {
-	      const char *name;
-
-	      name = bfd_get_section_name (file->the_bfd, s);
-	      if (wildcard)
-		match = fnmatch (section, name, 0) == 0 ? true : false;
-	      else
-		match = strcmp (section, name) == 0 ? true : false;
-	    }
-
-	  if (match)
-	    {
-	      lang_statement_union_type *before;
-
-	      /* If the wild pattern was marked KEEP, the member sections
-		 should be as well.  */
-	      if (ptr->keep_sections)
-		s->flags |= SEC_KEEP;
-
-	      before = wild_sort (ptr, file, s);
-
-	      /* Here BEFORE points to the lang_input_section which
-		 should follow the one we are about to add.  If BEFORE
-		 is NULL, then the section should just go at the end
-		 of the current list.  */
-
-	      if (before == NULL)
-		wild_doit (&ptr->children, s, output, file);
-	      else
-		{
-		  lang_statement_list_type list;
-		  lang_statement_union_type **pp;
-
-		  lang_list_init (&list);
-		  wild_doit (&list, s, output, file);
-
-		  /* If we are discarding the section, LIST.HEAD will
-                     be NULL.  */
-		  if (list.head != NULL)
-		    {
-		      ASSERT (list.head->next == NULL);
-
-		      for (pp = &ptr->children.head;
-			   *pp != before;
-			   pp = &(*pp)->next)
-			ASSERT (*pp != NULL);
-
-		      list.head->next = *pp;
-		      *pp = list.head;
-		    }
-		}
-	    }
+	  ASSERT (list.head->next == NULL);
+	  
+	  for (pp = &ptr->children.head;
+	       *pp != before;
+	       pp = &(*pp)->next)
+	    ASSERT (*pp != NULL);
+	  
+	  list.head->next = *pp;
+	  *pp = list.head;
 	}
     }
 }
@@ -1320,43 +1503,7 @@
   entry->loaded = true;
 }
 
-/* Handle a wild statement for a single file F.  */
-
-static void
-wild_file (s, section, f, output)
-     lang_wild_statement_type *s;
-     const char *section;
-     lang_input_statement_type *f;
-     lang_output_section_statement_type *output;
-{
-  if (f->the_bfd == NULL
-      || ! bfd_check_format (f->the_bfd, bfd_archive))
-    wild_section (s, section, f, output);
-  else
-    {
-      bfd *member;
-
-      /* This is an archive file.  We must map each member of the
-	 archive separately.  */
-      member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
-      while (member != NULL)
-	{
-	  /* When lookup_name is called, it will call the add_symbols
-	     entry point for the archive.  For each element of the
-	     archive which is included, BFD will call ldlang_add_file,
-	     which will set the usrdata field of the member to the
-	     lang_input_statement.  */
-	  if (member->usrdata != NULL)
-	    {
-	      wild_section (s, section,
-			    (lang_input_statement_type *) member->usrdata,
-			    output);
-	    }
-
-	  member = bfd_openr_next_archived_file (f->the_bfd, member);
-	}
-    }
-}
+     
 
 /* Handle a wild statement.  SECTION or FILE or both may be NULL,
    indicating that it is a wildcard.  Separate lang_input_section
@@ -1368,37 +1515,10 @@
      lang_wild_statement_type *s;
      const char *section;
      const char *file;
-     const char *target;
+     const char *target ATTRIBUTE_UNUSED;
      lang_output_section_statement_type *output;
 {
-  lang_input_statement_type *f;
-
-  if (file == (char *) NULL)
-    {
-      /* Perform the iteration over all files in the list */
-      for (f = (lang_input_statement_type *) file_chain.head;
-	   f != (lang_input_statement_type *) NULL;
-	   f = (lang_input_statement_type *) f->next)
-	{
-	  wild_file (s, section, f, output);
-	}
-    }
-  else if (wildcardp (file))
-    {
-      for (f = (lang_input_statement_type *) file_chain.head;
-	   f != (lang_input_statement_type *) NULL;
-	   f = (lang_input_statement_type *) f->next)
-	{
-	  if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
-	    wild_file (s, section, f, output);
-	}
-    }
-  else
-    {
-      /* Perform the iteration over a single file */
-      f = lookup_name (file);
-      wild_file (s, section, f, output);
-    }
+  walk_wild (s, section, file, output_section_callback, (void *) output);
 
   if (section != (char *) NULL
       && strcmp (section, "COMMON") == 0
@@ -1410,29 +1530,234 @@
     }
 }
 
+/* Return true iff target is the sought target.  */
+static int
+get_target (target, data)
+     const bfd_target * target;
+     void * data;
+{
+  const char * sought = (const char *) data;
+  
+  return strcmp (target->name, sought) == 0;
+}
+
+/* Like strcpy() but convert to lower case as well.  */
+static void
+stricpy (dest, src)
+     char * dest;
+     char * src;
+{
+  char c;
+  
+  while ((c = * src ++) != 0)
+    {
+      if (isupper ((unsigned char) c))
+	c = tolower (c);
+
+      * dest ++ = c;
+    }
+
+  * dest = 0;
+}
+
+/* Remove the first occurance of needle (if any) in haystack
+   from haystack.  */
+static void
+strcut (haystack, needle)
+     char * haystack;
+     char * needle;
+{
+  haystack = strstr (haystack, needle);
+  
+  if (haystack)
+    {
+      char * src;
+
+      for (src = haystack + strlen (needle); * src;)
+	* haystack ++ = * src ++;
+      
+      * haystack = 0;
+    }
+}
+
+/* Compare two target format name strings.
+   Return a value indicating how "similar" they are.  */
+static int
+name_compare (first, second)
+     char * first;
+     char * second;
+{
+  char * copy1;
+  char * copy2;
+  int    result;
+  
+  copy1 = xmalloc (strlen (first) + 1);
+  copy2 = xmalloc (strlen (second) + 1);
+
+  /* Convert the names to lower case.  */
+  stricpy (copy1, first);
+  stricpy (copy2, second);
+
+  /* Remove and endian strings from the name.  */
+  strcut (copy1, "big");
+  strcut (copy1, "little");
+  strcut (copy2, "big");
+  strcut (copy2, "little");
+
+  /* Return a value based on how many characters match,
+     starting from the beginning.   If both strings are
+     the same then return 10 * their length.  */
+  for (result = 0; copy1 [result] == copy2 [result]; result ++)
+    if (copy1 [result] == 0)
+      {
+	result *= 10;
+	break;
+      }
+  
+  free (copy1);
+  free (copy2);
+
+  return result;
+}
+
+/* Set by closest_target_match() below.  */
+static const bfd_target * winner;
+
+/* Scan all the valid bfd targets looking for one that has the endianness
+   requirement that was specified on the command line, and is the nearest
+   match to the original output target.  */
+static int
+closest_target_match (target, data)
+     const bfd_target * target;
+     void * data;
+{
+  const bfd_target * original = (const bfd_target *) data;
+  
+  if (command_line.endian == ENDIAN_BIG && target->byteorder != BFD_ENDIAN_BIG)
+    return 0;
+  
+  if (command_line.endian == ENDIAN_LITTLE && target->byteorder != BFD_ENDIAN_LITTLE)
+    return 0;
+
+  /* Must be the same flavour.  */
+  if (target->flavour != original->flavour)
+    return 0;
+
+  /* If we have not found a potential winner yet, then record this one.  */
+  if (winner == NULL)
+    {
+      winner = target;
+      return 0;
+    }
+
+  /* Oh dear, we now have two potential candidates for a successful match.
+     Compare their names and choose the better one. */
+  if (name_compare (target->name, original->name) > name_compare (winner->name, original->name))
+    winner = target;
+
+  /* Keep on searching until wqe have checked them all.  */
+  return 0;
+}
+
+/* Return the BFD target format of the first input file.  */
+static char *
+get_first_input_target ()
+{
+  char * target = NULL;
+
+  LANG_FOR_EACH_INPUT_STATEMENT (s)
+    {
+      if (s->header.type == lang_input_statement_enum
+	  && s->real)
+	{
+	  ldfile_open_file (s);
+	  
+	  if (s->the_bfd != NULL
+	      && bfd_check_format (s->the_bfd, bfd_object))
+	    {
+	      target = bfd_get_target (s->the_bfd);
+	  
+	      if (target != NULL)
+		break;
+	    }
+	}
+    }
+  
+  return target;
+}
+
 /* Open the output file.  */
 
 static bfd *
 open_output (name)
-     const char *name;
+     const char * name;
 {
-  bfd *output;
+  bfd * output;
 
+  /* Has the user told us which output format to use ?  */
   if (output_target == (char *) NULL)
     {
-      if (current_target != (char *) NULL)
+      /* No - has the current target been set to something other than the default ?  */
+      if (current_target != default_target)
 	output_target = current_target;
+
+      /* No - can we determine the format of the first input file ? */
       else
-	output_target = default_target;
+	{
+	  output_target = get_first_input_target ();
+
+	  /* Failed - use the default output target.  */
+	  if (output_target == NULL)
+	    output_target = default_target;
+	}
     }
+  
+  /* Has the user requested a particular endianness on the command line ?  */
+  if (command_line.endian != ENDIAN_UNSET)
+    {
+      const bfd_target * target;
+      enum bfd_endian desired_endian;
+
+      /* Get the chosen target.  */
+      target = bfd_search_for_target (get_target, (void *) output_target);
+
+      if (command_line.endian == ENDIAN_BIG)
+	desired_endian = BFD_ENDIAN_BIG;
+      else
+	desired_endian = BFD_ENDIAN_LITTLE;
+      
+      /* See if the target has the wrong endianness.  This should not happen
+	 if the linker script has provided big and little endian alternatives,
+	 but some scrips don't do this.  */
+      if (target->byteorder != desired_endian)
+	{
+	  /* If it does, then see if the target provides
+	     an alternative with the correct endianness.  */
+	  if (target->alternative_target != NULL
+	      && (target->alternative_target->byteorder == desired_endian))
+	    output_target = target->alternative_target->name;
+	  else
+	    {
+	      /* Try to find a target as similar as possible to the default
+		 target, but which has the desired endian characteristic.  */
+	      (void) bfd_search_for_target (closest_target_match, (void *) target);
+	      
+	      /* Oh dear - we could not find any targets that satisfy our requirements.  */
+	      if (winner == NULL)
+		einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
+	      else
+		output_target = winner->name;
+	    }
+	}
+    }
+      
   output = bfd_openw (name, output_target);
 
   if (output == (bfd *) NULL)
     {
       if (bfd_get_error () == bfd_error_invalid_target)
-	{
-	  einfo (_("%P%F: target %s not found\n"), output_target);
-	}
+	einfo (_("%P%F: target %s not found\n"), output_target);
+
       einfo (_("%P%F: cannot open output file %s: %E\n"), name);
     }
 
@@ -1455,9 +1780,6 @@
   return output;
 }
 
-
-
-
 static void
 ldlang_open_output (statement)
      lang_statement_union_type * statement;
@@ -1534,7 +1856,7 @@
 	  current_target = s->target_statement.target;
 	  break;
 	case lang_input_statement_enum:
-	  if (s->input_statement.real == true)
+	  if (s->input_statement.real)
 	    {
 	      lang_statement_list_type add;
 
@@ -1847,7 +2169,8 @@
 {
   asection *i = in->section;
   bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
-
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine);
   if (size != 0)
     {
       print_space ();
@@ -1871,7 +2194,7 @@
 	    }
 
 	  minfo ("0x%V %W %B\n",
-		 i->output_section->vma + i->output_offset, size,
+		 i->output_section->vma + i->output_offset, size / opb,
 		 i->owner);
 
 	  if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
@@ -1893,7 +2216,7 @@
 
 	  bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
 
-	  print_dot = i->output_section->vma + i->output_offset + size;
+	  print_dot = i->output_section->vma + i->output_offset + size / opb;
 	}
     }
 }
@@ -1913,6 +2236,8 @@
   bfd_vma addr;
   bfd_size_type size;
   const char *name;
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine);
 
   for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
     print_space ();
@@ -1957,7 +2282,8 @@
 
   print_nl ();
 
-  print_dot = addr + size;
+  print_dot = addr + size / opb;
+
 }
 
 /* Print an address statement.  These are generated by options like
@@ -1981,6 +2307,8 @@
   int i;
   bfd_vma addr;
   bfd_size_type size;
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
 
   for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
     print_space ();
@@ -2002,7 +2330,7 @@
 
   print_nl ();
 
-  print_dot = addr + size;
+  print_dot = addr + size / opb;
 }  
 
 static void
@@ -2011,6 +2339,8 @@
 {
   int len;
   bfd_vma addr;
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
 
   minfo (" *fill*");
 
@@ -2031,7 +2361,7 @@
 
   print_nl ();
 
-  print_dot = addr + s->size;
+  print_dot = addr + s->size / opb;
 }
 
 static void
@@ -2043,9 +2373,15 @@
 
   if (w->filenames_sorted)
     minfo ("SORT(");
-  if (w->exclude_filename != NULL)
-    minfo ("EXCLUDE_FILE ( %s )", w->exclude_filename);
-  if (w->filename != NULL)
+  if (w->exclude_filename_list != NULL)
+    {
+      name_list *tmp;
+      minfo ("EXCLUDE_FILE ( %s", w->exclude_filename_list->name);
+      for (tmp=w->exclude_filename_list->next; tmp; tmp = tmp->next)
+        minfo (", %s", tmp->name);
+      minfo (")");
+     }
+   if (w->filename != NULL)
     minfo ("%s", w->filename);
   else
     minfo ("*");
@@ -2220,6 +2556,8 @@
      inserting a magic 'padding' statement.
      */
 
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
   unsigned int alignment_needed = align_power (dot, power) - dot;
 
   if (alignment_needed != 0)
@@ -2236,7 +2574,7 @@
       new->padding_statement.output_offset =
 	dot - output_section_statement->vma;
       new->padding_statement.fill = fill;
-      new->padding_statement.size = alignment_needed;
+      new->padding_statement.size = alignment_needed * opb;
     }
 
 
@@ -2245,9 +2583,9 @@
     {
       output_section_statement->alignment_power = power;
     }
-  output_section_statement->_raw_size += alignment_needed;
-  return alignment_needed + dot;
+  output_section_statement->_raw_size += alignment_needed * opb;
 
+  return dot + alignment_needed;
 }
 
 /* Work out how much this section will move the dot point */
@@ -2257,10 +2595,12 @@
      lang_output_section_statement_type * output_section_statement;
      fill_type fill;
      bfd_vma dot;
-     boolean relax;
+     boolean relax ATTRIBUTE_UNUSED;
 {
   lang_input_section_type *is = &((*this_ptr)->input_section);
   asection *i = is->section;
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
 
   if (is->ifile->just_syms_flag == false)
     {
@@ -2278,10 +2618,11 @@
       /* Mark how big the output section must be to contain this now
 	 */
       if (i->_cooked_size != 0)
-	dot += i->_cooked_size;
+	dot += i->_cooked_size / opb;
       else
-	dot += i->_raw_size;
-      output_section_statement->bfd_section->_raw_size = dot - output_section_statement->bfd_section->vma;
+	dot += i->_raw_size / opb;
+      output_section_statement->bfd_section->_raw_size = 
+        (dot - output_section_statement->bfd_section->vma) * opb;
     }
   else
     {
@@ -2291,6 +2632,10 @@
   return dot;
 }
 
+#define IGNORE_SECTION(bfd, s) \
+  (((bfd_get_section_flags (bfd, s) & (SEC_ALLOC | SEC_LOAD)) != (SEC_ALLOC | SEC_LOAD)) \
+   || bfd_section_size (bfd, s) == 0)
+
 /* Check to see if any allocated sections overlap with other allocated
    sections.  This can happen when the linker script specifically specifies
    the output section addresses of the two sections.  */
@@ -2298,52 +2643,52 @@
 lang_check_section_addresses ()
 {
   asection * s;
+  unsigned opb = bfd_octets_per_byte (output_bfd);
 
   /* Scan all sections in the output list.  */
   for (s = output_bfd->sections; s != NULL; s = s->next)
-    /* Ignore sections which are not loaded or which have no contents.  */
-    if ((bfd_get_section_flags (output_bfd, s) & (SEC_ALLOC | SEC_LOAD))
-	&& bfd_section_size (output_bfd, s) != 0)
-      {
-	asection * os;
+    {
+      asection * os;
+      
+      /* Ignore sections which are not loaded or which have no contents.  */
+      if (IGNORE_SECTION (output_bfd, s))
+	continue;
+      
+      /* Once we reach section 's' stop our seach.  This prevents two
+	 warning messages from being produced, one for 'section A overlaps
+	 section B' and one for 'section B overlaps section A'.  */
+      for (os = output_bfd->sections; os != s; os = os->next)
+	{
+	  bfd_vma s_start;
+	  bfd_vma s_end;
+	  bfd_vma os_start;
+	  bfd_vma os_end;
+	  
+	  /* Only consider loadable sections with real contents.  */
+	  if (IGNORE_SECTION (output_bfd, os))
+	    continue;
 
-	/* Once we reach section 's' stop our seach.  This prevents two
-	   warning messages from being produced, one for 'section A overlaps
-	   section B' and one for 'section B overlaps section A'.  */
-	for (os = output_bfd->sections; os != s; os = os->next)
-	  {
-	    bfd_vma s_start;
-	    bfd_vma s_end;
-	    bfd_vma os_start;
-	    bfd_vma os_end;
-
-	    /* Only consider loadable sections with real contents.  */
-	    if (((bfd_get_section_flags (output_bfd, os)
-		  & (SEC_ALLOC | SEC_LOAD)) == 0)
-		|| bfd_section_size (output_bfd, os) == 0)
-	      continue;
-
-	    /* We must check the sections' LMA addresses not their
-	       VMA addresses because overlay sections can have
-	       overlapping VMAs but they must have distinct LMAs.  */
-	    s_start  = bfd_section_lma (output_bfd, s);
-	    os_start = bfd_section_lma (output_bfd, os);
-	    s_end    = s_start  + bfd_section_size (output_bfd, s) - 1;
-	    os_end   = os_start + bfd_section_size (output_bfd, os) - 1;
-
-	    /* Look for an overlap.  */
-	    if ((s_end < os_start) || (s_start > os_end))
-	      continue;
-	    
-	    einfo (
+	  /* We must check the sections' LMA addresses not their
+	     VMA addresses because overlay sections can have
+	     overlapping VMAs but they must have distinct LMAs.  */
+	  s_start  = bfd_section_lma (output_bfd, s);
+	  os_start = bfd_section_lma (output_bfd, os);
+	  s_end    = s_start  + bfd_section_size (output_bfd, s) / opb - 1;
+	  os_end   = os_start + bfd_section_size (output_bfd, os) / opb - 1;
+	  
+	  /* Look for an overlap.  */
+	  if ((s_end < os_start) || (s_start > os_end))
+	    continue;
+	  
+	  einfo (
 _("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
-		   s->name, s_start, s_end, os->name, os_start, os_end);
-
-	    /* Once we have found one overlap for this section,
-	       stop looking for others.  */
-	    break;
-	  }
-      }
+		 s->name, s_start, s_end, os->name, os_start, os_end);
+	  
+	  /* Once we have found one overlap for this section,
+	     stop looking for others.  */
+	  break;
+	}
+    }
 }
 
 /* This variable indicates whether bfd_relax_section should be called
@@ -2351,6 +2696,43 @@
 
 static boolean relax_again;
 
+/* Make sure the new address is within the region.  We explicitly permit the
+   current address to be at the exact end of the region when the address is
+   non-zero, in case the region is at the end of addressable memory and the
+   calculation wraps around.  */ 
+
+static void
+os_region_check (os, region, tree, base)
+  lang_output_section_statement_type *os;
+  struct memory_region_struct *region;
+  etree_type *tree;
+  bfd_vma base;
+{
+  if ((region->current < region->origin
+       || (region->current - region->origin > region->length))
+      && ((region->current != region->origin + region->length)
+           || base == 0))
+    {
+      if (tree != (etree_type *) NULL)
+        {
+          einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
+                 region->current,
+                 os->bfd_section->owner,
+                 os->bfd_section->name,
+                 region->name);
+        }
+      else
+        {
+          einfo (_("%X%P: region %s is full (%B section %s)\n"),
+                 region->name,
+                 os->bfd_section->owner,
+                 os->bfd_section->name);
+        }
+      /* Reset the region pointer.  */
+      region->current = region->origin;
+    }
+}
+
 /* Set the sizes for all the output sections.  */
 
 bfd_vma
@@ -2362,6 +2744,9 @@
      bfd_vma dot;
      boolean relax;
 {
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine);
+
   /* Size up the sections from their constituent parts.  */
   for (; s != (lang_statement_union_type *) NULL; s = s->next)
     {
@@ -2475,54 +2860,66 @@
 	    (void) lang_size_sections (os->children.head, os, &os->children.head,
 				       os->fill, dot, relax);
 	    
-	    /* Ignore the size of the input sections, use the vma and size to
-	       align against.  */
-
-	    after = ALIGN_N (os->bfd_section->vma +
-			     os->bfd_section->_raw_size,
+            /* put the section within the requested block size, or align at
+               the block boundary */
+	    after = ALIGN_N (os->bfd_section->vma
+			     + os->bfd_section->_raw_size / opb,
 			     /* The coercion here is important, see ld.h.  */
 			     (bfd_vma) os->block_value);
 
 	    if (bfd_is_abs_section (os->bfd_section))
 	      ASSERT (after == os->bfd_section->vma);
 	    else
-	      os->bfd_section->_raw_size = after - os->bfd_section->vma;
-	    dot = os->bfd_section->vma + os->bfd_section->_raw_size;
+	      os->bfd_section->_raw_size = 
+                (after - os->bfd_section->vma) * opb;
+	    dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
 	    os->processed = true;
 
 	    /* Update dot in the region ?
 	       We only do this if the section is going to be allocated,
 	       since unallocated sections do not contribute to the region's
-	       overall size in memory.  */
+	       overall size in memory.
+	       
+	       If the SEC_NEVER_LOAD bit is not set, it will affect the
+	       addresses of sections after it. We have to update
+	       dot.  */
 	    if (os->region != (lang_memory_region_type *) NULL
-		&& (bfd_get_section_flags (output_bfd, os->bfd_section)
-		& (SEC_ALLOC | SEC_LOAD)))
+		&& ((bfd_get_section_flags (output_bfd, os->bfd_section)
+		     & SEC_NEVER_LOAD) == 0
+		    || (bfd_get_section_flags (output_bfd, os->bfd_section)
+			& (SEC_ALLOC | SEC_LOAD))))
 	      {
 		os->region->current = dot;
 		
-		/* Make sure this isn't silly.  */
-		if (os->region->current < os->region->origin
-		    || (os->region->current - os->region->origin
-			> os->region->length))
-		  {
-		    if (os->addr_tree != (etree_type *) NULL)
-		      {
-			einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
-			       os->region->current,
-			       os->bfd_section->owner,
-			       os->bfd_section->name,
-			       os->region->name);
-		      }
-		    else
-		      {
-			einfo (_("%X%P: region %s is full (%B section %s)\n"),
-			       os->region->name,
-			       os->bfd_section->owner,
-			       os->bfd_section->name);
-		      }
-		    /* Reset the region pointer.  */
-		    os->region->current = os->region->origin;
-		  }
+		/* Make sure the new address is within the region.  */
+                os_region_check (os, os->region, os->addr_tree, 
+                                 os->bfd_section->vma);
+
+                /* if there's no load address specified, use the run region as
+                   the load region */
+                if (os->lma_region == NULL && os->load_base == NULL)
+                    os->lma_region = os->region;
+
+                if (os->lma_region != NULL)
+                  {
+                    if (os->load_base != NULL)
+                      {
+                        einfo (_("%X%P: use an absolute load address or a load memory region, not both\n"));
+                      }
+                    else
+                      {
+                        /* don't allocate twice */
+                        if (os->lma_region != os->region)
+                          {
+                            /* set load_base, which will be handled later */
+                            os->load_base = exp_intop (os->lma_region->current);
+                            os->lma_region->current += 
+                              os->bfd_section->_raw_size / opb;
+                            os_region_check (os, os->lma_region, NULL,
+                                             os->bfd_section->lma);
+                          }
+                      }
+                  }
 	      }
 	  }
 	  break;
@@ -2545,6 +2942,8 @@
 
 	    switch (s->data_statement.type)
 	      {
+              default:
+                abort();
 	      case QUAD:
 	      case SQUAD:
 		size = QUAD_SIZE;
@@ -2559,8 +2958,9 @@
 		size = BYTE_SIZE;
 		break;
 	      }
-
-	    dot += size;
+            if (size < opb)
+              size = opb;
+	    dot += size / opb;
 	    output_section_statement->bfd_section->_raw_size += size;
 	    /* The output section gets contents, and then we inspect for
 	       any flags set in the input script which override any ALLOC.  */
@@ -2580,7 +2980,7 @@
 	    s->reloc_statement.output_section =
 	      output_section_statement->bfd_section;
 	    size = bfd_get_reloc_size (s->reloc_statement.howto);
-	    dot += size;
+	    dot += size / opb;
 	    output_section_statement->bfd_section->_raw_size += size;
 	  }
 	  break;
@@ -2668,7 +3068,7 @@
 		    new->padding_statement.output_offset =
 		      dot - output_section_statement->bfd_section->vma;
 		    new->padding_statement.fill = fill;
-		    new->padding_statement.size = newdot - dot;
+		    new->padding_statement.size = (newdot - dot) * opb;
 		    output_section_statement->bfd_section->_raw_size +=
 		      new->padding_statement.size;
 		  }
@@ -2686,7 +3086,7 @@
 	     pass than it did at this point in the previous pass.  */
 	  s->padding_statement.output_offset =
 	    dot - output_section_statement->bfd_section->vma;
-	  dot += s->padding_statement.size;
+	  dot += s->padding_statement.size / opb;
 	  output_section_statement->bfd_section->_raw_size +=
 	    s->padding_statement.size;
 	  break;
@@ -2719,6 +3119,9 @@
      fill_type fill;
      bfd_vma dot;
 {
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
+
   for (; s != (lang_statement_union_type *) NULL; s = s->next)
     {
       switch (s->header.type)
@@ -2740,7 +3143,8 @@
 		dot = os->bfd_section->vma;
 		(void) lang_do_assignments (os->children.head, os,
 					    os->fill, dot);
-		dot = os->bfd_section->vma + os->bfd_section->_raw_size;
+		dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
+
 	      }
 	    if (os->load_base) 
 	      {
@@ -2780,22 +3184,30 @@
 	    if (value.valid_p == false)
 	      einfo (_("%F%P: invalid data statement\n"));
 	  }
-	  switch (s->data_statement.type)
-	    {
-	    case QUAD:
-	    case SQUAD:
-	      dot += QUAD_SIZE;
-	      break;
-	    case LONG:
-	      dot += LONG_SIZE;
-	      break;
-	    case SHORT:
-	      dot += SHORT_SIZE;
-	      break;
-	    case BYTE:
-	      dot += BYTE_SIZE;
-	      break;
-	    }
+          {
+            unsigned int size;
+            switch (s->data_statement.type)
+              {
+              default:
+                abort();
+              case QUAD:
+              case SQUAD:
+                size = QUAD_SIZE;
+                break;
+              case LONG:
+                size = LONG_SIZE;
+                break;
+              case SHORT:
+                size = SHORT_SIZE;
+                break;
+              case BYTE:
+                size = BYTE_SIZE;
+                break;
+              }
+            if (size < opb)
+              size = opb;
+            dot += size / opb;
+          }
 	  break;
 
 	case lang_reloc_statement_enum:
@@ -2809,7 +3221,7 @@
 	    if (value.valid_p == false)
 	      einfo (_("%F%P: invalid reloc statement\n"));
 	  }
-	  dot += bfd_get_reloc_size (s->reloc_statement.howto);
+	  dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
 	  break;
 
 	case lang_input_section_enum:
@@ -2817,9 +3229,9 @@
 	    asection *in = s->input_section.section;
 
 	    if (in->_cooked_size != 0)
-	      dot += in->_cooked_size;
+	      dot += in->_cooked_size / opb;
 	    else
-	      dot += in->_raw_size;
+	      dot += in->_raw_size / opb;
 	  }
 	  break;
 
@@ -2839,7 +3251,7 @@
 
 	  break;
 	case lang_padding_statement_enum:
-	  dot += s->padding_statement.size;
+	  dot += s->padding_statement.size / opb;
 	  break;
 
 	case lang_group_statement_enum:
@@ -2897,11 +3309,13 @@
       h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
       if (h != NULL && h->type == bfd_link_hash_undefined)
 	{
+          unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+							ldfile_output_machine);
 	  h->type = bfd_link_hash_defined;
 	  if (s->_cooked_size != 0)
-	    h->u.def.value = s->_cooked_size;
+	    h->u.def.value = s->_cooked_size / opb;
 	  else
-	    h->u.def.value = s->_raw_size;
+	    h->u.def.value = s->_raw_size / opb;
 	  h->u.def.section = bfd_abs_section_ptr;
 	}
 
@@ -2988,10 +3402,10 @@
 
 static void
 #ifdef ANSI_PROTOTYPES
-ignore_bfd_errors (const char *s, ...)
+ignore_bfd_errors (const char *s ATTRIBUTE_UNUSED, ...)
 #else
 ignore_bfd_errors (s)
-     const char *s;
+     const char *s ATTRIBUTE_UNUSED;
 #endif
 {
   /* Don't do anything.  */
@@ -3078,6 +3492,8 @@
   unsigned int power_of_two;
   bfd_vma size;
   asection *section;
+  unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+						ldfile_output_machine); 
 
   if (h->type != bfd_link_hash_common)
     return true;
@@ -3092,8 +3508,8 @@
   section = h->u.c.p->section;
 
   /* Increase the size of the section.  */
-  section->_cooked_size = ALIGN_N (section->_cooked_size,
-				   (bfd_size_type) (1 << power_of_two));
+  section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
+				   (bfd_size_type) (1 << power_of_two)) * opb;
 
   /* Adjust the alignment if necessary.  */
   if (power_of_two > section->alignment_power)
@@ -3172,11 +3588,7 @@
 static void
 lang_place_orphans ()
 {
-  lang_input_statement_type *file;
-
-  for (file = (lang_input_statement_type *) file_chain.head;
-       file != (lang_input_statement_type *) NULL;
-       file = (lang_input_statement_type *) file->next)
+  LANG_FOR_EACH_INPUT_STATEMENT (file)
     {
       asection *s;
 
@@ -3237,21 +3649,18 @@
 
 
 void
-lang_set_flags (ptr, flags)
+lang_set_flags (ptr, flags, invert)
      lang_memory_region_type *ptr;
      CONST char *flags;
+     int invert;
 {
-  flagword *ptr_flags = &ptr->flags;
+  flagword *ptr_flags;
 
-  ptr->flags = ptr->not_flags = 0;
+  ptr_flags = invert ? &ptr->not_flags : &ptr->flags;
   while (*flags)
     {
       switch (*flags)
 	{
-	case '!':
-	  ptr_flags = (ptr_flags == &ptr->flags) ? &ptr->not_flags : &ptr->flags;
-	  break;
-
 	case 'A': case 'a':
 	  *ptr_flags |= SEC_ALLOC;
 	  break;
@@ -3304,11 +3713,7 @@
 lang_for_each_file (func)
      void (*func) PARAMS ((lang_input_statement_type *));
 {
-  lang_input_statement_type *f;
-
-  for (f = (lang_input_statement_type *) file_chain.head;
-       f != (lang_input_statement_type *) NULL;
-       f = (lang_input_statement_type *) f->next)
+  LANG_FOR_EACH_INPUT_STATEMENT (f)
     {
       func (f);
     }
@@ -3322,13 +3727,9 @@
 lang_for_each_input_section (func)
      void (*func) PARAMS ((bfd * ab, asection * as));
 {
-  lang_input_statement_type *f;
-
-  for (f = (lang_input_statement_type *) file_chain.head;
-       f != (lang_input_statement_type *) NULL;
-       f = (lang_input_statement_type *) f->next)
+  LANG_FOR_EACH_INPUT_STATEMENT (f)
     {
-      asection *s;
+      asection * s;
 
       for (s = f->the_bfd->sections;
 	   s != (asection *) NULL;
@@ -3487,90 +3888,20 @@
     }
 }
 
-/* ??? At some point this traversal for GC should share code with the
-   traversal for manipulating the output file.  */
-
 /* Expand a wild statement for a particular FILE, marking its sections KEEP
    as needed.  SECTION may be NULL, in which case it is a wild card.  */
 
 static void
-lang_gc_wild_section (ptr, section, file)
+gc_section_callback (ptr, section, file, data)
      lang_wild_statement_type *ptr;
-     const char *section;
-     lang_input_statement_type *file;
+     asection *section;
+     lang_input_statement_type *file ATTRIBUTE_UNUSED;
+     void *data ATTRIBUTE_UNUSED;
 {
-  if (file->just_syms_flag == false)
-    {
-      register asection *s;
-      boolean wildcard;
-
-      if (section == NULL)
-	wildcard = false;
-      else
-	wildcard = wildcardp (section);
-
-      for (s = file->the_bfd->sections; s != NULL; s = s->next)
-	{
-	  boolean match;
-
-	  if (section == NULL)
-	    match = true;
-	  else
-	    {
-	      const char *name;
-
-	      name = bfd_get_section_name (file->the_bfd, s);
-	      if (wildcard)
-		match = fnmatch (section, name, 0) == 0 ? true : false;
-	      else
-		match = strcmp (section, name) == 0 ? true : false;
-	    }
-
-	  if (match)
-	    {
-	      /* If the wild pattern was marked KEEP, the member sections
-		 should be as well.  */
-	      if (ptr->keep_sections)
-		s->flags |= SEC_KEEP;
-	    }
-	}
-    }
-}
-
-/* Handle a wild statement for a single file F.  */
-
-static void
-lang_gc_wild_file (s, section, f)
-     lang_wild_statement_type *s;
-     const char *section;
-     lang_input_statement_type *f;
-{
-  if (f->the_bfd == NULL
-      || ! bfd_check_format (f->the_bfd, bfd_archive))
-    lang_gc_wild_section (s, section, f);
-  else
-    {
-      bfd *member;
-
-      /* This is an archive file.  We must map each member of the
-	 archive separately.  */
-      member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
-      while (member != NULL)
-	{
-	  /* When lookup_name is called, it will call the add_symbols
-	     entry point for the archive.  For each element of the
-	     archive which is included, BFD will call ldlang_add_file,
-	     which will set the usrdata field of the member to the
-	     lang_input_statement.  */
-	  if (member->usrdata != NULL)
-	    {
-	      lang_gc_wild_section (s, section,
-			    (lang_input_statement_type *) member->usrdata);
-	    }
-
-	  member = bfd_openr_next_archived_file (f->the_bfd, member);
-	}
-    }
+  /* If the wild pattern was marked KEEP, the member sections
+     should be as well.  */
+  if (ptr->keep_sections)
+    section->flags |= SEC_KEEP;
 }
 
 /* Handle a wild statement, marking it against GC.  SECTION or FILE or both
@@ -3582,34 +3913,7 @@
      const char *section;
      const char *file;
 {
-  lang_input_statement_type *f;
-
-  if (file == (char *) NULL)
-    {
-      /* Perform the iteration over all files in the list */
-      for (f = (lang_input_statement_type *) file_chain.head;
-	   f != (lang_input_statement_type *) NULL;
-	   f = (lang_input_statement_type *) f->next)
-	{
-	  lang_gc_wild_file (s, section, f);
-	}
-    }
-  else if (wildcardp (file))
-    {
-      for (f = (lang_input_statement_type *) file_chain.head;
-	   f != (lang_input_statement_type *) NULL;
-	   f = (lang_input_statement_type *) f->next)
-	{
-	  if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
-	    lang_gc_wild_file (s, section, f);
-	}
-    }
-  else
-    {
-      /* Perform the iteration over a single file */
-      f = lookup_name (file);
-      lang_gc_wild_file (s, section, f);
-    }
+  walk_wild (s, section, file, gc_section_callback, NULL);
 }
 
 /* Iterate over sections marking them against GC.  */
@@ -3654,14 +3958,17 @@
 
   /* Keep all sections containing symbols undefined on the command-line.
      Handle the entry symbol at the same time.  */
-
-  fake_list_start.next = ldlang_undef_chain_list_head;
-  if (entry_symbol == NULL)
-    fake_list_start.name = "start";
+  
+  if (entry_symbol != NULL)
+    {
+      fake_list_start.next = ldlang_undef_chain_list_head;
+      fake_list_start.name = (char *) entry_symbol;
+      ulist = &fake_list_start;
+    }
   else
-    fake_list_start.name = (char *) entry_symbol;
+    ulist = ldlang_undef_chain_list_head;
 
-  for (ulist = &fake_list_start; ulist; ulist = ulist->next)
+  for (; ulist; ulist = ulist->next)
     {
       h = bfd_link_hash_lookup (link_info.hash, ulist->name, 
 				false, false, false);
@@ -3691,12 +3998,16 @@
   /* Add to the hash table all undefineds on the command line */
   lang_place_undefineds ();
 
+  already_linked_table_init ();
+
   /* Create a bfd for each input file */
   current_target = default_target;
   open_input_bfds (statement_list.head, false);
 
   ldemul_after_open ();
 
+  already_linked_table_free ();
+
   /* Make sure that we're not mixing architectures.  We call this
      after all the input files have been opened, but before we do any
      other processing, so that any operations merge_private_bfd_data
@@ -3806,13 +4117,13 @@
 
 void
 lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
-	       keep_sections, exclude_filename)
+	       keep_sections, exclude_filename_list)
      const char *const section_name;
      boolean sections_sorted;
      const char *const filename;
      boolean filenames_sorted;
      boolean keep_sections;
-     const char *exclude_filename;
+     struct name_list *exclude_filename_list;
 {
   lang_wild_statement_type *new = new_stat (lang_wild_statement,
 					    stat_ptr);
@@ -3830,7 +4141,7 @@
   new->filename = filename;
   new->filenames_sorted = filenames_sorted;
   new->keep_sections = keep_sections;
-  new->exclude_filename = exclude_filename;
+  new->exclude_filename_list = exclude_filename_list;
   lang_list_init (&new->children);
 }
 
@@ -3984,13 +4295,22 @@
 }
 
 void
-lang_leave_output_section_statement (fill, memspec, phdrs)
+lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
      bfd_vma fill;
      const char *memspec;
      struct lang_output_section_phdr_list *phdrs;
+     const char *lma_memspec;
 {
   current_section->fill = fill;
   current_section->region = lang_memory_region_lookup (memspec);
+  if (strcmp (lma_memspec, "*default*") != 0)
+    {
+      current_section->lma_region = lang_memory_region_lookup (lma_memspec);
+      /* if no runtime region has been given, but the load region has been,
+         use the load region */
+      if (strcmp (memspec, "*default*") == 0)
+        current_section->region = lang_memory_region_lookup (lma_memspec);
+    }
   current_section->phdrs = phdrs;
   stat_ptr = &statement_list;
 }
@@ -4058,7 +4378,8 @@
 	h->u.def.value = 0;
       else
 	h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
-			  + bfd_section_size (output_bfd, sec));
+			  + bfd_section_size (output_bfd, sec) /
+                          bfd_octets_per_byte (output_bfd));
 
       h->u.def.section = bfd_abs_section_ptr;
     }
@@ -4368,7 +4689,8 @@
 
   name = current_section->name;
 
-  lang_leave_output_section_statement (fill, "*default*", phdrs);
+  lang_leave_output_section_statement (fill, "*default*", 
+                                       phdrs, "*default*");
 
   /* Define the magic symbols.  */
 
@@ -4398,12 +4720,14 @@
    looks through all the sections in the overlay and sets them.  */
 
 void
-lang_leave_overlay (fill, memspec, phdrs)
+lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
      bfd_vma fill;
      const char *memspec;
      struct lang_output_section_phdr_list *phdrs;
+     const char *lma_memspec;
 {
   lang_memory_region_type *region;
+  lang_memory_region_type *lma_region;
   struct overlay_list *l;
   struct lang_nocrossref *nocrossref;
 
@@ -4412,6 +4736,11 @@
   else
     region = lang_memory_region_lookup (memspec);
 
+  if (lma_memspec == NULL)
+    lma_region = NULL;
+  else
+    lma_region = lang_memory_region_lookup (lma_memspec);
+
   nocrossref = NULL;
 
   l = overlay_list;
@@ -4423,6 +4752,8 @@
 	l->os->fill = fill;
       if (region != NULL && l->os->region == NULL)
 	l->os->region = region;
+      if (lma_region != NULL && l->os->lma_region == NULL)
+        l->os->lma_region = lma_region;
       if (phdrs != NULL && l->os->phdrs == NULL)
 	l->os->phdrs = phdrs;
 
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 7bd7972..068cd96 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -1,5 +1,6 @@
 /* ldlang.h - linker command language support
-   Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
    
    This file is part of GLD, the Gnu Linker.
    
@@ -135,6 +136,7 @@
   flagword flags;		/* Or together of all input sections */
   enum section_type sectype;
   struct memory_region_struct *region;
+  struct memory_region_struct *lma_region;
   size_t block_value;
   fill_type fill;
 
@@ -282,7 +284,7 @@
   const char *filename;
   boolean filenames_sorted;
   boolean keep_sections;
-  const char *exclude_filename;
+  struct name_list *exclude_filename_list;
   lang_statement_list_type children;
 } lang_wild_statement_type;
 
@@ -383,7 +385,8 @@
 extern struct memory_region_struct *lang_memory_region_default
   PARAMS ((asection *));
 extern void lang_map PARAMS ((void));
-extern void lang_set_flags PARAMS ((lang_memory_region_type *, const char *));
+extern void lang_set_flags PARAMS ((lang_memory_region_type *, const char *,
+				    int));
 extern void lang_add_output PARAMS ((const char *, int from_script));
 extern void lang_enter_output_section_statement
   PARAMS ((const char *output_section_statement_name,
@@ -399,7 +402,7 @@
 extern void lang_add_entry PARAMS ((const char *, boolean));
 extern void lang_add_target PARAMS ((const char *));
 extern void lang_add_wild
-  PARAMS ((const char *, boolean, const char *, boolean, boolean, const char *));
+  PARAMS ((const char *, boolean, const char *, boolean, boolean, name_list *));
 extern void lang_add_map PARAMS ((const char *));
 extern void lang_add_fill PARAMS ((int));
 extern lang_assignment_statement_type * lang_add_assignment PARAMS ((union etree_union *));
@@ -407,7 +410,8 @@
 extern void lang_startup PARAMS ((const char *));
 extern void lang_float PARAMS ((enum bfd_boolean));
 extern void lang_leave_output_section_statement
-  PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *));
+  PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
+           const char *));
 extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *));
 extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *,
 						     const char *));
@@ -473,7 +477,8 @@
 extern void lang_leave_overlay_section
   PARAMS ((bfd_vma, struct lang_output_section_phdr_list *));
 extern void lang_leave_overlay
-  PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *));
+  PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
+           const char *));
 
 extern struct bfd_elf_version_tree *lang_elf_version_info;
 
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 1e710db..ba2a592 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -117,7 +117,7 @@
 static void warning_find_reloc PARAMS ((bfd *, asection *, PTR));
 static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
 					 const char *, bfd *,
-					 asection *, bfd_vma));
+					 asection *, bfd_vma, boolean));
 static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
 				       const char *, bfd_vma,
 				       bfd *, asection *, bfd_vma));
@@ -231,7 +231,11 @@
   link_info.notice_hash = NULL;
   link_info.wrap_hash = NULL;
   link_info.mpc860c0 = 0;
-  
+  /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
+     and _fini symbols.  We are compatible.  */
+  link_info.init_function = "_init";
+  link_info.fini_function = "_fini";
+
   ldfile_add_arch ("");
 
   config.make_executable = true;
@@ -701,7 +705,7 @@
 /*ARGSUSED*/
 static boolean
 add_archive_element (info, abfd, name)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      bfd *abfd;
      const char *name;
 {
@@ -816,7 +820,7 @@
 /*ARGSUSED*/
 static boolean
 multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name;
      bfd *obfd;
      asection *osec;
@@ -853,7 +857,7 @@
 /*ARGSUSED*/
 static boolean
 multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name;
      bfd *obfd;
      enum bfd_link_hash_type otype;
@@ -920,7 +924,7 @@
 /*ARGSUSED*/
 static boolean
 add_to_set (info, h, reloc, abfd, section, value)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct bfd_link_hash_entry *h;
      bfd_reloc_code_real_type reloc;
      bfd *abfd;
@@ -1019,7 +1023,7 @@
 /*ARGSUSED*/
 static boolean
 warning_callback (info, warning, symbol, abfd, section, address)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *warning;
      const char *symbol;
      bfd *abfd;
@@ -1140,12 +1144,13 @@
 
 /*ARGSUSED*/
 static boolean
-undefined_symbol (info, name, abfd, section, address)
-     struct bfd_link_info *info;
+undefined_symbol (info, name, abfd, section, address, fatal)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name;
      bfd *abfd;
      asection *section;
      bfd_vma address;
+     boolean fatal;
 {
   static char *error_name;
   static unsigned int error_count;
@@ -1189,8 +1194,12 @@
   if (section != NULL)
     {
       if (error_count < MAX_ERRORS_IN_A_ROW)
-	einfo (_("%X%C: undefined reference to `%T'\n"),
-	       abfd, section, address, name);
+	{
+	  einfo (_("%C: undefined reference to `%T'\n"),
+		 abfd, section, address, name);
+	  if (fatal)
+	    einfo ("%X");
+	}
       else if (error_count == MAX_ERRORS_IN_A_ROW)
 	einfo (_("%D: more undefined references to `%T' follow\n"),
 	       abfd, section, address, name);
@@ -1198,8 +1207,12 @@
   else
     {
       if (error_count < MAX_ERRORS_IN_A_ROW)
-	einfo (_("%X%B: undefined reference to `%T'\n"),
-	       abfd, name);
+	{
+	  einfo (_("%B: undefined reference to `%T'\n"),
+		 abfd, name);
+	  if (fatal)
+	    einfo ("%X");
+	}
       else if (error_count == MAX_ERRORS_IN_A_ROW)
 	einfo (_("%B: more undefined references to `%T' follow\n"),
 	       abfd, name);
@@ -1213,7 +1226,7 @@
 /*ARGSUSED*/
 static boolean
 reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name;
      const char *reloc_name;
      bfd_vma addend;
@@ -1237,7 +1250,7 @@
 /*ARGSUSED*/
 static boolean
 reloc_dangerous (info, message, abfd, section, address)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *message;
      bfd *abfd;
      asection *section;
@@ -1257,7 +1270,7 @@
 /*ARGSUSED*/
 static boolean
 unattached_reloc (info, name, abfd, section, address)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name;
      bfd *abfd;
      asection *section;
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 8fab228..e343944 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -1,5 +1,5 @@
 /* ldmisc.c
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
@@ -213,7 +213,7 @@
 
 	    case 'E':
 	      /* current bfd error or errno */
-	      fprintf (fp, bfd_errmsg (bfd_get_error ()));
+	      fprintf (fp, "%s", bfd_errmsg (bfd_get_error ()));
 	      break;
 
 	    case 'I':
@@ -536,3 +536,22 @@
 {
   fprintf (config.map_file, "\n");
 }
+
+/* A more or less friendly abort message.  In ld.h abort is defined to
+   call this function.  */
+
+void
+ld_abort (file, line, fn)
+     const char *file;
+     int line;
+     const char *fn;
+{
+  if (fn != NULL)
+    einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
+	   file, line, fn);
+  else
+    einfo (_("%P: internal error: aborting at %s line %d\n"),
+	   file, line);
+  einfo (_("%P%F: please report this bug\n"));
+  xexit (1);
+}
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 7ee5087..06a65e1 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -55,6 +55,7 @@
    that might disagree about consts.  */
 unsigned long strtoul ();
 
+static int is_num PARAMS ((const char *, int, int, int));
 static void set_default_dirlist PARAMS ((char *dirlist_ptr));
 static void set_section_start PARAMS ((char *sect, char *valstr));
 static void help PARAMS ((void));
@@ -120,6 +121,8 @@
 #define OPTION_NO_CHECK_SECTIONS	(OPTION_CHECK_SECTIONS + 1)
 #define OPTION_MPC860C0                 (OPTION_NO_CHECK_SECTIONS + 1)
 #define OPTION_NO_UNDEFINED		(OPTION_MPC860C0 + 1)
+#define OPTION_INIT                     (OPTION_NO_UNDEFINED + 1)
+#define OPTION_FINI                     (OPTION_INIT + 1)
 
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
@@ -270,6 +273,8 @@
       '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
   { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
       '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
+  { {"fini", required_argument, NULL, OPTION_FINI},
+     '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
   { {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
       '\0', NULL, N_("Force generation of file with .exe suffix"), TWO_DASHES},
   { {"gc-sections", no_argument, NULL, OPTION_GC_SECTIONS},
@@ -280,6 +285,8 @@
       TWO_DASHES },
   { {"help", no_argument, NULL, OPTION_HELP},
       '\0', NULL, N_("Print option help"), TWO_DASHES },
+  { {"init", required_argument, NULL, OPTION_INIT},
+     '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
   { {"Map", required_argument, NULL, OPTION_MAP},
       '\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
   { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
@@ -341,7 +348,7 @@
       '\0', N_("FILE"), N_("Read version information script"), TWO_DASHES },
   { {"version-exports-section", required_argument, NULL,
      OPTION_VERSION_EXPORTS_SECTION },
-    '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using SYMBOL as the version."),
+    '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n\t\t\t\tSYMBOL as the version."),
     TWO_DASHES },
   { {"warn-common", no_argument, NULL, OPTION_WARN_COMMON},
       '\0', NULL, N_("Warn about duplicate common symbols"), TWO_DASHES },
@@ -360,27 +367,32 @@
   { {"wrap", required_argument, NULL, OPTION_WRAP},
       '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
   { {"mpc860c0", optional_argument, NULL, OPTION_MPC860C0},
-      '\0', N_("[=WORDS]"), N_("Modify problematic branches in last WORDS (1-10, default 5) words of a page"), TWO_DASHES }
+      '\0', N_("[=WORDS]"), N_("Modify problematic branches in last WORDS (1-10,\n\t\t\t\tdefault 5) words of a page"), TWO_DASHES }
 };
 
 #define OPTION_COUNT ((int) (sizeof ld_options / sizeof ld_options[0]))
 
-/* Test "string" for containing a string of digits that form a number
-between "min" and "max".  The return value is the number or "err". */
-static
-int is_num( char *string, int min, int max, int err)
+/* Test STRING for containing a string of digits that form a number
+   between MIN and MAX.  The return value is the number or ERR.  */
+
+static int
+is_num (string, min, max, err)
+     const char *string;
+     int min;
+     int max;
+     int err;
 {
   int result = 0;
 
-  for ( ; *string; ++string)
-  {
-    if (!isdigit(*string))
+  for (; *string; ++string)
     {
-      result = err;
-      break;
+      if (! isdigit (*string))
+	{
+	  result = err;
+	  break;
+	}
+      result = result * 10 + (*string - '0');
     }
-    result = result * 10 + (*string - '0');
-  }
   if (result < min || result > max)
     result = err;
 
@@ -504,6 +516,9 @@
       switch (optc)
 	{
 	default:
+	  fprintf (stderr,
+		   _("%s: use the --help option for usage information\n"),
+		   program_name);
 	  xexit (1);
 	case 1:			/* File name.  */
 	  lang_add_input_file (optarg, lang_input_file_is_file_enum,
@@ -939,7 +954,7 @@
              ignored.  Someday we should handle it correctly.  FIXME.  */
 	  break;
 	case OPTION_SPLIT_BY_RELOC:
-	  config.split_by_reloc = atoi (optarg);
+	  config.split_by_reloc = strtoul (optarg, NULL, 0);
 	  break; 
 	case OPTION_SPLIT_BY_FILE:
 	  config.split_by_file = true;
@@ -981,13 +996,23 @@
               words = is_num (optarg, 1, 10, 0);
               if (words == 0)
                 {
-                  fprintf (stderr, _("Invalid argument to option \"mpc860c0\"\n"));
+                  fprintf (stderr,
+			   _("%s: Invalid argument to option \"mpc860c0\"\n"),
+			   program_name);
                   xexit (1);
                 }
               link_info.mpc860c0 = words * 4;   /* convert words to bytes */
             }
           command_line.relax = true;
           break;
+
+	case OPTION_INIT:
+	  link_info.init_function = optarg;
+	  break;
+	  
+	case OPTION_FINI:
+	  link_info.fini_function = optarg;
+	  break;
 	}
     }
 
@@ -1118,6 +1143,8 @@
 	}
     }
 
+  /* Note: Various tools (such as libtool) depend upon the
+     format of the listings below - do not change them.  */
   /* xgettext:c-format */
   printf (_("%s: supported targets:"), program_name);
   targets = bfd_target_list ();
diff --git a/ld/mri.c b/ld/mri.c
index 54aaea2..d39186c 100644
--- a/ld/mri.c
+++ b/ld/mri.c
@@ -266,7 +266,8 @@
       }
 
       lang_leave_output_section_statement
-	(0, "*default*", (struct lang_output_section_phdr_list *) NULL);
+	(0, "*default*", (struct lang_output_section_phdr_list *) NULL, 
+         "*default*");
 
       p = p->next;
     }
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 6d7306c..6b8b1af 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1,5 +1,5 @@
 /* Routines to help build PEI-format DLLs (Win32 etc)
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Written by DJ Delorie <dj@cygnus.com>
 
    This file is part of GLD, the Gnu Linker.
@@ -38,6 +38,7 @@
 #include "coff/internal.h"
 #include "../bfd/libcoff.h"
 #include "deffile.h"
+#include "pe-dll.h"
 
 /************************************************************************
 
@@ -59,6 +60,8 @@
 int pe_dll_do_default_excludes = 1;
 int pe_dll_kill_ats = 0;
 int pe_dll_stdcall_aliases = 0;
+int pe_dll_warn_dup_exports = 0;
+int pe_dll_compat_implib = 0;
 
 /************************************************************************
 
@@ -71,7 +74,76 @@
 static bfd *filler_bfd;
 static struct sec *edata_s, *reloc_s;
 static unsigned char *edata_d, *reloc_d;
-static int edata_sz, reloc_sz;
+static size_t edata_sz, reloc_sz;
+
+typedef struct {
+  char *target_name;
+  char *object_target;
+  unsigned int imagebase_reloc;
+  int pe_arch;
+  int bfd_arch;
+  int underscored;
+} pe_details_type;
+
+#define PE_ARCH_i386	1
+#define PE_ARCH_sh	2
+#define PE_ARCH_mips	3
+#define PE_ARCH_arm	4
+
+static pe_details_type pe_detail_list[] = {
+  {
+    "pei-i386",
+    "pe-i386",
+    7 /* R_IMAGEBASE */,
+    PE_ARCH_i386,
+    bfd_arch_i386,
+    1
+  },
+  {
+    "pei-shl",
+    "pe-shl",
+    16 /* R_SH_IMAGEBASE */,
+    PE_ARCH_sh,
+    bfd_arch_sh,
+    1
+  },
+  {
+    "pei-mips",
+    "pe-mips",
+    34 /* MIPS_R_RVA */,
+    PE_ARCH_mips,
+    bfd_arch_mips,
+    0
+  },
+  {
+    "pei-arm-little",
+    "pe-arm-little",
+    11 /* ARM_RVA32 */,
+    PE_ARCH_arm,
+    bfd_arch_arm,
+    0
+  },
+  { NULL, NULL, 0, 0, 0, 0 }
+};
+
+static pe_details_type *pe_details;
+
+#define U(str) (pe_details->underscored ? "_" str : str)
+
+void
+pe_dll_id_target (target)
+     const char *target;
+{
+  int i;
+  for (i=0; pe_detail_list[i].target_name; i++)
+    if (strcmp (pe_detail_list[i].target_name, target) == 0)
+      {
+	pe_details = pe_detail_list+i;
+	return;
+      }
+  einfo (_("%XUnsupported PEI architecture: %s\n"), target);
+  exit (1);
+}
 
 /************************************************************************
 
@@ -80,13 +152,19 @@
 
  ************************************************************************/
 
+typedef struct {
+  bfd_vma vma;
+  char type;
+  short extra;
+} reloc_data_type;
+
 static int
 reloc_sort (va, vb)
      const void *va, *vb;
 {
-  bfd_vma a = *(bfd_vma *) va;
-  bfd_vma b = *(bfd_vma *) vb;
-  return (a > b) - (a < b);
+  bfd_vma a = ((reloc_data_type *) va)->vma;
+  bfd_vma b = ((reloc_data_type *) vb)->vma;
+  return (a > b) ? 1 : ((a < b) ? -1 : 0);
 }
 
 static int
@@ -179,7 +257,7 @@
 
 static void
 process_def_file (abfd, info)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
   int i, j;
@@ -289,20 +367,22 @@
     {
       if (i > 0 && strcmp (e[i].name, e[i - 1].name) == 0)
 	{
-	  /* This is a duplicate */
+	  /* This is a duplicate.  */
 	  if (e[j - 1].ordinal != -1
 	      && e[i].ordinal != -1
 	      && e[j - 1].ordinal != e[i].ordinal)
 	    {
-	      /* xgettext:c-format */
-	      einfo (_("%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"),
-		     e[j - 1].name, e[j - 1].ordinal, e[i].ordinal);
+	      if (pe_dll_warn_dup_exports)
+		/* xgettext:c-format */
+		einfo (_("%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"),
+		       e[j - 1].name, e[j - 1].ordinal, e[i].ordinal);
 	    }
 	  else
 	    {
-	      /* xgettext:c-format */
-	      einfo (_("Warning, duplicate EXPORT: %s\n"),
-		     e[j - 1].name);
+	      if (pe_dll_warn_dup_exports)
+		/* xgettext:c-format */
+		einfo (_("Warning, duplicate EXPORT: %s\n"),
+		       e[j - 1].name);
 	    }
 	  if (e[i].ordinal)
 	    e[j - 1].ordinal = e[i].ordinal;
@@ -323,20 +403,34 @@
   for (i = 0; i < NE; i++)
     {
       char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
-      *name = '_';
-      strcpy (name + 1, pe_def_file->exports[i].internal_name);
+      if (pe_details->underscored)
+	{
+	  *name = '_';
+	  strcpy (name + 1, pe_def_file->exports[i].internal_name);
+	}
+      else
+	strcpy (name, pe_def_file->exports[i].internal_name);
 
       blhe = bfd_link_hash_lookup (info->hash,
 				   name,
 				   false, false, true);
 
-      if (blhe && (blhe->type == bfd_link_hash_defined))
+      if (blhe
+          && (blhe->type == bfd_link_hash_defined
+	      || (blhe->type == bfd_link_hash_common)))
 	{
 	  count_exported++;
 	  if (!pe_def_file->exports[i].flag_noname)
 	    count_exported_byname++;
-	  exported_symbol_offsets[i] = blhe->u.def.value;
-	  exported_symbol_sections[i] = blhe->u.def.section;
+
+	  /* Only fill in the sections. The actual offsets are computed
+	     in fill_exported_offsets() after common symbols are laid
+	     out.  */
+          if (blhe->type == bfd_link_hash_defined)
+	    exported_symbol_sections[i] = blhe->u.def.section;
+	  else
+	    exported_symbol_sections[i] = blhe->u.c.p->section;
+	  
 	  if (pe_def_file->exports[i].ordinal != -1)
 	    {
 	      if (max_ordinal < pe_def_file->exports[i].ordinal)
@@ -376,7 +470,8 @@
  ************************************************************************/
 
 static void
-build_filler_bfd ()
+build_filler_bfd (include_edata)
+     int include_edata;
 {
   lang_input_statement_type *filler_file;
   filler_file = lang_add_input_file ("dll stuff",
@@ -392,19 +487,22 @@
       return;
     }
 
-  edata_s = bfd_make_section_old_way (filler_bfd, ".edata");
-  if (edata_s == NULL
-      || !bfd_set_section_flags (filler_bfd, edata_s,
-				 (SEC_HAS_CONTENTS
-				  | SEC_ALLOC
-				  | SEC_LOAD
-				  | SEC_KEEP
-				  | SEC_IN_MEMORY)))
+  if (include_edata)
     {
-      einfo ("%X%P: can not create .edata section: %E\n");
-      return;
+      edata_s = bfd_make_section_old_way (filler_bfd, ".edata");
+      if (edata_s == NULL
+	  || !bfd_set_section_flags (filler_bfd, edata_s,
+				     (SEC_HAS_CONTENTS
+				      | SEC_ALLOC
+				      | SEC_LOAD
+				      | SEC_KEEP
+				      | SEC_IN_MEMORY)))
+	{
+	  einfo ("%X%P: can not create .edata section: %E\n");
+	  return;
+	}
+      bfd_set_section_size (filler_bfd, edata_s, edata_sz);
     }
-  bfd_set_section_size (filler_bfd, edata_s, edata_sz);
 
   reloc_s = bfd_make_section_old_way (filler_bfd, ".reloc");
   if (reloc_s == NULL
@@ -432,7 +530,7 @@
 static void
 generate_edata (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   int i, next_ordinal;
   int name_table_size = 0;
@@ -514,10 +612,44 @@
 	      + name_table_size + strlen (dll_name) + 1);
 }
 
+/* Fill the exported symbol offsets. The preliminary work has already
+   been done in process_def_file().  */
+
+static void
+fill_exported_offsets (abfd, info)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
+{
+  int i;
+  struct bfd_link_hash_entry *blhe;
+  
+  for (i = 0; i < pe_def_file->num_exports; i++)
+    {
+      char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+      if (pe_details->underscored)
+	{
+	  *name = '_';
+	  strcpy (name + 1, pe_def_file->exports[i].internal_name);
+	}
+      else
+	strcpy (name, pe_def_file->exports[i].internal_name);
+
+      blhe = bfd_link_hash_lookup (info->hash,
+				   name,
+				   false, false, true);
+
+      if (blhe && (blhe->type == bfd_link_hash_defined))
+	{
+	  exported_symbol_offsets[i] = blhe->u.def.value;
+        }
+      free (name);
+    }
+}
+
 static void
 fill_edata (abfd, info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   int i, hint;
   unsigned char *edirectory;
@@ -557,6 +689,8 @@
   bfd_put_32 (abfd, ERVA (enameptrs), edata_d + 32);
   bfd_put_32 (abfd, ERVA (eordinals), edata_d + 36);
 
+  fill_exported_offsets (abfd, info);
+
   /* Ok, now for the filling in part */
   hint = 0;
   for (i = 0; i < export_table_size; i++)
@@ -598,7 +732,7 @@
 {
 
   /* for .reloc stuff */
-  bfd_vma *reloc_addresses;
+  reloc_data_type *reloc_data;
   int total_relocs = 0;
   int i;
   unsigned long sec_page = (unsigned long) (-1);
@@ -612,7 +746,7 @@
     for (s = b->sections; s; s = s->next)
       total_relocs += s->reloc_count;
 
-  reloc_addresses = (bfd_vma *) xmalloc (total_relocs * sizeof (bfd_vma));
+  reloc_data = (reloc_data_type *) xmalloc (total_relocs * sizeof (reloc_data_type));
 
   total_relocs = 0;
   bi = 0;
@@ -656,12 +790,41 @@
 	  for (i = 0; i < nrelocs; i++)
 	    {
 	      if (!relocs[i]->howto->pc_relative
-		  && relocs[i]->howto->type != R_IMAGEBASE)
+		  && relocs[i]->howto->type != pe_details->imagebase_reloc)
 		{
-		  switch (relocs[i]->howto->bitsize)
+		  bfd_vma sym_vma;
+		  struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr;
+		  sym_vma = (relocs[i]->addend
+			     + sym->value
+			     + sym->section->vma
+			     + sym->section->output_offset
+			     + sym->section->output_section->vma);
+		  reloc_data[total_relocs].vma = sec_vma + relocs[i]->address;
+		  
+#define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift)
+				    
+		  switch BITS_AND_SHIFT (relocs[i]->howto->bitsize,
+					 relocs[i]->howto->rightshift)
 		    {
-		    case 32:
-		      reloc_addresses[total_relocs++] = sec_vma + relocs[i]->address;
+		    case BITS_AND_SHIFT (32, 0):
+		      reloc_data[total_relocs].type = 3;
+		      total_relocs++;
+		      break;
+		    case BITS_AND_SHIFT (16, 0):
+		      reloc_data[total_relocs].type = 2;
+		      total_relocs++;
+		      break;
+		    case BITS_AND_SHIFT (16, 16):
+		      reloc_data[total_relocs].type = 4;
+		      /* FIXME: we can't know the symbol's right value yet,
+			 but we probably can safely assume that CE will relocate
+			 us in 64k blocks, so leaving it zero is safe.  */
+		      reloc_data[total_relocs].extra = 0;
+		      total_relocs++;
+		      break;
+		    case BITS_AND_SHIFT (26, 2):
+		      reloc_data[total_relocs].type = 5;
+		      total_relocs++;
 		      break;
 		    default:
 		      /* xgettext:c-format */
@@ -682,18 +845,23 @@
      reloc_addresses, which are all suitable for the .reloc section.
      We must now create the new sections. */
 
-  qsort (reloc_addresses, total_relocs, sizeof (bfd_vma), reloc_sort);
+  qsort (reloc_data, total_relocs, sizeof (*reloc_data), reloc_sort);
 
   for (i = 0; i < total_relocs; i++)
     {
-      unsigned long this_page = (reloc_addresses[i] >> 12);
+      unsigned long this_page = (reloc_data[i].vma >> 12);
+      
       if (this_page != sec_page)
 	{
 	  reloc_sz = (reloc_sz + 3) & ~3;	/* 4-byte align */
 	  reloc_sz += 8;
 	  sec_page = this_page;
 	}
+      
       reloc_sz += 2;
+      
+      if (reloc_data[i].type == 4)
+	reloc_sz += 2;
     }
   reloc_sz = (reloc_sz + 3) & ~3;	/* 4-byte align */
 
@@ -705,7 +873,7 @@
   page_count = 0;
   for (i = 0; i < total_relocs; i++)
     {
-      unsigned long rva = reloc_addresses[i] - image_base;
+      unsigned long rva = reloc_data[i].vma - image_base;
       unsigned long this_page = (rva & ~0xfff);
       if (this_page != sec_page)
 	{
@@ -719,8 +887,14 @@
 	  sec_page = this_page;
 	  page_count = 0;
 	}
-      bfd_put_16 (abfd, (rva & 0xfff) + 0x3000, reloc_d + reloc_sz);
+      bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type<<12),
+		  reloc_d + reloc_sz);
       reloc_sz += 2;
+      if (reloc_data[i].type == 4)
+	{
+	  bfd_put_16 (abfd, reloc_data[i].extra, reloc_d + reloc_sz);
+	  reloc_sz += 2;
+	}
       page_count++;
     }
   while (reloc_sz & 3)
@@ -771,7 +945,7 @@
 
 void
 pe_dll_generate_def_file (pe_out_def_filename)
-     char *pe_out_def_filename;
+     const char *pe_out_def_filename;
 {
   int i;
   FILE *out = fopen (pe_out_def_filename, "w");
@@ -1049,19 +1223,25 @@
   tmp_seq++;
 
   abfd = bfd_create (oname, parent);
-  bfd_find_target ("pe-i386", abfd);
+  bfd_find_target (pe_details->object_target, abfd);
   bfd_make_writable (abfd);
 
   bfd_set_format (abfd, bfd_object);
-  bfd_set_arch_mach (abfd, bfd_arch_i386, 0);
+  bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
 
   symptr = 0;
   symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *));
   id2 = quick_section (abfd, ".idata$2", SEC_HAS_CONTENTS, 2);
   id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
   id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
-  quick_symbol (abfd, "__head_", dll_symname, "", id2, BSF_GLOBAL, 0);
-  quick_symbol (abfd, "_", dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
+  quick_symbol (abfd, U("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0);
+  quick_symbol (abfd, U(""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
+
+  /* OK, pay attention here.  I got confused myself looking back at
+     it.  We create a four-byte section to mark the beginning of the
+     list, and we include an offset of 4 in the section, so that the
+     pointer to the list points to the *end* of this section, which is
+     the start of the list of sections from other objects. */
 
   bfd_set_section_size (abfd, id2, 20);
   d2 = (unsigned char *) xmalloc (20);
@@ -1119,18 +1299,18 @@
   tmp_seq++;
 
   abfd = bfd_create (oname, parent);
-  bfd_find_target ("pe-i386", abfd);
+  bfd_find_target (pe_details->object_target, abfd);
   bfd_make_writable (abfd);
 
   bfd_set_format (abfd, bfd_object);
-  bfd_set_arch_mach (abfd, bfd_arch_i386, 0);
+  bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
 
   symptr = 0;
   symtab = (asymbol **) xmalloc (5 * sizeof (asymbol *));
   id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
   id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
   id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2);
-  quick_symbol (abfd, "_", dll_symname, "_iname", id7, BSF_GLOBAL, 0);
+  quick_symbol (abfd, U(""), dll_symname, "_iname", id7, BSF_GLOBAL, 0);
 
   bfd_set_section_size (abfd, id4, 4);
   d4 = (unsigned char *) xmalloc (4);
@@ -1187,6 +1367,31 @@
   0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90
 };
 
+/*
+ *_function:
+ *	mov.l	ip+8,r0
+ *	mov.l	@r0,r0
+ *	jmp	@r0
+ *	nop
+ *	.dw	__imp_function
+ */
+
+static unsigned char jmp_sh_bytes[] = {
+  0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ *_function:
+ *	lui	$t0,<high:__imp_function>
+ *	lw	$t0,<low:__imp_function>
+ *	jr	$t0
+ *	nop
+ */
+
+static unsigned char jmp_mips_bytes[] = {
+  0x00, 0x00, 0x08, 0x3c,  0x00, 0x00, 0x08, 0x8d,
+  0x08, 0x00, 0x00, 0x01,  0x00, 0x00, 0x00, 0x00
+};
 
 static bfd *
 make_one (exp, parent)
@@ -1194,21 +1399,39 @@
      bfd *parent;
 {
   asection *tx, *id7, *id5, *id4, *id6;
-  unsigned char *td, *d7, *d5, *d4, *d6;
+  unsigned char *td, *d7, *d5, *d4, *d6 = NULL;
   int len;
   char *oname;
   bfd *abfd;
+  unsigned char *jmp_bytes = NULL;
+  int jmp_byte_count = 0;
+
+  switch (pe_details->pe_arch)
+    {
+    case PE_ARCH_i386:
+      jmp_bytes = jmp_ix86_bytes;
+      jmp_byte_count = sizeof (jmp_ix86_bytes);
+      break;
+    case PE_ARCH_sh:
+      jmp_bytes = jmp_sh_bytes;
+      jmp_byte_count = sizeof (jmp_sh_bytes);
+      break;
+    case PE_ARCH_mips:
+      jmp_bytes = jmp_mips_bytes;
+      jmp_byte_count = sizeof (jmp_mips_bytes);
+      break;
+    }
 
   oname = (char *) xmalloc (20);
   sprintf (oname, "d%06d.o", tmp_seq);
   tmp_seq++;
 
   abfd = bfd_create (oname, parent);
-  bfd_find_target ("pe-i386", abfd);
+  bfd_find_target (pe_details->object_target, abfd);
   bfd_make_writable (abfd);
 
   bfd_set_format (abfd, bfd_object);
-  bfd_set_arch_mach (abfd, bfd_arch_i386, 0);
+  bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
 
   symptr = 0;
   symtab = (asymbol **) xmalloc (10 * sizeof (asymbol *));
@@ -1217,16 +1440,32 @@
   id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
   id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
   id6 = quick_section (abfd, ".idata$6", SEC_HAS_CONTENTS, 2);
-  quick_symbol (abfd, "_", exp->internal_name, "", tx, BSF_GLOBAL, 0);
-  quick_symbol (abfd, "__head_", dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
-  quick_symbol (abfd, "___imp_", exp->internal_name, "", id5, BSF_GLOBAL, 0);
-  quick_symbol (abfd, "__imp__", exp->internal_name, "", id5, BSF_GLOBAL, 0);
+  if (! exp->flag_data)
+    quick_symbol (abfd, U(""), exp->internal_name, "", tx, BSF_GLOBAL, 0);
+  quick_symbol (abfd, U("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
+  quick_symbol (abfd, U("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
+  if (pe_dll_compat_implib)
+    quick_symbol (abfd, U("__imp_"), exp->internal_name, "", 
+                  id5, BSF_GLOBAL, 0);
 
-  bfd_set_section_size (abfd, tx, 8);
-  td = (unsigned char *) xmalloc (8);
+  bfd_set_section_size (abfd, tx, jmp_byte_count);
+  td = (unsigned char *) xmalloc (jmp_byte_count);
   tx->contents = td;
-  memcpy (td, jmp_ix86_bytes, 8);
-  quick_reloc (abfd, 2, BFD_RELOC_32, 2);
+  memcpy (td, jmp_bytes, jmp_byte_count);
+  switch (pe_details->pe_arch)
+    {
+    case PE_ARCH_i386:
+      quick_reloc (abfd, 2, BFD_RELOC_32, 2);
+      break;
+    case PE_ARCH_sh:
+      quick_reloc (abfd, 8, BFD_RELOC_32, 2);
+      break;
+    case PE_ARCH_mips:
+      quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2);
+      quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */
+      quick_reloc (abfd, 4, BFD_RELOC_LO16, 2);
+      break;
+    }
   save_relocs (tx);
 
   bfd_set_section_size (abfd, id7, 4);
@@ -1289,7 +1528,7 @@
 
   bfd_set_symtab (abfd, symtab, symptr);
 
-  bfd_set_section_contents (abfd, tx, td, 0, 4);
+  bfd_set_section_contents (abfd, tx, td, 0, jmp_byte_count);
   bfd_set_section_contents (abfd, id7, d7, 0, 4);
   bfd_set_section_contents (abfd, id5, d5, 0, 4);
   bfd_set_section_contents (abfd, id4, d4, 0, 4);
@@ -1303,7 +1542,7 @@
 void
 pe_dll_generate_implib (def, impfilename)
      def_file *def;
-     char *impfilename;
+     const char *impfilename;
 {
   int i;
   bfd *ar_head;
@@ -1311,14 +1550,7 @@
   bfd *outarch;
   bfd *head = 0;
 
-  dll_filename = def->name;
-  if (dll_filename == 0)
-    {
-      dll_filename = dll_name;
-      for (i=0; impfilename[i]; i++)
-	if (impfilename[i] == '/' || impfilename[i] == '\\')
-	  dll_filename = impfilename+1;
-    }
+  dll_filename = (def->name) ? def->name : dll_name;
   dll_symname = xstrdup (dll_filename);
   for (i=0; dll_symname[i]; i++)
     if (!isalnum ((unsigned char) dll_symname[i]))
@@ -1344,10 +1576,6 @@
   /* Work out a reasonable size of things to put onto one line. */
 
   ar_head = make_head (outarch);
-  ar_tail = make_tail (outarch);
-
-  if (ar_head == NULL || ar_tail == NULL)
-    return;
 
   for (i = 0; i<def->num_exports; i++)
     {
@@ -1361,6 +1589,11 @@
       def->exports[i].internal_name = internal;
     }
 
+  ar_tail = make_tail (outarch);
+
+  if (ar_head == NULL || ar_tail == NULL)
+    return;
+
   /* Now stick them all into the archive */
 
   ar_head->next = head;
@@ -1403,6 +1636,7 @@
      struct bfd_link_info *link_info;
 {
   def_file_module *module;
+  pe_dll_id_target(bfd_get_target (output_bfd));
 
   if (!pe_def_file)
     return;
@@ -1427,7 +1661,7 @@
 
 	    /* see if we need this import */
 	    char *name = (char *) xmalloc (strlen (pe_def_file->imports[i].internal_name) + 2);
-	    sprintf (name, "_%s", pe_def_file->imports[i].internal_name);
+	    sprintf (name, "%s%s", U(""), pe_def_file->imports[i].internal_name);
 	    blhe = bfd_link_hash_lookup (link_info->hash, name,
 					 false, false, false);
 	    free (name);
@@ -1515,19 +1749,19 @@
 
 boolean
 pe_implied_import_dll (filename)
-     char *filename;
+     const char *filename;
 {
   bfd *dll;
   unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
   unsigned long export_rva, export_size, nsections, secptr, expptr;
   unsigned char *expdata, *erva;
   unsigned long name_rvas, ordinals, nexp, ordbase;
-  char *dll_name;
+  const char *dll_name;
 
   /* No, I can't use bfd here.  kernel32.dll puts its export table in
      the middle of the .rdata section. */
 
-  dll = bfd_openr (filename, "pei-i386");
+  dll = bfd_openr (filename, pe_details->target_name);
   if (!dll)
     {
       einfo ("%Xopen %s: %s\n", filename, bfd_errmsg (bfd_get_error ()));
@@ -1611,10 +1845,20 @@
      bfd *abfd;
      struct bfd_link_info *info;
 {
+  pe_dll_id_target (bfd_get_target (abfd));
   process_def_file (abfd, info);
 
   generate_edata (abfd, info);
-  build_filler_bfd ();
+  build_filler_bfd (1);
+}
+
+void
+pe_exe_build_sections (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+  pe_dll_id_target (bfd_get_target (abfd));
+  build_filler_bfd (0);
 }
 
 void
@@ -1622,6 +1866,7 @@
      bfd *abfd;
      struct bfd_link_info *info;
 {
+  pe_dll_id_target (bfd_get_target (abfd));
   image_base = pe_data (abfd)->pe_opthdr.ImageBase;
 
   generate_reloc (abfd, info);
@@ -1649,3 +1894,31 @@
   edata_s->contents = edata_d;
   reloc_s->contents = reloc_d;
 }
+
+void
+pe_exe_fill_sections (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  pe_dll_id_target (bfd_get_target (abfd));
+  image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+
+  generate_reloc (abfd, info);
+  if (reloc_sz > 0)
+    {
+      bfd_set_section_size (filler_bfd, reloc_s, reloc_sz);
+
+      /* Resize the sections.  */
+      lang_size_sections (stat_ptr->head, abs_output_section,
+			  &stat_ptr->head, 0, (bfd_vma) 0, false);
+
+      /* Redo special stuff.  */
+      ldemul_after_allocation ();
+
+      /* Do the assignments again.  */
+      lang_do_assignments (stat_ptr->head,
+			   abs_output_section,
+			   (fill_type) 0, (bfd_vma) 0);
+    }
+  reloc_s->contents = reloc_d;
+}
diff --git a/ld/pe-dll.h b/ld/pe-dll.h
new file mode 100644
index 0000000..cf9e84a
--- /dev/null
+++ b/ld/pe-dll.h
@@ -0,0 +1,48 @@
+/* pe-dll.h: Header file for routines used to build Windows DLLs.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+   This file is part of GLD, the Gnu Linker.
+
+   GLD 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.
+
+   GLD 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 GLD; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+#ifndef PE_DLL_H
+#define PE_DLL_H
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "deffile.h"
+
+extern def_file *pe_def_file;
+extern int pe_dll_export_everything;
+extern int pe_dll_do_default_excludes;
+extern int pe_dll_kill_ats;
+extern int pe_dll_stdcall_aliases;
+extern int pe_dll_warn_dup_exports;
+extern int pe_dll_compat_implib;
+
+extern void pe_dll_id_target PARAMS ((const char *));
+extern void pe_dll_add_excludes PARAMS ((const char *));
+extern void pe_dll_generate_def_file PARAMS ((const char *));
+extern void pe_dll_generate_implib PARAMS ((def_file *, const char *));
+extern void pe_process_import_defs PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean pe_implied_import_dll PARAMS ((const char *));
+extern void pe_dll_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_dll_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+
+#endif /* PE_DLL_H */
diff --git a/ld/po/POTFILES.in b/ld/po/POTFILES.in
index 468a8a6..f7a614d 100644
--- a/ld/po/POTFILES.in
+++ b/ld/po/POTFILES.in
@@ -1,4 +1,6 @@
 deffile.h
+emultempl/armcoff.em
+emultempl/pe.em
 ld.h
 ldcref.c
 ldctor.c
@@ -21,44 +23,7 @@
 ldwrite.c
 ldwrite.h
 lexsup.c
-mpw-elfmips.c
-mpw-eppcmac.c
-mpw-esh.c
-mpw-idtmips.c
 mri.c
 mri.h
 pe-dll.c
-sysdep.h
-testsuite/ld-cdtest/cdtest-foo.h
-testsuite/ld-elfvers/vers1.c
-testsuite/ld-elfvers/vers15.c
-testsuite/ld-elfvers/vers16.c
-testsuite/ld-elfvers/vers16a.c
-testsuite/ld-elfvers/vers2.c
-testsuite/ld-elfvers/vers3.c
-testsuite/ld-elfvers/vers4.c
-testsuite/ld-elfvers/vers5.c
-testsuite/ld-elfvers/vers6.c
-testsuite/ld-elfvers/vers7.c
-testsuite/ld-elfvers/vers7a.c
-testsuite/ld-elfvers/vers8.c
-testsuite/ld-elfvers/vers9.c
-testsuite/ld-empic/relax1.c
-testsuite/ld-empic/relax2.c
-testsuite/ld-empic/relax3.c
-testsuite/ld-empic/relax4.c
-testsuite/ld-empic/run.c
-testsuite/ld-empic/runtest1.c
-testsuite/ld-empic/runtest2.c
-testsuite/ld-scripts/cross1.c
-testsuite/ld-scripts/cross2.c
-testsuite/ld-scripts/cross3.c
-testsuite/ld-selective/1.c
-testsuite/ld-selective/2.c
-testsuite/ld-sh/sh2.c
-testsuite/ld-shared/main.c
-testsuite/ld-shared/sh1.c
-testsuite/ld-shared/sh2.c
-testsuite/ld-srec/sr1.c
-testsuite/ld-srec/sr2.c
-testsuite/ld-undefined/undefined.c
+pe-dll.h
diff --git a/ld/po/ld.pot b/ld/po/ld.pot
index faaaeb0..c1670e1 100644
--- a/ld/po/ld.pot
+++ b/ld/po/ld.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-02-11 21:00+0000\n"
+"POT-Creation-Date: 2000-02-25 22:20-0500\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,178 +14,210 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: emultempl/armcoff.em:65
+#: emultempl/armcoff.em:69
 msgid "  --support-old-code   Support interworking with old code\n"
 msgstr ""
 
-#: emultempl/armcoff.em:130
+#: emultempl/armcoff.em:70
+msgid "  --thumb-entry=<sym>  Set the entry point to be Thumb symbol <sym>\n"
+msgstr ""
+
+#: emultempl/armcoff.em:139
 #, c-format
 msgid "Errors encountered processing file %s"
 msgstr ""
 
-#: emultempl/pe.em:190
+#: emultempl/armcoff.em:205 emultempl/pe.em:1030
+msgid "%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"
+msgstr ""
+
+#: emultempl/armcoff.em:210 emultempl/pe.em:1035
+msgid "%P: warning: connot find thumb start symbol %s\n"
+msgstr ""
+
+#: emultempl/pe.em:255
 msgid ""
 "  --base_file <basefile>             Generate a base file for relocatable "
 "DLLs\n"
 msgstr ""
 
-#: emultempl/pe.em:191
+#: emultempl/pe.em:256
 msgid ""
 "  --dll                              Set image base to the default for DLLs\n"
 msgstr ""
 
-#: emultempl/pe.em:192
+#: emultempl/pe.em:257
 msgid "  --file-alignment <size>            Set file alignment\n"
 msgstr ""
 
-#: emultempl/pe.em:193
+#: emultempl/pe.em:258
 msgid "  --heap <size>                      Set initial size of the heap\n"
 msgstr ""
 
-#: emultempl/pe.em:194
+#: emultempl/pe.em:259
 msgid ""
 "  --image-base <address>             Set start address of the executable\n"
 msgstr ""
 
-#: emultempl/pe.em:195
+#: emultempl/pe.em:260
 msgid ""
 "  --major-image-version <number>     Set version number of the executable\n"
 msgstr ""
 
-#: emultempl/pe.em:196
+#: emultempl/pe.em:261
 msgid "  --major-os-version <number>        Set minimum required OS version\n"
 msgstr ""
 
-#: emultempl/pe.em:197
+#: emultempl/pe.em:262
 msgid ""
 "  --major-subsystem-version <number> Set minimum required OS subsystem "
 "version\n"
 msgstr ""
 
-#: emultempl/pe.em:198
+#: emultempl/pe.em:263
 msgid ""
 "  --minor-image-version <number>     Set revision number of the executable\n"
 msgstr ""
 
-#: emultempl/pe.em:199
+#: emultempl/pe.em:264
 msgid "  --minor-os-version <number>        Set minimum required OS revision\n"
 msgstr ""
 
-#: emultempl/pe.em:200
+#: emultempl/pe.em:265
 msgid ""
 "  --minor-subsystem-version <number> Set minimum required OS subsystem "
 "revision\n"
 msgstr ""
 
-#: emultempl/pe.em:201
+#: emultempl/pe.em:266
 msgid "  --section-alignment <size>         Set section alignment\n"
 msgstr ""
 
-#: emultempl/pe.em:202
+#: emultempl/pe.em:267
 msgid "  --stack <size>                     Set size of the initial stack\n"
 msgstr ""
 
-#: emultempl/pe.em:203
+#: emultempl/pe.em:268
 msgid ""
 "  --subsystem <name>[:<version>]     Set required OS subsystem [& version]\n"
 msgstr ""
 
-#: emultempl/pe.em:204
+#: emultempl/pe.em:269
 msgid ""
 "  --support-old-code                 Support interworking with old code\n"
 msgstr ""
 
-#: emultempl/pe.em:206
+#: emultempl/pe.em:270
+msgid ""
+"  --thumb-entry=<symbol>             Set the entry point to be Thumb "
+"<symbol>\n"
+msgstr ""
+
+#: emultempl/pe.em:272
 msgid ""
 "  --add-stdcall-alias                Export symbols with and without @nn\n"
 msgstr ""
 
-#: emultempl/pe.em:207
+#: emultempl/pe.em:273
 msgid "  --disable-stdcall-fixup            Don't link _sym to _sym@nn\n"
 msgstr ""
 
-#: emultempl/pe.em:208
+#: emultempl/pe.em:274
 msgid ""
 "  --enable-stdcall-fixup             Link _sym to _sym@nn without warnings\n"
 msgstr ""
 
-#: emultempl/pe.em:209
+#: emultempl/pe.em:275
 msgid ""
 "  --exclude-symbols sym,sym,...      Exclude symbols from automatic export\n"
 msgstr ""
 
-#: emultempl/pe.em:210
+#: emultempl/pe.em:276
 msgid ""
 "  --export-all-symbols               Automatically export all globals to "
 "DLL\n"
 msgstr ""
 
-#: emultempl/pe.em:211
+#: emultempl/pe.em:277
 msgid "  --kill-at                          Remove @nn from exported symbols\n"
 msgstr ""
 
-#: emultempl/pe.em:212
+#: emultempl/pe.em:278
 msgid "  --out-implib <file>                Generate import library\n"
 msgstr ""
 
-#: emultempl/pe.em:213
+#: emultempl/pe.em:279
 msgid ""
 "  --output-def <file>                Generate a .DEF file for the built DLL\n"
 msgstr ""
 
-#: emultempl/pe.em:276
+#: emultempl/pe.em:280
+msgid "  --warn-duplicate-exports           Warn about duplicate exports.\n"
+msgstr ""
+
+#: emultempl/pe.em:281
+msgid ""
+"  --compat-implib                    Create backward compatible import "
+"libs;\n"
+msgstr ""
+
+#: emultempl/pe.em:282
+msgid "                                       create __imp_<SYMBOL> as well.\n"
+msgstr ""
+
+#: emultempl/pe.em:350
 msgid "%P: warning: bad version number in -subsystem option\n"
 msgstr ""
 
-#: emultempl/pe.em:292
+#: emultempl/pe.em:386
 msgid "%P%F: invalid subsystem type %s\n"
 msgstr ""
 
-#: emultempl/pe.em:307
+#: emultempl/pe.em:401
 msgid "%P%F: invalid hex number for PE parameter '%s'\n"
 msgstr ""
 
-#: emultempl/pe.em:325
+#: emultempl/pe.em:419
 msgid "%P%F: strange hex info for PE parameter '%s'\n"
 msgstr ""
 
-#: emultempl/pe.em:364
+#: emultempl/pe.em:458
 #, c-format
 msgid "%s: Can't open base file %s\n"
 msgstr ""
 
-#: emultempl/pe.em:497
+#: emultempl/pe.em:600
 msgid "%P: warning, file alignment > section alignment.\n"
 msgstr ""
 
-#: emultempl/pe.em:567 emultempl/pe.em:593
+#: emultempl/pe.em:670 emultempl/pe.em:696
 #, c-format
 msgid "Warning: resolving %s by linking to %s\n"
 msgstr ""
 
-#: emultempl/pe.em:572 emultempl/pe.em:598
+#: emultempl/pe.em:675 emultempl/pe.em:701
 msgid "Use --enable-stdcall-fixup to disable these warnings\n"
 msgstr ""
 
-#: emultempl/pe.em:573 emultempl/pe.em:599
+#: emultempl/pe.em:676 emultempl/pe.em:702
 msgid "Use --disable-stdcall-fixup to disable these fixups\n"
 msgstr ""
 
-#: emultempl/pe.em:615
+#: emultempl/pe.em:718
 msgid "%F%P: PE operations on non PE file.\n"
 msgstr ""
 
-#: emultempl/pe.em:652
+#: emultempl/pe.em:835
 #, c-format
 msgid "Errors encountered processing file %s\n"
 msgstr ""
 
-#: emultempl/pe.em:675
+#: emultempl/pe.em:858
 #, c-format
 msgid "Errors encountered processing file %s for interworking"
 msgstr ""
 
-#: emultempl/pe.em:730 ldlang.c:1623 ldlang.c:3990 ldlang.c:4024 ldmain.c:978
+#: emultempl/pe.em:913 ldlang.c:1961 ldlang.c:4333 ldlang.c:4367 ldmain.c:996
 msgid "%P%F: bfd_link_hash_lookup failed: %E\n"
 msgstr ""
 
@@ -224,11 +256,11 @@
 msgid "%B%F: could not read symbols; %E\n"
 msgstr ""
 
-#: ldcref.c:445 ldmain.c:1046 ldmain.c:1050
+#: ldcref.c:445 ldmain.c:1064 ldmain.c:1068
 msgid "%B%F: could not read symbols: %E\n"
 msgstr ""
 
-#: ldcref.c:517 ldcref.c:524 ldmain.c:1096 ldmain.c:1103
+#: ldcref.c:517 ldcref.c:524 ldmain.c:1114 ldmain.c:1121
 msgid "%B%F: could not read relocs: %E\n"
 msgstr ""
 
@@ -263,299 +295,328 @@
 "\n"
 msgstr ""
 
-#: ldemul.c:223
+#: ldemul.c:224
 msgid "%S SYSLIB ignored\n"
 msgstr ""
 
-#: ldemul.c:231
+#: ldemul.c:232
 msgid "%S HLL ignored\n"
 msgstr ""
 
-#: ldemul.c:252
+#: ldemul.c:253
 msgid "%P: unrecognised emulation mode: %s\n"
 msgstr ""
 
-#: ldemul.c:253
+#: ldemul.c:254
 msgid "Supported emulations: "
 msgstr ""
 
-#: ldemul.c:297
+#: ldemul.c:298
 msgid "  no emulation specific options.\n"
 msgstr ""
 
-#: ldexp.c:156
+#: ldexp.c:157
 msgid "%F%P: %s uses undefined section %s\n"
 msgstr ""
 
-#: ldexp.c:158
+#: ldexp.c:159
 msgid "%F%P: %s forward reference of section %s\n"
 msgstr ""
 
-#: ldexp.c:270
+#: ldexp.c:271
 msgid "%F%S %% by zero\n"
 msgstr ""
 
-#: ldexp.c:277
+#: ldexp.c:278
 msgid "%F%S / by zero\n"
 msgstr ""
 
-#: ldexp.c:400
+#: ldexp.c:401
 msgid "%X%S: unresolvable symbol `%s' referenced in expression\n"
 msgstr ""
 
-#: ldexp.c:419
+#: ldexp.c:420
 msgid "%F%S: undefined symbol `%s' referenced in expression\n"
 msgstr ""
 
-#: ldexp.c:600
+#: ldexp.c:602
 msgid "%F%S can not PROVIDE assignment to location counter\n"
 msgstr ""
 
-#: ldexp.c:610
+#: ldexp.c:612
 msgid "%F%S invalid assignment to location counter\n"
 msgstr ""
 
-#: ldexp.c:614
+#: ldexp.c:616
 msgid "%F%S assignment to location counter invalid outside of SECTION\n"
 msgstr ""
 
-#: ldexp.c:624
+#: ldexp.c:626
 msgid "%F%S cannot move location counter backwards (from %V to %V)\n"
 msgstr ""
 
-#: ldexp.c:652
+#: ldexp.c:654
 msgid "%P%F:%s: hash creation failed\n"
 msgstr ""
 
-#: ldexp.c:949
+#: ldexp.c:951
 msgid "%F%S nonconstant expression for %s\n"
 msgstr ""
 
-#: ldexp.c:982
+#: ldexp.c:984
 msgid "%F%S non constant expression for %s\n"
 msgstr ""
 
-#: ldfile.c:109
+#: ldfile.c:106
 #, c-format
 msgid "attempt to open %s failed\n"
 msgstr ""
 
-#: ldfile.c:111
+#: ldfile.c:108
 #, c-format
 msgid "attempt to open %s succeeded\n"
 msgstr ""
 
-#: ldfile.c:119
+#: ldfile.c:114
 msgid "%F%P: invalid BFD target `%s'\n"
 msgstr ""
 
-#: ldfile.c:222
+#: ldfile.c:136
+msgid "%P: skipping incompatible %s when searching for %s"
+msgstr ""
+
+#: ldfile.c:227
+msgid "%F%P: cannot open %s for %s: %E\n"
+msgstr ""
+
+#: ldfile.c:230
 msgid "%F%P: cannot open %s: %E\n"
 msgstr ""
 
-#: ldfile.c:239 ldfile.c:254
+#: ldfile.c:250
+msgid "%F%P: cannot find %s\n"
+msgstr ""
+
+#: ldfile.c:268 ldfile.c:283
 #, c-format
 msgid "cannot find script file %s\n"
 msgstr ""
 
-#: ldfile.c:241 ldfile.c:256
+#: ldfile.c:270 ldfile.c:285
 #, c-format
 msgid "opened script file %s\n"
 msgstr ""
 
-#: ldfile.c:299
+#: ldfile.c:328
 msgid "%P%F: cannot open linker script file %s: %E\n"
 msgstr ""
 
-#: ldfile.c:340
+#: ldfile.c:369
 msgid "%P%F: unknown architecture: %s\n"
 msgstr ""
 
-#: ldfile.c:357
+#: ldfile.c:386
 msgid "%P%F: target architecture respecified\n"
 msgstr ""
 
-#: ldfile.c:410
+#: ldfile.c:439
 msgid "%P%F: cannot represent machine `%s'\n"
 msgstr ""
 
-#: ldlang.c:590
+#: ldlang.c:736
 msgid ""
 "\n"
 "Memory Configuration\n"
 "\n"
 msgstr ""
 
-#: ldlang.c:592
+#: ldlang.c:738
 msgid "Name"
 msgstr ""
 
-#: ldlang.c:592
+#: ldlang.c:738
 msgid "Origin"
 msgstr ""
 
-#: ldlang.c:592
+#: ldlang.c:738
 msgid "Length"
 msgstr ""
 
-#: ldlang.c:592
+#: ldlang.c:738
 msgid "Attributes"
 msgstr ""
 
-#: ldlang.c:634
+#: ldlang.c:780
 msgid ""
 "\n"
 "Linker script and memory map\n"
 "\n"
 msgstr ""
 
-#: ldlang.c:651
+#: ldlang.c:797
 msgid "%P%F: Illegal use of `%s' section"
 msgstr ""
 
-#: ldlang.c:661
+#: ldlang.c:807
 msgid "%P%F: output format %s cannot represent section called %s\n"
 msgstr ""
 
-#: ldlang.c:782
+#: ldlang.c:970
 msgid "%P: %B: warning: ignoring duplicate section `%s'\n"
 msgstr ""
 
-#: ldlang.c:796
+#: ldlang.c:973
+msgid "%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"
+msgstr ""
+
+#: ldlang.c:987
 msgid "%P: %B: warning: duplicate section `%s' has different size\n"
 msgstr ""
 
-#: ldlang.c:1223
+#: ldlang.c:1039
+msgid "%P%F: Failed to create hash table\n"
+msgstr ""
+
+#: ldlang.c:1422
 msgid "%B: file not recognized: %E\n"
 msgstr ""
 
-#: ldlang.c:1224
+#: ldlang.c:1423
 msgid "%B: matching formats:"
 msgstr ""
 
-#: ldlang.c:1231
+#: ldlang.c:1430
 msgid "%F%B: file not recognized: %E\n"
 msgstr ""
 
-#: ldlang.c:1284
+#: ldlang.c:1483
 msgid "%F%B: object %B in archive is not object\n"
 msgstr ""
 
-#: ldlang.c:1290 ldlang.c:1302
+#: ldlang.c:1489 ldlang.c:1501
 msgid "%F%B: could not read symbols: %E\n"
 msgstr ""
 
-#: ldlang.c:1418
+#: ldlang.c:1747
+msgid ""
+"%P: warning: could not find any targets that match endianness requirement\n"
+msgstr ""
+
+#: ldlang.c:1759
 msgid "%P%F: target %s not found\n"
 msgstr ""
 
-#: ldlang.c:1420
+#: ldlang.c:1761
 msgid "%P%F: cannot open output file %s: %E\n"
 msgstr ""
 
-#: ldlang.c:1428
+#: ldlang.c:1769
 msgid "%P%F:%s: can not make object file: %E\n"
 msgstr ""
 
-#: ldlang.c:1432
+#: ldlang.c:1773
 msgid "%P%F:%s: can not set architecture: %E\n"
 msgstr ""
 
-#: ldlang.c:1436
+#: ldlang.c:1777
 msgid "%P%F: can not create link hash table: %E\n"
 msgstr ""
 
-#: ldlang.c:1746
+#: ldlang.c:2084
 msgid " load address 0x%V"
 msgstr ""
 
-#: ldlang.c:1875
+#: ldlang.c:2214
 msgid "%W (size before relaxing)\n"
 msgstr ""
 
-#: ldlang.c:1954
+#: ldlang.c:2296
 #, c-format
 msgid "Address of section %s set to "
 msgstr ""
 
-#: ldlang.c:2091
+#: ldlang.c:2445
 #, c-format
 msgid "Fail with %d\n"
 msgstr ""
 
-#: ldlang.c:2320
+#: ldlang.c:2684
 msgid "%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"
 msgstr ""
 
-#: ldlang.c:2372
-msgid "%P%X: Internal error on COFF shared library section %s\n"
-msgstr ""
-
-#: ldlang.c:2413
-msgid "%P: warning: no memory region specified for section `%s'\n"
-msgstr ""
-
-#: ldlang.c:2426
-msgid "%P: warning: changing start of section %s by %u bytes\n"
-msgstr ""
-
-#: ldlang.c:2440
-msgid "%F%S: non constant address expression for section %s\n"
-msgstr ""
-
-#: ldlang.c:2492
+#: ldlang.c:2718
 msgid "%X%P: address 0x%v of %B section %s is not within region %s\n"
 msgstr ""
 
-#: ldlang.c:2500
+#: ldlang.c:2726
 msgid "%X%P: region %s is full (%B section %s)\n"
 msgstr ""
 
-#: ldlang.c:2602
+#: ldlang.c:2775
+msgid "%P%X: Internal error on COFF shared library section %s\n"
+msgstr ""
+
+#: ldlang.c:2816
+msgid "%P: warning: no memory region specified for section `%s'\n"
+msgstr ""
+
+#: ldlang.c:2829
+msgid "%P: warning: changing start of section %s by %u bytes\n"
+msgstr ""
+
+#: ldlang.c:2843
+msgid "%F%S: non constant address expression for section %s\n"
+msgstr ""
+
+#: ldlang.c:2907
+msgid "%X%P: use an absolute load address or a load memory region, not both\n"
+msgstr ""
+
+#: ldlang.c:3020
 msgid "%P%F: can't relax section: %E\n"
 msgstr ""
 
-#: ldlang.c:2763
+#: ldlang.c:3185
 msgid "%F%P: invalid data statement\n"
 msgstr ""
 
-#: ldlang.c:2792
+#: ldlang.c:3222
 msgid "%F%P: invalid reloc statement\n"
 msgstr ""
 
-#: ldlang.c:2926
+#: ldlang.c:3358
 msgid "%P%F:%s: can't set start address\n"
 msgstr ""
 
-#: ldlang.c:2939 ldlang.c:2956
+#: ldlang.c:3371 ldlang.c:3388
 msgid "%P%F: can't set start address\n"
 msgstr ""
 
-#: ldlang.c:2951
+#: ldlang.c:3383
 msgid "%P: warning: cannot find entry symbol %s; defaulting to %V\n"
 msgstr ""
 
-#: ldlang.c:2961
+#: ldlang.c:3393
 msgid "%P: warning: cannot find entry symbol %s; not setting start address\n"
 msgstr ""
 
-#: ldlang.c:3003
+#: ldlang.c:3435
 msgid ""
 "%P: warning: %s architecture of input file `%B' is incompatible with %s "
 "output\n"
 msgstr ""
 
-#: ldlang.c:3021
+#: ldlang.c:3453
 msgid "%E%X: failed to merge target specific data of file %B\n"
 msgstr ""
 
-#: ldlang.c:3106
+#: ldlang.c:3540
 msgid ""
 "\n"
 "Allocating common symbols\n"
 msgstr ""
 
-#: ldlang.c:3107
+#: ldlang.c:3541
 msgid ""
 "Common symbol       size              file\n"
 "\n"
@@ -564,264 +625,284 @@
 #. This message happens when using the
 #. svr3.ifile linker script, so I have
 #. disabled it.
-#: ldlang.c:3196
+#: ldlang.c:3626
 msgid "%P: no [COMMON] command, defaulting to .bss\n"
 msgstr ""
 
-#: ldlang.c:3259
+#: ldlang.c:3686
 msgid "%P%F: invalid syntax in flags\n"
 msgstr ""
 
-#: ldlang.c:3947
+#: ldlang.c:4281
 msgid "%P%Fmultiple STARTUP files\n"
 msgstr ""
 
-#: ldlang.c:4209
+#: ldlang.c:4553
 msgid "%F%P: bfd_record_phdr failed: %E\n"
 msgstr ""
 
-#: ldlang.c:4228
+#: ldlang.c:4572
 msgid "%X%P: section `%s' assigned to non-existent phdr `%s'\n"
 msgstr ""
 
-#: ldlang.c:4497
+#: ldlang.c:4881
+msgid "%X%P: unknown language `%s' in version information\n"
+msgstr ""
+
+#: ldlang.c:4930
 msgid "%X%P: duplicate version tag `%s'\n"
 msgstr ""
 
-#: ldlang.c:4510 ldlang.c:4523
+#: ldlang.c:4943 ldlang.c:4956
 msgid "%X%P: duplicate expression `%s' in version information\n"
 msgstr ""
 
-#: ldlang.c:4560
+#: ldlang.c:4993
 msgid "%X%P: unable to find version dependency `%s'\n"
 msgstr ""
 
-#: ldlang.c:4582
+#: ldlang.c:5015
 msgid "%X%P: unable to read .exports section contents"
 msgstr ""
 
-#: ldmain.c:188
+#: ldmain.c:192
 msgid "%X%P: can't set BFD default target to `%s': %E\n"
 msgstr ""
 
-#: ldmain.c:245
+#: ldmain.c:262
+msgid "%P%F: -r and --mpc860c0 may not be used together\n"
+msgstr ""
+
+#: ldmain.c:264
 msgid "%P%F: --relax and -r may not be used together\n"
 msgstr ""
 
-#: ldmain.c:247
+#: ldmain.c:266
 msgid "%P%F: -r and -shared may not be used together\n"
 msgstr ""
 
-#: ldmain.c:276
+#: ldmain.c:295
 msgid "using internal linker script:\n"
 msgstr ""
 
-#: ldmain.c:295
+#: ldmain.c:314
 msgid "%P%F: no input files\n"
 msgstr ""
 
-#: ldmain.c:300
+#: ldmain.c:319
 msgid "%P: mode %s\n"
 msgstr ""
 
-#: ldmain.c:318
+#: ldmain.c:337
 msgid "%P%F: cannot open map file %s: %E\n"
 msgstr ""
 
-#: ldmain.c:364
+#: ldmain.c:383
 msgid "%P: link errors found, deleting executable `%s'\n"
 msgstr ""
 
-#: ldmain.c:375
+#: ldmain.c:394
 msgid "%F%B: final close failed: %E\n"
 msgstr ""
 
-#: ldmain.c:399
+#: ldmain.c:418
 msgid "%X%P: unable to open for source of copy `%s'\n"
 msgstr ""
 
-#: ldmain.c:401
+#: ldmain.c:420
 msgid "%X%P: unable to open for destination of copy `%s'\n"
 msgstr ""
 
-#: ldmain.c:407
+#: ldmain.c:426
 msgid "%P: Error writing file `%s'\n"
 msgstr ""
 
-#: ldmain.c:413 pe-dll.c:899
+#: ldmain.c:432 pe-dll.c:1085
 #, c-format
 msgid "%P: Error closing file `%s'\n"
 msgstr ""
 
-#: ldmain.c:431
+#: ldmain.c:449
 #, c-format
 msgid "%s: total time in link: %ld.%06ld\n"
 msgstr ""
 
-#: ldmain.c:434
+#: ldmain.c:452
 #, c-format
 msgid "%s: data size %ld\n"
 msgstr ""
 
-#: ldmain.c:475
+#: ldmain.c:493
 msgid "%P%F: missing argument to -m\n"
 msgstr ""
 
-#: ldmain.c:589 ldmain.c:610 ldmain.c:641
+#: ldmain.c:607 ldmain.c:628 ldmain.c:659
 msgid "%P%F: bfd_hash_table_init failed: %E\n"
 msgstr ""
 
-#: ldmain.c:594 ldmain.c:613
+#: ldmain.c:612 ldmain.c:631
 msgid "%P%F: bfd_hash_lookup failed: %E\n"
 msgstr ""
 
-#: ldmain.c:628
+#: ldmain.c:646
 msgid "%X%P: error: duplicate retain-symbols-file\n"
 msgstr ""
 
-#: ldmain.c:672
+#: ldmain.c:690
 msgid "%P%F: bfd_hash_lookup for insertion failed: %E\n"
 msgstr ""
 
-#: ldmain.c:677
+#: ldmain.c:695
 msgid "%P: `-retain-symbols-file' overrides `-s' and `-S'\n"
 msgstr ""
 
-#: ldmain.c:754
+#: ldmain.c:772
 msgid "Archive member included"
 msgstr ""
 
-#: ldmain.c:755
+#: ldmain.c:773
 msgid "because of file (symbol)"
 msgstr ""
 
-#: ldmain.c:827
+#: ldmain.c:845
 msgid "%X%C: multiple definition of `%T'\n"
 msgstr ""
 
-#: ldmain.c:830
+#: ldmain.c:848
 msgid "%D: first defined here\n"
 msgstr ""
 
-#: ldmain.c:859
+#: ldmain.c:877
 msgid "%B: warning: definition of `%T' overriding common\n"
 msgstr ""
 
-#: ldmain.c:862
+#: ldmain.c:880
 msgid "%B: warning: common is here\n"
 msgstr ""
 
-#: ldmain.c:869
+#: ldmain.c:887
 msgid "%B: warning: common of `%T' overridden by definition\n"
 msgstr ""
 
-#: ldmain.c:872
+#: ldmain.c:890
 msgid "%B: warning: defined here\n"
 msgstr ""
 
-#: ldmain.c:879
+#: ldmain.c:897
 msgid "%B: warning: common of `%T' overridden by larger common\n"
 msgstr ""
 
-#: ldmain.c:882
+#: ldmain.c:900
 msgid "%B: warning: larger common is here\n"
 msgstr ""
 
-#: ldmain.c:886
+#: ldmain.c:904
 msgid "%B: warning: common of `%T' overriding smaller common\n"
 msgstr ""
 
-#: ldmain.c:889
+#: ldmain.c:907
 msgid "%B: warning: smaller common is here\n"
 msgstr ""
 
-#: ldmain.c:893
+#: ldmain.c:911
 msgid "%B: warning: multiple common of `%T'\n"
 msgstr ""
 
-#: ldmain.c:895
+#: ldmain.c:913
 msgid "%B: warning: previous common is here\n"
 msgstr ""
 
-#: ldmain.c:917 ldmain.c:956
+#: ldmain.c:935 ldmain.c:974
 msgid "%P: warning: global constructor %s used\n"
 msgstr ""
 
-#: ldmain.c:966
+#: ldmain.c:984
 msgid "%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"
 msgstr ""
 
-#: ldmain.c:1152
+#: ldmain.c:1170
 msgid "%F%P: bfd_hash_table_init failed: %E\n"
 msgstr ""
 
-#: ldmain.c:1159
+#: ldmain.c:1177
 msgid "%F%P: bfd_hash_lookup failed: %E\n"
 msgstr ""
 
-#: ldmain.c:1178
+#: ldmain.c:1196
 msgid "%X%C: undefined reference to `%T'\n"
 msgstr ""
 
-#: ldmain.c:1181
+#: ldmain.c:1199
 msgid "%D: more undefined references to `%T' follow\n"
 msgstr ""
 
-#: ldmain.c:1187
+#: ldmain.c:1205
 msgid "%X%B: undefined reference to `%T'\n"
 msgstr ""
 
-#: ldmain.c:1190
+#: ldmain.c:1208
 msgid "%B: more undefined references to `%T' follow\n"
 msgstr ""
 
-#: ldmain.c:1211 ldmain.c:1233 ldmain.c:1253
+#: ldmain.c:1229 ldmain.c:1251 ldmain.c:1271
 msgid "%P%X: generated"
 msgstr ""
 
-#: ldmain.c:1214
+#: ldmain.c:1232
 msgid " relocation truncated to fit: %s %T"
 msgstr ""
 
-#: ldmain.c:1236
+#: ldmain.c:1254
 #, c-format
 msgid "dangerous relocation: %s\n"
 msgstr ""
 
-#: ldmain.c:1256
+#: ldmain.c:1274
 msgid " reloc refers to symbol `%T' which is not being output\n"
 msgstr ""
 
-#: ldmisc.c:177
+#: ldmisc.c:178
 msgid "no symbol"
 msgstr ""
 
-#: ldmisc.c:239
+#: ldmisc.c:242
 #, c-format
 msgid "built in linker script:%u"
 msgstr ""
 
-#: ldmisc.c:289 ldmisc.c:293
+#: ldmisc.c:292 ldmisc.c:296
 msgid "%B%F: could not read symbols\n"
 msgstr ""
 
 #. We use abfd->filename in this initial line,
 #. in case filename is a .h file or something
 #. similarly unhelpful.
-#: ldmisc.c:329
+#: ldmisc.c:332
 msgid "%B: In function `%T':\n"
 msgstr ""
 
-#: ldmisc.c:461
+#: ldmisc.c:464
 msgid "%F%P: internal error %s %d\n"
 msgstr ""
 
+#: ldmisc.c:550
+msgid "%P: internal error: aborting at %s line %d in %s\n"
+msgstr ""
+
+#: ldmisc.c:553
+msgid "%P: internal error: aborting at %s line %d\n"
+msgstr ""
+
+#: ldmisc.c:555
+msgid "%P%F: please report this bug\n"
+msgstr ""
+
 #: ldver.c:35
 #, c-format
 msgid "GNU ld version %s (with BFD %s)\n"
 msgstr ""
 
-#: ldver.c:42 lexsup.c:829
+#: ldver.c:42 lexsup.c:887
 msgid "  Supported emulations:\n"
 msgstr ""
 
@@ -838,535 +919,585 @@
 msgid "%F%P: final link failed: %E\n"
 msgstr ""
 
-#: lexsup.c:148 lexsup.c:231 lexsup.c:237
+#: lexsup.c:155 lexsup.c:238 lexsup.c:244
 msgid "KEYWORD"
 msgstr ""
 
-#: lexsup.c:148
+#: lexsup.c:155
 msgid "Shared library control for HP/UX compatibility"
 msgstr ""
 
-#: lexsup.c:151
+#: lexsup.c:158
 msgid "ARCH"
 msgstr ""
 
-#: lexsup.c:151
+#: lexsup.c:158
 msgid "Set architecture"
 msgstr ""
 
-#: lexsup.c:153 lexsup.c:290
+#: lexsup.c:160 lexsup.c:307
 msgid "TARGET"
 msgstr ""
 
-#: lexsup.c:153
+#: lexsup.c:160
 msgid "Specify target for following input files"
 msgstr ""
 
-#: lexsup.c:155 lexsup.c:194 lexsup.c:204 lexsup.c:213 lexsup.c:278
-#: lexsup.c:297 lexsup.c:331
+#: lexsup.c:162 lexsup.c:201 lexsup.c:211 lexsup.c:220 lexsup.c:291
+#: lexsup.c:314 lexsup.c:348
 msgid "FILE"
 msgstr ""
 
-#: lexsup.c:155
+#: lexsup.c:162
 msgid "Read MRI format linker script"
 msgstr ""
 
-#: lexsup.c:157
+#: lexsup.c:164
 msgid "Force common symbols to be defined"
 msgstr ""
 
-#: lexsup.c:161 lexsup.c:321 lexsup.c:323 lexsup.c:325
+#: lexsup.c:168 lexsup.c:338 lexsup.c:340 lexsup.c:342
 msgid "ADDRESS"
 msgstr ""
 
-#: lexsup.c:161
+#: lexsup.c:168
 msgid "Set start address"
 msgstr ""
 
-#: lexsup.c:163
+#: lexsup.c:170
 msgid "Export all dynamic symbols"
 msgstr ""
 
-#: lexsup.c:165
+#: lexsup.c:172
 msgid "Link big-endian objects"
 msgstr ""
 
-#: lexsup.c:167
+#: lexsup.c:174
 msgid "Link little-endian objects"
 msgstr ""
 
-#: lexsup.c:169 lexsup.c:172
+#: lexsup.c:176 lexsup.c:179
 msgid "SHLIB"
 msgstr ""
 
-#: lexsup.c:169
+#: lexsup.c:176
 msgid "Auxiliary filter for shared object symbol table"
 msgstr ""
 
-#: lexsup.c:172
+#: lexsup.c:179
 msgid "Filter for shared object symbol table"
 msgstr ""
 
-#: lexsup.c:174
+#: lexsup.c:181
 msgid "Ignored"
 msgstr ""
 
-#: lexsup.c:176
+#: lexsup.c:183
 msgid "SIZE"
 msgstr ""
 
-#: lexsup.c:176
+#: lexsup.c:183
 msgid "Small data size (if no size, same as --shared)"
 msgstr ""
 
-#: lexsup.c:179
+#: lexsup.c:186
 msgid "FILENAME"
 msgstr ""
 
-#: lexsup.c:179
+#: lexsup.c:186
 msgid "Set internal name of shared library"
 msgstr ""
 
-#: lexsup.c:181
+#: lexsup.c:188
 msgid "LIBNAME"
 msgstr ""
 
-#: lexsup.c:181
+#: lexsup.c:188
 msgid "Search for library LIBNAME"
 msgstr ""
 
-#: lexsup.c:183
+#: lexsup.c:190
 msgid "DIRECTORY"
 msgstr ""
 
-#: lexsup.c:183
+#: lexsup.c:190
 msgid "Add DIRECTORY to library search path"
 msgstr ""
 
-#: lexsup.c:185
+#: lexsup.c:192
 msgid "EMULATION"
 msgstr ""
 
-#: lexsup.c:185
+#: lexsup.c:192
 msgid "Set emulation"
 msgstr ""
 
-#: lexsup.c:187
+#: lexsup.c:194
 msgid "Print map file on standard output"
 msgstr ""
 
-#: lexsup.c:189
+#: lexsup.c:196
 msgid "Do not page align data"
 msgstr ""
 
-#: lexsup.c:191
+#: lexsup.c:198
 msgid "Do not page align data, do not make text readonly"
 msgstr ""
 
-#: lexsup.c:194
+#: lexsup.c:201
 msgid "Set output file name"
 msgstr ""
 
-#: lexsup.c:196
+#: lexsup.c:203
 msgid "Optimize output file"
 msgstr ""
 
-#: lexsup.c:198
+#: lexsup.c:205
 msgid "Ignored for SVR4 compatibility"
 msgstr ""
 
-#: lexsup.c:200
+#: lexsup.c:207
 msgid "Generate relocateable output"
 msgstr ""
 
-#: lexsup.c:204
+#: lexsup.c:211
 msgid "Just link symbols (if directory, same as --rpath)"
 msgstr ""
 
-#: lexsup.c:207
+#: lexsup.c:214
 msgid "Strip all symbols"
 msgstr ""
 
-#: lexsup.c:209
+#: lexsup.c:216
 msgid "Strip debugging symbols"
 msgstr ""
 
-#: lexsup.c:211
+#: lexsup.c:218
 msgid "Trace file opens"
 msgstr ""
 
-#: lexsup.c:213
+#: lexsup.c:220
 msgid "Read linker script"
 msgstr ""
 
-#: lexsup.c:215 lexsup.c:227 lexsup.c:317 lexsup.c:334 lexsup.c:351
+#: lexsup.c:222 lexsup.c:234 lexsup.c:277 lexsup.c:289 lexsup.c:334
+#: lexsup.c:351 lexsup.c:368
 msgid "SYMBOL"
 msgstr ""
 
-#: lexsup.c:215
+#: lexsup.c:222
 msgid "Start with undefined reference to SYMBOL"
 msgstr ""
 
-#: lexsup.c:217
+#: lexsup.c:224
 msgid "Build global constructor/destructor tables"
 msgstr ""
 
-#: lexsup.c:219
+#: lexsup.c:226
 msgid "Print version information"
 msgstr ""
 
-#: lexsup.c:221
+#: lexsup.c:228
 msgid "Print version and emulation information"
 msgstr ""
 
-#: lexsup.c:223
+#: lexsup.c:230
 msgid "Discard all local symbols"
 msgstr ""
 
-#: lexsup.c:225
+#: lexsup.c:232
 msgid "Discard temporary local symbols"
 msgstr ""
 
-#: lexsup.c:227
+#: lexsup.c:234
 msgid "Trace mentions of SYMBOL"
 msgstr ""
 
-#: lexsup.c:229 lexsup.c:299 lexsup.c:301
+#: lexsup.c:236 lexsup.c:316 lexsup.c:318
 msgid "PATH"
 msgstr ""
 
-#: lexsup.c:229
+#: lexsup.c:236
 msgid "Default search path for Solaris compatibility"
 msgstr ""
 
-#: lexsup.c:231
+#: lexsup.c:238
 msgid "Ignored for Solaris compatibility"
 msgstr ""
 
-#: lexsup.c:233
+#: lexsup.c:240
 msgid "Start a group"
 msgstr ""
 
-#: lexsup.c:235
+#: lexsup.c:242
 msgid "End a group"
 msgstr ""
 
-#: lexsup.c:237
+#: lexsup.c:244
 msgid "Ignored for SunOS compatibility"
 msgstr ""
 
-#: lexsup.c:239
+#: lexsup.c:246
 msgid "Link against shared libraries"
 msgstr ""
 
-#: lexsup.c:245
+#: lexsup.c:252
 msgid "Do not link against shared libraries"
 msgstr ""
 
-#: lexsup.c:253
+#: lexsup.c:260
 msgid "Bind global references locally"
 msgstr ""
 
-#: lexsup.c:255
+#: lexsup.c:262
 msgid "Check section addresses for overlaps (default)"
 msgstr ""
 
-#: lexsup.c:257
+#: lexsup.c:264
 msgid "Do not check section addresses for overlaps"
 msgstr ""
 
-#: lexsup.c:260
+#: lexsup.c:267
 msgid "Output cross reference table"
 msgstr ""
 
-#: lexsup.c:262
+#: lexsup.c:269
 msgid "SYMBOL=EXPRESSION"
 msgstr ""
 
-#: lexsup.c:262
+#: lexsup.c:269
 msgid "Define a symbol"
 msgstr ""
 
-#: lexsup.c:264
-msgid "PROGRAM"
-msgstr ""
-
-#: lexsup.c:264
-msgid "Set the dynamic linker to use"
-msgstr ""
-
-#: lexsup.c:266
-msgid "Generate embedded relocs"
-msgstr ""
-
-#: lexsup.c:268
-msgid "Force generation of file with .exe suffix"
-msgstr ""
-
-#: lexsup.c:270
-msgid "Remove unused sections (on some targets)"
+#: lexsup.c:271
+msgid "Demangle symbol names"
 msgstr ""
 
 #: lexsup.c:273
-msgid "Don't remove unused sections (default)"
+msgid "PROGRAM"
 msgstr ""
 
-#: lexsup.c:276
-msgid "Print option help"
+#: lexsup.c:273
+msgid "Set the dynamic linker to use"
 msgstr ""
 
-#: lexsup.c:278
-msgid "Write a map file"
+#: lexsup.c:275
+msgid "Generate embedded relocs"
 msgstr ""
 
-#: lexsup.c:280
-msgid "Use less memory and more disk I/O"
+#: lexsup.c:277
+msgid "Call SYMBOL at unload-time"
 msgstr ""
 
-#: lexsup.c:282
-msgid "Don't warn about mismatched input files"
+#: lexsup.c:279
+msgid "Force generation of file with .exe suffix"
+msgstr ""
+
+#: lexsup.c:281
+msgid "Remove unused sections (on some targets)"
 msgstr ""
 
 #: lexsup.c:284
-msgid "Turn off --whole-archive"
+msgid "Don't remove unused sections (default)"
 msgstr ""
 
-#: lexsup.c:286
-msgid "Create an output file even if errors occur"
+#: lexsup.c:287
+msgid "Print option help"
 msgstr ""
 
-#: lexsup.c:290
-msgid "Specify target of output file"
+#: lexsup.c:289
+msgid "Call SYMBOL at load-time"
 msgstr ""
 
-#: lexsup.c:292
-msgid "Ignored for Linux compatibility"
+#: lexsup.c:291
+msgid "Write a map file"
 msgstr ""
 
-#: lexsup.c:294
-msgid "Relax branches on certain targets"
+#: lexsup.c:293
+msgid "Do not demangle symbol names"
+msgstr ""
+
+#: lexsup.c:295
+msgid "Use less memory and more disk I/O"
 msgstr ""
 
 #: lexsup.c:297
-msgid "Keep only symbols listed in FILE"
+msgid "Allow no undefined symbols"
 msgstr ""
 
 #: lexsup.c:299
-msgid "Set runtime shared library search path"
+msgid "Don't warn about mismatched input files"
 msgstr ""
 
 #: lexsup.c:301
-msgid "Set link time shared library search path"
+msgid "Turn off --whole-archive"
 msgstr ""
 
 #: lexsup.c:303
-msgid "Create a shared library"
+msgid "Create an output file even if errors occur"
 msgstr ""
 
 #: lexsup.c:307
-msgid "Sort common symbols by size"
+msgid "Specify target of output file"
+msgstr ""
+
+#: lexsup.c:309
+msgid "Ignored for Linux compatibility"
 msgstr ""
 
 #: lexsup.c:311
+msgid "Relax branches on certain targets"
+msgstr ""
+
+#: lexsup.c:314
+msgid "Keep only symbols listed in FILE"
+msgstr ""
+
+#: lexsup.c:316
+msgid "Set runtime shared library search path"
+msgstr ""
+
+#: lexsup.c:318
+msgid "Set link time shared library search path"
+msgstr ""
+
+#: lexsup.c:320
+msgid "Create a shared library"
+msgstr ""
+
+#: lexsup.c:324
+msgid "Sort common symbols by size"
+msgstr ""
+
+#: lexsup.c:328
 msgid "Split output sections for each file"
 msgstr ""
 
-#: lexsup.c:313
+#: lexsup.c:330
 msgid "COUNT"
 msgstr ""
 
-#: lexsup.c:313
+#: lexsup.c:330
 msgid "Split output sections every COUNT relocs"
 msgstr ""
 
-#: lexsup.c:315
+#: lexsup.c:332
 msgid "Print memory usage statistics"
 msgstr ""
 
-#: lexsup.c:317
+#: lexsup.c:334
 msgid "Do task level linking"
 msgstr ""
 
-#: lexsup.c:319
+#: lexsup.c:336
 msgid "Use same format as native linker"
 msgstr ""
 
-#: lexsup.c:321
+#: lexsup.c:338
 msgid "Set address of .bss section"
 msgstr ""
 
-#: lexsup.c:323
+#: lexsup.c:340
 msgid "Set address of .data section"
 msgstr ""
 
-#: lexsup.c:325
+#: lexsup.c:342
 msgid "Set address of .text section"
 msgstr ""
 
-#: lexsup.c:327
+#: lexsup.c:344
 msgid "Output lots of information during link"
 msgstr ""
 
-#: lexsup.c:331
+#: lexsup.c:348
 msgid "Read version information script"
 msgstr ""
 
-#: lexsup.c:334
-msgid "Take export symbols list from .exports, using SYMBOL as the version."
+#: lexsup.c:351
+msgid ""
+"Take export symbols list from .exports, using\n"
+"\t\t\t\tSYMBOL as the version."
 msgstr ""
 
-#: lexsup.c:337
+#: lexsup.c:354
 msgid "Warn about duplicate common symbols"
 msgstr ""
 
-#: lexsup.c:339
+#: lexsup.c:356
 msgid "Warn if global constructors/destructors are seen"
 msgstr ""
 
-#: lexsup.c:342
+#: lexsup.c:359
 msgid "Warn if the multiple GP values are used"
 msgstr ""
 
-#: lexsup.c:344
+#: lexsup.c:361
 msgid "Warn only once per undefined symbol"
 msgstr ""
 
-#: lexsup.c:346
+#: lexsup.c:363
 msgid "Warn if start of section changes due to alignment"
 msgstr ""
 
-#: lexsup.c:349
+#: lexsup.c:366
 msgid "Include all objects from following archives"
 msgstr ""
 
-#: lexsup.c:351
+#: lexsup.c:368
 msgid "Use wrapper functions for SYMBOL"
 msgstr ""
 
-#: lexsup.c:491
+#: lexsup.c:370
+msgid "[=WORDS]"
+msgstr ""
+
+#: lexsup.c:370
+msgid ""
+"Modify problematic branches in last WORDS (1-10,\n"
+"\t\t\t\tdefault 5) words of a page"
+msgstr ""
+
+#: lexsup.c:520
+#, c-format
+msgid "%s: use the --help option for usage information\n"
+msgstr ""
+
+#: lexsup.c:540
 msgid "%P%F: unrecognized -a option `%s'\n"
 msgstr ""
 
-#: lexsup.c:504
+#: lexsup.c:553
 msgid "%P%F: unrecognized -assert option `%s'\n"
 msgstr ""
 
-#: lexsup.c:592
+#: lexsup.c:644
 msgid "%P%F: invalid number `%s'\n"
 msgstr ""
 
-#: lexsup.c:758
+#: lexsup.c:816
 msgid "%P%F: -shared not supported\n"
 msgstr ""
 
-#: lexsup.c:822
+#: lexsup.c:880
 msgid "Copyright 1997 Free Software Foundation, Inc.\n"
 msgstr ""
 
-#: lexsup.c:823
+#: lexsup.c:881
 msgid ""
 "This program is free software; you may redistribute it under the terms of\n"
 "the GNU General Public License.  This program has absolutely no warranty.\n"
 msgstr ""
 
-#: lexsup.c:914
+#: lexsup.c:972
 #, c-format
 msgid "%s: may not nest groups (--help for usage)\n"
 msgstr ""
 
-#: lexsup.c:925
+#: lexsup.c:983
 #, c-format
 msgid "%s: group ended before it began (--help for usage)\n"
 msgstr ""
 
-#: lexsup.c:973
+#: lexsup.c:1000
+#, c-format
+msgid "%s: Invalid argument to option \"mpc860c0\"\n"
+msgstr ""
+
+#: lexsup.c:1056
 msgid "%P%F: invalid hex number `%s'\n"
 msgstr ""
 
-#: lexsup.c:985
+#: lexsup.c:1068
 #, c-format
 msgid "Usage: %s [options] file...\n"
 msgstr ""
 
-#: lexsup.c:987
+#: lexsup.c:1070
 msgid "Options:\n"
 msgstr ""
 
-#: lexsup.c:1064
+#. Note: Various tools (such as libtool) depend upon the
+#. format of the listings below - do not change them.
+#: lexsup.c:1149
 #, c-format
 msgid "%s: supported targets:"
 msgstr ""
 
-#: lexsup.c:1072
+#: lexsup.c:1157
 #, c-format
 msgid "%s: supported emulations: "
 msgstr ""
 
-#: lexsup.c:1077
+#: lexsup.c:1162
 #, c-format
 msgid "%s: emulation specific options:\n"
 msgstr ""
 
-#: lexsup.c:1081
+#: lexsup.c:1166
 msgid ""
 "\n"
 "Report bugs to bug-gnu-utils@gnu.org\n"
 msgstr ""
 
-#: mri.c:342
+#: mri.c:343
 msgid "%P%F: unknown format type %s\n"
 msgstr ""
 
-#: pe-dll.c:294
+#: pe-dll.c:144
+#, c-format
+msgid "%XUnsupported PEI architecture: %s\n"
+msgstr ""
+
+#: pe-dll.c:377
 #, c-format
 msgid "%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"
 msgstr ""
 
-#: pe-dll.c:300
+#: pe-dll.c:384
 #, c-format
 msgid "Warning, duplicate EXPORT: %s\n"
 msgstr ""
 
-#: pe-dll.c:348
+#: pe-dll.c:446
 #, c-format
 msgid "%XCannot export %s: symbol not defined\n"
 msgstr ""
 
-#: pe-dll.c:354
+#: pe-dll.c:452
 #, c-format
 msgid "%XCannot export %s: symbol wrong type (%d vs %d)\n"
 msgstr ""
 
-#: pe-dll.c:361
+#: pe-dll.c:459
 #, c-format
 msgid "%XCannot export %s: symbol not found\n"
 msgstr ""
 
-#: pe-dll.c:482
+#: pe-dll.c:584
 #, c-format
 msgid "%XError, oridinal used twice: %d (%s vs %s)\n"
 msgstr ""
 
-#: pe-dll.c:664
+#: pe-dll.c:834
 #, c-format
 msgid "%XError: %d-bit reloc in dll\n"
 msgstr ""
 
-#: pe-dll.c:773
+#: pe-dll.c:958
 #, c-format
 msgid "%s: Can't open output def file %s\n"
 msgstr ""
 
-#: pe-dll.c:894
+#: pe-dll.c:1080
 msgid "; no contents available\n"
 msgstr ""
 
-#: pe-dll.c:1326
+#: pe-dll.c:1569
 #, c-format
 msgid "%XCan't open .lib file: %s\n"
 msgstr ""
 
-#: pe-dll.c:1331
+#: pe-dll.c:1574
 #, c-format
 msgid "Creating library file: %s\n"
 msgstr ""
diff --git a/ld/scripttempl/armcoff.sc b/ld/scripttempl/armcoff.sc
index 8e07169..9f9cd7c 100644
--- a/ld/scripttempl/armcoff.sc
+++ b/ld/scripttempl/armcoff.sc
@@ -7,7 +7,7 @@
   fi
 fi
 cat <<EOF
-OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}")
 ${LIB_SEARCH_DIRS}
 
 ENTRY(${ENTRY})
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index e1fea97..ccc4b91 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -8,6 +8,7 @@
 #	OTHER_TEXT_SECTIONS - these get put in .text when relocating
 #	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
 #		(e.g., .PARISC.global)
+#	OTHER_BSS_SECTIONS - other than .bss .sbss ...
 #	OTHER_SECTIONS - at the end
 #	EXECUTABLE_SYMBOLS - symbols that must be defined for an
 #		executable (e.g., _DYNAMIC_LINK)
@@ -25,6 +26,11 @@
 #	SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
 #		start address of shared library.
 #	INPUT_FILES - INPUT command of files to always include
+#	WRITABLE_RODATA - if set, the .rodata section should be writable
+#	INIT_START, INIT_END -  statements just before and just after
+# 	combination of .init sections.
+#	FINI_START, FINI_END - statements just before and just after
+# 	combination of .fini sections.
 #
 # When adding sections, do note that the names of some sections are used
 # when specifying the start address of the next.
@@ -40,7 +46,7 @@
 INTERP=".interp   ${RELOCATING-0} : { *(.interp) 	}"
 PLT=".plt    ${RELOCATING-0} : { *(.plt)	}"
 DYNAMIC=".dynamic     ${RELOCATING-0} : { *(.dynamic) }"
-
+RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r*)} }"
 CTOR=".ctors ${CONSTRUCTING-0} : 
   {
     ${CONSTRUCTING+${CTOR_START}}
@@ -61,7 +67,7 @@
        The .ctor section from the crtend file contains the
        end of ctors marker and it must be last */
 
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .ctors))
     KEEP (*(SORT(.ctors.*)))
     KEEP (*(.ctors))
     ${CONSTRUCTING+${CTOR_END}}
@@ -71,7 +77,7 @@
   {
     ${CONSTRUCTING+${DTOR_START}}
     KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
     KEEP (*(SORT(.dtors.*)))
     KEEP (*(.dtors))
     ${CONSTRUCTING+${DTOR_END}}
@@ -114,6 +120,9 @@
   .gnu.version ${RELOCATING-0} : { *(.gnu.version)	}
   .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)	}
   .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)	}
+
+  .rel.init    ${RELOCATING-0} : { *(.rel.init)	}
+  .rela.init   ${RELOCATING-0} : { *(.rela.init)	}
   .rel.text    ${RELOCATING-0} :
     {
       *(.rel.text)
@@ -126,18 +135,8 @@
       ${RELOCATING+*(.rela.text.*)}
       ${RELOCATING+*(.rela.gnu.linkonce.t*)}
     }
-  .rel.data    ${RELOCATING-0} :
-    {
-      *(.rel.data)
-      ${RELOCATING+*(.rel.data.*)}
-      ${RELOCATING+*(.rel.gnu.linkonce.d*)}
-    }
-  .rela.data   ${RELOCATING-0} :
-    {
-      *(.rela.data)
-      ${RELOCATING+*(.rela.data.*)}
-      ${RELOCATING+*(.rela.gnu.linkonce.d*)}
-    }
+  .rel.fini    ${RELOCATING-0} : { *(.rel.fini)	}
+  .rela.fini   ${RELOCATING-0} : { *(.rela.fini)	}
   .rel.rodata  ${RELOCATING-0} :
     {
       *(.rel.rodata)
@@ -150,21 +149,53 @@
       ${RELOCATING+*(.rela.rodata.*)}
       ${RELOCATING+*(.rela.gnu.linkonce.r*)}
     }
-  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
-  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
+  ${OTHER_READONLY_RELOC_SECTIONS}
+  .rel.data    ${RELOCATING-0} :
+    {
+      *(.rel.data)
+      ${RELOCATING+*(.rel.data.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.d*)}
+    }
+  .rela.data   ${RELOCATING-0} :
+    {
+      *(.rela.data)
+      ${RELOCATING+*(.rela.data.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.d*)}
+    }
   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)	}
   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)	}
   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)	}
   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)	}
-  .rel.init    ${RELOCATING-0} : { *(.rel.init)	}
-  .rela.init   ${RELOCATING-0} : { *(.rela.init)	}
-  .rel.fini    ${RELOCATING-0} : { *(.rel.fini)	}
-  .rela.fini   ${RELOCATING-0} : { *(.rela.fini)	}
+  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
+  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
+  ${OTHER_GOT_RELOC_SECTIONS}
+  .rel.sdata   ${RELOCATING-0} :
+    {
+      *(.rel.sdata)
+      ${RELOCATING+*(.rel.sdata.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.s*)}
+    }
+  .rela.sdata   ${RELOCATING-0} :
+    {
+      *(.rela.sdata)
+      ${RELOCATING+*(.rela.sdata.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.s*)}
+    }
+  .rel.sbss    ${RELOCATING-0} : { *(.rel.sbss)		}
+  .rela.sbss   ${RELOCATING-0} : { *(.rela.sbss)	}
   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)		}
-  .init        ${RELOCATING-0} : { KEEP (*(.init))	} =${NOP-0}
+  ${OTHER_PLT_RELOC_SECTIONS}
+
+  .init        ${RELOCATING-0} : 
+  { 
+    ${INIT_START}
+    KEEP (*(.init))
+    ${INIT_END}
+  } =${NOP-0}
+
   ${DATA_PLT-${PLT}}
   .text    ${RELOCATING-0} :
   {
@@ -179,13 +210,13 @@
   } =${NOP-0}
   ${RELOCATING+_etext = .;}
   ${RELOCATING+PROVIDE (etext = .);}
-  .fini    ${RELOCATING-0} : { KEEP (*(.fini))		} =${NOP-0}
-  .rodata  ${RELOCATING-0} :
+  .fini    ${RELOCATING-0} :
   {
-    *(.rodata)
-    ${RELOCATING+*(.rodata.*)}
-    ${RELOCATING+*(.gnu.linkonce.r*)}
-  }
+    ${FINI_START}
+    KEEP (*(.fini))
+    ${FINI_END}
+  } =${NOP-0}
+  ${WRITABLE_RODATA-${RODATA}}
   .rodata1 ${RELOCATING-0} : { *(.rodata1) }
   ${RELOCATING+${OTHER_READONLY_SECTIONS}}
 
@@ -205,6 +236,7 @@
   .data1 ${RELOCATING-0} : { *(.data1) }
   .eh_frame : { *(.eh_frame) }
   .gcc_except_table : { *(.gcc_except_table) }
+  ${WRITABLE_RODATA+${RODATA}}
   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
   ${RELOCATING+${CTOR}}
   ${RELOCATING+${DTOR}}
@@ -215,25 +247,39 @@
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */
-  .sdata   ${RELOCATING-0} : { *(.sdata) *(.sdata.*) }
+  .sdata   ${RELOCATING-0} : 
+  {
+    ${RELOCATING+${SDATA_START_SYMBOLS}}
+    *(.sdata) 
+    ${RELOCATING+*(.sdata.*)}
+    ${RELOCATING+*(.gnu.linkonce.s.*)}
+  }
   ${RELOCATING+${OTHER_GOT_SECTIONS}}
-  ${RELOCATING+_edata  =  .;}
+  ${RELOCATING+_edata = .;}
   ${RELOCATING+PROVIDE (edata = .);}
   ${RELOCATING+__bss_start = .;}
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
-  .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
+  .sbss    ${RELOCATING-0} :
+  {
+    *(.dynsbss)
+    *(.sbss)
+    ${RELOCATING+*(.sbss.*)}
+    *(.scommon)
+  }
   .bss     ${RELOCATING-0} :
   {
    *(.dynbss)
    *(.bss)
+   ${RELOCATING+*(.bss.*)}
    *(COMMON)
    /* Align here to ensure that the .bss section occupies space up to
       _end.  Align after .bss to ensure correct alignment even if the
       .bss section disappears because there are no input sections.  */
    ${RELOCATING+. = ALIGN(${ALIGNMENT});}
   }
+  ${RELOCATING+${OTHER_BSS_SECTIONS}}
   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
-  ${RELOCATING+_end = . ;}
+  ${RELOCATING+_end = .;}
   ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
   ${RELOCATING+PROVIDE (end = .);}
 
diff --git a/ld/scripttempl/elf32avr.sc b/ld/scripttempl/elf32avr.sc
new file mode 100644
index 0000000..51b6512
--- /dev/null
+++ b/ld/scripttempl/elf32avr.sc
@@ -0,0 +1,149 @@
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+
+MEMORY
+{
+  text   (rx)   : ORIGIN = 0,    LENGTH = $TEXT_LENGTH
+  data   (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
+  eeprom (rw!x) : ORIGIN = 0,    LENGTH = $EEPROM_LENGTH
+}
+
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  ${TEXT_DYNAMIC+${DYNAMIC}}
+  .hash        ${RELOCATING-0} : { *(.hash)		}
+  .dynsym      ${RELOCATING-0} : { *(.dynsym)		}
+  .dynstr      ${RELOCATING-0} : { *(.dynstr)		}
+  .gnu.version ${RELOCATING-0} : { *(.gnu.version)	}
+  .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)	}
+  .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)	}
+
+  .rel.init    ${RELOCATING-0} : { *(.rel.init)	}
+  .rela.init   ${RELOCATING-0} : { *(.rela.init)	}
+  .rel.text    ${RELOCATING-0} :
+    {
+      *(.rel.text)
+      ${RELOCATING+*(.rel.text.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.t*)}
+    }
+  .rela.text   ${RELOCATING-0} :
+    {
+      *(.rela.text)
+      ${RELOCATING+*(.rela.text.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.t*)}
+    }
+  .rel.fini    ${RELOCATING-0} : { *(.rel.fini)	}
+  .rela.fini   ${RELOCATING-0} : { *(.rela.fini)	}
+  .rel.rodata  ${RELOCATING-0} :
+    {
+      *(.rel.rodata)
+      ${RELOCATING+*(.rel.rodata.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.r*)}
+    }
+  .rela.rodata ${RELOCATING-0} :
+    {
+      *(.rela.rodata)
+      ${RELOCATING+*(.rela.rodata.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.r*)}
+    }
+  .rel.data    ${RELOCATING-0} :
+    {
+      *(.rel.data)
+      ${RELOCATING+*(.rel.data.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.d*)}
+    }
+  .rela.data   ${RELOCATING-0} :
+    {
+      *(.rela.data)
+      ${RELOCATING+*(.rela.data.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.d*)}
+    }
+  .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)	}
+  .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)	}
+  .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)	}
+  .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)	}
+  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
+  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
+  .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
+  .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
+  .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
+  .rela.plt    ${RELOCATING-0} : { *(.rela.plt)		}
+
+  /* Internal text space or external memory */
+  .text :
+  {
+    *(.init)
+    *(.progmem.gcc*)
+    *(.progmem*)
+    ${RELOCATING+. = ALIGN(2);}
+    *(.text)
+    ${RELOCATING+. = ALIGN(2);}
+    *(.text.*)
+    ${RELOCATING+. = ALIGN(2);}
+    *(.fini)
+    ${RELOCATING+ _etext = . ; }
+  } ${RELOCATING+ > text}
+
+  .data	${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))}
+  {
+    *(.data)
+    *(.gnu.linkonce.d*)
+    ${RELOCATING+. = ALIGN(2);}
+    ${RELOCATING+ _edata = . ; }
+  } ${RELOCATING+ > data}
+
+  .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
+       ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text) + SIZEOF (.data))}
+  {
+    ${RELOCATING+ PROVIDE (__bss_start = .) ; }
+    *(.bss)
+    *(COMMON)
+    ${RELOCATING+ PROVIDE (__bss_end = .) ; }
+    ${RELOCATING+ _end = . ;  }
+  } ${RELOCATING+ > data}
+
+  .eeprom ${RELOCATING-0}:
+  {
+    *(.eeprom*)
+    ${RELOCATING+ __eeprom_end = . ; }
+  } ${RELOCATING+ > eeprom}
+
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+ 
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+
+}
+EOF
+
diff --git a/ld/scripttempl/elfd10v.sc b/ld/scripttempl/elfd10v.sc
index 322eef4..4a606c3 100644
--- a/ld/scripttempl/elfd10v.sc
+++ b/ld/scripttempl/elfd10v.sc
@@ -1,26 +1,3 @@
-#
-# Unusual variables checked by this code:
-#	NOP - two byte opcode for no-op (defaults to 0)
-#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
-#	OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
-#		(e.g., .PARISC.milli)
-#	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
-#		(e.g., .PARISC.global)
-#	OTHER_SECTIONS - at the end
-#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
-#		executable (e.g., _DYNAMIC_LINK)
-#	TEXT_START_SYMBOLS - symbols that appear at the start of the
-#		.text section.
-#	DATA_START_SYMBOLS - symbols that appear at the start of the
-#		.data section.
-#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
-#		.bss section besides __bss_start.
-#	DATA_PLT - .plt should be in data segment, not text segment.
-#	EMBEDDED - whether this is for an embedded system. 
-#
-# When adding sections, do note that the names of some sections are used
-# when specifying the start address of the next.
-#
 test -z "$ENTRY" && ENTRY=_start
 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
@@ -66,6 +43,7 @@
     ${CONSTRUCTING+${DTOR_END}}
   }"
 
+STACK=" .stack : { _stack = .; *(.stack) } >STACK "
 
 # if this is for an embedded system, don't add SIZEOF_HEADERS.
 if [ -z "$EMBEDDED" ]; then
@@ -84,46 +62,35 @@
 ${RELOCATING+/* Do we need any of these for elf?
    __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
-  if gld -r is used and the intermediate file has sections starting
-  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
-  bug.  But for now assigning the zero vmas works.  */}
+
+MEMORY
+{
+  UNIFIED : org = 0,         len = 0x1000000
+  INSN    : org = 0x1000000, len = 0x40000
+  DATA    : org = 0x2000004, len = 0x7FFC
+  STACK   : org = 0x2007FFE, len = 4
+}
+
 SECTIONS
 {
-  /* Read-only sections, merged into text segment: */
-  ${CREATE_SHLIB-${RELOCATING+. = ${READONLY_BASE_ADDRESS};}}
-  ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
-  ${CREATE_SHLIB-${INTERP}}
-  .hash        ${RELOCATING-0} : { *(.hash)		}
-  .dynsym      ${RELOCATING-0} : { *(.dynsym)		}
-  .dynstr      ${RELOCATING-0} : { *(.dynstr)		}
-  .rel.text    ${RELOCATING-0} : { *(.rel.text)		}
-  .rela.text   ${RELOCATING-0} : { *(.rela.text) 	}
-  .rel.data    ${RELOCATING-0} : { *(.rel.data)		}
-  .rela.data   ${RELOCATING-0} : { *(.rela.data) 	}
-  .rel.rodata  ${RELOCATING-0} : { *(.rel.rodata) 	}
-  .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) 	}
-  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
-  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
-  .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)	}
-  .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)	}
-  .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)	}
-  .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)	}
-  .rel.init    ${RELOCATING-0} : { *(.rel.init)	}
-  .rela.init   ${RELOCATING-0} : { *(.rela.init)	}
-  .rel.fini    ${RELOCATING-0} : { *(.rel.fini)	}
-  .rela.fini   ${RELOCATING-0} : { *(.rela.fini)	}
-  .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
-  .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
-  .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
-  .rela.plt    ${RELOCATING-0} : { *(.rela.plt)		}
-  ${DATA_PLT-${PLT}}
-  .rodata  ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
-  .rodata1 ${RELOCATING-0} : { *(.rodata1) }
-  ${RELOCATING+${OTHER_READONLY_SECTIONS}}
+  .text :
+  {
+    ${RELOCATING+${TEXT_START_SYMBOLS}}
+    KEEP (*(.init))
+    KEEP (*(.fini))
+    *(.text)
+    *(.text.*)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+    ${RELOCATING+_etext = .;}
+    ${RELOCATING+PROVIDE (etext = .);}
+  } ${RELOCATING+ >INSN} =${NOP-0}
 
-  /* Adjust the address for the data segment.  */
-  ${RELOCATING+. = ${DATA_ADDR-ALIGN(4);}}
+  .rodata  ${RELOCATING-0} : {
+    *(.rodata) *(.gnu.linkonce.r*)
+  } ${RELOCATING+ >DATA}
+  .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+ >DATA}
 
   .data  ${RELOCATING-0} :
   {
@@ -132,32 +99,30 @@
     *(.data.*)
     *(.gnu.linkonce.d*)
     ${CONSTRUCTING+CONSTRUCTORS}
-  }
-  .data1 ${RELOCATING-0} : { *(.data1) }
-  ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
-  ${RELOCATING+${CTOR}}
-  ${RELOCATING+${DTOR}}
-  .got         ${RELOCATING-0} : { *(.got.plt) *(.got) }
-  .dynamic     ${RELOCATING-0} : { *(.dynamic) }
-  ${DATA_PLT+${PLT}}
+  } ${RELOCATING+ >DATA}
+  .data1 ${RELOCATING-0} : { *(.data1) } ${RELOCATING+ >DATA}
+  ${RELOCATING+${CTOR} >DATA}
+  ${RELOCATING+${DTOR} >DATA}
+
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */
-  .sdata   ${RELOCATING-0} : { *(.sdata) }
-  ${RELOCATING+_edata  =  .;}
+  .sdata   ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ >DATA}
+  ${RELOCATING+_edata = .;}
   ${RELOCATING+PROVIDE (edata = .);}
   ${RELOCATING+__bss_start = .;}
-  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
-  .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
+  .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) } ${RELOCATING+ >DATA}
   .bss     ${RELOCATING-0} :
   {
    *(.dynbss)
    *(.bss)
    *(COMMON)
-  }
+  } ${RELOCATING+ >DATA}
   ${RELOCATING+_end = . ;}
   ${RELOCATING+PROVIDE (end = .);}
 
+  ${RELOCATING+$STACK}
+
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -198,29 +163,5 @@
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-
-  ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
-
-  /* These must appear regardless of ${RELOCATING}.  */
-  ${OTHER_SECTIONS}
-
-
-  /* Hmmm, there's got to be a better way.  This sets the stack to the
-     top of the simulator memory (i.e. top of 64K data space). */
-  .stack 0x00007FFE : { _stack = .; *(.stack) }
-
-  .text    ${RELOCATING+${TEXT_START_ADDR}} :
-  {
-    ${RELOCATING+${TEXT_START_SYMBOLS}}
-    KEEP (*(.init))
-    KEEP (*(.fini))
-    *(.text)
-    *(.text.*)
-    /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
-    *(.gnu.linkonce.t*)
-  } =${NOP-0}
-  ${RELOCATING+_etext = .;}
-  ${RELOCATING+PROVIDE (etext = .);}
 }
 EOF
diff --git a/ld/scripttempl/elfi370.sc b/ld/scripttempl/elfi370.sc
new file mode 100644
index 0000000..e2f0e88
--- /dev/null
+++ b/ld/scripttempl/elfi370.sc
@@ -0,0 +1,218 @@
+#
+# This is just a raw copy of elfppc.sc and has not been otherwise modified
+#
+# Unusual variables checked by this code:
+#	NOP - two byte opcode for no-op (defaults to 0)
+#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
+#	OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
+#		(e.g., .PARISC.milli)
+#	OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
+#		(e.g., .PARISC.global)
+#	OTHER_SECTIONS - at the end
+#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
+#		executable (e.g., _DYNAMIC_LINK)
+#	TEXT_START_SYMBOLS - symbols that appear at the start of the
+#		.text section.
+#	DATA_START_SYMBOLS - symbols that appear at the start of the
+#		.data section.
+#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
+#		.bss section besides __bss_start.
+#
+# When adding sections, do note that the names of some sections are used
+# when specifying the start address of the next.
+#
+test -z "$ENTRY" && ENTRY=_start
+test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test "$LD_FLAG" = "N" && DATA_ADDR=.
+SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }"
+SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }"
+INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
+PLT=".plt ${RELOCATING-0} : { *(.plt) }"
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
+	      "${LITTLE_OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+ENTRY(${ENTRY})
+
+${RELOCATING+${LIB_SEARCH_DIRS}}
+${RELOCATING+/* Do we need any of these for elf?
+   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
+${RELOCATING+${EXECUTABLE_SYMBOLS}}
+${RELOCATING- /* For some reason, the Solaris linker makes bad executables
+  if gld -r is used and the intermediate file has sections starting
+  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
+  bug.  But for now assigning the zero vmas works.  */}
+
+${RELOCATING+PROVIDE (__stack = 0);}
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
+  ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
+  ${CREATE_SHLIB-${INTERP}}
+  .hash		${RELOCATING-0} : { *(.hash)		}
+  .dynsym	${RELOCATING-0} : { *(.dynsym)		}
+  .dynstr	${RELOCATING-0} : { *(.dynstr)		}
+  .gnu.version ${RELOCATING-0} : { *(.gnu.version)      }
+  .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)  }
+  .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)  }
+  .rela.text   ${RELOCATING-0} :
+    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+  .rela.data   ${RELOCATING-0} :
+    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+  .rela.rodata ${RELOCATING-0} :
+    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+  .rela.got	${RELOCATING-0} : { *(.rela.got)	}
+  .rela.got1	${RELOCATING-0} : { *(.rela.got1)	}
+  .rela.got2	${RELOCATING-0} : { *(.rela.got2)	}
+  .rela.ctors	${RELOCATING-0} : { *(.rela.ctors)	}
+  .rela.dtors	${RELOCATING-0} : { *(.rela.dtors)	}
+  .rela.init	${RELOCATING-0} : { *(.rela.init)	}
+  .rela.fini	${RELOCATING-0} : { *(.rela.fini)	}
+  .rela.bss	${RELOCATING-0} : { *(.rela.bss)	}
+  .rela.plt	${RELOCATING-0} : { *(.rela.plt)	}
+  .rela.sdata	${RELOCATING-0} : { *(.rela.sdata)	}
+  .rela.sbss	${RELOCATING-0} : { *(.rela.sbss)	}
+  .rela.sdata2	${RELOCATING-0} : { *(.rela.sdata2)	}
+  .rela.sbss2	${RELOCATING-0} : { *(.rela.sbss2)	}
+  .text    ${RELOCATING-0} :
+  {
+    ${RELOCATING+${TEXT_START_SYMBOLS}}
+    *(.text)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+  } =${NOP-0}
+  .init		${RELOCATING-0} : { *(.init)		} =${NOP-0}
+  .fini		${RELOCATING-0} : { *(.fini)		} =${NOP-0}
+  .rodata	${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
+  .rodata1	${RELOCATING-0} : { *(.rodata1) }
+  ${RELOCATING+_etext = .;}
+  ${RELOCATING+PROVIDE (etext = .);}
+  ${CREATE_SHLIB-${SDATA2}}
+  ${CREATE_SHLIB-${SBSS2}}
+  ${RELOCATING+${OTHER_READONLY_SECTIONS}}
+
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  It would
+     be more correct to do this:
+       ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};}
+     The current expression does not correctly handle the case of a
+     text segment ending precisely at the end of a page; it causes the
+     data segment to skip a page.  The above expression does not have
+     this problem, but it will currently (2/95) cause BFD to allocate
+     a single segment, combining both text and data, for this case.
+     This will prevent the text segment from being shared among
+     multiple executions of the program; I think that is more
+     important than losing a page of the virtual address space (note
+     that no actual memory is lost; the page which is skipped can not
+     be referenced).  */
+  ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
+
+  .data  ${RELOCATING-0} :
+  {
+    ${RELOCATING+${DATA_START_SYMBOLS}}
+    *(.data)
+    *(.gnu.linkonce.d*)
+    ${CONSTRUCTING+CONSTRUCTORS}
+  }
+  .data1 ${RELOCATING-0} : { *(.data1) }
+  ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
+
+  .got1		${RELOCATING-0} : { *(.got1) }
+  .dynamic	${RELOCATING-0} : { *(.dynamic) }
+
+  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
+     get relocated with -mrelocatable. Also put in the .fixup pointers.
+     The current compiler no longer needs this, but keep it around for 2.7.2  */
+
+		${RELOCATING+PROVIDE (_GOT2_START_ = .);}
+  .got2		${RELOCATING-0} :  { *(.got2) }
+
+		${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
+  .ctors	${RELOCATING-0} : { *(.ctors) }
+		${RELOCATING+PROVIDE (__CTOR_END__ = .);}
+
+		${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
+  .dtors	${RELOCATING-0} : { *(.dtors) }
+		${RELOCATING+PROVIDE (__DTOR_END__ = .);}
+
+		${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
+  .fixup	${RELOCATING-0} : { *(.fixup) }
+		${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
+		${RELOCATING+PROVIDE (_GOT2_END_ = .);}
+
+		${RELOCATING+PROVIDE (_GOT_START_ = .);}
+  .got		${RELOCATING-0} : { *(.got) }
+  .got.plt	${RELOCATING-0} : { *(.got.plt) }
+  ${CREATE_SHLIB+${SDATA2}}
+  ${CREATE_SHLIB+${SBSS2}}
+		${RELOCATING+PROVIDE (_GOT_END_ = .);}
+
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  .sdata	${RELOCATING-0} : { *(.sdata) }
+  ${RELOCATING+_edata  =  .;}
+  ${RELOCATING+PROVIDE (edata = .);}
+  .sbss    ${RELOCATING-0} :
+  {
+    ${RELOCATING+PROVIDE (__sbss_start = .);}
+    *(.sbss)
+    *(.scommon)
+    *(.dynsbss)
+    ${RELOCATING+PROVIDE (__sbss_end = .);}
+  }
+  ${PLT}
+  .bss     ${RELOCATING-0} :
+  {
+   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
+   ${RELOCATING+PROVIDE (__bss_start = .);}
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  ${RELOCATING+_end = . ;}
+  ${RELOCATING+PROVIDE (end = .);}
+
+  /* These are needed for ELF backends which have not yet been
+     converted to the new style linker.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+
+  /* These must appear regardless of ${RELOCATING}.  */
+  ${OTHER_SECTIONS}
+}
+EOF
diff --git a/ld/scripttempl/epocpe.sc b/ld/scripttempl/epocpe.sc
new file mode 100644
index 0000000..eda6696
--- /dev/null
+++ b/ld/scripttempl/epocpe.sc
@@ -0,0 +1,151 @@
+# Linker script for PE.
+
+if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
+  RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+fi
+
+# We can't easily and portably get an unquoted $ in a shell
+# substitution, so we do this instead.
+# Sorting of the .foo$* sections is required by the definition of
+# grouped sections in PE.
+# Sorting of the file names in R_IDATA is required by the
+# current implementation of dlltool (this could probably be changed to
+# use grouped sections instead).
+if test "${RELOCATING}"; then
+  R_TEXT='*(SORT(.text$*))'
+  R_DATA='*(SORT(.data$*))'
+  R_RDATA='*(SORT(.rdata$*))'
+  R_IDATA='
+    SORT(*)(.idata$2)
+    SORT(*)(.idata$3)
+    /* These zeroes mark the end of the import list.  */
+    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+    SORT(*)(.idata$4)
+    SORT(*)(.idata$5)
+    SORT(*)(.idata$6)
+    SORT(*)(.idata$7)'
+  R_CRT='*(SORT(.CRT$*))'
+  R_RSRC='*(SORT(.rsrc$*))'
+else
+  R_TEXT=
+  R_DATA=
+  R_RDATA=
+  R_IDATA=
+  R_CRT=
+  R_RSRC=
+fi
+
+cat <<EOF
+${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
+${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
+
+${LIB_SEARCH_DIRS}
+
+ENTRY(_mainCRTStartup)
+
+SECTIONS
+{
+  .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 
+  {
+    ${RELOCATING+ *(.init)}
+    *(.text)
+    ${R_TEXT}
+    *(.glue_7t)
+    *(.glue_7)
+    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
+			LONG (-1); *(.ctors); *(.ctor); LONG (0); }
+    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
+			LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
+    ${RELOCATING+ *(.fini)}
+    /* ??? Why is .gcc_exc here?  */
+    ${RELOCATING+ *(.gcc_exc)}
+    ${RELOCATING+ etext = .;}
+    *(.gcc_except_table)
+
+    /* For EPOC the read only data is located at the end of the .text
+    section */
+    *(.rdata)
+    ${R_RDATA}
+    *(.eh_frame)
+  }
+
+  /* The Cygwin32 library uses a section to avoid copying certain data
+     on fork.  This used to be named ".data$nocopy".  The linker used
+     to include this between __data_start__ and __data_end__, but that
+     breaks building the cygwin32 dll.  Instead, we name the section
+     ".data_cygwin_nocopy" and explictly include it after __data_end__. */
+
+  .data ${RELOCATING+BLOCK(__section_alignment__)} : 
+  {
+    ${RELOCATING+__data_start__ = . ;}
+    *(.data)
+    *(.data2)
+    ${R_DATA}
+    ${RELOCATING+__data_end__ = . ;}
+    ${RELOCATING+*(.data_cygwin_nocopy)}
+  }
+
+  .bss ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${RELOCATING+__bss_start__ = . ;}
+    *(.bss)
+    *(COMMON)
+    ${RELOCATING+__bss_end__ = . ;}
+  }
+
+  .edata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    *(.edata)
+  }
+
+  /DISCARD/ :
+  {
+    *(.debug\$S)
+    *(.debug\$T)
+    *(.debug\$F)
+    *(.drectve)
+  }
+
+  .idata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    /* This cannot currently be handled with grouped sections.
+	See pe.em:sort_sections.  */
+    ${R_IDATA}
+  }
+  
+  .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
+  { 					
+    ${R_CRT}
+  }
+
+  .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    /* end is deprecated, don't use it */
+    ${RELOCATING+ end = .;}
+    ${RELOCATING+ _end = .;}
+    ${RELOCATING+ __end__ = .;}
+  }
+
+  .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
+  { 					
+    *(.reloc)
+  }
+
+  .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
+  { 					
+    *(.rsrc)
+    ${R_RSRC}
+  }
+
+  .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
+  {
+    [ .stab ]
+  }
+
+  .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
+  {
+    [ .stabstr ]
+  }
+
+}
+EOF
diff --git a/ld/scripttempl/go32coff.sc b/ld/scripttempl/go32coff.sc
deleted file mode 100644
index 40f6076..0000000
--- a/ld/scripttempl/go32coff.sc
+++ /dev/null
@@ -1,33 +0,0 @@
-# Linker script for 386 go32
-# DJ Delorie (dj@ctron.com)
-
-test -z "$ENTRY" && ENTRY=start
-cat <<EOF
-OUTPUT_FORMAT("${OUTPUT_FORMAT}")
-${LIB_SEARCH_DIRS}
-
-ENTRY(${ENTRY})
-
-SECTIONS
-{
-  .text ${RELOCATING+ 0x1000+SIZEOF_HEADERS} : {
-    *(.text)
-    ${RELOCATING+ etext  =  . ; _etext = .};
-    ${RELOCATING+ . = ALIGN(0x200);}
-  }
-  .data ${RELOCATING+ ${DATA_ALIGNMENT}} : {
-    ${RELOCATING+ *(.ctor)}
-    ${RELOCATING+ *(.dtor)}
-    *(.data)
-    ${RELOCATING+ edata  =  . ; _edata = .};
-    ${RELOCATING+ . = ALIGN(0x200);}
-  }
-  .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
-  { 					
-    *(.bss)
-    *(COMMON)
-    ${RELOCATING+ end = . ; _end = .};
-    ${RELOCATING+ . = ALIGN(0x200);}
-  }
-}
-EOF
diff --git a/ld/scripttempl/i386go32.sc b/ld/scripttempl/i386go32.sc
index 6bd3d09..f14aff7 100644
--- a/ld/scripttempl/i386go32.sc
+++ b/ld/scripttempl/i386go32.sc
@@ -17,9 +17,11 @@
 {
   .text ${RELOCATING+ ${TARGET_PAGE_SIZE}+SIZEOF_HEADERS} : {
     *(.text)
+    ${RELOCATING+*(.gnu.linkonce.t*)}
     *(.const*)
     *(.ro*)
-    ${RELOCATING+etext  =  . ; _etext = .};
+    ${RELOCATING+*(.gnu.linkonce.r*)}
+    ${RELOCATING+etext  =  . ; _etext = . ;}
     ${RELOCATING+. = ALIGN(${SEGMENT_SIZE});}
   }
   .data ${RELOCATING+ ${DATA_ALIGNMENT}} : {
@@ -30,8 +32,16 @@
     *(.dtor)
     djgpp_last_dtor = . ;}
     *(.data)
-    ${RELOCATING+ edata  =  . ; _edata = .};
-    ${RELOCATING+ . = ALIGN(${SEGMENT_SIZE});}
+
+    ${RELOCATING+*(.gcc_exc*)}
+    ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
+    ${RELOCATING+*(.eh_fram*)}
+    ${RELOCATING+___EH_FRAME_END__ = . ;}
+    ${RELOCATING+LONG(0);}
+
+    ${RELOCATING+*(.gnu.linkonce.d*)}
+    ${RELOCATING+edata  =  . ; _edata = . ;}
+    ${RELOCATING+. = ALIGN(${SEGMENT_SIZE});}
   }
   ${CONSTRUCTING+${RELOCATING-$CTOR}}
   ${CONSTRUCTING+${RELOCATING-$DTOR}}
@@ -39,7 +49,7 @@
   { 					
     *(.bss)
     *(COMMON)
-    ${RELOCATING+ end = . ; _end = .};
+    ${RELOCATING+ end = . ; _end = . ;}
     ${RELOCATING+ . = ALIGN(${SEGMENT_SIZE});}
   }
 }
diff --git a/ld/scripttempl/mcorepe.sc b/ld/scripttempl/mcorepe.sc
index 8111bf2..6f928aa 100644
--- a/ld/scripttempl/mcorepe.sc
+++ b/ld/scripttempl/mcorepe.sc
@@ -1,4 +1,4 @@
-# Linker script for PE.
+# Linker script for MCore PE.
 
 if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
   RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
@@ -35,10 +35,16 @@
   R_RSRC=
 fi
 
-cat <<EOF
-${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
-${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
+if test "$RELOCATING"; then
+  # Can't use ${RELOCATING+blah "blah" blah} for this,
+  # because bash 2.x will lose the doublequotes.
+  cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
+	  	           "${LITTLE_OUTPUT_FORMAT}")
+EOF
+fi
 
+cat <<EOF
 ${LIB_SEARCH_DIRS}
 
 ENTRY(_mainCRTStartup)
diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
index 7926bfe..ce1a502 100644
--- a/ld/scripttempl/pe.sc
+++ b/ld/scripttempl/pe.sc
@@ -38,10 +38,11 @@
 cat <<EOF
 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
+${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
 
 ${LIB_SEARCH_DIRS}
 
-ENTRY(_mainCRTStartup)
+ENTRY(${ENTRY})
 
 SECTIONS
 {
@@ -79,6 +80,18 @@
     ${RELOCATING+*(.data_cygwin_nocopy)}
   }
 
+  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    *(.rdata)
+    ${R_RDATA}
+    *(.eh_frame)
+  }
+
+  .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    *(.pdata)
+  }
+
   .bss ${RELOCATING+BLOCK(__section_alignment__)} :
   {
     ${RELOCATING+__bss_start__ = . ;}
@@ -87,13 +100,6 @@
     ${RELOCATING+__bss_end__ = . ;}
   }
 
-  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    *(.rdata)
-    ${R_RDATA}
-    *(.eh_frame)
-  }
-
   .edata ${RELOCATING+BLOCK(__section_alignment__)} :
   {
     *(.edata)
@@ -126,17 +132,17 @@
     ${RELOCATING+ __end__ = .;}
   }
 
-  .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
-  { 					
-    *(.reloc)
-  }
-
   .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
   { 					
     *(.rsrc)
     ${R_RSRC}
   }
 
+  .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
+  { 					
+    *(.reloc)
+  }
+
   .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
   {
     [ .stab ]
diff --git a/ld/scripttempl/pj.sc b/ld/scripttempl/pj.sc
new file mode 100644
index 0000000..93981a5
--- /dev/null
+++ b/ld/scripttempl/pj.sc
@@ -0,0 +1,55 @@
+TORS=".tors :
+  {
+    ___ctors = . ;
+    *(.ctors)
+    ___ctors_end = . ;
+    ___dtors = . ;
+    *(.dtors)
+    ___dtors_end = . ;
+  } > ram"
+
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+
+MEMORY
+{
+  ram : o = 0x1000, l = 512M
+}
+
+SECTIONS
+{
+  .text :
+  {
+    *(.text)
+    *(.strings)
+    ${RELOCATING+ _etext = . ; }
+  } ${RELOCATING+ > ram}
+  ${CONSTRUCTING+${TORS}}
+  .data :
+  {
+    *(.data)
+    ${RELOCATING+ _edata = . ; }
+  } ${RELOCATING+ > ram}
+  .bss :
+  {
+    ${RELOCATING+ _bss_start = . ; }
+    *(.bss)
+    *(COMMON)
+    ${RELOCATING+ _end = . ;  }
+  } ${RELOCATING+ > ram}
+  .stack ${RELOCATING+ 0x30000 }  :
+  {
+    ${RELOCATING+ _stack = . ; }
+    *(.stack)
+  } ${RELOCATING+ > ram}
+  .stab 0 ${RELOCATING+(NOLOAD)} :
+  {
+    *(.stab)
+  }
+  .stabstr 0 ${RELOCATING+(NOLOAD)} :
+  {
+    *(.stabstr)
+  }
+}
+EOF
diff --git a/ld/scripttempl/v850.sc b/ld/scripttempl/v850.sc
index 6b2f7e5..0a20954 100644
--- a/ld/scripttempl/v850.sc
+++ b/ld/scripttempl/v850.sc
@@ -94,13 +94,17 @@
   .data1	: { *(.data1) }
   .ctors	: {
     ${RELOCATING+___ctors = .;}
-    KEEP (*(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*crtend(.ctors))
     ${RELOCATING+___ctors_end = .;}
   }
 
   .dtors	: {
     ${RELOCATING+___dtors = .;}
-    KEEP (*(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*crtend.o(.dtors))
     ${RELOCATING+___dtors_end = .;}
   }
 
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 6610cbf..240205f 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,124 @@
+2000-03-13  Nick Clifton  <nickc@cygnus.com>
+
+	* ld-scripts/phdrs.t: Discard all unexpected sections.
+
+2000-02-27 H.J. Lu  (hjl@gnu.org)
+
+	* lib/ld-lib.exp (default_ld_link): Added "$LIBS" to libs.
+
+1999-11-01  Nick Clifton  <nickc@cygnus.com>
+
+	* ld-selective/selective.exp: Fix test to disable these checks for
+	PE based targets.
+
+1999-10-29  Catherine Moore  <clm@cygnus.com>
+
+	* ld-selective/selective.exp:  Remove test6.
+	* ld-selective/5.cc: Delete.
+
+1999-10-28  Scott Bambrough  <scottb@netwinder.org>
+
+	* ld-srec/srec.exp: Setup expected failures for
+	srec tests on ARM Linux.
+
+1999-09-17  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* ld-shared/shared.exp: xfail linux*libc1 shared (non PIC, load
+	offset) test.
+
+1999-09-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld-scripts/script.exp: Add --image-base 0 for PE targets.
+
+1999-08-17  H.J. Lu  <hjl@gnu.org>
+
+	* ld-cdtest/cdtest-foo.cc (Foo::init_foo): Use "%ld" for sizeof.
+
+1999-08-09  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* ld-elfvers/vers.exp: Run tests on sparc*-*-linux*.
+	* ld-shared/shared.exp: Likewise.
+
+1999-07-28  Nick Clifton  <nickc@cygnus.com>
+
+	* lib/ld-lib.exp (proc big_or_little_endian): New proc.
+	Determine if a big endian or little endian output format hass
+	been selected by any of the multilib options, and if so return
+	a suitable command line option for the linker/assembler.
+	(proc default_ld_link): Include the result of proc
+	big_or_little_endian on the command line to the linker.
+	(proc ld_simple_link): Include the result of proc
+	big_or_little_endian on the command line to the linker.
+	(proc default_ld_compile): Append multilib flags to compiler
+	switches.
+	(proc default_ld_assemble): Include the result of proc
+	big_or_little_endian on the command line to the linker.
+
+1999-07-21  H.J. Lu  <hjl@gnu.org>
+
+	* ld-elfvers/vers1.c: Add missing prototypes and include
+	<stdio.h> if necessary.
+	* ld-elfvers/vers15.c: Likewise.
+	* ld-elfvers/vers19.c: Likewise.
+	* ld-elfvers/vers2.c: Likewise.
+	* ld-elfvers/vers3.c: Likewise.
+	* ld-elfvers/vers4.c: Likewise.
+	* ld-elfvers/vers6.c: Likewise.
+	* ld-elfvers/vers7.c: Likewise.
+	* ld-elfvers/vers9.c: Likewise.
+	* ld-shared/main.c: Likewise.
+	* ld-srec/sr3.cc (Foo::Foo): Remove arg name.
+
+Thu Jul 15 18:00:30 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+	* ld-undefined/undefined.exp: XFAIL on IRIX6 for the usual as
+	with other DWARF2 targets.
+
+1999-07-13  Nick Clifton  <nickc@cygnus.com>
+
+	* ld-undefined/undefined.exp: Do not expect arm toolchains to fail
+	the undefined line test.
+
+1999-07-10  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld-elfvers/vers.exp: Use -rpath in new vers19 test.
+
+1999-07-07  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld-elfvers/vers.exp: Add new tests vers17 to vers19.
+	* ld/elfvers/{vers17.*, vers18.*, vers19.*}: New files.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld-checks/asm.s: Use a symbol name for .lcomm.
+	* ld-checks/checks.exp: Use different names for the two tests.
+	Don't add extra text when invoking fail.
+
+1999-06-12  Ian Lance Taylor  <ian@zembu.com>
+
+	* ld-scripts/phdrs.exp: Change target check from "*-*-linuxaout*"
+	to "*-*-linux*aout*".
+	* ld-scripts/weak.exp: Likewise.
+	* ld-shared/shared.exp: Likewise.  Simplify condition a bit.
+
+Wed Jun  9 12:02:33 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* ld-cdtest/cdtest-main.cc: Avoid `implicit int' warning.
+	* ld-shared/sh1.c: Fix typo.
+
+1999-06-04  H.J. Lu  <hjl@gnu.org>
+
+	* lib/ld-lib.exp (default_ld_nm): Clear nm_output first if
+	necessary.
+
+1999-05-17  Nick Clifton  <nickc@cygnus.com>
+
+	* ld-undefined/undefined.exp: Add xfail for mcore-elf.
+
+1999-05-11  DJ Delorie  <dj@cygnus.com>
+
+	* ld-srec/srec.exp: Do not run tests for PE based ports.
+
 1999-03-05  Nick Clifton  <nickc@cygnus.com>
 
 	* ld-selective/selective.exp: Do not run tests for COFF or PE
diff --git a/ld/testsuite/ld-cdtest/cdtest-foo.cc b/ld/testsuite/ld-cdtest/cdtest-foo.cc
index 615e33c..c7d41a9 100644
--- a/ld/testsuite/ld-cdtest/cdtest-foo.cc
+++ b/ld/testsuite/ld-cdtest/cdtest-foo.cc
@@ -22,7 +22,7 @@
 
 void Foo::init_foo ()
 {
-    printf ("BROKENLY calling Foo::init_foo from __init_start; size_of(Foo) = %d\n", sizeof(Foo));
+    printf ("BROKENLY calling Foo::init_foo from __init_start; size_of(Foo) = %ld\n", (long) sizeof(Foo));
     foos = FOOLISH_NUMBER;
 }
 
diff --git a/ld/testsuite/ld-cdtest/cdtest-main.cc b/ld/testsuite/ld-cdtest/cdtest-main.cc
index 4b99b5c..bc881da 100644
--- a/ld/testsuite/ld-cdtest/cdtest-main.cc
+++ b/ld/testsuite/ld-cdtest/cdtest-main.cc
@@ -27,7 +27,7 @@
 
 static Foo static_foo( "static_foo"); 
 
-main() 
+int main() 
 { 
     assert (Foo::nb_foos() == 2);
     Foo automatic_foo( "automatic_foo");
diff --git a/ld/testsuite/ld-checks/asm.s b/ld/testsuite/ld-checks/asm.s
index e4e0c33..ad5e177 100644
--- a/ld/testsuite/ld-checks/asm.s
+++ b/ld/testsuite/ld-checks/asm.s
@@ -8,7 +8,4 @@
 bar:
 	.long 0x87654321
 
-	.lcomm 0x12
-
-
-	
\ No newline at end of file
+	.lcomm dummy, 0x12
diff --git a/ld/testsuite/ld-checks/checks.exp b/ld/testsuite/ld-checks/checks.exp
index af3ef7d..16fafe3 100644
--- a/ld/testsuite/ld-checks/checks.exp
+++ b/ld/testsuite/ld-checks/checks.exp
@@ -24,7 +24,7 @@
     global srcdir
     global subdir
     
-    set test "check sections"
+    set test "check sections 1"
     
     set ldflags "--check-sections"
 
@@ -34,11 +34,13 @@
     }
 
     if ![ld_simple_link $ld tmpdir/asm.x "$ldflags tmpdir/asm.o"] {
-	fail "$test : using default linker script"
+	fail $test
     } else {
 	pass $test
     }
 
+    set test "check sections 2"
+
     # Change the linker flags so that our "buggy" linker
     # script is used.
     set ldflags "--check-sections -T $srcdir/$subdir/script -e foo"
@@ -51,7 +53,7 @@
 
     # Make sure that we got some output from the linker
     if [string match "" $exec_output] then {
-	fail "$test - error message expected but not found"
+	fail $test
     } 
 
     # Now remove our expected error message
@@ -62,8 +64,7 @@
 	pass $test
     } else {
 	verbose -log "Unexpected linker message(s): $exec_output"
-	
-	fail "$test - using erroneous linker script"
+	fail $test
     }
 }
 
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index 5dfaa93..560dfd6 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -1,5 +1,5 @@
 # Expect script for ld-version tests
-#   Copyright (C) 1997, 1998 Free Software Foundation
+#   Copyright (C) 1997, 1998, 1999 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
@@ -35,7 +35,8 @@
      && ![istarget powerpc-*-linux*] \
      && ![istarget powerpc-*-sysv4*] \
      && ![istarget sparc*-*-elf] \
-     && ![istarget sparc*-*-solaris2*]
+     && ![istarget sparc*-*-solaris2*] \
+     && ![istarget sparc*-*-linux*] \
      && ![istarget alpha*-*-linux*] } {
     return
 }
@@ -806,3 +807,8 @@
 #
 build_vers_lib "vers16a" vers16a.c vers16a "" vers16.map vers16a.ver vers16a.dsym ""
 build_exec "vers16" vers16.c vers16 "" vers16a.so "" vers16.dsym ""
+
+# Test a weak versioned symbol.
+build_vers_lib "vers17" vers17.c vers17 "" vers17.map vers17.ver vers17.dsym ""
+build_vers_lib "vers18" vers18.c vers18 vers17.so vers18.map vers18.ver vers18.dsym vers18.sym
+build_exec "vers19" vers19.c vers19 "-rpath ." vers18.so vers19.ver vers19.dsym ""
diff --git a/ld/testsuite/ld-elfvers/vers1.c b/ld/testsuite/ld-elfvers/vers1.c
index 1d41fd9..c27bc3b 100644
--- a/ld/testsuite/ld-elfvers/vers1.c
+++ b/ld/testsuite/ld-elfvers/vers1.c
@@ -6,6 +6,9 @@
 const char * show_bar1 = "asdf";
 const char * show_bar2 = "asdf";
 
+extern int new2_foo();
+extern int bar33();
+
 int
 bar()
 {
@@ -71,7 +74,7 @@
  * This test is designed to catch a couple of syntactic errors.  The assembler
  * should complain about both of the directives below.
  */
-int
+void
 xyzzz()
 {
   new2_foo();
@@ -87,7 +90,7 @@
  * This test is designed to catch a couple of syntactic errors.  The assembler
  * should complain about both of the directives below.
  */
-int
+void
 xyzzz()
 {
   new2_foo();
diff --git a/ld/testsuite/ld-elfvers/vers15.c b/ld/testsuite/ld-elfvers/vers15.c
index d32be3f..4e22cac 100644
--- a/ld/testsuite/ld-elfvers/vers15.c
+++ b/ld/testsuite/ld-elfvers/vers15.c
@@ -2,6 +2,7 @@
  * Testcase to make sure that if we externally reference a versioned symbol
  * that we always get the right one.
  */
+#include <stdio.h>
 
 int
 foo_1()
diff --git a/ld/testsuite/ld-elfvers/vers17.c b/ld/testsuite/ld-elfvers/vers17.c
new file mode 100644
index 0000000..3bcd647
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers17.c
@@ -0,0 +1,5 @@
+int
+show_foo ()
+{
+  return 99;
+}
diff --git a/ld/testsuite/ld-elfvers/vers17.dsym b/ld/testsuite/ld-elfvers/vers17.dsym
new file mode 100644
index 0000000..8decc0a
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers17.dsym
@@ -0,0 +1,2 @@
+[0]* g    DO \*ABS\*	[0]*  VERS_2.0    VERS_2.0
+[0-9a-f]* g    DF (.text|\*ABS\*)	[0-9a-f]*  VERS_2.0    (0x[0-9a-f][0-9a-f] )?show_foo
diff --git a/ld/testsuite/ld-elfvers/vers17.map b/ld/testsuite/ld-elfvers/vers17.map
new file mode 100644
index 0000000..a5c9cf6
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers17.map
@@ -0,0 +1,4 @@
+VERS_2.0 {
+	 global:
+		 show_foo;
+};
diff --git a/ld/testsuite/ld-elfvers/vers17.ver b/ld/testsuite/ld-elfvers/vers17.ver
new file mode 100644
index 0000000..e78d59c
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers17.ver
@@ -0,0 +1,3 @@
+Version definitions:
+1 0x01 0x02605d3f tmpdir/vers17.so
+2 0x00 0x0a7922b0 VERS_2.0
diff --git a/ld/testsuite/ld-elfvers/vers18.c b/ld/testsuite/ld-elfvers/vers18.c
new file mode 100644
index 0000000..25dcc25
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers18.c
@@ -0,0 +1,42 @@
+int
+bar ()
+{
+  return 3;
+}
+
+#pragma weak hide_original_foo
+
+int
+hide_original_foo ()
+{
+  return 1 + bar ();
+}
+
+#pragma weak hide_old_foo
+
+int
+hide_old_foo ()
+{
+  return 10 + bar();
+}
+
+#pragma weak hide_old_foo1
+
+int
+hide_old_foo1 ()
+{
+  return 100 + bar ();
+}
+
+#pragma weak hide_new_foo
+
+int
+hide_new_foo ()
+{
+  return 1000 + bar ();
+}
+
+__asm__(".symver hide_original_foo,show_foo@");
+__asm__(".symver hide_old_foo,show_foo@VERS_1.1");
+__asm__(".symver hide_old_foo1,show_foo@VERS_1.2");
+__asm__(".symver hide_new_foo,show_foo@@VERS_2.0");
diff --git a/ld/testsuite/ld-elfvers/vers18.dsym b/ld/testsuite/ld-elfvers/vers18.dsym
new file mode 100644
index 0000000..dc3ad7b
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers18.dsym
@@ -0,0 +1,7 @@
+[0-9a-f]*  w   DF (\*UND\*)	[0-9a-f]*  VERS_2.0    (0x[0-9a-f][0-9a-f] )?show_foo
+[0]* g    DO \*ABS\*	[0]*  VERS_1.1    VERS_1.1
+[0]* g    DO \*ABS\*	[0]*  VERS_1.2    VERS_1.2
+[0]* g    DO \*ABS\*	[0]*  VERS_2.0    VERS_2.0
+[0-9a-f]*  w   DF (.text|\*ABS\*)	[0-9a-f]* \(Base\)       (0x[0-9a-f][0-9a-f] )?show_foo
+[0-9a-f]*  w   DF (.text|\*ABS\*)	[0-9a-f]* \(VERS_1.1\)   (0x[0-9a-f][0-9a-f] )?show_foo
+[0-9a-f]*  w   DF (.text|\*ABS\*)	[0-9a-f]* \(VERS_1.2\)   (0x[0-9a-f][0-9a-f] )?show_foo
diff --git a/ld/testsuite/ld-elfvers/vers18.map b/ld/testsuite/ld-elfvers/vers18.map
new file mode 100644
index 0000000..eac2b0e
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers18.map
@@ -0,0 +1,15 @@
+VERS_1.1 {
+	 global:
+		 foo1;
+	 local:
+		 hide_old*; 
+		 hide_original*; 
+		 hide_new*; 
+};
+
+VERS_1.2 {
+		 foo2;
+} VERS_1.1;
+
+VERS_2.0 {
+} VERS_1.2;
diff --git a/ld/testsuite/ld-elfvers/vers18.sym b/ld/testsuite/ld-elfvers/vers18.sym
new file mode 100644
index 0000000..f9cefdf
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers18.sym
@@ -0,0 +1,4 @@
+[0-9a-f]*  w    F .text	[0-9a-f]* (0x[0-9a-f][0-9a-f] )?show_foo@
+[0-9a-f]*  w    F .text	[0-9a-f]* (0x[0-9a-f][0-9a-f] )?show_foo@VERS_1.1
+[0-9a-f]*  w    F .text	[0-9a-f]* (0x[0-9a-f][0-9a-f] )?show_foo@VERS_1.2
+[0-9a-f]*  w    F .text	[0-9a-f]* (0x[0-9a-f][0-9a-f] )?show_foo@@VERS_2.0
diff --git a/ld/testsuite/ld-elfvers/vers18.ver b/ld/testsuite/ld-elfvers/vers18.ver
new file mode 100644
index 0000000..d252996
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers18.ver
@@ -0,0 +1,12 @@
+Version definitions:
+1 0x01 0x02608d3f tmpdir/vers18.so
+2 0x00 0x0a7927b1 VERS_1.1
+3 0x00 0x0a7927b2 VERS_1.2
+	VERS_1.1 
+4 0x02 0x0a7922b0 VERS_2.0
+	VERS_1.2 
+
+Version References:
+  required from tmpdir/vers17.so:
+    0x0a7922b0 0x00 05 VERS_2.0
+
diff --git a/ld/testsuite/ld-elfvers/vers19.c b/ld/testsuite/ld-elfvers/vers19.c
new file mode 100644
index 0000000..c1bf27a
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers19.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern int show_foo ();
+
+int
+main ()
+{
+  printf ("%d\n", show_foo ());
+  return 0;
+}
diff --git a/ld/testsuite/ld-elfvers/vers19.dsym b/ld/testsuite/ld-elfvers/vers19.dsym
new file mode 100644
index 0000000..c9c2642
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers19.dsym
@@ -0,0 +1 @@
+[0-9a-f]*      DF \*UND\*	[0-9a-f]*  VERS_2.0    (0x[0-9a-f][0-9a-f] )?show_foo
diff --git a/ld/testsuite/ld-elfvers/vers19.ver b/ld/testsuite/ld-elfvers/vers19.ver
new file mode 100644
index 0000000..ccbdc88
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers19.ver
@@ -0,0 +1,3 @@
+Version References:
+  required from *tmpdir/vers17.so:
+    0x0a7922b0 0x00 02 VERS_2.0
diff --git a/ld/testsuite/ld-elfvers/vers2.c b/ld/testsuite/ld-elfvers/vers2.c
index d6a537e..eda54cb 100644
--- a/ld/testsuite/ld-elfvers/vers2.c
+++ b/ld/testsuite/ld-elfvers/vers2.c
@@ -2,6 +2,9 @@
  * Test function.  This is built into a shared library, and references a
  * versioned symbol foo that is in test.so.
  */
+#include <stdio.h>
+
+extern int show_foo ();
 
 void
 show_xyzzy()
diff --git a/ld/testsuite/ld-elfvers/vers3.c b/ld/testsuite/ld-elfvers/vers3.c
index b006d77..dbb4daf 100644
--- a/ld/testsuite/ld-elfvers/vers3.c
+++ b/ld/testsuite/ld-elfvers/vers3.c
@@ -1,6 +1,9 @@
 /*
  * Main program for test1, test2.
  */
+#include <stdio.h>
+
+extern int show_foo ();
 
 int
 main()
diff --git a/ld/testsuite/ld-elfvers/vers4.c b/ld/testsuite/ld-elfvers/vers4.c
index 15497ca..453f2eb 100644
--- a/ld/testsuite/ld-elfvers/vers4.c
+++ b/ld/testsuite/ld-elfvers/vers4.c
@@ -4,6 +4,10 @@
  * the actual symbol is exported.  This is built both with and without
  * -export-dynamic.
  */
+#include <stdio.h>
+
+extern int foo ();
+
 int
 bar()
 {
diff --git a/ld/testsuite/ld-elfvers/vers6.c b/ld/testsuite/ld-elfvers/vers6.c
index b5868bf..9e48df9 100644
--- a/ld/testsuite/ld-elfvers/vers6.c
+++ b/ld/testsuite/ld-elfvers/vers6.c
@@ -2,6 +2,12 @@
  * Testcase to make sure that if we externally reference a versioned symbol
  * that we always get the right one.
  */
+#include <stdio.h>
+
+extern int foo_1();
+extern int foo_2();
+extern int foo_3();
+extern int foo_4();
 
 int
 main()
diff --git a/ld/testsuite/ld-elfvers/vers7.c b/ld/testsuite/ld-elfvers/vers7.c
index d25b7e0..54316c9 100644
--- a/ld/testsuite/ld-elfvers/vers7.c
+++ b/ld/testsuite/ld-elfvers/vers7.c
@@ -2,6 +2,8 @@
  * Test program that goes with test7.so
  */
 
+extern int hide_a();
+extern int show_b();
 
 int
 main()
diff --git a/ld/testsuite/ld-elfvers/vers9.c b/ld/testsuite/ld-elfvers/vers9.c
index 432fddb..bef1402 100644
--- a/ld/testsuite/ld-elfvers/vers9.c
+++ b/ld/testsuite/ld-elfvers/vers9.c
@@ -5,6 +5,8 @@
 const char * bar1 = "asdf";
 const char * bar2 = "asdf";
 
+extern int old_foo1();
+
 int
 bar()
 {
diff --git a/ld/testsuite/ld-scripts/phdrs.exp b/ld/testsuite/ld-scripts/phdrs.exp
index 34ee00f..5a37fa0 100644
--- a/ld/testsuite/ld-scripts/phdrs.exp
+++ b/ld/testsuite/ld-scripts/phdrs.exp
@@ -13,8 +13,8 @@
     return
 }
 
-if { [istarget *-*-linuxaout*] \
-     || [istarget *-*-linuxoldld*] } {
+if { [istarget *-*-linux*aout*] \
+     || [istarget *-*-linux*oldld*] } {
     return
 }
 
diff --git a/ld/testsuite/ld-scripts/phdrs.t b/ld/testsuite/ld-scripts/phdrs.t
index 8f710e2..243dfb1 100644
--- a/ld/testsuite/ld-scripts/phdrs.t
+++ b/ld/testsuite/ld-scripts/phdrs.t
@@ -10,5 +10,5 @@
   . = 0x80000 + SIZEOF_HEADERS;
   .text : { *(.text) } :text
   .data : { *(.data) } :data
-  /DISCARD/ : { *(.reginfo) }
+  /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index fe0a041..9b66174 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -49,7 +49,18 @@
     }
 }
 
-if ![ld_simple_link $ld tmpdir/script "-T $srcdir/$subdir/script.t tmpdir/script.o"] {
+# PE targets need to set the image base to 0 to avoid complications from nm.
+set flags ""
+if {[istarget "*-*-pe*"] \
+    || [istarget "*-*-cygwin*"] \
+    || [istarget "*-*-mingw32*"] \
+    || [istarget "*-*-winnt*"] \
+    || [istarget "*-*-nt*"] \
+    || [istarget "*-*-interix*"] } then {
+  set flags "--image-base 0"
+}
+
+if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
     fail $testname
 } else {
     check_script
@@ -57,7 +68,7 @@
 
 set testname "MRI script"
 
-if ![ld_simple_link $ld tmpdir/script "-c $srcdir/$subdir/scriptm.t"] {
+if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] {
     fail $testname
 } else {
     check_script
diff --git a/ld/testsuite/ld-scripts/weak.exp b/ld/testsuite/ld-scripts/weak.exp
index f69db57..e965967 100644
--- a/ld/testsuite/ld-scripts/weak.exp
+++ b/ld/testsuite/ld-scripts/weak.exp
@@ -17,8 +17,8 @@
     return
 }
 
-if { [istarget *-*-linuxaout*] \
-     || [istarget *-*-linuxoldld*] } {
+if { [istarget *-*-linux*aout*] \
+     || [istarget *-*-linux*oldld*] } {
     return
 }
 
diff --git a/ld/testsuite/ld-selective/5.cc b/ld/testsuite/ld-selective/5.cc
deleted file mode 100644
index 5179d91..0000000
--- a/ld/testsuite/ld-selective/5.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// This test currently fails because the C++ front end emits `A' as
-// the base class called rather than `B' as it ought.  At least it
-// is erroring on the safe side...
-
-struct A
-{
-  virtual void foo();
-  virtual void bar();
-};
-
-void A::foo() { }			// loose
-void A::bar() { }			// loose
-
-struct B : public A
-{
-  virtual void foo();
-};
-
-void B::foo() { }			// keep
-
-void _start() __asm__("_start");	// keep
-
-A a;
-B b;					// keep
-B *getme() { return &b; }		// keep
-
-void _start()
-{
-  getme()->foo();
-}
-
-extern "C" void __main() { }
diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp
index e6a9d97..4ab5872 100644
--- a/ld/testsuite/ld-selective/selective.exp
+++ b/ld/testsuite/ld-selective/selective.exp
@@ -20,7 +20,10 @@
 
 
 # COFF based ports do not support selective linking
-if {[istarget "*-*-coff" "*-*-pe"]} {
+if {[istarget "*-*-coff"]} {
+  return
+}
+if {[istarget "*-*-pe"]} {
   return
 }
 
@@ -29,7 +32,6 @@
 set test3 "selective3"
 set test4 "selective4"
 set test5 "selective5"
-set test6 "selective6"
 
 set cflags "-w -O2 -ffunction-sections -fdata-sections" 
 set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti"
@@ -41,7 +43,6 @@
     untested $test3
     untested $test4
     untested $test5
-    untested $test6
     return
 }
 
@@ -177,32 +178,3 @@
 	}
     }
 }
-
-setup_xfail "v850*-*-elf"
-
-if { ![ld_compile "$CC $cflags $cxxflags" $srcdir/$subdir/5.cc tmpdir/5.o]} {
-    unresolved $test6
-    return
-}
-
-if ![ld_simple_link $ld tmpdir/5.x "$ldflags tmpdir/5.o"] {
-    fail $test6
-} else {
-    if ![ld_nm $nm tmpdir/5.x] {
-	unresolved $test6
-    } else {
-	if {[info exists nm_output(foo__1B)] } {
-            send_log "foo__1B == $nm_output(foo__1B)\n"
-            verbose "foo__1B == $nm_output(foo__1B)"
-	    fail $test6
-	} else {
-            if { [info exists nm_output(foo__1A)]} {
-		  send_log "foo__1A== $nm_output(foo__1A)\n"
-		  verbose "foo__1A == $nm_output(foo__1A)"
-		  fail $test6
-            } else {
-	       pass $test6
-	    }
-	}
-    }
-}
diff --git a/ld/testsuite/ld-shared/main.c b/ld/testsuite/ld-shared/main.c
index 4fcfdaa..fe5c78a 100644
--- a/ld/testsuite/ld-shared/main.c
+++ b/ld/testsuite/ld-shared/main.c
@@ -17,6 +17,7 @@
 extern int (*shlib_getfunptr1 ()) ();
 extern int (*shlib_getfunptr2 ()) ();
 extern int shlib_check ();
+extern int shlib_shlibcall2 ();
 
 /* This function is called by the shared library.  */
 
diff --git a/ld/testsuite/ld-shared/sh1.c b/ld/testsuite/ld-shared/sh1.c
index e31e06a..20f183c 100644
--- a/ld/testsuite/ld-shared/sh1.c
+++ b/ld/testsuite/ld-shared/sh1.c
@@ -64,7 +64,7 @@
 /* This function calls a function defined in this object in the shared
    library.  The main program will override the called function.  */
 
-extern int shlib_overiddencall2 ();
+extern int shlib_overriddencall2 ();
 
 int
 shlib_shlibcall2 ()
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 8939c3d..6eb0a8c 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -47,18 +47,14 @@
      && ![istarget sparc*-*-elf] \
      && ![istarget sparc*-*-solaris2*] \
      && ![istarget sparc*-*-sunos4*] \
+     && ![istarget sparc*-*-linux*] \
      && ![istarget rs6000*-*-aix*] \
      && ![istarget powerpc*-*-aix*] } {
     return
 }
 
-if { [istarget i386-*-linuxaout*] \
-     || [istarget i486-*-linuxaout*] \
-     || [istarget i586-*-linuxaout*] \
-     || [istarget i386-*-linuxoldld*] \
-     || [istarget i486-*-linuxoldld*] \
-     || [istarget i586-*-linuxoldld*] \
-     || [istarget m68k-*-linuxaout*] } {
+if { [istarget *-*-linux*aout*] \
+     || [istarget *-*-linux*oldld*] } {
     return
 }
 
@@ -207,6 +203,7 @@
 	# relocations for various targets are broken in the case where
 	# the load address is not zero (which is the default).
 	setup_xfail "*-*-sunos4*"
+	setup_xfail "*-*-linux*libc1"
 	shared_test shnp "shared (non PIC, load offset)" \
 		mainnp.o sh1np.o sh2np.o shared \
 		"-T $srcdir/$subdir/elf-offset.ld"
diff --git a/ld/testsuite/ld-srec/sr3.cc b/ld/testsuite/ld-srec/sr3.cc
index 8717c26..4cde2dc 100644
--- a/ld/testsuite/ld-srec/sr3.cc
+++ b/ld/testsuite/ld-srec/sr3.cc
@@ -56,6 +56,11 @@
 }
 
 void
+__rethrow ()
+{
+}
+
+void
 __terminate ()
 {
 }
@@ -88,7 +93,7 @@
   i = ++foos;
 }
 
-Foo::Foo (char* msg)
+Foo::Foo (char*)
 {
   i = ++foos;
 }
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 63a70ab..ca38a00 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -229,11 +229,11 @@
     }
 
     # ARM targets call __gccmain
-    if [istarget arm-*-*] {
+    if [istarget arm*-*-*] {
 	set flags "$flags --defsym ___gccmain=0"
     }
     
-    if [istarget strongarm-*-*] {
+    if [istarget strongarm*-*-*] {
 	set flags "$flags --defsym __gccmain=0"
     }
     
@@ -326,12 +326,13 @@
 
 # The S-record linker doesn't build ARM/Thumb stubs.
 setup_xfail "arm-*-coff"
-setup_xfail "strongarm-*-*"
+setup_xfail "strongarm*-*-*"
 setup_xfail "arm-*-pe*"
 # setup_xfail "arm-*elf*"
 setup_xfail "thumb-*-coff*"
 setup_xfail "thumb-*-pe*"
 setup_xfail "thumb-*-elf*"
+setup_xfail "arm*-*-linux*"
 
 # The S-record linker doesn't build special EABI sections.
 setup_xfail "powerpc*-*-eabi*"
@@ -343,6 +344,11 @@
 setup_xfail "alpha*-*-elf*" "alpha*-*-linux-gnu*" "alpha*-*-gnu*"
 setup_xfail "alpha*-*-netbsd*"
 
+# The S-record linker doesn't support the special PE headers - the PE
+# emulation tries to write pe-specific information to the PE headers
+# in the output bfd, but it's not a PE bfd (it's an srec bfd)
+setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
+
 run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
 
 # Now try linking a C++ program with global constructors and
@@ -363,12 +369,13 @@
 setup_xfail "i*86-*-aout*"
 setup_xfail "mips*-*-irix5*" "mips*-*-irix6*"
 setup_xfail "*-*-aix*" "*-*-xcoff*"
-setup_xfail "arm-*-*"
-setup_xfail "strongarm-*-*"
+setup_xfail "arm*-*-*"
+setup_xfail "strongarm*-*-*"
 setup_xfail "thumb-*-*"
 setup_xfail "powerpc*-*-eabi*"
 setup_xfail "v850*-*-elf"
 setup_xfail "alpha*-*-elf*" "alpha*-*-linux-gnu*" "alpha*-*-gnu*"
 setup_xfail "alpha*-*-netbsd*"
+setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
 
 run_srec_test $test2 "tmpdir/sr3.o"
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp
index 29b3bdd..5f55192 100644
--- a/ld/testsuite/ld-undefined/undefined.exp
+++ b/ld/testsuite/ld-undefined/undefined.exp
@@ -119,8 +119,10 @@
 #
 # hence the xfails below.
 
-setup_xfail arm-*-elf
-setup_xfail strongarm-*-elf
-setup_xfail thumb-*-elf
+#setup_xfail arm-*-elf
+#setup_xfail strongarm-*-elf
+#setup_xfail thumb-*-elf
+setup_xfail mcore-*-elf
+setup_xfail mips-sgi-irix6*
 
 checkund $ml $testline
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 24a4131..1c91257 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -43,6 +43,37 @@
     }
 }
 
+# Look for big-endian or little-endian switches in the multlib
+# options and translate these into a -EB or -EL switch.  Note
+# we cannot rely upon proc process_multilib_options to do this
+# for us because for some targets the compiler does not support
+# -EB/-EL but it does support -mbig-endian/-mlittle-endian, and
+# the site.exp file will include the switch "-mbig-endian"
+# (rather than "big-endian") which is not detected by proc
+# process_multilib_options.
+
+proc big_or_little_endian {} {
+    
+    if [board_info [target_info name] exists multilib_flags] {
+	set tmp_flags " [board_info [target_info name] multilib_flags]";
+
+	foreach x $tmp_flags {
+	    case $x in {
+		{*big*endian eb EB} {
+		    set flags " -EB"
+		    return $flags
+		}
+		{*little*endian el EL} {
+		    set flags " -EL"
+		    return $flags
+		}
+	    }
+	}
+    }
+
+    set flags ""
+    return $flags
+}
 
 #
 # default_ld_link 
@@ -52,19 +83,22 @@
     global HOSTING_EMU
     global HOSTING_CRT0
     global HOSTING_LIBS
+    global LIBS
     global host_triplet
     
     set objs "$HOSTING_CRT0 $objects"
-    set libs "$HOSTING_LIBS"
+    set libs "$LIBS $HOSTING_LIBS"
     
     if { [which $ld] == 0 } then {
 	perror "$ld does not exist"
 	return 0
     }
     
-    verbose -log "$ld $HOSTING_EMU -o $target $objs $libs"
+    set flags [big_or_little_endian]
     
-    catch "exec $ld $HOSTING_EMU -o $target $objs $libs" exec_output
+    verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
+    
+    catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" exec_output
     set exec_output [prune_warnings $exec_output]
     if [string match "" $exec_output] then {
 	return 1
@@ -86,9 +120,11 @@
 	return 0
     }
     
-    verbose -log "$ld -o $target $objects"
+    set flags [big_or_little_endian]
     
-    catch "exec $ld -o $target $objects" exec_output
+    verbose -log "$ld $flags -o $target $objects"
+    
+    catch "exec $ld $flags -o $target $objects" exec_output
     set exec_output [prune_warnings $exec_output]
 
     # We don't care if we get a warning about a non-existent start
@@ -134,6 +170,10 @@
 	set flags "$gcc_gas_flag $flags"
     }
 
+    if [board_info [target_info name] exists multilib_flags] {
+	append flags " [board_info [target_info name] multilib_flags]";
+    }
+
     verbose -log "$cc $flags -c $source -o $object"
 
     catch "exec $cc $flags -c $source -o $object" exec_output
@@ -180,9 +220,11 @@
 
     if ![info exists ASFLAGS] { set ASFLAGS "" }
 
-    verbose -log "$as $ASFLAGS -o $object $source"
+    set flags [big_or_little_endian]
 
-    catch "exec $as $ASFLAGS -o $object $source" exec_output
+    verbose -log "$as $flags $ASFLAGS -o $object $source"
+
+    catch "exec $as $flags $ASFLAGS -o $object $source" exec_output
     set exec_output [prune_warnings $exec_output]
     if [string match "" $exec_output] then {
 	return 1
@@ -207,6 +249,10 @@
 	return 0
     }
 
+    if {[info exists nm_output]} {
+      unset nm_output
+    }
+
     if ![info exists NMFLAGS] { set NMFLAGS "" }
 
     verbose -log "$nm $NMFLAGS $object >tmpdir/nm.out"
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index a0b4ed3..c858409 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,7 +1,73 @@
+Thu Mar 16 01:33:58 2000  Jeffrey A Law  (law@cygnus.com)
+
+	* Makefile.in (partition.o): Depend on config.h
+
+2000-03-14  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+	* hashtab.c (find_empty_slot_for_expand): New function.
+	(htab_expand): Use it instead of htab_find_slot.
+	(htab_find_with_hash): Renamed from htab_find; now accepts extra
+	argument HASH.
+	(htab_find_slot_with_hash): Likewise for htab_find_slot.
+	(htab_find): New wrapper function.
+	(htab_find_slot): Likewise.
+	(htab_traverse): Pass slot, not entry, to called function.
+
+2000-03-09  Alex Samuel  <samuel@codesourcery.com>
+
+	* Makefile.in (CFILES): Add partition.c.
+	(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.
+	(htab_delete, htab_empty, htab_remove_elt, htab_clear_slot):
+	Use it.
+
+2000-03-08  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* hashtab.c: Remove debugging variables (all_searches,
+	all_collisions, all_expansions). Delete
+	all_hash_table_collisions.
+	(create_hash_table, delete_hash_table, empty_hash_table,
+	find_hash_table_entry, remove_element_from_hash_table_entry,
+	clear_hash_table_slot, traverse_hash_table, hash_table_size,
+	hash_table_elements_number, hash_table_collisions): Rename to:
+	htab_create, htab_delete, htab_empty, htab_find_slot,
+	htab_remove_elt, htab_clear_slot, htab_traverse, htab_size,
+	htab_elements, htab_collisions.
+	(htab_find): New function, handles common case where you don't
+	plan to add or delete an entry.
+	(htab_expand): Don't create a whole new table, just a new
+	entry vector.
+	(htab_find_slot): Simplify logic.
+
+1999-08-03  Ian Lance Taylor  <ian@zembu.com>
+
+	* floatformat.c: Add casts to avoid signed/unsigned warnings.
+	* pexecute.c: Add ATTRIBUTE_UNUSED as needed on Unix.
+
+	* Makefile.in (install_to_libdir): Change $(TARGETLIB).n to
+	$(TARGETLIB)n so it works on MSDOS.
+	(install_to_tooldir): Likewise.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* makefile.dos: Remove; obsolete.
+	* configure.bat: Remove; obsolete.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* splay-tree.c (splay_tree_insert): Add initialization to avoid
+	warning.
+
 2000-01-04  Mumit Khan  <khan@xraylith.wisc.edu>
 
 	* pexecute.c: Conditionally include string.h.
-	(fix_argv): Handle embedded whitespace in args for Mingw32. 
+	(fix_argv): Handle embedded whitespace in args for Mingw32.
 
 2000-01-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
@@ -80,7 +146,7 @@
 	(demangle_qualified): Use consume_count_with_underscores.
 	(get_count): Tweak formatting.
 	(do_type): Use string_append_template_idx.
-	
+
 1999-10-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* calloc.c: Add a public domain notice.
@@ -143,7 +209,7 @@
 
 Tue Sep  7 23:32:18 1999  Linas Vepstas  <linas@linas.org>
 
-        * config.table: Add openedition target.
+	* config.table: Add openedition target.
 	* config/mh-openedition: New file.
 
 Thu Sep  2 01:36:12 1999  Marc Espie <espie@cvs.openbsd.org>
@@ -172,7 +238,7 @@
 	(arm_special): Likewise.
 	(demangle_fund_type): Likewise.
 	(do_hpacc_template_const_value): Mark parameter `work' with
-	ATTRIBUTE_UNUSED.	
+	ATTRIBUTE_UNUSED.
 	(main): Constify variable `valid_symbols'.
 
 Tue Aug 24 02:50:45 1999  Philippe De Muyter  <phdm@macqel.be>
@@ -190,7 +256,7 @@
 
 1999-07-14  Richard Henderson  <rth@cygnus.com>
 
-	* argv.c: Include stdlib.h and string.h instead of 
+	* argv.c: Include stdlib.h and string.h instead of
 	prototyping directly.
 	* choose-temp.c: Conditionally include string.h.
 
@@ -284,7 +350,7 @@
 1999-04-20  Jim Blandy  <jimb@zwingli.cygnus.com>
 
 	Fix from Dale Hawkins:
-	* cplus-dem.c (mop_up): Set typevec_size to zero, so it'll be 
+	* cplus-dem.c (mop_up): Set typevec_size to zero, so it'll be
 	reallocated properly if we use it again.
 
 	* cplus-dem.c (demangle_fund_type): Check for buffer overrun.  Be
@@ -375,7 +441,7 @@
 	* cplus-dem.c (demangle_prefix): Don't grab all the '__' strings
 	when doing arm or hp style.
 	(demangle_nested_args): Decr forgetting_types field when done.
-	
+
 Thu Mar 11 01:22:58 1999  Mumit Khan  <khan@xraylith.wisc.edu>
 
 	* pexecute.c (__CYGWIN32__): Rename to
@@ -409,10 +475,10 @@
 	* configure.in (funcs): Check for and conditionally add mkstemps to
 	the list of functions libiberty will provide.
 	* configure: Rebuilt.
-	
+
 Wed Feb  3 00:01:15 1999  Mumit Khan  <khan@xraylith.wisc.edu>
 
-	* clock.c (HZ): Define in terms of (ISO C) CLOCKS_PER_SEC on 
+	* clock.c (HZ): Define in terms of (ISO C) CLOCKS_PER_SEC on
 	platforms that don't have HZ.
 	* getruntime.c (HZ): Likewise.
 
@@ -481,7 +547,7 @@
 	* cplus-dem.c (demangle_arm_pt): remove declaration -- function
  	doesn't exist.
 	(do_hpacc_template_literal): remove unused variable `i'.
-	
+
 Fri Dec 18 16:11:43 EST 1998  Andrew MacLeod  <amacleod@cygnus.com>
 
 	* cplus-dem.c (demangle_fund_type): Process CV and u codes before
@@ -587,7 +653,7 @@
 
 1998-11-16  Benjamin Kosnik  <bkoz@haight.constant.com>
 
-        * cplus-dem.c (demangle_fund_type): Add demangling for C9x types.
+	* cplus-dem.c (demangle_fund_type): Add demangling for C9x types.
 
 Thu Nov 19 22:15:50 1998  Jeffrey A Law  (law@cygnus.com)
 
@@ -640,8 +706,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
 
 Mon Nov  2 10:22:01 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
@@ -731,9 +797,9 @@
 
 Tue Oct 13 23:51:51 1998  Jeffrey A Law  (law@cygnus.com)
 
-        * mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h
-        * configure.in (AC_CHECK_HEADERS): Check for sys/time.h too.
-        * config.in, configure: Rebuilt.
+	* mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h
+	* configure.in (AC_CHECK_HEADERS): Check for sys/time.h too.
+	* config.in, configure: Rebuilt.
 
 	* getopt.c: Check HAVE_STRINGS_H before including strings.h.
 	* configure.in (AC_CHECK_HEADERS): Check for strings.h too.
@@ -741,7 +807,7 @@
 
 Mon Oct 12 19:15:59 1998  Geoffrey Noer  <noer@cygnus.com>
 
-        * configure.in: in comment, call AC_EXEEXT instead of AM_EXEEXT
+	* configure.in: in comment, call AC_EXEEXT instead of AM_EXEEXT
 
 Sun Oct 11 17:36:06 1998  Michael Tiemann  <tiemann@holodeck.cygnus.com>
 
@@ -1181,8 +1247,8 @@
 
 Thu Feb  5 18:48:56 1998  Geoffrey Noer  <noer@cygnus.com>
 
-        * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES
-        since it gets built automatically
+	* config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES
+	since it gets built automatically
 
 Sun Feb  1 02:52:32 1998  Mike Stump  <mrs@wrs.com>
 
@@ -1267,24 +1333,24 @@
 
 	Mon Sep 29 12:27:59 1997  Ian Lance Taylor  <ian@cygnus.com>
 
-        * pexecute.c: Use spawn if __CYGWIN32__.
+	* pexecute.c: Use spawn if __CYGWIN32__.
 
 	1997-08-08  Paul Eggert  <eggert@twinsun.com>
 
-        * pexecute.c: Include "config.h" first, as per autoconf manual.
+	* pexecute.c: Include "config.h" first, as per autoconf manual.
 
 	Fri Jun 27 15:20:29 1997  Scott Christley <scottc@net-community.com>
 
-        * pexecute.c (fix_argv): New function.
-        (pexecute): Win32 but not Cygwin32 needs its arguments fixed.
-        Add underscore to cwait function call.
+	* pexecute.c (fix_argv): New function.
+	(pexecute): Win32 but not Cygwin32 needs its arguments fixed.
+	Add underscore to cwait function call.
 
 Sun Sep 28 12:00:52 1997  Mark Mitchell  <mmitchell@usa.net>
 
-        * cplus-dem.c (demangle_template): Add new parameter.  Handle new
-        template-function mangling.
-        (consume_count_with_underscores): New function.
-        (demangle_signature): Handle new name-mangling scheme.
+	* cplus-dem.c (demangle_template): Add new parameter.  Handle new
+	template-function mangling.
+	(consume_count_with_underscores): New function.
+	(demangle_signature): Handle new name-mangling scheme.
 
 Wed Sep 24 00:31:59 1997  Felix Lee  <flee@yin.cygnus.com>
 
@@ -1662,7 +1728,7 @@
 
 Tue Jun 25 22:50:07 1996  Jason Molenda  (crash@godzilla.cygnus.co.jp)
 
-        * Makefile.in (datadir): Set to $(prefix)/share.
+	* Makefile.in (datadir): Set to $(prefix)/share.
 
 Thu Jun 20 21:17:52 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -1708,7 +1774,7 @@
 
 Tue Apr 16 11:27:16 1996  Jeffrey A Law  (law@cygnus.com)
 
-        * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
+	* Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
 	Reverts Feb 8, 1995 change.
 
 Mon Apr 15 12:53:26 1996  Doug Evans  <dje@canuck.cygnus.com>
@@ -1962,7 +2028,7 @@
 	* cplus-dem.c: Update from gcc.
 
 	* argv.c, dummy.c: If __STDC__, #include "alloca-conf.h" after
-        <stddef.h>.
+	<stddef.h>.
 	* alloca-norm.h: If __STDC__, declare alloca with its parameter.
 
 Thu Jun 22 18:57:47 1995  Stan Shebs  <shebs@andros.cygnus.com>
@@ -2055,17 +2121,17 @@
 Thu May  4 14:36:42 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
 
 	* cplus-dem.c: Use const instead of CONST.  Don't include
-        ansidecl.h directly.
+	ansidecl.h directly.
 
 Wed Apr 19 01:30:27 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
 
 	* cplus-dem.c: Don't include libiberty.h.  Do declare xmalloc and
-        xrealloc.
+	xrealloc.
 	(-DMAIN): Don't rely on an externally-defined version number;
-        instead, require the version number to be defined as a
-        preprocessor macro.  Handle the RS/6000 leading dot.  Define
-        xmalloc, xrealloc and fatal.  Don't strip a leading underscore
-        if we couldn't demangle the word.
+	instead, require the version number to be defined as a
+	preprocessor macro.  Handle the RS/6000 leading dot.  Define
+	xmalloc, xrealloc and fatal.  Don't strip a leading underscore
+	if we couldn't demangle the word.
 
 Tue Apr  4 13:03:51 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
@@ -2239,7 +2305,7 @@
 Thu Aug 18 14:37:14 1994  Kung Hsu  (kung@mexican.cygnus.com)
 
 	* cplus-dem.c (demangle args): Handle ARM repeat encoding where
-        the type index is greater than 9.
+	the type index is greater than 9.
 
 Wed Aug 17 16:13:49 1994  Kung Hsu  (kung@mexican.cygnus.com)
 
@@ -2301,7 +2367,7 @@
 Sun Jun 12 01:37:09 1994  Jason Merrill  (jason@deneb.cygnus.com)
 
 	* cplus-dem.c (demangle_template): Separate consecutive >'s with a
-        space.
+	space.
 	(gnu_special): Demangle template and qualified names in a vtable name.
 
 Fri May 27 12:27:52 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
@@ -2345,13 +2411,13 @@
 
 Mon Apr 11 00:54:33 1994  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
-        * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]:
-        Declare strlen to return int.  Don't include stddef.h.
+	* getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]:
+	Declare strlen to return int.  Don't include stddef.h.
 
 Fri Apr  1 00:38:17 1994  Jim Wilson  (wilson@mole.gnu.ai.mit.edu)
 
-        * getopt.c: Delete use of IN_GCC to control whether
-        stddef.h or gstddef.h is included.
+	* getopt.c: Delete use of IN_GCC to control whether
+	stddef.h or gstddef.h is included.
 
 Thu Apr 14 14:00:56 1994  Kung Hsu  (kung@mexican.cygnus.com)
 
@@ -2424,27 +2490,27 @@
 
 Thu Feb 10 14:44:16 1994  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
-        * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]:
-        Test just __STDC__, not emacs.
+	* getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]:
+	Test just __STDC__, not emacs.
 
 Wed Feb  9 00:14:00 1994  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
-        * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]
-        [emacs] [not __STDC__]: Don't include stddef.h.  Don't declare strlen.
+	* getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]
+	[emacs] [not __STDC__]: Don't include stddef.h.  Don't declare strlen.
 
 Fri Dec 24 19:43:00 1993  Noah Friedman  (friedman@nutrimat.gnu.ai.mit.edu)
 
-        * getopt.c (_NO_PROTO): Define before config.h is included.
+	* getopt.c (_NO_PROTO): Define before config.h is included.
 
 Mon Sep 20 15:59:03 1993  Roland McGrath  (roland@churchy.gnu.ai.mit.edu)
 
-        * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include
+	* getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include
 	<config.h> only under these, else "config.h".
 
 Thu Aug 12 18:16:49 1993  Roland McGrath  (roland@churchy.gnu.ai.mit.edu)
 
-        * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include
-        <config.h> instead of "config.h".
+	* getopt.c, getopt1.c [HAVE_CONFIG_H]: Include
+	<config.h> instead of "config.h".
 
 Sun Feb 20 17:17:01 1994  Ian Lance Taylor  (ian@lisa.cygnus.com)
 
@@ -2820,7 +2886,7 @@
 
 Tue May 18 17:12:10 1993  Fred Fish  (fnf@cygnus.com)
 
-        (merge changes from dlong@cse.ucsc.edu)
+	(merge changes from dlong@cse.ucsc.edu)
 	* cplus-dem.c (consume_count):  Simplify.
 	* cplus-dem.c (arm_pt, demangle_class_name):  New functions.
 	* cplus-dem.c (various):  Calls to arm_pt, demangle_class_name.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index c6eb466..9aa57f0 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -123,21 +123,22 @@
 # NOTE: If you add new files to the library, add them to this list
 # (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 \
+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 \
-	memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.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
+	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  \
+	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
 
 # 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 pexecute.o spaces.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
 
@@ -151,15 +152,15 @@
 install: install_to_$(INSTALL_DEST) install-subdir
 
 install_to_libdir: all
-	$(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n
-	( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
-	mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+	$(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
+	( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+	mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
 	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
 install_to_tooldir: all
-	$(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n
-	( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
-	mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
+	$(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
+	( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+	mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
 	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
 # needed-list is used by libstdc++.  NEEDED is the list of functions
@@ -271,6 +272,7 @@
 mkstemps.o: config.h
 objalloc.o: $(INCDIR)/objalloc.h
 obstack.o: config.h $(INCDIR)/obstack.h
+partition.o: config.h $(INCDIR)/partition.h
 pexecute.o: config.h $(INCDIR)/libiberty.h
 setenv.o: config.h
 spaces.o: $(INCDIR)/libiberty.h
diff --git a/libiberty/configure.bat b/libiberty/configure.bat
deleted file mode 100644
index 18881ac..0000000
--- a/libiberty/configure.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@echo off

-if "%1" == "h8/300" goto h8300

-

-echo Configuring libiberty for go32

-copy Makefile.dos Makefile

-echo #define NEED_sys_siglist 1 >> config.h

-echo #define NEED_psignal 1 >> config.h

-goto exit

-

-:h8300

-echo Configuring libiberty for H8/300

-copy Makefile.dos Makefile

-

-:exit

diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
index c4f21e4..1d8f16d 100644
--- a/libiberty/floatformat.c
+++ b/libiberty/floatformat.c
@@ -1,5 +1,5 @@
 /* IEEE floating point support routines, for GDB, the GNU Debugger.
-   Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -128,7 +128,7 @@
     --cur_byte;
 
   /* Move towards the most significant part of the field.  */
-  while (cur_bitshift < len)
+  while ((unsigned int) cur_bitshift < len)
     {
       if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
 	/* This is the last byte; zero out the bits which are not part of
@@ -179,7 +179,7 @@
   mant_off = fmt->man_start;
   dto = 0.0;
 
-  special_exponent = exponent == 0 || exponent == fmt->exp_nan;
+  special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan;
 
   /* Don't bias zero's, denorms or NaNs.  */
   if (!special_exponent)
@@ -255,7 +255,7 @@
     --cur_byte;
 
   /* Move towards the most significant part of the field.  */
-  while (cur_bitshift < len)
+  while ((unsigned int) cur_bitshift < len)
     {
       if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
 	{
@@ -335,7 +335,7 @@
 	 If we are discarding a zero, we should be (but are not) creating
 	 a denormalized	number which means adjusting the exponent
 	 (I think).  */
-      if (mant_bits_left == fmt->man_len
+      if ((unsigned int) mant_bits_left == fmt->man_len
 	  && fmt->intbit == floatformat_intbit_no)
 	{
 	  mant_long &= 0x7fffffff;
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 3f5b303..16c5d3e 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -46,25 +46,9 @@
 #include "libiberty.h"
 #include "hashtab.h"
 
-/* The following variable is used for debugging. Its value is number
-   of all calls of `find_hash_table_entry' for all hash tables. */
-
-static int all_searches = 0;
-
-/* The following variable is used for debugging. Its value is number
-   of collisions fixed for time of work with all hash tables. */
-
-static int all_collisions = 0;
-
-/* The following variable is used for debugging. Its value is number
-   of all table expansions fixed for time of work with all hash
-   tables. */
-
-static int all_expansions = 0;
-
 /* This macro defines reserved value for empty table entry. */
 
-#define EMPTY_ENTRY    NULL
+#define EMPTY_ENTRY    ((void *) 0)
 
 /* This macro defines reserved value for table entry which contained
    a deleted element. */
@@ -75,19 +59,27 @@
    greater than given source number. */
 
 static unsigned long
-higher_prime_number (number)
-     unsigned long number;
+higher_prime_number (n)
+     unsigned long n;
 {
   unsigned long i;
 
-  for (number = (number / 2) * 2 + 3;; number += 2)
+  n |= 0x01;  /* Force N to be odd.  */
+  if (n < 9)
+    return n; /* All odd numbers < 9 are prime.  */
+
+ next:
+  n += 2;
+  i = 3;
+  do
     {
-      for (i = 3; i * i <= number; i += 2)
-        if (number % i == 0)
-          break;
-      if (i * i > number)
-        return number;
+      if (n % i == 0)
+	goto next;
+      i += 2;
     }
+  while ((i * i) <= n);
+
+  return n;
 }
 
 /* This function creates table with length slightly longer than given
@@ -95,26 +87,22 @@
    hash table entries are EMPTY_ENTRY).  The function returns the
    created hash table. */
 
-hash_table_t
-create_hash_table (size, hash_function, eq_function)
+htab_t
+htab_create (size, hash_f, eq_f, del_f)
      size_t size;
-     unsigned (*hash_function) PARAMS ((hash_table_entry_t));
-     int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t));
+     htab_hash hash_f;
+     htab_eq eq_f;
+     htab_del del_f;
 {
-  hash_table_t result;
+  htab_t result;
 
   size = higher_prime_number (size);
-  result = (hash_table_t) xmalloc (sizeof (*result));
-  result->entries
-    = (hash_table_entry_t *) xmalloc (size * sizeof (hash_table_entry_t));
+  result = (htab_t) xcalloc (1, sizeof (struct htab));
+  result->entries = (void **) xcalloc (size, sizeof (void *));
   result->size = size;
-  result->hash_function = hash_function;
-  result->eq_function = eq_function;
-  result->number_of_elements = 0;
-  result->number_of_deleted_elements = 0;
-  result->searches = 0;
-  result->collisions = 0;
-  memset (result->entries, 0, size * sizeof (hash_table_entry_t));
+  result->hash_f = hash_f;
+  result->eq_f = eq_f;
+  result->del_f = del_f;
   return result;
 }
 
@@ -122,9 +110,18 @@
    Naturally the hash table must already exist. */
 
 void
-delete_hash_table (htab)
-     hash_table_t htab;
+htab_delete (htab)
+     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]);
+      }
+
   free (htab->entries);
   free (htab);
 }
@@ -132,10 +129,49 @@
 /* This function clears all entries in the given hash table.  */
 
 void
-empty_hash_table (htab)
-     hash_table_t htab;
+htab_empty (htab)
+     htab_t htab;
 {
-  memset (htab->entries, 0, htab->size * sizeof (hash_table_entry_t));
+  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]);
+      }
+
+  memset (htab->entries, 0, htab->size * sizeof (void *));
+}
+
+/* Similar to htab_find_slot, but without several unwanted side effects:
+    - Does not call htab->eq_f when it finds an existing entry.
+    - Does not change the count of elements/searches/collisions in the
+      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 **
+find_empty_slot_for_expand (htab, hash)
+     htab_t htab;
+     unsigned int hash;
+{
+  size_t size = htab->size;
+  unsigned int hash2 = 1 + hash % (size - 2);
+  unsigned int index = hash % size;
+
+  for (;;)
+    {
+      void **slot = htab->entries + index;
+      if (*slot == EMPTY_ENTRY)
+	return slot;
+
+      if (*slot == DELETED_ENTRY)
+	abort ();
+
+      index += hash2;
+      if (index >= size)
+	index -= size;
+    }
 }
 
 /* The following function changes size of memory allocated for the
@@ -145,121 +181,193 @@
    table entries is changed. */
 
 static void
-expand_hash_table (htab)
-     hash_table_t htab;
+htab_expand (htab)
+     htab_t htab;
 {
-  hash_table_t new_htab;
-  hash_table_entry_t *entry_ptr;
-  hash_table_entry_t *new_entry_ptr;
+  void **oentries;
+  void **olimit;
+  void **p;
 
-  new_htab = create_hash_table (htab->number_of_elements * 2,
-                                htab->hash_function, htab->eq_function);
-  for (entry_ptr = htab->entries; entry_ptr < htab->entries + htab->size;
-       entry_ptr++)
-    if (*entry_ptr != EMPTY_ENTRY && *entry_ptr != DELETED_ENTRY)
-      {
-        new_entry_ptr = find_hash_table_entry (new_htab, *entry_ptr, 1);
-        *new_entry_ptr = (*entry_ptr);
-      }
-  free (htab->entries);
-  *htab = (*new_htab);
-  free (new_htab);
+  oentries = htab->entries;
+  olimit = oentries + htab->size;
+
+  htab->size = higher_prime_number (htab->size * 2);
+  htab->entries = xcalloc (htab->size, sizeof (void **));
+
+  htab->n_elements -= htab->n_deleted;
+  htab->n_deleted = 0;
+
+  p = oentries;
+  do
+    {
+      void *x = *p;
+      if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
+	{
+	  void **q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
+	  *q = x;
+	}
+      p++;
+    }
+  while (p < olimit);
+  free (oentries);
 }
 
-/* This function searches for hash table entry which contains element
-   equal to given value or empty entry in which given value can be
-   placed (if the element with given value does not exist in the
-   table).  The function works in two regimes.  The first regime is
-   used only for search.  The second is used for search and
-   reservation empty entry for given value.  The table is expanded if
-   occupancy (taking into accout also deleted elements) is more than
-   75%.  Naturally the hash table must already exist.  If reservation
-   flag is TRUE then the element with given value should be inserted
-   into the table entry before another call of
-   `find_hash_table_entry'. */
+/* This function searches for a hash table entry equal to the given
+   element.  It cannot be used to insert or delete an element.  */
 
-hash_table_entry_t *
-find_hash_table_entry (htab, element, reserve)
-     hash_table_t htab;
-     hash_table_entry_t element;
-     int reserve;
+void *
+htab_find_with_hash (htab, element, hash)
+     htab_t htab;
+     const void *element;
+     unsigned int hash;
 {
-  hash_table_entry_t *entry_ptr;
-  hash_table_entry_t *first_deleted_entry_ptr;
-  unsigned index, hash_value, secondary_hash_value;
+  unsigned int index, hash2;
+  size_t size;
 
-  if (htab->size * 3 <= htab->number_of_elements * 4)
-    {
-      all_expansions++;
-      expand_hash_table (htab);
-    }
-  hash_value = (*htab->hash_function) (element);
-  secondary_hash_value = 1 + hash_value % (htab->size - 2);
-  index = hash_value % htab->size;
   htab->searches++;
-  all_searches++;
-  first_deleted_entry_ptr = NULL;
-  for (;;htab->collisions++, all_collisions++)
+  size = htab->size;
+  hash2 = 1 + hash % (size - 2);
+  index = hash % size;
+
+  for (;;)
     {
-      entry_ptr = htab->entries + index;
-      if (*entry_ptr == EMPTY_ENTRY)
-        {
-          if (reserve)
-	    {
-	      htab->number_of_elements++;
-	      if (first_deleted_entry_ptr != NULL)
-		{
-		  entry_ptr = first_deleted_entry_ptr;
-		  *entry_ptr = EMPTY_ENTRY;
-		}
-	    }
-          break;
-        }
-      else if (*entry_ptr != DELETED_ENTRY)
-        {
-          if ((*htab->eq_function) (*entry_ptr, element))
-            break;
-        }
-      else if (first_deleted_entry_ptr == NULL)
-	first_deleted_entry_ptr = entry_ptr;
-      index += secondary_hash_value;
-      if (index >= htab->size)
-        index -= htab->size;
+      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;
     }
-  return entry_ptr;
 }
 
-/* This function deletes element with given value from hash table.
-   The hash table entry value will be `DELETED_ENTRY' after the
-   function call.  Naturally the hash table must already exist.  Hash
-   table entry for given value should be not empty (or deleted). */
-
-void
-remove_element_from_hash_table_entry (htab, element)
-     hash_table_t htab;
-     hash_table_entry_t element;
+/* Like htab_find_slot_with_hash, but compute the hash value from the
+   element.  */
+void *
+htab_find (htab, element)
+     htab_t htab;
+     const void *element;
 {
-  hash_table_entry_t *entry_ptr;
-
-  entry_ptr = find_hash_table_entry (htab, element, 0);
-  *entry_ptr = DELETED_ENTRY;
-  htab->number_of_deleted_elements++;
+  return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
 }
 
-/* This function clears a specified slot in a hash table.
-   It is useful when you've already done the lookup and don't want to
-   do it again.  */
+/* This function searches for a hash table slot containing an entry
+   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.  */
+
+void **
+htab_find_slot_with_hash (htab, element, hash, insert)
+     htab_t htab;
+     const void *element;
+     unsigned int hash;
+     int insert;
+{
+  void **first_deleted_slot;
+  unsigned int index, hash2;
+  size_t size;
+
+  if (insert && htab->size * 3 <= htab->n_elements * 4)
+    htab_expand (htab);
+
+  size = htab->size;
+  hash2 = 1 + hash % (size - 2);
+  index = hash % size;
+
+  htab->searches++;
+  first_deleted_slot = NULL;
+
+  for (;;)
+    {
+      void *entry = htab->entries[index];
+      if (entry == EMPTY_ENTRY)
+	{
+	  if (!insert)
+	    return NULL;
+
+	  htab->n_elements++;
+
+	  if (first_deleted_slot)
+	    {
+	      *first_deleted_slot = EMPTY_ENTRY;
+	      return first_deleted_slot;
+	    }
+
+	  return &htab->entries[index];
+	}
+
+      if (entry == DELETED_ENTRY)
+	{
+	  if (!first_deleted_slot)
+	    first_deleted_slot = &htab->entries[index];
+	}
+      else
+	{
+	  if ((*htab->eq_f) (entry, element))
+	    return &htab->entries[index];
+	}
+      
+      htab->collisions++;
+      index += hash2;
+      if (index >= size)
+	index -= size;
+    }
+}
+
+/* Like htab_find_slot_with_hash, but compute the hash value from the
+   element.  */
+void **
+htab_find_slot (htab, element, insert)
+     htab_t htab;
+     const void *element;
+     int insert;
+{
+  return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
+				   insert);
+}
+
+/* This function deletes an element with the given value from hash
+   table.  If there is no matching element in the hash table, this
+   function does nothing.  */
 
 void
-clear_hash_table_slot (htab, slot)
-     hash_table_t htab;
-     hash_table_entry_t *slot;
+htab_remove_elt (htab, element)
+     htab_t htab;
+     void *element;
+{
+  void **slot;
+
+  slot = htab_find_slot (htab, element, 0);
+  if (*slot == EMPTY_ENTRY)
+    return;
+
+  if (htab->del_f)
+    (*htab->del_f) (*slot);
+
+  *slot = DELETED_ENTRY;
+  htab->n_deleted++;
+}
+
+/* This function clears a specified slot in a hash table.  It is
+   useful when you've already done the lookup and don't want to do it
+   again.  */
+
+void
+htab_clear_slot (htab, slot)
+     htab_t htab;
+     void **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->number_of_deleted_elements++;
+  htab->n_deleted++;
 }
 
 /* This function scans over the entire hash table calling
@@ -268,24 +376,29 @@
    argument.  */
 
 void
-traverse_hash_table (htab, callback, info)
-     hash_table_t htab;
-     int (*callback) PARAMS ((hash_table_entry_t, void *));
+htab_traverse (htab, callback, info)
+     htab_t htab;
+     htab_trav callback;
      void *info;
 {
-  hash_table_entry_t *entry_ptr;
-  for (entry_ptr = htab->entries; entry_ptr < htab->entries + htab->size;
-       entry_ptr++)
-    if (*entry_ptr != EMPTY_ENTRY && *entry_ptr != DELETED_ENTRY)
-      if (!callback (*entry_ptr, info))
-	break;
+  void **slot, **limit;
+  slot = htab->entries;
+  limit = slot + htab->size;
+  do
+    {
+      void *x = *slot;
+      if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
+	if (!(*callback) (slot, info))
+	  break;
+    }
+  while (++slot < limit);
 }
 
 /* The following function returns current size of given hash table. */
 
 size_t
-hash_table_size (htab)
-     hash_table_t htab;
+htab_size (htab)
+     htab_t htab;
 {
   return htab->size;
 }
@@ -294,37 +407,23 @@
    hash table. */
 
 size_t
-hash_table_elements_number (htab)
-     hash_table_t htab;
+htab_elements (htab)
+     htab_t htab;
 {
-  return htab->number_of_elements - htab->number_of_deleted_elements;
+  return htab->n_elements - htab->n_deleted;
 }
 
 /* The following function returns number of percents of fixed
    collisions during all work with given hash table. */
 
-int
-hash_table_collisions (htab)
-     hash_table_t htab;
+double
+htab_collisions (htab)
+     htab_t htab;
 {
   int searches;
 
   searches = htab->searches;
   if (searches == 0)
-    searches++;
-  return htab->collisions * 100 / searches;
-}
-
-/* The following function returns number of percents of fixed
-   collisions during all work with all hash tables. */
-
-int
-all_hash_table_collisions ()
-{
-  int searches;
-
-  searches = all_searches;
-  if (searches == 0)
-    searches++;
-  return all_collisions * 100 / searches;
+    return 0.0;
+  return (double)htab->collisions / (double)searches;
 }
diff --git a/libiberty/makefile.dos b/libiberty/makefile.dos
deleted file mode 100644
index 7eba62c..0000000
--- a/libiberty/makefile.dos
+++ /dev/null
@@ -1,29 +0,0 @@
-CFLAGS=-O2
-
-OBJS = \
-	argv.o \
-	basename.o \
-	concat.o \
-	cplus-dem.o \
-	fdmatch.o \
-	floatformat.o \
-	getopt.o \
-	getopt1.o \
-	getruntime.o \
-	hex.o \
-	msdos.o \
-	obstack.o \
-	spaces.o \
-	strerror.o \
-	strsignal.o \
-	xatexit.o \
-	xexit.o \
-	xmalloc.o \
-	$E
-
-.c.o:
-	gcc -I../include $(CFLAGS) -c $<
-
-libiberty.a : $(OBJS)
-	-rm libiberty.a
-	ar rvs libiberty.a $(OBJS)
diff --git a/libiberty/partition.c b/libiberty/partition.c
new file mode 100644
index 0000000..c1d5847
--- /dev/null
+++ b/libiberty/partition.c
@@ -0,0 +1,185 @@
+/* List implentation of a partition of consecutive integers.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by CodeSourcery, LLC.
+
+   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
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "libiberty.h"
+#include "partition.h"
+
+/* Creates a partition of NUM_ELEMENTS elements.  Initially each
+   element is in a class by itself.  */
+
+partition
+partition_new (num_elements)
+     int num_elements;
+{
+  int e;
+  
+  partition part = (partition) 
+    xmalloc (sizeof (struct partition_def) + 
+	     (num_elements - 1) * sizeof (struct partition_elem));
+  part->num_elements = num_elements;
+  for (e = 0; e < num_elements; ++e) 
+    {
+      part->elements[e].class_element = e;
+      part->elements[e].next = &(part->elements[e]);
+      part->elements[e].class_count = 1;
+    }
+
+  return part;
+}
+
+/* Freeds a partition.  */
+
+void
+partition_delete (part)
+      partition part;
+{
+  free (part);
+}
+
+/* Unites the classes containing ELEM1 and ELEM2 into a single class
+   of partition PART.  If ELEM1 and ELEM2 are already in the same
+   class, does nothing.  Returns the canonical element of the
+   resulting union class.  */
+
+int
+partition_union (part, elem1, elem2)
+     partition part;
+     int elem1;
+     int elem2;
+{
+  struct partition_elem *elements = part->elements;
+  struct partition_elem *e1;
+  struct partition_elem *e2;
+  struct partition_elem *p;
+  struct partition_elem *old_next;
+  /* The canonical element of the resulting union class.  */
+  int class_element = elements[elem1].class_element;
+
+  /* If they're already in the same class, do nothing.  */
+  if (class_element == elements[elem2].class_element)
+    return class_element;
+
+  /* Make sure ELEM1 is in the larger class of the two.  If not, swap
+     them.  This way we always scan the shorter list.  */
+  if (elements[elem1].class_count < elements[elem2].class_count) 
+    {
+      int temp = elem1;
+      elem1 = elem2;
+      elem2 = temp;
+      class_element = elements[elem1].class_element;
+    }
+
+  e1 = &(elements[elem1]);
+  e2 = &(elements[elem2]);
+
+  /* Keep a count of the number of elements in the list.  */
+  elements[class_element].class_count 
+    += elements[e2->class_element].class_count;
+
+  /* Update the class fields in elem2's class list.  */
+  e2->class_element = class_element;
+  for (p = e2->next; p != e2; p = p->next)
+    p->class_element = class_element;
+  
+  /* Splice ELEM2's class list into ELEM1's.  These are circular
+     lists.  */
+  old_next = e1->next;
+  e1->next = e2->next;
+  e2->next = old_next;
+
+  return class_element;
+}
+
+/* Compare elements ELEM1 and ELEM2 from array of integers, given a
+   pointer to each.  Used to qsort such an array.  */
+
+static int 
+elem_compare (elem1, elem2)
+     const void *elem1;
+     const void *elem2;
+{
+  int e1 = * (int *) elem1;
+  int e2 = * (int *) elem2;
+  if (e1 < e2)
+    return -1;
+  else if (e1 > e2)
+    return 1;
+  else
+    return 0;
+}
+
+/* Prints PART to the file pointer FP.  The elements of each
+   class are sorted.  */
+
+void
+partition_print (part, fp)
+     partition part;
+     FILE *fp;
+{
+  char *done;
+  int num_elements = part->num_elements;
+  struct partition_elem *elements = part->elements;
+  int *class_elements;
+  int e;
+
+  /* Flag the elements we've already printed.  */
+  done = (char *) xmalloc (num_elements);
+  memset (done, 0, num_elements);
+
+  /* A buffer used to sort elements in a class.  */
+  class_elements = (int *) xmalloc (num_elements * sizeof (int));
+
+  fputc ('[', fp);
+  for (e = 0; e < num_elements; ++e)
+    /* If we haven't printed this element, print its entire class.  */
+    if (! done[e]) 
+      {
+	int c = e;
+	int count = elements[elements[e].class_element].class_count;
+	int i;
+
+      /* Collect the elements in this class.  */
+	for (i = 0; i < count; ++i) {
+	  class_elements[i] = c;
+	  done[c] = 1;
+	  c = elements[c].next - elements;
+	}
+	/* Sort them.  */
+	qsort ((void *) class_elements, count, sizeof (int), &elem_compare);
+	/* Print them.  */
+	fputc ('(', fp);
+	for (i = 0; i < count; ++i) 
+	  fprintf (fp, i == 0 ? "%d" : " %d", class_elements[i]);
+	fputc (')', fp);
+      }
+  fputc (']', fp);
+
+  free (done);
+}
+
diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c
index 5003f1f..56ddec7 100644
--- a/libiberty/pexecute.c
+++ b/libiberty/pexecute.c
@@ -656,7 +656,7 @@
      const char *program;
      char * const *argv;
      const char *this_pname;
-     const char *temp_base;
+     const char *temp_base ATTRIBUTE_UNUSED;
      char **errmsg_fmt, **errmsg_arg;
      int flags;
 {
@@ -763,7 +763,7 @@
 pwait (pid, status, flags)
      int pid;
      int *status;
-     int flags;
+     int flags ATTRIBUTE_UNUSED;
 {
   /* ??? Here's an opportunity to canonicalize the values in STATUS.
      Needed?  */
diff --git a/ltconfig b/ltconfig
index ab304fd..a01334f 100755
--- a/ltconfig
+++ b/ltconfig
@@ -2,7 +2,7 @@
 
 # ltconfig - Create a system-specific libtool.
 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+# 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
@@ -32,12 +32,8 @@
   # Discard the --no-reexec flag, and continue.
   shift
 elif test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit 0
+  # Avoid inline document here, it may be left over
+  :
 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
   # Yippee, $echo works!
   :
@@ -46,9 +42,18 @@
   exec "$SHELL" "$0" --no-reexec ${1+"$@"}
 fi
 
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
 # Find the correct PATH separator.  Usually this is `:', but
 # DJGPP uses `;' like DOS.
-if test "X${PATH_SEPARATOR+set}" != "Xset"; then
+if test "X${PATH_SEPARATOR+set}" != Xset; then
   UNAME=${UNAME-`uname 2>/dev/null`}
   case X$UNAME in
     *-DOS) PATH_SEPARATOR=';' ;;
@@ -58,9 +63,9 @@
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
 
-if test "X${echo_test_string+set}" != "Xset"; then
+if test "X${echo_test_string+set}" != Xset; then
   # find a string as large as possible, as long as the shell can cope with it
   for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
     # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
@@ -82,7 +87,7 @@
 
   IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
   for dir in $PATH /usr/ucb; do
-    if test -f $dir/echo &&
+    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="$dir/echo"
@@ -97,7 +102,8 @@
        test "X`(print -r "$echo_test_string") 2>/dev/null`" = 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 "X$CONFIG_SHELL" != X/bin/ksh; then
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
       # If we have ksh, try running ltconfig again with it.
       ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
       export ORIGINAL_CONFIG_SHELL
@@ -163,10 +169,10 @@
 # Constants:
 PROGRAM=ltconfig
 PACKAGE=libtool
-VERSION=1.2f
-TIMESTAMP=" (1.385 1999/03/15 17:24:54)"
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+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"
 
 help="Try \`$progname --help' for more information."
@@ -175,10 +181,12 @@
 default_ofile=libtool
 can_build_shared=yes
 enable_shared=yes
-# All known linkers require a `.a' archive for static linking.
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
 enable_static=yes
 enable_fast_install=yes
 enable_dlopen=unknown
+enable_win32_dll=no
 ltmain=
 silent=
 srcdir=
@@ -194,17 +202,21 @@
 ac_ext=c
 objext=o
 libext=a
+exeext=
 cache_file=
 
 old_AR="$AR"
 old_CC="$CC"
 old_CFLAGS="$CFLAGS"
 old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
 old_LD="$LD"
 old_LN_S="$LN_S"
+old_LIBS="$LIBS"
 old_NM="$NM"
 old_RANLIB="$RANLIB"
 old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
 old_AS="$AS"
 
 # Parse the command line options.
@@ -235,7 +247,7 @@
     --disable-static       do not build static libraries
     --disable-fast-install do not optimize for fast installation
     --enable-dlopen        enable dlopen support
-    --enable-dlopen-self   enable support for dlopening programs
+    --enable-win32-dll     enable building dlls on win32 hosts
     --help                 display this help and exit
     --no-verify            do not verify that HOST is a valid host type
 -o, --output=FILE          specify the output file [default=$default_ofile]
@@ -269,6 +281,8 @@
 
   --enable-dlopen) enable_dlopen=yes ;;
 
+  --enable-win32-dll) enable_win32_dll=yes ;;
+
   --quiet | --silent) silent=yes ;;
 
   --srcdir) prev=srcdir ;;
@@ -355,8 +369,8 @@
 # Only set LANG and LC_ALL to C if already set.
 # These must not be set unconditionally because not all systems understand
 # e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+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
   echo "loading cache $cache_file within ltconfig"
@@ -448,7 +462,7 @@
   # AIX sometimes has problems with the GCC collect2 program.  For some
   # reason, if we set the COLLECT_NAMES environment variable, the problems
   # vanish in a puff of smoke.
-  if test "${COLLECT_NAMES+set}" != set; then
+  if test "X${COLLECT_NAMES+set}" != Xset; then
     COLLECT_NAMES=
     export COLLECT_NAMES
   fi
@@ -463,6 +477,9 @@
 # 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
@@ -471,7 +488,7 @@
   IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
   for dir in $PATH; do
     test -z "$dir" && dir=.
-    if test -f $dir/ranlib; then
+    if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
       RANLIB="ranlib"
       result="ranlib"
       break
@@ -487,8 +504,9 @@
   old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
 fi
 
-# Set sane defaults for `DLLTOOL' and `AS', used on cygwin.
+# 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.
@@ -498,9 +516,8 @@
     echo $ac_n "checking for gcc... $ac_c" 1>&6
     IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
     for dir in $PATH; do
-      IFS="$save_ifs"
       test -z "$dir" && dir=.
-      if test -f $dir/gcc; then
+      if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
 	CC="gcc"
 	break
       fi
@@ -521,7 +538,7 @@
     cc_rejected=no
     for dir in $PATH; do
       test -z "$dir" && dir=.
-      if test -f $dir/cc; then
+      if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
 	if test "$dir/cc" = "/usr/ucb/cc"; then
 	  cc_rejected=yes
 	  continue
@@ -561,7 +578,7 @@
   # 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:564: checking whether we are using GNU C" >&5
+  echo "$progname:581: checking whether we are using GNU C" >&5
 
   $rm conftest.c
   cat > conftest.c <<EOF
@@ -569,7 +586,7 @@
   yes;
 #endif
 EOF
-  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:572: \"$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 $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
@@ -583,8 +600,8 @@
 echo $ac_n "checking for object suffix... $ac_c" 1>&6
 $rm conftest*
 echo 'int i = 1;' > conftest.c
-echo "$progname:586: checking for object suffix" >& 5
-if { (eval echo $progname:587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+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
 
@@ -602,6 +619,38 @@
 $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
+
 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
 pic_flag=
 special_shlib_compile_flags=
@@ -614,7 +663,7 @@
   link_static_flag='-static'
 
   case "$host_os" in
-  beos* | irix5* | irix6* | osf3* | osf4*)
+  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
     # PIC is the default for these OSes.
     ;;
   aix*)
@@ -635,6 +684,11 @@
     # 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'
     ;;
@@ -664,7 +718,7 @@
     # We can build DLLs from non-PIC.
     ;;
 
-  osf3* | osf4*)
+  osf3* | osf4* | osf5*)
     # All OSF/1 code is PIC.
     wl='-Wl,'
     link_static_flag='-non_shared'
@@ -688,7 +742,7 @@
     wl='-Qoption ld '
     ;;
 
-  sysv4.2uw2* | sysv4.3* | sysv5*)
+  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
     pic_flag='-KPIC'
     link_static_flag='-Bstatic'
     wl='-Wl,'
@@ -698,7 +752,12 @@
     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
     ;;
@@ -714,8 +773,8 @@
   echo "int some_variable = 0;" > conftest.c
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $pic_flag -DPIC"
-  echo "$progname:717: checking if $compiler PIC flag $pic_flag works" >&5
-  if { (eval echo $progname:718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+  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
     
@@ -753,16 +812,26 @@
 
 # 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
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
 $rm conftest*
 echo "int some_variable = 0;" > conftest.c
+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
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
 save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -c -o conftest2.o"
-echo "$progname:760: checking if $compiler supports -c -o file.o" >&5
-if { (eval echo $progname:761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest2.o; then
+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
 
   # 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
+    if test -s out/conftest.err; then
       echo "$ac_t"no 1>&6
       compiler_c_o=no
     else
@@ -771,12 +840,17 @@
     fi
 else
   # Append any errors to the config.log.
-  cat conftest.err 1>&5
+  cat out/conftest.err 1>&5
   compiler_c_o=no
   echo "$ac_t"no 1>&6
 fi
 CFLAGS="$save_CFLAGS"
-$rm conftest*
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+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
@@ -785,8 +859,8 @@
   echo "int some_variable = 0;" > conftest.c
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -c -o conftest.lo"
-  echo "$progname:788: checking if $compiler supports -c -o file.lo" >&5
-if { (eval echo $progname:789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+  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
@@ -837,8 +911,8 @@
   echo "int some_variable = 0;" > conftest.c
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
-  echo "$progname:840: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-  if { (eval echo $progname:841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+  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
 
     # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -881,8 +955,8 @@
 echo 'main(){return(0);}' > conftest.c
 save_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS $link_static_flag"
-echo "$progname:884: checking if $compiler static flag $link_static_flag works" >&5
-if { (eval echo $progname:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+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
@@ -894,9 +968,9 @@
 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 conftestdata
-  if ln -s X conftestdata 2>/dev/null; then
-    $rm conftestdata
+  $rm conftest.dat
+  if ln -s X conftest.dat 2>/dev/null; then
+    $rm conftest.dat
     LN_S="ln -s"
   else
     LN_S=ln
@@ -914,11 +988,11 @@
   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:917: checking for ld used by GCC" >&5
+    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]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
@@ -938,17 +1012,17 @@
     esac
   elif test "$with_gnu_ld" = yes; then
     echo $ac_n "checking for GNU ld... $ac_c" 1>&6
-    echo "$progname:941: checking for GNU ld" >&5
+    echo "$progname:1015: checking for GNU ld" >&5
   else
     echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-    echo "$progname:944: checking for non-GNU ld" >&5
+    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"; then
+      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.
@@ -1007,7 +1081,7 @@
 hardcode_shlibpath_var=unsupported
 runpath_var=
 always_export_symbols=no
-export_symbols_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+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=
@@ -1015,7 +1089,12 @@
 # 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=
+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*)
@@ -1027,10 +1106,6 @@
   fi
   ;;
 
-freebsd2* | sunos4*)
-  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
-  ;;
-
 esac
 
 ld_shlibs=yes
@@ -1058,18 +1133,21 @@
     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
-    ;;
 
-  sunos4*)
-    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
-    wlarc=
-    hardcode_direct=yes
-    hardcode_minus_L=yes
-    hardcode_shlibpath_var=no
+    # 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
@@ -1086,25 +1164,64 @@
     # 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='rm -f $objdir/$soname-ltdll.c~
-      sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
-      (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~
+    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;
+	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'
+      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
     ;;
 
   *)
@@ -1121,7 +1238,20 @@
     runpath_var=LD_RUN_PATH
     hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
     export_dynamic_flag_spec='${wl}--export-dynamic'
-    whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    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)
@@ -1141,35 +1271,45 @@
     ;;
 
   aix4*)
-    allow_undefined_flag=
+    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
-      if strings `${CC} -print-prog-name=collect2` | \
-	 grep resolve_lib_name >/dev/null
+      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
-      archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs $linkopts'
+      shared_flag='-shared'
     else
-      always_export_symbols=yes
-      archive_expsym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry'
+      shared_flag='${wl}-bM:SRE'
       hardcode_direct=yes
     fi
-    hardcode_minus_L=yes
-    # Though LIBPATH variable hardcodes shlibpath into executable,
-    # it doesn't affect searching for -l* libraries; this confuses
-    # tests in mdemo.
-    hardcode_shlibpath_var=unsupported
-    hardcode_libdir_flag_spec='-L$libdir'
+    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*)
@@ -1192,7 +1332,6 @@
 
   freebsd1*)
     ld_shlibs=no
-    can_build_shared=no
     ;;
 
   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
@@ -1203,7 +1342,6 @@
     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
-    hardcode_minus_L=no # verified on 2.2.6
     hardcode_shlibpath_var=no
     ;;
 
@@ -1220,31 +1358,27 @@
     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
-    hardcode_minus_L=no
     hardcode_shlibpath_var=no
     ;;
 
-  hpux9*)
-    archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib'
+  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
-    export_dynamic_flag_spec='${wl}-E'
-    ;;
-
-  hpux10* | hpux11*)
-    archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-    hardcode_direct=yes
-    hardcode_minus_L=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` -o $lib'
+      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` -o $lib'
+      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=:
@@ -1276,21 +1410,35 @@
     old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
     ;;
 
-  osf3* | osf4*)
+  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` -o $lib'
+      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` -o $lib'
+      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 -o $lib $libobjs $deplibs $linkopts'
-    hardcode_direct=yes
+    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*)
@@ -1302,63 +1450,100 @@
 		$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*)
-    # Why do we need -Bstatic?  To avoid inter-library dependencies, maybe...
-    if test "$with_gcc" = yes; then
-      # Use -fPIC here because libgcc is multilibbed
-      archive_cmds='$CC -shared ${wl}-Bstatic -fPIC -o $lib $libobjs $deplibs $linkopts'
-    else
-      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
-    fi
+    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_direct=no
-    hardcode_minus_L=no
     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_direct=no
-    hardcode_minus_L=no
     hardcode_shlibpath_var=no
     ;;
 
   dgux*)
     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
     hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_direct=no
+    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
-    can_build_shared=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.
+  [\\/]* | [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; then
+      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
@@ -1416,6 +1601,9 @@
 solaris*)
   symcode='[BDT]'
   ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
 esac
 
 # If we're using GNU nm, then use its standard symbol codes.
@@ -1444,11 +1632,11 @@
 main(){nm_test_var='a';nm_test_func();return(0);}
 EOF
 
-  echo "$progname:1447: checking if global_symbol_pipe works" >&5
-  if { (eval echo $progname:1448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+  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:1451: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+    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
@@ -1495,12 +1683,12 @@
 #endif
 EOF
 	  # Now try linking the two files.
-	  mv conftest.$objext conftestm.$objext
+	  mv conftest.$objext conftstm.$objext
 	  save_LIBS="$LIBS"
 	  save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$objext"
+	  LIBS="conftstm.$objext"
 	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo $progname:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+	  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
@@ -1520,7 +1708,7 @@
     echo "$progname: failed program was:" >&5
     cat conftest.c >&5
   fi
-  $rm conftest*
+  $rm conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
   if test "$pipe_works" = yes; then
@@ -1529,7 +1717,11 @@
     global_symbol_pipe=
   fi
 done
-echo "$ac_t$pipe_works" 1>&6
+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=
@@ -1542,10 +1734,12 @@
    test -n "$runpath_var"; then
 
   # We can hardcode non-existant directories.
-  if test "$hardcode_direct" != no && \
-     test "$hardcode_minus_L" != no && \
-     test "$hardcode_shlibpath_var" != no; then
-
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
     # Linking always hardcodes the temporary library directory.
     hardcode_action=relink
   else
@@ -1628,19 +1822,25 @@
   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
   ;;
 
 bsdi4*)
   version_type=linux
-  library_names_spec='${libname}.so$major ${libname}.so'
-  soname_spec='${libname}.so'
-  finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir'
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method='file_magic ELF 32-bit LSB shared object'
+  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
   # the default ld.so.conf also contains /usr/contrib/lib and
   # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
   # libtool to hard-code these into programs
@@ -1648,17 +1848,20 @@
 
 cygwin* | mingw*)
   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'
   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'
-  need_lib_prefix=no
+  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"
+  lt_cv_dlopen_libs=
   ;;
 
 freebsd1*)
@@ -1683,13 +1886,23 @@
       need_version=yes
       ;;
   esac
-  finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
+  case "$host_os" in
+  freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    ;;
+  esac
   ;;
 
 gnu*)
   version_type=linux
-  library_names_spec='${libname}${release}.so$versuffix ${libname}.so'
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -1701,46 +1914,41 @@
   need_lib_prefix=no
   need_version=no
   shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
   library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
   soname_spec='${libname}${release}.sl$major'
   # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-irix5*)
-  version_type=irix
-  soname_spec='${libname}${release}.so'
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
-  shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" # or should it be pass_all?
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=`echo /lib/libc.so*`
-  shlibpath_overrides_runpath=no
-  ;;
-
-irix6*)
+irix5* | irix6*)
   version_type=irix
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}.so'
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
-  case "$LD" in # libtool.m4 will add one of these switches to LD
-  *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
-  *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
-  *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
-  *) libsuff= shlibsuff= libmagic=never-match;;
+  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
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
-  # even though /usr/local/lib is always searched, the man-page says
-  # shared libraries should not be installed there if they use an ABI
-  # different from -32, so we'd better not search for shared libraries
-  # there either
-  sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-  deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" # or should it be pass_all?
+  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.
@@ -1755,7 +1963,7 @@
   need_version=no
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   soname_spec='${libname}${release}.so$major'
-  finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
+  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 )'
@@ -1777,7 +1985,7 @@
   version_type=sunos
   if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
     library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
-    finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
     library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
@@ -1806,19 +2014,17 @@
   shlibpath_var=LIBPATH
   ;;
 
-osf3* | osf4*)
+osf3* | osf4* | osf5*)
   version_type=osf
+  need_version=no
   soname_spec='${libname}${release}.so'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
-  # deplibs_check_method='pass_all'
-  # Although pass_all appears to work, it copies symbols from static libraries
-  # into shared ones and exports them.  So, when a program is linked with two
-  # or more libraries that have got copies of the same symbols, link fails
-  # This was only tested on osf4:
+  # 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"
   ;;
@@ -1857,7 +2063,7 @@
   need_version=yes
   ;;
 
-sysv4.2uw2* | sysv4.3* | sysv5*)
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
   version_type=linux
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   soname_spec='${libname}${release}.so$major'
@@ -1866,6 +2072,15 @@
     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
   ;;
 
@@ -1885,6 +2100,15 @@
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
 *)
   dynamic_linker=no
   ;;
@@ -1895,6 +2119,17 @@
 # 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*)
+  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
+  fi
+;;
+esac
+
 if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
   case "$deplibs_check_method" in
   "file_magic "*)
@@ -1973,53 +2208,8 @@
 else
 if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
   lt_cv_dlopen=no lt_cv_dlopen_libs=
-echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "$progname:1977: checking for dlopen" >&5
-if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1982 "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen(); 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 dlopen();
-
-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_dlopen) || defined (__stub___dlopen)
-choke me
-#else
-dlopen();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo $progname:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "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"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; 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 -ldl""... $ac_c" 1>&6
-echo "$progname:2022: checking for dlopen in -ldl" >&5
+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 $ac_n "(cached) $ac_c" 1>&6
@@ -2027,17 +2217,20 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2030 "ltconfig"
+#line 2220 "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:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:2233: \"$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
@@ -2055,8 +2248,55 @@
   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 $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2257 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); 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.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+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_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "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"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "$progname:2059: checking for dld_link in -ldld" >&5
+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 $ac_n "(cached) $ac_c" 1>&6
@@ -2064,17 +2304,20 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2067 "ltconfig"
+#line 2307 "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 dld_link();
 
 int main() {
 dld_link()
 ; return 0; }
 EOF
-if { (eval echo $progname:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:2320: \"$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
@@ -2093,18 +2336,21 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "$progname:2096: checking for shl_load" >&5
+echo "$progname:2339: checking for shl_load" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2101 "ltconfig"
+#line 2344 "ltconfig"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shl_load(); 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.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 char shl_load();
 
 int main() {
@@ -2120,7 +2366,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo $progname:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:2369: \"$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"
 else
@@ -2137,54 +2383,50 @@
   lt_cv_dlopen="shl_load"
 else
   echo "$ac_t""no" 1>&6
-echo $ac_n "checking for LoadLibrary""... $ac_c" 1>&6
-echo "$progname:2141: checking for LoadLibrary" >&5
-if eval "test \"`echo '$''{'ac_cv_func_LoadLibrary'+set}'`\" = set"; then
+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 $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2146 "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char LoadLibrary(); below.  */
-#include <assert.h>
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2395 "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
     builtin and then its argument prototype would still apply.  */
-char LoadLibrary();
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
 
 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_LoadLibrary) || defined (__stub___LoadLibrary)
-choke me
-#else
-LoadLibrary();
-#endif
-
+shl_load()
 ; return 0; }
 EOF
-if { (eval echo $progname:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:2409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_LoadLibrary=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_LoadLibrary=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'LoadLibrary`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  lt_cv_dlopen="LoadLibrary"
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-      
+
 fi
 
     
@@ -2207,17 +2449,17 @@
 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:2210: checking for $ac_hdr" >&5
+echo "$progname:2452: 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 2215 "ltconfig"
+#line 2457 "ltconfig"
 #include <$ac_hdr>
 int fnord = 0;
 EOF
-ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo $progname:2220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2462: \"$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*
@@ -2245,7 +2487,7 @@
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
   echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "$progname:2248: checking whether a program can dlopen itself" >&5
+echo "$progname:2490: checking whether a program can dlopen itself" >&5
 if test "${lt_cv_dlopen_self+set}" = set; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2253,7 +2495,7 @@
     lt_cv_dlopen_self=cross
   else
     cat > conftest.c <<EOF
-#line 2256 "ltconfig"
+#line 2498 "ltconfig"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
@@ -2296,10 +2538,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) exit(0); } exit(1); } 
+	       if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
 
 EOF
-if { (eval echo $progname:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   lt_cv_dlopen_self=yes
 else
@@ -2318,7 +2560,7 @@
   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:2321: checking whether a statically linked program can dlopen itself" >&5
+echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5
 if test "${lt_cv_dlopen_self_static+set}" = set; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2326,7 +2568,7 @@
     lt_cv_dlopen_self_static=cross
   else
     cat > conftest.c <<EOF
-#line 2329 "ltconfig"
+#line 2571 "ltconfig"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
@@ -2369,10 +2611,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) exit(0); } exit(1); } 
+    if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
 
 EOF
-if { (eval echo $progname:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo $progname:2617: \"$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
@@ -2416,8 +2658,10 @@
 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_NM old_RANLIB \
-    old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+  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 \
     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 \
@@ -2462,7 +2706,7 @@
 # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
 #
 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+# 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
@@ -2488,7 +2732,7 @@
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
 
 ### BEGIN LIBTOOL CONFIG
 EOF
@@ -2497,8 +2741,9 @@
 
 *)
   # Double-quote the variables that need it (for aesthetics).
-  for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
-    old_LN_S old_DLLTOOL old_AS; do
+  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
     eval "$var=\\\"\$var\\\""
   done
 
@@ -2518,8 +2763,9 @@
 # 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 NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
-# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\
+# 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 \\
 #   $0$ltconfig_args
 #
 # Compiler and other test output produced by $progname, useful for
@@ -2565,6 +2811,9 @@
 # Used on cygwin: DLL creation program.
 DLLTOOL="$DLLTOOL"
 
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
 # Used on cygwin: assembler.
 AS="$AS"
 
@@ -2584,10 +2833,13 @@
 # Old archive suffix (normally "a").
 libext="$libext"
 
+# Executable file suffix (normally "").
+exeext="$exeext"
+
 # Additional compiler flags for building library objects.
 pic_flag=$pic_flag
 
-# Does compiler simultaneously support -c and -o options
+# Does compiler simultaneously support -c and -o options?
 compiler_c_o=$compiler_c_o
 
 # Can we write directly to a .lo ?
@@ -2657,7 +2909,7 @@
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$deplibs_check_method
 
-# Command to use when deplibs_check_method == file_magic
+# Command to use when deplibs_check_method == file_magic.
 file_magic_cmd=$file_magic_cmd
 
 # Flag that allows shared libraries with undefined symbols to be built.
@@ -2718,16 +2970,16 @@
 # Fix the shell variable \$srcfile for the compiler.
 fix_srcfile_path="$fix_srcfile_path"
 
-# Set to yes if exported symbols are required
+# Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
-# The command to extract exported symbols
+# The commands to list exported symbols.
 export_symbols_cmds=$export_symbols_cmds
 
-# Symbols that should not be listed in the preloaded symbols
+# Symbols that should not be listed in the preloaded symbols.
 exclude_expsyms=$exclude_expsyms
 
-# Symbols that must always be exported
+# Symbols that must always be exported.
 include_expsyms=$include_expsyms
 
 EOF
@@ -2743,7 +2995,7 @@
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
 # vanish in a puff of smoke.
-if test "${COLLECT_NAMES+set}" != set; then
+if test "X${COLLECT_NAMES+set}" != Xset; then
   COLLECT_NAMES=
   export COLLECT_NAMES
 fi
@@ -2752,7 +3004,11 @@
   esac
 
   # Append the ltmain.sh script.
-  cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+  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"
   ;;
diff --git a/ltmain.sh b/ltmain.sh
index 878787a..c32939e 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,8 +1,8 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
 #
-# Copyright (C) 1996-1999 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+# 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
@@ -28,12 +28,8 @@
   # Discard the --no-reexec flag, and continue.
   shift
 elif test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit 0
+  # Avoid inline document here, it may be left over
+  :
 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
   # Yippee, $echo works!
   :
@@ -42,6 +38,15 @@
   exec $SHELL "$0" --no-reexec ${1+"$@"}
 fi
 
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
 # The name of this program.
 progname=`$echo "$0" | sed 's%^.*/%%'`
 modename="$progname"
@@ -49,8 +54,8 @@
 # Constants.
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.2f
-TIMESTAMP=" (1.33 1999/04/26 16:28:53)"
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -64,7 +69,7 @@
 Xsed='sed -e 1s/^X//'
 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
 SP2NL='tr \040 \012'
-NL2SP='tr \012 \040'
+NL2SP='tr \015\012 \040\040'
 
 # NLS nuisances.
 # Only set LANG and LC_ALL to C if already set.
@@ -100,6 +105,7 @@
 show_help=
 execute_dlfiles=
 lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
 
 # Parse our command line options once, thoroughly.
 while test $# -gt 0
@@ -429,7 +435,13 @@
       fbsd_hideous_sh_bug=$base_compile
 
       # All platforms use -DPIC, to notify preprocessed assembler code.
-      command="$base_compile $pic_flag -DPIC $srcfile"
+      # 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%/[^/]*$%%'`
@@ -460,6 +472,7 @@
 	command="$command -o $output_obj"
       fi
 
+      $run $rm "$output_obj"
       $show "$command"
       if $run eval "$command"; then :
       else
@@ -514,9 +527,17 @@
 	  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 "$LN_S $obj $lo_libobj"
-	if $run $LN_S $obj $lo_libobj; then
+	$show "(cd $xdir && $LN_S $baseobj $libobj)"
+	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
 	  exit 0
 	else
 	  error=$?
@@ -539,6 +560,7 @@
 
       # Suppress compiler output if we already did a PIC compilation.
       command="$command$suppress_output"
+      $run $rm "$output_obj"
       $show "$command"
       if $run eval "$command"; then :
       else
@@ -606,9 +628,18 @@
   link)
     modename="$modename: link"
     C_compiler="$CC" # save it, to compile generated C sources
-    # CYGNUS LOCAL: tromey/java
     # Always respect the CC configured in by ltconfig.
-    # CC="$nonopt"
+    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*)
@@ -633,10 +664,24 @@
 # #undef WIN32_LEAN_AND_MEAN
 # #include <stdio.h>
 #
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #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
@@ -783,8 +828,8 @@
       allow_undefined=yes
       ;;
     esac
-    compile_command="$CC"
-    finalize_command="$CC"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
 
     compile_rpath=
     finalize_rpath=
@@ -818,6 +863,7 @@
     ltlibs=
     module=no
     objs=
+    prefer_static_libs=no
     preload=no
     prev=
     prevarg=
@@ -834,11 +880,21 @@
     do
       case "$arg" in
       -all-static | -static)
-	if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
 	fi
 	build_libtool_libs=no
 	build_old_libs=yes
+	prefer_static_libs=yes
 	break
 	;;
       esac
@@ -871,18 +927,32 @@
 	  fi
 	  case "$arg" in
 	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
 	  self)
 	    if test "$prev" = dlprefiles; then
 	      dlself=yes
 	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
 	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
 	    fi
 	    prev=
 	    continue
 	    ;;
 	  *)
-	    dlprefiles="$dlprefiles $arg"
-	    test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
 	    prev=
 	    ;;
 	  esac
@@ -906,13 +976,26 @@
 	  prev=
 	  continue
 	  ;;
-	rpath)
-	  rpath="$rpath $arg"
-	  prev=
-	  continue
-	  ;;
-	xrpath)
-	  xrpath="$xrpath $arg"
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case "$arg" in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
 	  prev=
 	  continue
 	  ;;
@@ -931,7 +1014,6 @@
 	if test -n "$link_static_flag"; then
 	  compile_command="$compile_command $link_static_flag"
 	  finalize_command="$finalize_command $link_static_flag"
-	  dlopen_self=$dlopen_self_static
 	fi
 	continue
 	;;
@@ -958,22 +1040,16 @@
 	;;
 
       -export-dynamic)
-	if test "$export_dynamic" != yes; then
-	  export_dynamic=yes
-	  if test -n "$export_dynamic_flag_spec"; then
-	    eval arg=\"$export_dynamic_flag_spec\"
-	  else
-	    arg=
-	  fi
-	fi
+	export_dynamic=yes
+	continue
 	;;
 
       -export-symbols | -export-symbols-regex)
 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	  $echo "$modename: cannot have more than one -exported-symbols"
+	  $echo "$modename: not more than one -exported-symbols argument allowed"
 	  exit 1
 	fi
-	if test "$arg" = "-export-symbols"; then
+	if test "X$arg" = "X-export-symbols"; then
 	  prev=expsyms
 	else
 	  prev=expsyms_regex
@@ -982,14 +1058,18 @@
 	;;
 
       -L*)
-	dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
 	case "$dir" in
-	/* | [A-Za-z]:[/\\]*)
-	  # Add the corresponding hardcode_libdir_flag, if it is not identical.
-	  ;;
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
 	*)
-	  $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
-	  exit 1
+	  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
+	  dir="$absdir"
 	  ;;
 	esac
 	case " $deplibs " in
@@ -1013,20 +1093,29 @@
 	;;
 
       -l*)
+	if test "$arg" = "-lc"; then
+	  case "$host" in
+	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+	    # These systems don't actually have c library (as such)
+	    continue
+	    ;;
+	  esac
+	elif test "$arg" = "-lm"; then
+	  case "$host" in
+	  *-*-cygwin* | *-*-beos*)
+	    # These systems don't actually have math library (as such)
+	    continue
+	    ;;
+	  esac
+	fi
 	deplibs="$deplibs $arg"
 	;;
 
       -module)
-	if test "$module" != yes; then
-	  module=yes
-	  if test -n "$export_dynamic_flag_spec"; then
-	    eval arg=\"$export_dynamic_flag_spec\"
-	  else
-	    arg=
-	  fi
-	fi
+	module=yes
+	continue
 	;;
-	
+
       -no-undefined)
 	allow_undefined=no
 	continue
@@ -1050,7 +1139,19 @@
 	;;
 
       -R*)
-	xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case "$dir" in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit 1
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
 	continue
 	;;
 
@@ -1059,7 +1160,6 @@
 	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"
-	  dlopen_self=$dlopen_self_static
 	fi
 	continue
 	;;
@@ -1131,6 +1231,7 @@
 	# 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 ;;
@@ -1163,7 +1264,7 @@
 	fi
 
 	if test -n "$dependency_libs"; then
-	  # Extract -R from dependency_libs
+	  # Extract -R and -L from dependency_libs
 	  temp_deplibs=
 	  for deplib in $dependency_libs; do
 	    case "$deplib" in
@@ -1175,7 +1276,13 @@
 	    -L*) case "$compile_command $temp_deplibs " in
 		 *" $deplib "*) ;;
 		 *) temp_deplibs="$temp_deplibs $deplib";;
-		 esac;;
+		 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
@@ -1221,7 +1328,8 @@
 	  prev=
 	fi
 
-	if test "$build_libtool_libs" = yes && test -n "$library_names"; then
+	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.
@@ -1233,12 +1341,13 @@
 
 	  # We need an absolute path.
 	  case "$dir" in
-	  /* | [A-Za-z]:[/\\]*) absdir="$dir" ;;
+	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
 	  *)
 	    absdir=`cd "$dir" && pwd`
 	    if test -z "$absdir"; then
-	      $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
-	      exit 1
+	      $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
@@ -1247,24 +1356,24 @@
 	  # 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 "*) ;;
+	  *" $absdir "*) ;;
 	  *)
 	    case "$compile_rpath " in
 	    *" $absdir "*) ;;
 	    *) compile_rpath="$compile_rpath $absdir" 
 	    esac
 	    ;;
- 	  esac
+	  esac
 
 	  case " $sys_lib_dlsearch_path " in
- 	  *" $libdir "*) ;;
+	  *" $libdir "*) ;;
 	  *)
 	    case "$finalize_rpath " in
 	    *" $libdir "*) ;;
 	    *) finalize_rpath="$finalize_rpath $libdir"
 	    esac
 	    ;;
- 	  esac
+	  esac
 
 	  lib_linked=yes
 	  case "$hardcode_action" in
@@ -1422,6 +1531,12 @@
       exit 1
     fi
 
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
     oldlibs=
     # calculate the name of the file, without its directory
     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
@@ -1444,7 +1559,7 @@
 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
       fi
 
-      if test -n "$dlfiles$dlprefiles"; then
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
       fi
 
@@ -1464,7 +1579,7 @@
 	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
       fi
 
-      if test -n "$export_symbols"; then
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
       fi
 
@@ -1503,11 +1618,6 @@
 	output_objdir="$output_objdir/$objdir"
       fi
 
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
       if test -n "$objs"; then
 	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
 	exit 1
@@ -1519,7 +1629,7 @@
 	 exit 1
       fi
 
-      if test -n "$dlfiles$dlprefiles"; then
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
       fi
 
@@ -1702,7 +1812,7 @@
 
 	dependency_libs="$deplibs"
 	case "$host" in
-	*-*-cygwin* | *-*-mingw* | *-*-os2*)
+	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
 	  # these systems don't actually have a c library (as such)!
 	  ;;
 	*)
@@ -1750,12 +1860,13 @@
 	droppeddeps=no
 	case "$deplibs_check_method" in
 	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behaviour.
 	  newdeplibs=$deplibs
-		    ;; # Don't check for shared/static.  Everything works.
-		       # This might be a little naive.  We might want to check
-		       # whether the library exists or not.  But this is on
-		       # osf3 & osf4 and I'm not really sure... Just
-		       # implementing what was already the behaviour.
+	  ;;
 	test_compile)
 	  # This code stresses the "libraries are programs" paradigm to its
 	  # limits. Maybe even breaks it.  We compile a program, linking it
@@ -1766,7 +1877,7 @@
 	  int main() { return 0; }
 EOF
 	  $rm conftest
-	  $C_compiler -o conftest conftest.c $deplibs
+	  $CC -o conftest conftest.c $deplibs
 	  if test $? -eq 0 ; then
 	    ldd_output=`ldd conftest`
 	    for i in $deplibs; do
@@ -1799,24 +1910,24 @@
 	     # If $name is empty we are operating on a -L argument.
 	      if test "$name" != "" ; then
 		$rm conftest
-		$C_compiler -o conftest conftest.c $i
+		$CC -o conftest conftest.c $i
 		# Did it work?
 		if test $? -eq 0 ; then
 		  ldd_output=`ldd conftest`
-		    libname=`eval \\$echo \"$libname_spec\"`
-		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
-		    set dummy $deplib_matches
-		    deplib_match=$2
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
-		    else
-		      droppeddeps=yes
-		      echo
-		      echo "*** Warning: This library needs some functionality provided by $i."
-		      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."
-		    fi
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    echo "*** Warning: This library needs some functionality provided by $i."
+		    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."
+		  fi
 		else
 		  droppeddeps=yes
 		  echo
@@ -1830,7 +1941,6 @@
 	      fi
 	    done
 	  fi
-	  deplibs=$newdeplibs
 	  ;;
 	file_magic*)
 	  set dummy $deplibs_check_method
@@ -1844,7 +1954,7 @@
 		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		    for potent_lib in $potential_libs; do
 		      # Follow soft links.
-		      if ls -lLd "$potlib" 2>/dev/null \
+		      if ls -lLd "$potent_lib" 2>/dev/null \
 			 | grep " -> " >/dev/null; then
 			continue 
 		      fi
@@ -1857,11 +1967,11 @@
 		      while test -h "$potlib" 2>/dev/null; do
 			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 			case "$potliblink" in
-			/*) potlib="$potliblink";;
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
-		      if eval $file_magic_cmd \"\$potlib\" \
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
 			 | sed 10q \
 			 | egrep "$file_magic_regex" > /dev/null; then
 			newdeplibs="$newdeplibs $a_deplib"
@@ -1884,7 +1994,8 @@
 	    fi
 	  done # Gone through all deplibs.
 	  ;;
-	none | unknown | *) newdeplibs=""
+	none | unknown | *)
+	  newdeplibs=""
 	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
 	     grep . >/dev/null; then
@@ -1926,21 +2037,23 @@
 	    else
 	      build_libtool_libs=no
 	    fi
-	    dlname=
-	    library_names=
 	  else
 	    echo "*** The inter-library dependencies that have been dropped here will be"
 	    echo "*** automatically added whenever a program is linked with this library"
 	    echo "*** or is declared to -dlopen it."
 	  fi
 	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
       fi
 
-      # test again, we may have decided not to build it any more
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+      
+      # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
-	deplibs=$newdeplibs
-	# Done checking deplibs!
- 
 	# Get the real and link names of the library.
 	eval library_names=\"$library_names_spec\"
 	set dummy $library_names
@@ -1960,52 +2073,30 @@
 	done
 
 	# Ensure that we have .o objects for linkers which dislike .lo
-	# (e.g. aix) incase we are running --disable-static
+	# (e.g. aix) in case we are running --disable-static
 	for obj in $libobjs; do
-	  oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
-	  test -f $oldobj || ${LN_S} $obj $oldobj
+	  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
 
 	# Use standard objects if they are pic
 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
-	if test -n "$whole_archive_flag_spec"; then
-	  if test -n "$convenience"; then
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	  fi
-	else
-	  for xlib in $convenience; do
-	    # Extract the objects.
-	    xdir="$xlib"x
-	    generated="$generated $xdir"
-	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
-
-	    $show "${rm}r $xdir"
-	    $run ${rm}r "$xdir"
-	    $show "mkdir $xdir"
-	    $run mkdir "$xdir"
-	    status=$?
-	    if test $status -ne 0 && test ! -d "$xdir"; then
-	      exit $status
-	    fi
-	    $show "(cd $xdir && $AR x ../$xlib)"
-	    $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
-
-	    libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
-	  done
-	fi
-
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-	  eval flag=\"$thread_safe_flag_spec\"
-
-	  linkopts="$linkopts $flag"
-	fi
-
 	# Prepare the list of exported symbols
 	if test -z "$export_symbols"; then
 	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
 	    $show "generating symbol list for \`$libname.la'"
-	    export_symbols="$objdir/$libname.exp"
+	    export_symbols="$output_objdir/$libname.exp"
 	    $run $rm $export_symbols
 	    eval cmds=\"$export_symbols_cmds\"
 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
@@ -2028,6 +2119,51 @@
 	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
 	fi
 
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "mkdir $gentop"
+	    $run mkdir "$gentop"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$gentop"; then
+	      exit $status
+	    fi
+	    generated="$generated $gentop"
+
+	    for xlib in $convenience; do
+	      # Extract the objects.
+	      case "$xlib" in
+	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	      *) xabs=`pwd`"/$xlib" ;;
+	      esac
+	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	      xdir="$gentop/$xlib"
+
+	      $show "${rm}r $xdir"
+	      $run ${rm}r "$xdir"
+	      $show "mkdir $xdir"
+	      $run mkdir "$xdir"
+	      status=$?
+	      if test $status -ne 0 && test ! -d "$xdir"; then
+		exit $status
+	      fi
+	      $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`
+	    done
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linkopts="$linkopts $flag"
+	fi
+
 	# Do each of the archive commands.
 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 	  eval cmds=\"$archive_expsym_cmds\"
@@ -2068,7 +2204,7 @@
 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
       fi
 
-      if test -n "$dlfiles$dlprefiles"; then
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
       fi
 
@@ -2106,8 +2242,58 @@
       # Delete the old objects.
       $run $rm $obj $libobj
 
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl= 
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  $show "${rm}r $gentop"
+	  $run ${rm}r "$gentop"
+	  $show "mkdir $gentop"
+	  $run mkdir "$gentop"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$gentop"; then
+	    exit $status
+	  fi
+	  generated="$generated $gentop"
+
+	  for xlib in $convenience; do
+	    # Extract the objects.
+	    case "$xlib" in
+	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	    *) xabs=`pwd`"/$xlib" ;;
+	    esac
+	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	    xdir="$gentop/$xlib"
+
+	    $show "${rm}r $xdir"
+	    $run ${rm}r "$xdir"
+	    $show "mkdir $xdir"
+	    $run mkdir "$xdir"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$xdir"; then
+	      exit $status
+	    fi
+	    $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`
+	  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_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
 
       output="$obj"
       eval cmds=\"$reload_cmds\"
@@ -2120,9 +2306,21 @@
       IFS="$save_ifs"
 
       # Exit if we aren't doing a library object file.
-      test -z "$libobj" && exit 0
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit 0
+      fi
 
       if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
 	# Create an invalid libtool object if no PIC, so that we don't
 	# accidentally link it into a program.
 	$show "echo timestamp > $libobj"
@@ -2132,7 +2330,7 @@
 
       if test -n "$pic_flag"; then
 	# Only do commands if we really have different PIC objects.
-	reload_objs="$libobjs"
+	reload_objs="$libobjs $reload_conv_objs"
 	output="$libobj"
 	eval cmds=\"$reload_cmds\"
 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
@@ -2146,8 +2344,21 @@
 	# Just create a symlink.
 	$show $rm $libobj
 	$run $rm $libobj
-	$show "$LN_S $obj $libobj"
-	$run $LN_S $obj $libobj || exit $?
+	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
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
       fi
 
       exit 0
@@ -2170,11 +2381,6 @@
 	fi 
       fi
     
-      if test "$dlself" = yes && test "$export_dynamic" = no; then
-	$echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
-	exit 1
-      fi
-
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	for libdir in $rpath $xrpath; do
@@ -2210,7 +2416,6 @@
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-
 	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
@@ -2247,7 +2452,6 @@
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-
 	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
@@ -2272,6 +2476,16 @@
 	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`
@@ -2279,7 +2493,7 @@
       fi
 
       dlsyms=
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
 	  dlsyms="${outputname}S.c"
 	else
@@ -2292,24 +2506,15 @@
 	"") ;;
 	*.c)
 	  # Discover the nlist of each of the dlfiles.
-	  nlist="$objdir/${output}.nm"
+	  nlist="$output_objdir/${outputname}.nm"
 
-	  if test -d $objdir; then
-	    $show "$rm $nlist ${nlist}S ${nlist}T"
-	    $run $rm "$nlist" "${nlist}S" "${nlist}T"
-	  else
-	    $show "$mkdir $objdir"
-	    $run $mkdir $objdir
-	    status=$?
-	    if test $status -ne 0 && test ! -d $objdir; then
-	      exit $status
-	    fi
-	  fi
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
 
 	  # Parse the name list into a source file.
-	  $show "creating $objdir/$dlsyms"
+	  $show "creating $output_objdir/$dlsyms"
 
-	  $echo > "$objdir/$dlsyms" "\
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
 
@@ -2326,7 +2531,7 @@
 	  if test "$dlself" = yes; then
 	    $show "generating symbol list for \`$output'"
 
-	    echo ': @PROGRAM@ ' > "$nlist"
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
 
 	    # Add our own program objects to the symbol list.
 	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
@@ -2347,13 +2552,12 @@
 
 	    # Prepare the list of exported symbols
 	    if test -z "$export_symbols"; then
-	      export_symbols="$objdir/$output.exp"
+	      export_symbols="$output_objdir/$output.exp"
 	      $run $rm $export_symbols
 	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 	    else
-	      $run $rm $export_symbols
-	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
-	      $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
+	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 	      $run eval 'mv "$nlist"T "$nlist"'
 	    fi
 	  fi
@@ -2429,26 +2633,35 @@
 	  fi
 
 	  pic_flag_for_symtable=
-          case "$host" in
+	  case "$host" in
 	  # compiling the symbol table file with pic_flag works around
 	  # a FreeBSD bug that causes programs to crash when -lm is
 	  # 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*)
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)

 	    case "$compile_command " in
 	    *" -static "*) ;;
 	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 	    esac
 	  esac
 
 	  # Now compile the dynamic symbol file.
-	  $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
-	  $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+	  $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 $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
 
 	  # Transform the symbol file into the correct name.
-	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
-	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
+	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 	  ;;
 	*)
 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
@@ -2473,7 +2686,15 @@
 	# We have no uninstalled library dependencies, so finalize right now.
 	$show "$link_command"
 	$run eval "$link_command"
-	exit $?
+	status=$?
+	
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $status
       fi
 
       if test -n "$shlibpath_var"; then
@@ -2481,7 +2702,7 @@
 	rpath=
 	for dir in $temp_rpath; do
 	  case "$dir" in
-	  /* | [A-Za-z]:[/\\]*)
+	  [\\/]* | [A-Za-z]:[\\/]*)
 	    # Absolute path.
 	    rpath="$rpath$dir:"
 	    ;;
@@ -2527,7 +2748,6 @@
 	link_command="$compile_var$compile_command$compile_rpath"
 	relink_command="$finalize_var$finalize_command$finalize_rpath"
 	
-	# AGH! Flame the AIX and HP-UX people for me, will ya?
 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
       else
@@ -2548,17 +2768,7 @@
       # Replace the output file specification.
       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
       
-      # 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 $objdir; then
-	  exit $status
-	fi
-      fi
-
-      # Delete the old output file.
+      # Delete the old output files.
       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       $show "$link_command"
@@ -2575,7 +2785,7 @@
       # Quote $echo for shipping.
       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
 	case "$0" in
-	/* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
 	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 	esac
 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
@@ -2612,7 +2822,7 @@
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
 relink_command=\"$relink_command\"
 
@@ -2652,7 +2862,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
@@ -2790,31 +3000,65 @@
 	addlibs="$old_convenience"
       fi
 
-      # Add in members from convenience archives.
-      for xlib in $addlibs; do
-	# Extract the objects.
-	xdir="$xlib"x
-	generated="$generated $xdir"
-	xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
-
-	$show "${rm}r $xdir"
-	$run ${rm}r "$xdir"
-	$show "mkdir $xdir"
-	$run mkdir "$xdir"
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	$show "${rm}r $gentop"
+	$run ${rm}r "$gentop"
+	$show "mkdir $gentop"
+	$run mkdir "$gentop"
 	status=$?
-	if test $status -ne 0 && test ! -d "$xdir"; then
+	if test $status -ne 0 && test ! -d "$gentop"; then
 	  exit $status
 	fi
-	$show "(cd $xdir && $AR x ../$xlib)"
-	$run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
+	generated="$generated $gentop"
+	  
+	# Add in members from convenience archives.
+	for xlib in $addlibs; do
+	  # Extract the objects.
+	  case "$xlib" in
+	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	  *) xabs=`pwd`"/$xlib" ;;
+	  esac
+	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	  xdir="$gentop/$xlib"
 
-	oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
-      done
+	  $show "${rm}r $xdir"
+	  $run ${rm}r "$xdir"
+	  $show "mkdir $xdir"
+	  $run mkdir "$xdir"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$xdir"; then
+	    exit $status
+	  fi
+	  $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`
+	done
+      fi
 
       # Do each command in the archive commands.
       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
+
 	eval cmds=\"$old_archive_cmds\"
       fi
       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
@@ -2848,9 +3092,20 @@
 
       # Only create the output if not a dry run.
       if test -z "$run"; then
-	$echo > $output "\
-# $output - a libtool library file
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	  fi
+	  $rm $output
+	  $echo > $output "\
+# $outputname - a libtool library file
 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
 
 # The name that we can dlopen(3).
 dlname='$dlname'
@@ -2870,15 +3125,12 @@
 revision=$revision
 
 # Is this an already installed library?
-installed=no
+installed=$installed
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'\
 "
-
-	$rm "$output_objdir/$outputname"i
-	sed 's/^installed=no$/installed=yes/' \
-	  < "$output" > "$output_objdir/$outputname"i || exit 1
+	done
       fi
 
       # Do a symbolic link so that the libtool archive can be found in
@@ -3015,7 +3267,7 @@
       fi
     fi
     case "$destdir" in
-    /* | [A-Za-z]:[/\\]*) ;;
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
     *)
       for file in $files; do
 	case "$file" in
@@ -3091,13 +3343,11 @@
 	  # Install the shared library and build the symlinks.
 	  $show "$install_prog $dir/$realname $destdir/$realname"
 	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
-	  test "X$dlname" = "X$realname" && dlname=
 
 	  if test $# -gt 0; then
 	    # Delete the old symlinks, and create new ones.
 	    for linkname
 	    do
-	      test "X$dlname" = "X$linkname" && dlname=
 	      if test "$linkname" != "$realname"; then
 		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
@@ -3105,12 +3355,6 @@
 	    done
 	  fi
 
-	  if test -n "$dlname"; then
-	    # Install the dynamically-loadable library.
-	    $show "$install_prog $dir/$dlname $destdir/$dlname"
-	    $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
-	  fi
-
 	  # Do each command in the postinstall commands.
 	  lib="$destdir/$realname"
 	  eval cmds=\"$postinstall_cmds\"
@@ -3126,12 +3370,6 @@
 	# Install the pseudo-library for information purposes.
 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 	instname="$dir/$name"i
-	if test ! -f "$instname"; then
-	  # Just in case it was removed...
-	  $show "Creating $instname"
-	  $rm "$instname"
-	  sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
-	fi
 	$show "$install_prog $instname $destdir/$name"
 	$run eval "$install_prog $instname $destdir/$name" || exit $?
 
@@ -3229,21 +3467,29 @@
 
 	  outputname=
 	  if test "$fast_install" = no && test -n "$relink_command"; then
-	    if test "$finalize" = yes; then
-	      outputname="/tmp/$$-$file"
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir="/tmp"
+	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
+	      tmpdir="$tmpdir/libtool-$$"
+	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+	      else
+		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+		continue
+	      fi
+	      outputname="$tmpdir/$file"
 	      # Replace the output file specification.
 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
-	      $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 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
+		${rm}r "$tmpdir"
 		continue
 	      fi
 	      file="$outputname"
 	    else
-	      $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
 	    fi
 	  else
 	    # Install the binary that we compiled earlier.
@@ -3253,7 +3499,7 @@
 
 	$show "$install_prog$stripme $file $destfile"
 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
-	test -n "$outputname" && $rm $outputname
+	test -n "$outputname" && ${rm}r "$tmpdir"
 	;;
       esac
     done
@@ -3479,8 +3725,10 @@
     done
 
     if test -z "$run"; then
-      # Export the shlibpath_var.
-      eval "export $shlibpath_var"
+      if test -n "$shlibpath_var"; then
+        # Export the shlibpath_var.
+        eval "export $shlibpath_var"
+      fi
 
       # Restore saved enviroment variables
       if test "${save_LC_ALL+set}" = set; then
@@ -3497,8 +3745,10 @@
       exit 1
     else
       # Display what would be done.
-      eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
-      $echo "export $shlibpath_var"
+      if test -n "$shlibpath_var"; then
+        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+        $echo "export $shlibpath_var"
+      fi
       $echo "$cmd$args"
       exit 0
     fi
@@ -3540,9 +3790,7 @@
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
 	    rmfiles="$rmfiles $dir/$n"
-	    test "X$n" = "X$dlname" && dlname=
 	  done
-	  test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
 	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
 
 	  $show "$rm $rmfiles"
@@ -3721,6 +3969,8 @@
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
 		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -3751,7 +4001,7 @@
   ;;
 
 uninstall)
-  $echo
+  $echo \
 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
 
 Remove libraries from an installation directory.
diff --git a/makeall.bat b/makeall.bat
deleted file mode 100644
index d2d415f..0000000
--- a/makeall.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-@echo off

-chdir libiberty

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\bfd

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\opcodes

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\gprof

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\binutils

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\gas

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..\ld

-make %1 %2 %3 %4 %5 %6 %7 %8 %9

-chdir ..

diff --git a/mkdep b/mkdep
new file mode 100755
index 0000000..3c5b508
--- /dev/null
+++ b/mkdep
@@ -0,0 +1,87 @@
+#!/bin/sh -
+#
+# Copyright (c) 1987 Regents of the University of California.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms are permitted
+# provided that the above copyright notice and this paragraph are
+# duplicated in all such forms and that any documentation,
+# advertising materials, and other materials related to such
+# distribution and use acknowledge that the software was developed
+# by the University of California, Berkeley.  The name of the
+# University may not be used to endorse or promote products derived
+# from this software without specific prior written permission.
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+#	@(#)mkdep.sh	5.12 (Berkeley) 6/30/88
+#
+
+MAKE=Makefile			# default makefile name is "Makefile"
+
+while :
+	do case "$1" in
+		# -f allows you to select a makefile name
+		-f)
+			MAKE=$2
+			shift; shift ;;
+
+		# the -p flag produces "program: program.c" style dependencies
+		# so .o's don't get produced
+		-p)
+			SED='s;\.o;;'
+			shift ;;
+		*)
+			break ;;
+	esac
+done
+
+if [ $# = 0 ] ; then
+	echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
+	exit 1
+fi
+
+if [ ! -w $MAKE ]; then
+	echo "mkdep: no writeable file \"$MAKE\""
+	exit 1
+fi
+
+TMP=/tmp/mkdep$$
+
+trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+
+cp $MAKE ${MAKE}.bak
+
+sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
+
+cat << _EOF_ >> $TMP
+# DO NOT DELETE THIS LINE -- mkdep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+_EOF_
+
+# If your compiler doesn't have -M, add it.  If you can't, the next two
+# lines will try and replace the "cc -M".  The real problem is that this
+# hack can't deal with anything that requires a search path, and doesn't
+# even try for anything using bracket (<>) syntax.
+#
+# egrep '^#include[ 	]*".*"' /dev/null $* |
+# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
+
+gcc -MM $* |
+sed "
+	s; \./; ;g
+	$SED" >> $TMP
+
+cat << _EOF_ >> $TMP
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+_EOF_
+
+# copy to preserve permissions
+cp $TMP $MAKE
+rm -f ${MAKE}.bak $TMP
+exit 0
+
+
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 0e5ea17..c6d1fea 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,18 +1,673 @@
+2000-04-01  Ian Lance Taylor  <ian@zembu.com>
+
+	* disassemble.c (disassembler_usage): Don't use a prototype.  Mark
+	the parameter ATTRIBUTE_UNUSED.
+	* ppc-opc.c: Add ATTRIBUTE_UNUSED as needed.
+
+2000-04-01  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* m10300-opc.c: SP-based offsets are always unsigned.
+
+2000-03-29  Thomas de Lellis  <tdel@windriver.com>
+
+	* arm-opc.h (thumb_opcodes): Disassemble 0xde.. to "bal"
+	[branch always] instead of "undefined".
+
+2000-03-27  Nick Clifton  <nickc@cygnus.com>
+
+	* d30v-opc.c (d30v_format_table): Move SHORT_AR to end of list of
+	short instructions, from end of list of long instructions.
+
+2000-03-27  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am (CFILES): Add avr-dis.c.
+	(ALL_MACHINES): Add avr-dis.lo.
+
+2000-03-27  Alan Modra  <alan@linuxcare.com>
+
+	* avr-dis.c (add0fff, add03f8): Don't use structure bitfields to
+	truncate integers.
+	(print_insn_avr): Call function via pointer in K&R compatible way.
+	(dispLDD, regPP, reg50, reg104, reg40, reg20w, lit404, lit204,
+	add0fff, add03f8): Convert to old style function declaration and
+	add prototype.
+	(avrdis_opcode): Add prototype.
+
+2000-03-27  Denis Chertykov  <denisc@overta.ru>
+
+	* avr-dis.c: New file.  AVR disassembler.
+	* configure.in (bfd_avr_arch): New architecture support.
+	* disassemble.c: Likewise.
+	* configure: Regenerate.
+
+Mon Mar  6 19:52:05 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* sh-opc.h (sh_table): ldre and ldrs have a *signed* displacement.
+
+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.
+
+2000-02-28  Nick Clifton  <nickc@cygnus.com>
+
+	* m32r-desc.c (m32r_cgen_cpu_open): Replace 'flags' with
+	'signed_overflow_ok_p'.
+
+2000-02-27  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* Makefile.am (stamp-lib): Use $(LIBTOOL) --config to get the
+	name of the libtool directory.
+	* Makefile.in: Rebuild.
+
+2000-02-24  Nick Clifton  <nickc@cygnus.com>
+
+	* cgen-opc.c (cgen_set_signed_overflow_ok): New function.
+	(cgen_clear_signed_overflow_ok): New function.
+	(cgen_signed_overflow_ok_p): New function.
+
+2000-02-23  Andrew Haley  <aph@cygnus.com>
+
+        * 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>
+
+	* i370-dis.c, i370-opc.c: New.
+
+	* disassemble.c (ARCH_i370): Define.
+	(disassembler): Handle it.
+
+	* Makefile.am: Add support for Linux/IBM 370.
+	* configure.in: Likewise.
+
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+
+2000-02-22  Chandra Chavva   <cchavva@cygnus.com>
+
+	* d30v-opc.c (d30v_opcode_tab) : Added FLAG_NOT_WITH_ADDSUBppp to
+	ST2H, STB, STH, STHH, STW and ST2H opcodes to prohibit parallel
+	procedure.
+
+1999-12-30  Andrew Haley  <aph@cygnus.com>
+
+	* mips-dis.c (_print_insn_mips): New arg for OPCODE_IS_MEMBER:
+	force gp32 to zero.
+	* mips-opc.c (G6): New define.
+	(mips_builtin_op): Add "move" definition for -gp32.
+
+2000-02-22  Ian Lance Taylor  <ian@zembu.com>
+
+	From Grant Erickson <gerickso@Brocade.COM>:
+	* ppc-opc.c: Correct dcread--it takes 3 arguments, not 2.
+
+2000-02-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* dis-buf.c (buffer_read_memory): Change `length' param and all int
+	vars to unsigned.
+
+Thu Feb 17 00:18:12 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* sh-dis.c (print_movxy, print_insn_ddt, print_dsp_reg): New functions.
+	(print_insn_ppi): Likewise.
+	(print_insn_shx): Use info->mach to select appropriate insn set.
+	Add support for sh-dsp.  Remove FD_REG_N support.
+	* sh-opc.h (sh_nibble_type): Add new values for sh-dsp support.
+	(sh_arg_type): Likewise.  Remove FD_REG_N.
+	(sh_dsp_reg_nums): New enum.
+	(arch_sh1, arch_sh2, arch_sh3, arch_sh3e, arch_sh4): New macros.
+	(arch_sh_dsp, arch_sh3_dsp, arch_sh1_up, arch_sh2_up): Likewise.
+	(arch_sh3_up, arch_sh3e_up, arch_sh4_up, arch_sh_dsp_up): Likewise.
+	(arch_sh3_dsp_up): Likewise.
+	(sh_opcode_info): New field: arch.
+	(sh_table): Split up insn with FD_REG_N into ones with F_REG_N and
+	D_REG_N.  Fill in arch field.  Add sh-dsp insns.
+
+2000-02-14  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* arm-dis.c: Change flavor name from atpcs-special to
+	special-atpcs to prevent name conflict in gdb.
+	(get_arm_regname_num_options, set_arm_regname_option,
+	get_arm_regnames): New functions.  API to access the several
+	flavor of register names.  Note: Used by gdb.
+	(print_insn_thumb): Use the register name entry from the currently
+	selected flavor for LR and PC.
+
+2000-02-10  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore-opc.h (enum mcore_opclass): Add MULSH and OPSR
+	classes.
+	(mcore_table): Add "idly4", "psrclr", "psrset", "mulsh" and
+	"mulsh.h" instructions.
+	* mcore-dis.c (imsk array): Add masks for MULSH and OPSR
+	classes.
+	(print_insn_mcore): Add support for little endian targets.
+	Add support for MULSH and OPSR classes.
+
+2000-02-07  Nick Clifton  <nickc@cygnus.com>
+
+	* arm-dis.c (parse_arm_diassembler_option): Rename again.
+	Previous delat did not take.
+
+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
+	parse_arm_disassembler_option and allow to be exported.
+
+	* disassemble.c (disassembler_usage): New function: Print out any
+	target specific disassembler options.
+	Call arm_disassembler_options() if the ARM architecture is being
+	supported.  
+
+	* arm-dis.c (NUM_ELEM): Define this macro if not already
+	defined.
+	(arm_regname): New struct type for ARM register names.
+	(arm_toggle_regnames): Delete.
+	(parse_disassembler_option): Use register name structure.
+	(print_insn): New function: Combines duplicate code found in
+	print_insn_big_arm and print_insn_little_arm.
+	(print_insn_big_arm): Call print_insn.
+	(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_STT_16BIT flag as Thumb code symbols.
+        
+        * 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.
+
+2000-01-20  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore-opc.h (mcore_table): Add "add" as an alias for "addu".
+
+2000-01-03  Nick Clifton  <nickc@cygnus.com>
+
+	* arm-dis.c (streq): New macro.
+	(strneq): New macro.
+	(force_thumb): ew local variable.
+	(parse_disassembler_option): New function: Parse a single, ARM
+	specific disassembler command line switch.
+	(parse_disassembler_option): Call parse_disassembler_option to
+	parse individual command line switches.
+	(print_insn_big_arm): Check force_thumb.
+	(print_insn_little_arm): Check force_thumb.
+
+1999-12-27  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386-dis.c (grps[]): Correct GRP5 FF/3 from "call" to "lcall".
+
+Wed Dec  1 03:34:53 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* m10300-opc.c, m10300-dis.c: Add am33 support.
+
+Wed Nov 24 20:29:58 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa-dis.c (unit_cond_names): Add PA2.0 unit condition names.
+	(print_insn_hppa): Handle 'B' operand.
+
+1999-11-22  Nick Clifton  <nickc@cygnus.com>
+
+	* d10v-opc.c: Fix pattern for "cpfg,f{0|1},c" instruction.
+
+1999-11-18  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* mips-opc.c (I5): New.
+	(abs.ps,add.ps,alnv.ps,c.COND.ps,cvt.s.pl,cvt.s.pu,cvt.ps.s
+	madd.ps,movf.ps,movt.ps,mul.ps,net.ps,nmadd.ps,nmsub.ps,
+	pll.ps,plu.ps,pul.ps,puu.ps,sub.ps,suxc1,luxc1): New.
+
+Mon Nov 15 19:34:58 1999  Donald Lindsay  <dlindsay@cygnus.com>
+
+	* arm-dis.c (print_insn_arm): Added general purpose 'X' format.
+	* arm-opc.h (print_insn_arm): Added comment documenting
+	the 'X' format just added to arm-dis.c.
+
+1999-11-15  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* mips-opc.c (la): Create a version that just uses addiu directly.
+	(dla): Expand to daddiu if possible.
+
+1999-11-11  Nick Clifton  <nickc@cygnus.com>
+
+	* mips-opc.c: Add ssnop pattern.
+
+1999-11-01  Gavin Romig-Koch  <gavin@cygnus.com>
+
+	* mips-dis.c (_print_insn_mips): Use OPCODE_IS_MEMBER.
+
+1999-10-29  Nick Clifton  <nickc@cygnus.com>
+
+	* d30v-opc.c (mvtacc): Use format SHORT_AR not SHORT_AA
+	(d30v_format_tab): Define the SHORT_AR format.
+
+1999-10-28  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore-dis.c: Remove spurious code introduced in previous delta. 
+
+1999-10-27  Scott Bambrough  <scottb@netwinder.org>
+
+	* arm-dis.c: Include sysdep.h to prevent compile time warnings.
+
+1999-10-18  Michael Meissner  <meissner@cygnus.com>
+
+	* alpha-opc.c (alpha_operands): Fill in missing initializer.
+	(alpha_num_operands): Convert to unsigned.
+	(alpha_num_opcodes): Ditto.
+	(insert_rba): Declare unused arguments ATTRIBUTE_UNUSED.
+	(insert_rca): Ditto.
+	(insert_za): Ditto.
+	(insert_zb): Ditto.
+	(insert_zc): Ditto.
+	(extract_bdisp): Ditto.
+	(extract_jhint): Ditto.
+	(extract_ev6hwjhint): Ditto.
+
+Sun Oct 10 01:48:01 1999  Jerry Quinn <jerry.quinn.adv91@alum.dartmouth.org>
+
+	* hppa-dis.c (print_insn_hppa):  Add new codes 'cc', 'cd', 'cC',
+	'co', '@'.
+
+	* hppa-dis.c (print_insn_hppa): Removed unused args.  Fix '?W'.
+
+	* hppa-dis.c (print_insn_hppa):  Implement codes "?N", "?Q".
+
+Thu Oct  7 00:12:43 MDT 1999	Diego Novillo <dnovillo@cygnus.com>
+
+	* d10v-opc.c (d10v_operands): Add RESTRICTED_NUM3 flag for
+	rac/rachi instructions.
+	(d10v_opcodes): Added seven new instructions ld, ld2w, sac, sachi,
+	slae, st and st2w.
+
+1999-10-04  Doug Evans  <devans@casey.cygnus.com>
+
+	* fr30-asm.c,fr30-desc.h: Rebuild.
+	* m32r-asm.c,m32r-desc.c,m32r-desc.h: Rebuild.  Add m32rx support.
+	* m32r-dis.c,m32r-ibld.c,m32r-opc.c,m32r-opc.h,m32r-opinst.c: Ditto.
+
+1999-09-29  Nick Clifton  <nickc@cygnus.com>
+
+	* sh-opc.h: Fix bit patterns for several load and store
+	instructions.  
+
+Thu Sep 23 08:27:20 1999  Jerry Quinn <jerry.quinn.adv91@alum.dartmouth.org
+
+	* hppa-dis.c (print_insn_hppa): Replace 'B', 'M', 'g' and 'l' with
+	cleaner code using completer prefixes.  Add 'Y'.
+
+Sun Sep 19 10:41:27 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa-dis.c: (print_insn_hppa): Correct 'cJ', 'cc'.
+
+	* hppa-dis.c (extract_22): New function.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'J', 'K', and 'cc'.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'fe' and 'cJ'.
+
+	* hppa-dis.c (print_insn_hppa): Handle '#', 'd', and 'cq'.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'm', 'h', '='.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'X' operand.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'B' operand.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'M' and 'L' operands.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'l' operand.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'g' operand.
+
+Sat Sep 18 11:36:12 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa-dis.c (print_insn_hppa): Output a space after 'X' completer.
+
+	* hppa-dis.c: (print_insn_hppa): Do output a space before a 'v'
+	operand.
+
+	* hppa-dis.c: (print_insn_hppa): Handle 'fX'.
+
+	* hppa-dis.c: (print_insn_hppa): Add missing break after
+	FP register case.
+
+	* hppa-dis.c: Finish constifying various completers, register
+	names, etc etc.
+
+1999-09-14  Michael Meissner  <meissner@cygnus.com>
+
+	* configure.in (Canonicalization of target names): Remove adding
+	${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+	generates $ac_config_sub with a ${CONFIG_SHELL} already.
+	* configure: Regenerate.
+
+Tue Sep  7 13:50:32 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa-dis.c (print_insn_hppa): Escape '%' in output strings.
+
+	* hppa-dis.c (print_insn_hppa): Handle 'Z' argument.
+
+1999-09-07  Nick Clifton  <nickc@cygnus.com>
+
+	* sh-opc.h: Add mulu.w and muls.w patterns.  These are the correct
+	names for the mulu and muls patterns.
+
+1999-09-04  Steve Chamberlain  <sac@pobox.com>
+
+	* pj-opc.c: New file.
+	* pj-dis.c: New file.
+	* disassemble.c	(disassembler): Handle bfd_arch_pj.
+	* configure.in: Handle bfd_pj_arch.
+	* Makefile.am: Rebuild dependencies.
+	(CFILES): Add pj-dis.c and pj-opc.c.
+	(ALL_MACHINES): Add pj-dis.lo and pj-opc.lo.
+	* configure, Makefile.in: Rebuild.
+
+1999-09-04  H.J. Lu  <hjl@gnu.org>
+
+	* i386-dis.c (print_insn_i386): Set bytes_per_line to 7.
+
+Mon Aug 30 18:56:14 1999  Richard Henderson  <rth@cygnus.com>
+
+	* alpha-opc.c (fetch, fetch_m, ecb, wh64): RA must be R31.
+
+1999-08-04  Doug Evans  <devans@casey.cygnus.com>
+
+	* fr30-asm.c,fr30-desc.h,fr30-dis.c,fr30-ibld.c,fr30-opc.c: Rebuild.
+	* m32r-asm.c,m32r-desc.h,m32r-dis.c,m32r-ibld.c,m32r-opc.c: Rebuild.
+	* m32r-opinst.c: Rebuild.
+
+Sat Aug 28 00:27:24 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+        * 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 |.
+
+	* hppa-dis.c (MASK_10, read_write_names, add_compl_names,
+	extract_10U_store):  New.
+	(print_insn_hppa):  Add new completers.
+
+	* hppa-dis.c (signed_unsigned_names,mix_half_names,
+	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): Add cases for '.', '~'. '$'. and '!'
+
+	* hppa-dis.c (print_insn_hppa):  Look at next arg instead of bits
+	to decide to print a space.
+
+1999-08-21  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386-dis.c: Add AMD athlon instruction support.
+
+1999-08-10  Ian Lance Taylor  <ian@zembu.com>
+
+	From Wally Iimura <iimura@microunity.com>:
+	* dis-buf.c (buffer_read_memory): Rewrite expression to avoid
+	overflow at end of address space.
+	(generic_print_address): Use sprintf_vma.
+
+1999-08-08  Ian Lance Taylor  <ian@zembu.com>
+
+	* Makefile.am: Rename .dep* files to DEP*.  Change DEP variable to
+	MKDEP.  Rebuild dependencies.
+	* Makefile.in: Rebuild.
+
+Fri Aug  6 09:46:35 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa-dis.c (compare_cond_64_names, cmpib_cond_64_names,
+	add_cond_64_names, wide_add_cond_names, logical_cond_64_names,
+	unit_cond_64_names, shift_cond_64_names, bb_cond_64_names): New.
+	(print_insn_hppa): Add 64 bit condition completers.
+
+Thu Aug  5 16:59:58 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa-dis.c (print_insn_hppa): Change condition args to use
+	'?' prefix.
+
+Wed Jul 28 04:33:58 1999  Jerry Quinn <jquinn@nortelnetworks.com>
+
+	* hppa-dis.c (print_insn_hppa): Remove unnecessary test in 'E'
+	code.
+
+1999-07-21  Ian Lance Taylor  <ian@zembu.com>
+
+	From Mark Elbrecht:
+	* configure.bat: Remove; obsolete.
+
+1999-07-11  Ian Lance Taylor  <ian@zembu.com>
+
+	* dis-buf.c: Add ATTRIBUTE_UNUSED as appropriate.
+	(generic_strcat_address): Add cast to avoid warning.
+	* i386-dis.c: Initialize all structure fields to avoid warnings.
+	Add ATTRIBUTE_UNUSED as appropriate.
+
+1999-07-08  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc-dis.c (print_insn_sparc): Differentiate between
+	addition and oring when guessing symbol for comment.
+
+1999-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* arm-dis.c (print_insn_arm): Display hex equivalent of rotated
+	constant. 
+
+1999-06-23  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386-dis.c: Mention intel mode specials in macro char comment.
+
+1999-06-21  Ian Lance Taylor  <ian@zembu.com>
+
+	* alpha-dis.c: Don't include <stdlib.h>.
+	* arm-dis.c: Include "sysdep.h".
+	* tic30-dis.c: Don't include <stdlib.h> or <string.h>.  Include
+	"sysdep.h".
+	* Makefile.am: Rebuild dependencies.
+	* Makefile.in: Rebuild.
+
+1999-06-16  Nick Clifton  <nickc@cygnus.com>
+
+	* arm-dis.c (print_insn_arm): Add detection of IMB and IMBRange
+	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. 
+	(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
+	using just 'r' and the register number.
+	(arm_toggle_regnames): New function: Toggle the chosen register set
+	naming scheme.
+	(parse_disassembler_options): New function: Parse any target
+	disassembler command line options.
+	(print_insn_big_arm): Call parse_disassembler_options if any
+	are defined.
+	(print_insn_little_arm): Call parse_disassembler_options if any
+	are defined.
+
+1999-06-13  Ian Lance Taylor  <ian@zembu.com>
+
+	* i386-dis.c (FWAIT_OPCODE): Define.
+	(used_prefixes): New static variable.
+	(fetch_data): Don't print an error message if we have already
+	fetched some bytes successfully.
+	(ckprefix): Clear used_prefixes.  Use FWAIT_OPCODE, not 0x9b.
+	(prefix_name): New static function.
+	(print_insn_i386): If setjmp fails, indicating a data error, but
+	we have managed to fetch some bytes, print the first one as a
+	prefix or a .byte pseudo-op.  If fwait is followed by a non
+	floating point instruction, print the first prefix.  Set
+	used_prefixes when prefixes are used.  If any prefixes were not
+	used after disassembling the instruction, print the first prefix
+	instead of printing the instruction.
+	(putop): Set used_prefixes when prefixes are used.
+	(append_seg, OP_E, OP_G, OP_REG, OP_I, OP_sI, OP_J): Likewise.
+	(OP_DIR, OP_SIMD_Suffix): Likewise.
+
+1999-06-07  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc-opc.c: Fix up set, setsw, setuw operand kinds.
+	Support signx %reg, clruw %reg.
+
+1999-06-07  Jakub Jelinek  <jj@ultra.linux.cz>
+
+	* sparc-opc.c: Add aliases Solaris as supports.
+
+Mon Jun  7 12:04:52 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* Makefile.am (CFILES): Add arc-{dis,opc}.c and v850-{dis,opc}.c.
+	* Makefile.in: Regenerated.
+
+1999-06-03  Philip Blundell  <philb@gnu.org>
+
+	* arm-dis.c (print_insn_arm): Make LDRH/LDRB consistent with LDR
+	when target is PC-relative.
+
+1999-05-28  Linus Nordberg  <linus.nordberg@canit.se>
+
+	* m68k-opc.c: Rename MACL/MSACL to MAC/MSAC.  Add MACM/MSACM.  Add
+	MOVE MACSR,CCR.
+
+	* m68k-dis.c (fetch_arg): Add places `n', `o'.
+
+	* m68k-opc.c: Add MSAC, MACL, MOVE to/from ACC, MACSR, MASK.
+	Add mcf5206e to appropriate instructions.
+	Add alias for MAC, MSAC.
+
+	* m68k-dis.c (print_insn_arg): Add formats `E', `G', `H' and place
+	`N'.
+
+	* m68k-opc.c (m68k_opcodes): Add divsw, divsl, divuw, divul, macl,
+	macw, remsl, remul for mcf5307.  Change mcf5200 --> mcf.
+
+	* m68k-dis.c: Add format `u' and places `h', `m', `M'.
+
+1999-05-18  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386-dis.c (Ed): Define.
+	(dis386_twobyte_att, dis386_twobyte_intel): Use Ed for movd.
+	(Rw): Remove.
+	(OP_rm): Rename to OP_Rd.
+	(ONE): Remove.
+	(OP_ONE): Remove.
+	(putop): Add const to template and p.
+	(print_insn_x86): Delete.
+	(print_insn_i386): Merge old function print_insn_x86.  Add const
+	to dp.
+	(struct dis386): Add const to name.
+	(dis386_att, dis386_intel): Add const.
+	(dis386_twobyte_att, dis386_twobyte_intel): Add const.
+	(names32, names16, names8, names_seg, index16): Add const.
+	(grps, prefix_user_table, float_reg): Add const.
+	(float_mem_att, float_mem_intel): Add const.
+	(oappend): Add const to s.
+	(OP_REG): Add const to s.
+	(ptr_reg): Add const to s.
+	(dofloat): Add const to dp.
+	(OP_C): Don't skip modrm, it's now done in OP_Rd.
+	(OP_D): Ditto.
+	(OP_T): Ditto.
+	(OP_Rd): Check for valid mod.  Call Op_E to print.
+	(OP_E): Handle d_mode arg.  Check for bad sfence,lea,lds etc.
+	(OP_MS): Check for valid mod.  Call Op_EM to print.
+	(OP_3DNowSuffix): Set obufp and use oappend rather than
+	strcat.  Call BadOp() for errors.
+	(OP_SIMD_Suffix): Likewise.
+	(BadOp): New function.
+
+1999-05-12  Alan Modra  <alan@spri.levels.unisa.edu.au>
+
+	* i386-dis.c (dis386_intel): Remove macro chars, except for
+	jEcxz.  Change cWtR and cRtd to cW and cR.
+	(dis386_twobyte_intel): Remove macro chars here too.
+	(putop): Handle R and W macros for intel mode.
+
+	* i386-dis.c (SIMD_Fixup): New function.
+	(dis386_twobyte_att): Use it on movlps and movhps, and change
+	Ev to EX on these insns.  Change movmskps Ev, XM to Gv, EX.
+	(dis386_twobyte_intel): Same here.
+
+	* i386-dis.c (Av): Remove.
+	(Ap): remove lptr.
+	(lptr): Remove.
+	(OPSIMD): Define.
+	(OP_SIMD_Suffix): New function.
+	(OP_DIR): Remove dead code.
+	(eAX_reg..eDI_reg): Renumber.
+	(onebyte_has_modrm): Table numbering comments.
+	(INTERNAL_DISASSEMBLER_ERROR): Move to before print_insn_x86.
+	(print_insn_x86): Move all prefix oappends to after uses_f3_prefix
+	checks.  Print error on invalid dp->bytemode2.  Remove simd_cmp,
+	and handle SIMD cmp insns in OP_SIMD_Suffix.
+	(info->bytes_per_line): Bump from 5 to 6.
+	(OP_None): Remove.
+	(OP_E): Use INTERNAL_DISASSEMBLER_ERROR.  Handle sfence.
+	(OP_3DNowSuffix): Ensure mnemonic index unsigned.
+
+	PIII SIMD support from Doug Ledford <dledford@redhat.com>
+	* i386-dis.c (XM, EX, None): Define.
+	(OP_XMM, OP_EX, OP_None): New functions.
+	(USE_GROUPS, USE_PREFIX_USER_TABLE): Define.
+	(GRP14): Rename to GRPAMD.
+	(GRP*): Add USE_GROUPS flag.
+	(PREGRP*): Define.
+	(dis386_twobyte_att, dis386_twobyte_intel): Add SIMD insns.
+	(twobyte_has_modrm): Add SIMD entries.
+	(twobyte_uses_f3_prefix, simd_cmp_op, prefix_user_table): New.
+	(grps): Add SIMD insns.
+	(print_insn_x86): New vars uses_f3_prefix and simd_cmp.  Don't
+	oappend repz if uses_f3_prefix.  Add code to handle new groups for
+	SIMD insns.
+
+	From Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+	* i386-dis.c (dis386_att, dis386_intel): Change 0xE8 call insn
+	operand from Av to Jv.
+
+1999-05-07  Nick Clifton  <nickc@cygnus.com>
+
+	* mcore-dis.c (print_insn_mcore): Use .short to display
+	unidentified instructions, not .word.
+
 1999-04-26  Tom Tromey  <tromey@cygnus.com>
 
 	* aclocal.m4, configure: Updated for new version of libtool.
 
-1999-04-22  Nick Clifton  <nickc@cygnus.com>
-
-	* mcore-dis.c (print_insn_mcore): Display locaiton of address pool
-	for LRW instructions.
-
-1999-04-18  Nick Clifton  <nickc@cygnus.com>
-
-	* mcore-dis.c (print_insn_mcore): Display location of address pool
-	for JMP instructions.
-	* mcore-opc.h (mcore_table): Add 'nop'.
-
 1999-04-14  Doug Evans  <devans@casey.cygnus.com>
 
 	* fr30-desc.c,fr30-desc.h,fr30-dis.c,fr30-ibld.c,fr30-opc.c: Rebuild.
@@ -28,16 +683,6 @@
 	* fr30-desc.c,fr30-desc.h,fr30-ibld.c: Rebuild.
 	* m32r-desc.c,m32r-desc.h,m32r-opinst.c: Rebuild.
 
-1999-04-08  Nick Clifton  <nickc@cygnus.com>
-
-	* mcore-dis.c: New file: Disassemble MCore opcodes.
-	* mcore-opc.h: New file: Definitions of MCore opcodes.
-	* Makefile.am: Add Mcore source files.
-	* Makefile.in: Regenerate.
-	* configure.in: Add support for MCore targets.
-	* configure: Regenerate.
-	* disassemble.c: Add support for MCore targets.
-
 1999-04-06  Ian Lance Taylor  <ian@zembu.com>
 
 	* opintl.h (LC_MESSAGES): Never define.
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index d997298..0ee1080 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -6,7 +6,7 @@
 
 INCDIR = $(srcdir)/../include
 BFDDIR = $(srcdir)/../bfd
-DEP = mkdep
+MKDEP = mkdep
 
 lib_LTLIBRARIES = libopcodes.la
 
@@ -30,7 +30,10 @@
 	a29k-dis.c \
 	alpha-dis.c \
 	alpha-opc.c \
+	arc-dis.c \
+	arc-opc.c \
 	arm-dis.c \
+	avr-dis.c \
 	cgen-asm.c \
 	cgen-dis.c \
 	cgen-opc.c \
@@ -48,6 +51,8 @@
 	h8300-dis.c \
 	h8500-dis.c \
 	hppa-dis.c \
+	i370-dis.c \
+	i370-opc.c \
 	i386-dis.c \
 	i960-dis.c \
 	m32r-asm.c \
@@ -68,6 +73,8 @@
 	m10300-dis.c \
 	m10300-opc.c \
 	ns32k-dis.c \
+	pj-dis.c \
+	pj-opc.c \
 	ppc-dis.c \
 	ppc-opc.c \
 	sh-dis.c \
@@ -76,6 +83,8 @@
 	tic30-dis.c \
 	tic80-dis.c \
 	tic80-opc.c \
+	v850-dis.c \
+	v850-opc.c \
 	vax-dis.c \
 	w65-dis.c \
 	z8k-dis.c \
@@ -88,6 +97,7 @@
 	arc-dis.lo \
 	arc-opc.lo \
 	arm-dis.lo \
+	avr-dis.lo \
 	cgen-asm.lo \
 	cgen-dis.lo \
 	cgen-opc.lo \
@@ -104,6 +114,8 @@
 	h8500-dis.lo \
 	hppa-dis.lo \
 	i386-dis.lo \
+	i370-dis.lo \
+	i370-opc.lo \
 	i960-dis.lo \
 	m32r-asm.lo \
 	m32r-desc.lo \
@@ -122,6 +134,8 @@
 	mips-dis.lo \
 	mips-opc.lo \
 	mips16-opc.lo \
+	pj-dis.lo \
+	pj-opc.lo \
 	ppc-dis.lo \
 	ppc-opc.lo \
 	ns32k-dis.lo \
@@ -157,8 +171,9 @@
 noinst_LIBRARIES = libopcodes.a
 
 stamp-lib: libopcodes.la
-	if [ -f .libs/libopcodes.a ]; then \
-	  cp .libs/libopcodes.a libopcodes.tmp; \
+	libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
+	if [ -f $$libtooldir/libopcodes.a ]; then \
+	  cp $$libtooldir/libopcodes.a libopcodes.tmp; \
 	  $(SHELL) $(srcdir)/../move-if-change libopcodes.tmp libopcodes.a; \
 	else true; fi
 	touch stamp-lib
@@ -176,7 +191,7 @@
 	$(SHELL) ./config.status --recheck
 
 CLEANFILES = \
-	libopcodes.a stamp-lib dep.sed .dep .dep1
+	libopcodes.a stamp-lib dep.sed DEP DEP1
 
 
 
@@ -187,19 +202,19 @@
 
 # This dependency stuff is copied from BFD.
 
-.dep: dep.sed $(CFILES) $(HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed < .dep1 > .dep
+DEP: dep.sed $(CFILES) $(HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed < DEP1 > DEP
 
-.dep1: $(CFILES)
-	rm -f .dep2 .dep2a
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	echo > .dep2a
-	$(DEP) -f .dep2a $(INCLUDES) $(CFLAGS) $?
-	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2
-	rm -f .dep2a
-	$(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES)
+	rm -f DEP2 DEP2a
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	echo > DEP2a
+	$(MKDEP) -f DEP2a $(INCLUDES) $(CFLAGS) $?
+	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < DEP2a >> DEP2
+	rm -f DEP2a
+	$(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
@@ -208,19 +223,19 @@
 		-e 's!@BFDDIR@!$(BFDDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -235,6 +250,13 @@
   config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/alpha.h
 alpha-opc.lo: alpha-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/alpha.h \
   $(BFD_H) opintl.h
+arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
+  opintl.h
+arc-opc.lo: arc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h \
+  opintl.h
 arm-dis.lo: arm-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
   $(INCDIR)/ansidecl.h arm-opc.h $(INCDIR)/coff/internal.h \
   $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h opintl.h $(BFDDIR)/elf-bfd.h \
@@ -323,6 +345,9 @@
 ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h \
   opintl.h
+pj-dis.lo: pj-dis.c $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/ansidecl.h
+pj-opc.lo: pj-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/pj.h
 ppc-dis.lo: ppc-dis.c $(INCDIR)/ansidecl.h sysdep.h \
   config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/ppc.h
 ppc-opc.lo: ppc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/ppc.h \
@@ -333,11 +358,15 @@
   config.h $(INCDIR)/opcode/sparc.h $(INCDIR)/dis-asm.h \
   $(BFD_H) $(INCDIR)/libiberty.h opintl.h
 sparc-opc.lo: sparc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/sparc.h
-tic30-dis.lo: tic30-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
-  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic30.h
+tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/opcode/tic30.h
 tic80-dis.lo: tic80-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h \
   $(INCDIR)/dis-asm.h $(BFD_H)
 tic80-opc.lo: tic80-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h
+v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
+v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
+  opintl.h
 vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
   $(BFD_H) $(INCDIR)/ansidecl.h
 w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index ed8f64f..bdc030e 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -84,27 +84,23 @@
 INTLDEPS = @INTLDEPS@
 INTLLIBS = @INTLLIBS@
 INTLOBJS = @INTLOBJS@
-LD = @LD@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
 RANLIB = @RANLIB@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 WIN32LDFLAGS = @WIN32LDFLAGS@
 WIN32LIBADD = @WIN32LIBADD@
 archdefs = @archdefs@
-cgen = @cgen@
-cgendir = @cgendir@
 l = @l@
 
 AUTOMAKE_OPTIONS = cygnus
@@ -113,7 +109,7 @@
 
 INCDIR = $(srcdir)/../include
 BFDDIR = $(srcdir)/../bfd
-DEP = mkdep
+MKDEP = mkdep
 
 lib_LTLIBRARIES = libopcodes.la
 
@@ -138,7 +134,10 @@
 	a29k-dis.c \
 	alpha-dis.c \
 	alpha-opc.c \
+	arc-dis.c \
+	arc-opc.c \
 	arm-dis.c \
+	avr-dis.c \
 	cgen-asm.c \
 	cgen-dis.c \
 	cgen-opc.c \
@@ -156,6 +155,8 @@
 	h8300-dis.c \
 	h8500-dis.c \
 	hppa-dis.c \
+	i370-dis.c \
+	i370-opc.c \
 	i386-dis.c \
 	i960-dis.c \
 	m32r-asm.c \
@@ -176,6 +177,8 @@
 	m10300-dis.c \
 	m10300-opc.c \
 	ns32k-dis.c \
+	pj-dis.c \
+	pj-opc.c \
 	ppc-dis.c \
 	ppc-opc.c \
 	sh-dis.c \
@@ -184,6 +187,8 @@
 	tic30-dis.c \
 	tic80-dis.c \
 	tic80-opc.c \
+	v850-dis.c \
+	v850-opc.c \
 	vax-dis.c \
 	w65-dis.c \
 	z8k-dis.c \
@@ -197,6 +202,7 @@
 	arc-dis.lo \
 	arc-opc.lo \
 	arm-dis.lo \
+	avr-dis.lo \
 	cgen-asm.lo \
 	cgen-dis.lo \
 	cgen-opc.lo \
@@ -213,6 +219,8 @@
 	h8500-dis.lo \
 	hppa-dis.lo \
 	i386-dis.lo \
+	i370-dis.lo \
+	i370-opc.lo \
 	i960-dis.lo \
 	m32r-asm.lo \
 	m32r-desc.lo \
@@ -231,6 +239,8 @@
 	mips-dis.lo \
 	mips-opc.lo \
 	mips16-opc.lo \
+	pj-dis.lo \
+	pj-opc.lo \
 	ppc-dis.lo \
 	ppc-opc.lo \
 	ns32k-dis.lo \
@@ -266,12 +276,8 @@
 POTFILES = $(HFILES) $(CFILES)
 
 CLEANFILES = \
-	libopcodes.a stamp-lib dep.sed .dep .dep1
+	libopcodes.a stamp-lib dep.sed DEP DEP1
 
-
-
-
-# The start marker is written this way to pass through automake unscathed.
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
@@ -300,7 +306,7 @@
 
 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)
@@ -553,7 +559,7 @@
 	@for file in $(DISTFILES); do \
 	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -672,8 +678,9 @@
 	$(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $(srcdir)/disassemble.c
 
 stamp-lib: libopcodes.la
-	if [ -f .libs/libopcodes.a ]; then \
-	  cp .libs/libopcodes.a libopcodes.tmp; \
+	libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
+	if [ -f $$libtooldir/libopcodes.a ]; then \
+	  cp $$libtooldir/libopcodes.a libopcodes.tmp; \
 	  $(SHELL) $(srcdir)/../move-if-change libopcodes.tmp libopcodes.a; \
 	else true; fi
 	touch stamp-lib
@@ -688,24 +695,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.
 
 # This dependency stuff is copied from BFD.
 
-.dep: dep.sed $(CFILES) $(HFILES) config.h
-	rm -f .dep1
-	$(MAKE) DEP=$(DEP) .dep1
-	sed -f dep.sed < .dep1 > .dep
+DEP: dep.sed $(CFILES) $(HFILES) config.h
+	rm -f DEP1
+	$(MAKE) MKDEP=$(MKDEP) DEP1
+	sed -f dep.sed < DEP1 > DEP
 
-.dep1: $(CFILES)
-	rm -f .dep2 .dep2a
-	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
-	echo > .dep2a
-	$(DEP) -f .dep2a $(INCLUDES) $(CFLAGS) $?
-	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2
-	rm -f .dep2a
-	$(srcdir)/../move-if-change .dep2 .dep1
+DEP1: $(CFILES)
+	rm -f DEP2 DEP2a
+	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+	echo > DEP2a
+	$(MKDEP) -f DEP2a $(INCLUDES) $(CFLAGS) $?
+	sed -e '/DO NOT DELETE/d' -e '/^$$/d' < DEP2a >> DEP2
+	rm -f DEP2a
+	$(srcdir)/../move-if-change DEP2 DEP1
 
 dep.sed: dep-in.sed config.status
 	sed <$(srcdir)/dep-in.sed >dep.sed	\
@@ -714,19 +720,19 @@
 		-e 's!@BFDDIR@!$(BFDDIR)!'	\
 		-e 's!@SRCDIR@!$(srcdir)!'
 
-dep: .dep
+dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
-	cat .dep >> tmp-Makefile
+	cat DEP >> tmp-Makefile
 	$(srcdir)/../move-if-change tmp-Makefile Makefile
 
-dep-in: .dep
+dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
-	cat .dep >> tmp-Makefile.in
+	cat DEP >> tmp-Makefile.in
 	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
 
-dep-am: .dep
+dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
-	cat .dep >> tmp-Makefile.am
+	cat DEP >> tmp-Makefile.am
 	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
@@ -741,6 +747,13 @@
   config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/alpha.h
 alpha-opc.lo: alpha-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/alpha.h \
   $(BFD_H) opintl.h
+arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
+  opintl.h
+arc-opc.lo: arc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h \
+  opintl.h
 arm-dis.lo: arm-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
   $(INCDIR)/ansidecl.h arm-opc.h $(INCDIR)/coff/internal.h \
   $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h opintl.h $(BFDDIR)/elf-bfd.h \
@@ -829,6 +842,9 @@
 ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \
   sysdep.h config.h $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h \
   opintl.h
+pj-dis.lo: pj-dis.c $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/ansidecl.h
+pj-opc.lo: pj-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/pj.h
 ppc-dis.lo: ppc-dis.c $(INCDIR)/ansidecl.h sysdep.h \
   config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/ppc.h
 ppc-opc.lo: ppc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/ppc.h \
@@ -839,11 +855,15 @@
   config.h $(INCDIR)/opcode/sparc.h $(INCDIR)/dis-asm.h \
   $(BFD_H) $(INCDIR)/libiberty.h opintl.h
 sparc-opc.lo: sparc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/sparc.h
-tic30-dis.lo: tic30-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
-  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic30.h
+tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/opcode/tic30.h
 tic80-dis.lo: tic80-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h \
   $(INCDIR)/dis-asm.h $(BFD_H)
 tic80-opc.lo: tic80-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h
+v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
+v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
+  opintl.h
 vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
   $(BFD_H) $(INCDIR)/ansidecl.h
 w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
diff --git a/opcodes/aclocal.m4 b/opcodes/aclocal.m4
index 308711d..7ba1f4e 100644
--- a/opcodes/aclocal.m4
+++ b/opcodes/aclocal.m4
@@ -105,7 +105,7 @@
 AC_SUBST($1)])
 
 
-# serial 35 AC_PROG_LIBTOOL
+# serial 40 AC_PROG_LIBTOOL
 AC_DEFUN(AC_PROG_LIBTOOL,
 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
 
@@ -114,10 +114,11 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$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
@@ -146,24 +147,33 @@
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_LD])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -195,33 +205,28 @@
   fi
   ;;
 
-*-*-cygwin*)
-  AC_SYS_LIBTOOL_CYGWIN
+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
-
-# enable the --disable-libtool-lock switch
-
-AC_ARG_ENABLE(libtool-lock,
-[  --disable-libtool-lock  force libtool not to do file locking],
-need_locks=$enableval,
-need_locks=yes)
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
 ])
 
-# AC_LIBTOOL_DLOPEN - check for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
+# 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,
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -246,15 +251,15 @@
 ])
 
 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED,
-[AC_ENABLE_SHARED(no)])
+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,
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -279,16 +284,16 @@
 ])
 
 # AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC,
-[AC_ENABLE_STATIC(no)])
+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,
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+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],
@@ -313,9 +318,8 @@
 ])
 
 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL,
-[AC_ENABLE_FAST_INSTALL(no)])
-
+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,
@@ -333,7 +337,7 @@
   case "$ac_prog" in
     # Accept absolute paths.
 changequote(,)dnl
-    /* | [A-Za-z]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
 changequote([,])dnl
       # Canonicalize the path of ld
@@ -359,10 +363,10 @@
 fi
 AC_CACHE_VAL(ac_cv_path_LD,
 [if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -385,7 +389,6 @@
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
 AC_PROG_LD_GNU
 ])
 
@@ -407,10 +410,10 @@
   # Let the user override the test.
   ac_cv_path_NM="$NM"
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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; then
+    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
@@ -431,230 +434,24 @@
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
-])
-
-# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
-# by C symbol name from nm.
-AC_DEFUN(AC_SYS_NM_PARSE,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output])
-AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
-[# These are sane defaults that work on at least a few old systems.
-# {They come from Ultrix.  What could be older than Ultrix?!! ;)}
-
-changequote(,)dnl
-# Character class describing NM global symbol codes.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-changequote([,])dnl
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($ac_symcode\)[ 	][ 	]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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;
-}
-changequote(,)dnl
-lt_preloaded_symbols[] =
-changequote([,])dnl
-{
-EOF
-	sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&AC_FD_CC
-	    cat conftest.c >&AC_FD_CC
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-    fi
-  else
-    echo "$progname: failed program was:" >&AC_FD_CC
-    cat conftest.c >&AC_FD_CC
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-AC_MSG_RESULT($ac_result)
-])
-
-# AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
-AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-AC_CHECK_TOOL(AS, as, false)
-])
-
-# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
-#                            with an underscore?
-AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
-[AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_SYS_NM_PARSE])dnl
-AC_MSG_CHECKING([for _ prefix in compiled symbols])
-AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
-[ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if AC_TRY_EVAL(ac_compile); then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
-  fi
-else
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.c >&AC_FD_CC
-fi
-rm -rf conftest*
-])
-AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
 ])
 
 # AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM, [
-AC_CHECK_LIB(mw, _mwvalidcheckl)
-AC_CHECK_LIB(m, cos)
+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
@@ -665,13 +462,14 @@
 # '${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_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
@@ -683,16 +481,23 @@
 # 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_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
-    case "$enable_ltdl_install" in
-    no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
-    "") enable_ltdl_install=yes
-        ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
-    esac
+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"no"; then
+  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
 ])
 
@@ -704,9 +509,9 @@
 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
-AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
-AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
-AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])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.
 
diff --git a/opcodes/alpha-dis.c b/opcodes/alpha-dis.c
index db55799..db2d8fa 100644
--- a/opcodes/alpha-dis.c
+++ b/opcodes/alpha-dis.c
@@ -20,7 +20,6 @@
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
-#include <stdlib.h>
 #include <stdio.h>
 #include "ansidecl.h"
 #include "sysdep.h"
diff --git a/opcodes/alpha-opc.c b/opcodes/alpha-opc.c
index cceaf79..7a8ca59 100644
--- a/opcodes/alpha-opc.c
+++ b/opcodes/alpha-opc.c
@@ -81,7 +81,7 @@
   /* The fields are bits, shift, insert, extract, flags */
   /* The zero index is used to indicate end-of-list */
 #define UNUSED		0
-  { 0, 0, 0, 0, 0 },
+  { 0, 0, 0, 0, 0, 0 },
 
   /* The plain integer register fields */
 #define RA		(UNUSED + 1)
@@ -207,7 +207,7 @@
     insert_ev6hwjhint, extract_ev6hwjhint }
 };
 
-const int alpha_num_operands = sizeof(alpha_operands)/sizeof(*alpha_operands);
+const unsigned alpha_num_operands = sizeof(alpha_operands)/sizeof(*alpha_operands);
 
 /* The RB field when it is the same as the RA field in the same insn.
    This operand is marked fake.  The insertion function just copies
@@ -218,8 +218,8 @@
 static unsigned
 insert_rba(insn, value, errmsg)
      unsigned insn;
-     int value;
-     const char **errmsg;
+     int value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (((insn >> 21) & 0x1f) << 16);
 }
@@ -242,8 +242,8 @@
 static unsigned
 insert_rca(insn, value, errmsg)
      unsigned insn;
-     int value;
-     const char **errmsg;
+     int value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | ((insn >> 21) & 0x1f);
 }
@@ -266,8 +266,8 @@
 static unsigned
 insert_za(insn, value, errmsg)
      unsigned insn;
-     int value;
-     const char **errmsg;
+     int value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (31 << 21);
 }
@@ -286,8 +286,8 @@
 static unsigned
 insert_zb(insn, value, errmsg)
      unsigned insn;
-     int value;
-     const char **errmsg;
+     int value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (31 << 16);
 }
@@ -306,8 +306,8 @@
 static unsigned
 insert_zc(insn, value, errmsg)
      unsigned insn;
-     int value;
-     const char **errmsg;
+     int value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | 31;
 }
@@ -340,7 +340,7 @@
 static int
 extract_bdisp(insn, invalid)
      unsigned insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return 4 * (((insn & 0x1FFFFF) ^ 0x100000) - 0x100000);
 }
@@ -363,7 +363,7 @@
 static int
 extract_jhint(insn, invalid)
      unsigned insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return 4 * (((insn & 0x3FFF) ^ 0x2000) - 0x2000);
 }
@@ -385,7 +385,7 @@
 static int
 extract_ev6hwjhint(insn, invalid)
      unsigned insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return 4 * (((insn & 0x1FFF) ^ 0x1000) - 0x1000);
 }
@@ -1096,13 +1096,13 @@
   { "excb",		MFC(0x18,0x0400), BASE, ARG_NONE },
   { "mb",		MFC(0x18,0x4000), BASE, ARG_NONE },
   { "wmb",		MFC(0x18,0x4400), BASE, ARG_NONE },
-  { "fetch",		MFC(0x18,0x8000), BASE, { PRB } },
-  { "fetch_m",		MFC(0x18,0xA000), BASE, { PRB } },
+  { "fetch",		MFC(0x18,0x8000), BASE, { ZA, PRB } },
+  { "fetch_m",		MFC(0x18,0xA000), BASE, { ZA, PRB } },
   { "rpcc",		MFC(0x18,0xC000), BASE, { RA } },
   { "rc",		MFC(0x18,0xE000), BASE, { RA } },
-  { "ecb",		MFC(0x18,0xE800), BASE, { PRB } },	/* ev56 una */
+  { "ecb",		MFC(0x18,0xE800), BASE, { ZA, PRB } },	/* ev56 una */
   { "rs",		MFC(0x18,0xF000), BASE, { RA } },
-  { "wh64",		MFC(0x18,0xF800), BASE, { PRB } },	/* ev56 una */
+  { "wh64",		MFC(0x18,0xF800), BASE, { ZA, PRB } },	/* ev56 una */
 
   { "hw_mfpr",		OPR(0x19,0x00), EV4, { RA, RBA, EV4EXTHWINDEX } },
   { "hw_mfpr",		OP(0x19), OP_MASK, EV5, { RA, RBA, EV5HWINDEX } },
@@ -1543,4 +1543,4 @@
   { "bgt",		BRA(0x3F), BASE, ARG_BRA },
 };
 
-const int alpha_num_opcodes = sizeof(alpha_opcodes)/sizeof(*alpha_opcodes);
+const unsigned alpha_num_opcodes = sizeof(alpha_opcodes)/sizeof(*alpha_opcodes);
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 4aabf72..f131ada 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -1,5 +1,5 @@
 /* Instruction printing code for the ARM
-   Copyright (C) 1994, 95, 96, 97, 1998 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)
    Modification by James G. Smith (jsmith@cygnus.co.uk)
 
@@ -19,6 +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.  */
 
+#include "sysdep.h"
 #include "dis-asm.h"
 #define DEFINE_TABLE
 #include "arm-opc.h"
@@ -31,36 +32,111 @@
 #include "elf/internal.h"
 #include "elf/arm.h"
 
-static char *arm_conditional[] =
+#ifndef streq
+#define streq(a,b)	(strcmp ((a), (b)) == 0)
+#endif
+
+#ifndef strneq
+#define strneq(a,b,n)	(strncmp ((a), (b), (n)) == 0)
+#endif
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(a)     (sizeof (a) / sizeof (a)[0])
+#endif
+
+static char * arm_conditional[] =
 {"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc",
  "hi", "ls", "ge", "lt", "gt", "le", "", "nv"};
 
-static char *arm_regnames[] =
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc"};
+typedef struct
+{
+  const char * name;
+  const char * description;
+  const char * reg_names[16];
+}
+arm_regname;
 
-static char *arm_fp_const[] =
+static arm_regname regnames[] =
+{
+  { "raw" , "Select raw register names",
+    { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}},
+  { "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",
+    { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "sl",  "fp",  "ip",  "sp",  "lr",  "pc" }},
+  { "atpcs", "Select register names used in the ATPCS",
+    { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7",  "v8",  "IP",  "SP",  "LR",  "PC" }},
+  { "special-atpcs", "Select special register names used in the ATPCS",
+    { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL",  "FP",  "IP",  "SP",  "LR",  "PC" }}
+};
+
+/* Default to standard register name set.  */
+static unsigned int regname_selected = 1;
+
+#define NUM_ARM_REGNAMES  NUM_ELEM (regnames)
+#define arm_regnames      regnames[regname_selected].reg_names
+
+static boolean force_thumb = false;
+
+static char * arm_fp_const[] =
 {"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0"};
 
-static char *arm_shift[] = 
+static char * arm_shift[] = 
 {"lsl", "lsr", "asr", "ror"};
+
+/* Forward declarations.  */
+static void arm_decode_shift PARAMS ((long, fprintf_ftype, void *));
+static int  print_insn_arm   PARAMS ((bfd_vma, struct disassemble_info *, long));
+static int  print_insn_thumb PARAMS ((bfd_vma, struct disassemble_info *, long));
+static void parse_disassembler_options PARAMS ((char *));
+static int  print_insn       PARAMS ((bfd_vma, struct disassemble_info *, boolean));
+int get_arm_regname_num_options (void);
+int set_arm_regname_option (int option);
+int get_arm_regnames (int option, const char **setname,
+		      const char **setdescription,
+		      const char ***register_names);
+
+/* Functions. */
+int
+get_arm_regname_num_options (void)
+{
+  return NUM_ARM_REGNAMES;
+}
 
-static int print_insn_arm PARAMS ((bfd_vma, struct disassemble_info *,
-				   long));
+int
+set_arm_regname_option (int option)
+{
+  int old = regname_selected;
+  regname_selected = option;
+  return old;
+}
+
+int
+get_arm_regnames (int option, const char **setname,
+		  const char **setdescription,
+                  const char ***register_names)
+{
+  *setname = regnames[option].name;
+  *setdescription = regnames[option].description;
+  *register_names = regnames[option].reg_names;
+  return 16;
+}
 
 static void
 arm_decode_shift (given, func, stream)
      long given;
      fprintf_ftype func;
-     void *stream;
+     void * stream;
 {
   func (stream, "%s", arm_regnames[given & 0xf]);
+  
   if ((given & 0xff0) != 0)
     {
       if ((given & 0x10) == 0)
 	{
 	  int amount = (given & 0xf80) >> 7;
 	  int shift = (given & 0x60) >> 5;
+	  
 	  if (amount == 0)
 	    {
 	      if (shift == 3)
@@ -68,8 +144,10 @@
 		  func (stream, ", rrx");
 		  return;
 		}
+	      
 	      amount = 32;
 	    }
+	  
 	  func (stream, ", %s #%d", arm_shift[shift], amount);
 	}
       else
@@ -80,12 +158,11 @@
 
 /* Print one instruction from PC on INFO->STREAM.
    Return the size of the instruction (always 4 on ARM). */
-
 static int
 print_insn_arm (pc, info, given)
-     bfd_vma         pc;
-     struct disassemble_info *info;
-     long given;
+     bfd_vma                   pc;
+     struct disassemble_info * info;
+     long                      given;
 {
   struct arm_opcode *  insn;
   void *               stream = info->stream;
@@ -125,18 +202,19 @@
 
 			      offset += pc + 8;
 
-			      /* Cope with the possibility of write-back being used.
-				 Probably a very dangerous thing for the programmer
-				 to do, but who are we to argue ?  */
+			      /* Cope with the possibility of write-back
+				 being used.  Probably a very dangerous thing
+				 for the programmer to do, but who are we to
+				 argue ?  */
 			      if (given & 0x00200000)
 				func (stream, "!");
 			    }
 			  else
 			    {
-			      /* post indexed */
+			      /* Post indexed.  */
 			      func (stream, "], #%x", offset);
 
-			      offset = pc + 8;  /* ie ignore the offset */
+			      offset = pc + 8;  /* ie ignore the offset.  */
 			    }
 			  
 			  func (stream, "\t; ");
@@ -193,10 +271,14 @@
 		    case 's':
                       if ((given & 0x004f0000) == 0x004f0000)
 			{
-                          /* PC relative with immediate offset */
+                          /* PC relative with immediate offset.  */
 			  int offset = ((given & 0xf00) >> 4) | (given & 0xf);
+			  
 			  if ((given & 0x00800000) == 0)
 			    offset = -offset;
+			  
+			  func (stream, "[pc, #%x]\t; ", offset);
+			  
 			  (*info->print_address_func)
 			    (offset + pc + 8, info);
 			}
@@ -206,10 +288,10 @@
 				arm_regnames[(given >> 16) & 0xf]);
 			  if ((given & 0x01000000) != 0)
 			    {
-                              /* pre-indexed */
+                              /* Pre-indexed.  */
 			      if ((given & 0x00400000) == 0x00400000)
 				{
-                                  /* immediate */
+                                  /* Immediate.  */
                                   int offset = ((given & 0xf00) >> 4) | (given & 0xf);
 				  if (offset)
 				    func (stream, ", %s#%d",
@@ -218,7 +300,7 @@
 				}
 			      else
 				{
-                                  /* register */
+                                  /* Register.  */
 				  func (stream, ", %s%s",
 					(((given & 0x00800000) == 0)
 					 ? "-" : ""),
@@ -230,10 +312,10 @@
 			    }
 			  else
 			    {
-                              /* post-indexed */
+                              /* Post-indexed.  */
 			      if ((given & 0x00400000) == 0x00400000)
 				{
-                                  /* immediate */
+                                  /* Immediate.  */
                                   int offset = ((given & 0xf00) >> 4) | (given & 0xf);
 				  if (offset)
 				    func (stream, "], %s#%d",
@@ -244,7 +326,7 @@
 				}
 			      else
 				{
-                                  /* register */
+                                  /* Register.  */
 				  func (stream, "], %s%s",
 					(((given & 0x00800000) == 0)
 					 ? "-" : ""),
@@ -287,9 +369,9 @@
 			{
 			  int rotate = (given & 0xf00) >> 7;
 			  int immed = (given & 0xff);
-			  func (stream, "#%d",
-				((immed << (32 - rotate))
-				 | (immed >> rotate)) & 0xffffffff);
+			  immed = (((immed << (32 - rotate))
+				    | (immed >> rotate)) & 0xffffffff);
+			  func (stream, "#%d\t; 0x%x", immed, immed);
 			}
 		      else
 			arm_decode_shift (given, func, stream);
@@ -435,41 +517,69 @@
 			  {
 			  case '-':
 			    c++;
+			    
 			    while (*c >= '0' && *c <= '9')
 			      bitend = (bitend * 10) + *c++ - '0';
+			    
 			    if (!bitend)
 			      abort ();
+			    
 			    switch (*c)
 			      {
 			      case 'r':
 				{
 				  long reg;
+				  
 				  reg = given >> bitstart;
 				  reg &= (2 << (bitend - bitstart)) - 1;
+				  
 				  func (stream, "%s", arm_regnames[reg]);
 				}
 				break;
 			      case 'd':
 				{
 				  long reg;
+				  
 				  reg = given >> bitstart;
 				  reg &= (2 << (bitend - bitstart)) - 1;
+				  
 				  func (stream, "%d", reg);
 				}
 				break;
 			      case 'x':
 				{
 				  long reg;
+				  
 				  reg = given >> bitstart;
 				  reg &= (2 << (bitend - bitstart)) - 1;
+				  
 				  func (stream, "0x%08x", reg);
+				  
+				  /* Some SWI instructions have special
+				     meanings.  */
+				  if ((given & 0x0fffffff) == 0x0FF00000)
+				    func (stream, "\t; IMB");
+				  else if ((given & 0x0fffffff) == 0x0FF00001)
+				    func (stream, "\t; IMBRange");
+				}
+				break;
+			      case 'X':
+				{
+				  long reg;
+				  
+				  reg = given >> bitstart;
+				  reg &= (2 << (bitend - bitstart)) - 1;
+				  
+				  func (stream, "%01x", reg & 0xf);
 				}
 				break;
 			      case 'f':
 				{
 				  long reg;
+				  
 				  reg = given >> bitstart;
 				  reg &= (2 << (bitend - bitstart)) - 1;
+				  
 				  if (reg > 7)
 				    func (stream, "#%s",
 					  arm_fp_const[reg & 7]);
@@ -481,6 +591,7 @@
 				abort ();
 			      }
 			    break;
+			    
 			  case '`':
 			    c++;
 			    if ((given & (1 << bitstart)) == 0)
@@ -519,32 +630,31 @@
 
 /* Print one instruction from PC on INFO->STREAM.
    Return the size of the instruction. */
-
 static int
 print_insn_thumb (pc, info, given)
-     bfd_vma         pc;
-     struct disassemble_info *info;
-     long given;
+     bfd_vma                   pc;
+     struct disassemble_info * info;
+     long                      given;
 {
-  struct thumb_opcode *insn;
-  void *stream = info->stream;
-  fprintf_ftype func = info->fprintf_func;
+  struct thumb_opcode * insn;
+  void *                stream = info->stream;
+  fprintf_ftype         func = info->fprintf_func;
 
   for (insn = thumb_opcodes; insn->assembler; insn++)
     {
       if ((given & insn->mask) == insn->value)
         {
-          char *c = insn->assembler;
+          char * c = insn->assembler;
 
-          /* Special processing for Thumb 2 instruction BL sequence: */
-          if (!*c) /* check for empty (not NULL) assembler string */
+          /* Special processing for Thumb 2 instruction BL sequence:  */
+          if (!*c) /* Check for empty (not NULL) assembler string.  */
             {
 	      info->bytes_per_chunk = 4;
 	      info->bytes_per_line  = 4;
 	      
-              func (stream, "%04x\tbl\t", given & 0xffff);
-              (*info->print_address_func)
-                (BDISP23 (given) * 2 + pc + 4, info);
+                func (stream, "bl\t");
+		
+              info->print_address_func (BDISP23 (given) * 2 + pc + 4, info);
               return 4;
             }
           else
@@ -553,13 +663,14 @@
 	      info->bytes_per_line  = 4;
 	  	      
               given &= 0xffff;
-              func (stream, "%04x\t", given);
+	      
               for (; *c; c++)
                 {
                   if (*c == '%')
                     {
                       int domaskpc = 0;
                       int domasklr = 0;
+		      
                       switch (*++c)
                         {
                         case '%':
@@ -569,9 +680,11 @@
                         case 'S':
                           {
                             long reg;
+			    
                             reg = (given >> 3) & 0x7;
                             if (given & (1 << 6))
                               reg += 8;
+			    
                             func (stream, "%s", arm_regnames[reg]);
                           }
                           break;
@@ -579,9 +692,11 @@
                         case 'D':
                           {
                             long reg;
+			    
                             reg = given & 0x7;
                             if (given & (1 << 7))
                              reg += 8;
+			    
                             func (stream, "%s", arm_regnames[reg]);
                           }
                           break;
@@ -594,16 +709,18 @@
                         case 'N':
                           if (given & (1 << 8))
                             domasklr = 1;
-                          /* fall through */
+                          /* Fall through.  */
                         case 'O':
                           if (*c == 'O' && (given & (1 << 8)))
                             domaskpc = 1;
-                          /* fall through */
+                          /* Fall through.  */
                         case 'M':
                           {
                             int started = 0;
                             int reg;
+			    
                             func (stream, "{");
+			    
                             /* It would be nice if we could spot
                                ranges, and generate the rS-rE format: */
                             for (reg = 0; (reg < 8); reg++)
@@ -620,14 +737,14 @@
                                 if (started)
                                   func (stream, ", ");
                                 started = 1;
-                                func (stream, "lr");
+                                func (stream, arm_regnames[14] /* "lr" */);
                               }
 
                             if (domaskpc)
                               {
                                 if (started)
                                   func (stream, ", ");
-                                func (stream, "pc");
+                                func (stream, arm_regnames[15] /* "pc" */);
                               }
 
                             func (stream, "}");
@@ -640,6 +757,7 @@
                           {
                             int bitstart = *c++ - '0';
                             int bitend = 0;
+			    
                             while (*c >= '0' && *c <= '9')
                               bitstart = (bitstart * 10) + *c++ - '0';
 
@@ -648,6 +766,7 @@
                               case '-':
                                 {
                                   long reg;
+				  
                                   c++;
                                   while (*c >= '0' && *c <= '9')
                                     bitend = (bitend * 10) + *c++ - '0';
@@ -675,8 +794,8 @@
 
                                     case 'a':
 				      /* PC-relative address -- the bottom two
-					 bits of the address are dropped before
-					 the calculation.  */
+					 bits of the address are dropped
+					 before the calculation.  */
                                       info->print_address_func
 					(((pc + 4) & ~3) + (reg << 2), info);
                                       break;
@@ -697,7 +816,7 @@
                                       break;
 
                                     default:
-                                      abort();
+                                      abort ();
                                     }
                                 }
                                 break;
@@ -717,7 +836,7 @@
                                 break;
 
                               default:
-                                 abort();
+                                 abort ();
                               }
                           }
                           break;
@@ -734,154 +853,213 @@
        }
     }
 
-  /* no match */
+  /* No match.  */
   abort ();
 }
 
-/* NOTE: There are no checks in these routines that the relevant number of data bytes exist */
+/* Parse an individual disassembler option.  */
+void
+parse_arm_disassembler_option (option)
+     char * option;
+{
+  if (option == NULL)
+    return;
+      
+  if (strneq (option, "reg-names-", 10))
+    {
+      int i;
+	
+      option += 10;
 
-int
-print_insn_big_arm (pc, info)
+      for (i = NUM_ARM_REGNAMES; i--;)
+	if (streq (option, regnames[i].name))
+	  {
+	    regname_selected = i;
+	    break;
+	  }
+      
+      if (i < 0)
+	fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
+    }
+  else if (streq (option, "force-thumb"))
+    force_thumb = 1;
+  else if (streq (option, "no-force-thumb"))
+    force_thumb = 0;
+  else
+    fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
+  
+  return;
+}
+
+/* Parse the string of disassembler options, spliting it at whitespaces.  */
+static void
+parse_disassembler_options (options)
+     char * options;
+{
+  char * space;
+  
+  if (options == NULL)
+    return;
+
+  do
+    {
+      space = strchr (options, ' ');
+
+      if (space)
+	{
+	  * space = '\0';
+	  parse_arm_disassembler_option (options);
+	  * space = ' ';
+	  options = space + 1;
+	}
+      else
+	parse_arm_disassembler_option (options);
+    }
+  while (space);
+}
+
+/* NOTE: There are no checks in these routines that
+   the relevant number of data bytes exist.  */
+static int
+print_insn (pc, info, little)
      bfd_vma pc;
-     struct disassemble_info *info;
+     struct disassemble_info * info;
+     boolean little;
 {
   unsigned char      b[4];
   long               given;
   int                status;
-  coff_symbol_type   *cs;
-  elf_symbol_type    *es;
   int                is_thumb;
-  
-  is_thumb = false;
-  if (info->symbols != NULL)
-    {
-    if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
-     {
-       cs = coffsymbol (*info->symbols);
-       is_thumb = (cs->native->u.syment.n_sclass == C_THUMBEXT
-                   || cs->native->u.syment.n_sclass == C_THUMBSTAT
-                   || cs->native->u.syment.n_sclass == C_THUMBLABEL
-                   || cs->native->u.syment.n_sclass == C_THUMBEXTFUNC
-                   || cs->native->u.syment.n_sclass == C_THUMBSTATFUNC);
-  
-     }
-    else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
-     {
-       es = *(elf_symbol_type **)(info->symbols);
-       is_thumb = ELF_ST_TYPE (es->internal_elf_sym.st_info) ==
-	 STT_ARM_TFUNC;
-      }
-   }
 
-  info->bytes_per_chunk = 4;
-  info->display_endian = BFD_ENDIAN_BIG;
-
-  /* Always fetch word aligned values.  */
-  
-  status = (*info->read_memory_func) (pc & ~ 0x3, (bfd_byte *) &b[0], 4, info);
-  if (status != 0)
+  if (info->disassembler_options)
     {
-      (*info->memory_error_func) (status, pc, info);
-      return -1;
+      parse_disassembler_options (info->disassembler_options);
+      
+      /* To avoid repeated parsing of these options, we remove them here.  */
+      info->disassembler_options = NULL;
     }
-
-  if (is_thumb)
+  
+  is_thumb = force_thumb;
+  
+  if (!is_thumb && info->symbols != NULL)
     {
-      if (pc & 0x2)
+      if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
 	{
-	  given = (b[2] << 8) | b[3];
-
-	  status = info->read_memory_func ((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info);
-	  if (status != 0)
-	    {
-	      info->memory_error_func (status, pc + 4, info);
-	      return -1;
-	    }
+	  coff_symbol_type * cs;
 	  
-	  given |= (b[0] << 24) | (b[1] << 16);
+	  cs = coffsymbol (*info->symbols);
+	  is_thumb = (   cs->native->u.syment.n_sclass == C_THUMBEXT
+		      || cs->native->u.syment.n_sclass == C_THUMBSTAT
+		      || cs->native->u.syment.n_sclass == C_THUMBLABEL
+		      || cs->native->u.syment.n_sclass == C_THUMBEXTFUNC
+		      || cs->native->u.syment.n_sclass == C_THUMBSTATFUNC);
+	}
+      else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
+	{
+	  elf_symbol_type *  es;
+	  unsigned int       type;
+	  
+	  es = *(elf_symbol_type **)(info->symbols);
+	  type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
+	  
+	  is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT);
+	}
+    }
+  
+  info->bytes_per_chunk = 4;
+  info->display_endian  = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
+
+  if (little)
+    {
+      status = info->read_memory_func (pc, (bfd_byte *) &b[0], 4, info);
+      if (status != 0 && is_thumb)
+	{
+	  info->bytes_per_chunk = 2;
+	  
+	  status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
+	  b[3] = b[2] = 0;
+	}
+      
+      if (status != 0)
+	{
+	  info->memory_error_func (status, pc, info);
+	  return -1;
+	}
+      
+      given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
+    }
+  else
+    {
+      status = info->read_memory_func
+	(pc & ~ 0x3, (bfd_byte *) &b[0], 4, info);
+      if (status != 0)
+	{
+	  info->memory_error_func (status, pc, info);
+	  return -1;
+	}
+      
+      if (is_thumb)
+	{
+	  if (pc & 0x2)
+	    {
+	      given = (b[2] << 8) | b[3];
+	      
+	      status = info->read_memory_func
+		((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info);
+	      if (status != 0)
+		{
+		  info->memory_error_func (status, pc + 4, info);
+		  return -1;
+		}
+	      
+	      given |= (b[0] << 24) | (b[1] << 16);
+	    }
+	  else
+	    given = (b[0] << 8) | b[1] | (b[2] << 24) | (b[3] << 16);
 	}
       else
-	{
-	  given = (b[0] << 8) | b[1] | (b[2] << 24) | (b[3] << 16);
-	}
+	given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
     }
-  else
-    {
-      given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
-    }
-
+  
   if (is_thumb)
-    {
-      status = print_insn_thumb (pc, info, given);
-    }
+    status = print_insn_thumb (pc, info, given);
   else
-    {
-      status = print_insn_arm (pc, info, given);
-    }
+    status = print_insn_arm (pc, info, given);
 
   return status;
 }
 
 int
+print_insn_big_arm (pc, info)
+     bfd_vma pc;
+     struct disassemble_info * info;
+{
+  return print_insn (pc, info, false);
+}
+
+int
 print_insn_little_arm (pc, info)
      bfd_vma pc;
      struct disassemble_info * info;
 {
-  unsigned char      b[4];
-  long               given;
-  int                status;
-  coff_symbol_type   *cs;
-  elf_symbol_type    *es;
-  int                is_thumb;
+  return print_insn (pc, info, true);
+}
 
-  is_thumb = false;
-  if (info->symbols != NULL)
-    {
-    if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
-     {
-       cs = coffsymbol (*info->symbols);
-       is_thumb = (cs->native->u.syment.n_sclass == C_THUMBEXT
-                   || cs->native->u.syment.n_sclass == C_THUMBSTAT
-                   || cs->native->u.syment.n_sclass == C_THUMBLABEL
-                   || cs->native->u.syment.n_sclass == C_THUMBEXTFUNC
-                   || cs->native->u.syment.n_sclass == C_THUMBSTATFUNC);
+void
+print_arm_disassembler_options (FILE * stream)
+{
+  int i;
+
+  fprintf (stream, _("\n\
+The following ARM specific disassembler options are supported for use with\n\
+the -M switch:\n"));
   
-     }
-    else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
-     {
-       es = *(elf_symbol_type **)(info->symbols);
-       is_thumb = ELF_ST_TYPE (es->internal_elf_sym.st_info) ==
-	 STT_ARM_TFUNC;
-      }
-   }
+  for (i = NUM_ARM_REGNAMES; i--;)
+    fprintf (stream, "  reg-names-%s %*c%s\n",
+	     regnames[i].name,
+	     14 - strlen (regnames[i].name), ' ',
+	     regnames[i].description);
 
-  info->bytes_per_chunk = 4;
-  info->display_endian = BFD_ENDIAN_LITTLE;
-
-  status = (*info->read_memory_func) (pc, (bfd_byte *) &b[0], 4, info);
-  if (status != 0 && is_thumb)
-    {
-      info->bytes_per_chunk = 2;
-
-      status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
-      b[3] = b[2] = 0;
-    }
-  if (status != 0)
-    {
-      (*info->memory_error_func) (status, pc, info);
-      return -1;
-    }
-
-  given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
-
-  if (is_thumb)
-    {
-      status = print_insn_thumb (pc, info, given);
-    }
-  else
-    {
-      status = print_insn_arm (pc, info, given);
-    }
-
-  return status;
+  fprintf (stream, "  force-thumb              Assume all insns are Thumb insns\n");
+  fprintf (stream, "  no-force-thumb           Examine preceeding label to determine an insn's type\n\n");
 }
diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h
index f49298f..44a16a4 100644
--- a/opcodes/arm-opc.h
+++ b/opcodes/arm-opc.h
@@ -33,6 +33,7 @@
    %%			%
    %<bitfield>d		print the bitfield in decimal
    %<bitfield>x		print the bitfield in hex
+   %<bitfield>X		print the bitfield as 1 hex digit without leading "0x"
    %<bitfield>r		print as an ARM register
    %<bitfield>f		print a floating point constant if >7 else a
 			floating point register
@@ -72,7 +73,8 @@
 /* Note: There is a partial ordering in this table - it must be searched from
    the top to obtain a correct match. */
 
-static struct arm_opcode arm_opcodes[] = {
+static struct arm_opcode arm_opcodes[] =
+{
     /* ARM instructions */
     {0xe1a00000, 0xffffffff, "nop\t\t\t(mov r0,r0)"},
     {0x012FFF10, 0x0ffffff0, "bx%c\t%0-3r"},
@@ -162,7 +164,8 @@
     {0x0e000010, 0x0f100010, "mcr%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
     {0x0c000000, 0x0e100000, "stc%c%22'l\t%8-11d, cr%12-15d, %A"},
     {0x0c100000, 0x0e100000, "ldc%c%22'l\t%8-11d, cr%12-15d, %A"},
-    /* the rest */
+    
+    /* The rest.  */
     {0x00000000, 0x00000000, "undefined instruction %0-31x"},
     {0x00000000, 0x00000000, 0}
 };
@@ -264,7 +267,7 @@
   {0xDC00, 0xFF00, "bgt\t%0-7B"},
   {0xDD00, 0xFF00, "ble\t%0-7B"},
   /* format 17 */
-  {0xDE00, 0xFF00, "undefined"},
+  {0xDE00, 0xFF00, "bal\t%0-7B"},
   {0xDF00, 0xFF00, "swi\t%0-7d"},
   /* format 9 */
   {0x6000, 0xF800, "str\t%0-2r, [%3-5r, #%6-10W]"},
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c
new file mode 100644
index 0000000..2d7eb94
--- /dev/null
+++ b/opcodes/avr-dis.c
@@ -0,0 +1,577 @@
+/* Disassemble AVR instructions.
+   Copyright (C) 1999, 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 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 "opintl.h"
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+#define IFMASK(a,b)     ((opcode & (a)) == (b))
+#define CODE_MAX        65537
+
+static char* SREG_flags = "CZNVSHTI";
+static char* sect94[] = {"COM","NEG","SWAP","INC","NULL","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"
+};
+static char* last4[] = {"BLD","BST","SBRC","SBRS"};
+
+
+
+static void dispLDD PARAMS ((u16, char *));
+
+static void
+dispLDD (opcode, dest)
+     u16 opcode;
+     char *dest;
+{
+  opcode = (((opcode & 0x2000) >> 8) | ((opcode & 0x0c00) >> 7)
+	    | (opcode & 7));
+  sprintf(dest, "%d", opcode);
+}
+
+
+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 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 opcode = op & 0x0fff;
+  sprintf(dest, ".%+-8d ; 0x%06X", opcode * 2, pc + 2 + opcode * 2);
+}
+
+
+static void add03f8 PARAMS ((u16, char *, int));
+
+static void
+add03f8 (op, dest, pc)
+     u16 op;
+     char *dest;
+     int pc;
+{
+  int opcode = (op >> 3) & 0x7f;
+  sprintf(dest, ".%+-8d ; 0x%06X", opcode * 2, pc + 2 + opcode * 2);
+}
+
+
+static u16 avrdis_opcode PARAMS ((bfd_vma, disassemble_info *));
+
+static u16
+avrdis_opcode (addr, info)
+     bfd_vma addr;
+     disassemble_info *info;
+{
+  bfd_byte buffer[2];
+  int status;
+  status = info->read_memory_func(addr, buffer, 2, info);
+  if (status != 0)
+    {
+      info->memory_error_func(status, addr, info);
+      return -1;
+    }
+  return bfd_getl16 (buffer);
+}
+
+
+int
+print_insn_avr(addr, info)
+     bfd_vma addr;
+     disassemble_info *info;
+{
+  char rr[200];
+  char rd[200];
+  u16 opcode;
+  void *stream = info->stream;
+  fprintf_ftype prin = info->fprintf_func;
+  int cmd_len = 2;
+
+  opcode = avrdis_opcode (addr, info);
+
+  if (IFMASK(0xd000, 0x8000))
+    {
+      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);
+    }
+  else
+    {
+      switch (opcode & 0xf000)
+        {
+        case 0x0000:
+	  {
+	    reg50(opcode, rd);
+	    reg104(opcode, rr);
+	    switch (opcode & 0x0c00)
+	      {
+	      case 0x0000:
+		(*prin) (stream, "    NOP");
+		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 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(0x000f, 0x0009))
+		    {
+		      if (opcode & 0x0100)
+			(*prin) (stream, "    ICALL");
+		      else
+			(*prin) (stream, "    IJMP");
+		    }
+		  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
+			(*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;
+        }
+    }
+  return cmd_len;
+}
diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c
index 56840a6..ede3add 100644
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -1,6 +1,6 @@
 /* CGEN generic opcode support.
 
-   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.
 
@@ -595,3 +595,27 @@
   cgen_get_insn_operands (cd, insn, fields, indices);
   return insn;
 }
+
+/* Allow signed overflow of instruction fields.  */
+void
+cgen_set_signed_overflow_ok (cd)
+     CGEN_CPU_DESC cd;
+{
+  cd->signed_overflow_ok_p = 1;
+}
+
+/* Generate an error message if a signed field in an instruction overflows.  */
+void
+cgen_clear_signed_overflow_ok (cd)
+     CGEN_CPU_DESC cd;
+{
+  cd->signed_overflow_ok_p = 0;
+}
+
+/* Will an error message be generated if a signed field in an instruction overflows ? */
+unsigned int
+cgen_signed_overflow_ok_p (cd)
+     CGEN_CPU_DESC cd;
+{
+  return cd->signed_overflow_ok_p;
+}
diff --git a/opcodes/configure b/opcodes/configure
index 71cff12..bbfa207 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
+# Generated automatically using autoconf version 2.13.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -20,7 +20,7 @@
 ac_help="$ac_help
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
 ac_help="$ac_help
-  --disable-libtool-lock  force libtool not to do file locking"
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
   --enable-targets        alternative target configurations"
 ac_help="$ac_help
@@ -32,8 +32,6 @@
   --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
@@ -356,7 +354,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
+    echo "configure generated by autoconf version 2.13.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -516,7 +514,7 @@
 
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -560,9 +558,130 @@
 if test -z "$ac_aux_dir"; then
   { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:568: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_host_alias=$host
+  case "$ac_cv_host_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      if ac_cv_host_alias=`$ac_config_guess`; then :
+      else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+      fi ;;
+    *) ac_cv_host_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+  ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:609: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_target_alias=$target
+  case "$ac_cv_target_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_target_alias=$host_alias ;;
+
+    *) ac_cv_target_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+  ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:649: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_build_alias=$build
+  case "$ac_cv_build_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_build_alias=$host_alias ;;
+
+    *) ac_cv_build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+  ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
 
 
 # Do some error checking and defaulting for the host and target type.
@@ -585,69 +704,6 @@
 *) { 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:596: 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:617: 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:635: 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, &&
@@ -656,8 +712,8 @@
 # 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:660: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:716: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -686,8 +742,8 @@
   # 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:690: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:746: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -733,12 +789,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:741: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:797: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -768,8 +824,8 @@
   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:773: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:829: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -780,12 +836,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 784 "configure"
+#line 840 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:845: \"$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
@@ -810,14 +866,14 @@
 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:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:871: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:820: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:876: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -825,7 +881,7 @@
   yes;
 #endif
 EOF
-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
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:885: \"$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
@@ -844,8 +900,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:848: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:904: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -876,7 +932,7 @@
 fi
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:880: checking for POSIXized ISC" >&5
+echo "configure:936: 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
@@ -914,9 +970,9 @@
 # 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:918: checking for a BSD compatible install" >&5
+echo "configure:974: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -934,6 +990,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -962,12 +1022,12 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:971: checking whether build environment is sane" >&5
+echo "configure:1031: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1015,18 +1075,18 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1028: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1088: 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
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
@@ -1070,7 +1130,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1074: checking for working aclocal" >&5
+echo "configure:1134: 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.
@@ -1083,7 +1143,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1087: checking for working autoconf" >&5
+echo "configure:1147: 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.
@@ -1096,7 +1156,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1100: checking for working automake" >&5
+echo "configure:1160: 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.
@@ -1109,7 +1169,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1113: checking for working autoheader" >&5
+echo "configure:1173: 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.
@@ -1122,7 +1182,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1126: checking for working makeinfo" >&5
+echo "configure:1186: 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.
@@ -1145,8 +1205,8 @@
 # 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:1149: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+echo "configure:1209: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_AR+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AR"; then
@@ -1177,8 +1237,8 @@
 # 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:1181: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1241: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1209,8 +1269,8 @@
   # 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:1213: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1273: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1315,8 +1375,8 @@
 # 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:1319: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1379: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
@@ -1354,11 +1414,11 @@
 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:1358: checking for ld used by GCC" >&5
+echo "configure:1418: 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]:[\\/]*)
+    [\\/]* | [A-Za-z]:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
@@ -1378,19 +1438,19 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1382: checking for GNU ld" >&5
+echo "configure:1442: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1385: checking for non-GNU ld" >&5
+echo "configure:1445: checking for non-GNU ld" >&5
 fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  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"; then
+    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.
@@ -1415,10 +1475,9 @@
   echo "$ac_t""no" 1>&6
 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:1421: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+echo "configure:1480: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
@@ -1433,18 +1492,18 @@
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1437: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+echo "configure:1496: checking for BSD-compatible nm" >&5
+if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   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}:"
+  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; then
+    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
@@ -1468,214 +1527,9 @@
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
-
-# 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
-echo "configure:1475: checking command to parse $NM output" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  # 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.
-ac_symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-ac_symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  ac_symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  ac_symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  ac_symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  ac_symcode='[BDT]'
-  ;;
-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
-  ac_symcode='[ABCDGISTW]'
-fi
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* 	\($ac_symcode\) 	 	*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  ac_pipe_works=no
-  rm -f conftest.$ac_ext
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func;return 0;}
-EOF
-
-  if { (eval echo configure:1538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-    # Now try to grab the symbols.
-    ac_nlist=conftest.nm
-  
-    if { (eval echo configure:1542: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
-	mv -f "$ac_nlist"T "$ac_nlist"
-      else
-	rm -f "$ac_nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$ac_global_symbol_to_cdecl"' < "$ac_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},/' < "$ac_nlist" >> conftest.c
-	cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftestm.$ac_objext
-	  ac_save_LIBS="$LIBS"
-	  ac_save_CFLAGS="$CFLAGS"
-	  LIBS="conftestm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-	    ac_pipe_works=yes
-	  else
-	    echo "configure: failed program was:" >&5
-	    cat conftest.c >&5
-	  fi
-	  LIBS="$ac_save_LIBS"
-	  CFLAGS="$ac_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $ac_nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $ac_nlist" >&5
-      fi
-    else
-      echo "cannot run $ac_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.c >&5
-  fi
-  rm -rf conftest*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$ac_pipe_works" = yes; then
-    if test x"$ac_symprfx" = x"_"; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      ac_cv_sys_symbol_underscore=no
-    fi
-    break
-  else
-    ac_cv_sys_global_symbol_pipe=
-  fi
-done
-
-fi
-
-
-ac_result=yes
-if test -z "$ac_cv_sys_global_symbol_pipe"; then
-   ac_result=no
-fi
-echo "$ac_t""$ac_result" 1>&6
-
-echo $ac_n "checking for _ prefix in compiled symbols""... $ac_c" 1>&6
-echo "configure:1640: checking for _ prefix in compiled symbols" >&5
-if eval "test \"`echo '$''{'ac_cv_sys_symbol_underscore'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_cv_sys_symbol_underscore=no
-cat > conftest.$ac_ext <<EOF
-void nm_test_func(){}
-int main(){nm_test_func;return 0;}
-EOF
-if { (eval echo configure:1649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  # Now try to grab the symbols.
-  ac_nlist=conftest.nm
-  if { (eval echo configure:1652: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then
-    # See whether the symbols have a leading underscore.
-    if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
-      ac_cv_sys_symbol_underscore=yes
-    else
-      if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
-	:
-      else
-	echo "configure: cannot find nm_test_func in $ac_nlist" >&5
-      fi
-    fi
-  else
-    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&5
-  fi
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.c >&5
-fi
-rm -rf conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_sys_symbol_underscore" 1>&6
-USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
-
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1678: checking whether ln -s works" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+echo "configure:1532: checking whether ln -s works" >&5
+if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftestdata
@@ -1695,23 +1549,36 @@
 fi
 
 
+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 "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 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"
 
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+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 "$host" in
+case "$lt_target" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1714 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1581 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1732,19 +1599,19 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1736: checking whether the C compiler needs -belf" >&5
-if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+echo "configure:1603: checking whether the C compiler needs -belf" >&5
+if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1741 "configure"
+#line 1608 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1615: \"$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
@@ -1763,161 +1630,9 @@
   fi
   ;;
 
-*-*-cygwin*)
-  # 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:1771: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1803: 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
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="dlltool"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
-  echo "$ac_t""$DLLTOOL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  DLLTOOL="false"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1838: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1870: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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_AS="as"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
-  echo "$ac_t""$AS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  AS="false"
-fi
-fi
-
-
-  ;;
 
 esac
 
-# enable the --disable-libtool-lock switch
-
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval="$enable_libtool_lock"
-  need_locks=$enableval
-else
-  need_locks=yes
-fi
-
-
-if test x"$need_locks" = xno; then
-  libtool_flags="$libtool_flags --disable-lock"
-fi
-
 
 # Save cache, so that ltconfig can load it
 cat > confcache <<\EOF
@@ -1970,16 +1685,17 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
-DLLTOOL="$DLLTOOL" AS="$AS" \
+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 $host \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -2035,17 +1751,17 @@
   rm -f conftestsed
 fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+  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"
+  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,"
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2049: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1765: 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"
@@ -2068,12 +1784,12 @@
   
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:2072: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+echo "configure:1788: checking for Cygwin environment" >&5
+if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2077 "configure"
+#line 1793 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2084,7 +1800,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -2094,26 +1810,25 @@
   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:2105: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+echo "configure:1820: checking for mingw32 environment" >&5
+if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2110 "configure"
+#line 1825 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:2117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -2123,29 +1838,57 @@
   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 EMX OS/2 environment""... $ac_c" 1>&6
+echo "configure:1848: checking for EMX OS/2 environment" >&5
+if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1853 "configure"
+#include "confdefs.h"
+
+int main() {
+return __EMX__;
+; return 0; }
+EOF
+if { (eval echo configure:1860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_emxos2=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_emxos2=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_emxos2" 1>&6
+EMXOS2=
+test "$ac_cv_emxos2" = yes && EMXOS2=yes
+
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2136: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+echo "configure:1879: checking for executable suffix" >&5
+if eval "test \"\${ac_cv_exeext+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = 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:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.C | *.o | *.obj | *.xcoff) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -2168,8 +1911,8 @@
 # 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:2172: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1915: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2198,8 +1941,8 @@
   # 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:2202: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1945: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2245,12 +1988,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # 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:2253: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1996: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -2280,8 +2023,8 @@
   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:2285: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:2028: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2292,12 +2035,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2296 "configure"
+#line 2039 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2044: \"$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
@@ -2322,14 +2065,14 @@
 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:2327: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:2070: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:2332: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+echo "configure:2075: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -2337,7 +2080,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2341: \"$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:2084: \"$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
@@ -2356,8 +2099,8 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2360: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+echo "configure:2103: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -2390,13 +2133,13 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2394: checking how to run the C preprocessor" >&5
+echo "configure:2137: 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
+if eval "test \"\${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
@@ -2405,13 +2148,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2409 "configure"
+#line 2152 "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:2415: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2158: \"$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
   :
@@ -2422,13 +2165,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2426 "configure"
+#line 2169 "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:2432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2175: \"$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
   :
@@ -2439,13 +2182,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2443 "configure"
+#line 2186 "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:2449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2192: \"$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
   :
@@ -2470,12 +2213,12 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2474: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+echo "configure:2217: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2479 "configure"
+#line 2222 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2483,7 +2226,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2230: \"$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*
@@ -2500,7 +2243,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 2504 "configure"
+#line 2247 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2518,7 +2261,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 2522 "configure"
+#line 2265 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2539,7 +2282,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2543 "configure"
+#line 2286 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2550,7 +2293,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2574,12 +2317,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2578: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+echo "configure:2321: checking for working const" >&5
+if eval "test \"\${ac_cv_c_const+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2583 "configure"
+#line 2326 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2628,7 +2371,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2649,21 +2392,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2653: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+echo "configure:2396: checking for inline" >&5
+if eval "test \"\${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 2660 "configure"
+#line 2403 "configure"
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2689,12 +2432,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2693: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+echo "configure:2436: checking for off_t" >&5
+if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2698 "configure"
+#line 2441 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2705,29 +2448,31 @@
 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
+  eval "ac_cv_type_off_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_off_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'off_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define off_t long
 EOF
 
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2726: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+echo "configure:2471: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2731 "configure"
+#line 2476 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2738,17 +2483,19 @@
 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
+  eval "ac_cv_type_size_t=yes"
 else
   rm -rf conftest*
-  ac_cv_type_size_t=no
+  eval "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
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+  cat >> confdefs.h <<EOF
 #define size_t unsigned
 EOF
 
@@ -2757,19 +2504,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:2761: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+echo "configure:2508: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2766 "configure"
+#line 2513 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2520: \"$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
@@ -2790,12 +2537,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2794: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+echo "configure:2541: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2799 "configure"
+#line 2546 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2823,7 +2570,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2574: \"$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
@@ -2855,12 +2602,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2859: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+echo "configure:2606: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2864 "configure"
+#line 2611 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2885,12 +2632,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:2889: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2636: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2894 "configure"
+#line 2641 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2899,6 +2646,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -2908,12 +2656,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:2917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2665: \"$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
@@ -2940,15 +2688,15 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2944: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo "configure:2692: checking stack direction for C alloca" >&5
+if eval "test \"\${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 2952 "configure"
+#line 2700 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2967,7 +2715,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2719: \"$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
@@ -2992,17 +2740,17 @@
 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 "configure:2744: checking for $ac_hdr" >&5
+if eval "test \"\${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"
+#line 2749 "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; }
+{ (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*
@@ -3031,12 +2779,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3035: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:2783: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3040 "configure"
+#line 2788 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3045,6 +2793,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3054,12 +2803,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2812: \"$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
@@ -3084,15 +2833,15 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3088: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+echo "configure:2837: checking for working mmap" >&5
+if eval "test \"\${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 3096 "configure"
+#line 2845 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3232,7 +2981,7 @@
 }
 
 EOF
-if { (eval echo configure:3236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2985: \"$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
@@ -3260,17 +3009,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3264: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3013: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3269 "configure"
+#line 3018 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3023: \"$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*
@@ -3300,12 +3049,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3304: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3053: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3309 "configure"
+#line 3058 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3314,6 +3063,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3323,12 +3073,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3082: \"$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
@@ -3357,12 +3107,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3361: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3111: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3366 "configure"
+#line 3116 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3371,6 +3121,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3380,12 +3131,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3140: \"$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
@@ -3419,19 +3170,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3423: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+echo "configure:3174: checking for LC_MESSAGES" >&5
+if eval "test \"\${am_cv_val_LC_MESSAGES+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3428 "configure"
+#line 3179 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3186: \"$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
@@ -3452,7 +3203,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3456: checking whether NLS is requested" >&5
+echo "configure:3207: 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"
@@ -3472,7 +3223,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3476: checking whether included gettext is requested" >&5
+echo "configure:3227: 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"
@@ -3491,17 +3242,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3495: checking for libintl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3246: checking for libintl.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3500 "configure"
+#line 3251 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3256: \"$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*
@@ -3518,19 +3269,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:3522: checking for gettext in libc" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+echo "configure:3273: checking for gettext in libc" >&5
+if eval "test \"\${gt_cv_func_gettext_libc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3527 "configure"
+#line 3278 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3285: \"$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
@@ -3546,15 +3297,15 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3550: 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 "configure:3301: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 3558 "configure"
+#line 3309 "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
@@ -3565,7 +3316,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3320: \"$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
@@ -3581,19 +3332,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:3585: checking for gettext in libintl" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+echo "configure:3336: checking for gettext in libintl" >&5
+if eval "test \"\${gt_cv_func_gettext_libintl+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3590 "configure"
+#line 3341 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3348: \"$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
@@ -3621,8 +3372,8 @@
 	      # 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:3625: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3376: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3655,12 +3406,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3659: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+echo "configure:3410: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3664 "configure"
+#line 3415 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3669,6 +3420,7 @@
 /* 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();
+char (*f)();
 
 int main() {
 
@@ -3678,12 +3430,12 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3439: \"$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
@@ -3710,8 +3462,8 @@
 		# 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:3714: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3466: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3746,8 +3498,8 @@
 		# 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:3750: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3502: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3778,7 +3530,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3782 "configure"
+#line 3534 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3786,7 +3538,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3818,8 +3570,8 @@
         # 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:3822: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+echo "configure:3574: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$MSGFMT" in
@@ -3852,8 +3604,8 @@
         # 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:3856: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+echo "configure:3608: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$GMSGFMT" in
@@ -3888,8 +3640,8 @@
         # 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:3892: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+echo "configure:3644: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$XGETTEXT" in
@@ -3978,7 +3730,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3982: checking for catalogs to be installed" >&5
+echo "configure:3734: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -4006,17 +3758,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:4010: checking for linux/version.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3762: checking for linux/version.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4015 "configure"
+#line 3767 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3772: \"$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*
@@ -4093,9 +3845,9 @@
 # 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:4097: checking for a BSD compatible install" >&5
+echo "configure:3849: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -4113,6 +3865,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -4141,7 +3897,7 @@
 # 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
@@ -4150,17 +3906,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4154: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:3910: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4159 "configure"
+#line 3915 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3920: \"$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*
@@ -4210,7 +3966,7 @@
 if test -n "$enable_targets" ; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result" ; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -4253,6 +4009,7 @@
 	bfd_alpha_arch)		ta="$ta alpha-dis.lo alpha-opc.lo" ;;
 	bfd_arc_arch)		ta="$ta arc-dis.lo arc-opc.lo" ;;
 	bfd_arm_arch)		ta="$ta arm-dis.lo" ;;
+	bfd_avr_arch)		ta="$ta avr-dis.lo" ;;
 	bfd_convex_arch)	;;
 	bfd_d10v_arch)		ta="$ta d10v-dis.lo d10v-opc.lo" ;;
 	bfd_d30v_arch)		ta="$ta d30v-dis.lo d30v-opc.lo" ;;
@@ -4260,6 +4017,7 @@
 	bfd_h8300_arch)		ta="$ta h8300-dis.lo" ;;
 	bfd_h8500_arch)		ta="$ta h8500-dis.lo" ;;
 	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_i960_arch)		ta="$ta i960-dis.lo" ;;
@@ -4271,6 +4029,7 @@
 	bfd_mn10200_arch)	ta="$ta m10200-dis.lo m10200-opc.lo" ;;
 	bfd_mn10300_arch)	ta="$ta m10300-dis.lo m10300-opc.lo" ;;
 	bfd_ns32k_arch)		ta="$ta ns32k-dis.lo" ;;
+	bfd_pj_arch)	        ta="$ta pj-dis.lo pj-opc.lo" ;;
 	bfd_powerpc_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
 	bfd_pyramid_arch)	;;
 	bfd_romp_arch)		;;
@@ -4417,7 +4176,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.13"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -4489,12 +4248,7 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
-s%@USE_SYMBOL_UNDERSCORE@%$USE_SYMBOL_UNDERSCORE%g
 s%@LN_S@%$LN_S%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@AS@%$AS%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
 s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
@@ -4523,10 +4277,6 @@
 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%@cgen@%$cgen%g
 s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g
 s%@WIN32LIBADD@%$WIN32LIBADD%g
 s%@archdefs@%$archdefs%g
@@ -4750,5 +4500,5 @@
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
 
diff --git a/opcodes/configure.bat b/opcodes/configure.bat
deleted file mode 100644
index 5f2c6d1..0000000
--- a/opcodes/configure.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@echo off

-echo Configuring opcodes for go32

-rem This batch file assumes a unix-type "sed" program

-

-echo # Makefile generated by "configure.bat"> Makefile

-

-if exist config.sed del config.sed

-

-echo "/\.o[ 	]*:/ s/config.status//			">> config.sed

-echo "s/CC = cc/CC = gcc/				">> config.sed

-echo "s/@BFD_MACHINES@/i386-dis.o/			">> config.sed

-echo "s/@archdefs@/-DARCH_i386/				">> config.sed

-echo "s/@frags@//					">> config.sed

-echo "s/@srcdir@//					">> config.sed

-echo "s!@prefix@!/usr/local!				">> config.sed

-echo "s!@exec_prefix@!/usr/local!			">> config.sed

-echo "s/@RANLIB@/ranlib/				">> config.sed

-

-echo "s/^[ 	]*rm/	-rm/				">> config.sed

-

-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ 	]*$//" config.sed > config2.sed

-sed -f config2.sed Makefile.in >> Makefile

-del config.sed

-del config2.sed

diff --git a/opcodes/configure.in b/opcodes/configure.in
index c278580..6ef461f 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -90,7 +90,7 @@
 if test -n "$enable_targets" ; then
     for targ in `echo $enable_targets | sed 's/,/ /g'`
     do
-	result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
+	result=`$ac_config_sub $targ 2>/dev/null`
 	if test -n "$result" ; then
 	    canon_targets="$canon_targets $result"
 	else
@@ -133,6 +133,7 @@
 	bfd_alpha_arch)		ta="$ta alpha-dis.lo alpha-opc.lo" ;;
 	bfd_arc_arch)		ta="$ta arc-dis.lo arc-opc.lo" ;;
 	bfd_arm_arch)		ta="$ta arm-dis.lo" ;;
+	bfd_avr_arch)		ta="$ta avr-dis.lo" ;;
 	bfd_convex_arch)	;;
 	bfd_d10v_arch)		ta="$ta d10v-dis.lo d10v-opc.lo" ;;
 	bfd_d30v_arch)		ta="$ta d30v-dis.lo d30v-opc.lo" ;;
@@ -140,6 +141,7 @@
 	bfd_h8300_arch)		ta="$ta h8300-dis.lo" ;;
 	bfd_h8500_arch)		ta="$ta h8500-dis.lo" ;;
 	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_i960_arch)		ta="$ta i960-dis.lo" ;;
@@ -151,6 +153,7 @@
 	bfd_mn10200_arch)	ta="$ta m10200-dis.lo m10200-opc.lo" ;;
 	bfd_mn10300_arch)	ta="$ta m10300-dis.lo m10300-opc.lo" ;;
 	bfd_ns32k_arch)		ta="$ta ns32k-dis.lo" ;;
+	bfd_pj_arch)	        ta="$ta pj-dis.lo pj-opc.lo" ;;
 	bfd_powerpc_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
 	bfd_pyramid_arch)	;;
 	bfd_romp_arch)		;;
diff --git a/opcodes/d10v-opc.c b/opcodes/d10v-opc.c
index a8a02d0..c4bb098 100644
--- a/opcodes/d10v-opc.c
+++ b/opcodes/d10v-opc.c
@@ -115,7 +115,7 @@
 #define NUM16	(RDSTE + 1)
   { 16, 0, OPERAND_NUM|OPERAND_SIGNED },
 #define NUM3	(NUM16 + 1)			/* rac, rachi */
-  { 3, 1, OPERAND_NUM|OPERAND_SIGNED },
+  { 3, 1, OPERAND_NUM|OPERAND_SIGNED|RESTRICTED_NUM3 },
 #define NUM4	(NUM3 + 1)
   { 4, 1, OPERAND_NUM|OPERAND_SIGNED },
 #define UNUM4	(NUM4 + 1)
@@ -206,8 +206,8 @@
   { "cmpi.l", LONG_L, 1, MU, SEQ, 0x3000000, 0x3f0f0000, { RSRC2, NUM16 } },
   { "cmpu", SHORT_2, 1, EITHER, PAR|WF0, 0x4600, 0x7e01, { RSRC2, RSRC } },
   { "cmpui", LONG_L, 1, MU, SEQ, 0x23000000, 0x3f0f0000, { RSRC2, UNUM16 } },
+  { "cpfg", SHORT_2, 1, MU, PAR, 0x4e0f, 0x7fdf, { FDST, CFSRC } },
   { "cpfg", SHORT_2, 1, MU, PAR, 0x4e09, 0x7fd9, { FDST, FFSRC } },
-  { "cpfg", SHORT_2, 1, MU, PAR, 0x4e09, 0x7fd9, { FDST, CFSRC } },
   { "dbt", SHORT_2, 5, MU, PAR, 0x5f20, 0x7fff, { 0 } },
   { "divs", LONG_L, 1, BOTH, SEQ, 0x14002800, 0x3f10fe21, { RDSTE, RSRC } },
   { "exef0f", SHORT_2, 1, EITHER, PARONLY, 0x4e04, 0x7fff, { 0 } },
@@ -226,10 +226,12 @@
   { "ld", SHORT_2, 1, MU, PAR|RMEM, 0x6401, 0x7e01, { RDST, ATSIGN, RSRC, MINUS } },
   { "ld", SHORT_2, 1, MU, PAR|RMEM, 0x6001, 0x7e01, { RDST, ATSIGN, RSRC, PLUS } },
   { "ld", SHORT_2, 1, MU, PAR|RMEM, 0x6000, 0x7e01, { RDST, ATSIGN, RSRC } },
+  { "ld", LONG_L, 1, MU, SEQ, 0x32010000, 0x3f0f0000, { RDST, ATSIGN, NUM16 } },
   { "ld2w", LONG_L, 1, MU, SEQ, 0x31000000, 0x3f100000, { RDSTE, ATPAR, NUM16, RSRC } },
   { "ld2w", SHORT_2, 1, MU, PAR|RMEM, 0x6601, 0x7e21, { RDSTE, ATSIGN, RSRC, MINUS } },
   { "ld2w", SHORT_2, 1, MU, PAR|RMEM, 0x6201, 0x7e21, { RDSTE, ATSIGN, RSRC, PLUS } },
   { "ld2w", SHORT_2, 1, MU, PAR|RMEM, 0x6200, 0x7e21, { RDSTE, ATSIGN, RSRC } },
+  { "ld2w", LONG_L, 1, MU, SEQ, 0x33010000, 0x3f1f0000, { RDSTE, ATSIGN, NUM16 } },
   { "ldb", LONG_L, 1, MU, SEQ, 0x38000000, 0x3f000000, { RDST, ATPAR, NUM16, RSRC } },
   { "ldb", SHORT_2, 1, MU, PAR|RMEM, 0x7000, 0x7e01, { RDST, ATSIGN, RSRC } },
   { "ldi", OPCODE_FAKE, 0, 0, 0, 0, 0, { 1, 4, 16, 0 } },
@@ -276,6 +278,12 @@
   { "not", SHORT_2, 1, EITHER, PAR, 0x4603, 0x7e1f, { RDST } },
   { "or", SHORT_2, 1, EITHER, PAR, 0x800, 0x7e01, { RDST, RSRC } },
   { "or3", LONG_L, 1, MU, SEQ, 0x4000000, 0x3f000000, { RDST, RSRC, NUM16 } },
+  /* Special case. sac&sachi must occur before rac&rachi because they have
+     intersecting masks! The masks for rac&rachi will match sac&sachi but
+     not the other way around.
+   */
+  { "sac", SHORT_2, 1, IU, PAR|RF0|WF0, 0x5209, 0x7e2f, { RDSTE, ASRC } },
+  { "sachi", SHORT_2, 1, IU, PAR|RF0|WF0, 0x4209, 0x7e0f, { RDST, ASRC } },
   { "rac", SHORT_2, 1, IU, PAR|WF0, 0x5201, 0x7e21, { RDSTE, ASRC0ONLY, NUM3 } },
   { "rachi", SHORT_2, 1, IU, PAR|WF0, 0x4201, 0x7e01, { RDST, ASRC, NUM3 } },
   { "rep", LONG_L, 2, MU, SEQ, 0x27000000, 0x3ff00000, { RSRC, ANUM16 } },
@@ -285,6 +293,7 @@
   { "sadd", SHORT_2, 1, IU, PAR, 0x1223, 0x7eef, { ADST, ASRC } },
   { "setf0f", SHORT_2, 1, MU, PAR|RF0, 0x4611, 0x7e1f, { RDST } },
   { "setf0t", SHORT_2, 1, MU, PAR|RF0, 0x4613, 0x7e1f, { RDST } },
+  { "slae", SHORT_2, 1, IU, PAR, 0x3220, 0x7ee1, { ADST, RSRC } },
   { "sleep", SHORT_2, 1, MU, PAR, 0x5fc0, 0x7fff, { 0 } },
   { "sll", SHORT_2, 1, IU, PAR, 0x2200, 0x7e01, { RDST, RSRC } },
   { "sll", SHORT_2, 1, IU, PAR, 0x3200, 0x7ee1, { ADST, RSRC } },
@@ -305,11 +314,13 @@
   { "st", SHORT_2, 1, MU, PAR|WMEM, 0x6c1f, 0x7e1f, { RSRC2, ATMINUS, RSRC } },
   { "st", SHORT_2, 1, MU, PAR|WMEM, 0x6801, 0x7e01, { RSRC2, ATSIGN, RSRC, PLUS } },
   { "st", SHORT_2, 1, MU, PAR|WMEM, 0x6c01, 0x7e01, { RSRC2, ATSIGN, RSRC, MINUS } },
+  { "st", LONG_L, 1, MU, SEQ, 0x36010000, 0x3f0f0000, { RSRC2, ATSIGN, NUM16 } },
   { "st2w", LONG_L, 1, MU, SEQ, 0x35000000, 0x3f100000, { RSRC2E, ATPAR, NUM16, RSRC } },
   { "st2w", SHORT_2, 1, MU, PAR|WMEM, 0x6a00, 0x7e21, { RSRC2E, ATSIGN, RSRC } },
   { "st2w", SHORT_2, 1, MU, PAR|WMEM, 0x6e1f, 0x7e3f, { RSRC2E, ATMINUS, RSRC } },
   { "st2w", SHORT_2, 1, MU, PAR|WMEM, 0x6a01, 0x7e21, { RSRC2E, ATSIGN, RSRC, PLUS } },
   { "st2w", SHORT_2, 1, MU, PAR|WMEM, 0x6e01, 0x7e21, { RSRC2E, ATSIGN, RSRC, MINUS } },
+  { "st2w", LONG_L, 1, MU, SEQ, 0x37010000, 0x3f1f0000, { RSRC2E, ATSIGN, NUM16 } },
   { "stb", LONG_L, 1, MU, SEQ, 0x3c000000, 0x3f000000, { RSRC2, ATPAR, NUM16, RSRC } },
   { "stb", SHORT_2, 1, MU, PAR|WMEM, 0x7800, 0x7e01, { RSRC2, ATSIGN, RSRC } },
   { "stop", SHORT_2, 1, MU, PAR, 0x5fe0, 0x7fff, { 0 } },
diff --git a/opcodes/d30v-dis.c b/opcodes/d30v-dis.c
index 9358b75..9cdad69 100644
--- a/opcodes/d30v-dis.c
+++ b/opcodes/d30v-dis.c
@@ -1,5 +1,5 @@
 /* Disassemble D30V instructions.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 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
@@ -305,38 +305,41 @@
 		(info->stream, _("<unknown register %d>"), val & 0x3F);	      
 	    }
 	}
-      else if (insn->op->reloc_flag == RELOC_PCREL || 
-	       (opind == 1 && (insn->form->form == SHORT_D2 || insn->form->form == LONG_D)))
+      /* repeati has a relocation, but its first argument is a plain
+	 immediate.  OTOH instructions like djsri have a pc-relative
+	 delay target, but a absolute jump target.  Therefore, a test
+	 of insn->op->reloc_flag is not specific enough; we must test
+	 if the actual operand we are handling now is pc-relative.  */
+      else if (oper->flags & OPERAND_PCREL)
 	{
-	  long max;
-	  int neg=0;
-	  max = (1 << (bits - 1));
-	  if (val & max)
+	  int neg = 0;
+	  
+	  /* IMM6S3 is unsigned.  */
+	  if (oper->flags & OPERAND_SIGNED || bits == 32)
 	    {
-	      if (bits == 32)
-		val = -val;
-	      else
-		val = -val & ((1 << bits)-1);
-	      neg = 1;
+	      long max;
+	      max = (1 << (bits - 1));
+	      if (val & max)
+		{
+		  if (bits == 32)
+		    val = -val;
+		  else
+		    val = -val & ((1 << bits)-1);
+		  neg = 1;
+		}
 	    }
-	  if (opind == 1 && (insn->form->form == SHORT_D2 || insn->form->form == LONG_D))
+	  if (neg)
 	    {
-	      (*info->fprintf_func) (info->stream, "%x",val);
+	      (*info->fprintf_func) (info->stream, "-%x\t(",val);
+	      (*info->print_address_func) ((memaddr - val) & PC_MASK, info);
+	      (*info->fprintf_func) (info->stream, ")");
 	    }
-	  else {
-	    if (neg)
-	      {
-		(*info->fprintf_func) (info->stream, "-%x\t(",val);
-		(*info->print_address_func) ((memaddr - val) & PC_MASK, info);
-		(*info->fprintf_func) (info->stream, ")");
-	      }
-	    else
-	      {
-		(*info->fprintf_func) (info->stream, "%x\t(",val);
-		(*info->print_address_func) ((memaddr + val) & PC_MASK, info);
-		(*info->fprintf_func) (info->stream, ")");
-	      }
-	  }
+	  else
+	    {
+	      (*info->fprintf_func) (info->stream, "%x\t(",val);
+	      (*info->print_address_func) ((memaddr + val) & PC_MASK, info);
+	      (*info->fprintf_func) (info->stream, ")");
+	    }
 	}
       else if (insn->op->reloc_flag == RELOC_ABS)
 	{
diff --git a/opcodes/d30v-opc.c b/opcodes/d30v-opc.c
index 2265e7c..2a33f44 100644
--- a/opcodes/d30v-opc.c
+++ b/opcodes/d30v-opc.c
@@ -1,5 +1,5 @@
 /* d30v-opc.c -- D30V opcode list
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
    Written by Martin Hunt, Cygnus Support
 
 This file is part of GDB, GAS, and the GNU binutils.
@@ -22,7 +22,6 @@
 #include "ansidecl.h"
 #include "opcode/d30v.h"
 
-
 /* This table is sorted. */
 /* If you add anything, it MUST be in alphabetical order */
 /* The first field is the name the assembler uses when looking */
@@ -223,20 +222,20 @@
   { "avg2h", IALU1, 0xb, { SHORT_A, LONG}, EITHER, 0, 0, 0 },
   { "bclr", LOGIC, 0x3, { SHORT_A }, EITHER_BUT_PREFER_MU, 0, 0, 0 },
   { "bnot", LOGIC, 0x1, { SHORT_A }, EITHER_BUT_PREFER_MU, 0, 0, 0 },
-  { "bra", BRA, 0, { SHORT_B1, SHORT_B2, LONG_U }, MU, FLAG_JMP, 0, RELOC_PCREL },
-  { "bratnz", BRA, 0x4, { SHORT_B3b, LONG_2b }, MU, FLAG_JMP, 0, RELOC_PCREL },
-  { "bratzr", BRA, 0x4, { SHORT_B3, LONG_2 }, MU, FLAG_JMP, 0, RELOC_PCREL },
+  { "bra", BRA, 0, { SHORT_B1, SHORT_B2r, LONG_Ur }, MU, FLAG_JMP, 0, RELOC_PCREL },
+  { "bratnz", BRA, 0x4, { SHORT_B3br, LONG_2br }, MU, FLAG_JMP, 0, RELOC_PCREL },
+  { "bratzr", BRA, 0x4, { SHORT_B3r, LONG_2r }, MU, FLAG_JMP, 0, RELOC_PCREL },
   { "bset", LOGIC, 0x2, { SHORT_A }, EITHER_BUT_PREFER_MU, 0, 0, 0 },
-  { "bsr", BRA, 0x2, { SHORT_B1, SHORT_B2, LONG_U }, MU, FLAG_JSR, 0, RELOC_PCREL },
-  { "bsrtnz", BRA, 0x6, { SHORT_B3b, LONG_2b }, MU, FLAG_JSR, 0, RELOC_PCREL },
-  { "bsrtzr", BRA, 0x6, { SHORT_B3, LONG_2 }, MU, FLAG_JSR, 0, RELOC_PCREL },
+  { "bsr", BRA, 0x2, { SHORT_B1, SHORT_B2r, LONG_Ur }, MU, FLAG_JSR, 0, RELOC_PCREL },
+  { "bsrtnz", BRA, 0x6, { SHORT_B3br, LONG_2br }, MU, FLAG_JSR, 0, RELOC_PCREL },
+  { "bsrtzr", BRA, 0x6, { SHORT_B3r, LONG_2r }, MU, FLAG_JSR, 0, RELOC_PCREL },
   { "btst", LOGIC, 0, { SHORT_AF }, EITHER_BUT_PREFER_MU, 0, 0, 0 },
   { "cmp", LOGIC, 0xC, { SHORT_CMP, LONG_CMP }, EITHER, 0, 0, 0 },
   { "cmpu", LOGIC, 0xD, { SHORT_CMPU, LONG_CMP }, EITHER, 0, 0, 0 },
-  { "dbra", BRA, 0x10, { SHORT_B3, LONG_2 }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
-  { "dbrai", BRA, 0x14, { SHORT_D2, LONG_D }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
-  { "dbsr", BRA, 0x12, { SHORT_B3, LONG_2 }, MU, FLAG_JSR | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
-  { "dbsri", BRA, 0x16, { SHORT_D2, LONG_D }, MU, FLAG_JSR | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
+  { "dbra", BRA, 0x10, { SHORT_B3r, LONG_2r }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
+  { "dbrai", BRA, 0x14, { SHORT_D2r, LONG_Dr }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
+  { "dbsr", BRA, 0x12, { SHORT_B3r, LONG_2r }, MU, FLAG_JSR | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
+  { "dbsri", BRA, 0x16, { SHORT_D2r, LONG_Dr }, MU, FLAG_JSR | FLAG_DELAY, FLAG_RP, RELOC_PCREL },
   { "dbt", BRA, 0xb, { SHORT_NONE }, MU, FLAG_JSR, FLAG_LKR, 0 },
   { "djmp", BRA, 0x11, { SHORT_B3, LONG_2 }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_ABS },
   { "djmpi", BRA, 0x15, { SHORT_D2, LONG_D }, MU, FLAG_JMP | FLAG_DELAY, FLAG_RP, RELOC_ABS },
@@ -253,8 +252,8 @@
   { "jsrtnz", BRA, 0x7, { SHORT_B3b, LONG_2b }, MU, FLAG_JSR, 0, RELOC_ABS },
   { "jsrtzr", BRA, 0x7, { SHORT_B3, LONG_2 }, MU, FLAG_JSR, 0, RELOC_ABS },
   { "ld2h", IMEM, 0x3, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM, 0, 0 },
-  { "ld2w", IMEM, 0x6, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM | FLAG_2WORD, 0, 0 },
-  { "ld4bh", IMEM, 0x5, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM | FLAG_2WORD, 0, 0 },
+  { "ld2w", IMEM, 0x6, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0, 0 },
+  { "ld4bh", IMEM, 0x5, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0, 0 },
   { "ld4bhu", IMEM, 0xd, { SHORT_M2, LONG_M2 }, MU, FLAG_MEM, 0, 0 },
   { "ldb", IMEM, 0, { SHORT_M, LONG_M }, MU, FLAG_MEM, 0, 0 },
   { "ldbu", IMEM, 0x9, { SHORT_M, LONG_M }, MU, FLAG_MEM, 0, 0 },
@@ -283,7 +282,7 @@
   { "mulxs", IALU2, 0x19, { SHORT_AA }, IU, FLAG_MUL32, 0, 0 },
   { "mvfacc", IALU2, 0x1f, { SHORT_RA }, IU, 0, 0, 0 },
   { "mvfsys", BRA, 0x1e, { SHORT_C1 }, MU, FLAG_ALL, FLAG_ALL, 0 },
-  { "mvtacc", IALU2, 0xf, { SHORT_AA }, IU, 0, 0, 0 },
+  { "mvtacc", IALU2, 0xf, { SHORT_AR }, IU, 0, 0, 0 },
   { "mvtsys", BRA, 0xe, { SHORT_C2 }, MU, FLAG_ALL, FLAG_ALL, 0 },
   { "nop", BRA, 0xF, { SHORT_NONE }, EITHER, 0, 0, 0 },
   { "not", LOGIC, 0x19, { SHORT_U }, EITHER, 0, 0, 0 },
@@ -291,8 +290,8 @@
   { "or", LOGIC, 0x1a, { SHORT_A, LONG }, EITHER, 0, 0, 0 },
   { "orfg", LOGIC, 0xa, { SHORT_F }, EITHER, 0, 0, 0 },
   { "reit", BRA, 0x8, { SHORT_NONE }, MU, FLAG_SM | FLAG_JMP, FLAG_SM | FLAG_LKR, 0 },
-  { "repeat", BRA, 0x18, { SHORT_D1, LONG_2 }, MU, FLAG_RP, FLAG_RP, RELOC_PCREL },
-  { "repeati", BRA, 0x1a, { SHORT_D2B, LONG_Db }, MU, FLAG_RP, FLAG_RP, RELOC_PCREL },
+  { "repeat", BRA, 0x18, { SHORT_D1r, LONG_2r }, MU, FLAG_RP, FLAG_RP, RELOC_PCREL },
+  { "repeati", BRA, 0x1a, { SHORT_D2Br, LONG_Dbr }, MU, FLAG_RP, FLAG_RP, RELOC_PCREL },
   { "rot", LOGIC, 0x14, { SHORT_A }, EITHER, 0, 0, 0 },
   { "rot2h", LOGIC, 0x15, { SHORT_A }, EITHER, 0, 0, 0 },
   { "rtd", BRA, 0xa, { SHORT_NONE }, MU, FLAG_JMP, FLAG_LKR, 0 },
@@ -311,13 +310,13 @@
   { "srl2h", LOGIC, 0x13, { SHORT_A }, EITHER, 0, 0, 0 },
   { "srlhh", LOGIC, 0x7, { SHORT_A }, EITHER, 0, 0, 0 },
   { "srlhl", LOGIC, 0x6, { SHORT_A }, EITHER, 0, 0, 0 },
-  { "st2h", IMEM, 0x13, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM, 0 },
-  { "st2w", IMEM, 0x16, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM | FLAG_2WORD, 0 },
-  { "st4hb", IMEM, 0x15, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM | FLAG_2WORD, 0 },
-  { "stb", IMEM, 0x10, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM, 0 },
-  { "sth", IMEM, 0x12, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM, 0 },
-  { "sthh", IMEM, 0x11, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM, 0 },
-  { "stw", IMEM, 0x14, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM, 0 },
+  { "st2h", IMEM, 0x13, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "st2w", IMEM, 0x16, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "st4hb", IMEM, 0x15, { SHORT_M2, LONG_M2 }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "stb", IMEM, 0x10, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "sth", IMEM, 0x12, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "sthh", IMEM, 0x11, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
+  { "stw", IMEM, 0x14, { SHORT_M, LONG_M }, MU, 0, FLAG_MEM | FLAG_NOT_WITH_ADDSUBppp, 0 },
   { "sub", IALU1, 0x2, { SHORT_A, LONG}, EITHER, 0, FLAG_CVVA, 0 },
   { "sub2h", IALU1, 0x3, { SHORT_A, LONG}, EITHER, 0, 0, 0 },
   { "subb", IALU1, 0x5, { SHORT_A, LONG}, EITHER, FLAG_C, FLAG_CVVA, 0 },
@@ -358,25 +357,29 @@
   { 6, 1, 6, OPERAND_ACC|OPERAND_REG },
 #define IMM5	(Ab + 1)
   { 6, 5, 12, OPERAND_NUM },
-#define IMM5U	(IMM5 + 1)
-  { 6, 5, 12, OPERAND_NUM|OPERAND_SIGNED },
-#define IMM5S3	(IMM5U + 1)
-  { 6, 5, 12, OPERAND_NUM|OPERAND_SIGNED },
-#define IMM6	(IMM5S3 + 1)
+#define IMM5U (IMM5 + 1)
+  { 6, 5, 12, OPERAND_NUM|OPERAND_SIGNED }, /* not used */
+#define IMM5S3        (IMM5U + 1)
+  { 6, 5, 12, OPERAND_NUM|OPERAND_SIGNED }, /* not used */
+#define IMM6  (IMM5S3 + 1)
   { 6, 6, 12, OPERAND_NUM|OPERAND_SIGNED },
-#define IMM6U	(IMM6 + 1)
+#define IMM6U (IMM6 + 1)
   { 6, 6, 0, OPERAND_NUM },
-#define IMM6U2	(IMM6U + 1)
+#define IMM6U2        (IMM6U + 1)
   { 6, 6, 12, OPERAND_NUM },
-#define IMM6S3	(IMM6U2 + 1)
-  { 6, 6, 0, OPERAND_NUM|OPERAND_SHIFT },
-#define IMM12S3	(IMM6S3 + 1)
+#define REL6S3        (IMM6U2 + 1)
+  { 6, 6, 0, OPERAND_NUM|OPERAND_SHIFT|OPERAND_PCREL },
+#define REL12S3       (REL6S3 + 1)
+  { 12, 12, 12, OPERAND_NUM|OPERAND_SIGNED|OPERAND_SHIFT|OPERAND_PCREL },
+#define IMM12S3       (REL12S3 + 1)
   { 12, 12, 12, OPERAND_NUM|OPERAND_SIGNED|OPERAND_SHIFT },
-#define IMM12S3U (IMM12S3 + 1)
-  { 12, 12, 12, OPERAND_NUM|OPERAND_SHIFT },
-#define IMM18S3	(IMM12S3U + 1)
+#define REL18S3       (IMM12S3 + 1)
+  { 18, 18, 12, OPERAND_NUM|OPERAND_SIGNED|OPERAND_SHIFT|OPERAND_PCREL },
+#define IMM18S3       (REL18S3 + 1)
   { 18, 18, 12, OPERAND_NUM|OPERAND_SIGNED|OPERAND_SHIFT },
-#define IMM32	(IMM18S3 + 1)
+#define REL32 (IMM18S3 + 1)
+  { 32, 32, 0, OPERAND_NUM|OPERAND_PCREL },
+#define IMM32 (REL32 + 1)
   { 32, 32, 0, OPERAND_NUM },
 #define Fa	(IMM32 + 1)
   { 6, 3, 0, OPERAND_REG | OPERAND_FLAG | OPERAND_DEST },
@@ -415,25 +418,31 @@
   { SHORT_M, 2, { Ra, ATPAR, Rb, IMM6 } },	/* Ra,@(Rb,imm6) */
   { SHORT_M, 3, { Ra, ATPAR, Rb, MINUS, Rc } },	/* Ra,@(Rb-,Rc) */
   { SHORT_M2, 0, { Ra2, ATPAR, Rb, Rc } },	/* Ra,@(Rb,Rc) */
-  { SHORT_M2, 1, { Ra2, ATPAR, Rb, PLUS, Rc } },	/* Ra,@(Rb+,Rc) */
+  { SHORT_M2, 1, { Ra2, ATPAR, Rb, PLUS, Rc } },/* Ra,@(Rb+,Rc) */
   { SHORT_M2, 2, { Ra2, ATPAR, Rb, IMM6 } },	/* Ra,@(Rb,imm6) */
-  { SHORT_M2, 3, { Ra2, ATPAR, Rb, MINUS, Rc } },	/* Ra,@(Rb-,Rc) */
+  { SHORT_M2, 3, { Ra2, ATPAR, Rb, MINUS, Rc } },/* Ra,@(Rb-,Rc) */
   { SHORT_A, 0, { Ra, Rb, Rc } },		/* Ra,Rb,Rc */
   { SHORT_A, 2, { Ra, Rb, IMM6 } },		/* Ra,Rb,imm6 */
   { SHORT_B1, 0, { Rc } },			/* Rc */
   { SHORT_B2, 2, { IMM18S3 } },			/* imm18 */
+  { SHORT_B2r, 2, { REL18S3 } },		/* rel18 */
   { SHORT_B3, 0, { Ra3, Rc } },			/* Ra,Rc */
   { SHORT_B3, 2, { Ra3, IMM12S3 } },		/* Ra,imm12 */
+  { SHORT_B3r, 0, { Ra3, Rc } },		/* Ra,Rc */
+  { SHORT_B3r, 2, { Ra3, REL12S3 } },		/* Ra,rel12 */
   { SHORT_B3b, 1, { Ra3, Rc } },		/* Ra,Rc */
   { SHORT_B3b, 3, { Ra3, IMM12S3 } },		/* Ra,imm12 */
-  { SHORT_D1, 0, { Ra, Rc } },			/* Ra,Rc */
-  { SHORT_D1, 2, { Ra, IMM12S3 } },		/* Ra,imm12s3 */
-  { SHORT_D2, 0, { IMM6S3, Rc } },		/* imm6s3,Rc */
-  { SHORT_D2, 2, { IMM6S3, IMM12S3 } },		/* imm6s3,imm12s3 */
-  { SHORT_D2B, 0, { IMM6U, Rc } },		/* imm6u,Rc */
-  { SHORT_D2B, 2, { IMM6U, IMM12S3U } },	/* imm6u,imm12s3u */
+  { SHORT_B3br, 1, { Ra3, Rc } },		/* Ra,Rc */
+  { SHORT_B3br, 3, { Ra3, REL12S3 } },		/* Ra,rel12 */
+  { SHORT_D1r, 0, { Ra, Rc } },			/* Ra,Rc */
+  { SHORT_D1r, 2, { Ra, REL12S3 } },		/* Ra,rel12s3 */
+  { SHORT_D2, 0, { REL6S3, Rc } },		/* rel6s3,Rc */
+  { SHORT_D2, 2, { REL6S3, IMM12S3 } },		/* rel6s3,imm12s3 */
+  { SHORT_D2r, 0, { REL6S3, Rc } },		/* rel6s3,Rc */
+  { SHORT_D2r, 2, { REL6S3, REL12S3 } },	/* rel6s3,rel12s3 */
+  { SHORT_D2Br, 0, { IMM6U, Rc } },		/* imm6u,Rc */
+  { SHORT_D2Br, 2, { IMM6U, REL12S3 } },	/* imm6u,rel12s3 */
   { SHORT_U, 0, { Ra, Rb } },			/* Ra,Rb */
-  { SHORT_U, 2, { Ra, IMM12S3 } },		/* Ra,imm12 (repeat) */
   { SHORT_F, 0, { Fa, Fb, Fc } },		/* Fa,Fb,Fc  (orfg, xorfg) */
   { SHORT_F, 2, { Fa, Fb, IMM6 } },		/* Fa,Fb,imm6 */
   { SHORT_AF, 0, { Fa, Rb, Rc } },		/* Fa,Rb,Rc */
@@ -458,19 +467,21 @@
   { SHORT_UF, 0, { Fa, Fb } },			/* Fa,Fb  (notfg) */
   { SHORT_A2, 0, { Ra2, Rb, Rc } },		/* Ra2,Rb,Rc */
   { SHORT_A2, 2, { Ra2, Rb, IMM6 } },		/* Ra2,Rb,imm6 */
-  { SHORT_A5S, 0, { Ra, Rb, Rc } },		/* Ra,Rb,Rc */
-  { SHORT_A5S, 2, { Ra, Rb, IMM5U } },		/* Ra,Rb,imm5u   (shifts) */
   { SHORT_NONE, 0, { 0 } },			/* no operands (nop, reit) */
+  { SHORT_AR, 0, { Aa, Rb, Rc } },		/* Aa,Rb,Rc */
   { LONG, 2, { Ra, Rb, IMM32 } },		/* Ra,Rb,imm32 */
   { LONG_U, 2, { IMM32 } },			/* imm32 */
-  { LONG_AF, 2, { Fa, Rb, IMM32 } },		/* Fa,Rb,imm32 */
+  { LONG_Ur, 2, { REL32 } },			/* rel32 */
   { LONG_CMP, 2, { CC, Fa2, Rb, IMM32} },	/* CC  Fa2,Rb,imm32 */
   { LONG_M, 2, { Ra, ATPAR, Rb, IMM32 } },	/* Ra,@(Rb,imm32) */
   { LONG_M2, 2, { Ra2, ATPAR, Rb, IMM32 } },	/* Ra,@(Rb,imm32) */
   { LONG_2, 2, { Ra3, IMM32 } },		/* Ra,imm32 */
+  { LONG_2r, 2, { Ra3, REL32 } },		/* Ra,rel32 */
   { LONG_2b, 3, { Ra3, IMM32 } },		/* Ra,imm32 */
-  { LONG_D, 2, { IMM6S3, IMM32 } },		/* imm6s3,imm32 */
-  { LONG_Db, 2, { IMM6U, IMM32 } },		/* imm6,imm32 */
+  { LONG_2br, 3, { Ra3, REL32 } },		/* Ra,rel32 */
+  { LONG_D, 2, { REL6S3, IMM32 } },		/* rel6s3,imm32 */
+  { LONG_Dr, 2, { REL6S3, REL32 } },		/* rel6s3,rel32 */
+  { LONG_Dbr, 2, { IMM6U, REL32 } },		/* imm6,rel32 */
   { 0, 0, { 0 } },
 };
 
diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c
index d76be2e..b828206 100644
--- a/opcodes/dis-buf.c
+++ b/opcodes/dis-buf.c
@@ -1,5 +1,5 @@
 /* Disassemble from a buffer, for GNU.
-   Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1998, 1999 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
@@ -26,14 +26,20 @@
 buffer_read_memory (memaddr, myaddr, length, info)
      bfd_vma memaddr;
      bfd_byte *myaddr;
-     int length;
+     unsigned int length;
      struct disassemble_info *info;
 {
+  unsigned int opb = info->octets_per_byte;
+  unsigned int end_addr_offset = length / opb;
+  unsigned int max_addr_offset = info->buffer_length / opb; 
+  unsigned int octets = (memaddr - info->buffer_vma) * opb;
+
   if (memaddr < info->buffer_vma
-      || memaddr + length > info->buffer_vma + info->buffer_length)
+      || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
     /* Out of bounds.  Use EIO because GDB uses it.  */
     return EIO;
-  memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
+  memcpy (myaddr, info->buffer + octets, length);
+
   return 0;
 }
 
@@ -67,7 +73,10 @@
      bfd_vma addr;
      struct disassemble_info *info;
 {
-  (*info->fprintf_func) (info->stream, "0x%x", addr);
+  char buf[30];
+
+  sprintf_vma (buf, addr);
+  (*info->fprintf_func) (info->stream, "0x%s", buf);
 }
 
 /* Just concatenate the address as hex.  This is included for
@@ -85,7 +94,7 @@
       char tmpBuf[30];
 
       sprintf_vma (tmpBuf, addr);
-      if ((strlen (buf) + strlen (tmpBuf)) <= len)
+      if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
 	strcat (buf, tmpBuf);
       else
 	strncat (buf, tmpBuf, (len - strlen(buf)));
@@ -97,8 +106,8 @@
 
 int
 generic_symbol_at_address (addr, info)
-     bfd_vma addr;
-     struct disassemble_info * info;
+     bfd_vma addr ATTRIBUTE_UNUSED;
+     struct disassemble_info *info ATTRIBUTE_UNUSED;
 {
   return 1;
 }
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 4898b42..3d7de90 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -1,5 +1,6 @@
 /* Select disassembly routine for specified architecture.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 99, 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,11 +24,13 @@
 #define ARCH_alpha
 #define ARCH_arc
 #define ARCH_arm
+#define ARCH_avr
 #define ARCH_d10v
 #define ARCH_d30v
 #define ARCH_h8300
 #define ARCH_h8500
 #define ARCH_hppa
+#define ARCH_i370
 #define ARCH_i386
 #define ARCH_i960
 #define ARCH_fr30
@@ -39,6 +42,7 @@
 #define ARCH_mn10200
 #define ARCH_mn10300
 #define ARCH_ns32k
+#define ARCH_pj
 #define ARCH_powerpc
 #define ARCH_rs6000
 #define ARCH_sh
@@ -90,6 +94,11 @@
 	disassemble = print_insn_little_arm;
       break;
 #endif
+#ifdef ARCH_avr
+    case bfd_arch_avr:
+      disassemble = print_insn_avr;
+      break;
+#endif
 #ifdef ARCH_d10v
     case bfd_arch_d10v:
       disassemble = print_insn_d10v;
@@ -120,6 +129,11 @@
       disassemble = print_insn_hppa;
       break;
 #endif
+#ifdef ARCH_i370
+    case bfd_arch_i370:
+      disassemble = print_insn_i370;
+      break;
+#endif
 #ifdef ARCH_i386
     case bfd_arch_i386:
       if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax)
@@ -181,6 +195,11 @@
       disassemble = print_insn_mn10300;
       break;
 #endif
+#ifdef ARCH_pj
+    case bfd_arch_pj:
+      disassemble = print_insn_pj;
+      break;
+#endif
 #ifdef ARCH_powerpc
     case bfd_arch_powerpc:
       if (bfd_big_endian (abfd))
@@ -246,3 +265,13 @@
   return disassemble;
 }
 
+void
+disassembler_usage (stream)
+     FILE *stream ATTRIBUTE_UNUSED;
+{
+#ifdef ARCH_arm
+  print_arm_disassembler_options (stream);
+#endif
+  
+  return;
+}
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 5f5ccdc..6038dbb 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -177,7 +177,9 @@
      const char ** strp;
      CGEN_FIELDS * fields;
 {
-  const char * errmsg;
+  const char * errmsg = NULL;
+  /* Used by scalar operands that still need to be parsed.  */
+  long junk;
 
   switch (opindex)
     {
@@ -188,13 +190,13 @@
       errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_cr_names, & fields->f_CRj);
       break;
     case FR30_OPERAND_R13 :
-      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r13, & fields->f_nil);
+      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r13, & junk);
       break;
     case FR30_OPERAND_R14 :
-      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r14, & fields->f_nil);
+      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r14, & junk);
       break;
     case FR30_OPERAND_R15 :
-      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r15, & fields->f_nil);
+      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_r15, & junk);
       break;
     case FR30_OPERAND_RI :
       errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_gr_names, & fields->f_Ri);
@@ -265,7 +267,7 @@
       errmsg = cgen_parse_signed_integer (cd, strp, FR30_OPERAND_M4, &fields->f_m4);
       break;
     case FR30_OPERAND_PS :
-      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_ps, & fields->f_nil);
+      errmsg = cgen_parse_keyword (cd, strp, & fr30_cgen_opval_h_ps, & junk);
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       errmsg = parse_hi_register_list_ld (cd, strp, FR30_OPERAND_REGLIST_HI_LD, &fields->f_reglist_hi_ld);
@@ -362,10 +364,15 @@
   p = CGEN_INSN_MNEMONIC (insn);
   while (*p && tolower (*p) == tolower (*str))
     ++p, ++str;
-  
-  if (* p || (* str && !isspace (* 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
@@ -387,6 +394,10 @@
       /* 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 (*str == CGEN_SYNTAX_CHAR (* syn))
 	    {
 #ifdef CGEN_MNEMONIC_OPERANDS
diff --git a/opcodes/fr30-desc.h b/opcodes/fr30-desc.h
index 0289156..97e29cd 100644
--- a/opcodes/fr30-desc.h
+++ b/opcodes/fr30-desc.h
@@ -35,6 +35,9 @@
 
 #define CGEN_INSN_LSB0_P 0
 
+/* Minimum size of any insn (in bytes).  */
+#define CGEN_MIN_INSN_SIZE 2
+
 /* Maximum size of any insn (in bytes).  */
 #define CGEN_MAX_INSN_SIZE 6
 
@@ -46,6 +49,7 @@
    e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
    we can't hash on everything up to the space.  */
 #define CGEN_MNEMONIC_OPERANDS
+
 /* Maximum number of operands any insn or macro-insn has.  */
 #define CGEN_MAX_INSN_OPERANDS 16
 
diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c
index 0d7c18c..c42915b 100644
--- a/opcodes/fr30-dis.c
+++ b/opcodes/fr30-dis.c
@@ -193,13 +193,13 @@
       print_keyword (cd, info, & fr30_cgen_opval_cr_names, fields->f_CRj, 0);
       break;
     case FR30_OPERAND_R13 :
-      print_keyword (cd, info, & fr30_cgen_opval_h_r13, fields->f_nil, 0);
+      print_keyword (cd, info, & fr30_cgen_opval_h_r13, 0, 0);
       break;
     case FR30_OPERAND_R14 :
-      print_keyword (cd, info, & fr30_cgen_opval_h_r14, fields->f_nil, 0);
+      print_keyword (cd, info, & fr30_cgen_opval_h_r14, 0, 0);
       break;
     case FR30_OPERAND_R15 :
-      print_keyword (cd, info, & fr30_cgen_opval_h_r15, fields->f_nil, 0);
+      print_keyword (cd, info, & fr30_cgen_opval_h_r15, 0, 0);
       break;
     case FR30_OPERAND_RI :
       print_keyword (cd, info, & fr30_cgen_opval_gr_names, fields->f_Ri, 0);
@@ -262,7 +262,7 @@
       print_m4 (cd, info, fields->f_m4, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length);
       break;
     case FR30_OPERAND_PS :
-      print_keyword (cd, info, & fr30_cgen_opval_h_ps, fields->f_nil, 0);
+      print_keyword (cd, info, & fr30_cgen_opval_h_ps, 0, 0);
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       print_hi_register_list_ld (cd, info, fields->f_reglist_hi_ld, 0, pc, length);
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index 386613d..2aa4458 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -579,7 +579,7 @@
      CGEN_INSN_BYTES_PTR buffer;
      bfd_vma pc;
 {
-  const char * errmsg;
+  const char * errmsg = NULL;
   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
 
   switch (opindex)
@@ -591,13 +591,10 @@
       errmsg = insert_normal (cd, fields->f_CRj, 0, 16, 8, 4, 16, total_length, buffer);
       break;
     case FR30_OPERAND_R13 :
-      errmsg = insert_normal (cd, fields->f_nil, 0, 0, 0, 0, 0, total_length, buffer);
       break;
     case FR30_OPERAND_R14 :
-      errmsg = insert_normal (cd, fields->f_nil, 0, 0, 0, 0, 0, total_length, buffer);
       break;
     case FR30_OPERAND_R15 :
-      errmsg = insert_normal (cd, fields->f_nil, 0, 0, 0, 0, 0, total_length, buffer);
       break;
     case FR30_OPERAND_RI :
       errmsg = insert_normal (cd, fields->f_Ri, 0, 0, 12, 4, 16, total_length, buffer);
@@ -699,7 +696,6 @@
       }
       break;
     case FR30_OPERAND_PS :
-      errmsg = insert_normal (cd, fields->f_nil, 0, 0, 0, 0, 0, total_length, buffer);
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       errmsg = insert_normal (cd, fields->f_reglist_hi_ld, 0, 0, 8, 8, 16, total_length, buffer);
@@ -755,6 +751,8 @@
 }
 
 /* Main entry point for operand extraction.
+   The result is <= 0 for error, >0 for success.
+   ??? Actual values aren't well defined right now.
 
    This function is basically just a big switch statement.  Earlier versions
    used tables to look up the function to use, but
@@ -777,7 +775,8 @@
      CGEN_FIELDS * fields;
      bfd_vma pc;
 {
-  int length;
+  /* Assume success (for those operands that are nops).  */
+  int length = 1;
   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
 
   switch (opindex)
@@ -789,13 +788,10 @@
       length = extract_normal (cd, ex_info, insn_value, 0, 16, 8, 4, 16, total_length, pc, & fields->f_CRj);
       break;
     case FR30_OPERAND_R13 :
-      length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 0, total_length, pc, & fields->f_nil);
       break;
     case FR30_OPERAND_R14 :
-      length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 0, total_length, pc, & fields->f_nil);
       break;
     case FR30_OPERAND_R15 :
-      length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 0, total_length, pc, & fields->f_nil);
       break;
     case FR30_OPERAND_RI :
       length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 16, total_length, pc, & fields->f_Ri);
@@ -899,7 +895,6 @@
       }
       break;
     case FR30_OPERAND_PS :
-      length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 0, total_length, pc, & fields->f_nil);
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & fields->f_reglist_hi_ld);
@@ -989,13 +984,13 @@
       value = fields->f_CRj;
       break;
     case FR30_OPERAND_R13 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_R14 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_R15 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_RI :
       value = fields->f_Ri;
@@ -1058,7 +1053,7 @@
       value = fields->f_m4;
       break;
     case FR30_OPERAND_PS :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       value = fields->f_reglist_hi_ld;
@@ -1118,13 +1113,13 @@
       value = fields->f_CRj;
       break;
     case FR30_OPERAND_R13 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_R14 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_R15 :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_RI :
       value = fields->f_Ri;
@@ -1187,7 +1182,7 @@
       value = fields->f_m4;
       break;
     case FR30_OPERAND_PS :
-      value = fields->f_nil;
+      value = 0;
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       value = fields->f_reglist_hi_ld;
@@ -1251,13 +1246,10 @@
       fields->f_CRj = value;
       break;
     case FR30_OPERAND_R13 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_R14 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_R15 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_RI :
       fields->f_Ri = value;
@@ -1320,7 +1312,6 @@
       fields->f_m4 = value;
       break;
     case FR30_OPERAND_PS :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       fields->f_reglist_hi_ld = value;
@@ -1377,13 +1368,10 @@
       fields->f_CRj = value;
       break;
     case FR30_OPERAND_R13 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_R14 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_R15 :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_RI :
       fields->f_Ri = value;
@@ -1446,7 +1434,6 @@
       fields->f_m4 = value;
       break;
     case FR30_OPERAND_PS :
-      fields->f_nil = value;
       break;
     case FR30_OPERAND_REGLIST_HI_LD :
       fields->f_reglist_hi_ld = value;
diff --git a/opcodes/fr30-opc.c b/opcodes/fr30-opc.c
index 302100d..5ea7e0a 100644
--- a/opcodes/fr30-opc.c
+++ b/opcodes/fr30-opc.c
@@ -1182,11 +1182,11 @@
 };
 
 static const CGEN_IFMT ifmt_ldi20m = {
-  16, 32, 0xff00, { F (F_OP1), F (F_I20), F (F_OP2), F (F_RI), 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_I32), F (F_OP2), F (F_OP3), F (F_RI), 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/hppa-dis.c b/opcodes/hppa-dis.c
index dc45d5e..fa34fdc 100644
--- a/opcodes/hppa-dis.c
+++ b/opcodes/hppa-dis.c
@@ -46,6 +46,7 @@
 /* Get at various relevent fields of an instruction word. */
 
 #define MASK_5 0x1f
+#define MASK_10 0x3ff
 #define MASK_11 0x7ff
 #define MASK_14 0x3fff
 #define MASK_21 0x1fffff
@@ -58,7 +59,7 @@
 /* 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.  */
-static const char control_reg[][6] = {
+static const char *const control_reg[] = {
   "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
   "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
   "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
@@ -66,39 +67,70 @@
   "tr4", "tr5", "tr6", "tr7"
 };
 
-static const char compare_cond_names[][5] = {
-  "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv",
-  ",od", ",tr", ",<>", ",>=", ",>", ",>>=",
-  ",>>", ",nsv", ",ev"
+static const char *const compare_cond_names[] = {
+  "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
+  ",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
 };
-static const char add_cond_names[][5] = {
-  "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv",
-  ",od", ",tr", ",<>", ",>=", ",>", ",uv",
-  ",vnz", ",nsv", ",ev"
+static const char *const compare_cond_64_names[] = {
+  "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
+  ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
+};
+static const char *const cmpib_cond_64_names[] = {
+  ",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
+};
+static const char *const add_cond_names[] = {
+  "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
+  ",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
+};
+static const char *const add_cond_64_names[] = {
+  "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
+  ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
+};
+static const char *const wide_add_cond_names[] = {
+  "", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
+  ",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
 };
 static const char *const logical_cond_names[] = {
   "", ",=", ",<", ",<=", 0, 0, 0, ",od",
   ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
+static const char *const logical_cond_64_names[] = {
+  "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
+  ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
 static const char *const unit_cond_names[] = {
-  "", 0, ",sbz", ",shz", ",sdc", 0, ",sbc", ",shc",
-  ",tr", 0, ",nbz", ",nhz", ",ndc", 0, ",nbc", ",nhc"
+  "", ",swz", ",sbz", ",shz", ",sdc", ",swc", ",sbc", ",shc",
+  ",tr", ",nwz", ",nbz", ",nhz", ",ndc", ",nwc", ",nbc", ",nhc"
 };
-static const char shift_cond_names[][4] = {
+static const char *const unit_cond_64_names[] = {
+  "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
+  ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
+};
+static const char *const shift_cond_names[] = {
   "", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
 };
-static const char index_compl_names[][4] = {"", ",m", ",s", ",sm"};
-static const char short_ldst_compl_names[][4] = {"", ",ma", "", ",mb"};
+static const char *const shift_cond_64_names[] = {
+  "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
+};
+static const char *const bb_cond_64_names[] = {
+  ",*<", ",*>="
+};
+static const char *const index_compl_names[] = {"", ",m", ",s", ",sm"};
+static const char *const short_ldst_compl_names[] = {"", ",ma", "", ",mb"};
 static const char *const short_bytes_compl_names[] = {
   "", ",b,m", ",e", ",e,m"
 };
 static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
-static const char float_comp_names[][8] =
+static const char *const float_comp_names[] =
 {
   ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
   ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
   ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
   ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
 };
+static const char *const signed_unsigned_names[] = {",u", ",s"};
+static const char *const mix_half_names[] = {",l", ",r"};
+static const char *const saturation_names[] = {",us", ",ss", 0, ""};
+static const char *const read_write_names[] = {",r", ",w"};
+static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" };
 
 /* For a bunch of different instructions form an index into a 
    completer name table. */
@@ -205,6 +237,14 @@
   return (word >> 16 & MASK_5);
 }
 
+/* extract the 10 bit immediate field from a {sr}sm instruction */
+static unsigned
+extract_10U_store (word)
+     unsigned word;
+{
+  return (word >> 16 & MASK_10);
+}
+
 /* extract the immediate field from a bb instruction */
 static unsigned
 extract_5Q_store (word)
@@ -275,6 +315,17 @@
                       (word & 0x1) << 16, 17) << 2;
 }
 
+static int
+extract_22 (word)
+     unsigned word;
+{
+  return sign_extend (GET_FIELD (word, 19, 28) |
+                      GET_FIELD (word, 29, 29) << 10 |
+                      GET_FIELD (word, 11, 15) << 11 |
+                      GET_FIELD (word, 6, 10) << 16 |
+                      (word & 0x1) << 21, 22) << 2;
+}
+
 /* Print one instruction.  */
 int
 print_insn_hppa (memaddr, info)
@@ -305,7 +356,7 @@
 	  
 	  (*info->fprintf_func) (info->stream, "%s", opcode->name);
 
-	  if (!strchr ("cfCY<?!@-+&U>~nHNZFIMadu|", opcode->args[0]))
+	  if (!strchr ("cfCY?-+nHNZFIuv", opcode->args[0]))
 	    (*info->fprintf_func) (info->stream, " ");
 	  for (s = opcode->args; *s != '\0'; ++s)
 	    {
@@ -314,76 +365,125 @@
 		case 'x':
 		  fput_reg (GET_FIELD (insn, 11, 15), info);
 		  break;
-		case 'X':
-                  if (GET_FIELD (insn, 25, 25))
-		      fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
-		  else
-		      fput_fp_reg (GET_FIELD (insn, 11, 15), info);
-		  break;
+		case 'a':
 		case 'b':
 		  fput_reg (GET_FIELD (insn, 6, 10), info);
 		  break;
 		case '^':
 		  fput_creg (GET_FIELD (insn, 6, 10), info);
 		  break;
-		case 'E':
-                  if (GET_FIELD (insn, 25, 25))
-		      fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
-		  else
-		      fput_fp_reg (GET_FIELD (insn, 6, 10), info);
-		  break;
 		case 't':
 		  fput_reg (GET_FIELD (insn, 27, 31), info);
 		  break;
-		case 'v':
-                  if (GET_FIELD (insn, 25, 25))
-		      fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
-		  else
+
+		/* Handle floating point registers.  */
+		case 'f':
+		  switch (*++s)
+		    {
+		    case 't':
 		      fput_fp_reg (GET_FIELD (insn, 27, 31), info);
+		      break;
+		    case 'T':
+		      if (GET_FIELD (insn, 25, 25))
+			fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 27, 31), info);
+		      break;
+		    case 'a':
+		      if (GET_FIELD (insn, 25, 25))
+			fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 6, 10), info);
+		      break;
+
+		    /* 'fA' will not generate a space before the regsiter
+			name.  Normally that is fine.  Except that it
+			causes problems with xmpyu which has no FP format
+			completer.  */
+		    case 'X':
+		      fputs_filtered (" ", info);
+
+		    /* FALLTHRU */
+
+		    case 'A':
+		      if (GET_FIELD (insn, 24, 24))
+			fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 6, 10), info);
+		      
+		      break;
+		    case 'b':
+		      if (GET_FIELD (insn, 25, 25))
+			fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 11, 15), info);
+		      break;
+		    case 'B':
+		      if (GET_FIELD (insn, 19, 19))
+			fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 11, 15), info);
+		      break;
+		    case 'C':
+		      {
+			int reg = GET_FIELD (insn, 21, 22);
+			reg |= GET_FIELD (insn, 16, 18) << 2;
+			if (GET_FIELD (insn, 23, 23) != 0)
+			  fput_fp_reg_r (reg, info);
+			else
+			  fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'i':
+		      {
+			int reg = GET_FIELD (insn, 6, 10);
+
+			reg |= (GET_FIELD (insn, 26, 26) << 4);
+			fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'j':
+		      {
+			int reg = GET_FIELD (insn, 11, 15);
+
+			reg |= (GET_FIELD (insn, 26, 26) << 4);
+			fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'k':
+		      {
+			int reg = GET_FIELD (insn, 27, 31);
+
+			reg |= (GET_FIELD (insn, 26, 26) << 4);
+			fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'l':
+		      {
+			int reg = GET_FIELD (insn, 21, 25);
+
+			reg |= (GET_FIELD (insn, 26, 26) << 4);
+			fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'm':
+		      {
+			int reg = GET_FIELD (insn, 16, 20);
+
+			reg |= (GET_FIELD (insn, 26, 26) << 4);
+			fput_fp_reg (reg, info);
+			break;
+		      }
+		    case 'e':
+		      if (GET_FIELD (insn, 25, 25))
+			fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
+		      else
+			fput_fp_reg (GET_FIELD (insn, 11, 15), info);
+		      break;
+
+		    }
 		  break;
-		case 'y':
-		  fput_fp_reg (GET_FIELD (insn, 27, 31), info);
-		  break;
-		case '4':
-		  {
-		    int reg = GET_FIELD (insn, 6, 10);
 
-		    reg |= (GET_FIELD (insn, 26, 26) << 4);
-		    fput_fp_reg (reg, info);
-		    break;
-		  }
-		case '6':
-		  {
-		    int reg = GET_FIELD (insn, 11, 15);
-
-		    reg |= (GET_FIELD (insn, 26, 26) << 4);
-		    fput_fp_reg (reg, info);
-		    break;
-		  }
-		case '7':
-		  {
-		    int reg = GET_FIELD (insn, 27, 31);
-
-		    reg |= (GET_FIELD (insn, 26, 26) << 4);
-		    fput_fp_reg (reg, info);
-		    break;
-		  }
-		case '8':
-		  {
-		    int reg = GET_FIELD (insn, 16, 20);
-
-		    reg |= (GET_FIELD (insn, 26, 26) << 4);
-		    fput_fp_reg (reg, info);
-		    break;
-		  }
-		case '9':
-		  {
-		    int reg = GET_FIELD (insn, 21, 25);
-
-		    reg |= (GET_FIELD (insn, 26, 26) << 4);
-		    fput_fp_reg (reg, info);
-		    break;
-		  }
 		case '5':
 		  fput_const (extract_5_load (insn), info);
 		  break;
@@ -391,69 +491,326 @@
 		  (*info->fprintf_func) (info->stream,
 					 "sr%d", GET_FIELD (insn, 16, 17));
 		  break;
+
 		case 'S':
 		  (*info->fprintf_func) (info->stream, "sr%d", extract_3 (insn));
 		  break;
+
+		/* Handle completers.  */
 		case 'c':
-		  (*info->fprintf_func) (info->stream, "%s ",
-				    index_compl_names[GET_COMPL (insn)]);
+		  switch (*++s)
+		    {
+		    case 'x':
+		      (*info->fprintf_func) (info->stream, "%s ",
+					     index_compl_names[GET_COMPL (insn)]);
+		      break;
+		    case 'm':
+		      (*info->fprintf_func) (info->stream, "%s ",
+					     short_ldst_compl_names[GET_COMPL (insn)]);
+		      break;
+		    case 's':
+		      (*info->fprintf_func) (info->stream, "%s ",
+					     short_bytes_compl_names[GET_COMPL (insn)]);
+		      break;
+		    case 'c':
+		    case 'C':
+		      switch (GET_FIELD (insn, 20, 21))
+			{
+			case 1:
+			  (*info->fprintf_func) (info->stream, ",bc ");
+			  break;
+			case 2:
+			  (*info->fprintf_func) (info->stream, ",sl ");
+			  break;
+			default:
+			  (*info->fprintf_func) (info->stream, " ");
+			}
+		      break;
+		    case 'd':
+		      switch (GET_FIELD (insn, 20, 21))
+			{
+			case 1:
+			  (*info->fprintf_func) (info->stream, ",co ");
+			  break;
+			default:
+			  (*info->fprintf_func) (info->stream, " ");
+			}
+		      break;
+		    case 'o':
+		      (*info->fprintf_func) (info->stream, ",o");
+		      break;
+		    case 'g':
+		      (*info->fprintf_func) (info->stream, ",gate");
+		      break;
+		    case 'p':
+		      (*info->fprintf_func) (info->stream, ",l,push");
+		      break;
+		    case 'P':
+		      (*info->fprintf_func) (info->stream, ",pop");
+		      break;
+		    case 'l':
+		    case 'L':
+		      (*info->fprintf_func) (info->stream, ",l");
+		      break;
+		    case 'w':
+		      (*info->fprintf_func) (info->stream, "%s ",
+					     read_write_names[GET_FIELD (insn, 25, 25)]);
+		      break;
+		    case 'W':
+		      (*info->fprintf_func) (info->stream, ",w");
+		      break;
+		    case 'r':
+		      if (GET_FIELD (insn, 23, 26) == 5)
+			(*info->fprintf_func) (info->stream, ",r");
+		      break;
+		    case 'Z':
+		      if (GET_FIELD (insn, 26, 26))
+			(*info->fprintf_func) (info->stream, ",m ");
+		      else
+			(*info->fprintf_func) (info->stream, " ");
+		      break;
+		    case 'i':
+		      if (GET_FIELD (insn, 25, 25))
+			(*info->fprintf_func) (info->stream, ",i");
+		      break;
+		    case 'z':
+		      if (!GET_FIELD (insn, 21, 21))
+			(*info->fprintf_func) (info->stream, ",z");
+		      break;
+		    case 'a':
+		      (*info->fprintf_func)
+			(info->stream, "%s", add_compl_names[GET_FIELD
+							    (insn, 20, 21)]);
+		      break;
+		    case 'Y':
+		      (*info->fprintf_func)
+			(info->stream, ",dc%s", add_compl_names[GET_FIELD
+							       (insn, 20, 21)]);
+		      break;
+		    case 'y':
+		      (*info->fprintf_func)
+			(info->stream, ",c%s", add_compl_names[GET_FIELD
+							      (insn, 20, 21)]);
+		      break;
+		    case 'v':
+		      if (GET_FIELD (insn, 20, 20))
+			(*info->fprintf_func) (info->stream, ",tsv");
+		      break;
+		    case 't':
+		      (*info->fprintf_func) (info->stream, ",tc");
+		      if (GET_FIELD (insn, 20, 20))
+			(*info->fprintf_func) (info->stream, ",tsv");
+		      break;
+		    case 'B':
+		      (*info->fprintf_func) (info->stream, ",db");
+		      if (GET_FIELD (insn, 20, 20))
+			(*info->fprintf_func) (info->stream, ",tsv");
+		      break;
+		    case 'b':
+		      (*info->fprintf_func) (info->stream, ",b");
+		      if (GET_FIELD (insn, 20, 20))
+			(*info->fprintf_func) (info->stream, ",tsv");
+		      break;
+		    case 'T':
+		      if (GET_FIELD (insn, 25, 25))
+			(*info->fprintf_func) (info->stream, ",tc");
+		      break;
+		    case 'S':
+		      /* EXTRD/W has a following condition.  */
+		      if (*(s + 1) == '?')
+			(*info->fprintf_func)
+			  (info->stream, "%s", signed_unsigned_names[GET_FIELD
+								    (insn, 21, 21)]);
+		      else
+			(*info->fprintf_func)
+			  (info->stream, "%s ", signed_unsigned_names[GET_FIELD
+								     (insn, 21, 21)]);
+		      break;
+		    case 'h':
+		      (*info->fprintf_func)
+			  (info->stream, "%s", mix_half_names[GET_FIELD
+							     (insn, 17, 17)]);
+		      break;
+		    case 'H':
+		      (*info->fprintf_func)
+			  (info->stream, "%s", saturation_names[GET_FIELD
+							       (insn, 24, 25)]);
+		      break;
+		    case '*':
+		      (*info->fprintf_func)
+			  (info->stream, ",%d%d%d%d ",
+			   GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21),
+			   GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25));
+		      break;
+
+		    case 'q':
+		      {
+			int m, a;
+
+			m = GET_FIELD (insn, 28, 28);
+			a = GET_FIELD (insn, 29, 29);
+
+			if (m && !a)
+			  fputs_filtered (",ma ", info);
+			else if (m && a)
+			  fputs_filtered (",mb ", info);
+			else
+			  fputs_filtered (" ", info);
+			break;
+		      }
+
+		    case 'J':
+		      {
+			int opcode = GET_FIELD (insn, 0, 5);
+
+			if (opcode == 0x16 || opcode == 0x1e)
+			  {
+			    if (GET_FIELD (insn, 29, 29) == 0)
+			      fputs_filtered (",ma ", info);
+			    else
+			      fputs_filtered (",mb ", info);
+			  }
+			else
+			  fputs_filtered (" ", info);
+			break;
+		      }
+
+		    case 'e':
+		      {
+			int opcode = GET_FIELD (insn, 0, 5);
+
+			if (opcode == 0x13 || opcode == 0x1b)
+			  {
+			    if (GET_FIELD (insn, 18, 18) == 1)
+			      fputs_filtered (",mb ", info);
+			    else
+			      fputs_filtered (",ma ", info);
+			  }
+			else if (opcode == 0x17 || opcode == 0x1f)
+			  {
+			    if (GET_FIELD (insn, 31, 31) == 1)
+			      fputs_filtered (",ma ", info);
+			    else
+			      fputs_filtered (",mb ", info);
+			  }
+			else
+			  fputs_filtered (" ", info);
+
+			break;
+		      }
+		    }
 		  break;
-		case 'C':
-		  (*info->fprintf_func) (info->stream, "%s ",
-				    short_ldst_compl_names[GET_COMPL (insn)]);
-		  break;
-		case 'Y':
-		  (*info->fprintf_func) (info->stream, "%s ",
-				    short_bytes_compl_names[GET_COMPL (insn)]);
-		  break;
-		/* these four conditions are for the set of instructions
-		   which distinguish true/false conditions by opcode rather
-		   than by the 'f' bit (sigh): comb, comib, addb, addib */
-		case '<':
-		  fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)],
-				  info);
-		  break;
+
+		/* Handle conditions.  */
 		case '?':
-		  fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)
-				  + GET_FIELD (insn, 4, 4) * 8], info);
-		  break;
-		case '@':
-		  fputs_filtered (add_cond_names[GET_FIELD (insn, 16, 18)
-				  + GET_FIELD (insn, 4, 4) * 8], info);
-		  break;
-		case 'a':
-		  (*info->fprintf_func) (info->stream, "%s ",
-					 compare_cond_names[GET_COND (insn)]);
-		  break;
-		case 'd':
-		  (*info->fprintf_func) (info->stream, "%s ",
-					 add_cond_names[GET_COND (insn)]);
-		  break;
-		case '!':
-		  (*info->fprintf_func) (info->stream, "%s",
-				    add_cond_names[GET_FIELD (insn, 16, 18)]);
-		  break;
+		  {
+		    s++;
+		    switch (*s)
+		      {
+		      case 'f':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       float_comp_names[GET_FIELD
+							       (insn, 27, 31)]);
+			break;
 
-		case '&':
-		  (*info->fprintf_func) (info->stream, "%s ",
-				    logical_cond_names[GET_COND (insn)]);
-		  break;
-		case 'U':
-		  (*info->fprintf_func) (info->stream, "%s ",
-				    unit_cond_names[GET_COND (insn)]);
-		  break;
-		case '|':
-		case '>':
-		case '~':
-		  (*info->fprintf_func)
-		    (info->stream, "%s",
-		     shift_cond_names[GET_FIELD (insn, 16, 18)]);
+		      /* these four conditions are for the set of instructions
+			   which distinguish true/false conditions by opcode
+			   rather than by the 'f' bit (sigh): comb, comib,
+			   addb, addib */
+		      case 't':
+			fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)],
+					info);
+			break;
+		      case 'n':
+			fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)
+					+ GET_FIELD (insn, 4, 4) * 8], info);
+			break;
+		      case 'N':
+			fputs_filtered (compare_cond_64_names[GET_FIELD (insn, 16, 18)
+					+ GET_FIELD (insn, 2, 2) * 8], info);
+			break;
+		      case 'Q':
+			fputs_filtered (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
+					info);
+			break;
+		      case '@':
+			fputs_filtered (add_cond_names[GET_FIELD (insn, 16, 18)
+					+ GET_FIELD (insn, 4, 4) * 8], info);
+			break;
+		      case 's':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       compare_cond_names[GET_COND (insn)]);
+			break;
+		      case 'S':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       compare_cond_64_names[GET_COND (insn)]);
+			break;
+		      case 'a':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       add_cond_names[GET_COND (insn)]);
+			break;
+		      case 'A':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       add_cond_64_names[GET_COND (insn)]);
+			break;
+		      case 'd':
+			(*info->fprintf_func) (info->stream, "%s",
+					       add_cond_names[GET_FIELD (insn, 16, 18)]);
+			break;
 
-		  /* If the next character in args is 'n', it will handle
-		     putting out the space.  */
-		  if (s[1] != 'n')
-		    (*info->fprintf_func) (info->stream, " ");
-		  break;
+		      case 'W':
+			(*info->fprintf_func) 
+			  (info->stream, "%s",
+			   wide_add_cond_names[GET_FIELD (insn, 16, 18) + 
+					      GET_FIELD (insn, 4, 4) * 8]);
+			break;
+
+		      case 'l':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       logical_cond_names[GET_COND (insn)]);
+			break;
+		      case 'L':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       logical_cond_64_names[GET_COND (insn)]);
+			break;
+		      case 'u':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       unit_cond_names[GET_COND (insn)]);
+			break;
+		      case 'U':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       unit_cond_64_names[GET_COND (insn)]);
+			break;
+		      case 'y':
+		      case 'x':
+		      case 'b':
+			(*info->fprintf_func)
+			  (info->stream, "%s",
+			   shift_cond_names[GET_FIELD (insn, 16, 18)]);
+
+			/* If the next character in args is 'n', it will handle
+			   putting out the space.  */
+			if (s[1] != 'n')
+			  (*info->fprintf_func) (info->stream, " ");
+			break;
+		      case 'X':
+			(*info->fprintf_func) (info->stream, "%s ",
+					       shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
+			break;
+		      case 'B':
+			(*info->fprintf_func)
+			  (info->stream, "%s",
+			   bb_cond_64_names[GET_FIELD (insn, 16, 16)]);
+
+			/* If the next character in args is 'n', it will handle
+			   putting out the space.  */
+			if (s[1] != 'n')
+			  (*info->fprintf_func) (info->stream, " ");
+			break;
+		      }
+		    break;
+		  }
+
 		case 'V':
 		  fput_const (extract_5_store (insn), info);
 		  break;
@@ -463,6 +820,10 @@
 		case 'R':
 		  fput_const (extract_5R_store (insn), info);
 		  break;
+		case 'U':
+		  fput_const (extract_10U_store (insn), info);
+		  break;
+		case 'B':
 		case 'Q':
 		  fput_const (extract_5Q_store (insn), info);
 		  break;
@@ -505,31 +866,86 @@
 		     of address.  */
 		  fput_const (extract_17 (insn), info);
 		  break;
+
+		case 'Z':
+		  /* addil %r1 implicit output.  */
+		  (*info->fprintf_func) (info->stream, "%%r1");
+		  break;
+
+		case 'Y':
+		  /* be,l %sr0,%r31 implicit output.  */
+		  (*info->fprintf_func) (info->stream, "%%sr0,%%r31");
+		  break;
+		  
+		case '@':
+		  (*info->fprintf_func) (info->stream, "0");
+		  break;
+
+		case '.':
+		  (*info->fprintf_func) (info->stream, "%d",
+				    GET_FIELD (insn, 24, 25));
+		  break;
+		case '*':
+		  (*info->fprintf_func) (info->stream, "%d",
+				    GET_FIELD (insn, 22, 25));
+		  break;
+		case '!':
+		  (*info->fprintf_func) (info->stream, "%%sar");
+		  break;
 		case 'p':
 		  (*info->fprintf_func) (info->stream, "%d",
 				    31 - GET_FIELD (insn, 22, 26));
 		  break;
+		case '~':
+		  {
+		    int num;
+		    num = GET_FIELD (insn, 20, 20) << 5;
+		    num |= GET_FIELD (insn, 22, 26);
+		    (*info->fprintf_func) (info->stream, "%d", 63 - num);
+		    break;
+		  }
 		case 'P':
 		  (*info->fprintf_func) (info->stream, "%d",
 				    GET_FIELD (insn, 22, 26));
 		  break;
+		case 'q':
+		  {
+		    int num;
+		    num = GET_FIELD (insn, 20, 20) << 5;
+		    num |= GET_FIELD (insn, 22, 26);
+		    (*info->fprintf_func) (info->stream, "%d", num);
+		    break;
+		  }
 		case 'T':
 		  (*info->fprintf_func) (info->stream, "%d",
 				    32 - GET_FIELD (insn, 27, 31));
 		  break;
+		case '%':
+		  {
+		    int num;
+		    num = (GET_FIELD (insn, 23, 23) + 1) * 32;
+		    num -= GET_FIELD (insn, 27, 31);
+		    (*info->fprintf_func) (info->stream, "%d", num);
+		    break;
+		  }
+		case '|':
+		  {
+		    int num;
+		    num = (GET_FIELD (insn, 19, 19) + 1) * 32;
+		    num -= GET_FIELD (insn, 27, 31);
+		    (*info->fprintf_func) (info->stream, "%d", num);
+		    break;
+		  }
+		case '$':
+		  fput_const (GET_FIELD (insn, 20, 28), info);
+		  break;
 		case 'A':
 		  fput_const (GET_FIELD (insn, 6, 18), info);
 		  break;
-		case 'Z':
-		  if (GET_FIELD (insn, 26, 26))
-		    (*info->fprintf_func) (info->stream, ",m ");
-		  else
-		    (*info->fprintf_func) (info->stream, " ");
-		  break;
 		case 'D':
 		  fput_const (GET_FIELD (insn, 6, 31), info);
 		  break;
-		case 'f':
+		case 'v':
 		  (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
 		  break;
 		case 'O':
@@ -539,17 +955,6 @@
 		case 'o':
 		  fput_const (GET_FIELD (insn, 6, 20), info);
 		  break;
-		case '3':
-		  {
-		    int reg = GET_FIELD (insn, 21, 22);
-		    reg |= GET_FIELD (insn, 16, 18) << 2;
-		    if (GET_FIELD (insn, 23, 23) != 0)
-		      fput_fp_reg_r (reg, info);
-		    else
-		      fput_fp_reg (reg, info);
-		    break;
-		  }
-
 		case '2':
 		  fput_const ((GET_FIELD (insn, 6, 22) << 5 |
 			       GET_FIELD (insn, 27, 31)), info);
@@ -568,7 +973,7 @@
 		case 'F':
 		  /* if no destination completer and not before a completer
 		     for fcmp, need a space here */
-		  if (GET_FIELD (insn, 21, 22) == 1 || s[1] == 'M')
+		  if (s[1] == 'G' || s[1] == '?')
 		    fputs_filtered (float_format_names[GET_FIELD (insn, 19, 20)],
 				    info);
 		  else
@@ -592,7 +997,7 @@
 		case 'I':
 		  /* if no destination completer and not before a completer
 		     for fcmp, need a space here */
-		  if (GET_FIELD (insn, 21, 22) == 1 || s[1] == 'M')
+		  if (s[1] == '?')
 		    fputs_filtered (float_format_names[GET_FIELD (insn, 20, 20)],
 				    info);
 		  else
@@ -600,23 +1005,99 @@
 					   float_format_names[GET_FIELD
 							      (insn, 20, 20)]);
 		  break;
-		case 'J':
-                  if (GET_FIELD (insn, 24, 24))
-		      fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
-		  else
-		      fput_fp_reg (GET_FIELD (insn, 6, 10), info);
-		      
+
+                case 'J':
+                  fput_const (extract_14 (insn), info);
+                  break;
+
+		case '#':
+		  {
+		    int sign = GET_FIELD (insn, 31, 31);
+		    int imm10 = GET_FIELD (insn, 18, 27);
+		    int disp;
+
+		    if (sign)
+		      disp = (-1 << 10) | imm10;
+		    else
+		      disp = imm10;
+
+		    disp <<= 3;
+		    fput_const (disp, info);
+		    break;
+		  }
+                case 'K':
+		case 'd':
+		  {
+		    int sign = GET_FIELD (insn, 31, 31);
+		    int imm11 = GET_FIELD (insn, 18, 28);
+		    int disp;
+
+		    if (sign)
+		      disp = (-1 << 11) | imm11;
+		    else
+		      disp = imm11;
+
+		    disp <<= 2;
+		    fput_const (disp, info);
+		    break;
+		  }
+
+		/* ?!? FIXME */
+		case '_':
+		case '{':
+		  fputs_filtered ("Disassembler botch.\n", info);
 		  break;
-		case 'K':
-                  if (GET_FIELD (insn, 19, 19))
-		      fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
-		  else
-		      fput_fp_reg (GET_FIELD (insn, 11, 15), info);
+
+		case 'm':
+		  {
+		    int y = GET_FIELD (insn, 16, 18);
+
+		    if (y != 1)
+		      fput_const ((y ^ 1) - 1, info);
+		  }
 		  break;
-		case 'M':
-		    (*info->fprintf_func) (info->stream, "%s ",
-					   float_comp_names[GET_FIELD
-							      (insn, 27, 31)]);
+
+		case 'h':
+		  {
+		    int cbit;
+
+		    cbit = GET_FIELD (insn, 16, 18);
+
+		    if (cbit > 0)
+		      (*info->fprintf_func) (info->stream, ",%d", cbit - 1);
+		    break;
+		  }
+
+		case '=':
+		  {
+		    int cond = GET_FIELD (insn, 27, 31);
+
+		    if (cond == 0)
+		      fputs_filtered (" ", info);
+		    else if (cond == 1)
+		      fputs_filtered ("acc ", info);
+		    else if (cond == 2)
+		      fputs_filtered ("rej ", info);
+		    else if (cond == 5)
+		      fputs_filtered ("acc8 ", info);
+		    else if (cond == 6)
+		      fputs_filtered ("rej8 ", info);
+		    else if (cond == 9)
+		      fputs_filtered ("acc6 ", info);
+		    else if (cond == 13)
+		      fputs_filtered ("acc4 ", info);
+		    else if (cond == 17)
+		      fputs_filtered ("acc2 ", info);
+		    break;
+		  }
+
+		case 'X':
+		  (*info->print_address_func) ((memaddr + 8 
+						+ extract_22 (insn)),
+					       info);
+		  break;
+		case 'L':
+		  fputs_filtered (",%r2", info);
 		  break;
 		default:
 		  (*info->fprintf_func) (info->stream, "%c", *s);
diff --git a/opcodes/i370-dis.c b/opcodes/i370-dis.c
new file mode 100644
index 0000000..a992c76
--- /dev/null
+++ b/opcodes/i370-dis.c
@@ -0,0 +1,167 @@
+
+/* i370-dis.c -- Disassemble Instruction 370 (ESA/390) instructions
+   Copyright 1994, 2000 Free Software Foundation, Inc.
+   PowerPC version written by Ian Lance Taylor, Cygnus Support
+   Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org>
+
+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 "sysdep.h"
+#include "dis-asm.h"
+#include "opcode/i370.h"
+
+/* This file provides several disassembler functions, all of which use
+   the disassembler interface defined in dis-asm.h.
+*/
+
+int
+print_insn_i370 (memaddr, info)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+{
+  bfd_byte buffer[8];
+  int status;
+  i370_insn_t insn;
+  const struct i370_opcode *opcode;
+  const struct i370_opcode *opcode_end;
+
+  status = (*info->read_memory_func) (memaddr, buffer, 6, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, memaddr, info);
+      return -1;
+    }
+
+  /* Cast the bytes into the insn (in a host-endian indep way) */
+  insn.i[0] = (buffer[0] << 24) & 0xff000000;
+  insn.i[0] |= (buffer[1] << 16) & 0xff0000;
+  insn.i[0] |= (buffer[2] << 8) & 0xff00;
+  insn.i[0] |= buffer[3]  & 0xff;
+  insn.i[1] = (buffer[4] << 24) & 0xff000000;
+  insn.i[1] |= (buffer[5] << 16) & 0xff0000;
+
+  /* Find the first match in the opcode table.  We could speed this up
+     a bit by doing a binary search on the major opcode.  */
+  opcode_end = i370_opcodes + i370_num_opcodes;
+  for (opcode = i370_opcodes; opcode < opcode_end; opcode++)
+    {
+      const unsigned char *opindex;
+      const struct i370_operand *operand;
+      i370_insn_t masked;
+      int invalid;
+
+      /* Mask off operands, and look for a match ... */
+      masked = insn;
+      if (2 == opcode->len)
+        {
+          masked.i[0] >>= 16;
+          masked.i[0] &= 0xffff;
+        }
+      masked.i[0] &= opcode->mask.i[0];
+      if (masked.i[0] != opcode->opcode.i[0]) continue;
+
+      if (6 == opcode->len)
+        {
+          masked.i[1] &= opcode->mask.i[1];
+          if (masked.i[1] != opcode->opcode.i[1]) continue;
+        }
+
+      /* Found a match.  adjust a tad */
+      if (2 == opcode->len)
+        {
+          insn.i[0] >>= 16;
+          insn.i[0] &= 0xffff;
+        }
+
+      /* Make two passes over the operands.  First see if any of them
+         have extraction functions, and, if they do, make sure the
+         instruction is valid.  */
+      invalid = 0;
+      for (opindex = opcode->operands; *opindex != 0; opindex++)
+        {
+          operand = i370_operands + *opindex;
+          if (operand->extract)
+            (*operand->extract) (insn, &invalid);
+        }
+      if (invalid) continue;
+
+      /* The instruction is valid.  */
+      (*info->fprintf_func) (info->stream, "%s", opcode->name);
+      if (opcode->operands[0] != 0)
+        (*info->fprintf_func) (info->stream, "\t");
+
+      /* Now extract and print the operands.  */
+      for (opindex = opcode->operands; *opindex != 0; opindex++)
+        {
+          long value;
+
+          operand = i370_operands + *opindex;
+
+          /* Extract the value from the instruction.  */
+          if (operand->extract)
+            value = (*operand->extract) (insn, (int *) NULL);
+          else
+            {
+              value = (insn.i[0] >> operand->shift) & ((1 << operand->bits) - 1);
+            }
+
+          /* Print the operand as directed by the flags.  */
+          if ((operand->flags & I370_OPERAND_OPTIONAL) != 0)
+            {
+              if (value)
+                (*info->fprintf_func) (info->stream, "(r%ld)", value);
+            }
+          else if ((operand->flags & I370_OPERAND_SBASE) != 0)
+            {
+              (*info->fprintf_func) (info->stream, "(r%ld)", value);
+            }
+          else if ((operand->flags & I370_OPERAND_INDEX) != 0)
+            {
+              if (value)
+                (*info->fprintf_func) (info->stream, "(r%ld,", value);
+              else
+                (*info->fprintf_func) (info->stream, "(,");
+            }
+          else if ((operand->flags & I370_OPERAND_LENGTH) != 0)
+            {
+              (*info->fprintf_func) (info->stream, "(%ld,", value);
+            }
+          else if ((operand->flags & I370_OPERAND_BASE) != 0)
+            (*info->fprintf_func) (info->stream, "r%ld)", value);
+          else if ((operand->flags & I370_OPERAND_GPR) != 0)
+            (*info->fprintf_func) (info->stream, "r%ld,", value);
+          else if ((operand->flags & I370_OPERAND_FPR) != 0)
+            (*info->fprintf_func) (info->stream, "f%ld,", value);
+          else if ((operand->flags & I370_OPERAND_RELATIVE) != 0)
+            (*info->fprintf_func) (info->stream, "%ld", value);
+          else
+            (*info->fprintf_func) (info->stream, " %ld, ", value);
+
+        }
+
+      return opcode->len;
+
+    }
+
+
+  /* We could not find a match.  */
+  (*info->fprintf_func) (info->stream, ".short 0x%02x%02x", buffer[0], buffer[1]);
+
+  return 2;
+}
diff --git a/opcodes/i370-opc.c b/opcodes/i370-opc.c
new file mode 100644
index 0000000..632f16b
--- /dev/null
+++ b/opcodes/i370-opc.c
@@ -0,0 +1,959 @@
+/* i370-opc.c -- Instruction 370 (ESA/390) architecture opcode list
+   Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
+   PowerPC version written by Ian Lance Taylor, Cygnus Support
+   Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org> 1998, 1999
+
+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/i370.h"
+
+/* This file holds the i370 opcode table.  The opcode table
+   includes almost all of the extended instruction mnemonics.  This
+   permits the disassembler to use them, and simplifies the assembler
+   logic, at the cost of increasing the table size.  The table is
+   strictly constant data, so the compiler should be able to put it in
+   the .text section.
+
+   This file also holds the operand table.  All knowledge about
+   inserting operands into instructions and vice-versa is kept in this
+   file.  */
+
+/* Local insertion and extraction functions.  */
+static i370_insn_t insert_ss_b2  PARAMS (( i370_insn_t, long, const char **));
+static i370_insn_t insert_ss_d2  PARAMS (( i370_insn_t, long, const char **));
+static i370_insn_t insert_rxf_r3  PARAMS (( i370_insn_t, long, const char **));
+static long extract_ss_b2 PARAMS (( i370_insn_t, int *));
+static long extract_ss_d2 PARAMS (( i370_insn_t, int *));
+static long extract_rxf_r3 PARAMS (( i370_insn_t, int *));
+
+
+/* The operands table.
+   The fields are bits, shift, insert, extract, flags, name.
+   The types:
+   I370_OPERAND_GPR register, must name a register, must be present
+   I370_OPERAND_RELATIVE displacement or legnth field, must be present
+   I370_OPERAND_BASE base register; if present, must name a register
+                      if absent, should take value of zero
+   I370_OPERAND_INDEX index register; if present, must name a register
+                      if absent, should take value of zero
+   I370_OPERAND_OPTIONAL other optional operand (usuall reg?)
+*/
+
+const struct i370_operand i370_operands[] =
+{
+  /* The zero index is used to indicate the end of the list of
+     operands.  */
+#define UNUSED 0
+  { 0, 0, 0, 0, 0, "unused" },
+
+  /* The R1 register field in an RR form instruction.  */
+#define RR_R1 (UNUSED + 1)
+#define RR_R1_MASK (0xf << 4)
+  { 4, 4, 0, 0, I370_OPERAND_GPR, "RR R1" },
+
+  /* The R2 register field in an RR form instruction.  */
+#define RR_R2 (RR_R1 + 1)
+#define RR_R2_MASK (0xf)
+  { 4, 0, 0, 0, I370_OPERAND_GPR, "RR R2" },
+
+  /* The I field in an RR form SVC-style instruction.  */
+#define RR_I (RR_R2 + 1)
+#define RR_I_MASK (0xff)
+  { 8, 0, 0, 0, I370_OPERAND_RELATIVE, "RR I (svc)" },
+
+  /* The R1 register field in an RRE form instruction.  */
+#define RRE_R1 (RR_I + 1)
+#define RRE_R1_MASK (0xf << 4)
+  { 4, 4, 0, 0, I370_OPERAND_GPR, "RRE R1" },
+
+  /* The R2 register field in an RRE form instruction.  */
+#define RRE_R2 (RRE_R1 + 1)
+#define RRE_R2_MASK (0xf)
+  { 4, 0, 0, 0, I370_OPERAND_GPR, "RRE R2" },
+
+  /* The R1 register field in an RRF form instruction.  */
+#define RRF_R1 (RRE_R2 + 1)
+#define RRF_R1_MASK (0xf << 4)
+  { 4, 4, 0, 0, I370_OPERAND_GPR, "RRF R1" },
+
+  /* The R2 register field in an RRF form instruction.  */
+#define RRF_R2 (RRF_R1 + 1)
+#define RRF_R2_MASK (0xf)
+  { 4, 0, 0, 0, I370_OPERAND_GPR, "RRF R2" },
+
+  /* The R3 register field in an RRF form instruction.  */
+#define RRF_R3 (RRF_R2 + 1)
+#define RRF_R3_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR, "RRF R3" },
+
+  /* The R1 register field in an RX or RS form instruction.  */
+#define RX_R1 (RRF_R3 + 1)
+#define RX_R1_MASK (0xf << 20)
+  { 4, 20, 0, 0, I370_OPERAND_GPR, "RX R1" },
+
+  /* The X2 index field in an RX form instruction.  */
+#define RX_X2 (RX_R1 + 1)
+#define RX_X2_MASK (0xf << 16)
+  { 4, 16, 0, 0, I370_OPERAND_GPR | I370_OPERAND_INDEX, "RX X2"},
+
+  /* The B2 base field in an RX form instruction.  */
+#define RX_B2 (RX_X2 + 1)
+#define RX_B2_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE, "RX B2"},
+
+  /* The D2 displacement field in an RX form instruction.  */
+#define RX_D2 (RX_B2 + 1)
+#define RX_D2_MASK (0xfff)
+  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "RX D2"},
+
+ /* The R3 register field in an RXF form instruction.  */
+#define RXF_R3 (RX_D2 + 1)
+#define RXF_R3_MASK (0xf << 12)
+  { 4, 12, insert_rxf_r3, extract_rxf_r3, I370_OPERAND_GPR, "RXF R3" },
+
+  /* The D2 displacement field in an RS form instruction.  */
+#define RS_D2 (RXF_R3 + 1)
+#define RS_D2_MASK (0xfff)
+  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "RS D2"},
+
+  /* The R3 register field in an RS form instruction.  */
+#define RS_R3 (RS_D2 + 1)
+#define RS_R3_MASK (0xf << 16)
+  { 4, 16, 0, 0, I370_OPERAND_GPR, "RS R3" },
+
+  /* The B2 base field in an RS form instruction.  */
+#define RS_B2 (RS_R3 + 1)
+#define RS_B2_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "RS B2"},
+
+  /* The optional B2 base field in an RS form instruction.  */
+  /* Note that this field will almost always be absent */
+#define RS_B2_OPT (RS_B2 + 1)
+#define RS_B2_OPT_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_OPTIONAL, "RS B2 OPT"},
+
+  /* The R1 register field in an RSI form instruction.  */
+#define RSI_R1 (RS_B2_OPT + 1)
+#define RSI_R1_MASK (0xf << 20)
+  { 4, 20, 0, 0, I370_OPERAND_GPR, "RSI R1" },
+
+  /* The R3 register field in an RSI form instruction.  */
+#define RSI_R3 (RSI_R1 + 1)
+#define RSI_R3_MASK (0xf << 16)
+  { 4, 16, 0, 0, I370_OPERAND_GPR, "RSI R3" },
+
+  /* The I2 immediate field in an RSI form instruction.  */
+#define RSI_I2 (RSI_R3 + 1)
+#define RSI_I2_MASK (0xffff)
+  { 16, 0, 0, 0, I370_OPERAND_RELATIVE, "RSI I2" },
+
+  /* The R1 register field in an RI form instruction.  */
+#define RI_R1 (RSI_I2 + 1)
+#define RI_R1_MASK (0xf << 20)
+  { 4, 20, 0, 0, I370_OPERAND_GPR, "RI R1" },
+
+  /* The I2 immediate field in an RI form instruction.  */
+#define RI_I2 (RI_R1 + 1)
+#define RI_I2_MASK (0xffff)
+  { 16, 0, 0, 0, I370_OPERAND_RELATIVE, "RI I2" },
+
+ /* The I2 index field in an SI form instruction.  */
+#define SI_I2 (RI_I2 + 1)
+#define SI_I2_MASK (0xff << 16)
+  { 8, 16, 0, 0, I370_OPERAND_RELATIVE, "SI I2"},
+
+ /* The B1 base register field in an SI form instruction.  */
+#define SI_B1 (SI_I2 + 1)
+#define SI_B1_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR, "SI B1" },
+
+  /* The D1 displacement field in an SI form instruction.  */
+#define SI_D1 (SI_B1 + 1)
+#define SI_D1_MASK (0xfff)
+  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "SI D1" },
+
+ /* The B2 base register field in an S form instruction.  */
+#define S_B2 (SI_D1 + 1)
+#define S_B2_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "S B2" },
+
+  /* The D2 displacement field in an S form instruction.  */
+#define S_D2 (S_B2 + 1)
+#define S_D2_MASK (0xfff)
+  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "S D2" },
+
+  /* The L length field in an SS form instruction. */
+#define SS_L (S_D2 + 1)
+#define SS_L_MASK (0xffff<<16)
+  { 8, 16, 0, 0, I370_OPERAND_RELATIVE | I370_OPERAND_LENGTH, "SS L" },
+
+ /* The B1 base register field in an SS form instruction.  */
+#define SS_B1 (SS_L + 1)
+#define SS_B1_MASK (0xf << 12)
+  { 4, 12, 0, 0, I370_OPERAND_GPR, "SS B1" },
+
+  /* The D1 displacement field in an SS form instruction.  */
+#define SS_D1 (SS_B1 + 1)
+#define SS_D1_MASK (0xfff)
+  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "SS D1" },
+
+ /* The B2 base register field in an SS form instruction.  */
+#define SS_B2 (SS_D1 + 1)
+#define SS_B2_MASK (0xf << 12)
+  { 4, 12, insert_ss_b2, extract_ss_b2, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "SS B2" },
+
+  /* The D2 displacement field in an SS form instruction.  */
+#define SS_D2 (SS_B2 + 1)
+#define SS_D2_MASK (0xfff)
+  { 12, 0, insert_ss_d2, extract_ss_d2, I370_OPERAND_RELATIVE, "SS D2" },
+
+
+};
+
+/* The functions used to insert and extract complicated operands.  */
+
+/*ARGSUSED*/
+static i370_insn_t
+insert_ss_b2 (insn, value, errmsg)
+     i370_insn_t insn;
+     long value;
+     const char **errmsg;
+{
+  insn.i[1] |= (value & 0xf) << 28;
+  return insn;
+}
+
+static i370_insn_t
+insert_ss_d2 (insn, value, errmsg)
+     i370_insn_t insn;
+     long value;
+     const char **errmsg;
+{
+  insn.i[1] |= (value & 0xfff) << 16;
+  return insn;
+}
+
+static i370_insn_t
+insert_rxf_r3 (insn, value, errmsg)
+     i370_insn_t insn;
+     long value;
+     const char **errmsg;
+{
+  insn.i[1] |= (value & 0xf) << 28;
+  return insn;
+}
+
+static long
+extract_ss_b2 (insn, invalid)
+     i370_insn_t insn;
+     int *invalid;
+{
+  return (insn.i[1] >>28) & 0xf;
+}
+
+static long
+extract_ss_d2 (insn, invalid)
+     i370_insn_t insn;
+     int *invalid;
+{
+  return (insn.i[1] >>16) & 0xfff;
+}
+
+static long
+extract_rxf_r3 (insn, invalid)
+     i370_insn_t insn;
+     int *invalid;
+{
+  return (insn.i[1] >>28) & 0xf;
+}
+
+
+/* Macros used to form opcodes.  */
+
+/* The short-instruction opcode.  */
+#define OPS(x) ((((unsigned short)(x)) & 0xff) << 8)
+#define OPS_MASK OPS (0xff)
+
+/* the extended instruction opcode */
+#define XOPS(x) ((((unsigned short)(x)) & 0xff) << 24)
+#define XOPS_MASK XOPS (0xff)
+
+/* the S instruction opcode */
+#define SOPS(x) ((((unsigned short)(x)) & 0xffff) << 16)
+#define SOPS_MASK SOPS (0xffff)
+
+/* the E instruction opcode */
+#define EOPS(x) (((unsigned short)(x)) & 0xffff)
+#define EOPS_MASK EOPS (0xffff)
+
+/* the RI instruction opcode */
+#define ROPS(x) (((((unsigned short)(x)) & 0xff0) << 20) | \
+                 ((((unsigned short)(x)) & 0x00f) << 16))
+#define ROPS_MASK ROPS (0xfff)
+
+/* --------------------------------------------------------- */
+/* An E form instruction.  */
+#define E(op)  (EOPS (op))
+#define E_MASK E (0xffff)
+
+/* An RR form instruction.  */
+#define RR(op, r1, r2) \
+  (OPS (op) | ((((unsigned short)(r1)) & 0xf) << 4) |   \
+              ((((unsigned short)(r2)) & 0xf) ))
+
+#define RR_MASK RR (0xff, 0x0, 0x0)
+
+/* An SVC-style instruction.  */
+#define SVC(op, i) \
+  (OPS (op) | (((unsigned short)(i)) & 0xff))
+
+#define SVC_MASK SVC (0xff, 0x0)
+
+/* An RRE form instruction.  */
+#define RRE(op, r1, r2) \
+  (SOPS (op) | ((((unsigned short)(r1)) & 0xf) << 4) |   \
+               ((((unsigned short)(r2)) & 0xf) ))
+
+#define RRE_MASK RRE (0xffff, 0x0, 0x0)
+
+/* An RRF form instruction.  */
+#define RRF(op, r3, r1, r2) \
+  (SOPS (op) | ((((unsigned short)(r3)) & 0xf) << 12) |   \
+               ((((unsigned short)(r1)) & 0xf) << 4)  |   \
+               ((((unsigned short)(r2)) & 0xf) ))
+
+#define RRF_MASK RRF (0xffff, 0x0, 0x0, 0x0)
+
+/* An RX form instruction. */
+#define RX(op, r1, x2, b2, d2) \
+  (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(x2)) & 0xf) << 16) |  \
+              ((((unsigned short)(b2)) & 0xf) << 12) |  \
+              ((((unsigned short)(d2)) & 0xfff)))
+
+#define RX_MASK RX (0xff, 0x0, 0x0, 0x0, 0x0)
+
+/* An RXE form instruction high word. */
+#define RXEH(op, r1, x2, b2, d2) \
+  (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(x2)) & 0xf) << 16) |  \
+              ((((unsigned short)(b2)) & 0xf) << 12) |  \
+              ((((unsigned short)(d2)) & 0xfff)))
+
+#define RXEH_MASK RXEH (0xff, 0, 0, 0, 0)
+
+/* An RXE form instruction low word. */
+#define RXEL(op) \
+              ((((unsigned short)(op)) & 0xff) << 16 )
+
+#define RXEL_MASK RXEL (0xff)
+
+/* An RXF form instruction high word. */
+#define RXFH(op, r1, x2, b2, d2) \
+  (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(x2)) & 0xf) << 16) |  \
+              ((((unsigned short)(b2)) & 0xf) << 12) |  \
+              ((((unsigned short)(d2)) & 0xfff)))
+
+#define RXFH_MASK RXFH (0xff, 0, 0, 0, 0)
+
+/* An RXF form instruction low word. */
+#define RXFL(op, r3) \
+              (((((unsigned short)(r3)) & 0xf)  << 28 ) | \
+               ((((unsigned short)(op)) & 0xff) << 16 ))
+
+#define RXFL_MASK RXFL (0xff, 0)
+
+/* An RS form instruction. */
+#define RS(op, r1, b3, b2, d2) \
+  (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(b3)) & 0xf) << 16) |  \
+              ((((unsigned short)(b2)) & 0xf) << 12) |  \
+              ((((unsigned short)(d2)) & 0xfff)))
+
+#define RS_MASK RS (0xff, 0x0, 0x0, 0x0, 0x0)
+
+/* An RSI form instruction. */
+#define RSI(op, r1, r3, i2) \
+  (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(r3)) & 0xf) << 16) |  \
+              ((((unsigned short)(i2)) & 0xffff)))
+
+#define RSI_MASK RSI (0xff, 0x0, 0x0, 0x0)
+
+/* An RI form instruction. */
+#define RI(op, r1, i2) \
+  (ROPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) |  \
+              ((((unsigned short)(i2)) & 0xffff)))
+
+#define RI_MASK RI (0xfff, 0x0, 0x0)
+
+/* An SI form instruction. */
+#define SI(op, i2, b1, d1) \
+  (XOPS(op) | ((((unsigned short)(i2)) & 0xff) << 16) |  \
+              ((((unsigned short)(b1)) & 0xf)  << 12) |  \
+              ((((unsigned short)(d1)) & 0xfff)))
+
+#define SI_MASK SI (0xff, 0x0, 0x0, 0x0)
+
+/* An S form instruction. */
+#define S(op, b2, d2) \
+  (SOPS(op) | ((((unsigned short)(b2)) & 0xf) << 12) |  \
+              ((((unsigned short)(d2)) & 0xfff)))
+
+#define S_MASK S (0xffff, 0x0, 0x0)
+
+/* An SS form instruction high word. */
+#define SSH(op, l, b1, d1) \
+  (XOPS(op) | ((((unsigned short)(l)) & 0xff) << 16) |  \
+              ((((unsigned short)(b1)) & 0xf)  << 12) |  \
+              ((((unsigned short)(d1)) & 0xfff)))
+
+/* An SS form instruction low word. */
+#define SSL(b2, d2) \
+            ( ((((unsigned short)(b1)) & 0xf)   << 28) |  \
+              ((((unsigned short)(d1)) & 0xfff) << 16 ))
+
+#define SS_MASK SSH (0xff, 0x0, 0x0, 0x0)
+
+/* An SSE form instruction high word. */
+#define SSEH(op, b1, d1) \
+  (SOPS(op) | ((((unsigned short)(b1)) & 0xf)  << 12) |  \
+              ((((unsigned short)(d1)) & 0xfff)))
+
+/* An SSE form instruction low word. */
+#define SSEL(b2, d2) \
+            ( ((((unsigned short)(b1)) & 0xf)   << 28) |  \
+              ((((unsigned short)(d1)) & 0xfff) << 16 ))
+
+#define SSE_MASK SSEH (0xffff, 0x0, 0x0)
+
+
+/* Smaller names for the flags so each entry in the opcodes table will
+   fit on a single line.  These flags are set up so that e.g. IXA means
+   the insn is supported on the 370/XA or newer architecture.
+   Note that 370 or older obsolete insn's are not supported ...
+ */
+#define	IBF	I370_OPCODE_ESA390_BF
+#define	IBS	I370_OPCODE_ESA390_BS
+#define	ICK	I370_OPCODE_ESA390_CK
+#define	ICM	I370_OPCODE_ESA390_CM
+#define	IFX	I370_OPCODE_ESA390_FX
+#define	IHX	I370_OPCODE_ESA390_HX
+#define	IIR	I370_OPCODE_ESA390_IR
+#define	IMI	I370_OPCODE_ESA390_MI
+#define	IPC	I370_OPCODE_ESA390_PC
+#define	IPL	I370_OPCODE_ESA390_PL
+#define	IQR	I370_OPCODE_ESA390_QR
+#define	IRP	I370_OPCODE_ESA390_RP
+#define	ISA	I370_OPCODE_ESA390_SA
+#define	ISG	I370_OPCODE_ESA390_SG
+#define	ISR	I370_OPCODE_ESA390_SR
+#define	ITR	I370_OPCODE_ESA390_SR
+#define	I390	IBF  | IBS | ICK | ICM | IIR | IFX | IHX | IMI | IPC | IPL | IQR | IRP | ISA | ISG | ISR | ITR | I370_OPCODE_ESA390
+#define	IESA	I390 | I370_OPCODE_ESA370
+#define IXA	IESA | I370_OPCODE_370_XA
+#define	I370	IXA  | I370_OPCODE_370
+#define I360	I370 | I370_OPCODE_360
+
+
+/* The opcode table.
+
+   The format of the opcode table is:
+
+   NAME	    LEN  OPCODE_HI  OPCODE_LO	MASK_HI MASK_LO	FLAGS		{ OPERANDS }
+
+   NAME is the name of the instruction.
+   OPCODE is the instruction opcode.
+   MASK is the opcode mask; this is used to tell the disassembler
+     which bits in the actual opcode must match OPCODE.
+   FLAGS are flags indicated what processors support the instruction.
+   OPERANDS is the list of operands.
+
+   The disassembler reads the table in order and prints the first
+   instruction which matches, so this table is sorted to put more
+   specific instructions before more general instructions.  It is also
+   sorted by major opcode.  */
+
+const struct i370_opcode i370_opcodes[] = {
+
+/* E form instructions */
+{ "pr",     2, {E(0x0101),    0}, {E_MASK,  0}, IESA,  {0} },
+
+{ "trap2",  2, {E(0x01FF),    0}, {E_MASK,  0}, ITR,   {0} },
+{ "upt",    2, {E(0x0102),    0}, {E_MASK,  0}, IXA,   {0} },
+
+/* RR form instructions */
+{ "ar",     2, {RR(0x1a,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "adr",    2, {RR(0x2a,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "aer",    2, {RR(0x3a,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "alr",    2, {RR(0x1e,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "aur",    2, {RR(0x2e,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "awr",    2, {RR(0x3e,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "axr",    2, {RR(0x36,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "balr",   2, {RR(0x05,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "basr",   2, {RR(0x0d,0,0), 0}, {RR_MASK, 0}, IXA,   {RR_R1, RR_R2} },
+{ "bassm",  2, {RR(0x0c,0,0), 0}, {RR_MASK, 0}, IXA,   {RR_R1, RR_R2} },
+{ "bsm",    2, {RR(0x0b,0,0), 0}, {RR_MASK, 0}, IXA,   {RR_R1, RR_R2} },
+{ "bcr",    2, {RR(0x07,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "bctr",   2, {RR(0x06,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "cdr",    2, {RR(0x29,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "cer",    2, {RR(0x39,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "clr",    2, {RR(0x15,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "clcl",   2, {RR(0x0f,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "cr",     2, {RR(0x19,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ddr",    2, {RR(0x2d,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "der",    2, {RR(0x3d,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "dr",     2, {RR(0x1d,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "hdr",    2, {RR(0x24,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "her",    2, {RR(0x34,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lcdr",   2, {RR(0x23,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lcer",   2, {RR(0x33,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lcr",    2, {RR(0x13,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ldr",    2, {RR(0x28,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ler",    2, {RR(0x38,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lndr",   2, {RR(0x21,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lner",   2, {RR(0x31,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lnr",    2, {RR(0x11,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lpdr",   2, {RR(0x20,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lper",   2, {RR(0x30,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lpr",    2, {RR(0x10,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lr",     2, {RR(0x18,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lrdr",   2, {RR(0x25,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lrer",   2, {RR(0x35,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ltdr",   2, {RR(0x22,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "lter",   2, {RR(0x32,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ltr",    2, {RR(0x12,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mdr",    2, {RR(0x2c,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mer",    2, {RR(0x3c,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mr",     2, {RR(0x1c,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mvcl",   2, {RR(0x0e,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mxdr",   2, {RR(0x27,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "mxr",    2, {RR(0x26,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "nr",     2, {RR(0x14,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "or",     2, {RR(0x16,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "sdr",    2, {RR(0x2b,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "ser",    2, {RR(0x3b,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "slr",    2, {RR(0x1f,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "spm",    2, {RR(0x04,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1} },
+{ "sr",     2, {RR(0x1b,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "sur",    2, {RR(0x3f,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "swr",    2, {RR(0x2f,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "sxr",    2, {RR(0x37,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+{ "xr",     2, {RR(0x17,0,0), 0}, {RR_MASK, 0}, I370,  {RR_R1, RR_R2} },
+
+/* unusual RR formats */
+{ "svc",    2, {SVC(0x0a,0), 0}, {SVC_MASK, 0}, I370,  {RR_I} },
+
+/* RRE form instructions */
+{ "adbr",   4, {RRE(0xb31a,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "aebr",   4, {RRE(0xb30a,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "axbr",   4, {RRE(0xb34a,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "bakr",   4, {RRE(0xb240,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "bsa",    4, {RRE(0xb25a,0,0),   0}, {RRE_MASK, 0}, IBS,  {RRE_R1, RRE_R2} },
+{ "bsg",    4, {RRE(0xb258,0,0),   0}, {RRE_MASK, 0}, ISG,  {RRE_R1, RRE_R2} },
+{ "cdbr",   4, {RRE(0xb319,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cdfbr",  4, {RRE(0xb395,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cdfr",   4, {RRE(0xb3b5,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "cebr",   4, {RRE(0xb309,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cefbr",  4, {RRE(0xb394,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cefr",   4, {RRE(0xb3b4,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "cksm",   4, {RRE(0xb241,0,0),   0}, {RRE_MASK, 0}, ICK,  {RRE_R1, RRE_R2} },
+{ "clst",   4, {RRE(0xb25d,0,0),   0}, {RRE_MASK, 0}, ISR,  {RRE_R1, RRE_R2} },
+{ "cpya",   4, {RRE(0xb24d,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "cuse",   4, {RRE(0xb257,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "cxbr",   4, {RRE(0xb349,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cxfbr",  4, {RRE(0xb396,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "cxfr",   4, {RRE(0xb3b6,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "cxr",    4, {RRE(0xb369,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "ddbr",   4, {RRE(0xb31d,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "debr",   4, {RRE(0xb30d,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "dxbr",   4, {RRE(0xb34d,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "dxr",    4, {RRE(0xb22d,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "ear",    4, {RRE(0xb24f,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "efpc",   4, {RRE(0xb38c,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "epar",   4, {RRE(0xb226,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1} },
+{ "ereg",   4, {RRE(0xb249,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "esar",   4, {RRE(0xb227,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1} },
+{ "esta",   4, {RRE(0xb24a,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "fidr",   4, {RRE(0xb37f,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "fier",   4, {RRE(0xb377,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "fixr",   4, {RRE(0xb367,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "iac",    4, {RRE(0xb224,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1} },
+{ "ipm",    4, {RRE(0xb222,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1} },
+{ "ipte",   4, {RRE(0xb221,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "iske",   4, {RRE(0xb229,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "ivsk",   4, {RRE(0xb223,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "kdbr",   4, {RRE(0xb318,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "kebr",   4, {RRE(0xb308,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "kxbr",   4, {RRE(0xb348,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lcdbr",  4, {RRE(0xb313,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lcebr",  4, {RRE(0xb303,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lcxbr",  4, {RRE(0xb343,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lcxr",   4, {RRE(0xb363,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lder",   4, {RRE(0xb324,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "ldxbr",  4, {RRE(0xb345,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "ledbr",  4, {RRE(0xb344,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lexbr",  4, {RRE(0xb346,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lexr",   4, {RRE(0xb366,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lndbr",  4, {RRE(0xb311,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lnebr",  4, {RRE(0xb301,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lnxbr",  4, {RRE(0xb341,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lnxr",   4, {RRE(0xb361,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lpdbr",  4, {RRE(0xb310,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lpebr",  4, {RRE(0xb300,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lpxbr",  4, {RRE(0xb340,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "lpxr",   4, {RRE(0xb360,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "ltdbr",  4, {RRE(0xb312,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "ltebr",  4, {RRE(0xb302,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "ltxbr",  4, {RRE(0xb342,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "ltxr",   4, {RRE(0xb362,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lura",   4, {RRE(0xb24b,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "lxdr",   4, {RRE(0xb325,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lxer",   4, {RRE(0xb326,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "lxr",    4, {RRE(0xb365,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+{ "lzdr",   4, {RRE(0xb375,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+{ "lzer",   4, {RRE(0xb374,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+{ "lzxr",   4, {RRE(0xb376,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+{ "mdbr",   4, {RRE(0xb31c,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "mdebr",  4, {RRE(0xb30c,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "meebr",  4, {RRE(0xb317,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "meer",   4, {RRE(0xb337,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "msr",    4, {RRE(0xb252,0,0),   0}, {RRE_MASK, 0}, IIR,  {RRE_R1, RRE_R2} },
+{ "msta",   4, {RRE(0xb247,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1} },
+{ "mvpg",   4, {RRE(0xb254,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "mvst",   4, {RRE(0xb255,0,0),   0}, {RRE_MASK, 0}, ISR,  {RRE_R1, RRE_R2} },
+{ "mxbr",   4, {RRE(0xb34c,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "mxdbr",  4, {RRE(0xb307,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "palb",   4, {RRE(0xb248,0,0),   0}, {RRE_MASK, 0}, IESA, {0} },
+{ "prbe",   4, {RRE(0xb22a,0,0),   0}, {RRE_MASK, 0}, I370, {RRE_R1, RRE_R2} },
+{ "pt",     4, {RRE(0xb228,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "rrbe",   4, {RRE(0xb22a,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "sar",    4, {RRE(0xb24e,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "sdbr",   4, {RRE(0xb31b,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "sebr",   4, {RRE(0xb30b,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "servc",  4, {RRE(0xb220,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "sfpc",   4, {RRE(0xb384,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "sqdbr",  4, {RRE(0xb315,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "sqdr",   4, {RRE(0xb244,0,0),   0}, {RRE_MASK, 0}, IQR,  {RRE_R1, RRE_R2} },
+{ "sqebr",  4, {RRE(0xb314,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "sqer",   4, {RRE(0xb245,0,0),   0}, {RRE_MASK, 0}, IQR,  {RRE_R1, RRE_R2} },
+{ "sqxbr",  4, {RRE(0xb316,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "sqxr",   4, {RRE(0xb336,0,0),   0}, {RRE_MASK, 0}, IHX,  {RRE_R1, RRE_R2} },
+{ "srst",   4, {RRE(0xb25e,0,0),   0}, {RRE_MASK, 0}, ISR,  {RRE_R1, RRE_R2} },
+{ "ssar",   4, {RRE(0xb225,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1} },
+{ "sske",   4, {RRE(0xb22b,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "stura",  4, {RRE(0xb246,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "sxbr",   4, {RRE(0xb34b,0,0),   0}, {RRE_MASK, 0}, IBF,  {RRE_R1, RRE_R2} },
+{ "tar",    4, {RRE(0xb24c,0,0),   0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} },
+{ "tb",     4, {RRE(0xb22c,0,0),   0}, {RRE_MASK, 0}, IXA,  {RRE_R1, RRE_R2} },
+{ "thdr",   4, {RRE(0xb359,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+{ "thder",  4, {RRE(0xb359,0,0),   0}, {RRE_MASK, 0}, IFX,  {RRE_R1, RRE_R2} },
+
+/* RRF form instructions */
+{ "cfdbr",  4, {RRF(0xb399,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "cfdr",   4, {RRF(0xb3b9,0,0,0), 0}, {RRF_MASK, 0}, IHX,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "cfebr",  4, {RRF(0xb398,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "cfer",   4, {RRF(0xb3b8,0,0,0), 0}, {RRF_MASK, 0}, IHX,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "cfxbr",  4, {RRF(0xb39a,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "cfxr",   4, {RRF(0xb3ba,0,0,0), 0}, {RRF_MASK, 0}, IHX,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "didbr",  4, {RRF(0xb35b,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "diebr",  4, {RRF(0xb353,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "fidbr",  4, {RRF(0xb35f,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "fiebr",  4, {RRF(0xb357,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "fixbr",  4, {RRF(0xb347,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "madbr",  4, {RRF(0xb31e,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "maebr",  4, {RRF(0xb30e,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "msdbr",  4, {RRF(0xb31f,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "msebr",  4, {RRF(0xb30f,0,0,0), 0}, {RRF_MASK, 0}, IBF,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "tbdr",   4, {RRF(0xb351,0,0,0), 0}, {RRF_MASK, 0}, IFX,  {RRF_R1, RRF_R3, RRF_R2} },
+{ "tbedr",  4, {RRF(0xb350,0,0,0), 0}, {RRF_MASK, 0}, IFX,  {RRF_R1, RRF_R3, RRF_R2} },
+
+/* RX form instructions */
+{ "a",      4, {RX(0x5a,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ad",     4, {RX(0x6a,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ae",     4, {RX(0x7a,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ah",     4, {RX(0x4a,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "al",     4, {RX(0x5e,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "au",     4, {RX(0x7e,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "aw",     4, {RX(0x6e,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "bal",    4, {RX(0x45,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "bas",    4, {RX(0x4d,0,0,0,0),  0}, {RX_MASK,  0}, IXA,  {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "bc",     4, {RX(0x47,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "bct",    4, {RX(0x46,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "c",      4, {RX(0x59,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "cd",     4, {RX(0x69,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ce",     4, {RX(0x79,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ch",     4, {RX(0x49,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "cl",     4, {RX(0x55,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "cvb",    4, {RX(0x4f,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "cvd",    4, {RX(0x4e,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "d",      4, {RX(0x5d,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "dd",     4, {RX(0x6d,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "de",     4, {RX(0x7d,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ex",     4, {RX(0x44,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ic",     4, {RX(0x43,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "l",      4, {RX(0x58,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "la",     4, {RX(0x41,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lae",    4, {RX(0x51,0,0,0,0),  0}, {RX_MASK,  0}, IESA, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ld",     4, {RX(0x68,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "le",     4, {RX(0x78,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lh",     4, {RX(0x48,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lra",    4, {RX(0xb1,0,0,0,0),  0}, {RX_MASK,  0}, IXA,  {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "m",      4, {RX(0x5c,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "md",     4, {RX(0x6c,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "me",     4, {RX(0x7c,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mh",     4, {RX(0x4c,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ms",     4, {RX(0x71,0,0,0,0),  0}, {RX_MASK,  0}, IIR,  {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mxd",    4, {RX(0x67,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "n",      4, {RX(0x54,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "o",      4, {RX(0x56,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "s",      4, {RX(0x5b,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sd",     4, {RX(0x6b,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "se",     4, {RX(0x7b,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sh",     4, {RX(0x4b,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sl",     4, {RX(0x5f,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "st",     4, {RX(0x50,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "stc",    4, {RX(0x42,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "std",    4, {RX(0x60,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ste",    4, {RX(0x70,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sth",    4, {RX(0x40,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "su",     4, {RX(0x7f,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sw",     4, {RX(0x6f,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "x",      4, {RX(0x57,0,0,0,0),  0}, {RX_MASK,  0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} },
+
+/* RXE form instructions */
+{ "adb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x1a)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "aeb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x0a)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "cdb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x19)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ceb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x09)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ddb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x1d)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "deb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x0d)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "kdb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x18)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "keb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x08)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lde",    6, {RXEH(0xed,0,0,0,0), RXEL(0x24)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "ldeb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x04)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lxd",    6, {RXEH(0xed,0,0,0,0), RXEL(0x25)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lxdb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x05)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lxe",    6, {RXEH(0xed,0,0,0,0), RXEL(0x26)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "lxeb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x06)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mdb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x1c)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mdeb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x0c)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mee",    6, {RXEH(0xed,0,0,0,0), RXEL(0x37)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "meeb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x17)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "mxdb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x07)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sqd",    6, {RXEH(0xed,0,0,0,0), RXEL(0x35)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sqdb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x15)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sqe",    6, {RXEH(0xed,0,0,0,0), RXEL(0x34)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sqeb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x14)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "sdb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x1b)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "seb",    6, {RXEH(0xed,0,0,0,0), RXEL(0x0b)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "tcdb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x11)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "tceb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x10)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+{ "tcxb",   6, {RXEH(0xed,0,0,0,0), RXEL(0x12)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} },
+
+/* RXF form instructions */
+{ "madb",   6, {RXFH(0xed,0,0,0,0), RXFL(0x1e,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} },
+{ "maeb",   6, {RXFH(0xed,0,0,0,0), RXFL(0x0e,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} },
+{ "msdb",   6, {RXFH(0xed,0,0,0,0), RXFL(0x1f,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} },
+{ "mseb",   6, {RXFH(0xed,0,0,0,0), RXFL(0x0f,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} },
+
+/* RS form instructions */
+{ "bxh",    4, {RS(0x86,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "bxle",   4, {RS(0x87,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "cds",    4, {RS(0xbb,0,0,0,0), 0}, {RS_MASK, 0}, IXA,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "clcle",  4, {RS(0xa9,0,0,0,0), 0}, {RS_MASK, 0}, ICM,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "clm",    4, {RS(0xbd,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "cs",     4, {RS(0xba,0,0,0,0), 0}, {RS_MASK, 0}, IXA,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "icm",    4, {RS(0xbf,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "lam",    4, {RS(0x9a,0,0,0,0), 0}, {RS_MASK, 0}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "lctl",   4, {RS(0xb7,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "lm",     4, {RS(0x98,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "mvcle",  4, {RS(0xa8,0,0,0,0), 0}, {RS_MASK, 0}, ICM,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "sigp",   4, {RS(0xae,0,0,0,0), 0}, {RS_MASK, 0}, IXA,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "stam",   4, {RS(0x9b,0,0,0,0), 0}, {RS_MASK, 0}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "stcm",   4, {RS(0xbe,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "stctl",  4, {RS(0xb6,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "stm",    4, {RS(0x90,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} },
+{ "trace",  4, {RS(0x99,0,0,0,0), 0}, {RS_MASK, 0}, IXA,  {RX_R1, RS_R3, RS_D2, RS_B2} },
+
+/* RS form instructions with blank R3 and optional B2 (shift left/right) */
+{ "sla",    4, {RS(0x8b,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "slda",   4, {RS(0x8f,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "sldl",   4, {RS(0x8d,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "sll",    4, {RS(0x89,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "sra",    4, {RS(0x8a,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "srda",   4, {RS(0x8e,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "srdl",   4, {RS(0x8c,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+{ "srl",    4, {RS(0x88,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} },
+
+/* RSI form instructions */
+{ "brxh",   4, {RSI(0x84,0,0,0),  0}, {RSI_MASK, 0}, IIR,  {RSI_R1, RSI_R3, RSI_I2} },
+{ "brxle",  4, {RSI(0x85,0,0,0),  0}, {RSI_MASK, 0}, IIR,  {RSI_R1, RSI_R3, RSI_I2} },
+
+/* RI form instructions */
+{ "ahi",    4, {RI(0xa7a,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "bras",   4, {RI(0xa75,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "brc",    4, {RI(0xa74,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "brct",   4, {RI(0xa76,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "chi",    4, {RI(0xa7e,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "lhi",    4, {RI(0xa78,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "mhi",    4, {RI(0xa7c,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "tmh",    4, {RI(0xa70,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+{ "tml",    4, {RI(0xa71,0,0),    0}, {RI_MASK,  0}, IIR,  {RI_R1, RI_I2} },
+
+/* SI form instructions */
+{ "cli",    4, {SI(0x95,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "mc",     4, {SI(0xaf,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "mvi",    4, {SI(0x92,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "ni",     4, {SI(0x94,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "oi",     4, {SI(0x96,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "stnsm",  4, {SI(0xac,0,0,0),   0}, {SI_MASK,  0}, IXA,  {SI_D1, SI_B1, SI_I2} },
+{ "stosm",  4, {SI(0xad,0,0,0),   0}, {SI_MASK,  0}, IXA,  {SI_D1, SI_B1, SI_I2} },
+{ "tm",     4, {SI(0x91,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+{ "xi",     4, {SI(0x97,0,0,0),   0}, {SI_MASK,  0}, I370, {SI_D1, SI_B1, SI_I2} },
+
+/* S form instructions */
+{ "cfc",    4, {S(0xb21a,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "csch",   4, {S(0xb230,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "hsch",   4, {S(0xb231,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "ipk",    4, {S(0xb20b,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "lfpc",   4, {S(0xb29d,0,0),    0}, {S_MASK, 	 0}, IBF,  {S_D2, S_B2} },
+{ "lpsw",   4, {S(0x8200,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "msch",   4, {S(0xb232,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "pc",     4, {S(0xb218,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "pcf",    4, {S(0xb218,0,0),    0}, {S_MASK, 	 0}, IPC,  {S_D2, S_B2} },
+{ "ptlb",   4, {S(0xb20d,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "rchp",   4, {S(0xb23b,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "rp",     4, {S(0xb277,0,0),    0}, {S_MASK, 	 0}, IRP,  {0} },
+{ "rsch",   4, {S(0xb238,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "sac",    4, {S(0xb219,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "sacf",   4, {S(0xb279,0,0),    0}, {S_MASK, 	 0}, ISA,  {S_D2, S_B2} },
+{ "sal",    4, {S(0xb237,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "schm",   4, {S(0xb23c,0,0),    0}, {S_MASK, 	 0}, IXA,  {0} },
+{ "sck",    4, {S(0xb204,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "sckc",   4, {S(0xb206,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "spka",   4, {S(0xb20a,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "spt",    4, {S(0xb208,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "spx",    4, {S(0xb210,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "srnm",   4, {S(0xb299,0,0),    0}, {S_MASK, 	 0}, IBF,  {S_D2, S_B2} },
+{ "ssch",   4, {S(0xb233,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "ssm",    4, {S(0x8000,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "stap",   4, {S(0xb212,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stck",   4, {S(0xb205,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stckc",  4, {S(0xb207,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "stcps",  4, {S(0xb23a,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stcrw",  4, {S(0xb239,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stfpc",  4, {S(0xb29c,0,0),    0}, {S_MASK, 	 0}, IBF,  {S_D2, S_B2} },
+{ "stidp",  4, {S(0xb202,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "stpt",   4, {S(0xb209,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stpx",   4, {S(0xb211,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "stsch",  4, {S(0xb234,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "tpi",    4, {S(0xb236,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+{ "trap4",  4, {S(0xb2ff,0,0),    0}, {S_MASK, 	 0}, ITR,  {S_D2, S_B2} },
+{ "ts",     4, {S(0x9300,0,0),    0}, {S_MASK, 	 0}, I370, {S_D2, S_B2} },
+{ "tsch",   4, {S(0xb235,0,0),    0}, {S_MASK, 	 0}, IXA,  {S_D2, S_B2} },
+
+/* SS form instructions */
+{ "ap",     6, {SSH(0xfa,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "clc",    6, {SSH(0xd5,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "cp",     6, {SSH(0xf9,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "dp",     6, {SSH(0xfd,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "ed",     6, {SSH(0xde,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "edmk",   6, {SSH(0xdf,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvc",    6, {SSH(0xd2,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvcin",  6, {SSH(0xe8,0,0,0),  0}, {SS_MASK,  0}, IMI,  {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvck",   6, {SSH(0xd9,0,0,0),  0}, {SS_MASK,  0}, IXA,  {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvcp",   6, {SSH(0xda,0,0,0),  0}, {SS_MASK,  0}, IXA,  {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvcs",   6, {SSH(0xdb,0,0,0),  0}, {SS_MASK,  0}, IXA,  {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvn",    6, {SSH(0xd1,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvo",    6, {SSH(0xf1,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "mvz",    6, {SSH(0xd3,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "nc",     6, {SSH(0xd4,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "oc",     6, {SSH(0xd6,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "pack",   6, {SSH(0xf2,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "plo",    6, {SSH(0xee,0,0,0),  0}, {SS_MASK,  0}, IPL,  {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "sp",     6, {SSH(0xfb,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "srp",    6, {SSH(0xf0,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "tr",     6, {SSH(0xdc,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "trt",    6, {SSH(0xdd,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "unpk",   6, {SSH(0xf3,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "xc",     6, {SSH(0xd7,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+{ "zap",    6, {SSH(0xf8,0,0,0),  0}, {SS_MASK,  0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} },
+
+/* SSE form instructions */
+{ "lasp",   6, {SSEH(0xe500,0,0), 0}, {SSE_MASK, 0}, IXA,  {SS_D1, SS_B1, SS_D2, SS_B2} },
+{ "mvcdk",  6, {SSEH(0xe50f,0,0), 0}, {SSE_MASK, 0}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} },
+{ "mvcsk",  6, {SSEH(0xe50e,0,0), 0}, {SSE_MASK, 0}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} },
+{ "tprot",  6, {SSEH(0xe501,0,0), 0}, {SSE_MASK, 0}, IXA,  {SS_D1, SS_B1, SS_D2, SS_B2} },
+
+/* */
+};
+
+const int i370_num_opcodes =
+  sizeof (i370_opcodes) / sizeof (i370_opcodes[0]);
+
+/* The macro table.  This is only used by the assembler.  */
+
+const struct i370_macro i370_macros[] = {
+{ "b",     1,   I370,	"bc  15,%0" },
+{ "br",    1,   I370,	"bcr 15,%0" },
+
+{ "nop",   1,   I370,	"bc  0,%0" },
+{ "nopr",  1,   I370,	"bcr 0,%0" },
+
+{ "bh",    1,   I370,	"bc  2,%0" },
+{ "bhr",   1,   I370,	"bcr 2,%0" },
+{ "bl",    1,   I370,	"bc  4,%0" },
+{ "blr",   1,   I370,	"bcr 4,%0" },
+{ "be",    1,   I370,	"bc  8,%0" },
+{ "ber",   1,   I370,	"bcr 8,%0" },
+
+{ "bnh",    1,   I370,	"bc  13,%0" },
+{ "bnhr",   1,   I370,	"bcr 13,%0" },
+{ "bnl",    1,   I370,	"bc  11,%0" },
+{ "bnlr",   1,   I370,	"bcr 11,%0" },
+{ "bne",    1,   I370,	"bc  7,%0" },
+{ "bner",   1,   I370,	"bcr 7,%0" },
+
+{ "bp",    1,   I370,	"bc  2,%0" },
+{ "bpr",   1,   I370,	"bcr 2,%0" },
+{ "bm",    1,   I370,	"bc  4,%0" },
+{ "bmr",   1,   I370,	"bcr 4,%0" },
+{ "bz",    1,   I370,	"bc  8,%0" },
+{ "bzr",   1,   I370,	"bcr 8,%0" },
+{ "bo",    1,   I370,	"bc  1,%0" },
+{ "bor",   1,   I370,	"bcr 1,%0" },
+
+{ "bnp",    1,   I370,	"bc  13,%0" },
+{ "bnpr",   1,   I370,	"bcr 13,%0" },
+{ "bnm",    1,   I370,	"bc  11,%0" },
+{ "bnmr",   1,   I370,	"bcr 11,%0" },
+{ "bnz",    1,   I370,	"bc  7,%0" },
+{ "bnzr",   1,   I370,	"bcr 7,%0" },
+{ "bno",    1,   I370,	"bc  14,%0" },
+{ "bnor",   1,   I370,	"bcr 14,%0" },
+
+{ "sync",   0,   I370,	"bcr 15,0" },
+
+};
+
+const int i370_num_macros =
+  sizeof (i370_macros) / sizeof (i370_macros[0]);
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 19144cb..a75d6e3 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -47,7 +47,6 @@
 #define UNIXWARE_COMPAT 1
 #endif
 
-
 static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
 
 struct dis_private
@@ -59,6 +58,31 @@
   jmp_buf bailout;
 };
 
+/* The opcode for the fwait instruction, which we treat as a prefix
+   when we can.  */
+#define FWAIT_OPCODE (0x9b)
+
+/* Flags for the prefixes for the current instruction.  See below.  */
+static int prefixes;
+
+/* Flags for prefixes which we somehow handled when printing the
+   current instruction.  */
+static int used_prefixes;
+
+/* Flags stored in PREFIXES.  */
+#define PREFIX_REPZ 1
+#define PREFIX_REPNZ 2
+#define PREFIX_LOCK 4
+#define PREFIX_CS 8
+#define PREFIX_SS 0x10
+#define PREFIX_DS 0x20
+#define PREFIX_ES 0x40
+#define PREFIX_FS 0x80
+#define PREFIX_GS 0x100
+#define PREFIX_DATA 0x200
+#define PREFIX_ADDR 0x400
+#define PREFIX_FWAIT 0x800
+
 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
    to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
    on error.  */
@@ -81,7 +105,12 @@
 				      info);
   if (status != 0)
     {
-      (*info->memory_error_func) (status, start, info);
+      /* If we did manage to read at least one byte, then
+         print_insn_i386 will do something sensible.  Otherwise, print
+         an error.  We do that here because this is where we know
+         STATUS.  */
+      if (priv->max_fetched == priv->the_buffer)
+	(*info->memory_error_func) (status, start, info);
       longjmp (priv->bailout, 1);
     }
   else
@@ -89,28 +118,27 @@
   return 1;
 }
 
+#define XX NULL, 0
+
 #define Eb OP_E, b_mode
 #define indirEb OP_indirE, b_mode
 #define Gb OP_G, b_mode
 #define Ev OP_E, v_mode
+#define Ed OP_E, d_mode
 #define indirEv OP_indirE, v_mode
 #define Ew OP_E, w_mode
 #define Ma OP_E, v_mode
-#define M OP_E, 0
-#define Mp OP_E, 0		/* ? */
+#define M OP_E, 0		/* lea */
+#define Mp OP_E, 0		/* 32 or 48 bit memory operand for LDS, LES etc */
 #define Gv OP_G, v_mode
 #define Gw OP_G, w_mode
-#define Rw OP_rm, w_mode
-#define Rd OP_rm, d_mode
+#define Rd OP_Rd, d_mode
 #define Ib OP_I, b_mode
 #define sIb OP_sI, b_mode	/* sign extened byte */
 #define Iv OP_I, v_mode
 #define Iw OP_I, w_mode
 #define Jb OP_J, b_mode
 #define Jv OP_J, v_mode
-#if 0
-#define ONE OP_ONE, 0
-#endif
 #define Cd OP_C, d_mode
 #define Dd OP_D, d_mode
 #define Td OP_T, d_mode
@@ -136,8 +164,7 @@
 #define indirDX OP_REG, indir_dx_reg
 
 #define Sw OP_SEG, w_mode
-#define Ap OP_DIR, lptr
-#define Av OP_DIR, v_mode
+#define Ap OP_DIR, 0
 #define Ob OP_OFF, b_mode
 #define Ov OP_OFF, v_mode
 #define Xb OP_DSreg, eSI_reg
@@ -154,9 +181,13 @@
 #define gs OP_REG, gs_reg
 
 #define MX OP_MMX, 0
+#define XM OP_XMM, 0
 #define EM OP_EM, v_mode
-#define MS OP_MS, b_mode
+#define EX OP_EX, v_mode
+#define MS OP_MS, v_mode
+#define None OP_E, 0
 #define OPSUF OP_3DNowSuffix, 0
+#define OPSIMD OP_SIMD_Suffix, 0
 
 /* bits in sizeflag */
 #if 0 /* leave undefined until someone adds the extra flag to objdump */
@@ -165,7 +196,7 @@
 #define AFLAG 2
 #define DFLAG 1
 
-typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag ));
+typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
 
 static void OP_E PARAMS ((int, int));
 static void OP_G PARAMS ((int, int));
@@ -182,25 +213,28 @@
 static void OP_C PARAMS ((int, int));
 static void OP_D PARAMS ((int, int));
 static void OP_T PARAMS ((int, int));
-static void OP_rm PARAMS ((int, int));
+static void OP_Rd PARAMS ((int, int));
 static void OP_ST PARAMS ((int, int));
 static void OP_STi  PARAMS ((int, int));
-#if 0
-static void OP_ONE PARAMS ((int, int));
-#endif
 static void OP_MMX PARAMS ((int, int));
+static void OP_XMM PARAMS ((int, int));
 static void OP_EM PARAMS ((int, int));
+static void OP_EX PARAMS ((int, int));
 static void OP_MS PARAMS ((int, int));
 static void OP_3DNowSuffix PARAMS ((int, int));
+static void OP_SIMD_Suffix PARAMS ((int, int));
+static void SIMD_Fixup PARAMS ((int, int));
 
 static void append_seg PARAMS ((void));
 static void set_op PARAMS ((unsigned int op));
-static void putop PARAMS ((char *template, int sizeflag));
+static void putop PARAMS ((const char *template, int sizeflag));
 static void dofloat PARAMS ((int sizeflag));
 static int get16 PARAMS ((void));
 static int get32 PARAMS ((void));
 static void ckprefix PARAMS ((void));
+static const char *prefix_name PARAMS ((int, int));
 static void ptr_reg PARAMS ((int, int));
+static void BadOp PARAMS ((void));
 
 #define b_mode 1
 #define v_mode 2
@@ -214,16 +248,15 @@
 #define ds_reg 103
 #define fs_reg 104
 #define gs_reg 105
-#define eAX_reg 107
-#define eCX_reg 108
-#define eDX_reg 109
-#define eBX_reg 110
-#define eSP_reg 111
-#define eBP_reg 112
-#define eSI_reg 113
-#define eDI_reg 114
 
-#define lptr 115
+#define eAX_reg 108
+#define eCX_reg 109
+#define eDX_reg 110
+#define eBX_reg 111
+#define eSP_reg 112
+#define eBP_reg 113
+#define eSI_reg 114
+#define eDI_reg 115
 
 #define al_reg 116
 #define cl_reg 117
@@ -245,34 +278,54 @@
 
 #define indir_dx_reg 150
 
-#define GRP1b NULL, NULL, 0
-#define GRP1S NULL, NULL, 1
-#define GRP1Ss NULL, NULL, 2
-#define GRP2b NULL, NULL, 3
-#define GRP2S NULL, NULL, 4
-#define GRP2b_one NULL, NULL, 5
-#define GRP2S_one NULL, NULL, 6
-#define GRP2b_cl NULL, NULL, 7
-#define GRP2S_cl NULL, NULL, 8
-#define GRP3b NULL, NULL, 9
-#define GRP3S NULL, NULL, 10
-#define GRP4  NULL, NULL, 11
-#define GRP5  NULL, NULL, 12
-#define GRP6  NULL, NULL, 13
-#define GRP7 NULL, NULL, 14
-#define GRP8 NULL, NULL, 15
-#define GRP9 NULL, NULL, 16
-#define GRP10 NULL, NULL, 17
-#define GRP11 NULL, NULL, 18
-#define GRP12 NULL, NULL, 19
-#define GRP13 NULL, NULL, 20
-#define GRP14 NULL, NULL, 21
+#define USE_GROUPS 1
+#define USE_PREFIX_USER_TABLE 2
+
+#define GRP1b NULL, NULL, 0, NULL, USE_GROUPS, NULL, 0
+#define GRP1S NULL, NULL, 1, NULL, USE_GROUPS, NULL, 0
+#define GRP1Ss NULL, NULL, 2, NULL, USE_GROUPS, NULL, 0
+#define GRP2b NULL, NULL, 3, NULL, USE_GROUPS, NULL, 0
+#define GRP2S NULL, NULL, 4, NULL, USE_GROUPS, NULL, 0
+#define GRP2b_one NULL, NULL, 5, NULL, USE_GROUPS, NULL, 0
+#define GRP2S_one NULL, NULL, 6, NULL, USE_GROUPS, NULL, 0
+#define GRP2b_cl NULL, NULL, 7, NULL, USE_GROUPS, NULL, 0
+#define GRP2S_cl NULL, NULL, 8, NULL, USE_GROUPS, NULL, 0
+#define GRP3b NULL, NULL, 9, NULL, USE_GROUPS, NULL, 0
+#define GRP3S NULL, NULL, 10, NULL, USE_GROUPS, NULL, 0
+#define GRP4  NULL, NULL, 11, NULL, USE_GROUPS, NULL, 0
+#define GRP5  NULL, NULL, 12, NULL, USE_GROUPS, NULL, 0
+#define GRP6  NULL, NULL, 13, NULL, USE_GROUPS, NULL, 0
+#define GRP7 NULL, NULL, 14, NULL, USE_GROUPS, NULL, 0
+#define GRP8 NULL, NULL, 15, NULL, USE_GROUPS, NULL, 0
+#define GRP9 NULL, NULL, 16, NULL, USE_GROUPS, NULL, 0
+#define GRP10 NULL, NULL, 17, NULL, USE_GROUPS, NULL, 0
+#define GRP11 NULL, NULL, 18, NULL, USE_GROUPS, NULL, 0
+#define GRP12 NULL, NULL, 19, NULL, USE_GROUPS, NULL, 0
+#define GRP13 NULL, NULL, 20, NULL, USE_GROUPS, NULL, 0
+#define GRP14 NULL, NULL, 21, NULL, USE_GROUPS, NULL, 0
+#define GRPAMD NULL, NULL, 22, NULL, USE_GROUPS, NULL, 0
+
+#define PREGRP0 NULL, NULL, 0, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP1 NULL, NULL, 1, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP2 NULL, NULL, 2, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP3 NULL, NULL, 3, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP4 NULL, NULL, 4, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP5 NULL, NULL, 5, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP6 NULL, NULL, 6, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP7 NULL, NULL, 7, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP8 NULL, NULL, 8, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP9 NULL, NULL, 9, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP10 NULL, NULL, 10, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP11 NULL, NULL, 11, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP12 NULL, NULL, 12, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP13 NULL, NULL, 13, NULL, USE_PREFIX_USER_TABLE, NULL, 0
+#define PREGRP14 NULL, NULL, 14, NULL, USE_PREFIX_USER_TABLE, NULL, 0
 
 #define FLOATCODE 50
-#define FLOAT NULL, NULL, FLOATCODE
+#define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
 
 struct dis386 {
-  char *name;
+  const char *name;
   op_rtn op1;
   int bytemode1;
   op_rtn op2;
@@ -290,255 +343,255 @@
    'P' => print 'w' or 'l' if instruction has an operand size prefix,
                               or suffix_always is true
    'Q' => print 'w' or 'l' if no register operands or suffix_always is true
-   'R' => print 'w' or 'l'
+   'R' => print 'w' or 'l' ("wd" or "dq" in intel mode)
    'S' => print 'w' or 'l' if suffix_always is true
-   'W' => print 'b' or 'w'
+   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
 */
 
-static struct dis386 dis386_att[] = {
+static const struct dis386 dis386_att[] = {
   /* 00 */
-  { "addB",	Eb, Gb },
-  { "addS",	Ev, Gv },
-  { "addB",	Gb, Eb },
-  { "addS",	Gv, Ev },
-  { "addB",	AL, Ib },
-  { "addS",	eAX, Iv },
-  { "pushP",	es },
-  { "popP",	es },
+  { "addB",	Eb, Gb, XX },
+  { "addS",	Ev, Gv, XX },
+  { "addB",	Gb, Eb, XX },
+  { "addS",	Gv, Ev, XX },
+  { "addB",	AL, Ib, XX },
+  { "addS",	eAX, Iv, XX },
+  { "pushP",	es, XX, XX },
+  { "popP",	es, XX, XX },
   /* 08 */
-  { "orB",	Eb, Gb },
-  { "orS",	Ev, Gv },
-  { "orB",	Gb, Eb },
-  { "orS",	Gv, Ev },
-  { "orB",	AL, Ib },
-  { "orS",	eAX, Iv },
-  { "pushP",	cs },
-  { "(bad)" },	/* 0x0f extended opcode escape */
+  { "orB",	Eb, Gb, XX },
+  { "orS",	Ev, Gv, XX },
+  { "orB",	Gb, Eb, XX },
+  { "orS",	Gv, Ev, XX },
+  { "orB",	AL, Ib, XX },
+  { "orS",	eAX, Iv, XX },
+  { "pushP",	cs, XX, XX },
+  { "(bad)",	XX, XX, XX },	/* 0x0f extended opcode escape */
   /* 10 */
-  { "adcB",	Eb, Gb },
-  { "adcS",	Ev, Gv },
-  { "adcB",	Gb, Eb },
-  { "adcS",	Gv, Ev },
-  { "adcB",	AL, Ib },
-  { "adcS",	eAX, Iv },
-  { "pushP",	ss },
-  { "popP",	ss },
+  { "adcB",	Eb, Gb, XX },
+  { "adcS",	Ev, Gv, XX },
+  { "adcB",	Gb, Eb, XX },
+  { "adcS",	Gv, Ev, XX },
+  { "adcB",	AL, Ib, XX },
+  { "adcS",	eAX, Iv, XX },
+  { "pushP",	ss, XX, XX },
+  { "popP",	ss, XX, XX },
   /* 18 */
-  { "sbbB",	Eb, Gb },
-  { "sbbS",	Ev, Gv },
-  { "sbbB",	Gb, Eb },
-  { "sbbS",	Gv, Ev },
-  { "sbbB",	AL, Ib },
-  { "sbbS",	eAX, Iv },
-  { "pushP",	ds },
-  { "popP",	ds },
+  { "sbbB",	Eb, Gb, XX },
+  { "sbbS",	Ev, Gv, XX },
+  { "sbbB",	Gb, Eb, XX },
+  { "sbbS",	Gv, Ev, XX },
+  { "sbbB",	AL, Ib, XX },
+  { "sbbS",	eAX, Iv, XX },
+  { "pushP",	ds, XX, XX },
+  { "popP",	ds, XX, XX },
   /* 20 */
-  { "andB",	Eb, Gb },
-  { "andS",	Ev, Gv },
-  { "andB",	Gb, Eb },
-  { "andS",	Gv, Ev },
-  { "andB",	AL, Ib },
-  { "andS",	eAX, Iv },
-  { "(bad)" },			/* SEG ES prefix */
-  { "daa" },
+  { "andB",	Eb, Gb, XX },
+  { "andS",	Ev, Gv, XX },
+  { "andB",	Gb, Eb, XX },
+  { "andS",	Gv, Ev, XX },
+  { "andB",	AL, Ib, XX },
+  { "andS",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG ES prefix */
+  { "daa",	XX, XX, XX },
   /* 28 */
-  { "subB",	Eb, Gb },
-  { "subS",	Ev, Gv },
-  { "subB",	Gb, Eb },
-  { "subS",	Gv, Ev },
-  { "subB",	AL, Ib },
-  { "subS",	eAX, Iv },
-  { "(bad)" },			/* SEG CS prefix */
-  { "das" },
+  { "subB",	Eb, Gb, XX },
+  { "subS",	Ev, Gv, XX },
+  { "subB",	Gb, Eb, XX },
+  { "subS",	Gv, Ev, XX },
+  { "subB",	AL, Ib, XX },
+  { "subS",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG CS prefix */
+  { "das",	XX, XX, XX },
   /* 30 */
-  { "xorB",	Eb, Gb },
-  { "xorS",	Ev, Gv },
-  { "xorB",	Gb, Eb },
-  { "xorS",	Gv, Ev },
-  { "xorB",	AL, Ib },
-  { "xorS",	eAX, Iv },
-  { "(bad)" },			/* SEG SS prefix */
-  { "aaa" },
+  { "xorB",	Eb, Gb, XX },
+  { "xorS",	Ev, Gv, XX },
+  { "xorB",	Gb, Eb, XX },
+  { "xorS",	Gv, Ev, XX },
+  { "xorB",	AL, Ib, XX },
+  { "xorS",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG SS prefix */
+  { "aaa",	XX, XX, XX },
   /* 38 */
-  { "cmpB",	Eb, Gb },
-  { "cmpS",	Ev, Gv },
-  { "cmpB",	Gb, Eb },
-  { "cmpS",	Gv, Ev },
-  { "cmpB",	AL, Ib },
-  { "cmpS",	eAX, Iv },
-  { "(bad)" },			/* SEG DS prefix */
-  { "aas" },
+  { "cmpB",	Eb, Gb, XX },
+  { "cmpS",	Ev, Gv, XX },
+  { "cmpB",	Gb, Eb, XX },
+  { "cmpS",	Gv, Ev, XX },
+  { "cmpB",	AL, Ib, XX },
+  { "cmpS",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG DS prefix */
+  { "aas",	XX, XX, XX },
   /* 40 */
-  { "incS",	eAX },
-  { "incS",	eCX },
-  { "incS",	eDX },
-  { "incS",	eBX },
-  { "incS",	eSP },
-  { "incS",	eBP },
-  { "incS",	eSI },
-  { "incS",	eDI },
+  { "incS",	eAX, XX, XX },
+  { "incS",	eCX, XX, XX },
+  { "incS",	eDX, XX, XX },
+  { "incS",	eBX, XX, XX },
+  { "incS",	eSP, XX, XX },
+  { "incS",	eBP, XX, XX },
+  { "incS",	eSI, XX, XX },
+  { "incS",	eDI, XX, XX },
   /* 48 */
-  { "decS",	eAX },
-  { "decS",	eCX },
-  { "decS",	eDX },
-  { "decS",	eBX },
-  { "decS",	eSP },
-  { "decS",	eBP },
-  { "decS",	eSI },
-  { "decS",	eDI },
+  { "decS",	eAX, XX, XX },
+  { "decS",	eCX, XX, XX },
+  { "decS",	eDX, XX, XX },
+  { "decS",	eBX, XX, XX },
+  { "decS",	eSP, XX, XX },
+  { "decS",	eBP, XX, XX },
+  { "decS",	eSI, XX, XX },
+  { "decS",	eDI, XX, XX },
   /* 50 */
-  { "pushS",	eAX },
-  { "pushS",	eCX },
-  { "pushS",	eDX },
-  { "pushS",	eBX },
-  { "pushS",	eSP },
-  { "pushS",	eBP },
-  { "pushS",	eSI },
-  { "pushS",	eDI },
+  { "pushS",	eAX, XX, XX },
+  { "pushS",	eCX, XX, XX },
+  { "pushS",	eDX, XX, XX },
+  { "pushS",	eBX, XX, XX },
+  { "pushS",	eSP, XX, XX },
+  { "pushS",	eBP, XX, XX },
+  { "pushS",	eSI, XX, XX },
+  { "pushS",	eDI, XX, XX },
   /* 58 */
-  { "popS",	eAX },
-  { "popS",	eCX },
-  { "popS",	eDX },
-  { "popS",	eBX },
-  { "popS",	eSP },
-  { "popS",	eBP },
-  { "popS",	eSI },
-  { "popS",	eDI },
+  { "popS",	eAX, XX, XX },
+  { "popS",	eCX, XX, XX },
+  { "popS",	eDX, XX, XX },
+  { "popS",	eBX, XX, XX },
+  { "popS",	eSP, XX, XX },
+  { "popS",	eBP, XX, XX },
+  { "popS",	eSI, XX, XX },
+  { "popS",	eDI, XX, XX },
   /* 60 */
-  { "pushaP" },
-  { "popaP" },
-  { "boundS",	Gv, Ma },
-  { "arpl",	Ew, Gw },
-  { "(bad)" },			/* seg fs */
-  { "(bad)" },			/* seg gs */
-  { "(bad)" },			/* op size prefix */
-  { "(bad)" },			/* adr size prefix */
+  { "pushaP",	XX, XX, XX },
+  { "popaP",	XX, XX, XX },
+  { "boundS",	Gv, Ma, XX },
+  { "arpl",	Ew, Gw, XX },
+  { "(bad)",	XX, XX, XX },			/* seg fs */
+  { "(bad)",	XX, XX, XX },			/* seg gs */
+  { "(bad)",	XX, XX, XX },			/* op size prefix */
+  { "(bad)",	XX, XX, XX },			/* adr size prefix */
   /* 68 */
-  { "pushP",	Iv },		/* 386 book wrong */
+  { "pushP",	Iv, XX, XX },		/* 386 book wrong */
   { "imulS",	Gv, Ev, Iv },
-  { "pushP",	sIb },		/* push of byte really pushes 2 or 4 bytes */
+  { "pushP",	sIb, XX, XX },	/* push of byte really pushes 2 or 4 bytes */
   { "imulS",	Gv, Ev, sIb },
-  { "insb",	Yb, indirDX },
-  { "insR",	Yv, indirDX },
-  { "outsb",	indirDX, Xb },
-  { "outsR",	indirDX, Xv },
+  { "insb",	Yb, indirDX, XX },
+  { "insR",	Yv, indirDX, XX },
+  { "outsb",	indirDX, Xb, XX },
+  { "outsR",	indirDX, Xv, XX },
   /* 70 */
-  { "jo",	Jb },
-  { "jno",	Jb },
-  { "jb",	Jb },
-  { "jae",	Jb },
-  { "je",	Jb },
-  { "jne",	Jb },
-  { "jbe",	Jb },
-  { "ja",	Jb },
+  { "jo",	Jb, XX, XX },
+  { "jno",	Jb, XX, XX },
+  { "jb",	Jb, XX, XX },
+  { "jae",	Jb, XX, XX },
+  { "je",	Jb, XX, XX },
+  { "jne",	Jb, XX, XX },
+  { "jbe",	Jb, XX, XX },
+  { "ja",	Jb, XX, XX },
   /* 78 */
-  { "js",	Jb },
-  { "jns",	Jb },
-  { "jp",	Jb },
-  { "jnp",	Jb },
-  { "jl",	Jb },
-  { "jge",	Jb },
-  { "jle",	Jb },
-  { "jg",	Jb },
+  { "js",	Jb, XX, XX },
+  { "jns",	Jb, XX, XX },
+  { "jp",	Jb, XX, XX },
+  { "jnp",	Jb, XX, XX },
+  { "jl",	Jb, XX, XX },
+  { "jge",	Jb, XX, XX },
+  { "jle",	Jb, XX, XX },
+  { "jg",	Jb, XX, XX },
   /* 80 */
   { GRP1b },
   { GRP1S },
-  { "(bad)" },
+  { "(bad)",	XX, XX, XX },
   { GRP1Ss },
-  { "testB",	Eb, Gb },
-  { "testS",	Ev, Gv },
-  { "xchgB",	Eb, Gb },
-  { "xchgS",	Ev, Gv },
+  { "testB",	Eb, Gb, XX },
+  { "testS",	Ev, Gv, XX },
+  { "xchgB",	Eb, Gb, XX },
+  { "xchgS",	Ev, Gv, XX },
   /* 88 */
-  { "movB",	Eb, Gb },
-  { "movS",	Ev, Gv },
-  { "movB",	Gb, Eb },
-  { "movS",	Gv, Ev },
-  { "movQ",	Ev, Sw },
-  { "leaS",	Gv, M },
-  { "movQ",	Sw, Ev },
-  { "popQ",	Ev },
+  { "movB",	Eb, Gb, XX },
+  { "movS",	Ev, Gv, XX },
+  { "movB",	Gb, Eb, XX },
+  { "movS",	Gv, Ev, XX },
+  { "movQ",	Ev, Sw, XX },
+  { "leaS",	Gv, M, XX },
+  { "movQ",	Sw, Ev, XX },
+  { "popQ",	Ev, XX, XX },
   /* 90 */
-  { "nop" },
-  { "xchgS",	eCX, eAX },
-  { "xchgS",	eDX, eAX },
-  { "xchgS",	eBX, eAX },
-  { "xchgS",	eSP, eAX },
-  { "xchgS",	eBP, eAX },
-  { "xchgS",	eSI, eAX },
-  { "xchgS",	eDI, eAX },
+  { "nop",	XX, XX, XX },
+  { "xchgS",	eCX, eAX, XX },
+  { "xchgS",	eDX, eAX, XX },
+  { "xchgS",	eBX, eAX, XX },
+  { "xchgS",	eSP, eAX, XX },
+  { "xchgS",	eBP, eAX, XX },
+  { "xchgS",	eSI, eAX, XX },
+  { "xchgS",	eDI, eAX, XX },
   /* 98 */
-  { "cWtR" },
-  { "cRtd" },
-  { "lcallP",	Ap },
-  { "(bad)" },		/* fwait */
-  { "pushfP" },
-  { "popfP" },
-  { "sahf" },
-  { "lahf" },
+  { "cWtR",	XX, XX, XX },
+  { "cRtd",	XX, XX, XX },
+  { "lcallP",	Ap, XX, XX },
+  { "(bad)",	XX, XX, XX },		/* fwait */
+  { "pushfP",	XX, XX, XX },
+  { "popfP",	XX, XX, XX },
+  { "sahf",	XX, XX, XX },
+  { "lahf",	XX, XX, XX },
   /* a0 */
-  { "movB",	AL, Ob },
-  { "movS",	eAX, Ov },
-  { "movB",	Ob, AL },
-  { "movS",	Ov, eAX },
-  { "movsb",	Yb, Xb },
-  { "movsR",	Yv, Xv },
-  { "cmpsb",	Xb, Yb },
-  { "cmpsR",	Xv, Yv },
+  { "movB",	AL, Ob, XX },
+  { "movS",	eAX, Ov, XX },
+  { "movB",	Ob, AL, XX },
+  { "movS",	Ov, eAX, XX },
+  { "movsb",	Yb, Xb, XX },
+  { "movsR",	Yv, Xv, XX },
+  { "cmpsb",	Xb, Yb, XX },
+  { "cmpsR",	Xv, Yv, XX },
   /* a8 */
-  { "testB",	AL, Ib },
-  { "testS",	eAX, Iv },
-  { "stosB",	Yb, AL },
-  { "stosS",	Yv, eAX },
-  { "lodsB",	AL, Xb },
-  { "lodsS",	eAX, Xv },
-  { "scasB",	AL, Yb },
-  { "scasS",	eAX, Yv },
+  { "testB",	AL, Ib, XX },
+  { "testS",	eAX, Iv, XX },
+  { "stosB",	Yb, AL, XX },
+  { "stosS",	Yv, eAX, XX },
+  { "lodsB",	AL, Xb, XX },
+  { "lodsS",	eAX, Xv, XX },
+  { "scasB",	AL, Yb, XX },
+  { "scasS",	eAX, Yv, XX },
   /* b0 */
-  { "movB",	AL, Ib },
-  { "movB",	CL, Ib },
-  { "movB",	DL, Ib },
-  { "movB",	BL, Ib },
-  { "movB",	AH, Ib },
-  { "movB",	CH, Ib },
-  { "movB",	DH, Ib },
-  { "movB",	BH, Ib },
+  { "movB",	AL, Ib, XX },
+  { "movB",	CL, Ib, XX },
+  { "movB",	DL, Ib, XX },
+  { "movB",	BL, Ib, XX },
+  { "movB",	AH, Ib, XX },
+  { "movB",	CH, Ib, XX },
+  { "movB",	DH, Ib, XX },
+  { "movB",	BH, Ib, XX },
   /* b8 */
-  { "movS",	eAX, Iv },
-  { "movS",	eCX, Iv },
-  { "movS",	eDX, Iv },
-  { "movS",	eBX, Iv },
-  { "movS",	eSP, Iv },
-  { "movS",	eBP, Iv },
-  { "movS",	eSI, Iv },
-  { "movS",	eDI, Iv },
+  { "movS",	eAX, Iv, XX },
+  { "movS",	eCX, Iv, XX },
+  { "movS",	eDX, Iv, XX },
+  { "movS",	eBX, Iv, XX },
+  { "movS",	eSP, Iv, XX },
+  { "movS",	eBP, Iv, XX },
+  { "movS",	eSI, Iv, XX },
+  { "movS",	eDI, Iv, XX },
   /* c0 */
   { GRP2b },
   { GRP2S },
-  { "retP",	Iw },
-  { "retP" },
-  { "lesS",	Gv, Mp },
-  { "ldsS",	Gv, Mp },
-  { "movA",	Eb, Ib },
-  { "movQ",	Ev, Iv },
+  { "retP",	Iw, XX, XX },
+  { "retP",	XX, XX, XX },
+  { "lesS",	Gv, Mp, XX },
+  { "ldsS",	Gv, Mp, XX },
+  { "movA",	Eb, Ib, XX },
+  { "movQ",	Ev, Iv, XX },
   /* c8 */
-  { "enterP",	Iw, Ib },
-  { "leaveP" },
-  { "lretP",	Iw },
-  { "lretP" },
-  { "int3" },
-  { "int",	Ib },
-  { "into" },
-  { "iretP" },
+  { "enterP",	Iw, Ib, XX },
+  { "leaveP",	XX, XX, XX },
+  { "lretP",	Iw, XX, XX },
+  { "lretP",	XX, XX, XX },
+  { "int3",	XX, XX, XX },
+  { "int",	Ib, XX, XX },
+  { "into",	XX, XX, XX},
+  { "iretP",	XX, XX, XX },
   /* d0 */
   { GRP2b_one },
   { GRP2S_one },
   { GRP2b_cl },
   { GRP2S_cl },
-  { "aam",	sIb },
-  { "aad",	sIb },
-  { "(bad)" },
-  { "xlat",	DSBX },
+  { "aam",	sIb, XX, XX },
+  { "aad",	sIb, XX, XX },
+  { "(bad)",	XX, XX, XX },
+  { "xlat",	DSBX, XX, XX },
   /* d8 */
   { FLOAT },
   { FLOAT },
@@ -549,287 +602,287 @@
   { FLOAT },
   { FLOAT },
   /* e0 */
-  { "loopne",	Jb },
-  { "loope",	Jb },
-  { "loop",	Jb },
-  { "jEcxz",	Jb },
-  { "inB",	AL, Ib },
-  { "inS",	eAX, Ib },
-  { "outB",	Ib, AL },
-  { "outS",	Ib, eAX },
+  { "loopne",	Jb, XX, XX },
+  { "loope",	Jb, XX, XX },
+  { "loop",	Jb, XX, XX },
+  { "jEcxz",	Jb, XX, XX },
+  { "inB",	AL, Ib, XX },
+  { "inS",	eAX, Ib, XX },
+  { "outB",	Ib, AL, XX },
+  { "outS",	Ib, eAX, XX },
   /* e8 */
-  { "callP",	Av },
-  { "jmpP",	Jv },
-  { "ljmpP",	Ap },
-  { "jmp",	Jb },
-  { "inB",	AL, indirDX },
-  { "inS",	eAX, indirDX },
-  { "outB",	indirDX, AL },
-  { "outS",	indirDX, eAX },
+  { "callP",	Jv, XX, XX },
+  { "jmpP",	Jv, XX, XX },
+  { "ljmpP",	Ap, XX, XX },
+  { "jmp",	Jb, XX, XX },
+  { "inB",	AL, indirDX, XX },
+  { "inS",	eAX, indirDX, XX },
+  { "outB",	indirDX, AL, XX },
+  { "outS",	indirDX, eAX, XX },
   /* f0 */
-  { "(bad)" },			/* lock prefix */
-  { "(bad)" },
-  { "(bad)" },			/* repne */
-  { "(bad)" },			/* repz */
-  { "hlt" },
-  { "cmc" },
+  { "(bad)",	XX, XX, XX },			/* lock prefix */
+  { "(bad)",	XX, XX, XX },
+  { "(bad)",	XX, XX, XX },			/* repne */
+  { "(bad)",	XX, XX, XX },			/* repz */
+  { "hlt",	XX, XX, XX },
+  { "cmc",	XX, XX, XX },
   { GRP3b },
   { GRP3S },
   /* f8 */
-  { "clc" },
-  { "stc" },
-  { "cli" },
-  { "sti" },
-  { "cld" },
-  { "std" },
+  { "clc",	XX, XX, XX },
+  { "stc",	XX, XX, XX },
+  { "cli",	XX, XX, XX },
+  { "sti",	XX, XX, XX },
+  { "cld",	XX, XX, XX },
+  { "std",	XX, XX, XX },
   { GRP4 },
   { GRP5 },
 };
 
-static struct dis386 dis386_intel[] = {
+static const struct dis386 dis386_intel[] = {
   /* 00 */
-  { "addB",	Eb, Gb },
-  { "addS",	Ev, Gv },
-  { "addB",	Gb, Eb },
-  { "addS",	Gv, Ev },
-  { "addB",	AL, Ib },
-  { "addS",	eAX, Iv },
-  { "pushP",	es },
-  { "popP",	es },
+  { "add",	Eb, Gb, XX },
+  { "add",	Ev, Gv, XX },
+  { "add",	Gb, Eb, XX },
+  { "add",	Gv, Ev, XX },
+  { "add",	AL, Ib, XX },
+  { "add",	eAX, Iv, XX },
+  { "push",	es, XX, XX },
+  { "pop",	es, XX, XX },
   /* 08 */
-  { "orB",	Eb, Gb },
-  { "orS",	Ev, Gv },
-  { "orB",	Gb, Eb },
-  { "orS",	Gv, Ev },
-  { "orB",	AL, Ib },
-  { "orS",	eAX, Iv },
-  { "pushP",	cs },
-  { "(bad)" },	/* 0x0f extended opcode escape */
+  { "or",	Eb, Gb, XX },
+  { "or",	Ev, Gv, XX },
+  { "or",	Gb, Eb, XX },
+  { "or",	Gv, Ev, XX },
+  { "or",	AL, Ib, XX },
+  { "or",	eAX, Iv, XX },
+  { "push",	cs, XX, XX },
+  { "(bad)",	XX, XX, XX },	/* 0x0f extended opcode escape */
   /* 10 */
-  { "adcB",	Eb, Gb },
-  { "adcS",	Ev, Gv },
-  { "adcB",	Gb, Eb },
-  { "adcS",	Gv, Ev },
-  { "adcB",	AL, Ib },
-  { "adcS",	eAX, Iv },
-  { "pushP",	ss },
-  { "popP",	ss },
+  { "adc",	Eb, Gb, XX },
+  { "adc",	Ev, Gv, XX },
+  { "adc",	Gb, Eb, XX },
+  { "adc",	Gv, Ev, XX },
+  { "adc",	AL, Ib, XX },
+  { "adc",	eAX, Iv, XX },
+  { "push",	ss, XX, XX },
+  { "pop",	ss, XX, XX },
   /* 18 */
-  { "sbbB",	Eb, Gb },
-  { "sbbS",	Ev, Gv },
-  { "sbbB",	Gb, Eb },
-  { "sbbS",	Gv, Ev },
-  { "sbbB",	AL, Ib },
-  { "sbbS",	eAX, Iv },
-  { "pushP",	ds },
-  { "popP",	ds },
+  { "sbb",	Eb, Gb, XX },
+  { "sbb",	Ev, Gv, XX },
+  { "sbb",	Gb, Eb, XX },
+  { "sbb",	Gv, Ev, XX },
+  { "sbb",	AL, Ib, XX },
+  { "sbb",	eAX, Iv, XX },
+  { "push",	ds, XX, XX },
+  { "pop",	ds, XX, XX },
   /* 20 */
-  { "andB",	Eb, Gb },
-  { "andS",	Ev, Gv },
-  { "andB",	Gb, Eb },
-  { "andS",	Gv, Ev },
-  { "andB",	AL, Ib },
-  { "andS",	eAX, Iv },
-  { "(bad)" },			/* SEG ES prefix */
-  { "daa" },
+  { "and",	Eb, Gb, XX },
+  { "and",	Ev, Gv, XX },
+  { "and",	Gb, Eb, XX },
+  { "and",	Gv, Ev, XX },
+  { "and",	AL, Ib, XX },
+  { "and",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG ES prefix */
+  { "daa",	XX, XX, XX },
   /* 28 */
-  { "subB",	Eb, Gb },
-  { "subS",	Ev, Gv },
-  { "subB",	Gb, Eb },
-  { "subS",	Gv, Ev },
-  { "subB",	AL, Ib },
-  { "subS",	eAX, Iv },
-  { "(bad)" },			/* SEG CS prefix */
-  { "das" },
+  { "sub",	Eb, Gb, XX },
+  { "sub",	Ev, Gv, XX },
+  { "sub",	Gb, Eb, XX },
+  { "sub",	Gv, Ev, XX },
+  { "sub",	AL, Ib, XX },
+  { "sub",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG CS prefix */
+  { "das",	XX, XX, XX },
   /* 30 */
-  { "xorB",	Eb, Gb },
-  { "xorS",	Ev, Gv },
-  { "xorB",	Gb, Eb },
-  { "xorS",	Gv, Ev },
-  { "xorB",	AL, Ib },
-  { "xorS",	eAX, Iv },
-  { "(bad)" },			/* SEG SS prefix */
-  { "aaa" },
+  { "xor",	Eb, Gb, XX },
+  { "xor",	Ev, Gv, XX },
+  { "xor",	Gb, Eb, XX },
+  { "xor",	Gv, Ev, XX },
+  { "xor",	AL, Ib, XX },
+  { "xor",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG SS prefix */
+  { "aaa",	XX, XX, XX },
   /* 38 */
-  { "cmpB",	Eb, Gb },
-  { "cmpS",	Ev, Gv },
-  { "cmpB",	Gb, Eb },
-  { "cmpS",	Gv, Ev },
-  { "cmpB",	AL, Ib },
-  { "cmpS",	eAX, Iv },
-  { "(bad)" },			/* SEG DS prefix */
-  { "aas" },
+  { "cmp",	Eb, Gb, XX },
+  { "cmp",	Ev, Gv, XX },
+  { "cmp",	Gb, Eb, XX },
+  { "cmp",	Gv, Ev, XX },
+  { "cmp",	AL, Ib, XX },
+  { "cmp",	eAX, Iv, XX },
+  { "(bad)",	XX, XX, XX },			/* SEG DS prefix */
+  { "aas",	XX, XX, XX },
   /* 40 */
-  { "incS",	eAX },
-  { "incS",	eCX },
-  { "incS",	eDX },
-  { "incS",	eBX },
-  { "incS",	eSP },
-  { "incS",	eBP },
-  { "incS",	eSI },
-  { "incS",	eDI },
+  { "inc",	eAX, XX, XX },
+  { "inc",	eCX, XX, XX },
+  { "inc",	eDX, XX, XX },
+  { "inc",	eBX, XX, XX },
+  { "inc",	eSP, XX, XX },
+  { "inc",	eBP, XX, XX },
+  { "inc",	eSI, XX, XX },
+  { "inc",	eDI, XX, XX },
   /* 48 */
-  { "decS",	eAX },
-  { "decS",	eCX },
-  { "decS",	eDX },
-  { "decS",	eBX },
-  { "decS",	eSP },
-  { "decS",	eBP },
-  { "decS",	eSI },
-  { "decS",	eDI },
+  { "dec",	eAX, XX, XX },
+  { "dec",	eCX, XX, XX },
+  { "dec",	eDX, XX, XX },
+  { "dec",	eBX, XX, XX },
+  { "dec",	eSP, XX, XX },
+  { "dec",	eBP, XX, XX },
+  { "dec",	eSI, XX, XX },
+  { "dec",	eDI, XX, XX },
   /* 50 */
-  { "pushS",	eAX },
-  { "pushS",	eCX },
-  { "pushS",	eDX },
-  { "pushS",	eBX },
-  { "pushS",	eSP },
-  { "pushS",	eBP },
-  { "pushS",	eSI },
-  { "pushS",	eDI },
+  { "push",	eAX, XX, XX },
+  { "push",	eCX, XX, XX },
+  { "push",	eDX, XX, XX },
+  { "push",	eBX, XX, XX },
+  { "push",	eSP, XX, XX },
+  { "push",	eBP, XX, XX },
+  { "push",	eSI, XX, XX },
+  { "push",	eDI, XX, XX },
   /* 58 */
-  { "popS",	eAX },
-  { "popS",	eCX },
-  { "popS",	eDX },
-  { "popS",	eBX },
-  { "popS",	eSP },
-  { "popS",	eBP },
-  { "popS",	eSI },
-  { "popS",	eDI },
+  { "pop",	eAX, XX, XX },
+  { "pop",	eCX, XX, XX },
+  { "pop",	eDX, XX, XX },
+  { "pop",	eBX, XX, XX },
+  { "pop",	eSP, XX, XX },
+  { "pop",	eBP, XX, XX },
+  { "pop",	eSI, XX, XX },
+  { "pop",	eDI, XX, XX },
   /* 60 */
-  { "pushaP" },
-  { "popaP" },
-  { "boundS",	Gv, Ma },
-  { "arpl",	Ew, Gw },
-  { "(bad)" },			/* seg fs */
-  { "(bad)" },			/* seg gs */
-  { "(bad)" },			/* op size prefix */
-  { "(bad)" },			/* adr size prefix */
+  { "pusha",	XX, XX, XX },
+  { "popa",	XX, XX, XX },
+  { "bound",	Gv, Ma, XX },
+  { "arpl",	Ew, Gw, XX },
+  { "(bad)",	XX, XX, XX },			/* seg fs */
+  { "(bad)",	XX, XX, XX },			/* seg gs */
+  { "(bad)",	XX, XX, XX },			/* op size prefix */
+  { "(bad)",	XX, XX, XX },			/* adr size prefix */
   /* 68 */
-  { "pushP",	Iv },		/* 386 book wrong */
-  { "imulS",	Gv, Ev, Iv },
-  { "pushP",	sIb },		/* push of byte really pushes 2 or 4 bytes */
-  { "imulS",	Gv, Ev, sIb },
-  { "insb",	Yb, indirDX },
-  { "insR",	Yv, indirDX },
-  { "outsb",	indirDX, Xb },
-  { "outsR",	indirDX, Xv },
+  { "push",	Iv, XX, XX },		/* 386 book wrong */
+  { "imul",	Gv, Ev, Iv },
+  { "push",	sIb, XX, XX },	/* push of byte really pushes 2 or 4 bytes */
+  { "imul",	Gv, Ev, sIb },
+  { "ins",	Yb, indirDX, XX },
+  { "ins",	Yv, indirDX, XX },
+  { "outs",	indirDX, Xb, XX },
+  { "outs",	indirDX, Xv, XX },
   /* 70 */
-  { "jo",	Jb },
-  { "jno",	Jb },
-  { "jb",	Jb },
-  { "jae",	Jb },
-  { "je",	Jb },
-  { "jne",	Jb },
-  { "jbe",	Jb },
-  { "ja",	Jb },
+  { "jo",	Jb, XX, XX },
+  { "jno",	Jb, XX, XX },
+  { "jb",	Jb, XX, XX },
+  { "jae",	Jb, XX, XX },
+  { "je",	Jb, XX, XX },
+  { "jne",	Jb, XX, XX },
+  { "jbe",	Jb, XX, XX },
+  { "ja",	Jb, XX, XX },
   /* 78 */
-  { "js",	Jb },
-  { "jns",	Jb },
-  { "jp",	Jb },
-  { "jnp",	Jb },
-  { "jl",	Jb },
-  { "jge",	Jb },
-  { "jle",	Jb },
-  { "jg",	Jb },
+  { "js",	Jb, XX, XX },
+  { "jns",	Jb, XX, XX },
+  { "jp",	Jb, XX, XX },
+  { "jnp",	Jb, XX, XX },
+  { "jl",	Jb, XX, XX },
+  { "jge",	Jb, XX, XX },
+  { "jle",	Jb, XX, XX },
+  { "jg",	Jb, XX, XX },
   /* 80 */
   { GRP1b },
   { GRP1S },
-  { "(bad)" },
+  { "(bad)",	XX, XX, XX },
   { GRP1Ss },
-  { "testB",	Eb, Gb },
-  { "testS",	Ev, Gv },
-  { "xchgB",	Eb, Gb },
-  { "xchgS",	Ev, Gv },
+  { "test",	Eb, Gb, XX },
+  { "test",	Ev, Gv, XX },
+  { "xchg",	Eb, Gb, XX },
+  { "xchg",	Ev, Gv, XX },
   /* 88 */
-  { "movB",	Eb, Gb },
-  { "movS",	Ev, Gv },
-  { "movB",	Gb, Eb },
-  { "movS",	Gv, Ev },
-  { "movQ",	Ev, Sw },
-  { "leaS",	Gv, M },
-  { "movQ",	Sw, Ev },
-  { "popQ",	Ev },
+  { "mov",	Eb, Gb, XX },
+  { "mov",	Ev, Gv, XX },
+  { "mov",	Gb, Eb, XX },
+  { "mov",	Gv, Ev, XX },
+  { "mov",	Ev, Sw, XX },
+  { "lea",	Gv, M, XX },
+  { "mov",	Sw, Ev, XX },
+  { "pop",	Ev, XX, XX },
   /* 90 */
-  { "nop" },
-  { "xchgS",	eCX, eAX },
-  { "xchgS",	eDX, eAX },
-  { "xchgS",	eBX, eAX },
-  { "xchgS",	eSP, eAX },
-  { "xchgS",	eBP, eAX },
-  { "xchgS",	eSI, eAX },
-  { "xchgS",	eDI, eAX },
+  { "nop",	XX, XX, XX },
+  { "xchg",	eCX, eAX, XX },
+  { "xchg",	eDX, eAX, XX },
+  { "xchg",	eBX, eAX, XX },
+  { "xchg",	eSP, eAX, XX },
+  { "xchg",	eBP, eAX, XX },
+  { "xchg",	eSI, eAX, XX },
+  { "xchg",	eDI, eAX, XX },
   /* 98 */
-  { "cWtR" },
-  { "cRtd" },
-  { "lcallP",	Ap },
-  { "(bad)" },		/* fwait */
-  { "pushfP" },
-  { "popfP" },
-  { "sahf" },
-  { "lahf" },
+  { "cW",	XX, XX, XX },		/* cwde and cbw */
+  { "cR",	XX, XX, XX },		/* cdq and cwd */
+  { "lcall",	Ap, XX, XX },
+  { "(bad)",	XX, XX, XX },		/* fwait */
+  { "pushf",	XX, XX, XX },
+  { "popf",	XX, XX, XX },
+  { "sahf",	XX, XX, XX },
+  { "lahf",	XX, XX, XX },
   /* a0 */
-  { "movB",	AL, Ob },
-  { "movS",	eAX, Ov },
-  { "movB",	Ob, AL },
-  { "movS",	Ov, eAX },
-  { "movsb",	Yb, Xb },
-  { "movsR",	Yv, Xv },
-  { "cmpsb",	Xb, Yb },
-  { "cmpsR",	Xv, Yv },
+  { "mov",	AL, Ob, XX },
+  { "mov",	eAX, Ov, XX },
+  { "mov",	Ob, AL, XX },
+  { "mov",	Ov, eAX, XX },
+  { "movs",	Yb, Xb, XX },
+  { "movs",	Yv, Xv, XX },
+  { "cmps",	Xb, Yb, XX },
+  { "cmps",	Xv, Yv, XX },
   /* a8 */
-  { "testB",	AL, Ib },
-  { "testS",	eAX, Iv },
-  { "stosB",	Yb, AL },
-  { "stosS",	Yv, eAX },
-  { "lodsB",	AL, Xb },
-  { "lodsS",	eAX, Xv },
-  { "scasB",	AL, Yb },
-  { "scasS",	eAX, Yv },
+  { "test",	AL, Ib, XX },
+  { "test",	eAX, Iv, XX },
+  { "stos",	Yb, AL, XX },
+  { "stos",	Yv, eAX, XX },
+  { "lods",	AL, Xb, XX },
+  { "lods",	eAX, Xv, XX },
+  { "scas",	AL, Yb, XX },
+  { "scas",	eAX, Yv, XX },
   /* b0 */
-  { "movB",	AL, Ib },
-  { "movB",	CL, Ib },
-  { "movB",	DL, Ib },
-  { "movB",	BL, Ib },
-  { "movB",	AH, Ib },
-  { "movB",	CH, Ib },
-  { "movB",	DH, Ib },
-  { "movB",	BH, Ib },
+  { "mov",	AL, Ib, XX },
+  { "mov",	CL, Ib, XX },
+  { "mov",	DL, Ib, XX },
+  { "mov",	BL, Ib, XX },
+  { "mov",	AH, Ib, XX },
+  { "mov",	CH, Ib, XX },
+  { "mov",	DH, Ib, XX },
+  { "mov",	BH, Ib, XX },
   /* b8 */
-  { "movS",	eAX, Iv },
-  { "movS",	eCX, Iv },
-  { "movS",	eDX, Iv },
-  { "movS",	eBX, Iv },
-  { "movS",	eSP, Iv },
-  { "movS",	eBP, Iv },
-  { "movS",	eSI, Iv },
-  { "movS",	eDI, Iv },
+  { "mov",	eAX, Iv, XX },
+  { "mov",	eCX, Iv, XX },
+  { "mov",	eDX, Iv, XX },
+  { "mov",	eBX, Iv, XX },
+  { "mov",	eSP, Iv, XX },
+  { "mov",	eBP, Iv, XX },
+  { "mov",	eSI, Iv, XX },
+  { "mov",	eDI, Iv, XX },
   /* c0 */
   { GRP2b },
   { GRP2S },
-  { "retP",	Iw },
-  { "retP" },
-  { "lesS",	Gv, Mp },
-  { "ldsS",	Gv, Mp },
-  { "movA",	Eb, Ib },
-  { "movQ",	Ev, Iv },
+  { "ret",	Iw, XX, XX },
+  { "ret",	XX, XX, XX },
+  { "les",	Gv, Mp, XX },
+  { "lds",	Gv, Mp, XX },
+  { "mov",	Eb, Ib, XX },
+  { "mov",	Ev, Iv, XX },
   /* c8 */
-  { "enterP",	Iw, Ib },
-  { "leaveP" },
-  { "lretP",	Iw },
-  { "lretP" },
-  { "int3" },
-  { "int",	Ib },
-  { "into" },
-  { "iretP" },
+  { "enter",	Iw, Ib, XX },
+  { "leave",	XX, XX, XX },
+  { "lret",	Iw, XX, XX },
+  { "lret",	XX, XX, XX },
+  { "int3",	XX, XX, XX },
+  { "int",	Ib, XX, XX },
+  { "into",	XX, XX, XX },
+  { "iret",	XX, XX, XX },
   /* d0 */
   { GRP2b_one },
   { GRP2S_one },
   { GRP2b_cl },
   { GRP2S_cl },
-  { "aam",	sIb },
-  { "aad",	sIb },
-  { "(bad)" },
-  { "xlat",	DSBX },
+  { "aam",	sIb, XX, XX },
+  { "aad",	sIb, XX, XX },
+  { "(bad)",	XX, XX, XX },
+  { "xlat",	DSBX, XX, XX },
   /* d8 */
   { FLOAT },
   { FLOAT },
@@ -840,539 +893,694 @@
   { FLOAT },
   { FLOAT },
   /* e0 */
-  { "loopne",	Jb },
-  { "loope",	Jb },
-  { "loop",	Jb },
-  { "jEcxz",	Jb },
-  { "inB",	AL, Ib },
-  { "inS",	eAX, Ib },
-  { "outB",	Ib, AL },
-  { "outS",	Ib, eAX },
+  { "loopne",	Jb, XX, XX },
+  { "loope",	Jb, XX, XX },
+  { "loop",	Jb, XX, XX },
+  { "jEcxz",	Jb, XX, XX },
+  { "in",	AL, Ib, XX },
+  { "in",	eAX, Ib, XX },
+  { "out",	Ib, AL, XX },
+  { "out",	Ib, eAX, XX },
   /* e8 */
-  { "callP",	Av },
-  { "jmpP",	Jv },
-  { "ljmpP",	Ap },
-  { "jmp",	Jb },
-  { "inB",	AL, indirDX },
-  { "inS",	eAX, indirDX },
-  { "outB",	indirDX, AL },
-  { "outS",	indirDX, eAX },
+  { "call",	Jv, XX, XX },
+  { "jmp",	Jv, XX, XX },
+  { "ljmp",	Ap, XX, XX },
+  { "jmp",	Jb, XX, XX },
+  { "in",	AL, indirDX, XX },
+  { "in",	eAX, indirDX, XX },
+  { "out",	indirDX, AL, XX },
+  { "out",	indirDX, eAX, XX },
   /* f0 */
-  { "(bad)" },			/* lock prefix */
-  { "(bad)" },
-  { "(bad)" },			/* repne */
-  { "(bad)" },			/* repz */
-  { "hlt" },
-  { "cmc" },
+  { "(bad)",	XX, XX, XX },			/* lock prefix */
+  { "(bad)",	XX, XX, XX },
+  { "(bad)",	XX, XX, XX },			/* repne */
+  { "(bad)",	XX, XX, XX },			/* repz */
+  { "hlt",	XX, XX, XX },
+  { "cmc",	XX, XX, XX },
   { GRP3b },
   { GRP3S },
   /* f8 */
-  { "clc" },
-  { "stc" },
-  { "cli" },
-  { "sti" },
-  { "cld" },
-  { "std" },
+  { "clc",	XX, XX, XX },
+  { "stc",	XX, XX, XX },
+  { "cli",	XX, XX, XX },
+  { "sti",	XX, XX, XX },
+  { "cld",	XX, XX, XX },
+  { "std",	XX, XX, XX },
   { GRP4 },
   { GRP5 },
 };
 
-static struct dis386 dis386_twobyte_att[] = {
+static const struct dis386 dis386_twobyte_att[] = {
   /* 00 */
   { GRP6 },
   { GRP7 },
-  { "larS", Gv, Ew },
-  { "lslS", Gv, Ew },
-  { "(bad)" },
-  { "(bad)" },
-  { "clts" },
-  { "(bad)" },
+  { "larS", Gv, Ew, XX },
+  { "lslS", Gv, Ew, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "clts", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 08 */
-  { "invd" },
-  { "wbinvd" },
-  { "(bad)" },
-  { "ud2a" },
-  { "(bad)" },
-  { GRP14 },
-  { "femms" },
+  { "invd", XX, XX, XX },
+  { "wbinvd", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "ud2a", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { GRPAMD },
+  { "femms", XX, XX, XX },
   { "", MX, EM, OPSUF }, /* See OP_3DNowSuffix */
   /* 10 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { PREGRP8 },
+  { PREGRP9 },
+  { "movlps", XM, EX, SIMD_Fixup, 'h' },  /* really only 2 operands */
+  { "movlps", EX, XM, SIMD_Fixup, 'h' },
+  { "unpcklps", XM, EX, XX },
+  { "unpckhps", XM, EX, XX },
+  { "movhps", XM, EX, SIMD_Fixup, 'l' },
+  { "movhps", EX, XM, SIMD_Fixup, 'l' },
   /* 18 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { GRP14 },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 20 */
   /* these are all backward in appendix A of the intel book */
-  { "movL", Rd, Cd },
-  { "movL", Rd, Dd },
-  { "movL", Cd, Rd },
-  { "movL", Dd, Rd },
-  { "movL", Rd, Td },
-  { "(bad)" },
-  { "movL", Td, Rd },
-  { "(bad)" },
+  { "movL", Rd, Cd, XX },
+  { "movL", Rd, Dd, XX },
+  { "movL", Cd, Rd, XX },
+  { "movL", Dd, Rd, XX },
+  { "movL", Rd, Td, XX },
+  { "(bad)", XX, XX, XX },
+  { "movL", Td, Rd, XX },
+  { "(bad)", XX, XX, XX },
   /* 28 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "movaps", XM, EX, XX },
+  { "movaps", EX, XM, XX },
+  { PREGRP2 },
+  { "movntps", Ev, XM, XX },
+  { PREGRP4 },
+  { PREGRP3 },
+  { "ucomiss", XM, EX, XX },
+  { "comiss", XM, EX, XX },
   /* 30 */
-  { "wrmsr" },  { "rdtsc" },  { "rdmsr" },  { "rdpmc" },
-  { "sysenter" },  { "sysexit" },  { "(bad)" },  { "(bad)" },
+  { "wrmsr", XX, XX, XX },
+  { "rdtsc", XX, XX, XX },
+  { "rdmsr", XX, XX, XX },
+  { "rdpmc", XX, XX, XX },
+  { "sysenter", XX, XX, XX },
+  { "sysexit", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 38 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 40 */
-  { "cmovo", Gv,Ev }, { "cmovno", Gv,Ev }, { "cmovb", Gv,Ev }, { "cmovae", Gv,Ev },
-  { "cmove", Gv,Ev }, { "cmovne", Gv,Ev }, { "cmovbe", Gv,Ev }, { "cmova", Gv,Ev },
+  { "cmovo", Gv, Ev, XX },
+  { "cmovno", Gv, Ev, XX },
+  { "cmovb", Gv, Ev, XX },
+  { "cmovae", Gv, Ev, XX },
+  { "cmove", Gv, Ev, XX },
+  { "cmovne", Gv, Ev, XX },
+  { "cmovbe", Gv, Ev, XX },
+  { "cmova", Gv, Ev, XX },
   /* 48 */
-  { "cmovs", Gv,Ev }, { "cmovns", Gv,Ev }, { "cmovp", Gv,Ev }, { "cmovnp", Gv,Ev },
-  { "cmovl", Gv,Ev }, { "cmovge", Gv,Ev }, { "cmovle", Gv,Ev }, { "cmovg", Gv,Ev },
+  { "cmovs", Gv, Ev, XX },
+  { "cmovns", Gv, Ev, XX },
+  { "cmovp", Gv, Ev, XX },
+  { "cmovnp", Gv, Ev, XX },
+  { "cmovl", Gv, Ev, XX },
+  { "cmovge", Gv, Ev, XX },
+  { "cmovle", Gv, Ev, XX },
+  { "cmovg", Gv, Ev, XX },
   /* 50 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "movmskps", Gv, EX, XX },
+  { PREGRP13 },
+  { PREGRP12 },
+  { PREGRP11 },
+  { "andps", XM, EX, XX },
+  { "andnps", XM, EX, XX },
+  { "orps", XM, EX, XX },
+  { "xorps", XM, EX, XX },
   /* 58 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { PREGRP0 },
+  { PREGRP10 },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { PREGRP14 },
+  { PREGRP7 },
+  { PREGRP5 },
+  { PREGRP6 },
   /* 60 */
-  { "punpcklbw", MX, EM },
-  { "punpcklwd", MX, EM },
-  { "punpckldq", MX, EM },
-  { "packsswb", MX, EM },
-  { "pcmpgtb", MX, EM },
-  { "pcmpgtw", MX, EM },
-  { "pcmpgtd", MX, EM },
-  { "packuswb", MX, EM },
+  { "punpcklbw", MX, EM, XX },
+  { "punpcklwd", MX, EM, XX },
+  { "punpckldq", MX, EM, XX },
+  { "packsswb", MX, EM, XX },
+  { "pcmpgtb", MX, EM, XX },
+  { "pcmpgtw", MX, EM, XX },
+  { "pcmpgtd", MX, EM, XX },
+  { "packuswb", MX, EM, XX },
   /* 68 */
-  { "punpckhbw", MX, EM },
-  { "punpckhwd", MX, EM },
-  { "punpckhdq", MX, EM },
-  { "packssdw", MX, EM },
-  { "(bad)" },  { "(bad)" },
-  { "movd", MX, Ev },
-  { "movq", MX, EM },
+  { "punpckhbw", MX, EM, XX },
+  { "punpckhwd", MX, EM, XX },
+  { "punpckhdq", MX, EM, XX },
+  { "packssdw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "movd", MX, Ed, XX },
+  { "movq", MX, EM, XX },
   /* 70 */
-  { "(bad)" },
+  { "pshufw", MX, EM, Ib },
   { GRP10 },
   { GRP11 },
   { GRP12 },
-  { "pcmpeqb", MX, EM },
-  { "pcmpeqw", MX, EM },
-  { "pcmpeqd", MX, EM },
-  { "emms" },
+  { "pcmpeqb", MX, EM, XX },
+  { "pcmpeqw", MX, EM, XX },
+  { "pcmpeqd", MX, EM, XX },
+  { "emms", XX, XX, XX },
   /* 78 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },
-  { "movd", Ev, MX },
-  { "movq", EM, MX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "movd", Ed, MX, XX },
+  { "movq", EM, MX, XX },
   /* 80 */
-  { "jo", Jv },
-  { "jno", Jv },
-  { "jb", Jv },
-  { "jae", Jv },
-  { "je", Jv },
-  { "jne", Jv },
-  { "jbe", Jv },
-  { "ja", Jv },
+  { "jo", Jv, XX, XX },
+  { "jno", Jv, XX, XX },
+  { "jb", Jv, XX, XX },
+  { "jae", Jv, XX, XX },
+  { "je", Jv, XX, XX },
+  { "jne", Jv, XX, XX },
+  { "jbe", Jv, XX, XX },
+  { "ja", Jv, XX, XX },
   /* 88 */
-  { "js", Jv },
-  { "jns", Jv },
-  { "jp", Jv },
-  { "jnp", Jv },
-  { "jl", Jv },
-  { "jge", Jv },
-  { "jle", Jv },
-  { "jg", Jv },
+  { "js", Jv, XX, XX },
+  { "jns", Jv, XX, XX },
+  { "jp", Jv, XX, XX },
+  { "jnp", Jv, XX, XX },
+  { "jl", Jv, XX, XX },
+  { "jge", Jv, XX, XX },
+  { "jle", Jv, XX, XX },
+  { "jg", Jv, XX, XX },
   /* 90 */
-  { "seto", Eb },
-  { "setno", Eb },
-  { "setb", Eb },
-  { "setae", Eb },
-  { "sete", Eb },
-  { "setne", Eb },
-  { "setbe", Eb },
-  { "seta", Eb },
+  { "seto", Eb, XX, XX },
+  { "setno", Eb, XX, XX },
+  { "setb", Eb, XX, XX },
+  { "setae", Eb, XX, XX },
+  { "sete", Eb, XX, XX },
+  { "setne", Eb, XX, XX },
+  { "setbe", Eb, XX, XX },
+  { "seta", Eb, XX, XX },
   /* 98 */
-  { "sets", Eb },
-  { "setns", Eb },
-  { "setp", Eb },
-  { "setnp", Eb },
-  { "setl", Eb },
-  { "setge", Eb },
-  { "setle", Eb },
-  { "setg", Eb },
+  { "sets", Eb, XX, XX },
+  { "setns", Eb, XX, XX },
+  { "setp", Eb, XX, XX },
+  { "setnp", Eb, XX, XX },
+  { "setl", Eb, XX, XX },
+  { "setge", Eb, XX, XX },
+  { "setle", Eb, XX, XX },
+  { "setg", Eb, XX, XX },
   /* a0 */
-  { "pushP", fs },
-  { "popP", fs },
-  { "cpuid" },
-  { "btS", Ev, Gv },
+  { "pushP", fs, XX, XX },
+  { "popP", fs, XX, XX },
+  { "cpuid", XX, XX, XX },
+  { "btS", Ev, Gv, XX },
   { "shldS", Ev, Gv, Ib },
   { "shldS", Ev, Gv, CL },
-  { "(bad)" },
-  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* a8 */
-  { "pushP", gs },
-  { "popP", gs },
-  { "rsm" },
-  { "btsS", Ev, Gv },
+  { "pushP", gs, XX, XX },
+  { "popP", gs, XX, XX },
+  { "rsm", XX, XX, XX },
+  { "btsS", Ev, Gv, XX },
   { "shrdS", Ev, Gv, Ib },
   { "shrdS", Ev, Gv, CL },
   { GRP13 },
-  { "imulS", Gv, Ev },
+  { "imulS", Gv, Ev, XX },
   /* b0 */
-  { "cmpxchgB", Eb, Gb },
-  { "cmpxchgS", Ev, Gv },
-  { "lssS", Gv, Mp },	/* 386 lists only Mp */
-  { "btrS", Ev, Gv },
-  { "lfsS", Gv, Mp },	/* 386 lists only Mp */
-  { "lgsS", Gv, Mp },	/* 386 lists only Mp */
-  { "movzbR", Gv, Eb },
-  { "movzwR", Gv, Ew }, /* yes, there really is movzww ! */
+  { "cmpxchgB", Eb, Gb, XX },
+  { "cmpxchgS", Ev, Gv, XX },
+  { "lssS", Gv, Mp, XX },
+  { "btrS", Ev, Gv, XX },
+  { "lfsS", Gv, Mp, XX },
+  { "lgsS", Gv, Mp, XX },
+  { "movzbR", Gv, Eb, XX },
+  { "movzwR", Gv, Ew, XX }, /* yes, there really is movzww ! */
   /* b8 */
-  { "(bad)" },
-  { "ud2b" },
+  { "(bad)", XX, XX, XX },
+  { "ud2b", XX, XX, XX },
   { GRP8 },
-  { "btcS", Ev, Gv },
-  { "bsfS", Gv, Ev },
-  { "bsrS", Gv, Ev },
-  { "movsbR", Gv, Eb },
-  { "movswR", Gv, Ew }, /* yes, there really is movsww ! */
+  { "btcS", Ev, Gv, XX },
+  { "bsfS", Gv, Ev, XX },
+  { "bsrS", Gv, Ev, XX },
+  { "movsbR", Gv, Eb, XX },
+  { "movswR", Gv, Ew, XX }, /* yes, there really is movsww ! */
   /* c0 */
-  { "xaddB", Eb, Gb },
-  { "xaddS", Ev, Gv },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
+  { "xaddB", Eb, Gb, XX },
+  { "xaddS", Ev, Gv, XX },
+  { PREGRP1 },
+  { "(bad)", XX, XX, XX },
+  { "pinsrw", MX, Ev, Ib },
+  { "pextrw", Ev, MX, Ib },
+  { "shufps", XM, EX, Ib },
   { GRP9 },
   /* c8 */
-  { "bswap", eAX },	/* bswap doesn't support 16 bit regs */
-  { "bswap", eCX },
-  { "bswap", eDX },
-  { "bswap", eBX },
-  { "bswap", eSP },
-  { "bswap", eBP },
-  { "bswap", eSI },
-  { "bswap", eDI },
+  { "bswap", eAX, XX, XX },	/* bswap doesn't support 16 bit regs */
+  { "bswap", eCX, XX, XX },
+  { "bswap", eDX, XX, XX },
+  { "bswap", eBX, XX, XX },
+  { "bswap", eSP, XX, XX },
+  { "bswap", eBP, XX, XX },
+  { "bswap", eSI, XX, XX },
+  { "bswap", eDI, XX, XX },
   /* d0 */
-  { "(bad)" },
-  { "psrlw", MX, EM },
-  { "psrld", MX, EM },
-  { "psrlq", MX, EM },
-  { "(bad)" },
-  { "pmullw", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "psrlw", MX, EM, XX },
+  { "psrld", MX, EM, XX },
+  { "psrlq", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmullw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmovmskb", Ev, MX, XX },
   /* d8 */
-  { "psubusb", MX, EM },
-  { "psubusw", MX, EM },
-  { "(bad)" },
-  { "pand", MX, EM },
-  { "paddusb", MX, EM },
-  { "paddusw", MX, EM },
-  { "(bad)" },
-  { "pandn", MX, EM },
+  { "psubusb", MX, EM, XX },
+  { "psubusw", MX, EM, XX },
+  { "pminub", MX, EM, XX },
+  { "pand", MX, EM, XX },
+  { "paddusb", MX, EM, XX },
+  { "paddusw", MX, EM, XX },
+  { "pmaxub", MX, EM, XX },
+  { "pandn", MX, EM, XX },
   /* e0 */
-  { "(bad)" },
-  { "psraw", MX, EM },
-  { "psrad", MX, EM },
-  { "(bad)" },
-  { "(bad)" },
-  { "pmulhw", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "pavgb", MX, EM, XX },
+  { "psraw", MX, EM, XX },
+  { "psrad", MX, EM, XX },
+  { "pavgw", MX, EM, XX },
+  { "pmulhuw", MX, EM, XX },
+  { "pmulhw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "movntq", Ev, MX, XX },
   /* e8 */
-  { "psubsb", MX, EM },
-  { "psubsw", MX, EM },
-  { "(bad)" },
-  { "por", MX, EM },
-  { "paddsb", MX, EM },
-  { "paddsw", MX, EM },
-  { "(bad)" },
-  { "pxor", MX, EM },
+  { "psubsb", MX, EM, XX },
+  { "psubsw", MX, EM, XX },
+  { "pminsw", MX, EM, XX },
+  { "por", MX, EM, XX },
+  { "paddsb", MX, EM, XX },
+  { "paddsw", MX, EM, XX },
+  { "pmaxsw", MX, EM, XX },
+  { "pxor", MX, EM, XX },
   /* f0 */
-  { "(bad)" },
-  { "psllw", MX, EM },
-  { "pslld", MX, EM },
-  { "psllq", MX, EM },
-  { "(bad)" },
-  { "pmaddwd", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "psllw", MX, EM, XX },
+  { "pslld", MX, EM, XX },
+  { "psllq", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmaddwd", MX, EM, XX },
+  { "psadbw", MX, EM, XX },
+  { "maskmovq", MX, EM, XX },
   /* f8 */
-  { "psubb", MX, EM },
-  { "psubw", MX, EM },
-  { "psubd", MX, EM },
-  { "(bad)" },
-  { "paddb", MX, EM },
-  { "paddw", MX, EM },
-  { "paddd", MX, EM },
-  { "(bad)" }
+  { "psubb", MX, EM, XX },
+  { "psubw", MX, EM, XX },
+  { "psubd", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "paddb", MX, EM, XX },
+  { "paddw", MX, EM, XX },
+  { "paddd", MX, EM, XX },
+  { "(bad)", XX, XX, XX }
 };
 
-static struct dis386 dis386_twobyte_intel[] = {
+static const struct dis386 dis386_twobyte_intel[] = {
   /* 00 */
   { GRP6 },
   { GRP7 },
-  { "larS", Gv, Ew },
-  { "lslS", Gv, Ew },
-  { "(bad)" },
-  { "(bad)" },
-  { "clts" },
-  { "(bad)" },
+  { "lar", Gv, Ew, XX },
+  { "lsl", Gv, Ew, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "clts", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 08 */
-  { "invd" },
-  { "wbinvd" },
-  { "(bad)" },
-  { "ud2a" },
-  { "(bad)" },
-  { GRP14 },
-  { "femms" },
+  { "invd", XX, XX, XX },
+  { "wbinvd", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "ud2a", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { GRPAMD },
+  { "femms" , XX, XX, XX},
   { "", MX, EM, OPSUF }, /* See OP_3DNowSuffix */
   /* 10 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { PREGRP8 },
+  { PREGRP9 },
+  { "movlps", XM, EX, SIMD_Fixup, 'h' },  /* really only 2 operands */
+  { "movlps", EX, XM, SIMD_Fixup, 'h' },
+  { "unpcklps", XM, EX, XX },
+  { "unpckhps", XM, EX, XX },
+  { "movhps", XM, EX, SIMD_Fixup, 'l' },
+  { "movhps", EX, XM, SIMD_Fixup, 'l' },
   /* 18 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { GRP14 },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 20 */
   /* these are all backward in appendix A of the intel book */
-  { "movL", Rd, Cd },
-  { "movL", Rd, Dd },
-  { "movL", Cd, Rd },
-  { "movL", Dd, Rd },
-  { "movL", Rd, Td },
-  { "(bad)" },
-  { "movL", Td, Rd },
-  { "(bad)" },
+  { "mov", Rd, Cd, XX },
+  { "mov", Rd, Dd, XX },
+  { "mov", Cd, Rd, XX },
+  { "mov", Dd, Rd, XX },
+  { "mov", Rd, Td, XX },
+  { "(bad)", XX, XX, XX },
+  { "mov", Td, Rd, XX },
+  { "(bad)", XX, XX, XX },
   /* 28 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "movaps", XM, EX, XX },
+  { "movaps", EX, XM, XX },
+  { PREGRP2 },
+  { "movntps", Ev, XM, XX },
+  { PREGRP4 },
+  { PREGRP3 },
+  { "ucomiss", XM, EX, XX },
+  { "comiss", XM, EX, XX },
   /* 30 */
-  { "wrmsr" },  { "rdtsc" },  { "rdmsr" },  { "rdpmc" },
-  { "sysenter" },  { "sysexit" },  { "(bad)" },  { "(bad)" },
+  { "wrmsr", XX, XX, XX },
+  { "rdtsc", XX, XX, XX },
+  { "rdmsr", XX, XX, XX },
+  { "rdpmc", XX, XX, XX },
+  { "sysenter", XX, XX, XX },
+  { "sysexit", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 38 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* 40 */
-  { "cmovo", Gv,Ev }, { "cmovno", Gv,Ev }, { "cmovb", Gv,Ev }, { "cmovae", Gv,Ev },
-  { "cmove", Gv,Ev }, { "cmovne", Gv,Ev }, { "cmovbe", Gv,Ev }, { "cmova", Gv,Ev },
+  { "cmovo", Gv, Ev, XX },
+  { "cmovno", Gv, Ev, XX },
+  { "cmovb", Gv, Ev, XX },
+  { "cmovae", Gv, Ev, XX },
+  { "cmove", Gv, Ev, XX },
+  { "cmovne", Gv, Ev, XX },
+  { "cmovbe", Gv, Ev, XX },
+  { "cmova", Gv, Ev, XX },
   /* 48 */
-  { "cmovs", Gv,Ev }, { "cmovns", Gv,Ev }, { "cmovp", Gv,Ev }, { "cmovnp", Gv,Ev },
-  { "cmovl", Gv,Ev }, { "cmovge", Gv,Ev }, { "cmovle", Gv,Ev }, { "cmovg", Gv,Ev },
+  { "cmovs", Gv, Ev, XX },
+  { "cmovns", Gv, Ev, XX },
+  { "cmovp", Gv, Ev, XX },
+  { "cmovnp", Gv, Ev, XX },
+  { "cmovl", Gv, Ev, XX },
+  { "cmovge", Gv, Ev, XX },
+  { "cmovle", Gv, Ev, XX },
+  { "cmovg", Gv, Ev, XX },
   /* 50 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { "movmskps", Gv, EX, XX },
+  { PREGRP13 },
+  { PREGRP12 },
+  { PREGRP11 },
+  { "andps", XM, EX, XX },
+  { "andnps", XM, EX, XX },
+  { "orps", XM, EX, XX },
+  { "xorps", XM, EX, XX },
   /* 58 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
+  { PREGRP0 },
+  { PREGRP10 },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { PREGRP14 },
+  { PREGRP7 },
+  { PREGRP5 },
+  { PREGRP6 },
   /* 60 */
-  { "punpcklbw", MX, EM },
-  { "punpcklwd", MX, EM },
-  { "punpckldq", MX, EM },
-  { "packsswb", MX, EM },
-  { "pcmpgtb", MX, EM },
-  { "pcmpgtw", MX, EM },
-  { "pcmpgtd", MX, EM },
-  { "packuswb", MX, EM },
+  { "punpcklbw", MX, EM, XX },
+  { "punpcklwd", MX, EM, XX },
+  { "punpckldq", MX, EM, XX },
+  { "packsswb", MX, EM, XX },
+  { "pcmpgtb", MX, EM, XX },
+  { "pcmpgtw", MX, EM, XX },
+  { "pcmpgtd", MX, EM, XX },
+  { "packuswb", MX, EM, XX },
   /* 68 */
-  { "punpckhbw", MX, EM },
-  { "punpckhwd", MX, EM },
-  { "punpckhdq", MX, EM },
-  { "packssdw", MX, EM },
-  { "(bad)" },  { "(bad)" },
-  { "movd", MX, Ev },
-  { "movq", MX, EM },
+  { "punpckhbw", MX, EM, XX },
+  { "punpckhwd", MX, EM, XX },
+  { "punpckhdq", MX, EM, XX },
+  { "packssdw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "movd", MX, Ed, XX },
+  { "movq", MX, EM, XX },
   /* 70 */
-  { "(bad)" },
+  { "pshufw", MX, EM, Ib },
   { GRP10 },
   { GRP11 },
   { GRP12 },
-  { "pcmpeqb", MX, EM },
-  { "pcmpeqw", MX, EM },
-  { "pcmpeqd", MX, EM },
-  { "emms" },
+  { "pcmpeqb", MX, EM, XX },
+  { "pcmpeqw", MX, EM, XX },
+  { "pcmpeqd", MX, EM, XX },
+  { "emms", XX, XX, XX },
   /* 78 */
-  { "(bad)" },  { "(bad)" },  { "(bad)" },  { "(bad)" },
-  { "(bad)" },  { "(bad)" },
-  { "movd", Ev, MX },
-  { "movq", EM, MX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
+  { "movd", Ed, MX, XX },
+  { "movq", EM, MX, XX },
   /* 80 */
-  { "jo", Jv },
-  { "jno", Jv },
-  { "jb", Jv },
-  { "jae", Jv },
-  { "je", Jv },
-  { "jne", Jv },
-  { "jbe", Jv },
-  { "ja", Jv },
+  { "jo", Jv, XX, XX },
+  { "jno", Jv, XX, XX },
+  { "jb", Jv, XX, XX },
+  { "jae", Jv, XX, XX },
+  { "je", Jv, XX, XX },
+  { "jne", Jv, XX, XX },
+  { "jbe", Jv, XX, XX },
+  { "ja", Jv, XX, XX },
   /* 88 */
-  { "js", Jv },
-  { "jns", Jv },
-  { "jp", Jv },
-  { "jnp", Jv },
-  { "jl", Jv },
-  { "jge", Jv },
-  { "jle", Jv },
-  { "jg", Jv },
+  { "js", Jv, XX, XX },
+  { "jns", Jv, XX, XX },
+  { "jp", Jv, XX, XX },
+  { "jnp", Jv, XX, XX },
+  { "jl", Jv, XX, XX },
+  { "jge", Jv, XX, XX },
+  { "jle", Jv, XX, XX },
+  { "jg", Jv, XX, XX },
   /* 90 */
-  { "seto", Eb },
-  { "setno", Eb },
-  { "setb", Eb },
-  { "setae", Eb },
-  { "sete", Eb },
-  { "setne", Eb },
-  { "setbe", Eb },
-  { "seta", Eb },
+  { "seto", Eb, XX, XX },
+  { "setno", Eb, XX, XX },
+  { "setb", Eb, XX, XX },
+  { "setae", Eb, XX, XX },
+  { "sete", Eb, XX, XX },
+  { "setne", Eb, XX, XX },
+  { "setbe", Eb, XX, XX },
+  { "seta", Eb, XX, XX },
   /* 98 */
-  { "sets", Eb },
-  { "setns", Eb },
-  { "setp", Eb },
-  { "setnp", Eb },
-  { "setl", Eb },
-  { "setge", Eb },
-  { "setle", Eb },
-  { "setg", Eb },
+  { "sets", Eb, XX, XX },
+  { "setns", Eb, XX, XX },
+  { "setp", Eb, XX, XX },
+  { "setnp", Eb, XX, XX },
+  { "setl", Eb, XX, XX },
+  { "setge", Eb, XX, XX },
+  { "setle", Eb, XX, XX },
+  { "setg", Eb, XX, XX },
   /* a0 */
-  { "pushP", fs },
-  { "popP", fs },
-  { "cpuid" },
-  { "btS", Ev, Gv },
-  { "shldS", Ev, Gv, Ib },
-  { "shldS", Ev, Gv, CL },
-  { "(bad)" },
-  { "(bad)" },
+  { "push", fs, XX, XX },
+  { "pop", fs, XX, XX },
+  { "cpuid", XX, XX, XX },
+  { "bt", Ev, Gv, XX },
+  { "shld", Ev, Gv, Ib },
+  { "shld", Ev, Gv, CL },
+  { "(bad)", XX, XX, XX },
+  { "(bad)", XX, XX, XX },
   /* a8 */
-  { "pushP", gs },
-  { "popP", gs },
-  { "rsm" },
-  { "btsS", Ev, Gv },
-  { "shrdS", Ev, Gv, Ib },
-  { "shrdS", Ev, Gv, CL },
+  { "push", gs, XX, XX },
+  { "pop", gs, XX, XX },
+  { "rsm" , XX, XX, XX},
+  { "bts", Ev, Gv, XX },
+  { "shrd", Ev, Gv, Ib },
+  { "shrd", Ev, Gv, CL },
   { GRP13 },
-  { "imulS", Gv, Ev },
+  { "imul", Gv, Ev, XX },
   /* b0 */
-  { "cmpxchgB", Eb, Gb },
-  { "cmpxchgS", Ev, Gv },
-  { "lssS", Gv, Mp },	/* 386 lists only Mp */
-  { "btrS", Ev, Gv },
-  { "lfsS", Gv, Mp },	/* 386 lists only Mp */
-  { "lgsS", Gv, Mp },	/* 386 lists only Mp */
-  { "movzx", Gv, Eb },
-  { "movzx", Gv, Ew },
+  { "cmpxchg", Eb, Gb, XX },
+  { "cmpxchg", Ev, Gv, XX },
+  { "lss", Gv, Mp, XX },
+  { "btr", Ev, Gv, XX },
+  { "lfs", Gv, Mp, XX },
+  { "lgs", Gv, Mp, XX },
+  { "movzx", Gv, Eb, XX },
+  { "movzx", Gv, Ew, XX },
   /* b8 */
-  { "(bad)" },
-  { "ud2b" },
+  { "(bad)", XX, XX, XX },
+  { "ud2b", XX, XX, XX },
   { GRP8 },
-  { "btcS", Ev, Gv },
-  { "bsfS", Gv, Ev },
-  { "bsrS", Gv, Ev },
-  { "movsx", Gv, Eb },
-  { "movsx", Gv, Ew },
+  { "btc", Ev, Gv, XX },
+  { "bsf", Gv, Ev, XX },
+  { "bsr", Gv, Ev, XX },
+  { "movsx", Gv, Eb, XX },
+  { "movsx", Gv, Ew, XX },
   /* c0 */
-  { "xaddB", Eb, Gb },
-  { "xaddS", Ev, Gv },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
-  { "(bad)" },
+  { "xadd", Eb, Gb, XX },
+  { "xadd", Ev, Gv, XX },
+  { PREGRP1 },
+  { "(bad)", XX, XX, XX },
+  { "pinsrw", MX, Ev, Ib },
+  { "pextrw", Ev, MX, Ib },
+  { "shufps", XM, EX, Ib },
   { GRP9 },
   /* c8 */
-  { "bswap", eAX },	/* bswap doesn't support 16 bit regs */
-  { "bswap", eCX },
-  { "bswap", eDX },
-  { "bswap", eBX },
-  { "bswap", eSP },
-  { "bswap", eBP },
-  { "bswap", eSI },
-  { "bswap", eDI },
+  { "bswap", eAX, XX, XX },	/* bswap doesn't support 16 bit regs */
+  { "bswap", eCX, XX, XX },
+  { "bswap", eDX, XX, XX },
+  { "bswap", eBX, XX, XX },
+  { "bswap", eSP, XX, XX },
+  { "bswap", eBP, XX, XX },
+  { "bswap", eSI, XX, XX },
+  { "bswap", eDI, XX, XX },
   /* d0 */
-  { "(bad)" },
-  { "psrlw", MX, EM },
-  { "psrld", MX, EM },
-  { "psrlq", MX, EM },
-  { "(bad)" },
-  { "pmullw", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "psrlw", MX, EM, XX },
+  { "psrld", MX, EM, XX },
+  { "psrlq", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmullw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmovmskb", Ev, MX, XX },
   /* d8 */
-  { "psubusb", MX, EM },
-  { "psubusw", MX, EM },
-  { "(bad)" },
-  { "pand", MX, EM },
-  { "paddusb", MX, EM },
-  { "paddusw", MX, EM },
-  { "(bad)" },
-  { "pandn", MX, EM },
+  { "psubusb", MX, EM, XX },
+  { "psubusw", MX, EM, XX },
+  { "pminub", MX, EM, XX },
+  { "pand", MX, EM, XX },
+  { "paddusb", MX, EM, XX },
+  { "paddusw", MX, EM, XX },
+  { "pmaxub", MX, EM, XX },
+  { "pandn", MX, EM, XX },
   /* e0 */
-  { "(bad)" },
-  { "psraw", MX, EM },
-  { "psrad", MX, EM },
-  { "(bad)" },
-  { "(bad)" },
-  { "pmulhw", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "pavgb", MX, EM, XX },
+  { "psraw", MX, EM, XX },
+  { "psrad", MX, EM, XX },
+  { "pavgw", MX, EM, XX },
+  { "pmulhuw", MX, EM, XX },
+  { "pmulhw", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "movntq", Ev, MX, XX },
   /* e8 */
-  { "psubsb", MX, EM },
-  { "psubsw", MX, EM },
-  { "(bad)" },
-  { "por", MX, EM },
-  { "paddsb", MX, EM },
-  { "paddsw", MX, EM },
-  { "(bad)" },
-  { "pxor", MX, EM },
+  { "psubsb", MX, EM, XX },
+  { "psubsw", MX, EM, XX },
+  { "pminsw", MX, EM, XX },
+  { "por", MX, EM, XX },
+  { "paddsb", MX, EM, XX },
+  { "paddsw", MX, EM, XX },
+  { "pmaxsw", MX, EM, XX },
+  { "pxor", MX, EM, XX },
   /* f0 */
-  { "(bad)" },
-  { "psllw", MX, EM },
-  { "pslld", MX, EM },
-  { "psllq", MX, EM },
-  { "(bad)" },
-  { "pmaddwd", MX, EM },
-  { "(bad)" },  { "(bad)" },
+  { "(bad)", XX, XX, XX },
+  { "psllw", MX, EM, XX },
+  { "pslld", MX, EM, XX },
+  { "psllq", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "pmaddwd", MX, EM, XX },
+  { "psadbw", MX, EM, XX },
+  { "maskmovq", MX, EM, XX },
   /* f8 */
-  { "psubb", MX, EM },
-  { "psubw", MX, EM },
-  { "psubd", MX, EM },
-  { "(bad)" },
-  { "paddb", MX, EM },
-  { "paddw", MX, EM },
-  { "paddd", MX, EM },
-  { "(bad)" }
+  { "psubb", MX, EM, XX },
+  { "psubw", MX, EM, XX },
+  { "psubd", MX, EM, XX },
+  { "(bad)", XX, XX, XX },
+  { "paddb", MX, EM, XX },
+  { "paddw", MX, EM, XX },
+  { "paddd", MX, EM, XX },
+  { "(bad)", XX, XX, XX }
 };
 
 static const unsigned char onebyte_has_modrm[256] = {
-  1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
-  1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
-  1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
-  1,1,1,1,0,0,0,0,1,1,1,1,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,1,1,0,0,0,0,0,1,0,1,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-  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,
-  1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,
-  1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
+  /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
+  /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
+  /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
+  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
+  /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
+  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
+  /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
+  /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
+  /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
+  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
+  /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
 };
 
 static const unsigned char twobyte_has_modrm[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
   /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
-  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
-  /* 20 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* 2f */
+  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 2f */
   /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
   /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
-  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
+  /* 50 */ 1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1, /* 5f */
   /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1, /* 6f */
-  /* 70 */ 0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
+  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
   /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
   /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
   /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
   /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
   /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
-  /* d0 */ 0,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1, /* df */
-  /* e0 */ 0,1,1,0,0,1,0,0,1,1,0,1,1,1,0,1, /* ef */
-  /* f0 */ 0,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0  /* ff */
+  /* d0 */ 0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1, /* df */
+  /* e0 */ 1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1, /* ef */
+  /* f0 */ 0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static const unsigned char twobyte_uses_f3_prefix[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
+  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
+  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
+  /* 50 */ 0,1,1,1,0,0,0,0,1,1,0,0,1,1,1,1, /* 5f */
+  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
+  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
+  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
+  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
+  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
+  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
+  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
 };
 
 static char obuf[100];
@@ -1385,289 +1593,366 @@
 static int mod;
 static int rm;
 static int reg;
-static void oappend PARAMS ((char *s));
+static void oappend PARAMS ((const char *s));
 
-static char *names32[]={
+static const char *names32[]={
   "%eax","%ecx","%edx","%ebx", "%esp","%ebp","%esi","%edi",
 };
-static char *names16[] = {
+static const char *names16[] = {
   "%ax","%cx","%dx","%bx","%sp","%bp","%si","%di",
 };
-static char *names8[] = {
+static const char *names8[] = {
   "%al","%cl","%dl","%bl","%ah","%ch","%dh","%bh",
 };
-static char *names_seg[] = {
+static const char *names_seg[] = {
   "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
 };
-static char *index16[] = {
+static const char *index16[] = {
   "%bx,%si","%bx,%di","%bp,%si","%bp,%di","%si","%di","%bp","%bx"
 };
 
-static struct dis386 grps[][8] = {
+static const struct dis386 grps[][8] = {
   /* GRP1b */
   {
-    { "addA",	Eb, Ib },
-    { "orA",	Eb, Ib },
-    { "adcA",	Eb, Ib },
-    { "sbbA",	Eb, Ib },
-    { "andA",	Eb, Ib },
-    { "subA",	Eb, Ib },
-    { "xorA",	Eb, Ib },
-    { "cmpA",	Eb, Ib }
+    { "addA",	Eb, Ib, XX },
+    { "orA",	Eb, Ib, XX },
+    { "adcA",	Eb, Ib, XX },
+    { "sbbA",	Eb, Ib, XX },
+    { "andA",	Eb, Ib, XX },
+    { "subA",	Eb, Ib, XX },
+    { "xorA",	Eb, Ib, XX },
+    { "cmpA",	Eb, Ib, XX }
   },
   /* GRP1S */
   {
-    { "addQ",	Ev, Iv },
-    { "orQ",	Ev, Iv },
-    { "adcQ",	Ev, Iv },
-    { "sbbQ",	Ev, Iv },
-    { "andQ",	Ev, Iv },
-    { "subQ",	Ev, Iv },
-    { "xorQ",	Ev, Iv },
-    { "cmpQ",	Ev, Iv }
+    { "addQ",	Ev, Iv, XX },
+    { "orQ",	Ev, Iv, XX },
+    { "adcQ",	Ev, Iv, XX },
+    { "sbbQ",	Ev, Iv, XX },
+    { "andQ",	Ev, Iv, XX },
+    { "subQ",	Ev, Iv, XX },
+    { "xorQ",	Ev, Iv, XX },
+    { "cmpQ",	Ev, Iv, XX }
   },
   /* GRP1Ss */
   {
-    { "addQ",	Ev, sIb },
-    { "orQ",	Ev, sIb },
-    { "adcQ",	Ev, sIb },
-    { "sbbQ",	Ev, sIb },
-    { "andQ",	Ev, sIb },
-    { "subQ",	Ev, sIb },
-    { "xorQ",	Ev, sIb },
-    { "cmpQ",	Ev, sIb }
+    { "addQ",	Ev, sIb, XX },
+    { "orQ",	Ev, sIb, XX },
+    { "adcQ",	Ev, sIb, XX },
+    { "sbbQ",	Ev, sIb, XX },
+    { "andQ",	Ev, sIb, XX },
+    { "subQ",	Ev, sIb, XX },
+    { "xorQ",	Ev, sIb, XX },
+    { "cmpQ",	Ev, sIb, XX }
   },
   /* GRP2b */
   {
-    { "rolA",	Eb, Ib },
-    { "rorA",	Eb, Ib },
-    { "rclA",	Eb, Ib },
-    { "rcrA",	Eb, Ib },
-    { "shlA",	Eb, Ib },
-    { "shrA",	Eb, Ib },
-    { "(bad)" },
-    { "sarA",	Eb, Ib },
+    { "rolA",	Eb, Ib, XX },
+    { "rorA",	Eb, Ib, XX },
+    { "rclA",	Eb, Ib, XX },
+    { "rcrA",	Eb, Ib, XX },
+    { "shlA",	Eb, Ib, XX },
+    { "shrA",	Eb, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sarA",	Eb, Ib, XX },
   },
   /* GRP2S */
   {
-    { "rolQ",	Ev, Ib },
-    { "rorQ",	Ev, Ib },
-    { "rclQ",	Ev, Ib },
-    { "rcrQ",	Ev, Ib },
-    { "shlQ",	Ev, Ib },
-    { "shrQ",	Ev, Ib },
-    { "(bad)" },
-    { "sarQ",	Ev, Ib },
+    { "rolQ",	Ev, Ib, XX },
+    { "rorQ",	Ev, Ib, XX },
+    { "rclQ",	Ev, Ib, XX },
+    { "rcrQ",	Ev, Ib, XX },
+    { "shlQ",	Ev, Ib, XX },
+    { "shrQ",	Ev, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sarQ",	Ev, Ib, XX },
   },
   /* GRP2b_one */
   {
-    { "rolA",	Eb },
-    { "rorA",	Eb },
-    { "rclA",	Eb },
-    { "rcrA",	Eb },
-    { "shlA",	Eb },
-    { "shrA",	Eb },
-    { "(bad)" },
-    { "sarA",	Eb },
+    { "rolA",	Eb, XX, XX },
+    { "rorA",	Eb, XX, XX },
+    { "rclA",	Eb, XX, XX },
+    { "rcrA",	Eb, XX, XX },
+    { "shlA",	Eb, XX, XX },
+    { "shrA",	Eb, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sarA",	Eb, XX, XX },
   },
   /* GRP2S_one */
   {
-    { "rolQ",	Ev },
-    { "rorQ",	Ev },
-    { "rclQ",	Ev },
-    { "rcrQ",	Ev },
-    { "shlQ",	Ev },
-    { "shrQ",	Ev },
-    { "(bad)" },
-    { "sarQ",	Ev },
+    { "rolQ",	Ev, XX, XX },
+    { "rorQ",	Ev, XX, XX },
+    { "rclQ",	Ev, XX, XX },
+    { "rcrQ",	Ev, XX, XX },
+    { "shlQ",	Ev, XX, XX },
+    { "shrQ",	Ev, XX, XX },
+    { "(bad)",	XX, XX, XX},
+    { "sarQ",	Ev, XX, XX },
   },
   /* GRP2b_cl */
   {
-    { "rolA",	Eb, CL },
-    { "rorA",	Eb, CL },
-    { "rclA",	Eb, CL },
-    { "rcrA",	Eb, CL },
-    { "shlA",	Eb, CL },
-    { "shrA",	Eb, CL },
-    { "(bad)" },
-    { "sarA",	Eb, CL },
+    { "rolA",	Eb, CL, XX },
+    { "rorA",	Eb, CL, XX },
+    { "rclA",	Eb, CL, XX },
+    { "rcrA",	Eb, CL, XX },
+    { "shlA",	Eb, CL, XX },
+    { "shrA",	Eb, CL, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sarA",	Eb, CL, XX },
   },
   /* GRP2S_cl */
   {
-    { "rolQ",	Ev, CL },
-    { "rorQ",	Ev, CL },
-    { "rclQ",	Ev, CL },
-    { "rcrQ",	Ev, CL },
-    { "shlQ",	Ev, CL },
-    { "shrQ",	Ev, CL },
-    { "(bad)" },
-    { "sarQ",	Ev, CL }
+    { "rolQ",	Ev, CL, XX },
+    { "rorQ",	Ev, CL, XX },
+    { "rclQ",	Ev, CL, XX },
+    { "rcrQ",	Ev, CL, XX },
+    { "shlQ",	Ev, CL, XX },
+    { "shrQ",	Ev, CL, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sarQ",	Ev, CL, XX }
   },
   /* GRP3b */
   {
-    { "testA",	Eb, Ib },
-    { "(bad)",	Eb },
-    { "notA",	Eb },
-    { "negA",	Eb },
-    { "mulB",	AL, Eb },
-    { "imulB",	AL, Eb },
-    { "divB",	AL, Eb },
-    { "idivB",	AL, Eb }
+    { "testA",	Eb, Ib, XX },
+    { "(bad)",	Eb, XX, XX },
+    { "notA",	Eb, XX, XX },
+    { "negA",	Eb, XX, XX },
+    { "mulB",	AL, Eb, XX },
+    { "imulB",	AL, Eb, XX },
+    { "divB",	AL, Eb, XX },
+    { "idivB",	AL, Eb, XX }
   },
   /* GRP3S */
   {
-    { "testQ",	Ev, Iv },
-    { "(bad)" },
-    { "notQ",	Ev },
-    { "negQ",	Ev },
-    { "mulS",	eAX, Ev },
-    { "imulS",	eAX, Ev },
-    { "divS",	eAX, Ev },
-    { "idivS",	eAX, Ev },
+    { "testQ",	Ev, Iv, XX },
+    { "(bad)",	XX, XX, XX },
+    { "notQ",	Ev, XX, XX },
+    { "negQ",	Ev, XX, XX },
+    { "mulS",	eAX, Ev, XX },
+    { "imulS",	eAX, Ev, XX },
+    { "divS",	eAX, Ev, XX },
+    { "idivS",	eAX, Ev, XX },
   },
   /* GRP4 */
   {
-    { "incA", Eb },
-    { "decA", Eb },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
+    { "incA",	Eb, XX, XX },
+    { "decA",	Eb, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP5 */
   {
-    { "incQ",	Ev },
-    { "decQ",	Ev },
-    { "callP",	indirEv },
-    { "callP",	indirEv },
-    { "jmpP",	indirEv },
-    { "ljmpP",	indirEv },
-    { "pushQ",	Ev },
-    { "(bad)" },
+    { "incQ",	Ev, XX, XX },
+    { "decQ",	Ev, XX, XX },
+    { "callP",	indirEv, XX, XX },
+    { "lcallP",	indirEv, XX, XX },
+    { "jmpP",	indirEv, XX, XX },
+    { "ljmpP",	indirEv, XX, XX },
+    { "pushQ",	Ev, XX, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP6 */
   {
-    { "sldt",	Ew },
-    { "str",	Ew },
-    { "lldt",	Ew },
-    { "ltr",	Ew },
-    { "verr",	Ew },
-    { "verw",	Ew },
-    { "(bad)" },
-    { "(bad)" }
+    { "sldt",	Ew, XX, XX },
+    { "str",	Ew, XX, XX },
+    { "lldt",	Ew, XX, XX },
+    { "ltr",	Ew, XX, XX },
+    { "verr",	Ew, XX, XX },
+    { "verw",	Ew, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX }
   },
   /* GRP7 */
   {
-    { "sgdt", Ew },
-    { "sidt", Ew },
-    { "lgdt", Ew },
-    { "lidt", Ew },
-    { "smsw", Ew },
-    { "(bad)" },
-    { "lmsw", Ew },
-    { "invlpg", Ew },
+    { "sgdt", Ew, XX, XX },
+    { "sidt", Ew, XX, XX },
+    { "lgdt", Ew, XX, XX },
+    { "lidt", Ew, XX, XX },
+    { "smsw", Ew, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "lmsw", Ew, XX, XX },
+    { "invlpg", Ew, XX, XX },
   },
   /* GRP8 */
   {
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "btQ",	Ev, Ib },
-    { "btsQ",	Ev, Ib },
-    { "btrQ",	Ev, Ib },
-    { "btcQ",	Ev, Ib },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "btQ",	Ev, Ib, XX },
+    { "btsQ",	Ev, Ib, XX },
+    { "btrQ",	Ev, Ib, XX },
+    { "btcQ",	Ev, Ib, XX },
   },
   /* GRP9 */
   {
-    { "(bad)" },
-    { "cmpxchg8b", Ev },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "cmpxchg8b", Ev, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP10 */
   {
-    { "(bad)" },
-    { "(bad)" },
-    { "psrlw", MS, Ib },
-    { "(bad)" },
-    { "psraw", MS, Ib },
-    { "(bad)" },
-    { "psllw", MS, Ib },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psrlw",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psraw",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psllw",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP11 */
   {
-    { "(bad)" },
-    { "(bad)" },
-    { "psrld", MS, Ib },
-    { "(bad)" },
-    { "psrad", MS, Ib },
-    { "(bad)" },
-    { "pslld", MS, Ib },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psrld",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psrad",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "pslld",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP12 */
   {
-    { "(bad)" },
-    { "(bad)" },
-    { "psrlq", MS, Ib },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "psllq", MS, Ib },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psrlq",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "psllq",	MS, Ib, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* GRP13 */
   {
-    { "fxsave", Ev },
-    { "fxrstor", Ev },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
+    { "fxsave", Ev, XX, XX },
+    { "fxrstor", Ev, XX, XX },
+    { "ldmxcsr", Ev, XX, XX },
+    { "stmxcsr", Ev, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "sfence", None, XX, XX },
   },
   /* GRP14 */
   {
-    { "prefetch", Eb },
-    { "prefetchw", Eb },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
+    { "prefetchnta", Ev, XX, XX },
+    { "prefetcht0", Ev, XX, XX },
+    { "prefetcht1", Ev, XX, XX },
+    { "prefetcht2", Ev, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+  },
+  /* GRPAMD */
+  {
+    { "prefetch", Eb, XX, XX },
+    { "prefetchw", Eb, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
   }
 
 };
 
-#define PREFIX_REPZ 1
-#define PREFIX_REPNZ 2
-#define PREFIX_LOCK 4
-#define PREFIX_CS 8
-#define PREFIX_SS 0x10
-#define PREFIX_DS 0x20
-#define PREFIX_ES 0x40
-#define PREFIX_FS 0x80
-#define PREFIX_GS 0x100
-#define PREFIX_DATA 0x200
-#define PREFIX_ADDR 0x400
-#define PREFIX_FWAIT 0x800
+static const struct dis386 prefix_user_table[][2] = {
+  /* PREGRP0 */
+  {
+    { "addps", XM, EX, XX },
+    { "addss", XM, EX, XX },
+  },
+  /* PREGRP1 */
+  {
+    { "", XM, EX, OPSIMD },	/* See OP_SIMD_SUFFIX */
+    { "", XM, EX, OPSIMD },
+  },
+  /* PREGRP2 */
+  {
+    { "cvtpi2ps", XM, EM, XX },
+    { "cvtsi2ss", XM, Ev, XX },
+  },
+  /* PREGRP3 */
+  {
+    { "cvtps2pi", MX, EX, XX },
+    { "cvtss2si", Gv, EX, XX },
+  },
+  /* PREGRP4 */
+  {
+    { "cvttps2pi", MX, EX, XX },
+    { "cvttss2si", Gv, EX, XX },
+  },
+  /* PREGRP5 */
+  {
+    { "divps", XM, EX, XX },
+    { "divss", XM, EX, XX },
+  },
+  /* PREGRP6 */
+  {
+    { "maxps", XM, EX, XX },
+    { "maxss", XM, EX, XX },
+  },
+  /* PREGRP7 */
+  {
+    { "minps", XM, EX, XX },
+    { "minss", XM, EX, XX },
+  },
+  /* PREGRP8 */
+  {
+    { "movups", XM, EX, XX },
+    { "movss", XM, EX, XX },
+  },
+  /* PREGRP9 */
+  {
+    { "movups", EX, XM, XX },
+    { "movss", EX, XM, XX },
+  },
+  /* PREGRP10 */
+  {
+    { "mulps", XM, EX, XX },
+    { "mulss", XM, EX, XX },
+  },
+  /* PREGRP11 */
+  {
+    { "rcpps", XM, EX, XX },
+    { "rcpss", XM, EX, XX },
+  },
+  /* PREGRP12 */
+  {
+    { "rsqrtps", XM, EX, XX },
+    { "rsqrtss", XM, EX, XX },
+  },
+  /* PREGRP13 */
+  {
+    { "sqrtps", XM, EX, XX },
+    { "sqrtss", XM, EX, XX },
+  },
+  /* PREGRP14 */
+  {
+    { "subps", XM, EX, XX },
+    { "subss", XM, EX, XX },
+  }
+};
 
-static int prefixes;
+#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
 
 static void
 ckprefix ()
 {
   prefixes = 0;
+  used_prefixes = 0;
   while (1)
     {
       FETCH_DATA (the_info, codep + 1);
@@ -1706,7 +1991,7 @@
 	case 0x67:
 	  prefixes |= PREFIX_ADDR;
 	  break;
-	case 0x9b:
+	case FWAIT_OPCODE:
 	  /* fwait is really an instruction.  If there are prefixes
 	     before the fwait, they belong to the fwait, *not* to the
 	     following instruction.  */
@@ -1725,6 +2010,45 @@
     }
 }
 
+/* Return the name of the prefix byte PREF, or NULL if PREF is not a
+   prefix byte.  */
+
+static const char *
+prefix_name (pref, sizeflag)
+     int pref;
+     int sizeflag;
+{
+  switch (pref)
+    {
+    case 0xf3:
+      return "repz";
+    case 0xf2:
+      return "repnz";
+    case 0xf0:
+      return "lock";
+    case 0x2e:
+      return "cs";
+    case 0x36:
+      return "ss";
+    case 0x3e:
+      return "ds";
+    case 0x26:
+      return "es";
+    case 0x64:
+      return "fs";
+    case 0x65:
+      return "gs";
+    case 0x66:
+      return (sizeflag & DFLAG) ? "data16" : "data32";
+    case 0x67:
+      return (sizeflag & AFLAG) ? "addr16" : "addr32";
+    case FWAIT_OPCODE:
+      return "fwait";
+    default:
+      return NULL;
+    }
+}
+
 static char op1out[100], op2out[100], op3out[100];
 static int op_ad, op_index[3];
 static unsigned int op_address[3];
@@ -1740,8 +2064,6 @@
  * The function returns the length of this instruction in bytes.
  */
 
-static int print_insn_x86
-  PARAMS ((bfd_vma pc, disassemble_info *info, int sizeflag));
 static int print_insn_i386
   PARAMS ((bfd_vma pc, disassemble_info *info));
 
@@ -1784,43 +2106,35 @@
      bfd_vma pc;
      disassemble_info *info;
 {
-  int flags;
-  if (info->mach == bfd_mach_i386_i386
-      || info->mach == bfd_mach_i386_i386_intel_syntax)
-    flags = AFLAG|DFLAG;
-  else if (info->mach == bfd_mach_i386_i8086)
-    flags = 0;
-  else
-    abort ();
-  return print_insn_x86 (pc, info, flags);
-}
-
-static int
-print_insn_x86 (pc, info, sizeflag)
-     bfd_vma pc;
-     disassemble_info *info;
-     int sizeflag;
-{
-  struct dis386 *dp;
+  const struct dis386 *dp;
   int i;
   int two_source_ops;
   char *first, *second, *third;
   int needcomma;
   unsigned char need_modrm;
+  unsigned char uses_f3_prefix;
+  VOLATILE int sizeflag;
+  VOLATILE int orig_sizeflag;
 
   struct dis_private priv;
   bfd_byte *inbuf = priv.the_buffer;
 
-  /* The output looks better if we put 5 bytes on a line, since that
-     puts long word instructions on a single line.  */
-  info->bytes_per_line = 5;
+  if (info->mach == bfd_mach_i386_i386
+      || info->mach == bfd_mach_i386_i386_intel_syntax)
+    sizeflag = AFLAG|DFLAG;
+  else if (info->mach == bfd_mach_i386_i8086)
+    sizeflag = 0;
+  else
+    abort ();
+  orig_sizeflag = sizeflag;
+
+  /* The output looks better if we put 7 bytes on a line, since that
+     puts most long word instructions on a single line.  */
+  info->bytes_per_line = 7;
 
   info->private_data = (PTR) &priv;
   priv.max_fetched = priv.the_buffer;
   priv.insn_start = pc;
-  if (setjmp (priv.bailout) != 0)
-    /* Error return.  */
-    return -1;
 
   obuf[0] = 0;
   op1out[0] = 0;
@@ -1834,6 +2148,31 @@
   start_codep = inbuf;
   codep = inbuf;
 
+  if (setjmp (priv.bailout) != 0)
+    {
+      const char *name;
+
+      /* Getting here means we tried for data but didn't get it.  That
+         means we have an incomplete instruction of some sort.  Just
+         print the first byte as a prefix or a .byte pseudo-op.  */
+      if (codep > inbuf)
+	{
+	  name = prefix_name (inbuf[0], orig_sizeflag);
+	  if (name != NULL)
+	    (*info->fprintf_func) (info->stream, "%s", name);
+	  else
+	    {
+	      /* Just print the first byte as a .byte instruction.  */
+	      (*info->fprintf_func) (info->stream, ".byte 0x%x",
+				     (unsigned int) inbuf[0]);
+	    }
+
+	  return 1;
+	}
+
+      return -1;
+    }
+
   ckprefix ();
 
   insn_codep = codep;
@@ -1846,18 +2185,53 @@
   if ((prefixes & PREFIX_FWAIT)
       && ((*codep < 0xd8) || (*codep > 0xdf)))
     {
-      /* fwait not followed by floating point instruction.  */
-      (*info->fprintf_func) (info->stream, "fwait");
-      /* There may be other prefixes.  Skip any before the fwait.  */
-      return codep - inbuf;
+      const char *name;
+
+      /* fwait not followed by floating point instruction.  Print the
+         first prefix, which is probably fwait itself.  */
+      name = prefix_name (inbuf[0], orig_sizeflag);
+      if (name == NULL)
+	name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
     }
 
-  if (prefixes & PREFIX_REPZ)
-    oappend ("repz ");
+  if (*codep == 0x0f)
+    {
+      FETCH_DATA (info, codep + 2);
+      if (intel_syntax)
+        dp = &dis386_twobyte_intel[*++codep];
+      else
+        dp = &dis386_twobyte_att[*++codep];
+      need_modrm = twobyte_has_modrm[*codep];
+      uses_f3_prefix = twobyte_uses_f3_prefix[*codep];
+    }
+  else
+    {
+      if (intel_syntax)
+        dp = &dis386_intel[*codep];
+      else
+        dp = &dis386_att[*codep];
+      need_modrm = onebyte_has_modrm[*codep];
+      uses_f3_prefix = 0;
+    }
+  codep++;
+
+  if (!uses_f3_prefix && (prefixes & PREFIX_REPZ))
+    {
+      oappend ("repz ");
+      used_prefixes |= PREFIX_REPZ;
+    }
   if (prefixes & PREFIX_REPNZ)
-    oappend ("repnz ");
+    {
+      oappend ("repnz ");
+      used_prefixes |= PREFIX_REPNZ;
+    }
   if (prefixes & PREFIX_LOCK)
-    oappend ("lock ");
+    {
+      oappend ("lock ");
+      used_prefixes |= PREFIX_LOCK;
+    }
 
   if (prefixes & PREFIX_DATA)
     sizeflag ^= DFLAG;
@@ -1869,27 +2243,9 @@
         oappend ("addr32 ");
       else
 	oappend ("addr16 ");
+      used_prefixes |= PREFIX_ADDR;
     }
 
-  if (*codep == 0x0f)
-    {
-      FETCH_DATA (info, codep + 2);
-      if (intel_syntax)
-        dp = &dis386_twobyte_intel[*++codep];
-      else
-        dp = &dis386_twobyte_att[*++codep];
-      need_modrm = twobyte_has_modrm[*codep];
-    }
-  else
-    {
-      if (intel_syntax)
-        dp = &dis386_intel[*codep];
-      else
-        dp = &dis386_att[*codep];
-      need_modrm = onebyte_has_modrm[*codep];
-    }
-  codep++;
-
   if (need_modrm)
     {
       FETCH_DATA (info, codep + 1);
@@ -1905,7 +2261,21 @@
   else
     {
       if (dp->name == NULL)
-	dp = &grps[dp->bytemode1][reg];
+	{
+	  switch(dp->bytemode2)
+	    {
+	      case USE_GROUPS:
+	        dp = &grps[dp->bytemode1][reg];
+		break;
+	      case USE_PREFIX_USER_TABLE:
+		dp = &prefix_user_table[dp->bytemode1][prefixes & PREFIX_REPZ ? 1 : 0];
+		used_prefixes |= (prefixes & PREFIX_REPZ);
+		break;
+	      default:
+		oappend (INTERNAL_DISASSEMBLER_ERROR);
+		break;
+	    }
+	}
 
       putop (dp->name, sizeflag);
 
@@ -1925,6 +2295,21 @@
 	(*dp->op3)(dp->bytemode3, sizeflag);
     }
 
+  /* See if any prefixes were not used.  If so, print the first one
+     separately.  If we don't do this, we'll wind up printing an
+     instruction stream which does not precisely correspond to the
+     bytes we are disassembling.  */
+  if ((prefixes & ~used_prefixes) != 0)
+    {
+      const char *name;
+
+      name = prefix_name (inbuf[0], orig_sizeflag);
+      if (name == NULL)
+	name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
+    }
+
   obufp = obuf + strlen (obuf);
   for (i = strlen (obuf); i < 6; i++)
     oappend (" ");
@@ -1933,7 +2318,7 @@
 
   /* The enter and bound instructions are printed with operands in the same
      order as the intel book; everything else is printed in reverse order.  */
-  if (intel_syntax || two_source_ops) 
+  if (intel_syntax || two_source_ops)
     {
       first = op1out;
       second = op2out;
@@ -1979,7 +2364,7 @@
   return codep - inbuf;
 }
 
-static char *float_mem_att[] = {
+static const char *float_mem_att[] = {
   /* d8 */
   "fadds",
   "fmuls",
@@ -2054,7 +2439,7 @@
   "fistpll",
 };
 
-static char *float_mem_intel[] = {
+static const char *float_mem_intel[] = {
   /* d8 */
   "fadd",
   "fmul",
@@ -2132,34 +2517,34 @@
 #define ST OP_ST, 0
 #define STi OP_STi, 0
 
-#define FGRPd9_2 NULL, NULL, 0
-#define FGRPd9_4 NULL, NULL, 1
-#define FGRPd9_5 NULL, NULL, 2
-#define FGRPd9_6 NULL, NULL, 3
-#define FGRPd9_7 NULL, NULL, 4
-#define FGRPda_5 NULL, NULL, 5
-#define FGRPdb_4 NULL, NULL, 6
-#define FGRPde_3 NULL, NULL, 7
-#define FGRPdf_4 NULL, NULL, 8
+#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
+#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
+#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
+#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
+#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
+#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
+#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
+#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
+#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
 
-static struct dis386 float_reg[][8] = {
+static const struct dis386 float_reg[][8] = {
   /* d8 */
   {
-    { "fadd",	ST, STi },
-    { "fmul",	ST, STi },
-    { "fcom",	STi },
-    { "fcomp",	STi },
-    { "fsub",	ST, STi },
-    { "fsubr",	ST, STi },
-    { "fdiv",	ST, STi },
-    { "fdivr",	ST, STi },
+    { "fadd",	ST, STi, XX },
+    { "fmul",	ST, STi, XX },
+    { "fcom",	STi, XX, XX },
+    { "fcomp",	STi, XX, XX },
+    { "fsub",	ST, STi, XX },
+    { "fsubr",	ST, STi, XX },
+    { "fdiv",	ST, STi, XX },
+    { "fdivr",	ST, STi, XX },
   },
   /* d9 */
   {
-    { "fld",	STi },
-    { "fxch",	STi },
+    { "fld",	STi, XX, XX },
+    { "fxch",	STi, XX, XX },
     { FGRPd9_2 },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
     { FGRPd9_4 },
     { FGRPd9_5 },
     { FGRPd9_6 },
@@ -2167,83 +2552,83 @@
   },
   /* da */
   {
-    { "fcmovb",	ST, STi },
-    { "fcmove",	ST, STi },
-    { "fcmovbe",ST, STi },
-    { "fcmovu",	ST, STi },
-    { "(bad)" },
+    { "fcmovb",	ST, STi, XX },
+    { "fcmove",	ST, STi, XX },
+    { "fcmovbe",ST, STi, XX },
+    { "fcmovu",	ST, STi, XX },
+    { "(bad)",	XX, XX, XX },
     { FGRPda_5 },
-    { "(bad)" },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* db */
   {
-    { "fcmovnb",ST, STi },
-    { "fcmovne",ST, STi },
-    { "fcmovnbe",ST, STi },
-    { "fcmovnu",ST, STi },
+    { "fcmovnb",ST, STi, XX },
+    { "fcmovne",ST, STi, XX },
+    { "fcmovnbe",ST, STi, XX },
+    { "fcmovnu",ST, STi, XX },
     { FGRPdb_4 },
-    { "fucomi",	ST, STi },
-    { "fcomi",	ST, STi },
-    { "(bad)" },
+    { "fucomi",	ST, STi, XX },
+    { "fcomi",	ST, STi, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* dc */
   {
-    { "fadd",	STi, ST },
-    { "fmul",	STi, ST },
-    { "(bad)" },
-    { "(bad)" },
+    { "fadd",	STi, ST, XX },
+    { "fmul",	STi, ST, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
 #if UNIXWARE_COMPAT
-    { "fsub",	STi, ST },
-    { "fsubr",	STi, ST },
-    { "fdiv",	STi, ST },
-    { "fdivr",	STi, ST },
+    { "fsub",	STi, ST, XX },
+    { "fsubr",	STi, ST, XX },
+    { "fdiv",	STi, ST, XX },
+    { "fdivr",	STi, ST, XX },
 #else
-    { "fsubr",	STi, ST },
-    { "fsub",	STi, ST },
-    { "fdivr",	STi, ST },
-    { "fdiv",	STi, ST },
+    { "fsubr",	STi, ST, XX },
+    { "fsub",	STi, ST, XX },
+    { "fdivr",	STi, ST, XX },
+    { "fdiv",	STi, ST, XX },
 #endif
   },
   /* dd */
   {
-    { "ffree",	STi },
-    { "(bad)" },
-    { "fst",	STi },
-    { "fstp",	STi },
-    { "fucom",	STi },
-    { "fucomp",	STi },
-    { "(bad)" },
-    { "(bad)" },
+    { "ffree",	STi, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "fst",	STi, XX, XX },
+    { "fstp",	STi, XX, XX },
+    { "fucom",	STi, XX, XX },
+    { "fucomp",	STi, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
   },
   /* de */
   {
-    { "faddp",	STi, ST },
-    { "fmulp",	STi, ST },
-    { "(bad)" },
+    { "faddp",	STi, ST, XX },
+    { "fmulp",	STi, ST, XX },
+    { "(bad)",	XX, XX, XX },
     { FGRPde_3 },
 #if UNIXWARE_COMPAT
-    { "fsubp",	STi, ST },
-    { "fsubrp",	STi, ST },
-    { "fdivp",	STi, ST },
-    { "fdivrp",	STi, ST },
+    { "fsubp",	STi, ST, XX },
+    { "fsubrp",	STi, ST, XX },
+    { "fdivp",	STi, ST, XX },
+    { "fdivrp",	STi, ST, XX },
 #else
-    { "fsubrp",	STi, ST },
-    { "fsubp",	STi, ST },
-    { "fdivrp",	STi, ST },
-    { "fdivp",	STi, ST },
+    { "fsubrp",	STi, ST, XX },
+    { "fsubp",	STi, ST, XX },
+    { "fdivrp",	STi, ST, XX },
+    { "fdivp",	STi, ST, XX },
 #endif
   },
   /* df */
   {
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
-    { "(bad)" },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
+    { "(bad)",	XX, XX, XX },
     { FGRPdf_4 },
-    { "fucomip",ST, STi },
-    { "fcomip", ST, STi },
-    { "(bad)" },
+    { "fucomip",ST, STi, XX },
+    { "fcomip", ST, STi, XX },
+    { "(bad)",	XX, XX, XX },
   },
 };
 
@@ -2300,7 +2685,7 @@
 dofloat (sizeflag)
      int sizeflag;
 {
-  struct dis386 *dp;
+  const struct dis386 *dp;
   unsigned char floatop;
 
   floatop = codep[-1];
@@ -2316,7 +2701,7 @@
         OP_E (x_mode, sizeflag);
       else if (floatop == 0xdd)
         OP_E (d_mode, sizeflag);
-      else 
+      else
         OP_E (v_mode, sizeflag);
       return;
     }
@@ -2347,8 +2732,8 @@
 /* ARGSUSED */
 static void
 OP_ST (ignore, sizeflag)
-     int ignore;
-     int sizeflag;
+     int ignore ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
   oappend ("%st");
 }
@@ -2356,8 +2741,8 @@
 /* ARGSUSED */
 static void
 OP_STi (ignore, sizeflag)
-     int ignore;
-     int sizeflag;
+     int ignore ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
   sprintf (scratchbuf, "%%st(%d)", rm);
   oappend (scratchbuf);
@@ -2367,10 +2752,10 @@
 /* capital letters in template are macros */
 static void
 putop (template, sizeflag)
-     char *template;
+     const char *template;
      int sizeflag;
 {
-  char *p;
+  const char *p;
 
   for (p = template; *p; p++)
     {
@@ -2412,6 +2797,8 @@
 	case 'N':
 	  if ((prefixes & PREFIX_FWAIT) == 0)
 	    *obufp++ = 'n';
+	  else
+	    used_prefixes |= PREFIX_FWAIT;
 	  break;
 	case 'P':
           if (intel_syntax)
@@ -2426,6 +2813,7 @@
 		*obufp++ = 'l';
 	      else
 		*obufp++ = 'w';
+	      used_prefixes |= (prefixes & PREFIX_DATA);
 	    }
 	  break;
 	case 'Q':
@@ -2441,15 +2829,31 @@
 		*obufp++ = 'l';
 	      else
 		*obufp++ = 'w';
+	      used_prefixes |= (prefixes & PREFIX_DATA);
 	    }
 	  break;
 	case 'R':
           if (intel_syntax)
-            break;
-	  if (sizeflag & DFLAG)
-	    *obufp++ = 'l';
+	    {
+	      if (sizeflag & DFLAG)
+		{
+		  *obufp++ = 'd';
+		  *obufp++ = 'q';
+		}
+	      else
+		{
+		  *obufp++ = 'w';
+		  *obufp++ = 'd';
+		}
+	    }
 	  else
-	    *obufp++ = 'w';
+	    {
+	      if (sizeflag & DFLAG)
+		*obufp++ = 'l';
+	      else
+		*obufp++ = 'w';
+	    }
+	  used_prefixes |= (prefixes & PREFIX_DATA);
 	  break;
 	case 'S':
           if (intel_syntax)
@@ -2461,17 +2865,29 @@
 		*obufp++ = 'l';
 	      else
 		*obufp++ = 'w';
+	      used_prefixes |= (prefixes & PREFIX_DATA);
 	    }
 #endif
 	  break;
 	case 'W':
-          if (intel_syntax)
-            break;
 	  /* operand size flag for cwtl, cbtw */
 	  if (sizeflag & DFLAG)
 	    *obufp++ = 'w';
 	  else
 	    *obufp++ = 'b';
+          if (intel_syntax)
+	    {
+	      if (sizeflag & DFLAG)
+		{
+		  *obufp++ = 'd';
+		  *obufp++ = 'e';
+		}
+	      else
+		{
+		  *obufp++ = 'w';
+		}
+	    }
+	  used_prefixes |= (prefixes & PREFIX_DATA);
 	  break;
 	}
     }
@@ -2480,7 +2896,7 @@
 
 static void
 oappend (s)
-     char *s;
+     const char *s;
 {
   strcpy (obufp, s);
   obufp += strlen (s);
@@ -2490,17 +2906,35 @@
 append_seg ()
 {
   if (prefixes & PREFIX_CS)
-    oappend ("%cs:");
+    {
+      oappend ("%cs:");
+      used_prefixes |= PREFIX_CS;
+    }
   if (prefixes & PREFIX_DS)
-    oappend ("%ds:");
+    {
+      oappend ("%ds:");
+      used_prefixes |= PREFIX_DS;
+    }
   if (prefixes & PREFIX_SS)
-    oappend ("%ss:");
+    {
+      oappend ("%ss:");
+      used_prefixes |= PREFIX_SS;
+    }
   if (prefixes & PREFIX_ES)
-    oappend ("%es:");
+    {
+      oappend ("%es:");
+      used_prefixes |= PREFIX_ES;
+    }
   if (prefixes & PREFIX_FS)
-    oappend ("%fs:");
+    {
+      oappend ("%fs:");
+      used_prefixes |= PREFIX_FS;
+    }
   if (prefixes & PREFIX_GS)
-    oappend ("%gs:");
+    {
+      oappend ("%gs:");
+      used_prefixes |= PREFIX_GS;
+    }
 }
 
 static void
@@ -2533,14 +2967,22 @@
 	case w_mode:
 	  oappend (names16[rm]);
 	  break;
+	case d_mode:
+	  oappend (names32[rm]);
+	  break;
 	case v_mode:
 	  if (sizeflag & DFLAG)
 	    oappend (names32[rm]);
 	  else
 	    oappend (names16[rm]);
+	  used_prefixes |= (prefixes & PREFIX_DATA);
+	  break;
+	case 0:
+	  if ( !(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */))
+	    BadOp();	/* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
 	  break;
 	default:
-	  oappend ("<bad dis table>");
+	  oappend (INTERNAL_DISASSEMBLER_ERROR);
 	  break;
 	}
       return;
@@ -2597,7 +3039,7 @@
             sprintf (scratchbuf, "0x%x", disp);
             oappend (scratchbuf);
           }
-      
+
       if (havebase || (havesib && (index != 4 || scale != 0)))
 	{
           if (intel_syntax)
@@ -2645,7 +3087,7 @@
 		  oappend (scratchbuf);
 		}
               if (!intel_syntax
-                  || (intel_syntax 
+                  || (intel_syntax
                       && bytemode != b_mode
                       && bytemode != w_mode
                       && bytemode != v_mode))
@@ -2735,8 +3177,6 @@
     }
 }
 
-#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
-
 static void
 OP_G (bytemode, sizeflag)
      int bytemode;
@@ -2758,6 +3198,7 @@
 	oappend (names32[reg]);
       else
 	oappend (names16[reg]);
+      used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     default:
       oappend (INTERNAL_DISASSEMBLER_ERROR);
@@ -2802,7 +3243,7 @@
      int code;
      int sizeflag;
 {
-  char *s;
+  const char *s;
 
   switch (code)
     {
@@ -2827,6 +3268,7 @@
 	s = names32[code - eAX_reg];
       else
 	s = names16[code - eAX_reg];
+      used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     default:
       s = INTERNAL_DISASSEMBLER_ERROR;
@@ -2853,6 +3295,7 @@
 	op = get32 ();
       else
 	op = get16 ();
+      used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     case w_mode:
       op = get16 ();
@@ -2894,6 +3337,7 @@
 	  if ((op & 0x8000) != 0)
 	    op -= 0x10000;
 	}
+      used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     case w_mode:
       op = get16 ();
@@ -2938,6 +3382,7 @@
 	     displacement is added!  */
 	  mask = 0xffff;
 	}
+      used_prefixes |= (prefixes & PREFIX_DATA);
       break;
     default:
       oappend (INTERNAL_DISASSEMBLER_ERROR);
@@ -2952,8 +3397,8 @@
 /* ARGSUSED */
 static void
 OP_SEG (dummy, sizeflag)
-     int dummy;
-     int sizeflag;
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
   static char *sreg[] = {
     "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
@@ -2962,54 +3407,33 @@
   oappend (sreg[reg]);
 }
 
+/* ARGSUSED */
 static void
-OP_DIR (size, sizeflag)
-     int size;
+OP_DIR (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
      int sizeflag;
 {
   int seg, offset;
 
-  switch (size)
+  if (sizeflag & DFLAG)
     {
-    case lptr:
-      if (sizeflag & DFLAG)
-	{
-	  offset = get32 ();
-	  seg = get16 ();
-	}
-      else
-	{
-	  offset = get16 ();
-	  seg = get16 ();
-	}
-      sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
-      oappend (scratchbuf);
-      break;
-    case v_mode:
-      if (sizeflag & DFLAG)
-	offset = get32 ();
-      else
-	{
-	  offset = get16 ();
-	  if ((offset & 0x8000) != 0)
-	    offset -= 0x10000;
-	}
-
-      offset = start_pc + codep - start_codep + offset;
-      set_op (offset);
-      sprintf (scratchbuf, "0x%x", offset);
-      oappend (scratchbuf);
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      break;
+      offset = get32 ();
+      seg = get16 ();
     }
+  else
+    {
+      offset = get16 ();
+      seg = get16 ();
+    }
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
+  oappend (scratchbuf);
 }
 
 /* ARGSUSED */
 static void
 OP_OFF (ignore, sizeflag)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
      int sizeflag;
 {
   int off;
@@ -3039,7 +3463,7 @@
      int code;
      int sizeflag;
 {
-  char *s;
+  const char *s;
   oappend ("(");
   if (sizeflag & AFLAG)
     s = names32[code - eAX_reg];
@@ -3075,27 +3499,12 @@
   ptr_reg (code, sizeflag);
 }
 
-#if 0
-/* Not used.  */
-
-/* ARGSUSED */
-static void
-OP_ONE (dummy, sizeflag)
-     int dummy;
-     int sizeflag;
-{
-  oappend ("1");
-}
-
-#endif
-
 /* ARGSUSED */
 static void
 OP_C (dummy, sizeflag)
-     int dummy;
-     int sizeflag;
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
-  codep++; /* skip mod/rm */
   sprintf (scratchbuf, "%%cr%d", reg);
   oappend (scratchbuf);
 }
@@ -3103,10 +3512,9 @@
 /* ARGSUSED */
 static void
 OP_D (dummy, sizeflag)
-     int dummy;
-     int sizeflag;
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
-  codep++; /* skip mod/rm */
   sprintf (scratchbuf, "%%db%d", reg);
   oappend (scratchbuf);
 }
@@ -3114,40 +3522,43 @@
 /* ARGSUSED */
 static void
 OP_T (dummy, sizeflag)
-     int dummy;
-     int sizeflag;
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
-  codep++; /* skip mod/rm */
   sprintf (scratchbuf, "%%tr%d", reg);
   oappend (scratchbuf);
 }
 
 static void
-OP_rm (bytemode, sizeflag)
+OP_Rd (bytemode, sizeflag)
      int bytemode;
      int sizeflag;
 {
-  switch (bytemode)
-    {
-    case d_mode:
-      oappend (names32[rm]);
-      break;
-    case w_mode:
-      oappend (names16[rm]);
-      break;
-    }
+  if (mod == 3)
+    OP_E (bytemode, sizeflag);
+  else
+    BadOp();
 }
 
 static void
 OP_MMX (ignore, sizeflag)
-     int ignore;
-     int sizeflag;
+     int ignore ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
   sprintf (scratchbuf, "%%mm%d", reg);
   oappend (scratchbuf);
 }
 
 static void
+OP_XMM (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  sprintf (scratchbuf, "%%xmm%d", reg);
+  oappend (scratchbuf);
+}
+
+static void
 OP_EM (bytemode, sizeflag)
      int bytemode;
      int sizeflag;
@@ -3164,24 +3575,41 @@
 }
 
 static void
-OP_MS (ignore, sizeflag)
-     int ignore;
+OP_EX (bytemode, sizeflag)
+     int bytemode;
      int sizeflag;
 {
-  ++codep;
-  sprintf (scratchbuf, "%%mm%d", rm);
+  if (mod != 3)
+    {
+      OP_E (bytemode, sizeflag);
+      return;
+    }
+
+  codep++;
+  sprintf (scratchbuf, "%%xmm%d", rm);
   oappend (scratchbuf);
 }
 
+static void
+OP_MS (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_EM (bytemode, sizeflag);
+  else
+    BadOp();
+}
+
 static const char *Suffix3DNow[] = {
 /* 00 */	NULL,		NULL,		NULL,		NULL,
 /* 04 */	NULL,		NULL,		NULL,		NULL,
 /* 08 */	NULL,		NULL,		NULL,		NULL,
-/* 0C */	NULL,		"pi2fd",	NULL,		NULL,
+/* 0C */	"pi2fw",	"pi2fd",	NULL,		NULL,
 /* 10 */	NULL,		NULL,		NULL,		NULL,
 /* 14 */	NULL,		NULL,		NULL,		NULL,
 /* 18 */	NULL,		NULL,		NULL,		NULL,
-/* 1C */	NULL,		"pf2id",	NULL,		NULL,
+/* 1C */	"pf2iw",	"pf2id",	NULL,		NULL,
 /* 20 */	NULL,		NULL,		NULL,		NULL,
 /* 24 */	NULL,		NULL,		NULL,		NULL,
 /* 28 */	NULL,		NULL,		NULL,		NULL,
@@ -3208,8 +3636,8 @@
 /* 7C */	NULL,		NULL,		NULL,		NULL,
 /* 80 */	NULL,		NULL,		NULL,		NULL,
 /* 84 */	NULL,		NULL,		NULL,		NULL,
-/* 88 */	NULL,		NULL,		NULL,		NULL,
-/* 8C */	NULL,		NULL,		NULL,		NULL,
+/* 88 */	NULL,		NULL,		"pfnacc",	NULL,
+/* 8C */	NULL,		NULL,		"pfpnacc",	NULL,
 /* 90 */	"pfcmpge",	NULL,		NULL,		NULL,
 /* 94 */	"pfmin",	NULL,		"pfrcp",	"pfrsqrt",
 /* 98 */	NULL,		NULL,		"pfsub",	NULL,
@@ -3220,7 +3648,7 @@
 /* AC */	NULL,		NULL,		"pfacc",	NULL,
 /* B0 */	"pfcmpeq",	NULL,		NULL,		NULL,
 /* B4 */	"pfmul",	NULL,		"pfrcpit2",	"pfmulhrw",
-/* B8 */	NULL,		NULL,		NULL,		NULL,
+/* B8 */	NULL,		NULL,		NULL,		"pswapd",
 /* BC */	NULL,		NULL,		NULL,		"pavgusb",
 /* C0 */	NULL,		NULL,		NULL,		NULL,
 /* C4 */	NULL,		NULL,		NULL,		NULL,
@@ -3242,8 +3670,8 @@
 
 static void
 OP_3DNowSuffix (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
 {
   const char *mnemonic;
 
@@ -3251,18 +3679,81 @@
   /* AMD 3DNow! instructions are specified by an opcode suffix in the
      place where an 8-bit immediate would normally go.  ie. the last
      byte of the instruction.  */
-  mnemonic = Suffix3DNow[*codep++];
+  obufp = obuf + strlen(obuf);
+  mnemonic = Suffix3DNow[*codep++ & 0xff];
   if (mnemonic)
-    strcat (obuf, mnemonic);
+    oappend (mnemonic);
   else
     {
       /* Since a variable sized modrm/sib chunk is between the start
 	 of the opcode (0x0f0f) and the opcode suffix, we need to do
 	 all the modrm processing first, and don't know until now that
 	 we have a bad opcode.  This necessitates some cleaning up.  */
-      op1out[0] = 0;
-      op2out[0] = 0;
-      codep = insn_codep + 1;
-      strcat (obuf, "(bad)");
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp();
     }
 }
+
+
+static const char *simd_cmp_op [] = {
+  "eq",
+  "lt",
+  "le",
+  "unord",
+  "neq",
+  "nlt",
+  "nle",
+  "ord"
+};
+
+static void
+OP_SIMD_Suffix (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  unsigned int cmp_type;
+
+  FETCH_DATA (the_info, codep + 1);
+  obufp = obuf + strlen(obuf);
+  cmp_type = *codep++ & 0xff;
+  if (cmp_type < 8)
+    {
+      sprintf (scratchbuf, "cmp%s%cs",
+	       simd_cmp_op[cmp_type],
+	       prefixes & PREFIX_REPZ ? 's' : 'p');
+      used_prefixes |= (prefixes & PREFIX_REPZ);
+      oappend (scratchbuf);
+    }
+  else
+    {
+      /* We have a bad extension byte.  Clean up.  */
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp();
+    }
+}
+
+static void
+SIMD_Fixup (extrachar, sizeflag)
+     int extrachar;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
+     forms of these instructions.  */
+  if (mod == 3)
+    {
+      char *p = obuf + strlen(obuf);
+      *(p+1) = '\0';
+      *p     = *(p-1);
+      *(p-1) = *(p-2);
+      *(p-2) = *(p-3);
+      *(p-3) = extrachar;
+    }
+}
+
+static void BadOp (void)
+{
+  codep = insn_codep + 1;	/* throw away prefixes and 1st. opcode byte */
+  oappend ("(bad)");
+}
diff --git a/opcodes/m10300-dis.c b/opcodes/m10300-dis.c
index 415bffc..7d7f74c 100644
--- a/opcodes/m10300-dis.c
+++ b/opcodes/m10300-dis.c
@@ -120,6 +120,7 @@
 	   || (insn & 0xfc) == 0x38
 	   || (insn & 0xff) == 0xde
 	   || (insn & 0xff) == 0xdf
+	   || (insn & 0xff) == 0xf9
 	   || (insn & 0xff) == 0xcc)
     {
       status = (*info->read_memory_func) (memaddr, buffer, 2, info);
@@ -142,6 +143,7 @@
 
   /* These are four byte insns.  */
   else if ((insn & 0xff) == 0xfa
+	   || (insn & 0xff) == 0xf7
 	   || (insn & 0xff) == 0xfb)
     {
       status = (*info->read_memory_func) (memaddr, buffer, 4, info);
@@ -234,6 +236,14 @@
 	mysize = 4;
       else if (op->format == FMT_D4)
 	mysize = 6;
+      else if (op->format == FMT_D6)
+	mysize = 3;
+      else if (op->format == FMT_D7 || op->format == FMT_D10)
+	mysize = 4;
+      else if (op->format == FMT_D8)
+	mysize = 6;
+      else if (op->format == FMT_D9)
+	mysize = 7;
       else
 	mysize = 7;
 	
@@ -252,6 +262,10 @@
 		   || op->format == FMT_S2 || op->format == FMT_S4
 		   || op->format == FMT_S6 || op->format == FMT_D5)
 	    extra_shift = 16;
+	  else if (op->format == FMT_D7
+		   || op->format == FMT_D8
+		   || op->format == FMT_D9)
+	    extra_shift = 8;
 	  else
 	    extra_shift = 0;
 
@@ -266,6 +280,11 @@
 	    {
 	      extension = 0;
 	    }
+	  else if (size == 3
+		   && op->format == FMT_D6)
+	    {
+	      extension = 0;
+	    }
 	  else if (size == 3)
 	    {
 	      insn &= 0xff0000;
@@ -286,6 +305,12 @@
 	    {
 	      extension = 0;
 	    }
+	  else if (size == 4
+		   && (op->format == FMT_D7
+		       || op->format == FMT_D10))
+	    {
+	      extension = 0;
+	    }
 	  else if (size == 4)
 	    {
 	      insn &= 0xffff0000;
@@ -336,6 +361,25 @@
 		}
 	      extension = *(unsigned char *)buffer;
 	    }
+	  else if (size == 6 && op->format == FMT_D8)
+	    {
+	      insn &= 0xffffff00;
+	      status = (*info->read_memory_func) (memaddr + 5, buffer, 1, info);
+	      if (status != 0)
+		{
+		  (*info->memory_error_func) (status, memaddr, info);
+		  return;
+		}
+	      insn |= *(unsigned char *)buffer;
+
+	      status = (*info->read_memory_func) (memaddr + 3, buffer, 2, info);
+	      if (status != 0)
+		{
+		  (*info->memory_error_func) (status, memaddr, info);
+		  return;
+		}
+	      extension = bfd_getl16 (buffer);
+	    }
 	  else if (size == 6)
 	    {
 	      unsigned long temp = 0;
@@ -351,6 +395,19 @@
 	      insn |= (temp >> 16) & 0xffff;
 	      extension = temp & 0xffff;
 	    }
+	  else if (size == 7 && op->format == FMT_D9)
+	    {
+	      insn &= 0xffffff00;
+	      status = (*info->read_memory_func) (memaddr + 3, buffer, 4, info);
+	      if (status != 0)
+		{
+		  (*info->memory_error_func) (status, memaddr, info);
+		  return;
+		}
+	      extension = bfd_getl32 (buffer);
+	      insn |= (extension & 0xff000000) >> 24;
+	      extension &= 0xffffff;
+	    }
 	  else if (size == 7 && op->opcode == 0xdd000000)
 	    {
 	      unsigned long temp = 0;
@@ -410,6 +467,10 @@
 
 	      operand = &mn10300_operands[*opindex_ptr];
 
+	      /* If this operand is a PLUS (autoincrement), then do not emit
+		 a comma before emitting the plus.  */
+	      if ((operand->flags & MN10300_OPERAND_PLUS) != 0)
+		nocomma = 1;
 
 	      if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
 		{
@@ -420,6 +481,17 @@
 		  temp &= ((1 << (32 - operand->bits)) - 1);
 		  value |= temp;
 		}
+	      else if ((operand->flags & MN10300_OPERAND_24BIT) != 0)
+		{
+		  unsigned long temp;
+		  value = insn & ((1 << operand->bits) - 1);
+		  value <<= (24 - operand->bits);
+		  temp = extension >> operand->shift;
+		  temp &= ((1 << (24 - operand->bits)) - 1);
+		  value |= temp;
+		  if ((operand->flags & MN10300_OPERAND_SIGNED) != 0)
+		    value = ((value & 0xffffff) ^ (~0x7fffff)) + 0x800000;
+		}
 	      else if ((operand->flags & MN10300_OPERAND_EXTENDED) != 0)
 		{
 		  value = ((extension >> (operand->shift))
@@ -432,6 +504,8 @@
 		}
 
 	      if ((operand->flags & MN10300_OPERAND_SIGNED) != 0
+		   /* These are properly extended by the code above.  */
+		   && ((operand->flags & MN10300_OPERAND_24BIT) == 0)
 		  )
 		value = ((long)(value << (32 - operand->bits))
 			  >> (32 - operand->bits));
@@ -466,6 +540,45 @@
 	      else if ((operand->flags & MN10300_OPERAND_MDR) != 0)
 		(*info->fprintf_func) (info->stream, "mdr");
 
+	      else if ((operand->flags & MN10300_OPERAND_RREG) != 0)
+		{
+		  value = ((insn >> (operand->shift + extra_shift))
+			   & ((1 << operand->bits) - 1));
+		  if (value < 8)
+		    (*info->fprintf_func) (info->stream, "r%d", value);
+		  else if (value < 12)
+		    (*info->fprintf_func) (info->stream, "a%d", value - 8);
+		  else
+		    (*info->fprintf_func) (info->stream, "d%d", value - 12);
+		}
+
+	      else if ((operand->flags & MN10300_OPERAND_XRREG) != 0)
+		{
+		  value = ((insn >> (operand->shift + extra_shift))
+			   & ((1 << operand->bits) - 1));
+		  if (value == 0)
+		    (*info->fprintf_func) (info->stream, "sp", value);
+		  else
+		  (*info->fprintf_func) (info->stream, "xr%d", value);
+		}
+
+	      else if ((operand->flags & MN10300_OPERAND_USP) != 0)
+		(*info->fprintf_func) (info->stream, "usp");
+
+	      else if ((operand->flags & MN10300_OPERAND_SSP) != 0)
+		(*info->fprintf_func) (info->stream, "ssp");
+
+	      else if ((operand->flags & MN10300_OPERAND_MSP) != 0)
+		(*info->fprintf_func) (info->stream, "msp");
+
+	      else if ((operand->flags & MN10300_OPERAND_PC) != 0)
+		(*info->fprintf_func) (info->stream, "pc");
+
+	      else if ((operand->flags & MN10300_OPERAND_EPSW) != 0)
+		(*info->fprintf_func) (info->stream, "epsw");
+
+	      else if ((operand->flags & MN10300_OPERAND_PLUS) != 0)
+		(*info->fprintf_func) (info->stream, "+");
 
 	      else if ((operand->flags & MN10300_OPERAND_PAREN) != 0)
 		{
@@ -528,6 +641,27 @@
 		      comma = 1;
 		    }
 
+		  if (value & 0x04)
+		    {
+		      if (comma)
+			(*info->fprintf_func) (info->stream, ",");
+		      (*info->fprintf_func) (info->stream, "exreg0");
+		      comma = 1;
+		    }
+		  if (value & 0x02)
+		    {
+		      if (comma)
+			(*info->fprintf_func) (info->stream, ",");
+		      (*info->fprintf_func) (info->stream, "exreg1");
+		      comma = 1;
+		    }
+		  if (value & 0x01)
+		    {
+		      if (comma)
+			(*info->fprintf_func) (info->stream, ",");
+		      (*info->fprintf_func) (info->stream, "exother");
+		      comma = 1;
+		    }
 		  (*info->fprintf_func) (info->stream, "]");
 		}
 
diff --git a/opcodes/m10300-opc.c b/opcodes/m10300-opc.c
index 8d0c0f3..c779dbc 100644
--- a/opcodes/m10300-opc.c
+++ b/opcodes/m10300-opc.c
@@ -1,5 +1,5 @@
 /* Assemble Matsushita MN10300 instructions.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 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
@@ -88,7 +88,7 @@
 #define IMM16_PCREL    (IMM16+1)
   {16, 0, MN10300_OPERAND_PCREL | MN10300_OPERAND_RELAX | MN10300_OPERAND_SIGNED},
 
-/* 16bit unsigned dispacement in a memory operation which
+/* 16bit unsigned displacement in a memory operation which
    may promote to a 32bit displacement.  */
 #define IMM16_MEM    (IMM16_PCREL+1)
   {16, 0, MN10300_OPERAND_PROMOTE | MN10300_OPERAND_MEMADDR},
@@ -151,11 +151,11 @@
 #define DI (MDR+1)
   {2, 2, MN10300_OPERAND_DREG},
 
-/* 8 bit signed displacement, may promote to 16bit signed dispacement.  */
+/* 8 bit signed displacement, may promote to 16bit signed displacement.  */
 #define SD8    (DI+1)
   {8, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},
 
-/* 16 bit signed displacement, may promote to 32bit dispacement.  */
+/* 16 bit signed displacement, may promote to 32bit displacement.  */
 #define SD16    (SD8+1)
   {16, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},
 
@@ -212,6 +212,131 @@
 #define REGS    (REGS_SHIFT8+1)
   {8, 0, MN10300_OPERAND_REG_LIST},
 
+/* UStack pointer.  */
+#define USP    (REGS+1)
+  {0, 0, MN10300_OPERAND_USP},
+
+/* SStack pointer.  */
+#define SSP    (USP+1)
+  {0, 0, MN10300_OPERAND_SSP},
+
+/* MStack pointer.  */
+#define MSP    (SSP+1)
+  {0, 0, MN10300_OPERAND_MSP},
+
+/* PC .  */
+#define PC    (MSP+1)
+  {0, 0, MN10300_OPERAND_PC},
+
+/* 4 bit immediate for syscall.  */
+#define IMM4    (PC+1)
+  {4, 0, 0},
+
+/* Processor status word.  */
+#define EPSW    (IMM4+1)
+  {0, 0, MN10300_OPERAND_EPSW},
+
+/* rn register in the first register operand position.  */
+#define RN0      (EPSW+1)
+  {4, 0, MN10300_OPERAND_RREG},
+
+/* rn register in the fourth register operand position.  */
+#define RN2      (RN0+1)
+  {4, 4, MN10300_OPERAND_RREG},
+
+/* rm register in the first register operand position.  */
+#define RM0      (RN2+1)
+  {4, 0, MN10300_OPERAND_RREG},
+
+/* rm register in the second register operand position.  */
+#define RM1      (RM0+1)
+  {4, 2, MN10300_OPERAND_RREG},
+
+/* rm register in the third register operand position.  */
+#define RM2      (RM1+1)
+  {4, 4, MN10300_OPERAND_RREG},
+
+#define RN02      (RM2+1)
+  {4, 0, MN10300_OPERAND_RREG | MN10300_OPERAND_REPEATED},
+
+#define XRN0      (RN02+1)
+  {4, 0, MN10300_OPERAND_XRREG},
+
+#define XRM2      (XRN0+1)
+  {4, 4, MN10300_OPERAND_XRREG},
+
+/* + for autoincrement */
+#define PLUS	(XRM2+1)
+  {0, 0, MN10300_OPERAND_PLUS}, 
+
+#define XRN02      (PLUS+1)
+  {4, 0, MN10300_OPERAND_XRREG | MN10300_OPERAND_REPEATED},
+
+/* Ick */
+#define RD0      (XRN02+1)
+  {4, -8, MN10300_OPERAND_RREG},
+
+#define RD2      (RD0+1)
+  {4, -4, MN10300_OPERAND_RREG},
+
+/* 8 unsigned displacement in a memory operation which
+   may promote to a 32bit displacement.  */
+#define IMM8_MEM    (RD2+1)
+  {8, 0, MN10300_OPERAND_PROMOTE | MN10300_OPERAND_MEMADDR},
+
+/* Index register.  */
+#define RI (IMM8_MEM+1)
+  {4, 4, MN10300_OPERAND_RREG},
+
+/* 24 bit signed displacement, may promote to 32bit displacement.  */
+#define SD24    (RI+1)
+  {8, 0, MN10300_OPERAND_24BIT | MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},
+
+/* 24 bit unsigned immediate which may promote to a 32bit
+   unsigned immediate.  */
+#define IMM24    (SD24+1)
+  {8, 0, MN10300_OPERAND_24BIT | MN10300_OPERAND_PROMOTE},
+
+/* 24 bit signed immediate which may promote to a 32bit
+   signed immediate.  */
+#define SIMM24    (IMM24+1)
+  {8, 0, MN10300_OPERAND_24BIT | MN10300_OPERAND_PROMOTE | MN10300_OPERAND_SIGNED},
+
+/* 24bit unsigned displacement in a memory operation which
+   may promote to a 32bit displacement.  */
+#define IMM24_MEM    (SIMM24+1)
+  {8, 0, MN10300_OPERAND_24BIT | MN10300_OPERAND_PROMOTE | MN10300_OPERAND_MEMADDR},
+/* 32bit immediate, high 8 bits in the main instruction
+   word, 24 in the extension word.
+
+   The "bits" field indicates how many bits are in the
+   main instruction word for MN10300_OPERAND_SPLIT!  */
+#define IMM32_HIGH8    (IMM24_MEM+1)
+  {8, 0, MN10300_OPERAND_SPLIT},
+
+/* Similarly, but a memory address.  */
+#define IMM32_HIGH8_MEM  (IMM32_HIGH8+1)
+  {8, 0, MN10300_OPERAND_SPLIT | MN10300_OPERAND_MEMADDR},
+
+/* rm register in the seventh register operand position.  */
+#define RM6      (IMM32_HIGH8_MEM+1)
+  {4, 12, MN10300_OPERAND_RREG},
+
+/* rm register in the fifth register operand position.  */
+#define RN4      (RM6+1)
+  {4, 8, MN10300_OPERAND_RREG},
+
+/* 4 bit immediate for dsp instructions.  */
+#define IMM4_2    (RN4+1)
+  {4, 4, 0},
+
+/* 4 bit immediate for dsp instructions.  */
+#define SIMM4_2    (IMM4_2+1)
+  {4, 4, MN10300_OPERAND_SIGNED},
+
+/* 4 bit immediate for dsp instructions.  */
+#define SIMM4_6    (SIMM4_2+1)
+  {4, 12, MN10300_OPERAND_SIGNED},
 
 } ; 
 
@@ -283,6 +408,48 @@
 { "mov",	0xfa900000,  0xfff30000,  0,    FMT_D2, 0,	{AM1, MEM2(IMM16, SP)}},
 { "mov",	0xf3c0,	     0xffc0,	  0,    FMT_D0, 0,	{AM2, MEM2(DI, AN0)}},
 
+{ "mov",	0xf020,	     0xfffc,	  0,    FMT_D0, AM33,	{USP, AN0}},
+{ "mov",	0xf024,	     0xfffc,	  0,    FMT_D0, AM33,	{SSP, AN0}},
+{ "mov",	0xf028,	     0xfffc,	  0,    FMT_D0, AM33,	{MSP, AN0}},
+{ "mov",	0xf02c,	     0xfffc,	  0,    FMT_D0, AM33,	{PC, AN0}},
+{ "mov",	0xf030,	     0xfff3,	  0,    FMT_D0, AM33,	{AN1, USP}},
+{ "mov",	0xf031,	     0xfff3,	  0,    FMT_D0, AM33,	{AN1, SSP}},
+{ "mov",	0xf032,	     0xfff3,	  0,    FMT_D0, AM33,	{AN1, MSP}},
+{ "mov",	0xf2ec,	     0xfffc,	  0,    FMT_D0, AM33,	{EPSW, DN0}},
+{ "mov",	0xf2f1,	     0xfff3,	  0,    FMT_D0, AM33,	{DM1, EPSW}},
+{ "mov",	0xf500,	     0xffc0,	  0,    FMT_D0, AM33,	{AM2, RN0}},
+{ "mov",	0xf540,	     0xffc0,	  0,    FMT_D0, AM33,	{DM2, RN0}},
+{ "mov",	0xf580,	     0xffc0,	  0,    FMT_D0, AM33,	{RM1, AN0}},
+{ "mov",	0xf5c0,	     0xffc0,	  0,    FMT_D0, AM33,	{RM1, DN0}},
+{ "mov",	0xf90800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mov",	0xf9e800,    0xffff00,    0,    FMT_D6, AM33,	{XRM2, RN0}},
+{ "mov",	0xf9f800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, XRN0}},
+{ "mov",	0xf90a00,    0xffff00,    0,    FMT_D6, AM33,	{MEM(RM0), RN2}},
+{ "mov",	0xf98a00,    0xffff0f,    0,    FMT_D6, AM33,	{MEM(SP), RN2}},
+{ "mov",	0xf96a00,    0xffff00,    0x12, FMT_D6, AM33,	{MEMINC(RM0), RN2}},
+{ "mov",	0xfb0e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM(IMM8_MEM), RN2}},
+{ "mov",	0xfd0e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM(IMM24_MEM), RN2}},
+{ "mov",	0xf91a00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, MEM(RN0)}},
+{ "mov",	0xf99a00,    0xffff0f,    0,    FMT_D6, AM33,	{RM2, MEM(SP)}},
+{ "mov",	0xf97a00,    0xffff00,    0,	FMT_D6, AM33,	{RM2, MEMINC(RN0)}},
+{ "mov",	0xfb1e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM(IMM8_MEM)}},
+{ "mov",	0xfd1e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM(IMM24_MEM)}},
+{ "mov",	0xfb0a0000,  0xffff0000,  0,    FMT_D7, AM33,	{MEM2(SD8, RM0), RN2}},
+{ "mov",	0xfd0a0000,  0xffff0000,  0,    FMT_D8, AM33,	{MEM2(SD24, RM0), RN2}},
+{ "mov",	0xfb8e0000,  0xffff000f,  0,    FMT_D7, AM33,	{MEM2(RI, RM0), RD2}},
+{ "mov",	0xfb1a0000,  0xffff0000,  0,    FMT_D7, AM33,	{RM2, MEM2(SD8, RN0)}},
+{ "mov",	0xfd1a0000,  0xffff0000,  0,    FMT_D8, AM33,	{RM2, MEM2(SD24, RN0)}},
+{ "mov",	0xfb8a0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM2(IMM8, SP), RN2}},
+{ "mov",	0xfd8a0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM2(IMM24, SP), RN2}},
+{ "mov",	0xfb9a0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM2(IMM8, SP)}},
+{ "mov",	0xfd9a0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM2(IMM24, SP)}},
+{ "mov",	0xfb9e0000,  0xffff000f,  0,    FMT_D7, AM33,	{RD2, MEM2(RI, RN0)}},
+{ "mov",	0xfb6a0000,  0xffff0000,  0x22, FMT_D7, AM33,	{MEMINC2 (RM0, SIMM8), RN2}},
+{ "mov",	0xfb7a0000,  0xffff0000,  0,	FMT_D7, AM33,	{RM2, MEMINC2 (RN0, SIMM8)}},
+{ "mov",	0xfd6a0000,  0xffff0000,  0x22, FMT_D8, AM33,	{MEMINC2 (RM0, IMM24), RN2}},
+{ "mov",	0xfd7a0000,  0xffff0000,  0,	FMT_D8, AM33,	{RM2, MEMINC2 (RN0, IMM24)}},
+{ "mov",	0xfe6a0000,  0xffff0000,  0x22, FMT_D9, AM33,	{MEMINC2 (RM0, IMM32_HIGH8), RN2}},
+{ "mov",	0xfe7a0000,  0xffff0000,  0,	FMT_D9, AM33,	{RN2, MEMINC2 (RM0, IMM32_HIGH8)}},
 /* These must come after most of the other move instructions to avoid matching
    a symbolic name with IMMxx operands.  Ugh.  */
 { "mov",	0x2c0000,    0xfc0000,    0,    FMT_S2, 0,	{SIMM16, DN0}},
@@ -305,8 +472,83 @@
    moves.  */
 { "mov",	0xf8f000,    0xfffc00,    0,    FMT_D1, AM30,	{MEM2(SD8N, AM0), SP}},
 { "mov",	0xf8f400,    0xfffc00,    0,    FMT_D1, AM30,	{SP, MEM2(SD8N, AN0)}},
+/* These are the same as the previous non-promoting versions.  The am33
+   does not have restrictions on the offsets used to load/store the stack
+   pointer.  */
+{ "mov",	0xf8f000,    0xfffc00,    0,    FMT_D1, AM33,	{MEM2(SD8, AM0), SP}},
+{ "mov",	0xf8f400,    0xfffc00,    0,    FMT_D1, AM33,	{SP, MEM2(SD8, AN0)}},
+/* These must come last so that we favor shorter move instructions for
+   loading immediates into d0-d3/a0-a3.  */
+{ "mov",	0xfb080000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "mov",	0xfd080000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "mov",	0xfe080000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "mov",	0xfbf80000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, XRN02}},
+{ "mov",	0xfdf80000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, XRN02}},
+{ "mov",	0xfef80000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, XRN02}},
+{ "mov",	0xfe0e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM(IMM32_HIGH8_MEM), RN2}},
+{ "mov",	0xfe1e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM(IMM32_HIGH8_MEM)}},
+{ "mov",	0xfe0a0000,  0xffff0000,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8,RM0), RN2}},
+{ "mov",	0xfe1a0000,  0xffff0000,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, RN0)}},
+{ "mov",	0xfe8a0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8, SP), RN2}},
+{ "mov",	0xfe9a0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, SP)}},
 
+{ "movu",	0xfb180000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "movu",	0xfd180000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "movu",	0xfe180000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "mcst9",	0xf630,      0xfff0,	  0,    FMT_D0, AM33,	{DN01}},
+{ "mcst48",	0xf660,	     0xfff0,	  0,    FMT_D0, AM33,	{DN01}},
+{ "swap",	0xf680,	     0xfff0,	  0,    FMT_D0, AM33,	{DM1, DN0}},
+{ "swap",	0xf9cb00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "swaph",	0xf690,	     0xfff0,	  0,    FMT_D0, AM33,	{DM1, DN0}},
+{ "swaph",	0xf9db00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "getchx",	0xf6c0,	     0xfff0,	  0,    FMT_D0, AM33,	{DN01}},
+{ "getclx",	0xf6d0,	     0xfff0,	  0,    FMT_D0, AM33,	{DN01}},
+{ "mac",	0xfb0f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "mac",	0xf90b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mac",	0xfb0b0000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "mac",	0xfd0b0000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "mac",	0xfe0b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "macu",	0xfb1f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "macu",	0xf91b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "macu",	0xfb1b0000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "macu",	0xfd1b0000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "macu",	0xfe1b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "macb",	0xfb2f0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
+{ "macb",	0xf92b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "macb",	0xfb2b0000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "macb",	0xfd2b0000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "macb",	0xfe2b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "macbu",	0xfb3f0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
+{ "macbu",	0xf93b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "macbu",	0xfb3b0000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "macbu",	0xfd3b0000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "macbu",	0xfe3b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "mach",	0xfb4f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "mach",	0xf94b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mach",	0xfb4b0000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "mach",	0xfd4b0000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "mach",	0xfe4b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "machu",	0xfb5f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "machu",	0xf95b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "machu",	0xfb5b0000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "machu",	0xfd5b0000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "machu",	0xfe5b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "dmach",	0xfb6f0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
+{ "dmach",	0xf96b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "dmach",	0xfe6b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "dmachu",	0xfb7f0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
+{ "dmachu",	0xf97b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "dmachu",	0xfe7b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "dmulh",	0xfb8f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "dmulh",	0xf98b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "dmulh",	0xfe8b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "dmulhu",	0xfb9f0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
+{ "dmulhu",	0xf99b00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "dmulhu",	0xfe9b0000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
+{ "mcste",	0xf9bb00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mcste",	0xfbbb0000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "swhw",	0xf9eb00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 
 { "movbu",	0xf040,	     0xfff0,	  0,    FMT_D0, 0,	{MEM(AM0), DN1}},
 { "movbu",	0xf84000,    0xfff000,    0,    FMT_D1, 0,	{MEM2(SD8, AM0), DN1}},
@@ -324,12 +566,36 @@
 { "movbu",	0xfa920000,  0xfff30000,  0,    FMT_D2, 0,	{DM1, MEM2(IMM16, SP)}},
 { "movbu",	0xf440,	     0xffc0,	  0,    FMT_D0, 0,	{DM2, MEM2(DI, AN0)}},
 { "movbu",	0x020000,    0xf30000,    0,    FMT_S2, 0,	{DM1, MEM(IMM16_MEM)}},
+{ "movbu",	0xf92a00,    0xffff00,    0,    FMT_D6, AM33,	{MEM(RM0), RN2}},
+{ "movbu",	0xf93a00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, MEM(RN0)}},
+{ "movbu",	0xf9aa00,    0xffff0f,    0,    FMT_D6, AM33,	{MEM(SP), RN2}},
+{ "movbu",	0xf9ba00,    0xffff0f,    0,    FMT_D6, AM33,	{RM2, MEM(SP)}},
+{ "movbu",	0xfb2a0000,  0xffff0000,  0,    FMT_D7, AM33,	{MEM2(SD8, RM0), RN2}},
+{ "movbu",	0xfd2a0000,  0xffff0000,  0,    FMT_D8, AM33,	{MEM2(SD24, RM0), RN2}},
+{ "movbu",	0xfb3a0000,  0xffff0000,  0,    FMT_D7, AM33,	{RM2, MEM2(SD8, RN0)}},
+{ "movbu",	0xfd3a0000,  0xffff0000,  0,    FMT_D8, AM33,	{RM2, MEM2(SD24, RN0)}},
+{ "movbu",	0xfbaa0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM2(IMM8, SP), RN2}},
+{ "movbu",	0xfdaa0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM2(IMM24, SP), RN2}},
+{ "movbu",	0xfbba0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM2(IMM8, SP)}},
+{ "movbu",	0xfdba0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM2(IMM24, SP)}},
+{ "movbu",	0xfb2e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM(IMM8_MEM), RN2}},
+{ "movbu",	0xfd2e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM(IMM24_MEM), RN2}},
+{ "movbu",	0xfb3e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM(IMM8_MEM)}},
+{ "movbu",	0xfd3e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM(IMM24_MEM)}},
+{ "movbu",	0xfbae0000,  0xffff000f,  0,    FMT_D7, AM33,	{MEM2(RI, RM0), RD2}},
+{ "movbu",	0xfbbe0000,  0xffff000f,  0,    FMT_D7, AM33,	{RD2, MEM2(RI, RN0)}},
 { "movbu",	0xfc400000,  0xfff00000,  0,    FMT_D4, 0,	{MEM2(IMM32,AM0), DN1}},
 { "movbu",	0xfcb80000,  0xfffc0000,  0,    FMT_D4, 0,	{MEM2(IMM32, SP), DN0}},
 { "movbu",	0xfca80000,  0xfffc0000,  0,    FMT_D4, 0,	{MEM(IMM32_MEM), DN0}},
 { "movbu",	0xfc500000,  0xfff00000,  0,    FMT_D4, 0,	{DM1, MEM2(IMM32,AN0)}},
 { "movbu",	0xfc920000,  0xfff30000,  0,    FMT_D4, 0,	{DM1, MEM2(IMM32, SP)}},
 { "movbu",	0xfc820000,  0xfff30000,  0,    FMT_D4, 0,	{DM1, MEM(IMM32_MEM)}},
+{ "movbu",	0xfe2a0000,  0xffff0000,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8,RM0), RN2}},
+{ "movbu",	0xfe3a0000,  0xffff0000,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, RN0)}},
+{ "movbu",	0xfeaa0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8,SP), RN2}},
+{ "movbu",	0xfeba0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, SP)}},
+{ "movbu",	0xfe2e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM(IMM32_HIGH8_MEM), RN2}},
+{ "movbu",	0xfe3e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM(IMM32_HIGH8_MEM)}},
 
 { "movhu",	0xf060,	     0xfff0,	  0,    FMT_D0, 0,	{MEM(AM0), DN1}},
 { "movhu",	0xf86000,    0xfff000,    0,    FMT_D1, 0,	{MEM2(SD8, AM0), DN1}},
@@ -347,28 +613,73 @@
 { "movhu",	0xfa930000,  0xfff30000,  0,    FMT_D2, 0,	{DM1, MEM2(IMM16, SP)}},
 { "movhu",	0xf4c0,	     0xffc0,	  0,    FMT_D0, 0,	{DM2, MEM2(DI, AN0)}},
 { "movhu",	0x030000,    0xf30000,    0,    FMT_S2, 0,	{DM1, MEM(IMM16_MEM)}},
+{ "movhu",	0xf94a00,    0xffff00,    0,    FMT_D6, AM33,	{MEM(RM0), RN2}},
+{ "movhu",	0xf95a00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, MEM(RN0)}},
+{ "movhu",	0xf9ca00,    0xffff0f,    0,    FMT_D6, AM33,	{MEM(SP), RN2}},
+{ "movhu",	0xf9da00,    0xffff0f,    0,    FMT_D6, AM33,	{RM2, MEM(SP)}},
+{ "movhu",	0xf9ea00,    0xffff00,    0x12, FMT_D6, AM33,	{MEMINC(RM0), RN2}},
+{ "movhu",	0xf9fa00,    0xffff00,    0,	FMT_D6, AM33,	{RM2, MEMINC(RN0)}},
+{ "movhu",	0xfb4a0000,  0xffff0000,  0,    FMT_D7, AM33,	{MEM2(SD8, RM0), RN2}},
+{ "movhu",	0xfd4a0000,  0xffff0000,  0,    FMT_D8, AM33,	{MEM2(SD24, RM0), RN2}},
+{ "movhu",	0xfb5a0000,  0xffff0000,  0,    FMT_D7, AM33,	{RM2, MEM2(SD8, RN0)}},
+{ "movhu",	0xfd5a0000,  0xffff0000,  0,    FMT_D8, AM33,	{RM2, MEM2(SD24, RN0)}},
+{ "movhu",	0xfbca0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM2(IMM8, SP), RN2}},
+{ "movhu",	0xfdca0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM2(IMM24, SP), RN2}},
+{ "movhu",	0xfbda0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM2(IMM8, SP)}},
+{ "movhu",	0xfdda0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM2(IMM24, SP)}},
+{ "movhu",	0xfb4e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{MEM(IMM8_MEM), RN2}},
+{ "movhu",	0xfd4e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{MEM(IMM24_MEM), RN2}},
+{ "movhu",	0xfbce0000,  0xffff000f,  0,    FMT_D7, AM33,	{MEM2(RI, RM0), RD2}},
+{ "movhu",	0xfbde0000,  0xffff000f,  0,    FMT_D7, AM33,	{RD2, MEM2(RI, RN0)}},
 { "movhu",	0xfc600000,  0xfff00000,  0,    FMT_D4, 0,	{MEM2(IMM32,AM0), DN1}},
 { "movhu",	0xfcbc0000,  0xfffc0000,  0,    FMT_D4, 0,	{MEM2(IMM32, SP), DN0}},
 { "movhu",	0xfcac0000,  0xfffc0000,  0,    FMT_D4, 0,	{MEM(IMM32_MEM), DN0}},
 { "movhu",	0xfc700000,  0xfff00000,  0,    FMT_D4, 0,	{DM1, MEM2(IMM32,AN0)}},
 { "movhu",	0xfc930000,  0xfff30000,  0,    FMT_D4, 0,	{DM1, MEM2(IMM32, SP)}},
 { "movhu",	0xfc830000,  0xfff30000,  0,    FMT_D4, 0,	{DM1, MEM(IMM32_MEM)}},
+{ "movhu",	0xfe4a0000,  0xffff0000,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8,RM0), RN2}},
+{ "movhu",	0xfe5a0000,  0xffff0000,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, RN0)}},
+{ "movhu",	0xfeca0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM2(IMM32_HIGH8, SP), RN2}},
+{ "movhu",	0xfeda0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM2(IMM32_HIGH8, SP)}},
+{ "movhu",	0xfe4e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{MEM(IMM32_HIGH8_MEM), RN2}},
+{ "movhu",	0xfb5e0000,  0xffff0f00,  0,    FMT_D7, AM33,	{RM2, MEM(IMM8_MEM)}},
+{ "movhu",	0xfd5e0000,  0xffff0f00,  0,    FMT_D8, AM33,	{RM2, MEM(IMM24_MEM)}},
+{ "movhu",	0xfe5e0000,  0xffff0f00,  0,    FMT_D9, AM33,	{RM2, MEM(IMM32_HIGH8_MEM)}},
+{ "movhu",	0xfbea0000,  0xffff0000,  0x22, FMT_D7, AM33,	{MEMINC2 (RM0, SIMM8), RN2}},
+{ "movhu",	0xfbfa0000,  0xffff0000,  0,	FMT_D7, AM33,	{RM2, MEMINC2 (RN0, SIMM8)}},
+{ "movhu",	0xfdea0000,  0xffff0000,  0x22, FMT_D8, AM33,	{MEMINC2 (RM0, IMM24), RN2}},
+{ "movhu",	0xfdfa0000,  0xffff0000,  0,	FMT_D8, AM33,	{RM2, MEMINC2 (RN0, IMM24)}},
+{ "movhu",	0xfeea0000,  0xffff0000,  0x22, FMT_D9, AM33,	{MEMINC2 (RM0, IMM32_HIGH8), RN2}},
+{ "movhu",	0xfefa0000,  0xffff0000,  0,	FMT_D9, AM33,	{RN2, MEMINC2 (RM0, IMM32_HIGH8)}},
 
 { "ext",	0xf2d0,	     0xfffc,	  0,    FMT_D0, 0,	{DN0}},
+{ "ext",	0xf91800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
+{ "extb",	0xf92800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "extb",	0x10, 	     0xfc,	  0,    FMT_S0, 0,	{DN0}},
+{ "extb",	0xf92800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
+{ "extbu",	0xf93800,    0xffff00,	  0,    FMT_D6, AM33,	{RM2, RN0}},
 { "extbu",	0x14,	     0xfc,	  0,    FMT_S0, 0,	{DN0}},
+{ "extbu",	0xf93800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
+{ "exth",	0xf94800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "exth",	0x18,	     0xfc,	  0,    FMT_S0, 0,	{DN0}},
+{ "exth",	0xf94800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
+{ "exthu",	0xf95800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "exthu",	0x1c,	     0xfc,	  0,    FMT_S0, 0,	{DN0}},
+{ "exthu",	0xf95800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "movm",	0xce00,	     0xff00,	  0,    FMT_S1, 0,	{MEM(SP), REGS}},
 { "movm",	0xcf00,	     0xff00,	  0,    FMT_S1, 0,	{REGS, MEM(SP)}},
+{ "movm",	0xf8ce00,    0xffff00,    0,    FMT_D1, AM33,	{MEM(USP), REGS}},
+{ "movm",	0xf8cf00,    0xffff00,    0,    FMT_D1, AM33,	{REGS, MEM(USP)}},
 
 { "clr",	0x00,	     0xf3,	  0,    FMT_S0, 0,	{DN1}},
+{ "clr",	0xf96800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
+{ "add",	0xfb7c0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "add",	0xe0,	     0xf0,	  0,    FMT_S0, 0,	{DM1, DN0}},
 { "add",	0xf160,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, AN0}},
 { "add",	0xf150,	     0xfff0,	  0,    FMT_D0, 0,	{AM1, DN0}},
@@ -379,33 +690,66 @@
 { "add",	0xfad00000,  0xfffc0000,  0,    FMT_D2, 0,	{SIMM16, AN0}},
 { "add",	0xf8fe00,    0xffff00,    0,    FMT_D1, 0,	{SIMM8, SP}},
 { "add",	0xfafe0000,  0xffff0000,  0,    FMT_D2, 0,	{SIMM16, SP}},
+{ "add",	0xf97800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "add",	0xfcc00000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
 { "add",	0xfcd00000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, AN0}},
 { "add",	0xfcfe0000,  0xffff0000,  0,    FMT_D4, 0,	{IMM32, SP}},
+{ "add",	0xfb780000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "add",	0xfd780000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "add",	0xfe780000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "addc",	0xfb8c0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "addc",	0xf140,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "addc",	0xf98800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "addc",	0xfb880000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "addc",	0xfd880000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "addc",	0xfe880000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "sub",	0xfb9c0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "sub",	0xf100,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "sub",	0xf120,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, AN0}},
 { "sub",	0xf110,	     0xfff0,	  0,    FMT_D0, 0,	{AM1, DN0}},
 { "sub",	0xf130,	     0xfff0,	  0,    FMT_D0, 0,	{AM1, AN0}},
+{ "sub",	0xf99800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "sub",	0xfcc40000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
 { "sub",	0xfcd40000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, AN0}},
+{ "sub",	0xfb980000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "sub",	0xfd980000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "sub",	0xfe980000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "subc",	0xfa8c0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "subc",	0xf180,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "subc",	0xf9a800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "subc",	0xfba80000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "subc",	0xfda80000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "subc",	0xfea80000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "mul",	0xfbad0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
 { "mul",	0xf240,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "mul",	0xf9a900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mul",	0xfba90000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "mul",	0xfda90000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "mul",	0xfea90000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "mulu",	0xfbbd0000,  0xffff0000,  0xc,  FMT_D7, AM33,	{RM2, RN0, RD2, RD0}},
 { "mulu",	0xf250,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "mulu",	0xf9b900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "mulu",	0xfbb90000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "mulu",	0xfdb90000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "mulu",	0xfeb90000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
 { "div",	0xf260,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "div",	0xf9c900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 
 { "divu",	0xf270,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
+{ "divu",	0xf9d900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 
 { "inc",	0x40,	     0xf3,	  0,    FMT_S0, 0,	{DN1}},
 { "inc",	0x41,	     0xf3,	  0,    FMT_S0, 0,	{AN1}},
+{ "inc",	0xf9b800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "inc4",	0x50,	     0xfc,	  0,    FMT_S0, 0,	{AN0}},
+{ "inc4",	0xf9c800,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "cmp",	0xa000,	     0xf000,	  0,    FMT_S1, 0,	{SIMM8, DN01}},
 { "cmp",	0xa0,	     0xf0,	  0x3,  FMT_S0, 0,	{DM1, DN0}},
@@ -415,30 +759,57 @@
 { "cmp",	0xb0,	     0xf0,	  0x3,  FMT_S0, 0,	{AM1, AN0}},
 { "cmp",	0xfac80000,  0xfffc0000,  0,    FMT_D2, 0,	{SIMM16, DN0}},
 { "cmp",	0xfad80000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM16, AN0}},
+{ "cmp",	0xf9d800,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "cmp",	0xfcc80000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
 { "cmp",	0xfcd80000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, AN0}},
+{ "cmp",	0xfbd80000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "cmp",	0xfdd80000,  0xffff0000,  0,    FMT_D8, AM33,	{SIMM24, RN02}},
+{ "cmp",	0xfed80000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "and",	0xfb0d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "and",	0xf200,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "and",	0xf8e000,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
 { "and",	0xfae00000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM16, DN0}},
 { "and",	0xfafc0000,  0xffff0000,  0,    FMT_D2, 0,	{IMM16, PSW}},
+{ "and",	0xfcfc0000,  0xffff0000,  0,    FMT_D4, AM33,	{IMM32, EPSW}},
+{ "and",	0xf90900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "and",	0xfce00000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
+{ "and",	0xfb090000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "and",	0xfd090000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "and",	0xfe090000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "or",		0xfb1d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "or",		0xf210,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "or",		0xf8e400,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
 { "or",		0xfae40000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM16, DN0}},
 { "or",		0xfafd0000,  0xffff0000,  0,    FMT_D2, 0,	{IMM16, PSW}},
+{ "or",		0xfcfd0000,  0xffff0000,  0,    FMT_D4, AM33,	{IMM32, EPSW}},
+{ "or",		0xf91900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "or",		0xfce40000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
+{ "or",		0xfb190000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "or",		0xfd190000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "or",		0xfe190000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
+{ "xor",	0xfb2d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "xor",	0xf220,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "xor",	0xfae80000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM16, DN0}},
+{ "xor",	0xf92900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 { "xor",	0xfce80000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
+{ "xor",	0xfb290000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "xor",	0xfd290000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "xor",	0xfe290000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 
 { "not",	0xf230,	     0xfffc,	  0,    FMT_D0, 0,	{DN0}},
+{ "not",	0xf93900,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "btst",	0xf8ec00,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
 { "btst",	0xfaec0000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM16, DN0}},
 { "btst",	0xfcec0000,  0xfffc0000,  0,    FMT_D4, 0,	{IMM32, DN0}},
+/* Place these before the ones with IMM8E and SD8N_SHIFT8 since we want the
+   them to match last since they do not promote.  */
+{ "btst",	0xfbe90000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "btst",	0xfde90000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "btst",	0xfee90000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 { "btst",	0xfe020000,  0xffff0000,  0,    FMT_D5, 0,	{IMM8E, MEM(IMM32_LOWSHIFT8)}},
 { "btst",	0xfaf80000,  0xfffc0000,  0,    FMT_D2, 0, 	{IMM8, MEM2(SD8N_SHIFT8, AN0)}},
 
@@ -450,23 +821,44 @@
 { "bclr",	0xfe010000,  0xffff0000,  0,    FMT_D5, 0,	{IMM8E, MEM(IMM32_LOWSHIFT8)}},
 { "bclr",	0xfaf40000,  0xfffc0000,  0,    FMT_D2, 0,	{IMM8, MEM2(SD8N_SHIFT8,AN0)}},
 
+{ "asr",	0xfb4d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "asr",	0xf2b0,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "asr",	0xf8c800,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
+{ "asr",	0xf94900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "asr",	0xfb490000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "asr",	0xfd490000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "asr",	0xfe490000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 { "asr",	0xf8c801,    0xfffcff,    0,    FMT_D1, 0,	{DN0}},
+{ "asr",	0xfb490001,  0xffff00ff,  0,    FMT_D7, AM33,	{RN02}},
 
+{ "lsr",	0xfb5d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "lsr",	0xf2a0,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "lsr",	0xf8c400,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
+{ "lsr",	0xf95900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "lsr",	0xfb590000,  0xffff0000,  0,    FMT_D7, AM33,	{IMM8, RN02}},
+{ "lsr",	0xfd590000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "lsr",	0xfe590000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 { "lsr",	0xf8c401,    0xfffcff,    0,    FMT_D1, 0,	{DN0}},
+{ "lsr",	0xfb590001,  0xffff00ff,  0,    FMT_D7, AM33,	{RN02}},
 
+{ "asl",	0xfb6d0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "asl",	0xf290,	     0xfff0,	  0,    FMT_D0, 0,	{DM1, DN0}},
 { "asl",	0xf8c000,    0xfffc00,    0,    FMT_D1, 0,	{IMM8, DN0}},
+{ "asl",	0xf96900,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
+{ "asl",	0xfb690000,  0xffff0000,  0,    FMT_D7, AM33,	{SIMM8, RN02}},
+{ "asl",	0xfd690000,  0xffff0000,  0,    FMT_D8, AM33,	{IMM24, RN02}},
+{ "asl",	0xfe690000,  0xffff0000,  0,    FMT_D9, AM33,	{IMM32_HIGH8, RN02}},
 { "asl",	0xf8c001,    0xfffcff,    0,    FMT_D1, 0,	{DN0}},
+{ "asl",	0xfb690001,  0xffff00ff,  0,    FMT_D7, AM33,	{RN02}},
 
 { "asl2",	0x54,	     0xfc,	  0,    FMT_S0, 0,	{DN0}},
+{ "asl2",	0xf97900,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "ror",	0xf284,	     0xfffc,	  0,    FMT_D0, 0,	{DN0}},
+{ "ror",	0xf98900,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "rol",	0xf280,	     0xfffc,	  0,    FMT_D0, 0,	{DN0}},
+{ "rol",	0xf99900,    0xffff00,    0,    FMT_D6, AM33,	{RN02}},
 
 { "beq",	0xc800,	     0xff00,	  0,    FMT_S1, 0,	{SD8N_PCREL}},
 { "bne",	0xc900,	     0xff00,	  0,    FMT_S1, 0,	{SD8N_PCREL}},
@@ -655,13 +1047,18 @@
 { "mulqu",	0xfb140000,  0xfffc0000,  0,    FMT_D2, AM30,	{SIMM16, DN0}},
 { "mulqu",	0xfd140000,  0xfffc0000,  0,    FMT_D4, AM30,	{IMM32, DN0}},
 { "sat16",	0xf640,	     0xfff0,	  0,    FMT_D0, AM30,	{DM1, DN0}},
+{ "sat16",	0xf9ab00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 
 { "sat24",	0xf650,	     0xfff0,	  0,    FMT_D0, AM30,	{DM1, DN0}},
+{ "sat24",	0xfbaf0000,  0xffff00ff,  0,    FMT_D7, AM33,	{RM2, RN0}},
 
+{ "bsch",	0xfbff0000,  0xffff000f,  0,    FMT_D7, AM33,	{RM2, RN0, RD2}},
 { "bsch",	0xf670,	     0xfff0,	  0,    FMT_D0, AM30,	{DM1, DN0}},
+{ "bsch",	0xf9fb00,    0xffff00,    0,    FMT_D6, AM33,	{RM2, RN0}},
 
 /* Extension.  We need some instruction to trigger "emulated syscalls"
    for our simulator.  */
+{ "syscall",	0xf0e0,	     0xfff0,	  0,    FMT_D0, AM33,	{IMM4}},
 { "syscall",    0xf0c0,      0xffff,      0,    FMT_D0, 0,	{UNUSED}},
 
 /* Extension.  When talking to the simulator, gdb requires some instruction
@@ -672,6 +1069,353 @@
    both mn10x00 architectures.  */
 { "break",	0xff,	     0xff,	  0,    FMT_S0, 0,	{UNUSED}},
 
+{ "add_add",	0xf7000000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_add",	0xf7100000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "add_add",	0xf7040000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_add",	0xf7140000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "add_sub",	0xf7200000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_sub",	0xf7300000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "add_sub",	0xf7240000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_sub",	0xf7340000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "add_cmp",	0xf7400000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_cmp",	0xf7500000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "add_cmp",	0xf7440000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_cmp",	0xf7540000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "add_mov",	0xf7600000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_mov",	0xf7700000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "add_mov",	0xf7640000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_mov",	0xf7740000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "add_asr",	0xf7800000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_asr",	0xf7900000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "add_asr",	0xf7840000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_asr",	0xf7940000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "add_lsr",	0xf7a00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_lsr",	0xf7b00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "add_lsr",	0xf7a40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_lsr",	0xf7b40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "add_asl",	0xf7c00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "add_asl",	0xf7d00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "add_asl",	0xf7c40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "add_asl",	0xf7d40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "cmp_add",	0xf7010000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_add",	0xf7110000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "cmp_add",	0xf7050000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_add",	0xf7150000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "cmp_sub",	0xf7210000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_sub",	0xf7310000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "cmp_sub",	0xf7250000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_sub",	0xf7350000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "cmp_mov",	0xf7610000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_mov",	0xf7710000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "cmp_mov",	0xf7650000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_mov",	0xf7750000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "cmp_asr",	0xf7810000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_asr",	0xf7910000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "cmp_asr",	0xf7850000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_asr",	0xf7950000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "cmp_lsr",	0xf7a10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_lsr",	0xf7b10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "cmp_lsr",	0xf7a50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_lsr",	0xf7b50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "cmp_asl",	0xf7c10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "cmp_asl",	0xf7d10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "cmp_asl",	0xf7c50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "cmp_asl",	0xf7d50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "sub_add",	0xf7020000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_add",	0xf7120000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sub_add",	0xf7060000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_add",	0xf7160000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "sub_sub",	0xf7220000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_sub",	0xf7320000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sub_sub",	0xf7260000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_sub",	0xf7360000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "sub_cmp",	0xf7420000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_cmp",	0xf7520000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sub_cmp",	0xf7460000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_cmp",	0xf7560000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "sub_mov",	0xf7620000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_mov",	0xf7720000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sub_mov",	0xf7660000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_mov",	0xf7760000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "sub_asr",	0xf7820000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_asr",	0xf7920000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sub_asr",	0xf7860000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_asr",	0xf7960000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "sub_lsr",	0xf7a20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_lsr",	0xf7b20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sub_lsr",	0xf7a60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_lsr",	0xf7b60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "sub_asl",	0xf7c20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sub_asl",	0xf7d20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sub_asl",	0xf7c60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "sub_asl",	0xf7d60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "mov_add",	0xf7030000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_add",	0xf7130000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "mov_add",	0xf7070000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_add",	0xf7170000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "mov_sub",	0xf7230000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_sub",	0xf7330000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "mov_sub",	0xf7270000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_sub",	0xf7370000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "mov_cmp",	0xf7430000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_cmp",	0xf7530000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "mov_cmp",	0xf7470000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_cmp",	0xf7570000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "mov_mov",	0xf7630000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_mov",	0xf7730000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "mov_mov",	0xf7670000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_mov",	0xf7770000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, SIMM4_2, RN0}},
+{ "mov_asr",	0xf7830000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_asr",	0xf7930000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "mov_asr",	0xf7870000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_asr",	0xf7970000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "mov_lsr",	0xf7a30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_lsr",	0xf7b30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "mov_lsr",	0xf7a70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_lsr",	0xf7b70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "mov_asl",	0xf7c30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "mov_asl",	0xf7d30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "mov_asl",	0xf7c70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, RM2, RN0}},
+{ "mov_asl",	0xf7d70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_6, RN4, IMM4_2, RN0}},
+{ "and_add",	0xf7080000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_add",	0xf7180000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "and_sub",	0xf7280000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_sub",	0xf7380000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "and_cmp",	0xf7480000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_cmp",	0xf7580000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "and_mov",	0xf7680000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_mov",	0xf7780000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "and_asr",	0xf7880000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_asr",	0xf7980000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "and_lsr",	0xf7a80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_lsr",	0xf7b80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "and_asl",	0xf7c80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "and_asl",	0xf7d80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "dmach_add",	0xf7090000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_add",	0xf7190000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "dmach_sub",	0xf7290000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_sub",	0xf7390000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "dmach_cmp",	0xf7490000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_cmp",	0xf7590000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "dmach_mov",	0xf7690000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_mov",	0xf7790000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "dmach_asr",	0xf7890000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_asr",	0xf7990000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "dmach_lsr",	0xf7a90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_lsr",	0xf7b90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "dmach_asl",	0xf7c90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "dmach_asl",	0xf7d90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "xor_add",	0xf70a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_add",	0xf71a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "xor_sub",	0xf72a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_sub",	0xf73a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "xor_cmp",	0xf74a0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_cmp",	0xf75a0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "xor_mov",	0xf76a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_mov",	0xf77a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "xor_asr",	0xf78a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_asr",	0xf79a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "xor_lsr",	0xf7aa0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_lsr",	0xf7ba0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "xor_asl",	0xf7ca0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "xor_asl",	0xf7da0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "swhw_add",	0xf70b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_add",	0xf71b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "swhw_sub",	0xf72b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_sub",	0xf73b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "swhw_cmp",	0xf74b0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_cmp",	0xf75b0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "swhw_mov",	0xf76b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_mov",	0xf77b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "swhw_asr",	0xf78b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_asr",	0xf79b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "swhw_lsr",	0xf7ab0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_lsr",	0xf7bb0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "swhw_asl",	0xf7cb0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "swhw_asl",	0xf7db0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "or_add",	0xf70c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_add",	0xf71c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "or_sub",	0xf72c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_sub",	0xf73c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "or_cmp",	0xf74c0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_cmp",	0xf75c0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "or_mov",	0xf76c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_mov",	0xf77c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "or_asr",	0xf78c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_asr",	0xf79c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "or_lsr",	0xf7ac0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_lsr",	0xf7bc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "or_asl",	0xf7cc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "or_asl",	0xf7dc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sat16_add",	0xf70d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_add",	0xf71d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sat16_sub",	0xf72d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_sub",	0xf73d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sat16_cmp",	0xf74d0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_cmp",	0xf75d0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sat16_mov",	0xf76d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_mov",	0xf77d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, SIMM4_2, RN0}},
+{ "sat16_asr",	0xf78d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_asr",	0xf79d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sat16_lsr",	0xf7ad0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_lsr",	0xf7bd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+{ "sat16_asl",	0xf7cd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, RM2, RN0}},
+{ "sat16_asl",	0xf7dd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM6, RN4, IMM4_2, RN0}},
+/* Ugh.  Synthetic instructions.  */
+{ "add_and",	0xf7080000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_and",	0xf7180000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "add_dmach",	0xf7090000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_dmach",	0xf7190000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "add_or",	0xf70c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_or",	0xf71c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "add_sat16",	0xf70d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_sat16",	0xf71d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "add_swhw",	0xf70b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_swhw",	0xf71b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "add_xor",	0xf70a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "add_xor",	0xf71a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "asl_add",	0xf7c00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_add",	0xf7d00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_add",	0xf7c40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asl_add",	0xf7d40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asl_and",	0xf7c80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_and",	0xf7d80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_cmp",	0xf7c10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_cmp",	0xf7d10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4, }},
+{ "asl_cmp",	0xf7c50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asl_cmp",	0xf7d50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asl_dmach",	0xf7c90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_dmach",	0xf7d90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_mov",	0xf7c30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_mov",	0xf7d30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_mov",	0xf7c70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asl_mov",	0xf7d70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asl_or",	0xf7cc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_or",	0xf7dc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_sat16",	0xf7cd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_sat16",	0xf7dd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_sub",	0xf7c20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_sub",	0xf7d20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_sub",	0xf7c60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asl_sub",	0xf7d60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asl_swhw",	0xf7cb0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_swhw",	0xf7db0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asl_xor",	0xf7ca0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asl_xor",	0xf7da0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_add",	0xf7800000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_add",	0xf7900000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_add",	0xf7840000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asr_add",	0xf7940000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asr_and",	0xf7880000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_and",	0xf7980000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_cmp",	0xf7810000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_cmp",	0xf7910000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4, }},
+{ "asr_cmp",	0xf7850000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asr_cmp",	0xf7950000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asr_dmach",	0xf7890000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_dmach",	0xf7990000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_mov",	0xf7830000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_mov",	0xf7930000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_mov",	0xf7870000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asr_mov",	0xf7970000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asr_or",	0xf78c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_or",	0xf79c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_sat16",	0xf78d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_sat16",	0xf79d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_sub",	0xf7820000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_sub",	0xf7920000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_sub",	0xf7860000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "asr_sub",	0xf7960000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "asr_swhw",	0xf78b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_swhw",	0xf79b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "asr_xor",	0xf78a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "asr_xor",	0xf79a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "cmp_and",	0xf7480000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_and",	0xf7580000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "cmp_dmach",	0xf7490000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_dmach",	0xf7590000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "cmp_or",	0xf74c0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_or",	0xf75c0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "cmp_sat16",	0xf74d0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_sat16",	0xf75d0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "cmp_swhw",	0xf74b0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_swhw",	0xf75b0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "cmp_xor",	0xf74a0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "cmp_xor",	0xf75a0000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "lsr_add",	0xf7a00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_add",	0xf7b00000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_add",	0xf7a40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "lsr_add",	0xf7b40000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "lsr_and",	0xf7a80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_and",	0xf7b80000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_cmp",	0xf7a10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_cmp",	0xf7b10000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4, }},
+{ "lsr_cmp",	0xf7a50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "lsr_cmp",	0xf7b50000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "lsr_dmach",	0xf7a90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_dmach",	0xf7b90000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_mov",	0xf7a30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_mov",	0xf7b30000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_mov",	0xf7a70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "lsr_mov",	0xf7b70000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "lsr_or",	0xf7ac0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_or",	0xf7bc0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_sat16",	0xf7ad0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_sat16",	0xf7bd0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_sub",	0xf7a20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_sub",	0xf7b20000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_sub",	0xf7a60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, SIMM4_6, RN4}},
+{ "lsr_sub",	0xf7b60000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, SIMM4_6, RN4}},
+{ "lsr_swhw",	0xf7ab0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_swhw",	0xf7bb0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "lsr_xor",	0xf7aa0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "lsr_xor",	0xf7ba0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {IMM4_2, RN0, RM6, RN4}},
+{ "mov_and",	0xf7680000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_and",	0xf7780000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_dmach",	0xf7690000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_dmach",	0xf7790000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_or",	0xf76c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_or",	0xf77c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_sat16",	0xf76d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_sat16",	0xf77d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_swhw",	0xf76b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_swhw",	0xf77b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_xor",	0xf76a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "mov_xor",	0xf77a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_and",	0xf7280000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_and",	0xf7380000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_dmach",	0xf7290000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_dmach",	0xf7390000,  0xffff0000,  0x0,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_or",	0xf72c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_or",	0xf73c0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_sat16",	0xf72d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_sat16",	0xf73d0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_swhw",	0xf72b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_swhw",	0xf73b0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "sub_xor",	0xf72a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {RM2, RN0, RM6, RN4}},
+{ "sub_xor",	0xf73a0000,  0xffff0000,  0xa,  FMT_D10, AM33,	 {SIMM4_2, RN0, RM6, RN4}},
+{ "mov_llt",	0xf7e00000,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lgt",	0xf7e00001,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lge",	0xf7e00002,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lle",	0xf7e00003,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lcs",	0xf7e00004,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lhi",	0xf7e00005,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lcc",	0xf7e00006,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lls",	0xf7e00007,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_leq",	0xf7e00008,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lne",	0xf7e00009,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "mov_lra",	0xf7e0000a,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "llt_mov",	0xf7e00000,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lgt_mov",	0xf7e00001,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lge_mov",	0xf7e00002,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lle_mov",	0xf7e00003,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lcs_mov",	0xf7e00004,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lhi_mov",	0xf7e00005,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lcc_mov",	0xf7e00006,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lls_mov",	0xf7e00007,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "leq_mov",	0xf7e00008,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lne_mov",	0xf7e00009,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
+{ "lra_mov",	0xf7e0000a,  0xffff000f,  0x22, FMT_D10, AM33,	 {MEMINC2 (RN4,SIMM4_2), RM6}},
  
 { 0, 0, 0, 0, 0, 0, {0}},
 
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index 378cd73..0aa62ce 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -216,10 +216,21 @@
      const char ** strp;
      CGEN_FIELDS * fields;
 {
-  const char * errmsg;
+  const char * errmsg = NULL;
+  /* Used by scalar operands that still need to be parsed.  */
+  long junk;
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_h_accums, & fields->f_acc);
+      break;
+    case M32R_OPERAND_ACCD :
+      errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_h_accums, & fields->f_accd);
+      break;
+    case M32R_OPERAND_ACCS :
+      errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_h_accums, & fields->f_accs);
+      break;
     case M32R_OPERAND_DCR :
       errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_cr_names, & fields->f_r1);
       break;
@@ -248,11 +259,14 @@
       errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_gr_names, & fields->f_r1);
       break;
     case M32R_OPERAND_HASH :
-      errmsg = parse_hash (cd, strp, M32R_OPERAND_HASH, &fields->f_nil);
+      errmsg = parse_hash (cd, strp, M32R_OPERAND_HASH, &junk);
       break;
     case M32R_OPERAND_HI16 :
       errmsg = parse_hi16 (cd, strp, M32R_OPERAND_HI16, &fields->f_hi16);
       break;
+    case M32R_OPERAND_IMM1 :
+      errmsg = cgen_parse_unsigned_integer (cd, strp, M32R_OPERAND_IMM1, &fields->f_imm1);
+      break;
     case M32R_OPERAND_SCR :
       errmsg = cgen_parse_keyword (cd, strp, & m32r_cgen_opval_cr_names, & fields->f_r2);
       break;
@@ -358,10 +372,15 @@
   p = CGEN_INSN_MNEMONIC (insn);
   while (*p && tolower (*p) == tolower (*str))
     ++p, ++str;
-  
-  if (* p || (* str && !isspace (* 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
@@ -383,6 +402,10 @@
       /* 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 (*str == CGEN_SYNTAX_CHAR (* syn))
 	    {
 #ifdef CGEN_MNEMONIC_OPERANDS
@@ -463,6 +486,7 @@
 {
   const char *start;
   CGEN_INSN_LIST *ilist;
+  const char *tmp_errmsg;
 
   /* Skip leading white space.  */
   while (isspace (* str))
@@ -479,7 +503,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 (! m32r_cgen_insn_supported (cd, insn))
 	continue;
@@ -496,7 +521,7 @@
       /* 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))
+      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)
@@ -510,16 +535,25 @@
       /* Try the next entry.  */
     }
 
-  /* FIXME: We can return a better error message than this.
-     Need to track why it failed and pick the right one.  */
   {
-    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/m32r-desc.c b/opcodes/m32r-desc.c
index 9cb5462..360c38f 100644
--- a/opcodes/m32r-desc.c
+++ b/opcodes/m32r-desc.c
@@ -46,6 +46,7 @@
 {
   { "base", MACH_BASE },
   { "m32r", MACH_M32R },
+  { "m32rx", MACH_M32RX },
   { "max", MACH_MAX },
   { 0, 0 }
 };
@@ -57,6 +58,15 @@
   { 0, 0 }
 };
 
+static const CGEN_ATTR_ENTRY PIPE_attr[] =
+{
+  { "NONE", PIPE_NONE },
+  { "O", PIPE_O },
+  { "S", PIPE_S },
+  { "OS", PIPE_OS },
+  { 0, 0 }
+};
+
 const CGEN_ATTR_TABLE m32r_cgen_ifield_attr_table[] =
 {
   { "MACH", & MACH_attr[0] },
@@ -99,6 +109,7 @@
 const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] =
 {
   { "MACH", & MACH_attr[0] },
+  { "PIPE", & 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] },
@@ -110,6 +121,7 @@
   { "NO-DIS", &bool_attr[0], &bool_attr[0] },
   { "PBB", &bool_attr[0], &bool_attr[0] },
   { "FILL-SLOT", &bool_attr[0], &bool_attr[0] },
+  { "SPECIAL", &bool_attr[0], &bool_attr[0] },
   { 0, 0, 0 }
 };
 
@@ -124,6 +136,7 @@
 
 static const CGEN_MACH m32r_cgen_mach_table[] = {
   { "m32r", "m32r", MACH_M32R },
+  { "m32rx", "m32rx", MACH_M32RX },
   { 0 }
 };
 
@@ -189,6 +202,18 @@
   23
 };
 
+static CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_accums_entries[] =
+{
+  { "a0", 0 },
+  { "a1", 1 }
+};
+
+CGEN_KEYWORD m32r_cgen_opval_h_accums =
+{
+  & m32r_cgen_opval_h_accums_entries[0],
+  2
+};
+
 
 
 /* The hardware table.  */
@@ -209,6 +234,7 @@
   { "h-gr", HW_H_GR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_gr_names, { 0|A(CACHE_ADDR)|A(PROFILE), { (1<<MACH_BASE) } } },
   { "h-cr", HW_H_CR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_cr_names, { 0, { (1<<MACH_BASE) } } },
   { "h-accum", HW_H_ACCUM, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
+  { "h-accums", HW_H_ACCUMS, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_accums, { 0, { (1<<MACH_M32RX) } } },
   { "h-cond", HW_H_COND, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-psw", HW_H_PSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-bpsw", HW_H_BPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
@@ -226,6 +252,7 @@
 const CGEN_IFLD m32r_cgen_ifld_table[] =
 {
   { M32R_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } }  },
+  { M32R_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } }  },
   { M32R_F_OP1, "f-op1", 0, 32, 0, 4, { 0, { (1<<MACH_BASE) } }  },
   { M32R_F_OP2, "f-op2", 0, 32, 8, 4, { 0, { (1<<MACH_BASE) } }  },
   { M32R_F_COND, "f-cond", 0, 32, 4, 4, { 0, { (1<<MACH_BASE) } }  },
@@ -242,6 +269,14 @@
   { M32R_F_DISP8, "f-disp8", 0, 32, 8, 8, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } }  },
   { M32R_F_DISP16, "f-disp16", 0, 32, 16, 16, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } }  },
   { M32R_F_DISP24, "f-disp24", 0, 32, 8, 24, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } }  },
+  { M32R_F_OP23, "f-op23", 0, 32, 9, 3, { 0, { (1<<MACH_BASE) } }  },
+  { M32R_F_OP3, "f-op3", 0, 32, 14, 2, { 0, { (1<<MACH_BASE) } }  },
+  { M32R_F_ACC, "f-acc", 0, 32, 8, 1, { 0, { (1<<MACH_BASE) } }  },
+  { M32R_F_ACCS, "f-accs", 0, 32, 12, 2, { 0, { (1<<MACH_BASE) } }  },
+  { M32R_F_ACCD, "f-accd", 0, 32, 4, 2, { 0, { (1<<MACH_BASE) } }  },
+  { 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 }
 };
 
@@ -290,6 +325,18 @@
 /* uimm16: 16 bit unsigned immediate */
   { "uimm16", M32R_OPERAND_UIMM16, HW_H_UINT, 16, 16,
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
+/* imm1: 1 bit immediate */
+  { "imm1", M32R_OPERAND_IMM1, HW_H_UINT, 15, 1,
+    { 0|A(HASH_PREFIX), { (1<<MACH_M32RX) } }  },
+/* accd: accumulator destination register */
+  { "accd", M32R_OPERAND_ACCD, HW_H_ACCUMS, 4, 2,
+    { 0, { (1<<MACH_M32RX) } }  },
+/* accs: accumulator source register */
+  { "accs", M32R_OPERAND_ACCS, HW_H_ACCUMS, 12, 2,
+    { 0, { (1<<MACH_M32RX) } }  },
+/* acc: accumulator reg (d) */
+  { "acc", M32R_OPERAND_ACC, HW_H_ACCUMS, 8, 1,
+    { 0, { (1<<MACH_M32RX) } }  },
 /* hash: # prefix */
   { "hash", M32R_OPERAND_HASH, HW_H_SINT, 0, 0,
     { 0, { (1<<MACH_BASE) } }  },
@@ -339,497 +386,672 @@
 /* add $dr,$sr */
   {
     M32R_INSN_ADD, "add", "add", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* add3 $dr,$sr,$hash$slo16 */
   {
     M32R_INSN_ADD3, "add3", "add3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* and $dr,$sr */
   {
     M32R_INSN_AND, "and", "and", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* and3 $dr,$sr,$uimm16 */
   {
     M32R_INSN_AND3, "and3", "and3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* or $dr,$sr */
   {
     M32R_INSN_OR, "or", "or", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* or3 $dr,$sr,$hash$ulo16 */
   {
     M32R_INSN_OR3, "or3", "or3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* xor $dr,$sr */
   {
     M32R_INSN_XOR, "xor", "xor", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* xor3 $dr,$sr,$uimm16 */
   {
     M32R_INSN_XOR3, "xor3", "xor3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* addi $dr,$simm8 */
   {
     M32R_INSN_ADDI, "addi", "addi", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* addv $dr,$sr */
   {
     M32R_INSN_ADDV, "addv", "addv", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* addv3 $dr,$sr,$simm16 */
   {
     M32R_INSN_ADDV3, "addv3", "addv3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* addx $dr,$sr */
   {
     M32R_INSN_ADDX, "addx", "addx", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* bc.s $disp8 */
   {
     M32R_INSN_BC8, "bc8", "bc.s", 16,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bc.l $disp24 */
   {
     M32R_INSN_BC24, "bc24", "bc.l", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* beq $src1,$src2,$disp16 */
   {
     M32R_INSN_BEQ, "beq", "beq", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* beqz $src2,$disp16 */
   {
     M32R_INSN_BEQZ, "beqz", "beqz", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bgez $src2,$disp16 */
   {
     M32R_INSN_BGEZ, "bgez", "bgez", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bgtz $src2,$disp16 */
   {
     M32R_INSN_BGTZ, "bgtz", "bgtz", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* blez $src2,$disp16 */
   {
     M32R_INSN_BLEZ, "blez", "blez", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bltz $src2,$disp16 */
   {
     M32R_INSN_BLTZ, "bltz", "bltz", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bnez $src2,$disp16 */
   {
     M32R_INSN_BNEZ, "bnez", "bnez", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bl.s $disp8 */
   {
     M32R_INSN_BL8, "bl8", "bl.s", 16,
-    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bl.l $disp24 */
   {
     M32R_INSN_BL24, "bl24", "bl.l", 32,
-    { 0|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* bcl.s $disp8 */
+  {
+    M32R_INSN_BCL8, "bcl8", "bcl.s", 16,
+    { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* bcl.l $disp24 */
+  {
+    M32R_INSN_BCL24, "bcl24", "bcl.l", 32,
+    { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } }
   },
 /* bnc.s $disp8 */
   {
     M32R_INSN_BNC8, "bnc8", "bnc.s", 16,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bnc.l $disp24 */
   {
     M32R_INSN_BNC24, "bnc24", "bnc.l", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bne $src1,$src2,$disp16 */
   {
     M32R_INSN_BNE, "bne", "bne", 32,
-    { 0|A(COND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bra.s $disp8 */
   {
     M32R_INSN_BRA8, "bra8", "bra.s", 16,
-    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bra.l $disp24 */
   {
     M32R_INSN_BRA24, "bra24", "bra.l", 32,
-    { 0|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* bncl.s $disp8 */
+  {
+    M32R_INSN_BNCL8, "bncl8", "bncl.s", 16,
+    { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* bncl.l $disp24 */
+  {
+    M32R_INSN_BNCL24, "bncl24", "bncl.l", 32,
+    { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } }
   },
 /* cmp $src1,$src2 */
   {
     M32R_INSN_CMP, "cmp", "cmp", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* cmpi $src2,$simm16 */
   {
     M32R_INSN_CMPI, "cmpi", "cmpi", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* cmpu $src1,$src2 */
   {
     M32R_INSN_CMPU, "cmpu", "cmpu", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* cmpui $src2,$simm16 */
   {
     M32R_INSN_CMPUI, "cmpui", "cmpui", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* cmpeq $src1,$src2 */
+  {
+    M32R_INSN_CMPEQ, "cmpeq", "cmpeq", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_OS } }
+  },
+/* cmpz $src2 */
+  {
+    M32R_INSN_CMPZ, "cmpz", "cmpz", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_OS } }
   },
 /* div $dr,$sr */
   {
     M32R_INSN_DIV, "div", "div", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* divu $dr,$sr */
   {
     M32R_INSN_DIVU, "divu", "divu", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* rem $dr,$sr */
   {
     M32R_INSN_REM, "rem", "rem", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* remu $dr,$sr */
   {
     M32R_INSN_REMU, "remu", "remu", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* divh $dr,$sr */
+  {
+    M32R_INSN_DIVH, "divh", "divh", 32,
+    { 0, { (1<<MACH_M32RX), PIPE_NONE } }
+  },
+/* jc $sr */
+  {
+    M32R_INSN_JC, "jc", "jc", 16,
+    { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* jnc $sr */
+  {
+    M32R_INSN_JNC, "jnc", "jnc", 16,
+    { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
   },
 /* jl $sr */
   {
     M32R_INSN_JL, "jl", "jl", 16,
-    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* jmp $sr */
   {
     M32R_INSN_JMP, "jmp", "jmp", 16,
-    { 0|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* ld $dr,@$sr */
   {
     M32R_INSN_LD, "ld", "ld", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* ld $dr,@($slo16,$sr) */
   {
     M32R_INSN_LD_D, "ld-d", "ld", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldb $dr,@$sr */
   {
     M32R_INSN_LDB, "ldb", "ldb", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldb $dr,@($slo16,$sr) */
   {
     M32R_INSN_LDB_D, "ldb-d", "ldb", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldh $dr,@$sr */
   {
     M32R_INSN_LDH, "ldh", "ldh", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldh $dr,@($slo16,$sr) */
   {
     M32R_INSN_LDH_D, "ldh-d", "ldh", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldub $dr,@$sr */
   {
     M32R_INSN_LDUB, "ldub", "ldub", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldub $dr,@($slo16,$sr) */
   {
     M32R_INSN_LDUB_D, "ldub-d", "ldub", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* lduh $dr,@$sr */
   {
     M32R_INSN_LDUH, "lduh", "lduh", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* lduh $dr,@($slo16,$sr) */
   {
     M32R_INSN_LDUH_D, "lduh-d", "lduh", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ld $dr,@$sr+ */
   {
     M32R_INSN_LD_PLUS, "ld-plus", "ld", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* ld24 $dr,$uimm24 */
   {
     M32R_INSN_LD24, "ld24", "ld24", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldi8 $dr,$simm8 */
   {
     M32R_INSN_LDI8, "ldi8", "ldi8", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* ldi16 $dr,$hash$slo16 */
   {
     M32R_INSN_LDI16, "ldi16", "ldi16", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* lock $dr,@$sr */
   {
     M32R_INSN_LOCK, "lock", "lock", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* machi $src1,$src2 */
   {
     M32R_INSN_MACHI, "machi", "machi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* machi $src1,$src2,$acc */
+  {
+    M32R_INSN_MACHI_A, "machi-a", "machi", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* maclo $src1,$src2 */
   {
     M32R_INSN_MACLO, "maclo", "maclo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* maclo $src1,$src2,$acc */
+  {
+    M32R_INSN_MACLO_A, "maclo-a", "maclo", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* macwhi $src1,$src2 */
   {
     M32R_INSN_MACWHI, "macwhi", "macwhi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* macwhi $src1,$src2,$acc */
+  {
+    M32R_INSN_MACWHI_A, "macwhi-a", "macwhi", 16,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
   },
 /* macwlo $src1,$src2 */
   {
     M32R_INSN_MACWLO, "macwlo", "macwlo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* macwlo $src1,$src2,$acc */
+  {
+    M32R_INSN_MACWLO_A, "macwlo-a", "macwlo", 16,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mul $dr,$sr */
   {
     M32R_INSN_MUL, "mul", "mul", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_S } }
   },
 /* mulhi $src1,$src2 */
   {
     M32R_INSN_MULHI, "mulhi", "mulhi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mulhi $src1,$src2,$acc */
+  {
+    M32R_INSN_MULHI_A, "mulhi-a", "mulhi", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mullo $src1,$src2 */
   {
     M32R_INSN_MULLO, "mullo", "mullo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mullo $src1,$src2,$acc */
+  {
+    M32R_INSN_MULLO_A, "mullo-a", "mullo", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mulwhi $src1,$src2 */
   {
     M32R_INSN_MULWHI, "mulwhi", "mulwhi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mulwhi $src1,$src2,$acc */
+  {
+    M32R_INSN_MULWHI_A, "mulwhi-a", "mulwhi", 16,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mulwlo $src1,$src2 */
   {
     M32R_INSN_MULWLO, "mulwlo", "mulwlo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mulwlo $src1,$src2,$acc */
+  {
+    M32R_INSN_MULWLO_A, "mulwlo-a", "mulwlo", 16,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mv $dr,$sr */
   {
     M32R_INSN_MV, "mv", "mv", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* mvfachi $dr */
   {
     M32R_INSN_MVFACHI, "mvfachi", "mvfachi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mvfachi $dr,$accs */
+  {
+    M32R_INSN_MVFACHI_A, "mvfachi-a", "mvfachi", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mvfaclo $dr */
   {
     M32R_INSN_MVFACLO, "mvfaclo", "mvfaclo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mvfaclo $dr,$accs */
+  {
+    M32R_INSN_MVFACLO_A, "mvfaclo-a", "mvfaclo", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mvfacmi $dr */
   {
     M32R_INSN_MVFACMI, "mvfacmi", "mvfacmi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mvfacmi $dr,$accs */
+  {
+    M32R_INSN_MVFACMI_A, "mvfacmi-a", "mvfacmi", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mvfc $dr,$scr */
   {
     M32R_INSN_MVFC, "mvfc", "mvfc", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* mvtachi $src1 */
   {
     M32R_INSN_MVTACHI, "mvtachi", "mvtachi", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mvtachi $src1,$accs */
+  {
+    M32R_INSN_MVTACHI_A, "mvtachi-a", "mvtachi", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mvtaclo $src1 */
   {
     M32R_INSN_MVTACLO, "mvtaclo", "mvtaclo", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* mvtaclo $src1,$accs */
+  {
+    M32R_INSN_MVTACLO_A, "mvtaclo-a", "mvtaclo", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* mvtc $sr,$dcr */
   {
     M32R_INSN_MVTC, "mvtc", "mvtc", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* neg $dr,$sr */
   {
     M32R_INSN_NEG, "neg", "neg", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* nop */
   {
     M32R_INSN_NOP, "nop", "nop", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* not $dr,$sr */
   {
     M32R_INSN_NOT, "not", "not", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* rac */
   {
     M32R_INSN_RAC, "rac", "rac", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* rac $accd,$accs,$imm1 */
+  {
+    M32R_INSN_RAC_DSI, "rac-dsi", "rac", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* rach */
   {
     M32R_INSN_RACH, "rach", "rach", 16,
-    { 0, { (1<<MACH_M32R) } }
+    { 0, { (1<<MACH_M32R), PIPE_S } }
+  },
+/* rach $accd,$accs,$imm1 */
+  {
+    M32R_INSN_RACH_DSI, "rach-dsi", "rach", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
   },
 /* rte */
   {
     M32R_INSN_RTE, "rte", "rte", 16,
-    { 0|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* seth $dr,$hash$hi16 */
   {
     M32R_INSN_SETH, "seth", "seth", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* sll $dr,$sr */
   {
     M32R_INSN_SLL, "sll", "sll", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* sll3 $dr,$sr,$simm16 */
   {
     M32R_INSN_SLL3, "sll3", "sll3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* slli $dr,$uimm5 */
   {
     M32R_INSN_SLLI, "slli", "slli", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* sra $dr,$sr */
   {
     M32R_INSN_SRA, "sra", "sra", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* sra3 $dr,$sr,$simm16 */
   {
     M32R_INSN_SRA3, "sra3", "sra3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* srai $dr,$uimm5 */
   {
     M32R_INSN_SRAI, "srai", "srai", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* srl $dr,$sr */
   {
     M32R_INSN_SRL, "srl", "srl", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* srl3 $dr,$sr,$simm16 */
   {
     M32R_INSN_SRL3, "srl3", "srl3", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* srli $dr,$uimm5 */
   {
     M32R_INSN_SRLI, "srli", "srli", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* st $src1,@$src2 */
   {
     M32R_INSN_ST, "st", "st", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* st $src1,@($slo16,$src2) */
   {
     M32R_INSN_ST_D, "st-d", "st", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* stb $src1,@$src2 */
   {
     M32R_INSN_STB, "stb", "stb", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* stb $src1,@($slo16,$src2) */
   {
     M32R_INSN_STB_D, "stb-d", "stb", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* sth $src1,@$src2 */
   {
     M32R_INSN_STH, "sth", "sth", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* sth $src1,@($slo16,$src2) */
   {
     M32R_INSN_STH_D, "sth-d", "sth", 32,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* st $src1,@+$src2 */
   {
     M32R_INSN_ST_PLUS, "st-plus", "st", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* st $src1,@-$src2 */
   {
     M32R_INSN_ST_MINUS, "st-minus", "st", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
   },
 /* sub $dr,$sr */
   {
     M32R_INSN_SUB, "sub", "sub", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* subv $dr,$sr */
   {
     M32R_INSN_SUBV, "subv", "subv", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* subx $dr,$sr */
   {
     M32R_INSN_SUBX, "subx", "subx", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_OS } }
   },
 /* trap $uimm4 */
   {
     M32R_INSN_TRAP, "trap", "trap", 16,
-    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE) } }
+    { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
   },
 /* unlock $src1,@$src2 */
   {
     M32R_INSN_UNLOCK, "unlock", "unlock", 16,
-    { 0, { (1<<MACH_BASE) } }
+    { 0, { (1<<MACH_BASE), PIPE_O } }
+  },
+/* satb $dr,$sr */
+  {
+    M32R_INSN_SATB, "satb", "satb", 32,
+    { 0, { (1<<MACH_M32RX), PIPE_NONE } }
+  },
+/* sath $dr,$sr */
+  {
+    M32R_INSN_SATH, "sath", "sath", 32,
+    { 0, { (1<<MACH_M32RX), PIPE_NONE } }
+  },
+/* sat $dr,$sr */
+  {
+    M32R_INSN_SAT, "sat", "sat", 32,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_NONE } }
+  },
+/* pcmpbz $src2 */
+  {
+    M32R_INSN_PCMPBZ, "pcmpbz", "pcmpbz", 16,
+    { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_OS } }
+  },
+/* sadd */
+  {
+    M32R_INSN_SADD, "sadd", "sadd", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* macwu1 $src1,$src2 */
+  {
+    M32R_INSN_MACWU1, "macwu1", "macwu1", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* msblo $src1,$src2 */
+  {
+    M32R_INSN_MSBLO, "msblo", "msblo", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* mulwu1 $src1,$src2 */
+  {
+    M32R_INSN_MULWU1, "mulwu1", "mulwu1", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* maclh1 $src1,$src2 */
+  {
+    M32R_INSN_MACLH1, "maclh1", "maclh1", 16,
+    { 0, { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* sc */
+  {
+    M32R_INSN_SC, "sc", "sc", 16,
+    { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* snc */
+  {
+    M32R_INSN_SNC, "snc", "snc", 16,
+    { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } }
   },
 };
 
@@ -1116,6 +1338,9 @@
   cd->rebuild_tables = m32r_cgen_rebuild_tables;
   m32r_cgen_rebuild_tables (cd);
 
+  /* Initialise flags.  */
+  cd->signed_overflow_ok_p = 0;
+  
   return (CGEN_CPU_DESC) cd;
 }
 
diff --git a/opcodes/m32r-desc.h b/opcodes/m32r-desc.h
index 6a3636c..7d42807 100644
--- a/opcodes/m32r-desc.h
+++ b/opcodes/m32r-desc.h
@@ -32,9 +32,13 @@
 
 /* Selected cpu families.  */
 #define HAVE_CPU_M32RBF
+#define HAVE_CPU_M32RXF
 
 #define CGEN_INSN_LSB0_P 0
 
+/* Minimum size of any insn (in bytes).  */
+#define CGEN_MIN_INSN_SIZE 2
+
 /* Maximum size of any insn (in bytes).  */
 #define CGEN_MAX_INSN_SIZE 4
 
@@ -46,6 +50,7 @@
    e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
    we can't hash on everything up to the space.  */
 #define CGEN_MNEMONIC_OPERANDS
+
 /* Maximum number of operands any insn or macro-insn has.  */
 #define CGEN_MAX_INSN_OPERANDS 16
 
@@ -93,8 +98,7 @@
 
 /* Enum declaration for machine type selection.  */
 typedef enum mach_attr {
-  MACH_BASE, MACH_M32R
- , MACH_MAX
+  MACH_BASE, MACH_M32R, MACH_M32RX, MACH_MAX
 } MACH_ATTR;
 
 /* Enum declaration for instruction set selection.  */
@@ -102,6 +106,11 @@
   ISA_M32R, ISA_MAX
 } ISA_ATTR;
 
+/* Enum declaration for parallel execution pipeline selection.  */
+typedef enum pipe_attr {
+  PIPE_NONE, PIPE_O, PIPE_S, PIPE_OS
+} PIPE_ATTR;
+
 /* Number of architecture variants.  */
 #define MAX_ISAS  1
 #define MAX_MACHS ((int) MACH_MAX)
@@ -124,12 +133,13 @@
 
 /* Enum declaration for m32r ifield types.  */
 typedef enum ifield_type {
-  M32R_F_NIL, M32R_F_OP1, M32R_F_OP2, M32R_F_COND
- , M32R_F_R1, M32R_F_R2, M32R_F_SIMM8, M32R_F_SIMM16
- , M32R_F_SHIFT_OP2, M32R_F_UIMM4, M32R_F_UIMM5, M32R_F_UIMM16
- , M32R_F_UIMM24, M32R_F_HI16, M32R_F_DISP8, M32R_F_DISP16
- , M32R_F_DISP24
- , M32R_F_MAX
+  M32R_F_NIL, M32R_F_ANYOF, M32R_F_OP1, M32R_F_OP2
+ , M32R_F_COND, M32R_F_R1, M32R_F_R2, M32R_F_SIMM8
+ , M32R_F_SIMM16, M32R_F_SHIFT_OP2, M32R_F_UIMM4, M32R_F_UIMM5
+ , M32R_F_UIMM16, M32R_F_UIMM24, M32R_F_HI16, M32R_F_DISP8
+ , M32R_F_DISP16, M32R_F_DISP24, M32R_F_OP23, M32R_F_OP3
+ , M32R_F_ACC, M32R_F_ACCS, M32R_F_ACCD, M32R_F_BITS67
+ , M32R_F_BIT14, M32R_F_IMM1, M32R_F_MAX
 } IFIELD_TYPE;
 
 #define MAX_IFLD ((int) M32R_F_MAX)
@@ -150,8 +160,8 @@
   HW_H_MEMORY, HW_H_SINT, HW_H_UINT, HW_H_ADDR
  , HW_H_IADDR, HW_H_PC, HW_H_HI16, HW_H_SLO16
  , HW_H_ULO16, HW_H_GR, HW_H_CR, HW_H_ACCUM
- , HW_H_COND, HW_H_PSW, HW_H_BPSW, HW_H_BBPSW
- , HW_H_LOCK, HW_MAX
+ , HW_H_ACCUMS, HW_H_COND, HW_H_PSW, HW_H_BPSW
+ , HW_H_BBPSW, HW_H_LOCK, HW_MAX
 } CGEN_HW_TYPE;
 
 #define MAX_HW ((int) HW_MAX)
@@ -174,6 +184,7 @@
   M32R_OPERAND_PC, M32R_OPERAND_SR, M32R_OPERAND_DR, M32R_OPERAND_SRC1
  , M32R_OPERAND_SRC2, M32R_OPERAND_SCR, M32R_OPERAND_DCR, M32R_OPERAND_SIMM8
  , M32R_OPERAND_SIMM16, M32R_OPERAND_UIMM4, M32R_OPERAND_UIMM5, M32R_OPERAND_UIMM16
+ , M32R_OPERAND_IMM1, M32R_OPERAND_ACCD, M32R_OPERAND_ACCS, M32R_OPERAND_ACC
  , M32R_OPERAND_HASH, M32R_OPERAND_HI16, M32R_OPERAND_SLO16, M32R_OPERAND_ULO16
  , M32R_OPERAND_UIMM24, M32R_OPERAND_DISP8, M32R_OPERAND_DISP16, M32R_OPERAND_DISP24
  , M32R_OPERAND_CONDBIT, M32R_OPERAND_ACCUM, M32R_OPERAND_MAX
@@ -212,6 +223,7 @@
 
 extern CGEN_KEYWORD m32r_cgen_opval_gr_names;
 extern CGEN_KEYWORD m32r_cgen_opval_cr_names;
+extern CGEN_KEYWORD m32r_cgen_opval_h_accums;
 
 
 
diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c
index 48c591a..d6d5377 100644
--- a/opcodes/m32r-dis.c
+++ b/opcodes/m32r-dis.c
@@ -164,6 +164,15 @@
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      print_keyword (cd, info, & m32r_cgen_opval_h_accums, fields->f_acc, 0);
+      break;
+    case M32R_OPERAND_ACCD :
+      print_keyword (cd, info, & m32r_cgen_opval_h_accums, fields->f_accd, 0);
+      break;
+    case M32R_OPERAND_ACCS :
+      print_keyword (cd, info, & m32r_cgen_opval_h_accums, fields->f_accs, 0);
+      break;
     case M32R_OPERAND_DCR :
       print_keyword (cd, info, & m32r_cgen_opval_cr_names, fields->f_r1, 0);
       break;
@@ -180,11 +189,14 @@
       print_keyword (cd, info, & m32r_cgen_opval_gr_names, fields->f_r1, 0);
       break;
     case M32R_OPERAND_HASH :
-      print_hash (cd, info, fields->f_nil, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
+      print_hash (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
       break;
     case M32R_OPERAND_HI16 :
       print_normal (cd, info, fields->f_hi16, 0|(1<<CGEN_OPERAND_SIGN_OPT), pc, length);
       break;
+    case M32R_OPERAND_IMM1 :
+      print_normal (cd, info, fields->f_imm1, 0|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length);
+      break;
     case M32R_OPERAND_SCR :
       print_keyword (cd, info, & m32r_cgen_opval_cr_names, fields->f_r2, 0);
       break;
@@ -409,10 +421,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 (! m32r_cgen_insn_supported (cd, insn))
-	continue;
+        {
+          insn_list = CGEN_DIS_NEXT_INSN (insn_list);
+	  continue;
+        }
 #endif
 
       /* Basic bit mask must be correct.  */
diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c
index fa15d7e..30c3c6a 100644
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-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.
 
@@ -203,6 +203,7 @@
   if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
     {
       unsigned long maxval = mask;
+      
       if ((unsigned long) value > maxval)
 	{
 	  /* xgettext:c-format */
@@ -214,15 +215,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;
+	    }
 	}
     }
 
@@ -579,11 +584,20 @@
      CGEN_INSN_BYTES_PTR buffer;
      bfd_vma pc;
 {
-  const char * errmsg;
+  const char * errmsg = NULL;
   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      errmsg = insert_normal (cd, fields->f_acc, 0, 0, 8, 1, 32, total_length, buffer);
+      break;
+    case M32R_OPERAND_ACCD :
+      errmsg = insert_normal (cd, fields->f_accd, 0, 0, 4, 2, 32, total_length, buffer);
+      break;
+    case M32R_OPERAND_ACCS :
+      errmsg = insert_normal (cd, fields->f_accs, 0, 0, 12, 2, 32, total_length, buffer);
+      break;
     case M32R_OPERAND_DCR :
       errmsg = insert_normal (cd, fields->f_r1, 0, 0, 4, 4, 32, total_length, buffer);
       break;
@@ -612,11 +626,17 @@
       errmsg = insert_normal (cd, fields->f_r1, 0, 0, 4, 4, 32, total_length, buffer);
       break;
     case M32R_OPERAND_HASH :
-      errmsg = insert_normal (cd, fields->f_nil, 0, 0, 0, 0, 0, total_length, buffer);
       break;
     case M32R_OPERAND_HI16 :
       errmsg = insert_normal (cd, fields->f_hi16, 0|(1<<CGEN_IFLD_SIGN_OPT), 0, 16, 16, 32, total_length, buffer);
       break;
+    case M32R_OPERAND_IMM1 :
+      {
+        long value = fields->f_imm1;
+        value = ((value) - (1));
+        errmsg = insert_normal (cd, value, 0, 0, 15, 1, 32, total_length, buffer);
+      }
+      break;
     case M32R_OPERAND_SCR :
       errmsg = insert_normal (cd, fields->f_r2, 0, 0, 12, 4, 32, total_length, buffer);
       break;
@@ -665,6 +685,8 @@
 }
 
 /* Main entry point for operand extraction.
+   The result is <= 0 for error, >0 for success.
+   ??? Actual values aren't well defined right now.
 
    This function is basically just a big switch statement.  Earlier versions
    used tables to look up the function to use, but
@@ -687,11 +709,21 @@
      CGEN_FIELDS * fields;
      bfd_vma pc;
 {
-  int length;
+  /* Assume success (for those operands that are nops).  */
+  int length = 1;
   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 1, 32, total_length, pc, & fields->f_acc);
+      break;
+    case M32R_OPERAND_ACCD :
+      length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 2, 32, total_length, pc, & fields->f_accd);
+      break;
+    case M32R_OPERAND_ACCS :
+      length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 2, 32, total_length, pc, & fields->f_accs);
+      break;
     case M32R_OPERAND_DCR :
       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_r1);
       break;
@@ -723,11 +755,18 @@
       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_r1);
       break;
     case M32R_OPERAND_HASH :
-      length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 0, total_length, pc, & fields->f_nil);
       break;
     case M32R_OPERAND_HI16 :
       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGN_OPT), 0, 16, 16, 32, total_length, pc, & fields->f_hi16);
       break;
+    case M32R_OPERAND_IMM1 :
+      {
+        long value;
+        length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & value);
+        value = ((value) + (1));
+        fields->f_imm1 = value;
+      }
+      break;
     case M32R_OPERAND_SCR :
       length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_r2);
       break;
@@ -800,6 +839,15 @@
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      value = fields->f_acc;
+      break;
+    case M32R_OPERAND_ACCD :
+      value = fields->f_accd;
+      break;
+    case M32R_OPERAND_ACCS :
+      value = fields->f_accs;
+      break;
     case M32R_OPERAND_DCR :
       value = fields->f_r1;
       break;
@@ -816,11 +864,14 @@
       value = fields->f_r1;
       break;
     case M32R_OPERAND_HASH :
-      value = fields->f_nil;
+      value = 0;
       break;
     case M32R_OPERAND_HI16 :
       value = fields->f_hi16;
       break;
+    case M32R_OPERAND_IMM1 :
+      value = fields->f_imm1;
+      break;
     case M32R_OPERAND_SCR :
       value = fields->f_r2;
       break;
@@ -878,6 +929,15 @@
 
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      value = fields->f_acc;
+      break;
+    case M32R_OPERAND_ACCD :
+      value = fields->f_accd;
+      break;
+    case M32R_OPERAND_ACCS :
+      value = fields->f_accs;
+      break;
     case M32R_OPERAND_DCR :
       value = fields->f_r1;
       break;
@@ -894,11 +954,14 @@
       value = fields->f_r1;
       break;
     case M32R_OPERAND_HASH :
-      value = fields->f_nil;
+      value = 0;
       break;
     case M32R_OPERAND_HI16 :
       value = fields->f_hi16;
       break;
+    case M32R_OPERAND_IMM1 :
+      value = fields->f_imm1;
+      break;
     case M32R_OPERAND_SCR :
       value = fields->f_r2;
       break;
@@ -960,6 +1023,15 @@
 {
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      fields->f_acc = value;
+      break;
+    case M32R_OPERAND_ACCD :
+      fields->f_accd = value;
+      break;
+    case M32R_OPERAND_ACCS :
+      fields->f_accs = value;
+      break;
     case M32R_OPERAND_DCR :
       fields->f_r1 = value;
       break;
@@ -976,11 +1048,13 @@
       fields->f_r1 = value;
       break;
     case M32R_OPERAND_HASH :
-      fields->f_nil = value;
       break;
     case M32R_OPERAND_HI16 :
       fields->f_hi16 = value;
       break;
+    case M32R_OPERAND_IMM1 :
+      fields->f_imm1 = value;
+      break;
     case M32R_OPERAND_SCR :
       fields->f_r2 = value;
       break;
@@ -1035,6 +1109,15 @@
 {
   switch (opindex)
     {
+    case M32R_OPERAND_ACC :
+      fields->f_acc = value;
+      break;
+    case M32R_OPERAND_ACCD :
+      fields->f_accd = value;
+      break;
+    case M32R_OPERAND_ACCS :
+      fields->f_accs = value;
+      break;
     case M32R_OPERAND_DCR :
       fields->f_r1 = value;
       break;
@@ -1051,11 +1134,13 @@
       fields->f_r1 = value;
       break;
     case M32R_OPERAND_HASH :
-      fields->f_nil = value;
       break;
     case M32R_OPERAND_HI16 :
       fields->f_hi16 = value;
       break;
+    case M32R_OPERAND_IMM1 :
+      fields->f_imm1 = value;
+      break;
     case M32R_OPERAND_SCR :
       fields->f_r2 = value;
       break;
diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c
index 43edf9a..a1efecc 100644
--- a/opcodes/m32r-opc.c
+++ b/opcodes/m32r-opc.c
@@ -93,11 +93,15 @@
   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 }
+};
+
 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 }
 };
 
-static const CGEN_IFMT ifmt_jl = {
+static const CGEN_IFMT ifmt_jc = {
   16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
 };
 
@@ -109,10 +113,18 @@
   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 }
+};
+
 static const CGEN_IFMT ifmt_mvfachi = {
   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 }
+};
+
 static const CGEN_IFMT ifmt_mvfc = {
   16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
 };
@@ -121,6 +133,10 @@
   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 }
+};
+
 static const CGEN_IFMT ifmt_mvtc = {
   16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
 };
@@ -129,6 +145,10 @@
   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 }
+};
+
 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 }
 };
@@ -145,6 +165,10 @@
   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 }
+};
+
 #undef F
 
 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
@@ -298,6 +322,18 @@
     { { MNEM, ' ', OP (DISP24), 0 } },
     & ifmt_bc24, { 0xfe000000 }
   },
+/* bcl.s $disp8 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP8), 0 } },
+    & ifmt_bc8, { 0x7800 }
+  },
+/* bcl.l $disp24 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP24), 0 } },
+    & ifmt_bc24, { 0xf8000000 }
+  },
 /* bnc.s $disp8 */
   {
     { 0, 0, 0, 0 },
@@ -328,6 +364,18 @@
     { { MNEM, ' ', OP (DISP24), 0 } },
     & ifmt_bc24, { 0xff000000 }
   },
+/* bncl.s $disp8 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP8), 0 } },
+    & ifmt_bc8, { 0x7900 }
+  },
+/* bncl.l $disp24 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP24), 0 } },
+    & ifmt_bc24, { 0xf9000000 }
+  },
 /* cmp $src1,$src2 */
   {
     { 0, 0, 0, 0 },
@@ -352,6 +400,18 @@
     { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
     & ifmt_cmpi, { 0x80500000 }
   },
+/* cmpeq $src1,$src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
+    & ifmt_cmp, { 0x60 }
+  },
+/* cmpz $src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC2), 0 } },
+    & ifmt_cmpz, { 0x70 }
+  },
 /* div $dr,$sr */
   {
     { 0, 0, 0, 0 },
@@ -376,17 +436,35 @@
     { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
     & ifmt_div, { 0x90300000 }
   },
+/* divh $dr,$sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
+    & ifmt_div, { 0x90000010 }
+  },
+/* jc $sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SR), 0 } },
+    & ifmt_jc, { 0x1cc0 }
+  },
+/* jnc $sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SR), 0 } },
+    & ifmt_jc, { 0x1dc0 }
+  },
 /* jl $sr */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SR), 0 } },
-    & ifmt_jl, { 0x1ec0 }
+    & ifmt_jc, { 0x1ec0 }
   },
 /* jmp $sr */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SR), 0 } },
-    & ifmt_jl, { 0x1fc0 }
+    & ifmt_jc, { 0x1fc0 }
   },
 /* ld $dr,@$sr */
   {
@@ -484,24 +562,48 @@
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3040 }
   },
+/* machi $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3040 }
+  },
 /* maclo $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3050 }
   },
+/* maclo $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3050 }
+  },
 /* macwhi $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3060 }
   },
+/* macwhi $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3060 }
+  },
 /* macwlo $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3070 }
   },
+/* macwlo $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3070 }
+  },
 /* mul $dr,$sr */
   {
     { 0, 0, 0, 0 },
@@ -514,24 +616,48 @@
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3000 }
   },
+/* mulhi $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3000 }
+  },
 /* mullo $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3010 }
   },
+/* mullo $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3010 }
+  },
 /* mulwhi $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3020 }
   },
+/* mulwhi $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3020 }
+  },
 /* mulwlo $src1,$src2 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x3030 }
   },
+/* mulwlo $src1,$src2,$acc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
+    & ifmt_machi_a, { 0x3030 }
+  },
 /* mv $dr,$sr */
   {
     { 0, 0, 0, 0 },
@@ -544,18 +670,36 @@
     { { MNEM, ' ', OP (DR), 0 } },
     & ifmt_mvfachi, { 0x50f0 }
   },
+/* mvfachi $dr,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
+    & ifmt_mvfachi_a, { 0x50f0 }
+  },
 /* mvfaclo $dr */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (DR), 0 } },
     & ifmt_mvfachi, { 0x50f1 }
   },
+/* mvfaclo $dr,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
+    & ifmt_mvfachi_a, { 0x50f1 }
+  },
 /* mvfacmi $dr */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (DR), 0 } },
     & ifmt_mvfachi, { 0x50f2 }
   },
+/* mvfacmi $dr,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
+    & ifmt_mvfachi_a, { 0x50f2 }
+  },
 /* mvfc $dr,$scr */
   {
     { 0, 0, 0, 0 },
@@ -568,12 +712,24 @@
     { { MNEM, ' ', OP (SRC1), 0 } },
     & ifmt_mvtachi, { 0x5070 }
   },
+/* mvtachi $src1,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
+    & ifmt_mvtachi_a, { 0x5070 }
+  },
 /* mvtaclo $src1 */
   {
     { 0, 0, 0, 0 },
     { { MNEM, ' ', OP (SRC1), 0 } },
     & ifmt_mvtachi, { 0x5071 }
   },
+/* mvtaclo $src1,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
+    & ifmt_mvtachi_a, { 0x5071 }
+  },
 /* mvtc $sr,$dcr */
   {
     { 0, 0, 0, 0 },
@@ -604,12 +760,24 @@
     { { MNEM, 0 } },
     & ifmt_nop, { 0x5090 }
   },
+/* rac $accd,$accs,$imm1 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
+    & ifmt_rac_dsi, { 0x5090 }
+  },
 /* rach */
   {
     { 0, 0, 0, 0 },
     { { MNEM, 0 } },
     & ifmt_nop, { 0x5080 }
   },
+/* rach $accd,$accs,$imm1 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
+    & ifmt_rac_dsi, { 0x5080 }
+  },
 /* rte */
   {
     { 0, 0, 0, 0 },
@@ -754,6 +922,72 @@
     { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
     & ifmt_cmp, { 0x2050 }
   },
+/* satb $dr,$sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
+    & ifmt_satb, { 0x80600300 }
+  },
+/* sath $dr,$sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
+    & ifmt_satb, { 0x80600200 }
+  },
+/* sat $dr,$sr */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
+    & ifmt_satb, { 0x80600000 }
+  },
+/* pcmpbz $src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC2), 0 } },
+    & ifmt_cmpz, { 0x370 }
+  },
+/* sadd */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, 0 } },
+    & ifmt_nop, { 0x50e4 }
+  },
+/* macwu1 $src1,$src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
+    & ifmt_cmp, { 0x50b0 }
+  },
+/* msblo $src1,$src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
+    & ifmt_cmp, { 0x50d0 }
+  },
+/* mulwu1 $src1,$src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
+    & ifmt_cmp, { 0x50a0 }
+  },
+/* maclh1 $src1,$src2 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
+    & ifmt_cmp, { 0x50c0 }
+  },
+/* sc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, 0 } },
+    & ifmt_nop, { 0x7401 }
+  },
+/* snc */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, 0 } },
+    & ifmt_nop, { 0x7501 }
+  },
 };
 
 #undef A
@@ -781,6 +1015,14 @@
   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 }
+};
+
+static const CGEN_IFMT ifmt_bcl24r = {
+  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 }
 };
@@ -797,44 +1039,52 @@
   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 }
+};
+
+static const CGEN_IFMT ifmt_bncl24r = {
+  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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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 = {
@@ -846,35 +1096,51 @@
 };
 
 static const CGEN_IFMT ifmt_ldi16a = {
-  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_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 }
+};
+
+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 }
+};
+
+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 }
+};
+
+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 }
 };
 
 static const CGEN_IFMT ifmt_st_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), 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_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0ff, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
 };
 
 #undef F
@@ -893,142 +1159,182 @@
 /* bc $disp8 */
   {
     -1, "bc8r", "bc", 16,
-    { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bc $disp24 */
   {
     -1, "bc24r", "bc", 32,
-    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bl $disp8 */
   {
     -1, "bl8r", "bl", 16,
-    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bl $disp24 */
   {
     -1, "bl24r", "bl", 32,
-    { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* bcl $disp8 */
+  {
+    -1, "bcl8r", "bcl", 16,
+    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* bcl $disp24 */
+  {
+    -1, "bcl24r", "bcl", 32,
+    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
   },
 /* bnc $disp8 */
   {
     -1, "bnc8r", "bnc", 16,
-    { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bnc $disp24 */
   {
     -1, "bnc24r", "bnc", 32,
-    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* bra $disp8 */
   {
     -1, "bra8r", "bra", 16,
-    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* bra $disp24 */
   {
     -1, "bra24r", "bra", 32,
-    { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* bncl $disp8 */
+  {
+    -1, "bncl8r", "bncl", 16,
+    { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
+  },
+/* bncl $disp24 */
+  {
+    -1, "bncl24r", "bncl", 32,
+    { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
   },
 /* ld $dr,@($sr) */
   {
     -1, "ld-2", "ld", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* ld $dr,@($sr,$slo16) */
   {
     -1, "ld-d2", "ld", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldb $dr,@($sr) */
   {
     -1, "ldb-2", "ldb", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldb $dr,@($sr,$slo16) */
   {
     -1, "ldb-d2", "ldb", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldh $dr,@($sr) */
   {
     -1, "ldh-2", "ldh", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldh $dr,@($sr,$slo16) */
   {
     -1, "ldh-d2", "ldh", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldub $dr,@($sr) */
   {
     -1, "ldub-2", "ldub", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* ldub $dr,@($sr,$slo16) */
   {
     -1, "ldub-d2", "ldub", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* lduh $dr,@($sr) */
   {
     -1, "lduh-2", "lduh", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* lduh $dr,@($sr,$slo16) */
   {
     -1, "lduh-d2", "lduh", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* pop $dr */
   {
     -1, "pop", "pop", 16,
-    { 0|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* ldi $dr,$simm8 */
   {
     -1, "ldi8a", "ldi", 16,
-    { 0|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_OS } }
   },
 /* ldi $dr,$hash$slo16 */
   {
     -1, "ldi16a", "ldi", 32,
-    { 0|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
+  },
+/* rac $accd */
+  {
+    -1, "rac-d", "rac", 16,
+    { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* rac $accd,$accs */
+  {
+    -1, "rac-ds", "rac", 16,
+    { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* rach $accd */
+  {
+    -1, "rach-d", "rach", 16,
+    { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
+  },
+/* rach $accd,$accs */
+  {
+    -1, "rach-ds", "rach", 16,
+    { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
   },
 /* st $src1,@($src2) */
   {
     -1, "st-2", "st", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* st $src1,@($src2,$slo16) */
   {
     -1, "st-d2", "st", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* stb $src1,@($src2) */
   {
     -1, "stb-2", "stb", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* stb $src1,@($src2,$slo16) */
   {
     -1, "stb-d2", "stb", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* sth $src1,@($src2) */
   {
     -1, "sth-2", "sth", 16,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
   },
 /* sth $src1,@($src2,$slo16) */
   {
     -1, "sth-d2", "sth", 32,
-    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 /* push $src1 */
   {
     -1, "push", "push", 16,
-    { 0|A(ALIAS), { (1<<MACH_BASE) } }
+    { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
   },
 };
 
@@ -1060,6 +1366,18 @@
     { { MNEM, ' ', OP (DISP24), 0 } },
     & ifmt_bl24r, { 0xfe000000 }
   },
+/* bcl $disp8 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP8), 0 } },
+    & ifmt_bcl8r, { 0x7800 }
+  },
+/* bcl $disp24 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP24), 0 } },
+    & ifmt_bcl24r, { 0xf8000000 }
+  },
 /* bnc $disp8 */
   {
     { 0, 0, 0, 0 },
@@ -1084,6 +1402,18 @@
     { { MNEM, ' ', OP (DISP24), 0 } },
     & ifmt_bra24r, { 0xff000000 }
   },
+/* bncl $disp8 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP8), 0 } },
+    & ifmt_bncl8r, { 0x7900 }
+  },
+/* bncl $disp24 */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (DISP24), 0 } },
+    & ifmt_bncl24r, { 0xf9000000 }
+  },
 /* ld $dr,@($sr) */
   {
     { 0, 0, 0, 0 },
@@ -1162,6 +1492,30 @@
     { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
     & ifmt_ldi16a, { 0x90f00000 }
   },
+/* rac $accd */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), 0 } },
+    & ifmt_rac_d, { 0x5090 }
+  },
+/* rac $accd,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
+    & ifmt_rac_ds, { 0x5090 }
+  },
+/* rach $accd */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), 0 } },
+    & ifmt_rach_d, { 0x5080 }
+  },
+/* rach $accd,$accs */
+  {
+    { 0, 0, 0, 0 },
+    { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
+    & ifmt_rach_ds, { 0x5080 }
+  },
 /* st $src1,@($src2) */
   {
     { 0, 0, 0, 0 },
diff --git a/opcodes/m32r-opc.h b/opcodes/m32r-opc.h
index 6c57daa..b98c5f9 100644
--- a/opcodes/m32r-opc.h
+++ b/opcodes/m32r-opc.h
@@ -47,37 +47,34 @@
  , M32R_INSN_ADDX, M32R_INSN_BC8, M32R_INSN_BC24, M32R_INSN_BEQ
  , M32R_INSN_BEQZ, M32R_INSN_BGEZ, M32R_INSN_BGTZ, M32R_INSN_BLEZ
  , M32R_INSN_BLTZ, M32R_INSN_BNEZ, M32R_INSN_BL8, M32R_INSN_BL24
- , M32R_INSN_BNC8, M32R_INSN_BNC24, M32R_INSN_BNE, M32R_INSN_BRA8
- , M32R_INSN_BRA24
- , M32R_INSN_CMP, M32R_INSN_CMPI, M32R_INSN_CMPU, M32R_INSN_CMPUI
- , M32R_INSN_DIV, M32R_INSN_DIVU, M32R_INSN_REM, M32R_INSN_REMU
- , M32R_INSN_JL, M32R_INSN_JMP, M32R_INSN_LD, M32R_INSN_LD_D
- , M32R_INSN_LDB, M32R_INSN_LDB_D, M32R_INSN_LDH, M32R_INSN_LDH_D
- , M32R_INSN_LDUB, M32R_INSN_LDUB_D, M32R_INSN_LDUH, M32R_INSN_LDUH_D
- , M32R_INSN_LD_PLUS, M32R_INSN_LD24, M32R_INSN_LDI8, M32R_INSN_LDI16
- , M32R_INSN_LOCK, M32R_INSN_MACHI
- , M32R_INSN_MACLO
- , M32R_INSN_MACWHI
- , M32R_INSN_MACWLO
- , M32R_INSN_MUL, M32R_INSN_MULHI
- , M32R_INSN_MULLO
- , M32R_INSN_MULWHI
- , M32R_INSN_MULWLO
- , M32R_INSN_MV, M32R_INSN_MVFACHI
- , M32R_INSN_MVFACLO
- , M32R_INSN_MVFACMI
- , M32R_INSN_MVFC, M32R_INSN_MVTACHI
- , M32R_INSN_MVTACLO
+ , M32R_INSN_BCL8, M32R_INSN_BCL24, M32R_INSN_BNC8, M32R_INSN_BNC24
+ , M32R_INSN_BNE, M32R_INSN_BRA8, M32R_INSN_BRA24, M32R_INSN_BNCL8
+ , M32R_INSN_BNCL24, M32R_INSN_CMP, M32R_INSN_CMPI, M32R_INSN_CMPU
+ , M32R_INSN_CMPUI, M32R_INSN_CMPEQ, M32R_INSN_CMPZ, M32R_INSN_DIV
+ , M32R_INSN_DIVU, M32R_INSN_REM, M32R_INSN_REMU, M32R_INSN_DIVH
+ , M32R_INSN_JC, M32R_INSN_JNC, M32R_INSN_JL, M32R_INSN_JMP
+ , M32R_INSN_LD, M32R_INSN_LD_D, M32R_INSN_LDB, M32R_INSN_LDB_D
+ , M32R_INSN_LDH, M32R_INSN_LDH_D, M32R_INSN_LDUB, M32R_INSN_LDUB_D
+ , M32R_INSN_LDUH, M32R_INSN_LDUH_D, M32R_INSN_LD_PLUS, M32R_INSN_LD24
+ , M32R_INSN_LDI8, M32R_INSN_LDI16, M32R_INSN_LOCK, M32R_INSN_MACHI
+ , M32R_INSN_MACHI_A, M32R_INSN_MACLO, M32R_INSN_MACLO_A, M32R_INSN_MACWHI
+ , M32R_INSN_MACWHI_A, M32R_INSN_MACWLO, M32R_INSN_MACWLO_A, M32R_INSN_MUL
+ , M32R_INSN_MULHI, M32R_INSN_MULHI_A, M32R_INSN_MULLO, M32R_INSN_MULLO_A
+ , M32R_INSN_MULWHI, M32R_INSN_MULWHI_A, M32R_INSN_MULWLO, M32R_INSN_MULWLO_A
+ , M32R_INSN_MV, M32R_INSN_MVFACHI, M32R_INSN_MVFACHI_A, M32R_INSN_MVFACLO
+ , M32R_INSN_MVFACLO_A, M32R_INSN_MVFACMI, M32R_INSN_MVFACMI_A, M32R_INSN_MVFC
+ , M32R_INSN_MVTACHI, M32R_INSN_MVTACHI_A, M32R_INSN_MVTACLO, M32R_INSN_MVTACLO_A
  , M32R_INSN_MVTC, M32R_INSN_NEG, M32R_INSN_NOP, M32R_INSN_NOT
- , M32R_INSN_RAC
- , M32R_INSN_RACH
+ , M32R_INSN_RAC, M32R_INSN_RAC_DSI, M32R_INSN_RACH, M32R_INSN_RACH_DSI
  , M32R_INSN_RTE, M32R_INSN_SETH, M32R_INSN_SLL, M32R_INSN_SLL3
  , M32R_INSN_SLLI, M32R_INSN_SRA, M32R_INSN_SRA3, M32R_INSN_SRAI
  , M32R_INSN_SRL, M32R_INSN_SRL3, M32R_INSN_SRLI, M32R_INSN_ST
  , M32R_INSN_ST_D, M32R_INSN_STB, M32R_INSN_STB_D, M32R_INSN_STH
  , M32R_INSN_STH_D, M32R_INSN_ST_PLUS, M32R_INSN_ST_MINUS, M32R_INSN_SUB
  , M32R_INSN_SUBV, M32R_INSN_SUBX, M32R_INSN_TRAP, M32R_INSN_UNLOCK
- , M32R_INSN_MAX
+ , M32R_INSN_SATB, M32R_INSN_SATH, M32R_INSN_SAT, M32R_INSN_PCMPBZ
+ , M32R_INSN_SADD, M32R_INSN_MACWU1, M32R_INSN_MSBLO, M32R_INSN_MULWU1
+ , M32R_INSN_MACLH1, M32R_INSN_SC, M32R_INSN_SNC, M32R_INSN_MAX
 } CGEN_INSN_TYPE;
 
 /* Index of `invalid' insn place holder.  */
@@ -91,6 +88,7 @@
 {
   int length;
   long f_nil;
+  long f_anyof;
   long f_op1;
   long f_op2;
   long f_cond;
@@ -107,6 +105,14 @@
   long f_disp8;
   long f_disp16;
   long f_disp24;
+  long f_op23;
+  long f_op3;
+  long f_acc;
+  long f_accs;
+  long f_accd;
+  long f_bits67;
+  long f_bit14;
+  long f_imm1;
 };
 
 #define CGEN_INIT_PARSE(od) \
diff --git a/opcodes/m32r-opinst.c b/opcodes/m32r-opinst.c
index 7f3a49f..269651f 100644
--- a/opcodes/m32r-opinst.c
+++ b/opcodes/m32r-opinst.c
@@ -37,46 +37,46 @@
 #define COND_REF CGEN_OPINST_COND_REF
 #define OP_ENT(op) CONCAT2 (M32R_OPERAND_,op)
 
-static const CGEN_OPINST fmt_empty_ops[] = {
+static const CGEN_OPINST sfmt_empty_ops[] = {
   { END }
 };
 
-static const CGEN_OPINST fmt_add_ops[] = {
+static const CGEN_OPINST sfmt_add_ops[] = {
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_add3_ops[] = {
+static const CGEN_OPINST sfmt_add3_ops[] = {
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_and3_ops[] = {
+static const CGEN_OPINST sfmt_and3_ops[] = {
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { INPUT, "uimm16", HW_H_UINT, CGEN_MODE_UINT, OP_ENT (UIMM16), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_or3_ops[] = {
+static const CGEN_OPINST sfmt_or3_ops[] = {
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { INPUT, "ulo16", HW_H_ULO16, CGEN_MODE_UINT, OP_ENT (ULO16), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_addi_ops[] = {
+static const CGEN_OPINST sfmt_addi_ops[] = {
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { INPUT, "simm8", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM8), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_addv_ops[] = {
+static const CGEN_OPINST sfmt_addv_ops[] = {
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
@@ -84,7 +84,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_addv3_ops[] = {
+static const CGEN_OPINST sfmt_addv3_ops[] = {
   { INPUT, "simm16", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM16), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
@@ -92,7 +92,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_addx_ops[] = {
+static const CGEN_OPINST sfmt_addx_ops[] = {
   { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
@@ -101,21 +101,21 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_bc8_ops[] = {
+static const CGEN_OPINST sfmt_bc8_ops[] = {
   { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
   { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, COND_REF },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
   { END }
 };
 
-static const CGEN_OPINST fmt_bc24_ops[] = {
+static const CGEN_OPINST sfmt_bc24_ops[] = {
   { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
   { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, COND_REF },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
   { END }
 };
 
-static const CGEN_OPINST fmt_beq_ops[] = {
+static const CGEN_OPINST sfmt_beq_ops[] = {
   { INPUT, "disp16", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP16), 0, COND_REF },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
@@ -123,14 +123,14 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_beqz_ops[] = {
+static const CGEN_OPINST sfmt_beqz_ops[] = {
   { INPUT, "disp16", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP16), 0, COND_REF },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
   { END }
 };
 
-static const CGEN_OPINST fmt_bl8_ops[] = {
+static const CGEN_OPINST sfmt_bl8_ops[] = {
   { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, 0 },
   { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { OUTPUT, "h_gr_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 },
@@ -138,7 +138,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_bl24_ops[] = {
+static const CGEN_OPINST sfmt_bl24_ops[] = {
   { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, 0 },
   { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { OUTPUT, "h_gr_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 },
@@ -146,40 +146,71 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_bra8_ops[] = {
+static const CGEN_OPINST sfmt_bcl8_ops[] = {
+  { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, COND_REF },
+  { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
+  { OUTPUT, "h_gr_14", HW_H_GR, CGEN_MODE_SI, 0, 14, COND_REF },
+  { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_bcl24_ops[] = {
+  { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, COND_REF },
+  { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
+  { OUTPUT, "h_gr_14", HW_H_GR, CGEN_MODE_SI, 0, 14, COND_REF },
+  { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_bra8_ops[] = {
   { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, 0 },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_bra24_ops[] = {
+static const CGEN_OPINST sfmt_bra24_ops[] = {
   { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, 0 },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_cmp_ops[] = {
+static const CGEN_OPINST sfmt_cmp_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_cmpi_ops[] = {
+static const CGEN_OPINST sfmt_cmpi_ops[] = {
   { INPUT, "simm16", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM16), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_div_ops[] = {
+static const CGEN_OPINST sfmt_cmpz_ops[] = {
+  { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
+  { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_div_ops[] = {
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, COND_REF },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, COND_REF },
   { END }
 };
 
-static const CGEN_OPINST fmt_jl_ops[] = {
+static const CGEN_OPINST sfmt_jc_ops[] = {
+  { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, COND_REF },
+  { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_jl_ops[] = {
   { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "h_gr_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 },
@@ -187,58 +218,28 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_jmp_ops[] = {
+static const CGEN_OPINST sfmt_jmp_ops[] = {
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_ld_ops[] = {
+static const CGEN_OPINST sfmt_ld_ops[] = {
   { INPUT, "h_memory_sr", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_ld_d_ops[] = {
-  { INPUT, "h_memory_add__VM_sr_slo16", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
+static const CGEN_OPINST sfmt_ld_d_ops[] = {
+  { INPUT, "h_memory_add__DFLT_sr_slo16", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_ldb_ops[] = {
-  { INPUT, "h_memory_sr", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 },
-  { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 },
-  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
-  { END }
-};
-
-static const CGEN_OPINST fmt_ldb_d_ops[] = {
-  { INPUT, "h_memory_add__VM_sr_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 },
-  { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
-  { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
-  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
-  { END }
-};
-
-static const CGEN_OPINST fmt_ldh_ops[] = {
-  { INPUT, "h_memory_sr", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 },
-  { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 },
-  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
-  { END }
-};
-
-static const CGEN_OPINST fmt_ldh_d_ops[] = {
-  { INPUT, "h_memory_add__VM_sr_slo16", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 },
-  { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
-  { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
-  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
-  { END }
-};
-
-static const CGEN_OPINST fmt_ld_plus_ops[] = {
+static const CGEN_OPINST sfmt_ld_plus_ops[] = {
   { INPUT, "h_memory_sr", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
@@ -246,25 +247,25 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_ld24_ops[] = {
+static const CGEN_OPINST sfmt_ld24_ops[] = {
   { INPUT, "uimm24", HW_H_ADDR, CGEN_MODE_USI, OP_ENT (UIMM24), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_ldi8_ops[] = {
+static const CGEN_OPINST sfmt_ldi8_ops[] = {
   { INPUT, "simm8", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM8), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_ldi16_ops[] = {
+static const CGEN_OPINST sfmt_ldi16_ops[] = {
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_lock_ops[] = {
+static const CGEN_OPINST sfmt_lock_ops[] = {
   { INPUT, "h_memory_sr", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
@@ -272,7 +273,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_machi_ops[] = {
+static const CGEN_OPINST sfmt_machi_ops[] = {
   { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
@@ -280,55 +281,90 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_mulhi_ops[] = {
+static const CGEN_OPINST sfmt_machi_a_ops[] = {
+  { INPUT, "acc", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACC), 0, 0 },
+  { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
+  { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
+  { OUTPUT, "acc", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACC), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_mulhi_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_mv_ops[] = {
+static const CGEN_OPINST sfmt_mulhi_a_ops[] = {
+  { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
+  { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
+  { OUTPUT, "acc", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACC), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_mv_ops[] = {
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_mvfachi_ops[] = {
+static const CGEN_OPINST sfmt_mvfachi_ops[] = {
   { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_mvfc_ops[] = {
+static const CGEN_OPINST sfmt_mvfachi_a_ops[] = {
+  { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 },
+  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_mvfc_ops[] = {
   { INPUT, "scr", HW_H_CR, CGEN_MODE_USI, OP_ENT (SCR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_mvtachi_ops[] = {
+static const CGEN_OPINST sfmt_mvtachi_ops[] = {
   { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_mvtc_ops[] = {
+static const CGEN_OPINST sfmt_mvtachi_a_ops[] = {
+  { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 },
+  { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
+  { OUTPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_mvtc_ops[] = {
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dcr", HW_H_CR, CGEN_MODE_USI, OP_ENT (DCR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_nop_ops[] = {
+static const CGEN_OPINST sfmt_nop_ops[] = {
   { END }
 };
 
-static const CGEN_OPINST fmt_rac_ops[] = {
+static const CGEN_OPINST sfmt_rac_ops[] = {
   { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_rte_ops[] = {
+static const CGEN_OPINST sfmt_rac_dsi_ops[] = {
+  { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 },
+  { INPUT, "imm1", HW_H_UINT, CGEN_MODE_INT, OP_ENT (IMM1), 0, 0 },
+  { OUTPUT, "accd", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCD), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_rte_ops[] = {
   { INPUT, "h_bbpsw", HW_H_BBPSW, CGEN_MODE_UQI, 0, 0, 0 },
   { INPUT, "h_bpsw", HW_H_BPSW, CGEN_MODE_UQI, 0, 0, 0 },
   { INPUT, "h_cr_14", HW_H_CR, CGEN_MODE_USI, 0, 14, 0 },
@@ -340,72 +376,72 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_seth_ops[] = {
+static const CGEN_OPINST sfmt_seth_ops[] = {
   { INPUT, "hi16", HW_H_HI16, CGEN_MODE_SI, OP_ENT (HI16), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_sll3_ops[] = {
+static const CGEN_OPINST sfmt_sll3_ops[] = {
   { INPUT, "simm16", HW_H_SINT, CGEN_MODE_SI, OP_ENT (SIMM16), 0, 0 },
   { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_slli_ops[] = {
+static const CGEN_OPINST sfmt_slli_ops[] = {
   { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { INPUT, "uimm5", HW_H_UINT, CGEN_MODE_INT, OP_ENT (UIMM5), 0, 0 },
   { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_st_ops[] = {
+static const CGEN_OPINST sfmt_st_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "h_memory_src2", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_st_d_ops[] = {
+static const CGEN_OPINST sfmt_st_d_ops[] = {
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
-  { OUTPUT, "h_memory_add__VM_src2_slo16", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
+  { OUTPUT, "h_memory_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_stb_ops[] = {
+static const CGEN_OPINST sfmt_stb_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_QI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "h_memory_src2", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_stb_d_ops[] = {
+static const CGEN_OPINST sfmt_stb_d_ops[] = {
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_QI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
-  { OUTPUT, "h_memory_add__VM_src2_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 },
+  { OUTPUT, "h_memory_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_sth_ops[] = {
+static const CGEN_OPINST sfmt_sth_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_HI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "h_memory_src2", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_sth_d_ops[] = {
+static const CGEN_OPINST sfmt_sth_d_ops[] = {
   { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_HI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
-  { OUTPUT, "h_memory_add__VM_src2_slo16", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 },
+  { OUTPUT, "h_memory_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 },
   { END }
 };
 
-static const CGEN_OPINST fmt_st_plus_ops[] = {
+static const CGEN_OPINST sfmt_st_plus_ops[] = {
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
   { OUTPUT, "h_memory_new_src2", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 },
@@ -413,7 +449,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_trap_ops[] = {
+static const CGEN_OPINST sfmt_trap_ops[] = {
   { INPUT, "h_bpsw", HW_H_BPSW, CGEN_MODE_UQI, 0, 0, 0 },
   { INPUT, "h_cr_6", HW_H_CR, CGEN_MODE_USI, 0, 6, 0 },
   { INPUT, "h_psw", HW_H_PSW, CGEN_MODE_UQI, 0, 0, 0 },
@@ -428,7 +464,7 @@
   { END }
 };
 
-static const CGEN_OPINST fmt_unlock_ops[] = {
+static const CGEN_OPINST sfmt_unlock_ops[] = {
   { INPUT, "h_lock", HW_H_LOCK, CGEN_MODE_BI, 0, 0, 0 },
   { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, COND_REF },
   { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, COND_REF },
@@ -437,6 +473,46 @@
   { END }
 };
 
+static const CGEN_OPINST sfmt_satb_ops[] = {
+  { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 },
+  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_sat_ops[] = {
+  { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, COND_REF },
+  { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_sadd_ops[] = {
+  { INPUT, "h_accums_0", HW_H_ACCUMS, CGEN_MODE_DI, 0, 0, 0 },
+  { INPUT, "h_accums_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 },
+  { OUTPUT, "h_accums_0", HW_H_ACCUMS, CGEN_MODE_DI, 0, 0, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_macwu1_ops[] = {
+  { INPUT, "h_accums_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 },
+  { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
+  { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
+  { OUTPUT, "h_accums_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_mulwu1_ops[] = {
+  { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 },
+  { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 },
+  { OUTPUT, "h_accums_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 },
+  { END }
+};
+
+static const CGEN_OPINST sfmt_sc_ops[] = {
+  { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 },
+  { END }
+};
+
 #undef INPUT
 #undef OUTPUT
 #undef END
@@ -447,105 +523,140 @@
 
 static const CGEN_OPINST *m32r_cgen_opinst_table[MAX_INSNS] = {
   0,
-  & fmt_add_ops[0],
-  & fmt_add3_ops[0],
-  & fmt_add_ops[0],
-  & fmt_and3_ops[0],
-  & fmt_add_ops[0],
-  & fmt_or3_ops[0],
-  & fmt_add_ops[0],
-  & fmt_and3_ops[0],
-  & fmt_addi_ops[0],
-  & fmt_addv_ops[0],
-  & fmt_addv3_ops[0],
-  & fmt_addx_ops[0],
-  & fmt_bc8_ops[0],
-  & fmt_bc24_ops[0],
-  & fmt_beq_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_beqz_ops[0],
-  & fmt_bl8_ops[0],
-  & fmt_bl24_ops[0],
-  & fmt_bc8_ops[0],
-  & fmt_bc24_ops[0],
-  & fmt_beq_ops[0],
-  & fmt_bra8_ops[0],
-  & fmt_bra24_ops[0],
-  & fmt_cmp_ops[0],
-  & fmt_cmpi_ops[0],
-  & fmt_cmp_ops[0],
-  & fmt_cmpi_ops[0],
-  & fmt_div_ops[0],
-  & fmt_div_ops[0],
-  & fmt_div_ops[0],
-  & fmt_div_ops[0],
-  & fmt_jl_ops[0],
-  & fmt_jmp_ops[0],
-  & fmt_ld_ops[0],
-  & fmt_ld_d_ops[0],
-  & fmt_ldb_ops[0],
-  & fmt_ldb_d_ops[0],
-  & fmt_ldh_ops[0],
-  & fmt_ldh_d_ops[0],
-  & fmt_ldb_ops[0],
-  & fmt_ldb_d_ops[0],
-  & fmt_ldh_ops[0],
-  & fmt_ldh_d_ops[0],
-  & fmt_ld_plus_ops[0],
-  & fmt_ld24_ops[0],
-  & fmt_ldi8_ops[0],
-  & fmt_ldi16_ops[0],
-  & fmt_lock_ops[0],
-  & fmt_machi_ops[0],
-  & fmt_machi_ops[0],
-  & fmt_machi_ops[0],
-  & fmt_machi_ops[0],
-  & fmt_add_ops[0],
-  & fmt_mulhi_ops[0],
-  & fmt_mulhi_ops[0],
-  & fmt_mulhi_ops[0],
-  & fmt_mulhi_ops[0],
-  & fmt_mv_ops[0],
-  & fmt_mvfachi_ops[0],
-  & fmt_mvfachi_ops[0],
-  & fmt_mvfachi_ops[0],
-  & fmt_mvfc_ops[0],
-  & fmt_mvtachi_ops[0],
-  & fmt_mvtachi_ops[0],
-  & fmt_mvtc_ops[0],
-  & fmt_mv_ops[0],
-  & fmt_nop_ops[0],
-  & fmt_mv_ops[0],
-  & fmt_rac_ops[0],
-  & fmt_rac_ops[0],
-  & fmt_rte_ops[0],
-  & fmt_seth_ops[0],
-  & fmt_add_ops[0],
-  & fmt_sll3_ops[0],
-  & fmt_slli_ops[0],
-  & fmt_add_ops[0],
-  & fmt_sll3_ops[0],
-  & fmt_slli_ops[0],
-  & fmt_add_ops[0],
-  & fmt_sll3_ops[0],
-  & fmt_slli_ops[0],
-  & fmt_st_ops[0],
-  & fmt_st_d_ops[0],
-  & fmt_stb_ops[0],
-  & fmt_stb_d_ops[0],
-  & fmt_sth_ops[0],
-  & fmt_sth_d_ops[0],
-  & fmt_st_plus_ops[0],
-  & fmt_st_plus_ops[0],
-  & fmt_add_ops[0],
-  & fmt_addv_ops[0],
-  & fmt_addx_ops[0],
-  & fmt_trap_ops[0],
-  & fmt_unlock_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_add3_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_and3_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_or3_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_and3_ops[0],
+  & sfmt_addi_ops[0],
+  & sfmt_addv_ops[0],
+  & sfmt_addv3_ops[0],
+  & sfmt_addx_ops[0],
+  & sfmt_bc8_ops[0],
+  & sfmt_bc24_ops[0],
+  & sfmt_beq_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_beqz_ops[0],
+  & sfmt_bl8_ops[0],
+  & sfmt_bl24_ops[0],
+  & sfmt_bcl8_ops[0],
+  & sfmt_bcl24_ops[0],
+  & sfmt_bc8_ops[0],
+  & sfmt_bc24_ops[0],
+  & sfmt_beq_ops[0],
+  & sfmt_bra8_ops[0],
+  & sfmt_bra24_ops[0],
+  & sfmt_bcl8_ops[0],
+  & sfmt_bcl24_ops[0],
+  & sfmt_cmp_ops[0],
+  & sfmt_cmpi_ops[0],
+  & sfmt_cmp_ops[0],
+  & sfmt_cmpi_ops[0],
+  & sfmt_cmp_ops[0],
+  & sfmt_cmpz_ops[0],
+  & sfmt_div_ops[0],
+  & sfmt_div_ops[0],
+  & sfmt_div_ops[0],
+  & sfmt_div_ops[0],
+  & sfmt_div_ops[0],
+  & sfmt_jc_ops[0],
+  & sfmt_jc_ops[0],
+  & sfmt_jl_ops[0],
+  & sfmt_jmp_ops[0],
+  & sfmt_ld_ops[0],
+  & sfmt_ld_d_ops[0],
+  & sfmt_ld_ops[0],
+  & sfmt_ld_d_ops[0],
+  & sfmt_ld_ops[0],
+  & sfmt_ld_d_ops[0],
+  & sfmt_ld_ops[0],
+  & sfmt_ld_d_ops[0],
+  & sfmt_ld_ops[0],
+  & sfmt_ld_d_ops[0],
+  & sfmt_ld_plus_ops[0],
+  & sfmt_ld24_ops[0],
+  & sfmt_ldi8_ops[0],
+  & sfmt_ldi16_ops[0],
+  & sfmt_lock_ops[0],
+  & sfmt_machi_ops[0],
+  & sfmt_machi_a_ops[0],
+  & sfmt_machi_ops[0],
+  & sfmt_machi_a_ops[0],
+  & sfmt_machi_ops[0],
+  & sfmt_machi_a_ops[0],
+  & sfmt_machi_ops[0],
+  & sfmt_machi_a_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_mulhi_ops[0],
+  & sfmt_mulhi_a_ops[0],
+  & sfmt_mulhi_ops[0],
+  & sfmt_mulhi_a_ops[0],
+  & sfmt_mulhi_ops[0],
+  & sfmt_mulhi_a_ops[0],
+  & sfmt_mulhi_ops[0],
+  & sfmt_mulhi_a_ops[0],
+  & sfmt_mv_ops[0],
+  & sfmt_mvfachi_ops[0],
+  & sfmt_mvfachi_a_ops[0],
+  & sfmt_mvfachi_ops[0],
+  & sfmt_mvfachi_a_ops[0],
+  & sfmt_mvfachi_ops[0],
+  & sfmt_mvfachi_a_ops[0],
+  & sfmt_mvfc_ops[0],
+  & sfmt_mvtachi_ops[0],
+  & sfmt_mvtachi_a_ops[0],
+  & sfmt_mvtachi_ops[0],
+  & sfmt_mvtachi_a_ops[0],
+  & sfmt_mvtc_ops[0],
+  & sfmt_mv_ops[0],
+  & sfmt_nop_ops[0],
+  & sfmt_mv_ops[0],
+  & sfmt_rac_ops[0],
+  & sfmt_rac_dsi_ops[0],
+  & sfmt_rac_ops[0],
+  & sfmt_rac_dsi_ops[0],
+  & sfmt_rte_ops[0],
+  & sfmt_seth_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_sll3_ops[0],
+  & sfmt_slli_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_sll3_ops[0],
+  & sfmt_slli_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_sll3_ops[0],
+  & sfmt_slli_ops[0],
+  & sfmt_st_ops[0],
+  & sfmt_st_d_ops[0],
+  & sfmt_stb_ops[0],
+  & sfmt_stb_d_ops[0],
+  & sfmt_sth_ops[0],
+  & sfmt_sth_d_ops[0],
+  & sfmt_st_plus_ops[0],
+  & sfmt_st_plus_ops[0],
+  & sfmt_add_ops[0],
+  & sfmt_addv_ops[0],
+  & sfmt_addx_ops[0],
+  & sfmt_trap_ops[0],
+  & sfmt_unlock_ops[0],
+  & sfmt_satb_ops[0],
+  & sfmt_satb_ops[0],
+  & sfmt_sat_ops[0],
+  & sfmt_cmpz_ops[0],
+  & sfmt_sadd_ops[0],
+  & sfmt_macwu1_ops[0],
+  & sfmt_machi_ops[0],
+  & sfmt_mulwu1_ops[0],
+  & sfmt_macwu1_ops[0],
+  & sfmt_sc_ops[0],
+  & sfmt_sc_ops[0],
 };
 
 /* Function to call before using the operand instance table.  */
diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c
index a316c21..23d3a821 100644
--- a/opcodes/m68k-dis.c
+++ b/opcodes/m68k-dis.c
@@ -1,5 +1,5 @@
 /* Print Motorola 68k instructions.
-   Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
 This file is free software; you can redistribute it and/or modify
@@ -504,6 +504,18 @@
       (*info->fprintf_func) (info->stream, "%%usp");
       break;
 
+    case 'E':
+      (*info->fprintf_func) (info->stream, "%%acc");
+      break;
+
+    case 'G':
+      (*info->fprintf_func) (info->stream, "%%macsr");
+      break;
+
+    case 'H':
+      (*info->fprintf_func) (info->stream, "%%mask");
+      break;
+
     case 'J':
       {
 	static const struct { char *name; int value; } names[]
@@ -539,10 +551,19 @@
       break;
 
     case 'M':
-      val = fetch_arg (buffer, place, 8, info);
-      if (val & 0x80)
-	val = val - 0x100;
-      (*info->fprintf_func) (info->stream, "#%d", val);
+      if (place == 'h')
+	{
+	  static char *const scalefactor_name[] = { "<<", ">>" };
+	  val = fetch_arg (buffer, place, 1, info);
+	  (*info->fprintf_func) (info->stream, scalefactor_name[val]);
+	}
+      else
+	{
+	  val = fetch_arg (buffer, place, 8, info);
+	  if (val & 0x80)
+	    val = val - 0x100;
+	  (*info->fprintf_func) (info->stream, "#%d", val);
+	}
       break;
 
     case 'T':
@@ -979,6 +1000,22 @@
       }
       break;
 
+    case 'u':
+      {
+	short is_upper = 0;
+	int reg = fetch_arg (buffer, place, 5, info);
+	
+	if (reg & 0x10)
+	  {
+	    is_upper = 1;
+	    reg &= 0xf;
+	  }
+	(*info->fprintf_func) (info->stream, "%s%s",
+			       reg_names[reg],
+			       is_upper ? "u" : "l");
+      }
+      break;
+	
     default:
       return -2;
     }
@@ -1082,12 +1119,40 @@
       val = (buffer[1] >> 6);
       break;
 
+    case 'm': 
+      val = (buffer[1] & 0x40 ? 0x8 : 0)
+	| ((buffer[0] >> 1) & 0x7)
+	| (buffer[3] & 0x80 ? 0x10 : 0);
+      break;
+
+    case 'n': 
+      val = (buffer[1] & 0x40 ? 0x8 : 0) | ((buffer[0] >> 1) & 0x7);
+      break;
+
+    case 'o':
+      val = (buffer[2] >> 4) | (buffer[3] & 0x80 ? 0x10 : 0);
+      break;
+
+    case 'M':
+      val = buffer[1] | (buffer[3] & 0x40 ? 0x10 : 0);
+      break;
+
+    case 'N':
+      val = buffer[3] | (buffer[3] & 0x40 ? 0x10 : 0);
+      break;
+
+    case 'h':
+      val = buffer[2] >> 2;
+      break;
+
     default:
       abort ();
     }
 
   switch (bits)
     {
+    case 1:
+      return val & 1;
     case 2:
       return val & 3;
     case 3:
diff --git a/opcodes/m68k-opc.c b/opcodes/m68k-opc.c
index 15e1b8d..847ad7c 100644
--- a/opcodes/m68k-opc.c
+++ b/opcodes/m68k-opc.c
@@ -35,16 +35,16 @@
 {"abcd",	one(0140410),	one(0170770), "-s-d", m68000up },
 
 {"addaw",	one(0150300),	one(0170700), "*wAd", m68000up },
-{"addal",	one(0150700),	one(0170700), "*lAd", m68000up | mcf5200 },
+{"addal",	one(0150700),	one(0170700), "*lAd", m68000up | mcf },
 
 {"addib",	one(0003000),	one(0177700), "#b$s", m68000up },
 {"addiw",	one(0003100),	one(0177700), "#w$s", m68000up },
 {"addil",	one(0003200),	one(0177700), "#l$s", m68000up },
-{"addil",	one(0003200),	one(0177700), "#lDs", mcf5200 },
+{"addil",	one(0003200),	one(0177700), "#lDs", mcf },
 
 {"addqb",	one(0050000),	one(0170700), "Qd$b", m68000up },
 {"addqw",	one(0050100),	one(0170700), "Qd%w", m68000up },
-{"addql",	one(0050200),	one(0170700), "Qd%l", m68000up | mcf5200 },
+{"addql",	one(0050200),	one(0170700), "Qd%l", m68000up | mcf },
 
 /* The add opcode can generate the adda, addi, and addq instructions.  */
 {"addb",	one(0050000),	one(0170700), "Qd$b", m68000up },
@@ -56,18 +56,18 @@
 {"addw",	one(0003100),	one(0177700), "#w$s", m68000up },
 {"addw",	one(0150100),	one(0170700), "*wDd", m68000up },
 {"addw",	one(0150500),	one(0170700), "Dd~w", m68000up },
-{"addl",	one(0050200),	one(0170700), "Qd%l", m68000up | mcf5200 },
+{"addl",	one(0050200),	one(0170700), "Qd%l", m68000up | mcf },
 {"addl",	one(0003200),	one(0177700), "#l$s", m68000up },
-{"addl",	one(0003200),	one(0177700), "#lDs", mcf5200 },
-{"addl",	one(0150700),	one(0170700), "*lAd", m68000up | mcf5200 },
-{"addl",	one(0150200),	one(0170700), "*lDd", m68000up | mcf5200 },
-{"addl",	one(0150600),	one(0170700), "Dd~l", m68000up | mcf5200 },
+{"addl",	one(0003200),	one(0177700), "#lDs", mcf },
+{"addl",	one(0150700),	one(0170700), "*lAd", m68000up | mcf },
+{"addl",	one(0150200),	one(0170700), "*lDd", m68000up | mcf },
+{"addl",	one(0150600),	one(0170700), "Dd~l", m68000up | mcf },
 
 {"addxb",	one(0150400),	one(0170770), "DsDd", m68000up },
 {"addxb",	one(0150410),	one(0170770), "-s-d", m68000up },
 {"addxw",	one(0150500),	one(0170770), "DsDd", m68000up },
 {"addxw",	one(0150510),	one(0170770), "-s-d", m68000up },
-{"addxl",	one(0150600),	one(0170770), "DsDd", m68000up | mcf5200 },
+{"addxl",	one(0150600),	one(0170770), "DsDd", m68000up | mcf },
 {"addxl",	one(0150610),	one(0170770), "-s-d", m68000up },
 
 {"andib",	one(0001000),	one(0177700), "#b$s", m68000up },
@@ -75,7 +75,7 @@
 {"andiw",	one(0001100),	one(0177700), "#w$s", m68000up },
 {"andiw",	one(0001174),	one(0177777), "#wSs", m68000up },
 {"andil",	one(0001200),	one(0177700), "#l$s", m68000up },
-{"andil",	one(0001200),	one(0177700), "#lDs", mcf5200 },
+{"andil",	one(0001200),	one(0177700), "#lDs", mcf },
 {"andi",	one(0001100),	one(0177700), "#w$s", m68000up },
 {"andi",	one(0001074),	one(0177777), "#bCs", m68000up },
 {"andi",	one(0001174),	one(0177777), "#wSs", m68000up },
@@ -90,9 +90,9 @@
 {"andw",	one(0140100),	one(0170700), ";wDd", m68000up },
 {"andw",	one(0140500),	one(0170700), "Dd~w", m68000up },
 {"andl",	one(0001200),	one(0177700), "#l$s", m68000up },
-{"andl",	one(0001200),	one(0177700), "#lDs", mcf5200 },
-{"andl",	one(0140200),	one(0170700), ";lDd", m68000up | mcf5200 },
-{"andl",	one(0140600),	one(0170700), "Dd~l", m68000up | mcf5200 },
+{"andl",	one(0001200),	one(0177700), "#lDs", mcf },
+{"andl",	one(0140200),	one(0170700), ";lDd", m68000up | mcf },
+{"andl",	one(0140600),	one(0170700), "Dd~l", m68000up | mcf },
 {"and",		one(0001100),	one(0177700), "#w$w", m68000up },
 {"and",		one(0001074),	one(0177777), "#bCs", m68000up },
 {"and",		one(0001174),	one(0177777), "#wSs", m68000up },
@@ -104,31 +104,31 @@
 {"aslw",	one(0160500),	one(0170770), "QdDs", m68000up },
 {"aslw",	one(0160540),	one(0170770), "DdDs", m68000up },
 {"aslw",	one(0160700),	one(0177700), "~s",   m68000up },
-{"asll",	one(0160600),	one(0170770), "QdDs", m68000up | mcf5200 },
-{"asll",	one(0160640),	one(0170770), "DdDs", m68000up | mcf5200 },
+{"asll",	one(0160600),	one(0170770), "QdDs", m68000up | mcf },
+{"asll",	one(0160640),	one(0170770), "DdDs", m68000up | mcf },
 
 {"asrb",	one(0160000),	one(0170770), "QdDs", m68000up },
 {"asrb",	one(0160040),	one(0170770), "DdDs", m68000up },
 {"asrw",	one(0160100),	one(0170770), "QdDs", m68000up },
 {"asrw",	one(0160140),	one(0170770), "DdDs", m68000up },
 {"asrw",	one(0160300),	one(0177700), "~s",   m68000up },
-{"asrl",	one(0160200),	one(0170770), "QdDs", m68000up | mcf5200 },
-{"asrl",	one(0160240),	one(0170770), "DdDs", m68000up | mcf5200 },
+{"asrl",	one(0160200),	one(0170770), "QdDs", m68000up | mcf },
+{"asrl",	one(0160240),	one(0170770), "DdDs", m68000up | mcf },
 
-{"bhiw",	one(0061000),	one(0177777), "BW", m68000up | mcf5200 },
-{"blsw",	one(0061400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bccw",	one(0062000),	one(0177777), "BW", m68000up | mcf5200 },
-{"bcsw",	one(0062400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bnew",	one(0063000),	one(0177777), "BW", m68000up | mcf5200 },
-{"beqw",	one(0063400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bvcw",	one(0064000),	one(0177777), "BW", m68000up | mcf5200 },
-{"bvsw",	one(0064400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bplw",	one(0065000),	one(0177777), "BW", m68000up | mcf5200 },
-{"bmiw",	one(0065400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bgew",	one(0066000),	one(0177777), "BW", m68000up | mcf5200 },
-{"bltw",	one(0066400),	one(0177777), "BW", m68000up | mcf5200 },
-{"bgtw",	one(0067000),	one(0177777), "BW", m68000up | mcf5200 },
-{"blew",	one(0067400),	one(0177777), "BW", m68000up | mcf5200 },
+{"bhiw",	one(0061000),	one(0177777), "BW", m68000up | mcf },
+{"blsw",	one(0061400),	one(0177777), "BW", m68000up | mcf },
+{"bccw",	one(0062000),	one(0177777), "BW", m68000up | mcf },
+{"bcsw",	one(0062400),	one(0177777), "BW", m68000up | mcf },
+{"bnew",	one(0063000),	one(0177777), "BW", m68000up | mcf },
+{"beqw",	one(0063400),	one(0177777), "BW", m68000up | mcf },
+{"bvcw",	one(0064000),	one(0177777), "BW", m68000up | mcf },
+{"bvsw",	one(0064400),	one(0177777), "BW", m68000up | mcf },
+{"bplw",	one(0065000),	one(0177777), "BW", m68000up | mcf },
+{"bmiw",	one(0065400),	one(0177777), "BW", m68000up | mcf },
+{"bgew",	one(0066000),	one(0177777), "BW", m68000up | mcf },
+{"bltw",	one(0066400),	one(0177777), "BW", m68000up | mcf },
+{"bgtw",	one(0067000),	one(0177777), "BW", m68000up | mcf },
+{"blew",	one(0067400),	one(0177777), "BW", m68000up | mcf },
 
 {"bhil",	one(0061377),	one(0177777), "BL", m68020up | cpu32 },
 {"blsl",	one(0061777),	one(0177777), "BL", m68020up | cpu32 },
@@ -145,44 +145,44 @@
 {"bgtl",	one(0067377),	one(0177777), "BL", m68020up | cpu32 },
 {"blel",	one(0067777),	one(0177777), "BL", m68020up | cpu32 },
 
-{"bhis",	one(0061000),	one(0177400), "BB", m68000up | mcf5200 },
-{"blss",	one(0061400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bccs",	one(0062000),	one(0177400), "BB", m68000up | mcf5200 },
-{"bcss",	one(0062400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bnes",	one(0063000),	one(0177400), "BB", m68000up | mcf5200 },
-{"beqs",	one(0063400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bvcs",	one(0064000),	one(0177400), "BB", m68000up | mcf5200 },
-{"bvss",	one(0064400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bpls",	one(0065000),	one(0177400), "BB", m68000up | mcf5200 },
-{"bmis",	one(0065400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bges",	one(0066000),	one(0177400), "BB", m68000up | mcf5200 },
-{"blts",	one(0066400),	one(0177400), "BB", m68000up | mcf5200 },
-{"bgts",	one(0067000),	one(0177400), "BB", m68000up | mcf5200 },
-{"bles",	one(0067400),	one(0177400), "BB", m68000up | mcf5200 },
+{"bhis",	one(0061000),	one(0177400), "BB", m68000up | mcf },
+{"blss",	one(0061400),	one(0177400), "BB", m68000up | mcf },
+{"bccs",	one(0062000),	one(0177400), "BB", m68000up | mcf },
+{"bcss",	one(0062400),	one(0177400), "BB", m68000up | mcf },
+{"bnes",	one(0063000),	one(0177400), "BB", m68000up | mcf },
+{"beqs",	one(0063400),	one(0177400), "BB", m68000up | mcf },
+{"bvcs",	one(0064000),	one(0177400), "BB", m68000up | mcf },
+{"bvss",	one(0064400),	one(0177400), "BB", m68000up | mcf },
+{"bpls",	one(0065000),	one(0177400), "BB", m68000up | mcf },
+{"bmis",	one(0065400),	one(0177400), "BB", m68000up | mcf },
+{"bges",	one(0066000),	one(0177400), "BB", m68000up | mcf },
+{"blts",	one(0066400),	one(0177400), "BB", m68000up | mcf },
+{"bgts",	one(0067000),	one(0177400), "BB", m68000up | mcf },
+{"bles",	one(0067400),	one(0177400), "BB", m68000up | mcf },
 
-{"jhi",		one(0061000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jls",		one(0061400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jcc",		one(0062000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jcs",		one(0062400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jne",		one(0063000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jeq",		one(0063400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jvc",		one(0064000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jvs",		one(0064400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jpl",		one(0065000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jmi",		one(0065400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jge",		one(0066000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jlt",		one(0066400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jgt",		one(0067000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jle",		one(0067400),	one(0177400), "Bg", m68000up | mcf5200 },
+{"jhi",		one(0061000),	one(0177400), "Bg", m68000up | mcf },
+{"jls",		one(0061400),	one(0177400), "Bg", m68000up | mcf },
+{"jcc",		one(0062000),	one(0177400), "Bg", m68000up | mcf },
+{"jcs",		one(0062400),	one(0177400), "Bg", m68000up | mcf },
+{"jne",		one(0063000),	one(0177400), "Bg", m68000up | mcf },
+{"jeq",		one(0063400),	one(0177400), "Bg", m68000up | mcf },
+{"jvc",		one(0064000),	one(0177400), "Bg", m68000up | mcf },
+{"jvs",		one(0064400),	one(0177400), "Bg", m68000up | mcf },
+{"jpl",		one(0065000),	one(0177400), "Bg", m68000up | mcf },
+{"jmi",		one(0065400),	one(0177400), "Bg", m68000up | mcf },
+{"jge",		one(0066000),	one(0177400), "Bg", m68000up | mcf },
+{"jlt",		one(0066400),	one(0177400), "Bg", m68000up | mcf },
+{"jgt",		one(0067000),	one(0177400), "Bg", m68000up | mcf },
+{"jle",		one(0067400),	one(0177400), "Bg", m68000up | mcf },
 
-{"bchg",	one(0000500),	one(0170700), "Dd$s", m68000up | mcf5200 },
+{"bchg",	one(0000500),	one(0170700), "Dd$s", m68000up | mcf },
 {"bchg",	one(0004100),	one(0177700), "#b$s", m68000up },
-{"bchg",	one(0004100),	one(0177700), "#bqs", mcf5200 },
+{"bchg",	one(0004100),	one(0177700), "#bqs", mcf },
 
 {"bclr",	one(0000600),	one(0170700), "Dd$s", m68000up },
-{"bclr",	one(0000600),	one(0170700), "Ddvs", mcf5200 },
+{"bclr",	one(0000600),	one(0170700), "Ddvs", mcf },
 {"bclr",	one(0004200),	one(0177700), "#b$s", m68000up },
-{"bclr",	one(0004200),	one(0177700), "#bqs", mcf5200 },
+{"bclr",	one(0004200),	one(0177700), "#bqs", mcf },
 
 {"bfchg",	two(0165300, 0), two(0177700, 0170000),	"?sO2O3",   m68020up },
 {"bfclr",	two(0166300, 0), two(0177700, 0170000),	"?sO2O3",   m68020up },
@@ -197,22 +197,22 @@
 
 {"bkpt",	one(0044110),		one(0177770), "ts", m68010up },
 
-{"braw",	one(0060000),	one(0177777), "BW", m68000up | mcf5200 },
+{"braw",	one(0060000),	one(0177777), "BW", m68000up | mcf },
 {"bral",	one(0060377),	one(0177777), "BL", m68020up | cpu32 },
-{"bras",	one(0060000),	one(0177400), "BB", m68000up | mcf5200 },
+{"bras",	one(0060000),	one(0177400), "BB", m68000up | mcf },
 
 {"bset",	one(0000700),	one(0170700), "Dd$s", m68000up },
-{"bset",	one(0000700),	one(0170700), "Ddvs", mcf5200 },
+{"bset",	one(0000700),	one(0170700), "Ddvs", mcf },
 {"bset",	one(0004300),	one(0177700), "#b$s", m68000up },
-{"bset",	one(0004300),	one(0177700), "#bqs", mcf5200 },
+{"bset",	one(0004300),	one(0177700), "#bqs", mcf },
 
-{"bsrw",	one(0060400),	one(0177777), "BW", m68000up | mcf5200 },
+{"bsrw",	one(0060400),	one(0177777), "BW", m68000up | mcf },
 {"bsrl",	one(0060777),	one(0177777), "BL", m68020up | cpu32 },
-{"bsrs",	one(0060400),	one(0177400), "BB", m68000up | mcf5200 },
+{"bsrs",	one(0060400),	one(0177400), "BB", m68000up | mcf },
 
-{"btst",	one(0000400),	one(0170700), "Dd;b", m68000up | mcf5200 },
+{"btst",	one(0000400),	one(0170700), "Dd;b", m68000up | mcf },
 {"btst",	one(0004000),	one(0177700), "#b@s", m68000up },
-{"btst",	one(0004000),	one(0177700), "#bqs", mcf5200 },
+{"btst",	one(0004000),	one(0177700), "#bqs", mcf },
 
 {"callm",	one(0003300),		one(0177700), "#b!s", m68020 },
 
@@ -242,28 +242,28 @@
 
 {"cpusha",	one(0xf420|SCOPE_ALL),  one(0xff38), "ce",   m68040up },
 {"cpushl",	one(0xf420|SCOPE_LINE), one(0xff38), "ceas", m68040up },
-{"cpushl",	one(0x04e8),		one(0xfff8), "as",   mcf5200  },
+{"cpushl",	one(0x04e8),		one(0xfff8), "as",   mcf },
 {"cpushp",	one(0xf420|SCOPE_PAGE), one(0xff38), "ceas", m68040up },
 
 #undef SCOPE_LINE
 #undef SCOPE_PAGE
 #undef SCOPE_ALL
 
-{"clrb",	one(0041000),	one(0177700), "$s", m68000up | mcf5200 },
-{"clrw",	one(0041100),	one(0177700), "$s", m68000up | mcf5200 },
-{"clrl",	one(0041200),	one(0177700), "$s", m68000up | mcf5200 },
+{"clrb",	one(0041000),	one(0177700), "$s", m68000up | mcf },
+{"clrw",	one(0041100),	one(0177700), "$s", m68000up | mcf },
+{"clrl",	one(0041200),	one(0177700), "$s", m68000up | mcf },
 
 {"cmp2b",	two(0000300,0), two(0177700,07777), "!sR1", m68020up | cpu32 },
 {"cmp2w",	two(0001300,0),	two(0177700,07777), "!sR1", m68020up | cpu32 },
 {"cmp2l",	two(0002300,0),	two(0177700,07777), "!sR1", m68020up | cpu32 },
 
 {"cmpaw",	one(0130300),	one(0170700), "*wAd", m68000up },
-{"cmpal",	one(0130700),	one(0170700), "*lAd", m68000up | mcf5200 },
+{"cmpal",	one(0130700),	one(0170700), "*lAd", m68000up | mcf },
 
 {"cmpib",	one(0006000),	one(0177700), "#b@s", m68000up },
 {"cmpiw",	one(0006100),	one(0177700), "#w@s", m68000up },
 {"cmpil",	one(0006200),	one(0177700), "#l@s", m68000up },
-{"cmpil",	one(0006200),	one(0177700), "#lDs", mcf5200 },
+{"cmpil",	one(0006200),	one(0177700), "#lDs", mcf },
 
 {"cmpmb",	one(0130410),	one(0170770), "+s+d", m68000up },
 {"cmpmw",	one(0130510),	one(0170770), "+s+d", m68000up },
@@ -277,11 +277,11 @@
 {"cmpw",	one(0006100),	one(0177700), "#w@s", m68000up },
 {"cmpw",	one(0130510),	one(0170770), "+s+d", m68000up },
 {"cmpw",	one(0130100),	one(0170700), "*wDd", m68000up },
-{"cmpl",	one(0130700),	one(0170700), "*lAd", m68000up | mcf5200 },
+{"cmpl",	one(0130700),	one(0170700), "*lAd", m68000up | mcf },
 {"cmpl",	one(0006200),	one(0177700), "#l@s", m68000up },
-{"cmpl",	one(0006200),	one(0177700), "#lDs", mcf5200 },
+{"cmpl",	one(0006200),	one(0177700), "#lDs", mcf },
 {"cmpl",	one(0130610),	one(0170770), "+s+d", m68000up },
-{"cmpl",	one(0130200),	one(0170700), "*lDd", m68000up | mcf5200 },
+{"cmpl",	one(0130200),	one(0170700), "*lDd", m68000up | mcf },
 
 {"dbcc",	one(0052310),	one(0177770), "DsBw", m68000up },
 {"dbcs",	one(0052710),	one(0177770), "DsBw", m68000up },
@@ -301,17 +301,21 @@
 {"dbvs",	one(0054710),	one(0177770), "DsBw", m68000up },
 
 {"divsw",	one(0100700),		one(0170700), ";wDd", m68000up },
+{"divsw",	one(0100700),   one(0170700), "vsDd", mcf5307 | mcf5206e },
 
 {"divsl", two(0046100,0006000),two(0177700,0107770),";lD3D1", m68020up|cpu32 },
 {"divsl", two(0046100,0004000),two(0177700,0107770),";lDD",   m68020up|cpu32 },
+{"divsl", two(0046100,0004000),two(0177700,0107770),"vsDD",   mcf5307 | mcf5206e },
 
 {"divsll", two(0046100,0004000),two(0177700,0107770),";lD3D1",m68020up|cpu32 },
 {"divsll", two(0046100,0004000),two(0177700,0107770),";lDD",  m68020up|cpu32 },
 
 {"divuw",	one(0100300),		one(0170700), ";wDd", m68000up },
+{"divuw",	one(0100300),		one(0170700), "vsDd", mcf5307 | mcf5206e },
 
 {"divul", two(0046100,0002000),two(0177700,0107770),";lD3D1", m68020up|cpu32 },
 {"divul", two(0046100,0000000),two(0177700,0107770),";lDD",   m68020up|cpu32 },
+{"divul", two(0046100,0000000),two(0177700,0107770),"vsDD",   mcf5307 | mcf5206e },
 
 {"divull", two(0046100,0000000),two(0177700,0107770),";lD3D1",m68020up|cpu32 },
 {"divull", two(0046100,0000000),two(0177700,0107770),";lDD",  m68020up|cpu32 },
@@ -321,7 +325,7 @@
 {"eoriw",	one(0005100),	one(0177700), "#w$s", m68000up },
 {"eoriw",	one(0005174),	one(0177777), "#wSs", m68000up },
 {"eoril",	one(0005200),	one(0177700), "#l$s", m68000up },
-{"eoril",	one(0005200),	one(0177700), "#lDs", mcf5200 },
+{"eoril",	one(0005200),	one(0177700), "#lDs", mcf },
 {"eori",	one(0005074),	one(0177777), "#bCs", m68000up },
 {"eori",	one(0005174),	one(0177777), "#wSs", m68000up },
 {"eori",	one(0005100),	one(0177700), "#w$s", m68000up },
@@ -334,8 +338,8 @@
 {"eorw",	one(0005174),	one(0177777), "#wSs", m68000up },
 {"eorw",	one(0130500),	one(0170700), "Dd$s", m68000up },
 {"eorl",	one(0005200),	one(0177700), "#l$s", m68000up },
-{"eorl",	one(0005200),	one(0177700), "#lDs", mcf5200 },
-{"eorl",	one(0130600),	one(0170700), "Dd$s", m68000up | mcf5200 },
+{"eorl",	one(0005200),	one(0177700), "#lDs", mcf },
+{"eorl",	one(0130600),	one(0170700), "Dd$s", m68000up | mcf },
 {"eor",		one(0005074),	one(0177777), "#bCs", m68000up },
 {"eor",		one(0005174),	one(0177777), "#wSs", m68000up },
 {"eor",		one(0005100),	one(0177700), "#w$s", m68000up },
@@ -346,9 +350,9 @@
 {"exg",		one(0140610),	one(0170770), "DdAs", m68000up },
 {"exg",		one(0140610),	one(0170770), "AsDd", m68000up },
 
-{"extw",	one(0044200),	one(0177770), "Ds", m68000up|mcf5200 },
-{"extl",	one(0044300),	one(0177770), "Ds", m68000up|mcf5200 },
-{"extbl",	one(0044700),	one(0177770), "Ds", m68020up|cpu32|mcf5200 },
+{"extw",	one(0044200),	one(0177770), "Ds", m68000up|mcf },
+{"extl",	one(0044300),	one(0177770), "Ds", m68000up|mcf },
+{"extbl",	one(0044700),	one(0177770), "Ds", m68020up|cpu32|mcf },
 
 /* float stuff starts here */
 
@@ -1198,27 +1202,27 @@
 {"ftwotoxx",	two(0xF000, 0x4811), two(0xF1C0, 0xFC7F), "Ii;xF7", mfloat },
 {"ftwotoxx",	two(0xF000, 0x0011), two(0xF1C0, 0xE07F), "IiFt",   mfloat },
 
-{"halt",	one(0045310),	one(0177777), "",     m68060 | mcf5200 },
+{"halt",	one(0045310),	one(0177777), "",     m68060 | mcf },
 
 {"illegal",	one(0045374),	one(0177777), "",     m68000up },
 
-{"jmp",		one(0047300),	one(0177700), "!s", m68000up | mcf5200 },
+{"jmp",		one(0047300),	one(0177700), "!s", m68000up | mcf },
 
-{"jra",		one(0060000),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jra",		one(0047300),	one(0177700), "!s", m68000up | mcf5200 },
+{"jra",		one(0060000),	one(0177400), "Bg", m68000up | mcf },
+{"jra",		one(0047300),	one(0177700), "!s", m68000up | mcf },
 
-{"jsr",		one(0047200),	one(0177700), "!s", m68000up | mcf5200 },
+{"jsr",		one(0047200),	one(0177700), "!s", m68000up | mcf },
 
-{"jbsr",	one(0060400),	one(0177400), "Bg", m68000up | mcf5200 },
-{"jbsr",	one(0047200),	one(0177700), "!s", m68000up | mcf5200 },
+{"jbsr",	one(0060400),	one(0177400), "Bg", m68000up | mcf },
+{"jbsr",	one(0047200),	one(0177700), "!s", m68000up | mcf },
 
-{"lea",		one(0040700),	one(0170700), "!sAd", m68000up | mcf5200 },
+{"lea",		one(0040700),	one(0170700), "!sAd", m68000up | mcf },
 
 {"lpstop",	two(0174000,0000700),two(0177777,0177777),"#w", cpu32|m68060 },
 
-{"linkw",	one(0047120),	one(0177770), "As#w", m68000up | mcf5200 },
+{"linkw",	one(0047120),	one(0177770), "As#w", m68000up | mcf },
 {"linkl",	one(0044010),	one(0177770), "As#l", m68020up | cpu32 },
-{"link",	one(0047120),	one(0177770), "As#W", m68000up | mcf5200 },
+{"link",	one(0047120),	one(0177770), "As#W", m68000up | mcf },
 {"link",	one(0044010),	one(0177770), "As#l", m68020up | cpu32 },
 
 {"lslb",	one(0160410),	one(0170770), "QdDs", m68000up },
@@ -1226,16 +1230,55 @@
 {"lslw",	one(0160510),	one(0170770), "QdDs", m68000up },
 {"lslw",	one(0160550),	one(0170770), "DdDs", m68000up },
 {"lslw",	one(0161700),	one(0177700), "~s",   m68000up },
-{"lsll",	one(0160610),	one(0170770), "QdDs", m68000up | mcf5200 },
-{"lsll",	one(0160650),	one(0170770), "DdDs", m68000up | mcf5200 },
+{"lsll",	one(0160610),	one(0170770), "QdDs", m68000up | mcf },
+{"lsll",	one(0160650),	one(0170770), "DdDs", m68000up | mcf },
 
 {"lsrb",	one(0160010),	one(0170770), "QdDs", m68000up },
 {"lsrb",	one(0160050),	one(0170770), "DdDs", m68000up },
 {"lsrw",	one(0160110),	one(0170770), "QdDs", m68000up },
 {"lsrw",	one(0160150),	one(0170770), "DdDs", m68000up },
 {"lsrw",	one(0161300),	one(0177700), "~s",   m68000up },
-{"lsrl",	one(0160210),	one(0170770), "QdDs", m68000up | mcf5200 },
-{"lsrl",	one(0160250),	one(0170770), "DdDs", m68000up | mcf5200 },
+{"lsrl",	one(0160210),	one(0170770), "QdDs", m68000up | mcf },
+{"lsrl",	one(0160250),	one(0170770), "DdDs", m68000up | mcf },
+
+  /* FIXME: add MAM mode (`&' after <ea> operand) / remove MACM */
+{"macw",  two(0120000, 0000000), two(0170660, 0005400), "uMum", mcf5307 | mcf5206e },
+{"macw",  two(0120000, 0001000), two(0170660, 0005400), "uMumMh", mcf5307 | mcf5206e },
+{"macw",  two(0120220, 0000000), two(0170670, 0005460), "uNuoasRn", mcf5307 | mcf5206e },
+{"macw",  two(0120230, 0000000), two(0170670, 0005460), "uNuo+sRn", mcf5307 | mcf5206e },
+{"macw",  two(0120240, 0000000), two(0170670, 0005460), "uNuo-sRn", mcf5307 | mcf5206e },
+{"macw",  two(0120250, 0000000), two(0170670, 0005460), "uNuodsRn", mcf5307 | mcf5206e },
+{"macw",  two(0120220, 0001000), two(0170670, 0005460), "uNuoMhasRn", mcf5307 | mcf5206e },
+{"macw",  two(0120230, 0001000), two(0170670, 0005460), "uNuoMh+sRn", mcf5307 | mcf5206e },
+{"macw",  two(0120240, 0001000), two(0170670, 0005460), "uNuoMh-sRn", mcf5307 | mcf5206e },
+{"macw",  two(0120250, 0001000), two(0170670, 0005460), "uNuoMhdsRn", mcf5307 | mcf5206e },
+{"macmw", two(0120220, 0000040), two(0170670, 0005460), "uNuoasRn", mcf5307 | mcf5206e },
+{"macmw", two(0120230, 0000040), two(0170670, 0005460), "uNuo+sRn", mcf5307 | mcf5206e },
+{"macmw", two(0120240, 0000040), two(0170670, 0005460), "uNuo-sRn", mcf5307 | mcf5206e },
+{"macmw", two(0120250, 0000040), two(0170670, 0005460), "uNuodsRn", mcf5307 | mcf5206e },
+{"macmw", two(0120220, 0001040), two(0170670, 0005460), "uNuoMhasRn", mcf5307 | mcf5206e },
+{"macmw", two(0120230, 0001040), two(0170670, 0005460), "uNuoMh+sRn", mcf5307 | mcf5206e },
+{"macmw", two(0120240, 0001040), two(0170670, 0005460), "uNuoMh-sRn", mcf5307 | mcf5206e },
+{"macmw", two(0120250, 0001040), two(0170670, 0005460), "uNuoMhdsRn", mcf5307 | mcf5206e },
+
+{"macl",  two(0120000, 0004000), two(0170660, 0005400), "RsRm", mcf5307 | mcf5206e },
+{"macl",  two(0120000, 0005000), two(0170660, 0005400), "RsRmMh", mcf5307 | mcf5206e },
+{"macl",  two(0120220, 0004000), two(0170670, 0005460), "R3R1asRn", mcf5307 | mcf5206e },
+{"macl",  two(0120230, 0004000), two(0170670, 0005460), "R3R1+sRn", mcf5307 | mcf5206e },
+{"macl",  two(0120240, 0004000), two(0170670, 0005460), "R3R1-sRn", mcf5307 | mcf5206e },
+{"macl",  two(0120250, 0004000), two(0170670, 0005460), "R3R1dsRn", mcf5307 | mcf5206e },
+{"macl",  two(0120220, 0005000), two(0170670, 0005460), "R3R1MhasRn", mcf5307 | mcf5206e },
+{"macl",  two(0120230, 0005000), two(0170670, 0005460), "R3R1Mh+sRn", mcf5307 | mcf5206e },
+{"macl",  two(0120240, 0005000), two(0170670, 0005460), "R3R1Mh-sRn", mcf5307 | mcf5206e },
+{"macl",  two(0120250, 0005000), two(0170670, 0005460), "R3R1MhdsRn", mcf5307 | mcf5206e },
+{"macml", two(0120220, 0004040), two(0170670, 0005460), "R3R1asRn", mcf5307 | mcf5206e },
+{"macml", two(0120230, 0004040), two(0170670, 0005460), "R3R1+sRn", mcf5307 | mcf5206e },
+{"macml", two(0120240, 0004040), two(0170670, 0005460), "R3R1-sRn", mcf5307 | mcf5206e },
+{"macml", two(0120250, 0004040), two(0170670, 0005460), "R3R1dsRn", mcf5307 | mcf5206e },
+{"macml", two(0120220, 0005040), two(0170670, 0005460), "R3R1MhasRn", mcf5307 | mcf5206e },
+{"macml", two(0120230, 0005040), two(0170670, 0005460), "R3R1Mh+sRn", mcf5307 | mcf5206e },
+{"macml", two(0120240, 0005040), two(0170670, 0005460), "R3R1Mh-sRn", mcf5307 | mcf5206e },
+{"macml", two(0120250, 0005040), two(0170670, 0005460), "R3R1MhdsRn", mcf5307 | mcf5206e },
 
 /* NOTE: The mcf5200 family programmer's reference manual does not 
    indicate the byte form of the movea instruction is invalid (as it
@@ -1254,11 +1297,11 @@
 	jtc@cygnus.com - 97/01/24
  */
 
-{"moveal",	one(0020100),	one(0170700), "*lAd", m68000up | mcf5200 },
-{"moveaw",	one(0030100),	one(0170700), "*wAd", m68000up | mcf5200 },
+{"moveal",	one(0020100),	one(0170700), "*lAd", m68000up | mcf },
+{"moveaw",	one(0030100),	one(0170700), "*wAd", m68000up | mcf },
 
-{"movec",	one(0047173),	one(0177777), "R1Jj", m68010up | mcf5200 },
-{"movec",	one(0047173),	one(0177777), "R1#j", m68010up | mcf5200 },
+{"movec",	one(0047173),	one(0177777), "R1Jj", m68010up | mcf },
+{"movec",	one(0047173),	one(0177777), "R1#j", m68010up | mcf },
 {"movec",	one(0047172),	one(0177777), "JjR1", m68010up },
 {"movec",	one(0047172),	one(0177777), "#jR1", m68010up },
 
@@ -1273,66 +1316,76 @@
 {"moveml",	one(0046300),	one(0177700), "<sLw", m68000up },
 {"moveml",	one(0046300),	one(0177700), "<s#w", m68000up },
 /* FIXME: need specifier for mode 2 and 5 to simplify below insn patterns */
-{"moveml",	one(0044320),	one(0177770), "Lwas", mcf5200 },
-{"moveml",	one(0044320),	one(0177770), "#was", mcf5200 },
-{"moveml",	one(0044350),	one(0177770), "Lwds", mcf5200 },
-{"moveml",	one(0044350),	one(0177770), "#wds", mcf5200 },
-{"moveml",	one(0046320),	one(0177770), "asLw", mcf5200 },
-{"moveml",	one(0046320),	one(0177770), "as#w", mcf5200 },
-{"moveml",	one(0046350),	one(0177770), "dsLw", mcf5200 },
-{"moveml",	one(0046350),	one(0177770), "ds#w", mcf5200 },
+{"moveml",	one(0044320),	one(0177770), "Lwas", mcf },
+{"moveml",	one(0044320),	one(0177770), "#was", mcf },
+{"moveml",	one(0044350),	one(0177770), "Lwds", mcf },
+{"moveml",	one(0044350),	one(0177770), "#wds", mcf },
+{"moveml",	one(0046320),	one(0177770), "asLw", mcf },
+{"moveml",	one(0046320),	one(0177770), "as#w", mcf },
+{"moveml",	one(0046350),	one(0177770), "dsLw", mcf },
+{"moveml",	one(0046350),	one(0177770), "ds#w", mcf },
 
 {"movepw",	one(0000410),	one(0170770), "dsDd", m68000up },
 {"movepw",	one(0000610),	one(0170770), "Ddds", m68000up },
 {"movepl",	one(0000510),	one(0170770), "dsDd", m68000up },
 {"movepl",	one(0000710),	one(0170770), "Ddds", m68000up },
 
-{"moveq",	one(0070000),	one(0170400), "MsDd", m68000up | mcf5200 },
-{"moveq",	one(0070000),	one(0170400), "#BDd", m68000up | mcf5200 },
+{"moveq",	one(0070000),	one(0170400), "MsDd", m68000up | mcf },
+{"moveq",	one(0070000),	one(0170400), "#BDd", m68000up | mcf },
 
 /* The move opcode can generate the movea and moveq instructions.  */
 {"moveb",	one(0010000),	one(0170000), ";b$d", m68000up },
-{"moveb",	one(0010000),	one(0170000), "ms%d", mcf5200 },
-{"moveb",	one(0010000),	one(0170000), "nspd", mcf5200 },
-{"moveb",	one(0010000),	one(0170000), "obmd", mcf5200 },
+{"moveb",	one(0010000),	one(0170000), "ms%d", mcf },
+{"moveb",	one(0010000),	one(0170000), "nspd", mcf },
+{"moveb",	one(0010000),	one(0170000), "obmd", mcf },
 
 {"movew",	one(0030000),	one(0170000), "*w%d", m68000up },
-{"movew",	one(0030000),	one(0170000), "ms%d", mcf5200 },
-{"movew",	one(0030000),	one(0170000), "nspd", mcf5200 },
-{"movew",	one(0030000),	one(0170000), "owmd", mcf5200 },
+{"movew",	one(0030000),	one(0170000), "ms%d", mcf },
+{"movew",	one(0030000),	one(0170000), "nspd", mcf },
+{"movew",	one(0030000),	one(0170000), "owmd", mcf },
 {"movew",	one(0040300),	one(0177700), "Ss$s", m68000up },
-{"movew",	one(0040300),	one(0177770), "SsDs", mcf5200 },
+{"movew",	one(0040300),	one(0177770), "SsDs", mcf },
 {"movew",	one(0041300),	one(0177700), "Cs$s", m68010up },
-{"movew",	one(0041300),	one(0177770), "CsDs", mcf5200 },
+{"movew",	one(0041300),	one(0177770), "CsDs", mcf },
 {"movew",	one(0042300),	one(0177700), ";wCd", m68000up },
-{"movew",	one(0042300),	one(0177700), "DsCd", mcf5200 },
-{"movew",	one(0042374),	one(0177777), "#wCd", mcf5200 },
+{"movew",	one(0042300),	one(0177700), "DsCd", mcf },
+{"movew",	one(0042374),	one(0177777), "#wCd", mcf },
 {"movew",	one(0043300),	one(0177700), ";wSd", m68000up },
-{"movew",	one(0043300),	one(0177700), "DsSd", mcf5200 },
-{"movew",	one(0043374),	one(0177777), "#wSd", mcf5200 },
+{"movew",	one(0043300),	one(0177700), "DsSd", mcf },
+{"movew",	one(0043374),	one(0177777), "#wSd", mcf },
 
-{"movel",	one(0070000),	one(0170400), "MsDd", m68000up | mcf5200 },
+{"movel",	one(0070000),	one(0170400), "MsDd", m68000up | mcf },
 {"movel",	one(0020000),	one(0170000), "*l%d", m68000up },
-{"movel",	one(0020000),	one(0170000), "ms%d", mcf5200 },
-{"movel",	one(0020000),	one(0170000), "nspd", mcf5200 },
-{"movel",	one(0020000),	one(0170000), "olmd", mcf5200 },
+{"movel",	one(0020000),	one(0170000), "ms%d", mcf },
+{"movel",	one(0020000),	one(0170000), "nspd", mcf },
+{"movel",	one(0020000),	one(0170000), "olmd", mcf },
 {"movel",	one(0047140),	one(0177770), "AsUd", m68000up },
 {"movel",	one(0047150),	one(0177770), "UdAs", m68000up },
+{"movel",	one(0120600),	one(0177760), "EsRs", mcf5307 | mcf5206e },
+{"movel",	one(0120400),	one(0177760), "RsEs", mcf5307 | mcf5206e },
+{"movel",	one(0120474),	one(0177777), "#lEs", mcf5307 | mcf5206e },
+{"movel",	one(0124600),	one(0177760), "GsRs", mcf5307 | mcf5206e },
+{"movel",	one(0124400),	one(0177760), "RsGs", mcf5307 | mcf5206e },
+{"movel",	one(0124474),	one(0177777), "#lGs", mcf5307 | mcf5206e },
+{"movel",	one(0126600),	one(0177760), "HsRs", mcf5307 | mcf5206e },
+{"movel",	one(0126400),	one(0177760), "RsHs", mcf5307 | mcf5206e },
+{"movel",	one(0126474),	one(0177777), "#lHs", mcf5307 | mcf5206e },
+{"movel",	one(0124700),	one(0177777), "GsCs", mcf5307 | mcf5206e },
 
 {"move",	one(0030000),	one(0170000), "*w%d", m68000up },
-{"move",	one(0030000),	one(0170000), "ms%d", mcf5200 },
-{"move",	one(0030000),	one(0170000), "nspd", mcf5200 },
-{"move",	one(0030000),	one(0170000), "owmd", mcf5200 },
+{"move",	one(0030000),	one(0170000), "ms%d", mcf },
+{"move",	one(0030000),	one(0170000), "nspd", mcf },
+{"move",	one(0030000),	one(0170000), "owmd", mcf },
 {"move",	one(0040300),	one(0177700), "Ss$s", m68000up },
-{"move",	one(0040300),	one(0177770), "SsDs", mcf5200 },
+{"move",	one(0040300),	one(0177770), "SsDs", mcf },
 {"move",	one(0041300),	one(0177700), "Cs$s", m68010up },
-{"move",	one(0041300),	one(0177770), "CsDs", mcf5200 },
+{"move",	one(0041300),	one(0177770), "CsDs", mcf },
 {"move",	one(0042300),	one(0177700), ";wCd", m68000up },
-{"move",	one(0042300),	one(0177700), "DsCd", mcf5200 },
-{"move",	one(0042374),	one(0177777), "#wCd", mcf5200 },
+{"move",	one(0042300),	one(0177700), "DsCd", mcf },
+{"move",	one(0042374),	one(0177777), "#wCd", mcf },
 {"move",	one(0043300),	one(0177700), ";wSd", m68000up },
-{"move",	one(0043300),	one(0177700), "DsSd", mcf5200 },
-{"move",	one(0043374),	one(0177777), "#wSd", mcf5200 },
+{"move",	one(0043300),	one(0177700), "DsSd", mcf },
+{"move",	one(0043374),	one(0177777), "#wSd", mcf },
 
 {"move",	one(0047140),	one(0177770), "AsUd", m68000up },
 {"move",	one(0047150),	one(0177770), "UdAs", m68000up },
@@ -1350,14 +1403,53 @@
 {"move16",	one(0xf610),		one(0xfff8), "as_L", m68040up },
 {"move16",	one(0xf618),		one(0xfff8), "_Las", m68040up },
 
-{"mulsw",	one(0140700),		one(0170700), ";wDd", m68000up|mcf5200 },
+  /* FIXME: add MAM mode (`&' after <ea> operand) / remove MSACM */
+{"msacw",  two(0120000, 0000400), two(0170660, 0005400), "uMum", mcf5307 | mcf5206e },
+{"msacw",  two(0120000, 0001400), two(0170660, 0005400), "uMumMh", mcf5307 | mcf5206e },
+{"msacw",  two(0120220, 0000400), two(0170670, 0005460), "uNuoasRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120230, 0000400), two(0170670, 0005460), "uNuo+sRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120240, 0000400), two(0170670, 0005460), "uNuo-sRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120250, 0000400), two(0170670, 0005460), "uNuodsRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120220, 0001400), two(0170670, 0005460), "uNuoMhasRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120230, 0001400), two(0170670, 0005460), "uNuoMh+sRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120240, 0001400), two(0170670, 0005460), "uNuoMh-sRn", mcf5307 | mcf5206e },
+{"msacw",  two(0120250, 0001400), two(0170670, 0005460), "uNuoMhdsRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120220, 0000440), two(0170670, 0005460), "uNuoasRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120230, 0000440), two(0170670, 0005460), "uNuo+sRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120240, 0000440), two(0170670, 0005460), "uNuo-sRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120250, 0000440), two(0170670, 0005460), "uNuodsRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120220, 0001440), two(0170670, 0005460), "uNuoMhasRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120230, 0001440), two(0170670, 0005460), "uNuoMh+sRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120240, 0001440), two(0170670, 0005460), "uNuoMh-sRn", mcf5307 | mcf5206e },
+{"msacmw", two(0120250, 0001440), two(0170670, 0005460), "uNuoMhdsRn", mcf5307 | mcf5206e },
+
+{"msacl",  two(0120000, 0004400), two(0170660, 0005400), "RsRm", mcf5307 | mcf5206e },
+{"msacl",  two(0120000, 0005400), two(0170660, 0005400), "RsRmMh", mcf5307 | mcf5206e },
+{"msacl",  two(0120220, 0004400), two(0170670, 0005460), "R3R1asRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120230, 0004400), two(0170670, 0005460), "R3R1+sRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120240, 0004400), two(0170670, 0005460), "R3R1-sRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120250, 0004400), two(0170670, 0005460), "R3R1dsRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120220, 0005400), two(0170670, 0005460), "R3R1MhasRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120230, 0005400), two(0170670, 0005460), "R3R1Mh+sRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120240, 0005400), two(0170670, 0005460), "R3R1Mh-sRn", mcf5307 | mcf5206e },
+{"msacl",  two(0120250, 0005400), two(0170670, 0005460), "R3R1MhdsRn", mcf5307 | mcf5206e },
+{"msacml", two(0120220, 0004440), two(0170670, 0005460), "R3R1asRn", mcf5307 | mcf5206e },
+{"msacml", two(0120230, 0004440), two(0170670, 0005460), "R3R1+sRn", mcf5307 | mcf5206e },
+{"msacml", two(0120240, 0004440), two(0170670, 0005460), "R3R1-sRn", mcf5307 | mcf5206e },
+{"msacml", two(0120250, 0004440), two(0170670, 0005460), "R3R1dsRn", mcf5307 | mcf5206e },
+{"msacml", two(0120220, 0005440), two(0170670, 0005460), "R3R1MhasRn", mcf5307 | mcf5206e },
+{"msacml", two(0120230, 0005440), two(0170670, 0005460), "R3R1Mh+sRn", mcf5307 | mcf5206e },
+{"msacml", two(0120240, 0005440), two(0170670, 0005460), "R3R1Mh-sRn", mcf5307 | mcf5206e },
+{"msacml", two(0120250, 0005440), two(0170670, 0005460), "R3R1MhdsRn", mcf5307 | mcf5206e },
+
+{"mulsw",	one(0140700),		one(0170700), ";wDd", m68000up|mcf },
 {"mulsl",	two(0046000,004000), two(0177700,0107770), ";lD1", m68020up|cpu32 },
-{"mulsl",	two(0046000,004000), two(0177700,0107770), "qsD1", mcf5200 },
+{"mulsl",	two(0046000,004000), two(0177700,0107770), "qsD1", mcf },
 {"mulsl",	two(0046000,006000), two(0177700,0107770), ";lD3D1",m68020up|cpu32 },
 
-{"muluw",	one(0140300),		one(0170700), ";wDd", m68000up|mcf5200 },
+{"muluw",	one(0140300),		one(0170700), ";wDd", m68000up|mcf },
 {"mulul",	two(0046000,000000), two(0177700,0107770), ";lD1", m68020up|cpu32 },
-{"mulul",	two(0046000,000000), two(0177700,0107770), "qsD1", mcf5200 },
+{"mulul",	two(0046000,000000), two(0177700,0107770), "qsD1", mcf },
 {"mulul",	two(0046000,002000), two(0177700,0107770), ";lD3D1",m68020up|cpu32 },
 
 {"nbcd",	one(0044000),	one(0177700), "$s", m68000up },
@@ -1365,26 +1457,26 @@
 {"negb",	one(0042000),	one(0177700), "$s", m68000up },
 {"negw",	one(0042100),	one(0177700), "$s", m68000up },
 {"negl",	one(0042200),	one(0177700), "$s", m68000up },
-{"negl",	one(0042200),	one(0177700), "Ds", mcf5200},
+{"negl",	one(0042200),	one(0177700), "Ds", mcf},
 
 {"negxb",	one(0040000),	one(0177700), "$s", m68000up },
 {"negxw",	one(0040100),	one(0177700), "$s", m68000up },
 {"negxl",	one(0040200),	one(0177700), "$s", m68000up },
-{"negxl",	one(0040200),	one(0177700), "Ds", mcf5200},
+{"negxl",	one(0040200),	one(0177700), "Ds", mcf},
 
-{"nop",		one(0047161),	one(0177777), "", m68000up | mcf5200},
+{"nop",		one(0047161),	one(0177777), "", m68000up | mcf},
 
 {"notb",	one(0043000),	one(0177700), "$s", m68000up },
 {"notw",	one(0043100),	one(0177700), "$s", m68000up },
 {"notl",	one(0043200),	one(0177700), "$s", m68000up },
-{"notl",	one(0043200),	one(0177700), "Ds", mcf5200},
+{"notl",	one(0043200),	one(0177700), "Ds", mcf},
 
 {"orib",	one(0000000),	one(0177700), "#b$s", m68000up },
 {"orib",	one(0000074),	one(0177777), "#bCs", m68000up },
 {"oriw",	one(0000100),	one(0177700), "#w$s", m68000up },
 {"oriw",	one(0000174),	one(0177777), "#wSs", m68000up },
 {"oril",	one(0000200),	one(0177700), "#l$s", m68000up },
-{"oril",	one(0000200),	one(0177700), "#lDs", mcf5200 },
+{"oril",	one(0000200),	one(0177700), "#lDs", mcf },
 {"ori",		one(0000074),	one(0177777), "#bCs", m68000up },
 {"ori",		one(0000100),	one(0177700), "#w$s", m68000up },
 {"ori",		one(0000174),	one(0177777), "#wSs", m68000up },
@@ -1399,9 +1491,9 @@
 {"orw",		one(0100100),	one(0170700), ";wDd", m68000up },
 {"orw",		one(0100500),	one(0170700), "Dd~s", m68000up },
 {"orl",		one(0000200),	one(0177700), "#l$s", m68000up },
-{"orl",		one(0000200),	one(0177700), "#lDs", mcf5200 },
-{"orl",		one(0100200),	one(0170700), ";lDd", m68000up | mcf5200 },
-{"orl",		one(0100600),	one(0170700), "Dd~s", m68000up | mcf5200 },
+{"orl",		one(0000200),	one(0177700), "#lDs", mcf },
+{"orl",		one(0100200),	one(0170700), ";lDd", m68000up | mcf },
+{"orl",		one(0100600),	one(0170700), "Dd~s", m68000up | mcf },
 {"or",		one(0000074),	one(0177777), "#bCs", m68000up },
 {"or",		one(0000100),	one(0177700), "#w$s", m68000up },
 {"or",		one(0000174),	one(0177777), "#wSs", m68000up },
@@ -1461,7 +1553,7 @@
 {"pdbwc",	two(0xf048, 0x0009),	two(0xfff8, 0xffff), "DsBw", m68851 },
 {"pdbws",	two(0xf048, 0x0008),	two(0xfff8, 0xffff), "DsBw", m68851 },
 
-{"pea",		one(0044100),		one(0177700), "!s", m68000up|mcf5200 },
+{"pea",		one(0044100),		one(0177700), "!s", m68000up|mcf },
 
 {"pflusha",	one(0xf518),		one(0xfff8), "", m68040up },
 {"pflusha",	two(0xf000,0x2400), two(0xffff,0xffff), "", m68030 | m68851 },
@@ -1619,11 +1711,14 @@
 {"ptrapwsl",	two(0xf07b, 0x0008),	two(0xffff, 0xffff), "#l", m68851 },
 {"ptrapws",	two(0xf07c, 0x0008),	two(0xffff, 0xffff), "",   m68851 },
 
-{"pulse",	one(0045314),		one(0177777), "", m68060 | mcf5200 },
+{"pulse",	one(0045314),		one(0177777), "", m68060 | mcf },
 
 {"pvalid",	two(0xf000, 0x2800),	two(0xffc0, 0xffff), "Vs&s", m68851 },
 {"pvalid",	two(0xf000, 0x2c00),	two(0xffc0, 0xfff8), "A3&s", m68851 },
 
+  /* FIXME: don't allow Dw==Dx. */
+{"remsl",       two(0x4c40, 0x0800),    two(0xffc0, 0x8ff8), "vsD3D1", mcf5307 | mcf5206e },
+{"remul",       two(0x4c40, 0x0000),    two(0xffc0, 0x8ff8), "vsD3D1", mcf5307 | mcf5206e },
 
 {"reset",	one(0047160),		one(0177777), "", m68000up },
 
@@ -1661,64 +1756,64 @@
 
 {"rtd",		one(0047164),		one(0177777), "#w", m68010up },
 
-{"rte",		one(0047163),		one(0177777), "",   m68000up|mcf5200 },
+{"rte",		one(0047163),		one(0177777), "",   m68000up|mcf },
 
 {"rtm",		one(0003300),		one(0177760), "Rs", m68020 },
 
 {"rtr",		one(0047167),		one(0177777), "",   m68000up },
 
-{"rts",		one(0047165),		one(0177777), "",   m68000up|mcf5200 },
+{"rts",		one(0047165),		one(0177777), "",   m68000up|mcf },
 
 {"sbcd",	one(0100400),		one(0170770), "DsDd", m68000up },
 {"sbcd",	one(0100410),		one(0170770), "-s-d", m68000up },
 
 
 {"scc",		one(0052300),	one(0177700), "$s", m68000up },
-{"scc",		one(0052300),	one(0177700), "Ds", mcf5200 },
+{"scc",		one(0052300),	one(0177700), "Ds", mcf },
 {"scs",		one(0052700),	one(0177700), "$s", m68000up },
-{"scs",		one(0052700),	one(0177700), "Ds", mcf5200 },
+{"scs",		one(0052700),	one(0177700), "Ds", mcf },
 {"seq",		one(0053700),	one(0177700), "$s", m68000up },
-{"seq",		one(0053700),	one(0177700), "Ds", mcf5200 },
+{"seq",		one(0053700),	one(0177700), "Ds", mcf },
 {"sf",		one(0050700),	one(0177700), "$s", m68000up },
-{"sf",		one(0050700),	one(0177700), "Ds", mcf5200 },
+{"sf",		one(0050700),	one(0177700), "Ds", mcf },
 {"sge",		one(0056300),	one(0177700), "$s", m68000up },
-{"sge",		one(0056300),	one(0177700), "Ds", mcf5200 },
+{"sge",		one(0056300),	one(0177700), "Ds", mcf },
 {"sgt",		one(0057300),	one(0177700), "$s", m68000up },
-{"sgt",		one(0057300),	one(0177700), "Ds", mcf5200 },
+{"sgt",		one(0057300),	one(0177700), "Ds", mcf },
 {"shi",		one(0051300),	one(0177700), "$s", m68000up },
-{"shi",		one(0051300),	one(0177700), "Ds", mcf5200 },
+{"shi",		one(0051300),	one(0177700), "Ds", mcf },
 {"sle",		one(0057700),	one(0177700), "$s", m68000up },
-{"sle",		one(0057700),	one(0177700), "Ds", mcf5200 },
+{"sle",		one(0057700),	one(0177700), "Ds", mcf },
 {"sls",		one(0051700),	one(0177700), "$s", m68000up },
-{"sls",		one(0051700),	one(0177700), "Ds", mcf5200 },
+{"sls",		one(0051700),	one(0177700), "Ds", mcf },
 {"slt",		one(0056700),	one(0177700), "$s", m68000up },
-{"slt",		one(0056700),	one(0177700), "Ds", mcf5200 },
+{"slt",		one(0056700),	one(0177700), "Ds", mcf },
 {"smi",		one(0055700),	one(0177700), "$s", m68000up },
-{"smi",		one(0055700),	one(0177700), "Ds", mcf5200 },
+{"smi",		one(0055700),	one(0177700), "Ds", mcf },
 {"sne",		one(0053300),	one(0177700), "$s", m68000up },
-{"sne",		one(0053300),	one(0177700), "Ds", mcf5200 },
+{"sne",		one(0053300),	one(0177700), "Ds", mcf },
 {"spl",		one(0055300),	one(0177700), "$s", m68000up },
-{"spl",		one(0055300),	one(0177700), "Ds", mcf5200 },
+{"spl",		one(0055300),	one(0177700), "Ds", mcf },
 {"st",		one(0050300),	one(0177700), "$s", m68000up },
-{"st",		one(0050300),	one(0177700), "Ds", mcf5200 },
+{"st",		one(0050300),	one(0177700), "Ds", mcf },
 {"svc",		one(0054300),	one(0177700), "$s", m68000up },
-{"svc",		one(0054300),	one(0177700), "Ds", mcf5200 },
+{"svc",		one(0054300),	one(0177700), "Ds", mcf },
 {"svs",		one(0054700),	one(0177700), "$s", m68000up },
-{"svs",		one(0054700),	one(0177700), "Ds", mcf5200 },
+{"svs",		one(0054700),	one(0177700), "Ds", mcf },
 
-{"stop",	one(0047162),	one(0177777), "#w", m68000up | mcf5200 },
+{"stop",	one(0047162),	one(0177777), "#w", m68000up | mcf },
 
-{"subal",	one(0110700),	one(0170700), "*lAd", m68000up | mcf5200 },
+{"subal",	one(0110700),	one(0170700), "*lAd", m68000up | mcf },
 {"subaw",	one(0110300),	one(0170700), "*wAd", m68000up },
 
 {"subib",	one(0002000),	one(0177700), "#b$s", m68000up },
 {"subiw",	one(0002100),	one(0177700), "#w$s", m68000up },
 {"subil",	one(0002200),	one(0177700), "#l$s", m68000up },
-{"subil",	one(0002200),	one(0177700), "#lDs", mcf5200 },
+{"subil",	one(0002200),	one(0177700), "#lDs", mcf },
 
 {"subqb",	one(0050400),	one(0170700), "Qd%s", m68000up },
 {"subqw",	one(0050500),	one(0170700), "Qd%s", m68000up },
-{"subql",	one(0050600),	one(0170700), "Qd%s", m68000up | mcf5200 },
+{"subql",	one(0050600),	one(0170700), "Qd%s", m68000up | mcf },
 
 /* The sub opcode can generate the suba, subi, and subq instructions.  */
 {"subb",	one(0050400),	one(0170700), "Qd%s", m68000up },
@@ -1730,21 +1825,21 @@
 {"subw",	one(0110300),	one(0170700), "*wAd", m68000up },
 {"subw",	one(0110100),	one(0170700), "*wDd", m68000up },
 {"subw",	one(0110500),	one(0170700), "Dd~s", m68000up },
-{"subl",	one(0050600),	one(0170700), "Qd%s", m68000up | mcf5200 },
+{"subl",	one(0050600),	one(0170700), "Qd%s", m68000up | mcf },
 {"subl",	one(0002200),	one(0177700), "#l$s", m68000up },
-{"subl",	one(0002200),	one(0177700), "#lDs", mcf5200 },
-{"subl",	one(0110700),	one(0170700), "*lAd", m68000up | mcf5200 },
-{"subl",	one(0110200),	one(0170700), "*lDd", m68000up | mcf5200 },
-{"subl",	one(0110600),	one(0170700), "Dd~s", m68000up | mcf5200 },
+{"subl",	one(0002200),	one(0177700), "#lDs", mcf },
+{"subl",	one(0110700),	one(0170700), "*lAd", m68000up | mcf },
+{"subl",	one(0110200),	one(0170700), "*lDd", m68000up | mcf },
+{"subl",	one(0110600),	one(0170700), "Dd~s", m68000up | mcf },
 
 {"subxb",	one(0110400),	one(0170770), "DsDd", m68000up },
 {"subxb",	one(0110410),	one(0170770), "-s-d", m68000up },
 {"subxw",	one(0110500),	one(0170770), "DsDd", m68000up },
 {"subxw",	one(0110510),	one(0170770), "-s-d", m68000up },
-{"subxl",	one(0110600),	one(0170770), "DsDd", m68000up | mcf5200 },
+{"subxl",	one(0110600),	one(0170770), "DsDd", m68000up | mcf },
 {"subxl",	one(0110610),	one(0170770), "-s-d", m68000up },
 
-{"swap",	one(0044100),	one(0177770), "Ds", m68000up | mcf5200 },
+{"swap",	one(0044100),	one(0177770), "Ds", m68000up | mcf },
 
 /* swbeg and swbegl are magic constants used on sysV68.  The compiler
    generates them before a switch table.  They tell the debugger and
@@ -1752,8 +1847,8 @@
    number of elements in the table.  swbeg means that the entries in
    the table are word (2 byte) sized, and swbegl means that the
    entries in the table are longword (4 byte) sized.  */
-{"swbeg",	one(0045374),	one(0177777), "#w",   m68000up | mcf5200 },
-{"swbegl",	one(0045375),	one(0177777), "#l",   m68000up | mcf5200 },
+{"swbeg",	one(0045374),	one(0177777), "#w",   m68000up | mcf },
+{"swbegl",	one(0045375),	one(0177777), "#l",   m68000up | mcf },
 
 {"tas",		one(0045300),		one(0177700), "$s", m68000up },
 
@@ -1769,12 +1864,12 @@
 TBL("tblub", "tbluw", "tblul", 0, 1),
 TBL("tblunb", "tblunw", "tblunl", 0, 0),
 
-{"trap",	one(0047100),	one(0177760), "Ts", m68000up | mcf5200 },
+{"trap",	one(0047100),	one(0177760), "Ts", m68000up | mcf },
 
 {"trapcc",	one(0052374),	one(0177777), "", m68020up | cpu32 },
 {"trapcs",	one(0052774),	one(0177777), "", m68020up | cpu32 },
 {"trapeq",	one(0053774),	one(0177777), "", m68020up | cpu32 },
-{"trapf",	one(0050774),	one(0177777), "", m68020up | cpu32 | mcf5200 },
+{"trapf",	one(0050774),	one(0177777), "", m68020up | cpu32 | mcf },
 {"trapge",	one(0056374),	one(0177777), "", m68020up | cpu32 },
 {"trapgt",	one(0057374),	one(0177777), "", m68020up | cpu32 },
 {"traphi",	one(0051374),	one(0177777), "", m68020up | cpu32 },
@@ -1791,7 +1886,7 @@
 {"trapccw",	one(0052372),	one(0177777), "#w", m68020up|cpu32 },
 {"trapcsw",	one(0052772),	one(0177777), "#w", m68020up|cpu32 },
 {"trapeqw",	one(0053772),	one(0177777), "#w", m68020up|cpu32 },
-{"trapfw",	one(0050772),	one(0177777), "#w", m68020up|cpu32|mcf5200},
+{"trapfw",	one(0050772),	one(0177777), "#w", m68020up|cpu32|mcf},
 {"trapgew",	one(0056372),	one(0177777), "#w", m68020up|cpu32 },
 {"trapgtw",	one(0057372),	one(0177777), "#w", m68020up|cpu32 },
 {"traphiw",	one(0051372),	one(0177777), "#w", m68020up|cpu32 },
@@ -1808,7 +1903,7 @@
 {"trapccl",	one(0052373),	one(0177777), "#l", m68020up|cpu32 },
 {"trapcsl",	one(0052773),	one(0177777), "#l", m68020up|cpu32 },
 {"trapeql",	one(0053773),	one(0177777), "#l", m68020up|cpu32 },
-{"trapfl",	one(0050773),	one(0177777), "#l", m68020up|cpu32|mcf5200},
+{"trapfl",	one(0050773),	one(0177777), "#l", m68020up|cpu32|mcf},
 {"trapgel",	one(0056373),	one(0177777), "#l", m68020up|cpu32 },
 {"trapgtl",	one(0057373),	one(0177777), "#l", m68020up|cpu32 },
 {"traphil",	one(0051373),	one(0177777), "#l", m68020up|cpu32 },
@@ -1824,21 +1919,21 @@
 
 {"trapv",	one(0047166),	one(0177777), "", m68000up },
 
-{"tstb",	one(0045000),	one(0177700), ";b", m68020up|cpu32|mcf5200 },
+{"tstb",	one(0045000),	one(0177700), ";b", m68020up|cpu32|mcf },
 {"tstb",	one(0045000),	one(0177700), "$b", m68000up },
-{"tstw",	one(0045100),	one(0177700), "*w", m68020up|cpu32|mcf5200 },
+{"tstw",	one(0045100),	one(0177700), "*w", m68020up|cpu32|mcf },
 {"tstw",	one(0045100),	one(0177700), "$w", m68000up },
-{"tstl",	one(0045200),	one(0177700), "*l", m68020up|cpu32|mcf5200 },
+{"tstl",	one(0045200),	one(0177700), "*l", m68020up|cpu32|mcf },
 {"tstl",	one(0045200),	one(0177700), "$l", m68000up },
 
-{"unlk",	one(0047130),	one(0177770), "As", m68000up | mcf5200 },
+{"unlk",	one(0047130),	one(0177770), "As", m68000up | mcf },
 
 {"unpk",	one(0100600),	one(0170770), "DsDd#w", m68020up },
 {"unpk",	one(0100610),	one(0170770), "-s-d#w", m68020up },
 
-{"wddatab",	one(0172000),   one(0177700), "~s", mcf5200 },
-{"wddataw",	one(0172100),   one(0177700), "~s", mcf5200 },
-{"wddatal",	one(0172200),   one(0177700), "~s", mcf5200 },
+{"wddatab",	one(0172000),   one(0177700), "~s", mcf },
+{"wddataw",	one(0172100),   one(0177700), "~s", mcf },
+{"wddatal",	one(0172200),   one(0177700), "~s", mcf },
 
 };
 
@@ -1973,6 +2068,7 @@
   { "leal",	"lea", },
   { "lsl",	"lslw", },
   { "lsr",	"lsrw", },
+  { "mac",	"macw" },
   { "movea",	"moveaw", },
   { "movem",	"movemw", },
   { "movml",	"moveml", },
@@ -1983,6 +2079,7 @@
   { "moves",	"movesw" },
   { "muls",	"mulsw", },
   { "mulu",	"muluw", },
+  { "msac",	"msacw" },
   { "nbcdb",	"nbcd" },
   { "neg",	"negw", },
   { "negx",	"negxw", },
diff --git a/opcodes/mcore-dis.c b/opcodes/mcore-dis.c
index 42c1793b..096cec9 100644
--- a/opcodes/mcore-dis.c
+++ b/opcodes/mcore-dis.c
@@ -1,5 +1,5 @@
-/* Disassemble Motorolla M*Core instructions.
-   Copyright (C) 1993, 1999 Free Software Foundation, Inc.
+/* Disassemble Motorola M*Core instructions.
+   Copyright (C) 1993, 1999, 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
@@ -13,7 +13,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.  */
 
 #include <stdio.h>
 #define STATIC_TABLE
@@ -57,6 +57,8 @@
     /* OMc */ 0xFF00,
     /* SIa */ 0xFE00,
 
+  /* MULSH */ 0xFF00,    
+  /* OPSR  */ 0xFFF8,   /* psrset/psrclr */
 		 
     /* JC  */ 0,		/* JC,JU,JL don't appear in object */
     /* JU  */ 0,
@@ -96,6 +98,8 @@
   mcore_opcode_info * op;
   int                 status;
 
+  info->bytes_per_chunk = 2;
+
   status = info->read_memory_func (memaddr, ibytes, 2, info);
 
   if (status != 0) 
@@ -104,17 +108,20 @@
       return -1;
     }
 
-  inst = (ibytes[0] << 8) | ibytes[1];
+  if (info->endian == BFD_ENDIAN_BIG)
+    inst = (ibytes[0] << 8) | ibytes[1];
+  else if (info->endian == BFD_ENDIAN_LITTLE)
+    inst = (ibytes[1] << 8) | ibytes[0];
+  else
+    abort ();
 
   /* Just a linear search of the table.  */
   for (op = mcore_table; op->name != 0; op ++)
-    {
-      if (op->inst == (inst & imsk[op->opclass]))
-	break;
-    }
+    if (op->inst == (inst & imsk[op->opclass]))
+      break;
 
   if (op->name == 0)
-    fprintf (stream, ".word 0x%04x", inst);
+    fprintf (stream, ".short 0x%04x", inst);
   else
     {
       const char * name = grname[inst & 0x0F];
@@ -130,6 +137,7 @@
 	case JSR: fprintf (stream, "\t%s", name); break;
 	case OC:  fprintf (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]); break;
 	case O1R1: fprintf (stream, "\t%s, r1", name); break;
+	case MULSH:
 	case O2: fprintf (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]); break;
 	case X1: fprintf (stream, "\tr1, %s", name); break;
 	case OI: fprintf (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1); break;
@@ -191,11 +199,15 @@
 	    if (status != 0) 
 	      {
 		info->memory_error_func (status, memaddr, info);
-		return -1;
+		break;
 	      }
 	    
-	    val = (ibytes[0] << 24) | (ibytes[1] << 16)
-	      | (ibytes[2] << 8) | (ibytes[3]);
+	    if (info->endian == BFD_ENDIAN_LITTLE)
+	      val = (ibytes[3] << 24) | (ibytes[2] << 16)
+		| (ibytes[1] << 8) | (ibytes[0]);
+	    else
+	      val = (ibytes[0] << 24) | (ibytes[1] << 16)
+		| (ibytes[2] << 8) | (ibytes[3]);
 	    
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
 	    fprintf (stream, "\t%s, 0x%X", grname[(inst >> 8) & 0xF], val);
@@ -216,11 +228,15 @@
 	    if (status != 0) 
 	      {
 		info->memory_error_func (status, memaddr, info);
-		return -1;
+		break;
 	      }
-	    
-	    val = (ibytes[0] << 24) | (ibytes[1] << 16)
-	      | (ibytes[2] << 8) | (ibytes[3]);
+
+	    if (info->endian == BFD_ENDIAN_LITTLE)
+	      val = (ibytes[3] << 24) | (ibytes[2] << 16)
+		| (ibytes[1] << 8) | (ibytes[0]);
+	    else
+	      val = (ibytes[0] << 24) | (ibytes[1] << 16)
+		| (ibytes[2] << 8) | (ibytes[3]);
 	    
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
 	    fprintf (stream, "\t0x%X", val);
@@ -238,6 +254,18 @@
 	  }
 	  break;
 	  
+	case OPSR:
+	  {
+	    static char * fields[] = 
+	    {
+	      "af", "ie",    "fe",    "fe,ie", 
+	      "ee", "ee,ie", "ee,fe", "ee,fe,ie"
+	    };
+	    
+	    fprintf (stream, "\t%s", fields[inst & 0x7]);
+	  }
+	  break;
+	  
 	default:
 	  /* if the disassembler lags the instruction set */
 	  fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst);
diff --git a/opcodes/mcore-opc.h b/opcodes/mcore-opc.h
index 606ba84..6ff05ee 100644
--- a/opcodes/mcore-opc.h
+++ b/opcodes/mcore-opc.h
@@ -1,5 +1,5 @@
-/* Assembler instructions for Motorolla's Mcore processor
-   Copyright (C) 1999 Free Software Foundation, Inc.
+/* Assembler instructions for Motorola's Mcore processor
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
    
 This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
   OMa,   SI,   I7,   LS,   BR,    BL,    LR,    LJ,
   RM,    RQ,   JSR,  JMP,  OBRa,  OBRb,  OBRc,  OBR2,
   O1R1,  OMb,  OMc,  SIa,
+  MULSH, OPSR,
   JC,    JU,   JL,   RSI,  DO21,  OB2
 }
 mcore_opclass;
@@ -48,6 +49,7 @@
   { "stop",	O0,	0,	0x0004 },
   { "wait",	O0,	0,	0x0005 },
   { "doze",	O0,	0,	0x0006 },
+  { "idly4",    O0,     0,      0x0007 },
   { "trap",	OT,	0,	0x0008 },
 /* SPACE:                       0x000C - 0x000F */
 /* SPACE:                       0x0010 - 0x001F */
@@ -99,6 +101,8 @@
   { "tst",	O2,	0,	0x0E00 },
   { "cmpne",	O2,	0,	0x0F00 },
   { "mfcr",	OC,	0,	0x1000 },
+  { "psrclr",	OPSR,	0,	0x11F0 },
+  { "psrset",	OPSR,	0,	0x11F8 },
   { "mov",	O2,	0,	0x1200 },
   { "bgenr",	O2,	0,	0x1300 },
   { "rsub",	O2,	0,	0x1400 },
@@ -109,6 +113,7 @@
   { "asr",	O2,	0,	0x1A00 },
   { "lsl",	O2,	0,	0x1B00 },
   { "addu",	O2,	0,	0x1C00 },
+  { "add",	O2,	0,	0x1C00 }, /* Official alias.  */
   { "ixh",	O2,	0,	0x1D00 },
   { "or",	O2,	0,	0x1E00 },
   { "andn",	O2,	0,	0x1F00 },
@@ -146,6 +151,8 @@
   { "movi",	I7,	0,	0x6000 },
 #define MCORE_INST_BMASKI_ALT	0x6000
 #define MCORE_INST_BGENI_ALT	0x6000
+  { "mulsh",    MULSH,  0,      0x6800 },
+  { "muls.h",   MULSH,  0,      0x6800 },
 /* SPACE:                       0x6900 - 0x6FFF */
   { "jmpi",	LJ,	1,	0x7000 },
   { "jsri",	LJ,	0,	0x7F00 },
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 1e3577c..2e75266 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -387,28 +387,8 @@
 	  if (op->pinfo != INSN_MACRO && (word & op->mask) == op->match)
 	    {
 	      register const char *d;
-	      int insn_isa;
 
-	      if ((op->membership & INSN_ISA) == INSN_ISA1)
-		insn_isa = 1;
-	      else if ((op->membership & INSN_ISA) == INSN_ISA2)
-		insn_isa = 2;
-	      else if ((op->membership & INSN_ISA) == INSN_ISA3)
-		insn_isa = 3;
-	      else if ((op->membership & INSN_ISA) == INSN_ISA4)
-		insn_isa = 4;
-	      else
-		insn_isa = 15;
-
-	      if (insn_isa > mips_isa
-		  && (target_processor == 4650
-		      && op->membership & INSN_4650) == 0
-		  && (target_processor == 4010
-		      && op->membership & INSN_4010) == 0
-		  && (target_processor == 4100
-		      && op->membership & INSN_4100) == 0
-		  && (target_processor == 3900
-		      && op->membership & INSN_3900) == 0)
+	      if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor, 0))
 		continue;
 
 	      (*info->fprintf_func) (info->stream, "%s", op->name);
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index b864619..6cdd833 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -76,6 +76,7 @@
 #define I2	INSN_ISA2
 #define I3	INSN_ISA3
 #define I4	INSN_ISA4
+#define I5	INSN_ISA5
 #define P3	INSN_4650
 #define L1	INSN_4010
 #define V1      INSN_4100
@@ -90,6 +91,11 @@
 #define G3 (I4             \
             )
 
+#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
@@ -109,6 +115,7 @@
 {"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 */
@@ -119,14 +126,17 @@
 {"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	},
@@ -134,10 +144,10 @@
 /* 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	},
-{"bc1f",    "N,p",	0x45000000, 0xffe30000,	CBD|RD_CC|FP_S,	I4	},
-{"bc1fl",   "p",	0x45020000, 0xffff0000,	CBL|RD_CC|FP_S,	I2|T3	},
-{"bc1fl",   "N,p",	0x45020000, 0xffe30000,	CBL|RD_CC|FP_S,	I4	},
+{"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	},
@@ -215,67 +225,99 @@
 {"c.f.d",   "M,S,T",	0x46200030, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
 {"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	},
+{"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	},
-{"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	},
+{"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	},
 {"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	},
+{"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	},
-{"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	},
+{"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	},
 {"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	},
-{"cache",   "k,o(b)",	0xbc000000, 0xfc000000, RD_b,		I3|T3	},
+{"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	},
@@ -298,8 +340,11 @@
 {"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.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	},
@@ -310,7 +355,7 @@
 /* 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	},
+{"deret",   "",         0x4200001f, 0xffffffff,    0,	G2|M1	},
 /* 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	},
@@ -334,6 +379,7 @@
 {"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 */
@@ -381,7 +427,7 @@
 {"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	},
+{"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	},
@@ -413,6 +459,7 @@
   /* 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	},
@@ -451,6 +498,7 @@
 {"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	},
@@ -482,11 +530,12 @@
 {"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	},
+{"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},
+{"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	},
@@ -498,23 +547,27 @@
 {"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	},
-{"movf",    "d,s,N",	0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_D|FP_S,	I4	},
-{"movf.d",  "D,S,N",	0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I4	},
-{"movf.s",  "D,S,N",	0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,	I4	},
-{"movn",    "d,v,t",	0x0000000b, 0xfc0007ff,	WR_d|RD_s|RD_t,	I4	},
+{"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	},
+{"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	},
-{"movn.s",  "D,S,t",	0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,	I4	},
-{"movt",    "d,s,N",	0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC,	I4	},
-{"movt.d",  "D,S,N",	0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I4	},
-{"movt.s",  "D,S,N",	0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,	I4	},
-{"movz",    "d,v,t",	0x0000000a, 0xfc0007ff,	WR_d|RD_s|RD_t,	I4	},
+{"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	},
-{"movz.s",  "D,S,t",	0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,	I4	},
+{"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	},
 /* 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	},
 {"mtc0",    "t,G",	0x40800000, 0xffe007ff,	COD|RD_t|WR_C0|WR_CC,	I1	},
@@ -526,6 +579,7 @@
 {"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	},
@@ -541,10 +595,13 @@
 {"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	},
@@ -553,10 +610,14 @@
 {"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},
 
-{"pref",    "k,o(b)",	0xcc000000, 0xfc000000, RD_b,		G3	},
+{"pref",    "k,o(b)",	0xcc000000, 0xfc000000, RD_b,		G3|M1	},
 {"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},
 
 {"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	},
@@ -586,9 +647,9 @@
 {"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",   "",		0x0000000e, 0xffffffff,	TRAP,           G2|M1	},
+{"sdbbp",   "c",	0x0000000e, 0xfc00ffff,	TRAP,		G2|M1	},
+{"sdbbp",   "c,q",	0x0000000e, 0xfc00003f,	TRAP,		G2|M1	},
 {"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	},
@@ -642,14 +703,17 @@
 {"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	},
 {"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	},
+{"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	},
@@ -693,10 +757,10 @@
 {"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	},
+{"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	 },
@@ -737,7 +801,7 @@
 {"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	},
+{"wait",    "",		0x42000020, 0xffffffff,	TRAP,	I3|M1	},
 {"waiti",   "",		0x42000020, 0xffffffff,	TRAP,	L1	},
 {"wb", 	    "o(b)",	0xbc040000, 0xfc1f0000, SM|RD_b,	L1	},
 /* No hazard protection on coprocessor instructions--they shouldn't
diff --git a/opcodes/pj-dis.c b/opcodes/pj-dis.c
new file mode 100644
index 0000000..c098295
--- /dev/null
+++ b/opcodes/pj-dis.c
@@ -0,0 +1,175 @@
+/* pj-dis.c -- Disassemble picoJava instructions.
+   Copyright (C) 1999 Free Software Foundation, Inc. 
+   Contributed by Steve Chamberlain, of Transmeta (sac@pobox.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 <stdio.h>
+#include "opcode/pj.h"
+#include "dis-asm.h"
+
+extern const pj_opc_info_t pj_opc_info[512];
+
+static int get_int (memaddr, iptr, info)
+     bfd_vma memaddr;
+     int *iptr;
+     struct disassemble_info *info;
+{
+  unsigned char ival[4];
+
+  int status = info->read_memory_func (memaddr, ival, 4, info);
+
+  *iptr = (ival[0] << 24) 
+    | (ival[1] << 16) 
+    | (ival[2] << 8) 
+    | (ival[3] << 0) ;
+
+  return status;
+}
+
+int
+print_insn_pj (addr, info)
+     bfd_vma addr;
+     struct disassemble_info *info;
+{
+  fprintf_ftype fprintf_fn = info->fprintf_func;
+  void *stream = info->stream;
+  unsigned char opcode;
+  int status;
+
+  if ((status = info->read_memory_func (addr, &opcode, 1, info)))
+    goto fail;
+
+  if (opcode == 0xff)
+    {
+      unsigned char byte_2;
+      if ((status = info->read_memory_func (addr + 1, &byte_2, 1, info)))
+	goto fail;
+      fprintf_fn (stream, "%s\t", pj_opc_info[opcode + byte_2].name);
+      return 2;
+    }
+  else
+    {
+      char *sep = "\t";
+      int insn_start = addr;
+      const pj_opc_info_t *op = &pj_opc_info[opcode];
+      int a;
+      addr++;
+      fprintf_fn (stream, "%s", op->name);
+
+      /* The tableswitch instruction is followed by the default
+	 address, low value, high value and the destinations. */
+
+      if (strcmp (op->name, "tableswitch") == 0)
+	{
+	  int lowval;
+	  int highval;
+	  int val;
+
+	  addr = (addr + 3) & ~3;
+	  if ((status = get_int (addr, &val, info)))
+	    goto fail;
+
+	  fprintf_fn (stream," default: ");
+	  (*info->print_address_func) (val + insn_start, info);
+	  addr += 4;
+
+	  if ((status = get_int (addr, &lowval, info)))
+	    goto fail;
+	  addr += 4;
+
+	  if ((status = get_int (addr, &highval, info)))
+	    goto fail;
+	  addr += 4;
+
+	  while (lowval <= highval) {
+	    if ((status = get_int (addr, &val, info)))
+	      goto fail;
+	    fprintf_fn (stream," %d:[", lowval);
+	    (*info->print_address_func) (val + insn_start, info);
+	    fprintf_fn (stream," ]");
+	    addr += 4;
+	    lowval++;
+	  }
+	  return addr - insn_start;
+	}
+
+      /* The lookupswitch instruction is followed by the default
+	 address, element count and pairs of values and
+	 addresses. */
+	    
+      if (strcmp (op->name, "lookupswitch") == 0)
+	{
+	  int count;
+	  int val;
+
+	  addr = (addr + 3) & ~3;
+	  if ((status = get_int (addr, &val, info)))
+	    goto fail;
+	  addr += 4;
+
+	  fprintf_fn (stream," default: ");
+	  (*info->print_address_func) (val + insn_start, info);
+
+	  if ((status = get_int (addr, &count, info)))
+	    goto fail;
+	  addr += 4;
+
+	  while (count--) {
+	    if ((status = get_int (addr, &val, info)))
+	      goto fail;
+	    addr += 4;
+	    fprintf_fn (stream," %d:[", val);
+
+	    if ((status = get_int (addr, &val, info)))
+	      goto fail;
+	    addr += 4;
+
+	    (*info->print_address_func) (val + insn_start, info);
+	    fprintf_fn (stream," ]");
+	  }
+	  return addr - insn_start;
+	}
+      for (a = 0; op->arg[a]; a++)
+	{
+	  unsigned char data[4];
+	  int val = 0;
+	  int i;
+	  int size = ASIZE (op->arg[a]);
+
+	  if ((status = info->read_memory_func (addr, data, size, info)))
+	    goto fail;
+
+	  val = (UNS (op->arg[0]) || ((data[0] & 0x80) == 0)) ? 0 : -1;
+
+	  for (i = 0; i < size; i++)
+	    val = (val << 8) | (data[i] & 0xff);
+
+	  if (PCREL (op->arg[a]))
+	    (*info->print_address_func) (val + insn_start, info);
+	  else
+	    fprintf_fn (stream, "%s%d", sep, val);
+
+	  sep = ",";
+	  addr += size;
+	}
+      return op->len;
+    }
+
+ fail:
+  info->memory_error_func (status, addr, info);
+  return -1;
+}
diff --git a/opcodes/pj-opc.c b/opcodes/pj-opc.c
new file mode 100644
index 0000000..9f7e38e
--- /dev/null
+++ b/opcodes/pj-opc.c
@@ -0,0 +1,536 @@
+/* pj-opc.c -- Definitions for picoJava opcodes.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   Contributed by Steve Chamberlain of Transmeta (sac@pobox.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 "ansidecl.h"
+#include "opcode/pj.h"
+
+const pj_opc_info_t pj_opc_info[512] =
+{
+{ 0x00,   -1, 1, {O_N, O_N}, "nop"},
+{ 0x01,   -1, 1, {O_N, O_N}, "aconst_null"},
+{ 0x02,   -1, 1, {O_N, O_N}, "iconst_m1"},
+{ 0x03,   -1, 1, {O_N, O_N}, "iconst_0"},
+{ 0x04,   -1, 1, {O_N, O_N}, "iconst_1"},
+{ 0x05,   -1, 1, {O_N, O_N}, "iconst_2"},
+{ 0x06,   -1, 1, {O_N, O_N}, "iconst_3"},
+{ 0x07,   -1, 1, {O_N, O_N}, "iconst_4"},
+{ 0x08,   -1, 1, {O_N, O_N}, "iconst_5"},
+{ 0x09,   -1, 1, {O_N, O_N}, "lconst_0"},
+{ 0x0a,   -1, 1, {O_N, O_N}, "lconst_1"},
+{ 0x0b,   -1, 1, {O_N, O_N}, "fconst_0"},
+{ 0x0c,   -1, 1, {O_N, O_N}, "fconst_1"},
+{ 0x0d,   -1, 1, {O_N, O_N}, "fconst_2"},
+{ 0x0e,   -1, 1, {O_N, O_N}, "dconst_0"},
+{ 0x0f,   -1, 1, {O_N, O_N}, "dconst_1"},
+{ 0x10,   -1, 2, {O_8, O_N}, "bipush"},
+{ 0x11,   -1, 3, {O_16, O_N}, "sipush"},
+{ 0x12,   -1, 2, {O_N, O_N}, "ldc"},
+{ 0x13,   -1, 3, {O_N, O_N}, "ldc_w"},
+{ 0x14,   -1, 3, {O_N, O_N}, "ldc2_w"},
+{ 0x15,   -1, 2, {O_U8, O_N}, "iload"},
+{ 0x16,   -1, 2, {O_U8, O_N}, "lload"},
+{ 0x17,   -1, 2, {O_U8, O_N}, "fload"},
+{ 0x18,   -1, 2, {O_U8, O_N}, "dload"},
+{ 0x19,   -1, 2, {O_U8, O_N}, "aload"},
+{ 0x1a,   -1, 1, {O_N, O_N}, "iload_0"},
+{ 0x1b,   -1, 1, {O_N, O_N}, "iload_1"},
+{ 0x1c,   -1, 1, {O_N, O_N}, "iload_2"},
+{ 0x1d,   -1, 1, {O_N, O_N}, "iload_3"},
+{ 0x1e,   -1, 1, {O_N, O_N}, "lload_0"},
+{ 0x1f,   -1, 1, {O_N, O_N}, "lload_1"},
+{ 0x20,   -1, 1, {O_N, O_N}, "lload_2"},
+{ 0x21,   -1, 1, {O_N, O_N}, "lload_3"},
+{ 0x22,   -1, 1, {O_N, O_N}, "fload_0"},
+{ 0x23,   -1, 1, {O_N, O_N}, "fload_1"},
+{ 0x24,   -1, 1, {O_N, O_N}, "fload_2"},
+{ 0x25,   -1, 1, {O_N, O_N}, "fload_3"},
+{ 0x26,   -1, 1, {O_N, O_N}, "dload_0"},
+{ 0x27,   -1, 1, {O_N, O_N}, "dload_1"},
+{ 0x28,   -1, 1, {O_N, O_N}, "dload_2"},
+{ 0x29,   -1, 1, {O_N, O_N}, "dload_3"},
+{ 0x2a,   -1, 1, {O_N, O_N}, "aload_0"},
+{ 0x2b,   -1, 1, {O_N, O_N}, "aload_1"},
+{ 0x2c,   -1, 1, {O_N, O_N}, "aload_2"},
+{ 0x2d,   -1, 1, {O_N, O_N}, "aload_3"},
+{ 0x2e,   -1, 1, {O_N, O_N}, "iaload"},
+{ 0x2f,   -1, 1, {O_N, O_N}, "laload"},
+{ 0x30,   -1, 1, {O_N, O_N}, "faload"},
+{ 0x31,   -1, 1, {O_N, O_N}, "daload"},
+{ 0x32,   -1, 1, {O_N, O_N}, "aaload"},
+{ 0x33,   -1, 1, {O_N, O_N}, "baload"},
+{ 0x34,   -1, 1, {O_N, O_N}, "caload"},
+{ 0x35,   -1, 1, {O_N, O_N}, "saload"},
+{ 0x36,   -1, 2, {O_U8, O_N}, "istore"},
+{ 0x37,   -1, 2, {O_U8, O_N}, "lstore"},
+{ 0x38,   -1, 2, {O_U8, O_N}, "fstore"},
+{ 0x39,   -1, 2, {O_U8, O_N}, "dstore"},
+{ 0x3a,   -1, 2, {O_U8, O_N}, "astore"},
+{ 0x3b,   -1, 1, {O_N, O_N}, "istore_0"},
+{ 0x3c,   -1, 1, {O_N, O_N}, "istore_1"},
+{ 0x3d,   -1, 1, {O_N, O_N}, "istore_2"},
+{ 0x3e,   -1, 1, {O_N, O_N}, "istore_3"},
+{ 0x3f,   -1, 1, {O_N, O_N}, "lstore_0"},
+{ 0x40,   -1, 1, {O_N, O_N}, "lstore_1"},
+{ 0x41,   -1, 1, {O_N, O_N}, "lstore_2"},
+{ 0x42,   -1, 1, {O_N, O_N}, "lstore_3"},
+{ 0x43,   -1, 1, {O_N, O_N}, "fstore_0"},
+{ 0x44,   -1, 1, {O_N, O_N}, "fstore_1"},
+{ 0x45,   -1, 1, {O_N, O_N}, "fstore_2"},
+{ 0x46,   -1, 1, {O_N, O_N}, "fstore_3"},
+{ 0x47,   -1, 1, {O_N, O_N}, "dstore_0"},
+{ 0x48,   -1, 1, {O_N, O_N}, "dstore_1"},
+{ 0x49,   -1, 1, {O_N, O_N}, "dstore_2"},
+{ 0x4a,   -1, 1, {O_N, O_N}, "dstore_3"},
+{ 0x4b,   -1, 1, {O_N, O_N}, "astore_0"},
+{ 0x4c,   -1, 1, {O_N, O_N}, "astore_1"},
+{ 0x4d,   -1, 1, {O_N, O_N}, "astore_2"},
+{ 0x4e,   -1, 1, {O_N, O_N}, "astore_3"},
+{ 0x4f,   -1, 1, {O_N, O_N}, "iastore"},
+{ 0x50,   -1, 1, {O_N, O_N}, "lastore"},
+{ 0x51,   -1, 1, {O_N, O_N}, "fastore"},
+{ 0x52,   -1, 1, {O_N, O_N}, "dastore"},
+{ 0x53,   -1, 1, {O_N, O_N}, "aastore"},
+{ 0x54,   -1, 1, {O_N, O_N}, "bastore"},
+{ 0x55,   -1, 1, {O_N, O_N}, "castore"},
+{ 0x56,   -1, 1, {O_N, O_N}, "sastore"},
+{ 0x57,   -1, 1, {O_N, O_N}, "pop"},
+{ 0x58,   -1, 1, {O_N, O_N}, "pop2"},
+{ 0x59,   -1, 1, {O_N, O_N}, "dup"},
+{ 0x5a,   -1, 1, {O_N, O_N}, "dup_x1"},
+{ 0x5b,   -1, 1, {O_N, O_N}, "dup_x2"},
+{ 0x5c,   -1, 1, {O_N, O_N}, "dup2"},
+{ 0x5d,   -1, 1, {O_N, O_N}, "dup2_x1"},
+{ 0x5e,   -1, 1, {O_N, O_N}, "dup2_x2"},
+{ 0x5f,   -1, 1, {O_N, O_N}, "swap"},
+{ 0x60,   -1, 1, {O_N, O_N}, "iadd"},
+{ 0x61,   -1, 1, {O_N, O_N}, "ladd"},
+{ 0x62,   -1, 1, {O_N, O_N}, "fadd"},
+{ 0x63,   -1, 1, {O_N, O_N}, "dadd"},
+{ 0x64,   -1, 1, {O_N, O_N}, "isub"},
+{ 0x65,   -1, 1, {O_N, O_N}, "lsub"},
+{ 0x66,   -1, 1, {O_N, O_N}, "fsub"},
+{ 0x67,   -1, 1, {O_N, O_N}, "dsub"},
+{ 0x68,   -1, 1, {O_N, O_N}, "imul"},
+{ 0x69,   -1, 1, {O_N, O_N}, "lmul"},
+{ 0x6a,   -1, 1, {O_N, O_N}, "fmul"},
+{ 0x6b,   -1, 1, {O_N, O_N}, "dmul"},
+{ 0x6c,   -1, 1, {O_N, O_N}, "idiv"},
+{ 0x6d,   -1, 1, {O_N, O_N}, "ldiv"},
+{ 0x6e,   -1, 1, {O_N, O_N}, "fdiv"},
+{ 0x6f,   -1, 1, {O_N, O_N}, "ddiv"},
+{ 0x70,   -1, 1, {O_N, O_N}, "irem"},
+{ 0x71,   -1, 1, {O_N, O_N}, "lrem"},
+{ 0x72,   -1, 1, {O_N, O_N}, "frem"},
+{ 0x73,   -1, 1, {O_N, O_N}, "drem"},
+{ 0x74,   -1, 1, {O_N, O_N}, "ineg"},
+{ 0x75,   -1, 1, {O_N, O_N}, "lneg"},
+{ 0x76,   -1, 1, {O_N, O_N}, "fneg"},
+{ 0x77,   -1, 1, {O_N, O_N}, "dneg"},
+{ 0x78,   -1, 1, {O_N, O_N}, "ishl"},
+{ 0x79,   -1, 1, {O_N, O_N}, "lshl"},
+{ 0x7a,   -1, 1, {O_N, O_N}, "ishr"},
+{ 0x7b,   -1, 1, {O_N, O_N}, "lshr"},
+{ 0x7c,   -1, 1, {O_N, O_N}, "iushr"},
+{ 0x7d,   -1, 1, {O_N, O_N}, "lushr"},
+{ 0x7e,   -1, 1, {O_N, O_N}, "iand"},
+{ 0x7f,   -1, 1, {O_N, O_N}, "land"},
+{ 0x80,   -1, 1, {O_N, O_N}, "ior"},
+{ 0x81,   -1, 1, {O_N, O_N}, "lor"},
+{ 0x82,   -1, 1, {O_N, O_N}, "ixor"},
+{ 0x83,   -1, 1, {O_N, O_N}, "lxor"},
+{ 0x84,   -1, 3, {O_U8, O_8}, "iinc"},
+{ 0x85,   -1, 1, {O_N, O_N}, "i2l"},
+{ 0x86,   -1, 1, {O_N, O_N}, "i2f"},
+{ 0x87,   -1, 1, {O_N, O_N}, "i2d"},
+{ 0x88,   -1, 1, {O_N, O_N}, "l2i"},
+{ 0x89,   -1, 1, {O_N, O_N}, "l2f"},
+{ 0x8a,   -1, 1, {O_N, O_N}, "l2d"},
+{ 0x8b,   -1, 1, {O_N, O_N}, "f2i"},
+{ 0x8c,   -1, 1, {O_N, O_N}, "f2l"},
+{ 0x8d,   -1, 1, {O_N, O_N}, "f2d"},
+{ 0x8e,   -1, 1, {O_N, O_N}, "d2i"},
+{ 0x8f,   -1, 1, {O_N, O_N}, "d2l"},
+{ 0x90,   -1, 1, {O_N, O_N}, "d2f"},
+{ 0x91,   -1, 1, {O_N, O_N}, "i2b"},
+{ 0x92,   -1, 1, {O_N, O_N}, "i2c"},
+{ 0x93,   -1, 1, {O_N, O_N}, "i2s"},
+{ 0x94,   -1, 1, {O_N, O_N}, "lcmp"},
+{ 0x95,   -1, 1, {O_N, O_N}, "fcmpl"},
+{ 0x96,   -1, 1, {O_N, O_N}, "fcmpg"},
+{ 0x97,   -1, 1, {O_N, O_N}, "dcmpl"},
+{ 0x98,   -1, 1, {O_N, O_N}, "dcmpg"},
+{ 0x99,   -1, 3, {O_R16, O_N}, "ifeq"},
+{ 0x9a,   -1, 3, {O_R16, O_N}, "ifne"},
+{ 0x9b,   -1, 3, {O_R16, O_N}, "iflt"},
+{ 0x9c,   -1, 3, {O_R16, O_N}, "ifge"},
+{ 0x9d,   -1, 3, {O_R16, O_N}, "ifgt"},
+{ 0x9e,   -1, 3, {O_R16, O_N}, "ifle"},
+{ 0x9f,   -1, 3, {O_R16, O_N}, "if_icmpeq"},
+{ 0xa0,   -1, 3, {O_R16, O_N}, "if_icmpne"},
+{ 0xa1,   -1, 3, {O_R16, O_N}, "if_icmplt"},
+{ 0xa2,   -1, 3, {O_R16, O_N}, "if_icmpge"},
+{ 0xa3,   -1, 3, {O_R16, O_N}, "if_icmpgt"},
+{ 0xa4,   -1, 3, {O_R16, O_N}, "if_icmple"},
+{ 0xa5,   -1, 3, {O_R16, O_N}, "if_acmpeq"},
+{ 0xa6,   -1, 3, {O_R16, O_N}, "if_acmpne"},
+{ 0xa7,   -1, 3, {O_R16, O_N}, "goto"},
+{ 0xa8,   -1, 3, {O_N, O_N}, "jsr"},
+{ 0xa9,   -1, 2, {O_N, O_N}, "ret"},
+{ 0xaa,   -1, 1, {O_N, O_N}, "tableswitch"},
+{ 0xab,   -1, 1, {O_N, O_N}, "lookupswitch"},
+{ 0xac,   -1, 1, {O_N, O_N}, "ireturn"},
+{ 0xad,   -1, 1, {O_N, O_N}, "lreturn"},
+{ 0xae,   -1, 1, {O_N, O_N}, "freturn"},
+{ 0xaf,   -1, 1, {O_N, O_N}, "dreturn"},
+{ 0xb0,   -1, 1, {O_N, O_N}, "areturn"},
+{ 0xb1,   -1, 1, {O_N, O_N}, "return"},
+{ 0xb2,   -1, 3, {O_N, O_N}, "getstatic"},
+{ 0xb3,   -1, 3, {O_N, O_N}, "putstatic"},
+{ 0xb4,   -1, 3, {O_N, O_N}, "getfield"},
+{ 0xb5,   -1, 3, {O_N, O_N}, "putfield"},
+{ 0xb6,   -1, 3, {O_N, O_N}, "invokevirtual"},
+{ 0xb7,   -1, 3, {O_N, O_N}, "invokespecial"},
+{ 0xb8,   -1, 3, {O_N, O_N}, "invokestatic"},
+{ 0xb9,   -1, 5, {O_N, O_N}, "invokeinterface"},
+{ 0xba,   -1, 1, {O_N, O_N}, "bad_ba"},
+{ 0xbb,   -1, 3, {O_N, O_N}, "new"},
+{ 0xbc,   -1, 2, {O_N, O_N}, "newarray"},
+{ 0xbd,   -1, 3, {O_N, O_N}, "anewarray"},
+{ 0xbe,   -1, 1, {O_N, O_N}, "arraylength"},
+{ 0xbf,   -1, 1, {O_N, O_N}, "athrow"},
+{ 0xc0,   -1, 3, {O_N, O_N}, "checkcast"},
+{ 0xc1,   -1, 3, {O_N, O_N}, "instanceof"},
+{ 0xc2,   -1, 1, {O_N, O_N}, "monitorenter"},
+{ 0xc3,   -1, 1, {O_N, O_N}, "monitorexit"},
+{ 0xc4,   -1, 1, {O_N, O_N}, "wide"},
+{ 0xc5,   -1, 4, {O_N, O_N}, "multianewarray"},
+{ 0xc6,   -1, 3, {O_N, O_N}, "ifnull"},
+{ 0xc7,   -1, 3, {O_N, O_N}, "ifnonnull"},
+{ 0xc8,   -1, 5, {O_N, O_N}, "goto_w"},
+{ 0xc9,   -1, 5, {O_N, O_N}, "jsr_w"},
+{ 0xca,   -1, 1, {O_N, O_N}, "breakpoint"},
+{ 0xcb,   -1, 1, {O_N, O_N}, "bytecode"},
+{ 0xcc,   -1, 1, {O_N, O_N}, "try"},
+{ 0xcd,   -1, 1, {O_N, O_N}, "endtry"},
+{ 0xce,   -1, 1, {O_N, O_N}, "catch"},
+{ 0xcf,   -1, 1, {O_N, O_N}, "var"},
+{ 0xd0,   -1, 1, {O_N, O_N}, "endvar"},
+{ 0xd1,   -1, 1, {O_N, O_N}, "bad_d1"},
+{ 0xd2,   -1, 1, {O_N, O_N}, "bad_d2"},
+{ 0xd3,   -1, 1, {O_N, O_N}, "bad_d3"},
+{ 0xd4,   -1, 1, {O_N, O_N}, "bad_d4"},
+{ 0xd5,   -1, 1, {O_N, O_N}, "bad_d5"},
+{ 0xd6,   -1, 1, {O_N, O_N}, "bad_d6"},
+{ 0xd7,   -1, 1, {O_N, O_N}, "bad_d7"},
+{ 0xd8,   -1, 1, {O_N, O_N}, "bad_d8"},
+{ 0xd9,   -1, 1, {O_N, O_N}, "bad_d9"},
+{ 0xda,   -1, 1, {O_N, O_N}, "bad_da"},
+{ 0xdb,   -1, 1, {O_N, O_N}, "bad_db"},
+{ 0xdc,   -1, 1, {O_N, O_N}, "bad_dc"},
+{ 0xdd,   -1, 1, {O_N, O_N}, "bad_dd"},
+{ 0xde,   -1, 1, {O_N, O_N}, "bad_de"},
+{ 0xdf,   -1, 1, {O_N, O_N}, "bad_df"},
+{ 0xe0,   -1, 1, {O_N, O_N}, "bad_e0"},
+{ 0xe1,   -1, 1, {O_N, O_N}, "bad_e1"},
+{ 0xe2,   -1, 1, {O_N, O_N}, "bad_e2"},
+{ 0xe3,   -1, 1, {O_N, O_N}, "bad_e3"},
+{ 0xe4,   -1, 1, {O_N, O_N}, "bad_e4"},
+{ 0xe5,   -1, 1, {O_N, O_N}, "bad_e5"},
+{ 0xe6,   -1, 1, {O_N, O_N}, "bad_e6"},
+{ 0xe7,   -1, 1, {O_N, O_N}, "bad_e7"},
+{ 0xe8,   -1, 1, {O_N, O_N}, "bad_e8"},
+{ 0xe9,   -1, 1, {O_N, O_N}, "bad_e9"},
+{ 0xea,   -1, 1, {O_N, O_N}, "bad_ea"},
+{ 0xeb,   -1, 1, {O_N, O_N}, "bad_eb"},
+{ 0xec,   -1, 1, {O_N, O_N}, "bad_ec"},
+{ 0xed,   -1, 3, {O_16, O_N}, "sethi"},
+{ 0xee,   -1, 3, {O_U8, O_8}, "load_word_index"},
+{ 0xef,   -1, 3, {O_U8, O_8}, "load_short_index"},
+{ 0xf0,   -1, 3, {O_U8, O_8}, "load_char_index"},
+{ 0xf1,   -1, 3, {O_U8, O_8}, "load_byte_index"},
+{ 0xf2,   -1, 3, {O_U8, O_8}, "load_ubyte_index"},
+{ 0xf3,   -1, 3, {O_U8, O_8}, "store_word_index"},
+{ 0xf4,   -1, 3, {O_U8, O_8}, "na_store_word_index"},
+{ 0xf5,   -1, 3, {O_U8, O_8}, "store_short_index"},
+{ 0xf6,   -1, 3, {O_U8, O_8}, "store_byte_index"},
+{ 0xf7,   -1, 1, {O_N, O_N}, "bad_f7"},
+{ 0xf8,   -1, 1, {O_N, O_N}, "bad_f8"},
+{ 0xf9,   -1, 1, {O_N, O_N}, "bad_f9"},
+{ 0xfa,   -1, 1, {O_N, O_N}, "bad_fa"},
+{ 0xfb,   -1, 1, {O_N, O_N}, "bad_fb"},
+{ 0xfc,   -1, 1, {O_N, O_N}, "bad_fc"},
+{ 0xfd,   -1, 1, {O_N, O_N}, "bad_fd"},
+{ 0xfe,   -1, 1, {O_N, O_N}, "bad_fe"},
+{ 0xff, 0x00, 2, {O_N, O_N}, "load_ubyte"},
+{ 0xff, 0x01, 2, {O_N, O_N}, "load_byte"},
+{ 0xff, 0x02, 2, {O_N, O_N}, "load_char"},
+{ 0xff, 0x03, 2, {O_N, O_N}, "load_short"},
+{ 0xff, 0x04, 2, {O_N, O_N}, "load_word"},
+{ 0xff, 0x05, 2, {O_N, O_N}, "priv_ret_from_trap"},
+{ 0xff, 0x06, 2, {O_N, O_N}, "priv_read_dcache_tag"},
+{ 0xff, 0x07, 2, {O_N, O_N}, "priv_read_dcache_data"},
+{ 0xff, 0x08, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x09, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x0a, 2, {O_N, O_N}, "load_char_oe"},
+{ 0xff, 0x0b, 2, {O_N, O_N}, "load_short_oe"},
+{ 0xff, 0x0c, 2, {O_N, O_N}, "load_word_oe"},
+{ 0xff, 0x0d, 2, {O_N, O_N}, "return0"},
+{ 0xff, 0x0e, 2, {O_N, O_N}, "priv_read_icache_tag"},
+{ 0xff, 0x0f, 2, {O_N, O_N}, "priv_read_icache_data"},
+{ 0xff, 0x10, 2, {O_N, O_N}, "ncload_ubyte"},
+{ 0xff, 0x11, 2, {O_N, O_N}, "ncload_byte"},
+{ 0xff, 0x12, 2, {O_N, O_N}, "ncload_char"},
+{ 0xff, 0x13, 2, {O_N, O_N}, "ncload_short"},
+{ 0xff, 0x14, 2, {O_N, O_N}, "ncload_word"},
+{ 0xff, 0x15, 2, {O_N, O_N}, "iucmp"},
+{ 0xff, 0x16, 2, {O_N, O_N}, "priv_powerdown"},
+{ 0xff, 0x17, 2, {O_N, O_N}, "cache_invalidate"},
+{ 0xff, 0x18, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x19, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x1a, 2, {O_N, O_N}, "ncload_char_oe"},
+{ 0xff, 0x1b, 2, {O_N, O_N}, "ncload_short_oe"},
+{ 0xff, 0x1c, 2, {O_N, O_N}, "ncload_word_oe"},
+{ 0xff, 0x1d, 2, {O_N, O_N}, "return1"},
+{ 0xff, 0x1e, 2, {O_N, O_N}, "cache_flush"},
+{ 0xff, 0x1f, 2, {O_N, O_N}, "cache_index_flush"},
+{ 0xff, 0x20, 2, {O_N, O_N}, "store_byte"},
+{ 0xff, 0x21, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x22, 2, {O_N, O_N}, "store_short"},
+{ 0xff, 0x23, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x24, 2, {O_N, O_N}, "store_word"},
+{ 0xff, 0x25, 2, {O_N, O_N}, "soft_trap"},
+{ 0xff, 0x26, 2, {O_N, O_N}, "priv_write_dcache_tag"},
+{ 0xff, 0x27, 2, {O_N, O_N}, "priv_write_dcache_data"},
+{ 0xff, 0x28, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x29, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x2a, 2, {O_N, O_N}, "store_short_oe"},
+{ 0xff, 0x2b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x2c, 2, {O_N, O_N}, "store_word_oe"},
+{ 0xff, 0x2d, 2, {O_N, O_N}, "return2"},
+{ 0xff, 0x2e, 2, {O_N, O_N}, "priv_write_icache_tag"},
+{ 0xff, 0x2f, 2, {O_N, O_N}, "priv_write_icache_data"},
+{ 0xff, 0x30, 2, {O_N, O_N}, "ncstore_byte"},
+{ 0xff, 0x31, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x32, 2, {O_N, O_N}, "ncstore_short"},
+{ 0xff, 0x33, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x34, 2, {O_N, O_N}, "ncstore_word"},
+{ 0xff, 0x35, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x36, 2, {O_N, O_N}, "priv_reset"},
+{ 0xff, 0x37, 2, {O_N, O_N}, "get_current_class"},
+{ 0xff, 0x38, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x39, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x3a, 2, {O_N, O_N}, "ncstore_short_oe"},
+{ 0xff, 0x3b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x3c, 2, {O_N, O_N}, "ncstore_word_oe"},
+{ 0xff, 0x3d, 2, {O_N, O_N}, "call"},
+{ 0xff, 0x3e, 2, {O_N, O_N}, "zero_line"},
+{ 0xff, 0x3f, 2, {O_N, O_N}, "priv_update_optop"},
+{ 0xff, 0x40, 2, {O_N, O_N}, "read_pc"},
+{ 0xff, 0x41, 2, {O_N, O_N}, "read_vars"},
+{ 0xff, 0x42, 2, {O_N, O_N}, "read_frame"},
+{ 0xff, 0x43, 2, {O_N, O_N}, "read_optop"},
+{ 0xff, 0x44, 2, {O_N, O_N}, "priv_read_oplim"},
+{ 0xff, 0x45, 2, {O_N, O_N}, "read_const_pool"},
+{ 0xff, 0x46, 2, {O_N, O_N}, "priv_read_psr"},
+{ 0xff, 0x47, 2, {O_N, O_N}, "priv_read_trapbase"},
+{ 0xff, 0x48, 2, {O_N, O_N}, "priv_read_lockcount0"},
+{ 0xff, 0x49, 2, {O_N, O_N}, "priv_read_lockcount1"},
+{ 0xff, 0x4a, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x4b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x4c, 2, {O_N, O_N}, "priv_read_lockaddr0"},
+{ 0xff, 0x4d, 2, {O_N, O_N}, "priv_read_lockaddr1"},
+{ 0xff, 0x4e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x4f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x50, 2, {O_N, O_N}, "priv_read_userrange1"},
+{ 0xff, 0x51, 2, {O_N, O_N}, "priv_read_gc_config"},
+{ 0xff, 0x52, 2, {O_N, O_N}, "priv_read_brk1a"},
+{ 0xff, 0x53, 2, {O_N, O_N}, "priv_read_brk2a"},
+{ 0xff, 0x54, 2, {O_N, O_N}, "priv_read_brk12c"},
+{ 0xff, 0x55, 2, {O_N, O_N}, "priv_read_userrange2"},
+{ 0xff, 0x56, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x57, 2, {O_N, O_N}, "priv_read_versionid"},
+{ 0xff, 0x58, 2, {O_N, O_N}, "priv_read_hcr"},
+{ 0xff, 0x59, 2, {O_N, O_N}, "priv_read_sc_bottom"},
+{ 0xff, 0x5a, 2, {O_N, O_N}, "read_global0"},
+{ 0xff, 0x5b, 2, {O_N, O_N}, "read_global1"},
+{ 0xff, 0x5c, 2, {O_N, O_N}, "read_global2"},
+{ 0xff, 0x5d, 2, {O_N, O_N}, "read_global3"},
+{ 0xff, 0x5e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x5f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x60, 2, {O_N, O_N}, "write_pc"},
+{ 0xff, 0x61, 2, {O_N, O_N}, "write_vars"},
+{ 0xff, 0x62, 2, {O_N, O_N}, "write_frame"},
+{ 0xff, 0x63, 2, {O_N, O_N}, "write_optop"},
+{ 0xff, 0x64, 2, {O_N, O_N}, "priv_write_oplim"},
+{ 0xff, 0x65, 2, {O_N, O_N}, "write_const_pool"},
+{ 0xff, 0x66, 2, {O_N, O_N}, "priv_write_psr"},
+{ 0xff, 0x67, 2, {O_N, O_N}, "priv_write_trapbase"},
+{ 0xff, 0x68, 2, {O_N, O_N}, "priv_write_lockcount0"},
+{ 0xff, 0x69, 2, {O_N, O_N}, "priv_write_lockcount1"},
+{ 0xff, 0x6a, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x6b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x6c, 2, {O_N, O_N}, "priv_write_lockaddr0"},
+{ 0xff, 0x6d, 2, {O_N, O_N}, "priv_write_lockaddr1"},
+{ 0xff, 0x6e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x6f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x70, 2, {O_N, O_N}, "priv_write_userrange1"},
+{ 0xff, 0x71, 2, {O_N, O_N}, "priv_write_gc_config"},
+{ 0xff, 0x72, 2, {O_N, O_N}, "priv_write_brk1a"},
+{ 0xff, 0x73, 2, {O_N, O_N}, "priv_write_brk2a"},
+{ 0xff, 0x74, 2, {O_N, O_N}, "priv_write_brk12c"},
+{ 0xff, 0x75, 2, {O_N, O_N}, "priv_write_userrange2"},
+{ 0xff, 0x76, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x77, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x78, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x79, 2, {O_N, O_N}, "priv_write_sc_bottom"},
+{ 0xff, 0x7a, 2, {O_N, O_N}, "write_global0"},
+{ 0xff, 0x7b, 2, {O_N, O_N}, "write_global1"},
+{ 0xff, 0x7c, 2, {O_N, O_N}, "write_global2"},
+{ 0xff, 0x7d, 2, {O_N, O_N}, "write_global3"},
+{ 0xff, 0x7e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x7f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x80, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x81, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x82, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x83, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x84, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x85, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x86, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x87, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x88, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x89, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8a, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8c, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8d, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x8f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x90, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x91, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x92, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x93, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x94, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x95, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x96, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x97, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x98, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x99, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9a, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9b, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9c, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9d, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9e, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0x9f, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa0, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa1, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xa9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xaa, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xab, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xac, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xad, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xae, 2, {O_N, O_N}, "tm_putchar"},
+{ 0xff, 0xaf, 2, {O_N, O_N}, "tm_exit"},
+{ 0xff, 0xb0, 2, {O_N, O_N}, "tm_trap"},
+{ 0xff, 0xb1, 2, {O_N, O_N}, "tm_minfo"},
+{ 0xff, 0xb2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xb9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xba, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xbb, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xbc, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xbd, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xbe, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xbf, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc0, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc1, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xc9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xca, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xcb, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xcc, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xcd, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xce, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xcf, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd0, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd1, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xd9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xda, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xdb, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xdc, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xdd, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xde, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xdf, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe0, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe1, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xe9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xea, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xeb, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xec, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xed, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xee, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xef, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf0, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf1, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf2, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf3, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf4, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf5, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf6, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf7, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf8, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xf9, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xfa, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xfb, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xfc, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xfd, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xfe, 2, {O_N, O_N}, "bad"},
+{ 0xff, 0xff, 2, {O_N, O_N}, "bad"},
+};
diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in
index f072cca..ec23c5a 100644
--- a/opcodes/po/POTFILES.in
+++ b/opcodes/po/POTFILES.in
@@ -25,6 +25,8 @@
 h8500-dis.c
 h8500-opc.h
 hppa-dis.c
+i370-dis.c
+i370-opc.c
 i386-dis.c
 i960-dis.c
 m10200-dis.c
@@ -48,7 +50,8 @@
 mips-opc.c
 mips16-opc.c
 ns32k-dis.c
-opintl.h
+pj-dis.c
+pj-opc.c
 ppc-dis.c
 ppc-opc.c
 sh-dis.c
diff --git a/opcodes/po/opcodes.pot b/opcodes/po/opcodes.pot
index f7e3f0f..91145d3 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: 1999-04-18 19:01-0400\n"
+"POT-Creation-Date: 2000-02-25 22:16-0500\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,15 +22,58 @@
 msgid "jump hint unaligned"
 msgstr ""
 
-#: arm-dis.c:388
+#: arc-dis.c:231
+msgid "*unknown*"
+msgstr ""
+
+#: arc-opc.c:629
+msgid "unable to fit different valued constants into instruction"
+msgstr ""
+
+#: arc-opc.c:639
+msgid "auxiliary register not allowed here"
+msgstr ""
+
+#: arc-opc.c:652
+#, c-format
+msgid "invalid register number `%d'"
+msgstr ""
+
+#: arc-opc.c:775
+#, c-format
+msgid "value won't fit in range %ld - %ld"
+msgstr ""
+
+#: arc-opc.c:871
+msgid "branch address not on 4 byte boundary"
+msgstr ""
+
+#: arm-dis.c:470
 msgid "<illegal precision>"
 msgstr ""
 
+#: arm-dis.c:882
+#, c-format
+msgid "Unrecognised register name set: %s\n"
+msgstr ""
+
+#: arm-dis.c:889
+#, c-format
+msgid "Unrecognised disassembler option: %s\n"
+msgstr ""
+
+#: arm-dis.c:1053
+msgid ""
+"\n"
+"The following ARM specific disassembler options are supported for use with\n"
+"the -M switch:\n"
+msgstr ""
+
 #: cgen-asm.c:224
 msgid "unrecognized keyword/register name"
 msgstr ""
 
-#: cgen-asm.c:332 fr30-ibld.c:223 m32r-ibld.c:223
+#: cgen-asm.c:332 fr30-ibld.c:223 m32r-ibld.c:227
 #, c-format
 msgid "operand out of range (%ld not between %ld and %ld)"
 msgstr ""
@@ -46,83 +89,84 @@
 msgstr ""
 
 #. Can't happen.
-#: dis-buf.c:50
+#: dis-buf.c:56
 #, c-format
 msgid "Unknown error %d\n"
 msgstr ""
 
-#: dis-buf.c:55
+#: dis-buf.c:61
 #, c-format
 msgid "Address 0x%x is out of bounds.\n"
 msgstr ""
 
-#: fr30-asm.c:303 m32r-asm.c:319
+#: fr30-asm.c:305 m32r-asm.c:313
 #, c-format
 msgid "Unrecognized field %d while parsing.\n"
 msgstr ""
 
 #. We couldn't parse it.
-#: fr30-asm.c:367 fr30-asm.c:436 m32r-asm.c:383 m32r-asm.c:452
+#: fr30-asm.c:369 fr30-asm.c:373 fr30-asm.c:447 m32r-asm.c:377 m32r-asm.c:381
+#: m32r-asm.c:455
 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:404 m32r-asm.c:420
+#: fr30-asm.c:415 m32r-asm.c:423
 msgid "syntax error"
 msgstr ""
 
-#: fr30-asm.c:430 m32r-asm.c:446
+#: fr30-asm.c:441 m32r-asm.c:449
 msgid "junk at end of line"
 msgstr ""
 
-#: fr30-asm.c:523 m32r-asm.c:539
+#: fr30-asm.c:534 m32r-asm.c:552
 #, c-format
 msgid "bad instruction `%.50s...'"
 msgstr ""
 
-#: fr30-asm.c:526 m32r-asm.c:542
+#: fr30-asm.c:537 m32r-asm.c:555
 #, c-format
 msgid "bad instruction `%.50s'"
 msgstr ""
 
-#: fr30-dis.c:300 m32r-dis.c:247
+#: fr30-dis.c:300 m32r-dis.c:239
 #, c-format
 msgid "Unrecognized field %d while printing insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:210 m32r-ibld.c:210
+#: fr30-ibld.c:210 m32r-ibld.c:211
 #, c-format
 msgid "operand out of range (%lu not between 0 and %lu)"
 msgstr ""
 
-#: fr30-ibld.c:749 m32r-ibld.c:683
+#: fr30-ibld.c:745 m32r-ibld.c:679
 #, c-format
 msgid "Unrecognized field %d while building insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:952 m32r-ibld.c:819
+#: fr30-ibld.c:947 m32r-ibld.c:809
 #, c-format
 msgid "Unrecognized field %d while decoding insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:1096 m32r-ibld.c:932
+#: fr30-ibld.c:1091 m32r-ibld.c:914
 #, c-format
 msgid "Unrecognized field %d while getting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1225 m32r-ibld.c:1030
+#: fr30-ibld.c:1220 m32r-ibld.c:1004
 #, c-format
 msgid "Unrecognized field %d while getting vma operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1358 m32r-ibld.c:1132
+#: fr30-ibld.c:1349 m32r-ibld.c:1097
 #, c-format
 msgid "Unrecognized field %d while setting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1484 m32r-ibld.c:1227
+#: fr30-ibld.c:1471 m32r-ibld.c:1183
 #, c-format
 msgid "Unrecognized field %d while setting vma operand.\n"
 msgstr ""
@@ -158,7 +202,7 @@
 msgid "unknown\t0x%04lx"
 msgstr ""
 
-#: m10300-dis.c:706
+#: m10300-dis.c:680
 #, c-format
 msgid "unknown\t0x%04x"
 msgstr ""
@@ -168,7 +212,7 @@
 msgid "<internal error in opcode table: %s %s>\n"
 msgstr ""
 
-#: m68k-dis.c:967
+#: m68k-dis.c:988
 #, c-format
 msgid "<function code %d>"
 msgstr ""
@@ -178,7 +222,7 @@
 msgid "# <dis error: %08x>"
 msgstr ""
 
-#: mips-dis.c:373
+#: mips-dis.c:237
 #, c-format
 msgid "# internal error, undefined modifier(%c)"
 msgstr ""
@@ -222,21 +266,80 @@
 msgstr ""
 
 #. Mark as non-valid instruction
-#: sparc-dis.c:739
+#: sparc-dis.c:744
 msgid "unknown"
 msgstr ""
 
-#: sparc-dis.c:811
+#: sparc-dis.c:816
 #, c-format
 msgid "Internal error:  bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:822
+#: sparc-dis.c:827
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:871
+#: sparc-dis.c:876
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n"
 msgstr ""
+
+#: v850-dis.c:221
+#, c-format
+msgid "unknown operand shift: %x\n"
+msgstr ""
+
+#: v850-dis.c:233
+#, c-format
+msgid "unknown pop reg: %d\n"
+msgstr ""
+
+#. The functions used to insert and extract complicated operands.
+#. Note: There is a conspiracy between these functions and
+#. v850_insert_operand() in gas/config/tc-v850.c.  Error messages
+#. containing the string 'out of range' will be ignored unless a
+#. specific command line option is given to GAS.
+#: v850-opc.c:46
+msgid "displacement value is not in range and is not aligned"
+msgstr ""
+
+#: v850-opc.c:47
+msgid "displacement value is out of range"
+msgstr ""
+
+#: v850-opc.c:48
+msgid "displacement value is not aligned"
+msgstr ""
+
+#: v850-opc.c:50
+msgid "immediate value is out of range"
+msgstr ""
+
+#: v850-opc.c:61
+msgid "branch value not in range and to odd offset"
+msgstr ""
+
+#: v850-opc.c:63 v850-opc.c:95
+msgid "branch value out of range"
+msgstr ""
+
+#: v850-opc.c:66 v850-opc.c:98
+msgid "branch to odd offset"
+msgstr ""
+
+#: v850-opc.c:93
+msgid "branch value not in range and to an odd offset"
+msgstr ""
+
+#: v850-opc.c:321
+msgid "invalid register for stack adjustment"
+msgstr ""
+
+#: v850-opc.c:343
+msgid "immediate value not in range and not even"
+msgstr ""
+
+#: v850-opc.c:348
+msgid "immediate value must be even"
+msgstr ""
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 5921880..6e44e2d 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -1,5 +1,5 @@
 /* ppc-opc.c -- PowerPC opcode list
-   Copyright (c) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (c) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support
 
 This file is part of GDB, GAS, and the GNU binutils.
@@ -410,8 +410,8 @@
 static unsigned long
 insert_bat (insn, value, errmsg)
      unsigned long insn;
-     long value;
-     const char **errmsg;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (((insn >> 21) & 0x1f) << 16);
 }
@@ -437,8 +437,8 @@
 static unsigned long
 insert_bba (insn, value, errmsg)
      unsigned long insn;
-     long value;
-     const char **errmsg;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (((insn >> 16) & 0x1f) << 11);
 }
@@ -462,7 +462,7 @@
 insert_bd (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (value & 0xfffc);
 }
@@ -471,7 +471,7 @@
 static long
 extract_bd (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   if ((insn & 0x8000) != 0)
     return (insn & 0xfffc) - 0x10000;
@@ -491,7 +491,7 @@
 insert_bdm (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   if ((value & 0x8000) != 0)
     insn |= 1 << 21;
@@ -522,7 +522,7 @@
 insert_bdp (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   if ((value & 0x8000) == 0)
     insn |= 1 << 21;
@@ -643,7 +643,7 @@
 insert_ds (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (value & 0xfffc);
 }
@@ -652,7 +652,7 @@
 static long
 extract_ds (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   if ((insn & 0x8000) != 0)
     return (insn & 0xfffc) - 0x10000;
@@ -679,7 +679,7 @@
 static long
 extract_li (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   if ((insn & 0x2000000) != 0)
     return (insn & 0x3fffffc) - 0x4000000;
@@ -788,7 +788,7 @@
 insert_mb6 (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | ((value & 0x1f) << 6) | (value & 0x20);
 }
@@ -797,7 +797,7 @@
 static long
 extract_mb6 (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return ((insn >> 6) & 0x1f) | (insn & 0x20);
 }
@@ -822,7 +822,7 @@
 static long
 extract_nb (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   long ret;
 
@@ -842,7 +842,7 @@
 insert_nsi (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | ((- value) & 0xffff);
 }
@@ -915,8 +915,8 @@
 static unsigned long
 insert_rbs (insn, value, errmsg)
      unsigned long insn;
-     long value;
-     const char **errmsg;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | (((insn >> 21) & 0x1f) << 11);
 }
@@ -939,7 +939,7 @@
 insert_sh6 (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
 }
@@ -948,7 +948,7 @@
 static long
 extract_sh6 (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
 }
@@ -960,7 +960,7 @@
 insert_spr (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
 }
@@ -968,7 +968,7 @@
 static long
 extract_spr (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
 }
@@ -987,7 +987,7 @@
 insert_tbr (insn, value, errmsg)
      unsigned long insn;
      long value;
-     const char **errmsg;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   if (value == 0)
     value = TB;
@@ -997,7 +997,7 @@
 static long
 extract_tbr (insn, invalid)
      unsigned long insn;
-     int *invalid;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   long ret;
 
@@ -2688,7 +2688,7 @@
 { "nand",    XRC(31,476,0), X_MASK,	COM,		{ RA, RS, RB } },
 { "nand.",   XRC(31,476,1), X_MASK,	COM,		{ RA, RS, RB } },
 
-{ "dcread",  X(31,486),	XRT_MASK,	PPC403,		{ RA, RB } },
+{ "dcread",  X(31,486),	X_MASK,		PPC403,		{ RT, RA, RB }},
 
 { "nabs",    XO(31,488,0,0), XORB_MASK, M601,		{ RT, RA } },
 { "nabs.",   XO(31,488,0,1), XORB_MASK, M601,		{ RT, RA } },
diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c
index 2ebfdb6..bef6518 100644
--- a/opcodes/sh-dis.c
+++ b/opcodes/sh-dis.c
@@ -24,6 +24,256 @@
 
 #define LITTLE_BIT 2
 
+static void
+print_movxy (op, rn, rm, fprintf_fn, stream)
+     sh_opcode_info *op;
+     int rn, rm;
+     fprintf_ftype fprintf_fn;
+     void *stream;
+{
+  int n;
+
+  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);	
+	  break;
+	case A_INC_N:
+	  fprintf_fn (stream, "@r%d+", rn);	
+	  break;
+	case A_PMOD_N:
+	  fprintf_fn (stream, "@r%d+r8", rn);	
+	  break;
+	case A_PMODY_N:
+	  fprintf_fn (stream, "@r%d+r9", rn);	
+	  break;
+	case DSP_REG_M:
+	  fprintf_fn (stream, "a%c", '0' + rm);
+	  break;
+	case DSP_REG_X:
+	  fprintf_fn (stream, "x%c", '0' + rm);
+	  break;
+	case DSP_REG_Y:
+	  fprintf_fn (stream, "y%c", '0' + rm);
+	  break;
+	default:
+	  abort ();
+	}
+      if (n == 0)
+	fprintf_fn (stream, ",");	
+    }
+}
+
+/* Print a double data transfer insn.  INSN is just the lower three
+   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;
+     struct disassemble_info *info;
+{
+  fprintf_ftype fprintf_fn = info->fprintf_func;
+  void *stream = info->stream;
+
+  /* If this is just a nop, make sure to emit something.  */
+  if (insn == 0x000)
+    fprintf_fn (stream, "nopx\tnopy");
+
+  /* If a parallel processing insn was printed before,
+     and we got a non-nop, emit a tab.  */
+  if ((insn & 0x800) && (insn & 0x3ff))
+    fprintf_fn (stream, "\t");
+
+  /* Check if either the x or y part is invalid.  */
+  if (((insn & 0xc) == 0 && (insn & 0x2a0))
+      || ((insn & 3) == 0 && (insn & 0x150)))
+    fprintf_fn (stream, ".word 0x%x", insn);
+  else
+    {
+      static sh_opcode_info *first_movx, *first_movy;
+      sh_opcode_info *opx, *opy;
+      int insn_x, insn_y;
+
+      if (! first_movx)
+	{
+	  for (first_movx = sh_table; first_movx->nibbles[1] != MOVX; )
+	    first_movx++;
+	  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++;
+	  print_movxy (opx, ((insn >> 9) & 1) + 4, (insn >> 7) & 1,
+		       fprintf_fn, stream);
+	}
+      insn_y = (insn & 3) | ((insn >> 1) & 8);
+      if (insn_y)
+	{
+	  if (insn_x)
+	    fprintf_fn (stream, "\t");
+	  for (opy = first_movy; opy->nibbles[2] != insn_y; ) opy++;
+	  print_movxy (opy, ((insn >> 8) & 1) + 6, (insn >> 6) & 1,
+		       fprintf_fn, stream);
+	}
+    }
+}
+
+static void
+print_dsp_reg (rm, fprintf_fn, stream)
+     int rm;
+     fprintf_ftype fprintf_fn;
+     void *stream;
+{
+  switch (rm)
+    {
+    case A_A1_NUM:
+      fprintf_fn (stream, "a1");
+      break;
+    case A_A0_NUM:
+      fprintf_fn (stream, "a0");
+      break;
+    case A_X0_NUM:
+      fprintf_fn (stream, "x0");
+      break;
+    case A_X1_NUM:
+      fprintf_fn (stream, "x1");
+      break;
+    case A_Y0_NUM:
+      fprintf_fn (stream, "y0");
+      break;
+    case A_Y1_NUM:
+      fprintf_fn (stream, "y1");
+      break;
+    case A_M0_NUM:
+      fprintf_fn (stream, "m0");
+      break;
+    case A_A1G_NUM:
+      fprintf_fn (stream, "a1g");
+      break;
+    case A_M1_NUM:
+      fprintf_fn (stream, "m1");
+      break;
+    case A_A0G_NUM:
+      fprintf_fn (stream, "a0g");
+      break;
+    default:
+      fprintf_fn (stream, "0x%x", rm);
+      break;
+    }
+}
+
+static void
+print_insn_ppi (field_b, info)
+     int field_b;
+     struct disassemble_info *info;
+{
+  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;
+  sh_opcode_info *op;
+
+  if ((field_b & 0xe800) == 0)
+    {
+      fprintf_fn (stream, "psh%c\t#%d,",
+		  field_b & 0x1000 ? 'a' : 'l',
+		  (field_b >> 4) & 127);
+      print_dsp_reg (field_b & 0xf, fprintf_fn, stream);
+      return;
+    }
+  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"};
+
+      if (field_b & 0x2000)
+	{
+	  fprintf_fn (stream, "p%s %s,%s,%s\t",
+		      (field_b & 0x1000) ? "add" : "sub",
+		      sx_tab[(field_b >> 6) & 3],
+		      sy_tab[(field_b >> 4) & 3],
+		      du_tab[(field_b >> 0) & 3]);
+	}
+      fprintf_fn (stream, "pmuls%c%s,%s,%s",
+		  field_b & 0x2000 ? ' ' : '\t',
+		  se_tab[(field_b >> 10) & 3],
+		  sf_tab[(field_b >>  8) & 3],
+		  sg_tab[(field_b >>  2) & 3]);
+      return;
+    }
+
+  nib1 = PPIC;
+  nib2 = field_b >> 12 & 0xf;
+  nib3 = field_b >> 8 & 0xf;
+  switch (nib3 & 0x3)
+    {
+    case 0:
+      dc = "";
+      nib1 = PPI3;
+      break;
+    case 1:
+      dc = "";
+      break;
+    case 2:
+      dc = "dct ";
+      nib3 -= 1;
+      break;
+    case 3:
+      dc = "dcf ";
+      nib3 -= 2;
+      break;
+    }
+  for (op = sh_table; op->name; op++)
+    {
+      if (op->nibbles[1] == nib1
+	  && op->nibbles[2] == nib2
+	  && op->nibbles[3] == nib3)
+	{
+	  int n;
+
+	  fprintf_fn (stream, "%s%s\t", dc, op->name);
+	  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]) 
+		{
+		case DSP_REG_N:
+		  print_dsp_reg (field_b & 0xf, fprintf_fn, stream);
+		  break;
+		case DSP_REG_X:
+		  fprintf_fn (stream, sx_tab[(field_b >> 6) & 3]);
+		  break;
+		case DSP_REG_Y:
+		  fprintf_fn (stream, sy_tab[(field_b >> 4) & 3]);
+		  break;
+		case A_MACH:
+		  fprintf_fn (stream, "mach");
+		  break;
+		case A_MACL:
+		  fprintf_fn (stream ,"macl");
+		  break;
+		default:
+		  abort ();
+		}
+	    }
+	  return;
+	}
+    }
+  /* Not found.  */
+  fprintf_fn (stream, ".word 0x%x", field_b);
+}
+
 static int 
 print_insn_shx (memaddr, info)
      bfd_vma memaddr;
@@ -36,6 +286,34 @@
   int status;
   bfd_vma relmask = ~ (bfd_vma) 0;
   sh_opcode_info *op;
+  int target_arch;
+
+  switch (info->mach)
+    {
+    case bfd_mach_sh:
+      target_arch = arch_sh1;
+      break;
+    case bfd_mach_sh2:
+      target_arch = arch_sh2;
+      break;
+    case bfd_mach_sh_dsp:
+      target_arch = arch_sh_dsp;
+      break;
+    case bfd_mach_sh3:
+      target_arch = arch_sh3;
+      break;
+    case bfd_mach_sh3_dsp:
+      target_arch = arch_sh3_dsp;
+      break;
+    case bfd_mach_sh3e:
+      target_arch = arch_sh3e;
+      break;
+    case bfd_mach_sh4:
+      target_arch = arch_sh4;
+      break;
+    default:
+      abort ();
+    }
 
   status = info->read_memory_func (memaddr, insn, 2, info);
 
@@ -62,6 +340,32 @@
       nibs[3] = insn[1] & 0xf;
     }
 
+  if (nibs[0] == 0xf && (nibs[1] & 4) == 0 && target_arch & arch_sh_dsp_up)
+    {
+      if (nibs[1] & 8)
+	{
+	  int field_b;
+
+	  status = info->read_memory_func (memaddr + 2, insn, 2, info);
+
+	  if (status != 0) 
+	    {
+	      info->memory_error_func (status, memaddr + 2, info);
+	      return -1;
+	    }
+
+	  if (info->flags & LITTLE_BIT) 
+	    field_b = insn[1] << 8 | insn[0];
+	  else
+	    field_b = insn[0] << 8 | insn[1];
+
+	  print_insn_ppi (field_b, info);
+	  print_insn_ddt ((nibs[1] << 8) | (nibs[2] << 4) | nibs[3], info);
+	  return 4;
+	}
+      print_insn_ddt ((nibs[1] << 8) | (nibs[2] << 4) | nibs[3], info);
+      return 2;
+    }
   for (op = sh_table; op->name; op++) 
     {
       int n;
@@ -72,6 +376,8 @@
       int disp_pc;
       bfd_vma disp_pc_addr = 0;
 
+      if ((op->arch & target_arch) == 0)
+	goto fail;
       for (n = 0; n < 4; n++)
 	{
 	  int i = op->nibbles[n];
@@ -141,6 +447,16 @@
 	    case REG_B:
 	      rb = nibs[n] & 0x07;
 	      break;	
+	    case SDT_REG_N:
+	      /* sh-dsp: single data transfer.  */
+	      rn = nibs[n];
+	      if ((rn & 0xc) != 4)
+		goto fail;
+	      rn = rn & 0x3;
+	      rn |= (rn & 2) << 1;
+	      break;
+	    case PPI:
+	      goto fail;
 	    default:
 	      abort();
 	    }
@@ -176,6 +492,9 @@
 	    case A_DISP_REG_N:
 	      fprintf_fn (stream, "@(%d,r%d)", imm, rn);	
 	      break;
+	    case A_PMOD_N:
+	      fprintf_fn (stream, "@r%d+r8", rn);	
+	      break;
 	    case A_REG_M:
 	      fprintf_fn (stream, "r%d", rm);
 	      break;
@@ -224,6 +543,36 @@
 	    case A_VBR:
 	      fprintf_fn (stream, "vbr");
 	      break;
+	    case A_DSR:
+	      fprintf_fn (stream, "dsr");
+	      break;
+	    case A_MOD:
+	      fprintf_fn (stream, "mod");
+	      break;
+	    case A_RE:
+	      fprintf_fn (stream, "re");
+	      break;
+	    case A_RS:
+	      fprintf_fn (stream, "rs");
+	      break;
+	    case A_A0:
+	      fprintf_fn (stream, "a0");
+	      break;
+	    case A_X0:
+	      fprintf_fn (stream, "x0");
+	      break;
+	    case A_X1:
+	      fprintf_fn (stream, "x1");
+	      break;
+	    case A_Y0:
+	      fprintf_fn (stream, "y0");
+	      break;
+	    case A_Y1:
+	      fprintf_fn (stream, "y1");
+	      break;
+	    case DSP_REG_M:
+	      print_dsp_reg (rm, fprintf_fn, stream);
+	      break;
 	    case A_SSR:
 	      fprintf_fn (stream, "ssr");
 	      break;
@@ -245,9 +594,6 @@
 	    case A_DBR:
 	      fprintf_fn (stream, "dbr");
 	      break;
-	    case FD_REG_N:
-	      if (0)
-		goto d_reg_n;
 	    case F_REG_N:
 	      fprintf_fn (stream, "fr%d", rn);
 	      break;
diff --git a/opcodes/sh-opc.h b/opcodes/sh-opc.h
index dc1aae5..38bfbcd 100644
--- a/opcodes/sh-opc.h
+++ b/opcodes/sh-opc.h
@@ -34,6 +34,7 @@
 	HEX_F,
 	REG_N,
 	REG_M,
+	SDT_REG_N,
 	REG_NM,
         REG_B,
 	BRANCH_12,
@@ -47,7 +48,17 @@
 	PCRELIMM_8BY4,
 	IMM_8,
 	IMM_8BY2,
-	IMM_8BY4
+	IMM_8BY4,
+	PPI,
+	NOPX,
+	NOPY,
+	MOVX,
+	MOVY,
+	PSH,
+	PMUL,
+	PPI3,
+	PDC,
+	PPIC
 } sh_nibble_type;
 
 typedef enum {
@@ -66,6 +77,8 @@
 	A_INC_N,
 	A_IND_M,
 	A_IND_N,
+	A_PMOD_N,
+	A_PMODY_N,
 	A_IND_R0_REG_M,
 	A_IND_R0_REG_N,
 	A_MACH,
@@ -78,6 +91,22 @@
 	A_REG_B,
 	A_SR,
 	A_VBR,
+	A_MOD,
+	A_RE,
+	A_RS,
+	A_DSR,
+	DSP_REG_M,
+	DSP_REG_N,
+	DSP_REG_X,
+	DSP_REG_Y,
+	DSP_REG_E,
+	DSP_REG_F,
+	DSP_REG_G,
+	A_A0,
+	A_X0,
+	A_X1,
+	A_Y0,
+	A_Y1,
 	A_SSR,
 	A_SPC,
 	A_SGR,
@@ -92,7 +121,6 @@
 	DX_REG_M,
 	V_REG_N,
 	V_REG_M,
-	FD_REG_N,
 	XMTRX_M4,
 	F_FR0,
 	FPUL_N,
@@ -101,471 +129,700 @@
 	FPSCR_M
 } sh_arg_type;
 
+typedef enum {
+  A_A1_NUM =   5,
+  A_A0_NUM =   7,
+  A_X0_NUM, A_X1_NUM, A_Y0_NUM, A_Y1_NUM,
+  A_M0_NUM, A_A1G_NUM, A_M1_NUM, A_A0G_NUM
+} sh_dsp_reg_nums;
+
+#define arch_sh1     0x0001
+#define arch_sh2     0x0002
+#define arch_sh3     0x0004
+#define arch_sh3e    0x0008
+#define arch_sh4     0x0010
+#define arch_sh_dsp  0x0100
+#define arch_sh3_dsp 0x0200
+
+#define arch_sh1_up (arch_sh1 | arch_sh2_up)
+#define arch_sh2_up (arch_sh2 | arch_sh3_up | arch_sh_dsp)
+#define arch_sh3_up (arch_sh3 | arch_sh3e_up | arch_sh3_dsp)
+#define arch_sh3e_up (arch_sh3e | arch_sh4_up)
+#define arch_sh4_up arch_sh4
+
+#define arch_sh_dsp_up (arch_sh_dsp | arch_sh3_dsp_up)
+#define arch_sh3_dsp_up arch_sh3_dsp
+
 typedef struct {
   char *name;
   sh_arg_type arg[4];
   sh_nibble_type nibbles[4];
+  int arch;
 } sh_opcode_info;
 
 #ifdef DEFINE_TABLE
 
 sh_opcode_info sh_table[] = {
 
-/* 0111nnnni8*1.... add #<imm>,<REG_N>  */{"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM_8}},
+/* 0111nnnni8*1.... add #<imm>,<REG_N>  */{"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM_8}, arch_sh1_up},
 
-/* 0011nnnnmmmm1100 add <REG_M>,<REG_N> */{"add",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_C}},
+/* 0011nnnnmmmm1100 add <REG_M>,<REG_N> */{"add",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_C}, arch_sh1_up},
 
-/* 0011nnnnmmmm1110 addc <REG_M>,<REG_N>*/{"addc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_E}},
+/* 0011nnnnmmmm1110 addc <REG_M>,<REG_N>*/{"addc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_E}, arch_sh1_up},
 
-/* 0011nnnnmmmm1111 addv <REG_M>,<REG_N>*/{"addv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_F}},
+/* 0011nnnnmmmm1111 addv <REG_M>,<REG_N>*/{"addv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_F}, arch_sh1_up},
 
-/* 11001001i8*1.... and #<imm>,R0       */{"and",{A_IMM,A_R0},{HEX_C,HEX_9,IMM_8}},
+/* 11001001i8*1.... and #<imm>,R0       */{"and",{A_IMM,A_R0},{HEX_C,HEX_9,IMM_8}, arch_sh1_up},
 
-/* 0010nnnnmmmm1001 and <REG_M>,<REG_N> */{"and",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_9}},
+/* 0010nnnnmmmm1001 and <REG_M>,<REG_N> */{"and",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_9}, arch_sh1_up},
 
-/* 11001101i8*1.... and.b #<imm>,@(R0,GBR)*/{"and.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_D,IMM_8}},
+/* 11001101i8*1.... and.b #<imm>,@(R0,GBR)*/{"and.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_D,IMM_8}, arch_sh1_up},
 
-/* 1010i12......... bra <bdisp12>       */{"bra",{A_BDISP12},{HEX_A,BRANCH_12}},
+/* 1010i12......... bra <bdisp12>       */{"bra",{A_BDISP12},{HEX_A,BRANCH_12}, arch_sh1_up},
 
-/* 1011i12......... bsr <bdisp12>       */{"bsr",{A_BDISP12},{HEX_B,BRANCH_12}},
+/* 1011i12......... bsr <bdisp12>       */{"bsr",{A_BDISP12},{HEX_B,BRANCH_12}, arch_sh1_up},
 
-/* 10001001i8p1.... bt <bdisp8>         */{"bt",{A_BDISP8},{HEX_8,HEX_9,BRANCH_8}},
+/* 10001001i8p1.... bt <bdisp8>         */{"bt",{A_BDISP8},{HEX_8,HEX_9,BRANCH_8}, arch_sh1_up},
 
-/* 10001011i8p1.... bf <bdisp8>         */{"bf",{A_BDISP8},{HEX_8,HEX_B,BRANCH_8}},
+/* 10001011i8p1.... bf <bdisp8>         */{"bf",{A_BDISP8},{HEX_8,HEX_B,BRANCH_8}, arch_sh1_up},
 
-/* 10001101i8p1.... bt.s <bdisp8>       */{"bt.s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}},
+/* 10001101i8p1.... bt.s <bdisp8>       */{"bt.s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}, arch_sh2_up},
 
-/* 10001101i8p1.... bt/s <bdisp8>       */{"bt/s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}},
+/* 10001101i8p1.... bt/s <bdisp8>       */{"bt/s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}, arch_sh2_up},
 
-/* 10001111i8p1.... bf.s <bdisp8>       */{"bf.s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}},
+/* 10001111i8p1.... bf.s <bdisp8>       */{"bf.s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}, arch_sh2_up},
 
-/* 10001111i8p1.... bf/s <bdisp8>       */{"bf/s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}},
+/* 10001111i8p1.... bf/s <bdisp8>       */{"bf/s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}, arch_sh2_up},
 
-/* 0000000000101000 clrmac              */{"clrmac",{0},{HEX_0,HEX_0,HEX_2,HEX_8}},
+/* 0000000000101000 clrmac              */{"clrmac",{0},{HEX_0,HEX_0,HEX_2,HEX_8}, arch_sh1_up},
 
-/* 0000000001001000 clrs                */{"clrs",{0},{HEX_0,HEX_0,HEX_4,HEX_8}},
+/* 0000000001001000 clrs                */{"clrs",{0},{HEX_0,HEX_0,HEX_4,HEX_8}, arch_sh1_up},
 
-/* 0000000000001000 clrt                */{"clrt",{0},{HEX_0,HEX_0,HEX_0,HEX_8}},
+/* 0000000000001000 clrt                */{"clrt",{0},{HEX_0,HEX_0,HEX_0,HEX_8}, arch_sh1_up},
 
-/* 10001000i8*1.... cmp/eq #<imm>,R0    */{"cmp/eq",{A_IMM,A_R0},{HEX_8,HEX_8,IMM_8}},
+/* 10001000i8*1.... cmp/eq #<imm>,R0    */{"cmp/eq",{A_IMM,A_R0},{HEX_8,HEX_8,IMM_8}, arch_sh1_up},
 
-/* 0011nnnnmmmm0000 cmp/eq <REG_M>,<REG_N>*/{"cmp/eq",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_0}},
+/* 0011nnnnmmmm0000 cmp/eq <REG_M>,<REG_N>*/{"cmp/eq",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_0}, arch_sh1_up},
 
-/* 0011nnnnmmmm0011 cmp/ge <REG_M>,<REG_N>*/{"cmp/ge",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_3}},
+/* 0011nnnnmmmm0011 cmp/ge <REG_M>,<REG_N>*/{"cmp/ge",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_3}, arch_sh1_up},
 
-/* 0011nnnnmmmm0111 cmp/gt <REG_M>,<REG_N>*/{"cmp/gt",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_7}},
+/* 0011nnnnmmmm0111 cmp/gt <REG_M>,<REG_N>*/{"cmp/gt",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_7}, arch_sh1_up},
 
-/* 0011nnnnmmmm0110 cmp/hi <REG_M>,<REG_N>*/{"cmp/hi",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_6}},
+/* 0011nnnnmmmm0110 cmp/hi <REG_M>,<REG_N>*/{"cmp/hi",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_6}, arch_sh1_up},
 
-/* 0011nnnnmmmm0010 cmp/hs <REG_M>,<REG_N>*/{"cmp/hs",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_2}},
+/* 0011nnnnmmmm0010 cmp/hs <REG_M>,<REG_N>*/{"cmp/hs",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_2}, arch_sh1_up},
 
-/* 0100nnnn00010101 cmp/pl <REG_N>      */{"cmp/pl",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_5}},
+/* 0100nnnn00010101 cmp/pl <REG_N>      */{"cmp/pl",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_5}, arch_sh1_up},
 
-/* 0100nnnn00010001 cmp/pz <REG_N>      */{"cmp/pz",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_1}},
+/* 0100nnnn00010001 cmp/pz <REG_N>      */{"cmp/pz",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_1}, arch_sh1_up},
 
-/* 0010nnnnmmmm1100 cmp/str <REG_M>,<REG_N>*/{"cmp/str",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_C}},
+/* 0010nnnnmmmm1100 cmp/str <REG_M>,<REG_N>*/{"cmp/str",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_C}, arch_sh1_up},
 
-/* 0010nnnnmmmm0111 div0s <REG_M>,<REG_N>*/{"div0s",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_7}},
+/* 0010nnnnmmmm0111 div0s <REG_M>,<REG_N>*/{"div0s",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_7}, arch_sh1_up},
 
-/* 0000000000011001 div0u               */{"div0u",{0},{HEX_0,HEX_0,HEX_1,HEX_9}},
+/* 0000000000011001 div0u               */{"div0u",{0},{HEX_0,HEX_0,HEX_1,HEX_9}, arch_sh1_up},
 
-/* 0011nnnnmmmm0100 div1 <REG_M>,<REG_N>*/{"div1",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_4}},
+/* 0011nnnnmmmm0100 div1 <REG_M>,<REG_N>*/{"div1",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_4}, arch_sh1_up},
 
-/* 0110nnnnmmmm1110 exts.b <REG_M>,<REG_N>*/{"exts.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_E}},
+/* 0110nnnnmmmm1110 exts.b <REG_M>,<REG_N>*/{"exts.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_E}, arch_sh1_up},
 
-/* 0110nnnnmmmm1111 exts.w <REG_M>,<REG_N>*/{"exts.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_F}},
+/* 0110nnnnmmmm1111 exts.w <REG_M>,<REG_N>*/{"exts.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_F}, arch_sh1_up},
 
-/* 0110nnnnmmmm1100 extu.b <REG_M>,<REG_N>*/{"extu.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_C}},
+/* 0110nnnnmmmm1100 extu.b <REG_M>,<REG_N>*/{"extu.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_C}, arch_sh1_up},
 
-/* 0110nnnnmmmm1101 extu.w <REG_M>,<REG_N>*/{"extu.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_D}},
+/* 0110nnnnmmmm1101 extu.w <REG_M>,<REG_N>*/{"extu.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_D}, arch_sh1_up},
 
-/* 0100nnnn00101011 jmp @<REG_N>        */{"jmp",{A_IND_N},{HEX_4,REG_N,HEX_2,HEX_B}},
+/* 0100nnnn00101011 jmp @<REG_N>        */{"jmp",{A_IND_N},{HEX_4,REG_N,HEX_2,HEX_B}, arch_sh1_up},
 
-/* 0100nnnn00001011 jsr @<REG_N>        */{"jsr",{A_IND_N},{HEX_4,REG_N,HEX_0,HEX_B}},
+/* 0100nnnn00001011 jsr @<REG_N>        */{"jsr",{A_IND_N},{HEX_4,REG_N,HEX_0,HEX_B}, arch_sh1_up},
 
-/* 0100nnnn00001110 ldc <REG_N>,SR      */{"ldc",{A_REG_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_E}},
+/* 0100nnnn00001110 ldc <REG_N>,SR      */{"ldc",{A_REG_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_E}, arch_sh1_up},
 
-/* 0100nnnn00011110 ldc <REG_N>,GBR     */{"ldc",{A_REG_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_E}},
+/* 0100nnnn00011110 ldc <REG_N>,GBR     */{"ldc",{A_REG_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_E}, arch_sh1_up},
 
-/* 0100nnnn00101110 ldc <REG_N>,VBR     */{"ldc",{A_REG_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_E}},
+/* 0100nnnn00101110 ldc <REG_N>,VBR     */{"ldc",{A_REG_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_E}, arch_sh1_up},
 
-/* 0100nnnn00111110 ldc <REG_N>,SSR     */{"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}},
+/* 0100nnnn01011110 ldc <REG_N>,MOD     */{"ldc",{A_REG_N,A_MOD},{HEX_4,REG_N,HEX_5,HEX_E}, arch_sh_dsp_up},
 
-/* 0100nnnn01001110 ldc <REG_N>,SPC     */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}},
+/* 0100nnnn01111110 ldc <REG_N>,RE     */{"ldc",{A_REG_N,A_RE},{HEX_4,REG_N,HEX_7,HEX_E}, arch_sh_dsp_up},
 
-/* 0100nnnn01111110 ldc <REG_N>,DBR     */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_7,HEX_E}},
+/* 0100nnnn01101110 ldc <REG_N>,RS     */{"ldc",{A_REG_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_E}, arch_sh_dsp_up},
 
-/* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}},
+/* 0100nnnn00111110 ldc <REG_N>,SSR     */{"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}, arch_sh3_up},
 
-/* 0100nnnn00000111 ldc.l @<REG_N>+,SR  */{"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}},
+/* 0100nnnn01001110 ldc <REG_N>,SPC     */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}, arch_sh3_up},
 
-/* 0100nnnn00010111 ldc.l @<REG_N>+,GBR */{"ldc.l",{A_INC_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_7}},
+/* 0100nnnn11111010 ldc <REG_N>,DBR     */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_up},
 
-/* 0100nnnn00100111 ldc.l @<REG_N>+,VBR */{"ldc.l",{A_INC_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_7}},
+/* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}, arch_sh3_up},
 
-/* 0100nnnn00110111 ldc.l @<REG_N>+,SSR */{"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}},
+/* 0100nnnn00000111 ldc.l @<REG_N>+,SR  */{"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}, arch_sh1_up},
 
-/* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}},
+/* 0100nnnn00010111 ldc.l @<REG_N>+,GBR */{"ldc.l",{A_INC_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_7}, arch_sh1_up},
 
-/* 0100nnnn01110111 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_7,HEX_7}},
+/* 0100nnnn00100111 ldc.l @<REG_N>+,VBR */{"ldc.l",{A_INC_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_7}, arch_sh1_up},
 
-/* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}},
+/* 0100nnnn01010111 ldc.l @<REG_N>+,MOD */{"ldc.l",{A_INC_N,A_MOD},{HEX_4,REG_N,HEX_5,HEX_7}, arch_sh_dsp_up},
 
-/* 0100nnnn00001010 lds <REG_N>,MACH    */{"lds",{A_REG_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_A}},
+/* 0100nnnn01110111 ldc.l @<REG_N>+,RE */{"ldc.l",{A_INC_N,A_RE},{HEX_4,REG_N,HEX_7,HEX_7}, arch_sh_dsp_up},
 
-/* 0100nnnn00011010 lds <REG_N>,MACL    */{"lds",{A_REG_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_A}},
+/* 0100nnnn01100111 ldc.l @<REG_N>+,RS */{"ldc.l",{A_INC_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_7}, arch_sh_dsp_up},
 
-/* 0100nnnn00101010 lds <REG_N>,PR      */{"lds",{A_REG_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_A}},
+/* 0100nnnn00110111 ldc.l @<REG_N>+,SSR */{"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}, arch_sh3_up},
 
-/* 0100nnnn01011010 lds <REG_N>,FPUL    */{"lds",{A_REG_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_A}},
+/* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}, arch_sh3_up},
 
-/* 0100nnnn01101010 lds <REG_M>,FPSCR   */{"lds",{A_REG_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_A}},
+/* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_up},
 
-/* 0100nnnn00000110 lds.l @<REG_N>+,MACH*/{"lds.l",{A_INC_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_6}},
+/* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}, arch_sh3_up},
 
-/* 0100nnnn00010110 lds.l @<REG_N>+,MACL*/{"lds.l",{A_INC_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_6}},
+/* 10001110i8p2.... ldre @(<disp>,PC)	*/{"ldre",{A_BDISP8},{HEX_8,HEX_E,BRANCH_8}, arch_sh_dsp_up},
 
-/* 0100nnnn00100110 lds.l @<REG_N>+,PR  */{"lds.l",{A_INC_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_6}},
+/* 10001100i8p2.... ldrs @(<disp>,PC)	*/{"ldrs",{A_BDISP8},{HEX_8,HEX_C,BRANCH_8}, arch_sh_dsp_up},
 
-/* 0100nnnn01010110 lds.l @<REG_M>+,FPUL*/{"lds.l",{A_INC_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_6}},
+/* 0100nnnn00001010 lds <REG_N>,MACH    */{"lds",{A_REG_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_A}, arch_sh1_up},
 
-/* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}},
+/* 0100nnnn00011010 lds <REG_N>,MACL    */{"lds",{A_REG_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_A}, arch_sh1_up},
 
-/* 0000000000111000 ldtlb               */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}},
+/* 0100nnnn00101010 lds <REG_N>,PR      */{"lds",{A_REG_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_A}, arch_sh1_up},
 
-/* 0100nnnnmmmm1111 mac.w @<REG_M>+,@<REG_N>+*/{"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}},
+/* 0100nnnn01101010 lds <REG_N>,DSR	*/{"lds",{A_REG_N,A_DSR},{HEX_4,REG_N,HEX_6,HEX_A}, arch_sh_dsp_up},
 
-/* 1110nnnni8*1.... mov #<imm>,<REG_N>  */{"mov",{A_IMM,A_REG_N},{HEX_E,REG_N,IMM_8}},
+/* 0100nnnn01111010 lds <REG_N>,A0	*/{"lds",{A_REG_N,A_A0},{HEX_4,REG_N,HEX_7,HEX_A}, arch_sh_dsp_up},
 
-/* 0110nnnnmmmm0011 mov <REG_M>,<REG_N> */{"mov",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_3}},
+/* 0100nnnn10001010 lds <REG_N>,X0	*/{"lds",{A_REG_N,A_X0},{HEX_4,REG_N,HEX_8,HEX_A}, arch_sh_dsp_up},
 
-/* 0000nnnnmmmm0100 mov.b <REG_M>,@(R0,<REG_N>)*/{"mov.b",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_4}},
+/* 0100nnnn10011010 lds <REG_N>,X1	*/{"lds",{A_REG_N,A_X1},{HEX_4,REG_N,HEX_9,HEX_A}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm0100 mov.b <REG_M>,@-<REG_N>*/{"mov.b",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_4}},
+/* 0100nnnn10101010 lds <REG_N>,Y0	*/{"lds",{A_REG_N,A_Y0},{HEX_4,REG_N,HEX_A,HEX_A}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm0000 mov.b <REG_M>,@<REG_N>*/{"mov.b",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_0}},
+/* 0100nnnn10111010 lds <REG_N>,Y1	*/{"lds",{A_REG_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up},
 
-/* 10000100mmmmi4*1 mov.b @(<disp>,<REG_M>),R0*/{"mov.b",{A_DISP_REG_M,A_R0},{HEX_8,HEX_4,REG_M,IMM_4}},
+/* 0100nnnn01011010 lds <REG_N>,FPUL    */{"lds",{A_REG_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_A}, arch_sh3e_up},
 
-/* 11000100i8*1.... mov.b @(<disp>,GBR),R0*/{"mov.b",{A_DISP_GBR,A_R0},{HEX_C,HEX_4,IMM_8}},
+/* 0100nnnn01101010 lds <REG_M>,FPSCR   */{"lds",{A_REG_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_A}, arch_sh3e_up},
 
-/* 0000nnnnmmmm1100 mov.b @(R0,<REG_M>),<REG_N>*/{"mov.b",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_C}},
+/* 0100nnnn00000110 lds.l @<REG_N>+,MACH*/{"lds.l",{A_INC_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_6}, arch_sh1_up},
 
-/* 0110nnnnmmmm0100 mov.b @<REG_M>+,<REG_N>*/{"mov.b",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_4}},
+/* 0100nnnn00010110 lds.l @<REG_N>+,MACL*/{"lds.l",{A_INC_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_6}, arch_sh1_up},
 
-/* 0110nnnnmmmm0000 mov.b @<REG_M>,<REG_N>*/{"mov.b",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_0}},
+/* 0100nnnn00100110 lds.l @<REG_N>+,PR  */{"lds.l",{A_INC_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_6}, arch_sh1_up},
 
-/* 10000000mmmmi4*1 mov.b R0,@(<disp>,<REG_M>)*/{"mov.b",{A_R0,A_DISP_REG_M},{HEX_8,HEX_0,REG_M,IMM_4}},
+/* 0100nnnn01100110 lds.l @<REG_N>+,DSR	*/{"lds.l",{A_INC_N,A_DSR},{HEX_4,REG_N,HEX_6,HEX_6}, arch_sh_dsp_up},
 
-/* 11000000i8*1.... mov.b R0,@(<disp>,GBR)*/{"mov.b",{A_R0,A_DISP_GBR},{HEX_C,HEX_0,IMM_8}},
+/* 0100nnnn01110110 lds.l @<REG_N>+,A0	*/{"lds.l",{A_INC_N,A_A0},{HEX_4,REG_N,HEX_7,HEX_6}, arch_sh_dsp_up},
 
-/* 0001nnnnmmmmi4*4 mov.l <REG_M>,@(<disp>,<REG_N>)*/{"mov.l",{ A_REG_M,A_DISP_REG_N},{HEX_1,REG_N,REG_M,IMM_4BY4}},
+/* 0100nnnn10000110 lds.l @<REG_N>+,X0	*/{"lds.l",{A_INC_N,A_X0},{HEX_4,REG_N,HEX_8,HEX_6}, arch_sh_dsp_up},
 
-/* 0000nnnnmmmm0110 mov.l <REG_M>,@(R0,<REG_N>)*/{"mov.l",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_6}},
+/* 0100nnnn10010110 lds.l @<REG_N>+,X1	*/{"lds.l",{A_INC_N,A_X1},{HEX_4,REG_N,HEX_9,HEX_6}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm0110 mov.l <REG_M>,@-<REG_N>*/{"mov.l",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_6}},
+/* 0100nnnn10100110 lds.l @<REG_N>+,Y0	*/{"lds.l",{A_INC_N,A_Y0},{HEX_4,REG_N,HEX_A,HEX_6}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm0010 mov.l <REG_M>,@<REG_N>*/{"mov.l",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_2}},
+/* 0100nnnn10110110 lds.l @<REG_N>+,Y1	*/{"lds.l",{A_INC_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_6}, arch_sh_dsp_up},
 
-/* 0101nnnnmmmmi4*4 mov.l @(<disp>,<REG_M>),<REG_N>*/{"mov.l",{A_DISP_REG_M,A_REG_N},{HEX_5,REG_N,REG_M,IMM_4BY4}},
+/* 0100nnnn01010110 lds.l @<REG_M>+,FPUL*/{"lds.l",{A_INC_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_6}, arch_sh3e_up},
 
-/* 11000110i8*4.... mov.l @(<disp>,GBR),R0*/{"mov.l",{A_DISP_GBR,A_R0},{HEX_C,HEX_6,IMM_8BY4}},
+/* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}, arch_sh3e_up},
 
-/* 1101nnnni8p4.... mov.l @(<disp>,PC),<REG_N>*/{"mov.l",{A_DISP_PC,A_REG_N},{HEX_D,REG_N,PCRELIMM_8BY4}},
+/* 0000000000111000 ldtlb               */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}, arch_sh3_up},
 
-/* 0000nnnnmmmm1110 mov.l @(R0,<REG_M>),<REG_N>*/{"mov.l",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_E}},
+/* 0100nnnnmmmm1111 mac.w @<REG_M>+,@<REG_N>+*/{"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}, arch_sh1_up},
 
-/* 0110nnnnmmmm0110 mov.l @<REG_M>+,<REG_N>*/{"mov.l",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_6}},
+/* 1110nnnni8*1.... mov #<imm>,<REG_N>  */{"mov",{A_IMM,A_REG_N},{HEX_E,REG_N,IMM_8}, arch_sh1_up},
 
-/* 0110nnnnmmmm0010 mov.l @<REG_M>,<REG_N>*/{"mov.l",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_2}},
+/* 0110nnnnmmmm0011 mov <REG_M>,<REG_N> */{"mov",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_3}, arch_sh1_up},
 
-/* 11000010i8*4.... mov.l R0,@(<disp>,GBR)*/{"mov.l",{A_R0,A_DISP_GBR},{HEX_C,HEX_2,IMM_8BY4}},
+/* 0000nnnnmmmm0100 mov.b <REG_M>,@(R0,<REG_N>)*/{"mov.b",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_4}, arch_sh1_up},
 
-/* 0000nnnnmmmm0101 mov.w <REG_M>,@(R0,<REG_N>)*/{"mov.w",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_5}},
+/* 0010nnnnmmmm0100 mov.b <REG_M>,@-<REG_N>*/{"mov.b",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_4}, arch_sh1_up},
 
-/* 0010nnnnmmmm0101 mov.w <REG_M>,@-<REG_N>*/{"mov.w",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_5}},
+/* 0010nnnnmmmm0000 mov.b <REG_M>,@<REG_N>*/{"mov.b",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_0}, arch_sh1_up},
 
-/* 0010nnnnmmmm0001 mov.w <REG_M>,@<REG_N>*/{"mov.w",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_1}},
+/* 10000100mmmmi4*1 mov.b @(<disp>,<REG_M>),R0*/{"mov.b",{A_DISP_REG_M,A_R0},{HEX_8,HEX_4,REG_M,IMM_4}, arch_sh1_up},
 
-/* 10000101mmmmi4*2 mov.w @(<disp>,<REG_M>),R0*/{"mov.w",{A_DISP_REG_M,A_R0},{HEX_8,HEX_5,REG_M,IMM_4BY2}},
+/* 11000100i8*1.... mov.b @(<disp>,GBR),R0*/{"mov.b",{A_DISP_GBR,A_R0},{HEX_C,HEX_4,IMM_8}, arch_sh1_up},
 
-/* 11000101i8*2.... mov.w @(<disp>,GBR),R0*/{"mov.w",{A_DISP_GBR,A_R0},{HEX_C,HEX_5,IMM_8BY2}},
+/* 0000nnnnmmmm1100 mov.b @(R0,<REG_M>),<REG_N>*/{"mov.b",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_C}, arch_sh1_up},
 
-/* 1001nnnni8p2.... mov.w @(<disp>,PC),<REG_N>*/{"mov.w",{A_DISP_PC,A_REG_N},{HEX_9,REG_N,PCRELIMM_8BY2}},
+/* 0110nnnnmmmm0100 mov.b @<REG_M>+,<REG_N>*/{"mov.b",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_4}, arch_sh1_up},
 
-/* 0000nnnnmmmm1101 mov.w @(R0,<REG_M>),<REG_N>*/{"mov.w",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_D}},
+/* 0110nnnnmmmm0000 mov.b @<REG_M>,<REG_N>*/{"mov.b",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_0}, arch_sh1_up},
 
-/* 0110nnnnmmmm0101 mov.w @<REG_M>+,<REG_N>*/{"mov.w",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_5}},
+/* 10000000mmmmi4*1 mov.b R0,@(<disp>,<REG_M>)*/{"mov.b",{A_R0,A_DISP_REG_M},{HEX_8,HEX_0,REG_M,IMM_4}, arch_sh1_up},
 
-/* 0110nnnnmmmm0001 mov.w @<REG_M>,<REG_N>*/{"mov.w",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_1}},
+/* 11000000i8*1.... mov.b R0,@(<disp>,GBR)*/{"mov.b",{A_R0,A_DISP_GBR},{HEX_C,HEX_0,IMM_8}, arch_sh1_up},
 
-/* 10000001mmmmi4*2 mov.w R0,@(<disp>,<REG_M>)*/{"mov.w",{A_R0,A_DISP_REG_M},{HEX_8,HEX_1,REG_M,IMM_4BY2}},
+/* 0001nnnnmmmmi4*4 mov.l <REG_M>,@(<disp>,<REG_N>)*/{"mov.l",{ A_REG_M,A_DISP_REG_N},{HEX_1,REG_N,REG_M,IMM_4BY4}, arch_sh1_up},
 
-/* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM_8BY2}},
+/* 0000nnnnmmmm0110 mov.l <REG_M>,@(R0,<REG_N>)*/{"mov.l",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_6}, arch_sh1_up},
 
-/* 11000111i8p4.... mova @(<disp>,PC),R0*/{"mova",{A_DISP_PC,A_R0},{HEX_C,HEX_7,PCRELIMM_8BY4}},
-/* 0000nnnn11000011 movca.l R0,@<REG_N> */{"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}},
+/* 0010nnnnmmmm0110 mov.l <REG_M>,@-<REG_N>*/{"mov.l",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_6}, arch_sh1_up},
 
+/* 0010nnnnmmmm0010 mov.l <REG_M>,@<REG_N>*/{"mov.l",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_2}, arch_sh1_up},
 
-/* 0000nnnn00101001 movt <REG_N>        */{"movt",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_9}},
+/* 0101nnnnmmmmi4*4 mov.l @(<disp>,<REG_M>),<REG_N>*/{"mov.l",{A_DISP_REG_M,A_REG_N},{HEX_5,REG_N,REG_M,IMM_4BY4}, arch_sh1_up},
 
-/* 0010nnnnmmmm1111 muls <REG_M>,<REG_N>*/{"muls",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}},
+/* 11000110i8*4.... mov.l @(<disp>,GBR),R0*/{"mov.l",{A_DISP_GBR,A_R0},{HEX_C,HEX_6,IMM_8BY4}, arch_sh1_up},
 
-/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}},
+/* 1101nnnni8p4.... mov.l @(<disp>,PC),<REG_N>*/{"mov.l",{A_DISP_PC,A_REG_N},{HEX_D,REG_N,PCRELIMM_8BY4}, arch_sh1_up},
 
-/* 0010nnnnmmmm1110 mulu <REG_M>,<REG_N>*/{"mulu",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}},
+/* 0000nnnnmmmm1110 mov.l @(R0,<REG_M>),<REG_N>*/{"mov.l",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_E}, arch_sh1_up},
 
-/* 0110nnnnmmmm1011 neg <REG_M>,<REG_N> */{"neg",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_B}},
+/* 0110nnnnmmmm0110 mov.l @<REG_M>+,<REG_N>*/{"mov.l",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_6}, arch_sh1_up},
 
-/* 0110nnnnmmmm1010 negc <REG_M>,<REG_N>*/{"negc",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_A}},
+/* 0110nnnnmmmm0010 mov.l @<REG_M>,<REG_N>*/{"mov.l",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_2}, arch_sh1_up},
 
-/* 0000000000001001 nop                 */{"nop",{0},{HEX_0,HEX_0,HEX_0,HEX_9}},
+/* 11000010i8*4.... mov.l R0,@(<disp>,GBR)*/{"mov.l",{A_R0,A_DISP_GBR},{HEX_C,HEX_2,IMM_8BY4}, arch_sh1_up},
 
-/* 0110nnnnmmmm0111 not <REG_M>,<REG_N> */{"not",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_7}},
-/* 0000nnnn10010011 ocbi @<REG_N>       */{"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}},
+/* 0000nnnnmmmm0101 mov.w <REG_M>,@(R0,<REG_N>)*/{"mov.w",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_5}, arch_sh1_up},
 
-/* 0000nnnn10100011 ocbp @<REG_N>       */{"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}},
+/* 0010nnnnmmmm0101 mov.w <REG_M>,@-<REG_N>*/{"mov.w",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_5}, arch_sh1_up},
+
+/* 0010nnnnmmmm0001 mov.w <REG_M>,@<REG_N>*/{"mov.w",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_1}, arch_sh1_up},
+
+/* 10000101mmmmi4*2 mov.w @(<disp>,<REG_M>),R0*/{"mov.w",{A_DISP_REG_M,A_R0},{HEX_8,HEX_5,REG_M,IMM_4BY2}, arch_sh1_up},
+
+/* 11000101i8*2.... mov.w @(<disp>,GBR),R0*/{"mov.w",{A_DISP_GBR,A_R0},{HEX_C,HEX_5,IMM_8BY2}, arch_sh1_up},
+
+/* 1001nnnni8p2.... mov.w @(<disp>,PC),<REG_N>*/{"mov.w",{A_DISP_PC,A_REG_N},{HEX_9,REG_N,PCRELIMM_8BY2}, arch_sh1_up},
+
+/* 0000nnnnmmmm1101 mov.w @(R0,<REG_M>),<REG_N>*/{"mov.w",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_D}, arch_sh1_up},
+
+/* 0110nnnnmmmm0101 mov.w @<REG_M>+,<REG_N>*/{"mov.w",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_5}, arch_sh1_up},
+
+/* 0110nnnnmmmm0001 mov.w @<REG_M>,<REG_N>*/{"mov.w",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_1}, arch_sh1_up},
+
+/* 10000001mmmmi4*2 mov.w R0,@(<disp>,<REG_M>)*/{"mov.w",{A_R0,A_DISP_REG_M},{HEX_8,HEX_1,REG_M,IMM_4BY2}, arch_sh1_up},
+
+/* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM_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},
+
+
+/* 0000nnnn00101001 movt <REG_N>        */{"movt",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_9}, arch_sh1_up},
+
+/* 0010nnnnmmmm1111 muls.w <REG_M>,<REG_N>*/{"muls.w",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up},
+/* 0010nnnnmmmm1111 muls <REG_M>,<REG_N>*/{"muls",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up},
+
+/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}, arch_sh2_up},
+
+/* 0010nnnnmmmm1110 mulu.w <REG_M>,<REG_N>*/{"mulu.w",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}, arch_sh1_up},
+/* 0010nnnnmmmm1110 mulu <REG_M>,<REG_N>*/{"mulu",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}, arch_sh1_up},
+
+/* 0110nnnnmmmm1011 neg <REG_M>,<REG_N> */{"neg",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_B}, arch_sh1_up},
+
+/* 0110nnnnmmmm1010 negc <REG_M>,<REG_N>*/{"negc",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_A}, arch_sh1_up},
+
+/* 0000000000001001 nop                 */{"nop",{0},{HEX_0,HEX_0,HEX_0,HEX_9}, arch_sh1_up},
+
+/* 0110nnnnmmmm0111 not <REG_M>,<REG_N> */{"not",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_7}, arch_sh1_up},
+/* 0000nnnn10010011 ocbi @<REG_N>       */{"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}, arch_sh4_up},
+
+/* 0000nnnn10100011 ocbp @<REG_N>       */{"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}, arch_sh4_up},
+
+/* 0000nnnn10110011 ocbwb @<REG_N>      */{"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}, arch_sh4_up},
+
+
+/* 11001011i8*1.... or #<imm>,R0        */{"or",{A_IMM,A_R0},{HEX_C,HEX_B,IMM_8}, arch_sh1_up},
+
+/* 0010nnnnmmmm1011 or <REG_M>,<REG_N>  */{"or",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_B}, arch_sh1_up},
+
+/* 11001111i8*1.... or.b #<imm>,@(R0,GBR)*/{"or.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_F,IMM_8}, arch_sh1_up},
+
+/* 0000nnnn10000011 pref @<REG_N>       */{"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}, arch_sh4_up},
+
+/* 0100nnnn00100100 rotcl <REG_N>       */{"rotcl",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_4}, arch_sh1_up},
+
+/* 0100nnnn00100101 rotcr <REG_N>       */{"rotcr",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_5}, arch_sh1_up},
+
+/* 0100nnnn00000100 rotl <REG_N>        */{"rotl",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_4}, arch_sh1_up},
+
+/* 0100nnnn00000101 rotr <REG_N>        */{"rotr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_5}, arch_sh1_up},
+
+/* 0000000000101011 rte                 */{"rte",{0},{HEX_0,HEX_0,HEX_2,HEX_B}, arch_sh1_up},
+
+/* 0000000000001011 rts                 */{"rts",{0},{HEX_0,HEX_0,HEX_0,HEX_B}, arch_sh1_up},
+
+/* 0000000001011000 sets                */{"sets",{0},{HEX_0,HEX_0,HEX_5,HEX_8}, arch_sh1_up},
+/* 0000000000011000 sett                */{"sett",{0},{HEX_0,HEX_0,HEX_1,HEX_8}, arch_sh1_up},
+
+/* 0100nnnn00010100 setrc <REG_N>       */{"setrc",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_4}, arch_sh_dsp_up},
+
+/* 10000010i8*1.... setrc #<imm>        */{"setrc",{A_IMM},{HEX_8,HEX_2,IMM_8}, arch_sh_dsp_up},
+
+/* 0100nnnnmmmm1100 shad <REG_M>,<REG_N>*/{"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}, arch_sh3_up},
+
+/* 0100nnnnmmmm1101 shld <REG_M>,<REG_N>*/{"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}, arch_sh3_up},
+
+/* 0100nnnn00100000 shal <REG_N>        */{"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}, arch_sh1_up},
+
+/* 0100nnnn00100001 shar <REG_N>        */{"shar",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_1}, arch_sh1_up},
+
+/* 0100nnnn00000000 shll <REG_N>        */{"shll",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_0}, arch_sh1_up},
+
+/* 0100nnnn00101000 shll16 <REG_N>      */{"shll16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_8}, arch_sh1_up},
+
+/* 0100nnnn00001000 shll2 <REG_N>       */{"shll2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_8}, arch_sh1_up},
+
+/* 0100nnnn00011000 shll8 <REG_N>       */{"shll8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_8}, arch_sh1_up},
+
+/* 0100nnnn00000001 shlr <REG_N>        */{"shlr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_1}, arch_sh1_up},
+
+/* 0100nnnn00101001 shlr16 <REG_N>      */{"shlr16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_9}, arch_sh1_up},
+
+/* 0100nnnn00001001 shlr2 <REG_N>       */{"shlr2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_9}, arch_sh1_up},
+
+/* 0100nnnn00011001 shlr8 <REG_N>       */{"shlr8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_9}, arch_sh1_up},
+
+/* 0000000000011011 sleep               */{"sleep",{0},{HEX_0,HEX_0,HEX_1,HEX_B}, arch_sh1_up},
+
+/* 0000nnnn00000010 stc SR,<REG_N>      */{"stc",{A_SR,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_2}, arch_sh1_up},
+
+/* 0000nnnn00010010 stc GBR,<REG_N>     */{"stc",{A_GBR,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_2}, arch_sh1_up},
+
+/* 0000nnnn00100010 stc VBR,<REG_N>     */{"stc",{A_VBR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_2}, arch_sh1_up},
+
+/* 0000nnnn01010010 stc MOD,<REG_N>     */{"stc",{A_MOD,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_2}, arch_sh_dsp_up},
+
+/* 0000nnnn01110010 stc RE,<REG_N>     */{"stc",{A_RE,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_2}, arch_sh_dsp_up},
+
+/* 0000nnnn01100010 stc RS,<REG_N>     */{"stc",{A_RS,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up},
+
+/* 0000nnnn00110010 stc SSR,<REG_N>     */{"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}, arch_sh3_up},
+
+/* 0000nnnn01000010 stc SPC,<REG_N>     */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}, arch_sh3_up},
+
+/* 0000nnnn00111010 stc SGR,<REG_N>     */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_up},
+
+/* 0000nnnn11111010 stc DBR,<REG_N>     */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_up},
+
+/* 0000nnnn1xxx0010 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}, arch_sh3_up},
+
+/* 0100nnnn00000011 stc.l SR,@-<REG_N>  */{"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}, arch_sh1_up},
 
-/* 0000nnnn10110011 ocbwb @<REG_N>      */{"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}},
+/* 0100nnnn00100011 stc.l VBR,@-<REG_N> */{"stc.l",{A_VBR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_3}, arch_sh1_up},
 
+/* 0100nnnn01010011 stc.l MOD,@-<REG_N> */{"stc.l",{A_MOD,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_3}, arch_sh_dsp_up},
 
-/* 11001011i8*1.... or #<imm>,R0        */{"or",{A_IMM,A_R0},{HEX_C,HEX_B,IMM_8}},
+/* 0100nnnn01110011 stc.l RE,@-<REG_N>  */{"stc.l",{A_RE,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_3}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm1011 or <REG_M>,<REG_N>  */{"or",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_B}},
+/* 0100nnnn01100011 stc.l RS,@-<REG_N>  */{"stc.l",{A_RS,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}, arch_sh_dsp_up},
 
-/* 11001111i8*1.... or.b #<imm>,@(R0,GBR)*/{"or.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_F,IMM_8}},
+/* 0100nnnn00110011 stc.l SSR,@-<REG_N> */{"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}, arch_sh3_up},
 
-/* 0000nnnn10000011 pref @<REG_N>       */{"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}},
+/* 0100nnnn01000011 stc.l SPC,@-<REG_N> */{"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}, arch_sh3_up},
 
-/* 0100nnnn00100100 rotcl <REG_N>       */{"rotcl",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_4}},
+/* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}, arch_sh4_up},
 
-/* 0100nnnn00100101 rotcr <REG_N>       */{"rotcr",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_5}},
+/* 0100nnnn00110010 stc.l SGR,@-<REG_N> */{"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_2}, arch_sh4_up},
 
-/* 0100nnnn00000100 rotl <REG_N>        */{"rotl",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_4}},
+/* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_up},
 
-/* 0100nnnn00000101 rotr <REG_N>        */{"rotr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_5}},
+/* 0100nnnn1xxx0011 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}, arch_sh3_up},
 
-/* 0000000000101011 rte                 */{"rte",{0},{HEX_0,HEX_0,HEX_2,HEX_B}},
+/* 0000nnnn00001010 sts MACH,<REG_N>    */{"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}, arch_sh1_up},
 
-/* 0000000000001011 rts                 */{"rts",{0},{HEX_0,HEX_0,HEX_0,HEX_B}},
+/* 0000nnnn00011010 sts MACL,<REG_N>    */{"sts",{A_MACL,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_A}, arch_sh1_up},
 
-/* 0000000001011000 sets                */{"sets",{0},{HEX_0,HEX_0,HEX_5,HEX_8}},
-/* 0000000000011000 sett                */{"sett",{0},{HEX_0,HEX_0,HEX_1,HEX_8}},
+/* 0000nnnn00101010 sts PR,<REG_N>      */{"sts",{A_PR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_A}, arch_sh1_up},
 
-/* 0100nnnnmmmm1100 shad <REG_M>,<REG_N>*/{"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}},
+/* 0000nnnn01101010 sts DSR,<REG_N>	*/{"sts",{A_DSR,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnnmmmm1101 shld <REG_M>,<REG_N>*/{"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}},
+/* 0000nnnn01111010 sts A0,<REG_N>	*/{"sts",{A_A0,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnn00100000 shal <REG_N>        */{"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}},
+/* 0000nnnn10001010 sts X0,<REG_N>	*/{"sts",{A_X0,A_REG_N},{HEX_0,REG_N,HEX_8,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnn00100001 shar <REG_N>        */{"shar",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_1}},
+/* 0000nnnn10011010 sts X1,<REG_N>	*/{"sts",{A_X1,A_REG_N},{HEX_0,REG_N,HEX_9,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnn00000000 shll <REG_N>        */{"shll",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_0}},
+/* 0000nnnn10101010 sts Y0,<REG_N>	*/{"sts",{A_Y0,A_REG_N},{HEX_0,REG_N,HEX_A,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnn00101000 shll16 <REG_N>      */{"shll16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_8}},
+/* 0000nnnn10111010 sts Y1,<REG_N>	*/{"sts",{A_Y1,A_REG_N},{HEX_0,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up},
 
-/* 0100nnnn00001000 shll2 <REG_N>       */{"shll2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_8}},
+/* 0000nnnn01011010 sts FPUL,<REG_N>    */{"sts",{FPUL_M,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_A}, arch_sh3e_up},
 
-/* 0100nnnn00011000 shll8 <REG_N>       */{"shll8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_8}},
+/* 0000nnnn01101010 sts FPSCR,<REG_N>   */{"sts",{FPSCR_M,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}, arch_sh3e_up},
 
-/* 0100nnnn00000001 shlr <REG_N>        */{"shlr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_1}},
+/* 0100nnnn00000010 sts.l MACH,@-<REG_N>*/{"sts.l",{A_MACH,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_2}, arch_sh1_up},
 
-/* 0100nnnn00101001 shlr16 <REG_N>      */{"shlr16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_9}},
+/* 0100nnnn00010010 sts.l MACL,@-<REG_N>*/{"sts.l",{A_MACL,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_2}, arch_sh1_up},
 
-/* 0100nnnn00001001 shlr2 <REG_N>       */{"shlr2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_9}},
+/* 0100nnnn00100010 sts.l PR,@-<REG_N>  */{"sts.l",{A_PR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_2}, arch_sh1_up},
 
-/* 0100nnnn00011001 shlr8 <REG_N>       */{"shlr8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_9}},
+/* 0100nnnn01100110 sts.l DSR,@-<REG_N>	*/{"sts.l",{A_DSR,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up},
 
-/* 0000000000011011 sleep               */{"sleep",{0},{HEX_0,HEX_0,HEX_1,HEX_B}},
+/* 0100nnnn01110110 sts.l A0,@-<REG_N>	*/{"sts.l",{A_A0,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn00000010 stc SR,<REG_N>      */{"stc",{A_SR,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_2}},
+/* 0100nnnn10000110 sts.l X0,@-<REG_N>	*/{"sts.l",{A_X0,A_DEC_N},{HEX_4,REG_N,HEX_8,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn00010010 stc GBR,<REG_N>     */{"stc",{A_GBR,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_2}},
+/* 0100nnnn10010110 sts.l X1,@-<REG_N>	*/{"sts.l",{A_X1,A_DEC_N},{HEX_4,REG_N,HEX_9,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn00100010 stc VBR,<REG_N>     */{"stc",{A_VBR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_2}},
+/* 0100nnnn10100110 sts.l Y0,@-<REG_N>	*/{"sts.l",{A_Y0,A_DEC_N},{HEX_4,REG_N,HEX_A,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn00110010 stc SSR,<REG_N>     */{"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}},
+/* 0100nnnn10110110 sts.l Y1,@-<REG_N>	*/{"sts.l",{A_Y1,A_DEC_N},{HEX_4,REG_N,HEX_B,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn01000010 stc SPC,<REG_N>     */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}},
+/* 0100nnnn01010010 sts.l FPUL,@-<REG_N>*/{"sts.l",{FPUL_M,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_2}, arch_sh3e_up},
 
-/* 0000nnnn01100010 stc SGR,<REG_N>     */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}},
+/* 0100nnnn01100010 sts.l FPSCR,@-<REG_N>*/{"sts.l",{FPSCR_M,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}, arch_sh3e_up},
 
-/* 0000nnnn01110010 stc DBR,<REG_N>     */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_2}},
+/* 0011nnnnmmmm1000 sub <REG_M>,<REG_N> */{"sub",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_8}, arch_sh1_up},
 
-/* 0000nnnn1xxx0012 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}},
+/* 0011nnnnmmmm1010 subc <REG_M>,<REG_N>*/{"subc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_A}, arch_sh1_up},
 
-/* 0100nnnn00000011 stc.l SR,@-<REG_N>  */{"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}},
+/* 0011nnnnmmmm1011 subv <REG_M>,<REG_N>*/{"subv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_B}, arch_sh1_up},
 
-/* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}},
+/* 0110nnnnmmmm1000 swap.b <REG_M>,<REG_N>*/{"swap.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_8}, arch_sh1_up},
 
-/* 0100nnnn00100011 stc.l VBR,@-<REG_N> */{"stc.l",{A_VBR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_3}},
+/* 0110nnnnmmmm1001 swap.w <REG_M>,<REG_N>*/{"swap.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_9}, arch_sh1_up},
 
-/* 0100nnnn00110011 stc.l SSR,@-<REG_N> */{"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}},
+/* 0100nnnn00011011 tas.b @<REG_N>      */{"tas.b",{A_IND_N},{HEX_4,REG_N,HEX_1,HEX_B}, arch_sh1_up},
 
-/* 0100nnnn01000011 stc.l SPC,@-<REG_N> */{"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}},
+/* 11000011i8*1.... trapa #<imm>        */{"trapa",{A_IMM},{HEX_C,HEX_3,IMM_8}, arch_sh1_up},
 
-/* 0100nnnn01100011 stc.l SGR,@-<REG_N> */{"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}},
+/* 11001000i8*1.... tst #<imm>,R0       */{"tst",{A_IMM,A_R0},{HEX_C,HEX_8,IMM_8}, arch_sh1_up},
 
-/* 0100nnnn01110011 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_3}},
+/* 0010nnnnmmmm1000 tst <REG_M>,<REG_N> */{"tst",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_8}, arch_sh1_up},
 
-/* 0100nnnn1xxx0012 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}},
+/* 11001100i8*1.... tst.b #<imm>,@(R0,GBR)*/{"tst.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_C,IMM_8}, arch_sh1_up},
 
-/* 0000nnnn00001010 sts MACH,<REG_N>    */{"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}},
+/* 11001010i8*1.... xor #<imm>,R0       */{"xor",{A_IMM,A_R0},{HEX_C,HEX_A,IMM_8}, arch_sh1_up},
 
-/* 0000nnnn00011010 sts MACL,<REG_N>    */{"sts",{A_MACL,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_A}},
+/* 0010nnnnmmmm1010 xor <REG_M>,<REG_N> */{"xor",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_A}, arch_sh1_up},
 
-/* 0000nnnn00101010 sts PR,<REG_N>      */{"sts",{A_PR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_A}},
+/* 11001110i8*1.... xor.b #<imm>,@(R0,GBR)*/{"xor.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_E,IMM_8}, arch_sh1_up},
 
-/* 0000nnnn01011010 sts FPUL,<REG_N>    */{"sts",{FPUL_M,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_A}},
+/* 0010nnnnmmmm1101 xtrct <REG_M>,<REG_N>*/{"xtrct",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_D}, arch_sh1_up},
 
-/* 0000nnnn01101010 sts FPSCR,<REG_N>   */{"sts",{FPSCR_M,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}},
+/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}, arch_sh1_up},
 
-/* 0100nnnn00000010 sts.l MACH,@-<REG_N>*/{"sts.l",{A_MACH,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_2}},
+/* 0100nnnn00010000 dt <REG_N>          */{"dt",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_0}, arch_sh2_up},
 
-/* 0100nnnn00010010 sts.l MACL,@-<REG_N>*/{"sts.l",{A_MACL,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_2}},
+/* 0011nnnnmmmm1101 dmuls.l <REG_M>,<REG_N>*/{"dmuls.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_D}, arch_sh2_up},
 
-/* 0100nnnn00100010 sts.l PR,@-<REG_N>  */{"sts.l",{A_PR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_2}},
+/* 0011nnnnmmmm0101 dmulu.l <REG_M>,<REG_N>*/{"dmulu.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_5}, arch_sh2_up},
 
-/* 0100nnnn01010010 sts.l FPUL,@-<REG_N>*/{"sts.l",{FPUL_M,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_2}},
+/* 0000nnnnmmmm1111 mac.l @<REG_M>+,@<REG_N>+*/{"mac.l",{A_INC_M,A_INC_N},{HEX_0,REG_N,REG_M,HEX_F}, arch_sh2_up},
 
-/* 0100nnnn01100010 sts.l FPSCR,@-<REG_N>*/{"sts.l",{FPSCR_M,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}},
+/* 0000nnnn00100011 braf <REG_N>       */{"braf",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_3}, arch_sh2_up},
 
-/* 0011nnnnmmmm1000 sub <REG_M>,<REG_N> */{"sub",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_8}},
+/* 0000nnnn00000011 bsrf <REG_N>       */{"bsrf",{A_REG_N},{HEX_0,REG_N,HEX_0,HEX_3}, arch_sh2_up},
 
-/* 0011nnnnmmmm1010 subc <REG_M>,<REG_N>*/{"subc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_A}},
+/* 111101nnmmmm0000 movs.w @-<REG_N>,<DSP_REG_M> */   {"movs.w",{A_DEC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_0}, arch_sh_dsp_up},
 
-/* 0011nnnnmmmm1011 subv <REG_M>,<REG_N>*/{"subv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_B}},
+/* 111101nnmmmm0001 movs.w @<REG_N>,<DSP_REG_M> */    {"movs.w",{A_IND_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_1}, arch_sh_dsp_up},
 
-/* 0110nnnnmmmm1000 swap.b <REG_M>,<REG_N>*/{"swap.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_8}},
+/* 111101nnmmmm0010 movs.w @<REG_N>+,<DSP_REG_M> */   {"movs.w",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_2}, arch_sh_dsp_up},
 
-/* 0110nnnnmmmm1001 swap.w <REG_M>,<REG_N>*/{"swap.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_9}},
+/* 111101nnmmmm0011 movs.w @<REG_N>+r8,<DSP_REG_M> */ {"movs.w",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_3}, arch_sh_dsp_up},
 
-/* 0100nnnn00011011 tas.b @<REG_N>      */{"tas.b",{A_IND_N},{HEX_4,REG_N,HEX_1,HEX_B}},
+/* 111101nnmmmm0100 movs.w <DSP_REG_M>,@-<REG_N> */   {"movs.w",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_4}, arch_sh_dsp_up},
 
-/* 11000011i8*1.... trapa #<imm>        */{"trapa",{A_IMM},{HEX_C,HEX_3,IMM_8}},
+/* 111101nnmmmm0101 movs.w <DSP_REG_M>,@<REG_N> */    {"movs.w",{DSP_REG_M,A_IND_N},{HEX_F,SDT_REG_N,REG_M,HEX_5}, arch_sh_dsp_up},
 
-/* 11001000i8*1.... tst #<imm>,R0       */{"tst",{A_IMM,A_R0},{HEX_C,HEX_8,IMM_8}},
+/* 111101nnmmmm0110 movs.w <DSP_REG_M>,@<REG_N>+ */   {"movs.w",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_6}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm1000 tst <REG_M>,<REG_N> */{"tst",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_8}},
+/* 111101nnmmmm0111 movs.w <DSP_REG_M>,@<REG_N>+r8 */ {"movs.w",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_7}, arch_sh_dsp_up},
 
-/* 11001100i8*1.... tst.b #<imm>,@(R0,GBR)*/{"tst.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_C,IMM_8}},
+/* 111101nnmmmm1000 movs.l @-<REG_N>,<DSP_REG_M> */   {"movs.l",{A_DEC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_8}, arch_sh_dsp_up},
 
-/* 11001010i8*1.... xor #<imm>,R0       */{"xor",{A_IMM,A_R0},{HEX_C,HEX_A,IMM_8}},
+/* 111101nnmmmm1001 movs.l @<REG_N>,<DSP_REG_M> */    {"movs.l",{A_IND_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_9}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm1010 xor <REG_M>,<REG_N> */{"xor",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_A}},
+/* 111101nnmmmm1010 movs.l @<REG_N>+,<DSP_REG_M> */   {"movs.l",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_A}, arch_sh_dsp_up},
 
-/* 11001110i8*1.... xor.b #<imm>,@(R0,GBR)*/{"xor.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_E,IMM_8}},
+/* 111101nnmmmm1011 movs.l @<REG_N>+r8,<DSP_REG_M> */ {"movs.l",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_B}, arch_sh_dsp_up},
 
-/* 0010nnnnmmmm1101 xtrct <REG_M>,<REG_N>*/{"xtrct",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_D}},
+/* 111101nnmmmm1100 movs.l <DSP_REG_M>,@-<REG_N> */   {"movs.l",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_C}, arch_sh_dsp_up},
 
-/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}},
+/* 111101nnmmmm1101 movs.l <DSP_REG_M>,@<REG_N> */    {"movs.l",{DSP_REG_M,A_IND_N},{HEX_F,SDT_REG_N,REG_M,HEX_D}, arch_sh_dsp_up},
 
-/* 0100nnnn00010000 dt <REG_N>          */{"dt",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_0}},
+/* 111101nnmmmm1110 movs.l <DSP_REG_M>,@<REG_N>+ */   {"movs.l",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_E}, arch_sh_dsp_up},
 
-/* 0011nnnnmmmm1101 dmuls.l <REG_M>,<REG_N>*/{"dmuls.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_D}},
+/* 111101nnmmmm1111 movs.l <DSP_REG_M>,@<REG_N>+r8 */ {"movs.l",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_F}, arch_sh_dsp_up},
 
-/* 0011nnnnmmmm0101 dmulu.l <REG_M>,<REG_N>*/{"dmulu.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_5}},
+/* 0*0*0*00** nopx */ {"nopx",{0},{PPI,NOPX}, arch_sh_dsp_up},
+/* *0*0*0**00 nopy */ {"nopy",{0},{PPI,NOPY}, arch_sh_dsp_up},
+/* n*m*0*01** movx.w @<REG_N>,<DSP_REG_X> */    {"movx.w",{A_IND_N,DSP_REG_X},{PPI,MOVX,HEX_1}, arch_sh_dsp_up},
+/* n*m*0*10** movx.w @<REG_N>+,<DSP_REG_X> */   {"movx.w",{A_INC_N,DSP_REG_X},{PPI,MOVX,HEX_2}, arch_sh_dsp_up},
+/* n*m*0*11** movx.w @<REG_N>+r8,<DSP_REG_X> */ {"movx.w",{A_PMOD_N,DSP_REG_X},{PPI,MOVX,HEX_3}, arch_sh_dsp_up},
+/* n*m*1*01** movx.w <DSP_REG_M>,@<REG_N> */    {"movx.w",{DSP_REG_M,A_IND_N},{PPI,MOVX,HEX_9}, arch_sh_dsp_up},
+/* n*m*1*10** movx.w <DSP_REG_M>,@<REG_N>+ */   {"movx.w",{DSP_REG_M,A_INC_N},{PPI,MOVX,HEX_A}, arch_sh_dsp_up},
+/* n*m*1*11** movx.w <DSP_REG_M>,@<REG_N>+r8 */ {"movx.w",{DSP_REG_M,A_PMOD_N},{PPI,MOVX,HEX_B}, arch_sh_dsp_up},
+/* *n*m*0**01 movy.w @<REG_N>,<DSP_REG_Y> */    {"movy.w",{A_IND_N,DSP_REG_Y},{PPI,MOVY,HEX_1}, arch_sh_dsp_up},
+/* *n*m*0**10 movy.w @<REG_N>+,<DSP_REG_Y> */   {"movy.w",{A_INC_N,DSP_REG_Y},{PPI,MOVY,HEX_2}, arch_sh_dsp_up},
+/* *n*m*0**11 movy.w @<REG_N>+r9,<DSP_REG_Y> */ {"movy.w",{A_PMODY_N,DSP_REG_Y},{PPI,MOVY,HEX_3}, arch_sh_dsp_up},
+/* *n*m*1**01 movy.w <DSP_REG_M>,@<REG_N> */    {"movy.w",{DSP_REG_M,A_IND_N},{PPI,MOVY,HEX_9}, arch_sh_dsp_up},
+/* *n*m*1**10 movy.w <DSP_REG_M>,@<REG_N>+ */   {"movy.w",{DSP_REG_M,A_INC_N},{PPI,MOVY,HEX_A}, arch_sh_dsp_up},
+/* *n*m*1**11 movy.w <DSP_REG_M>,@<REG_N>+r9 */ {"movy.w",{DSP_REG_M,A_PMODY_N},{PPI,MOVY,HEX_B}, arch_sh_dsp_up},
 
-/* 0000nnnnmmmm1111 mac.l @<REG_M>+,@<REG_N>+*/{"mac.l",{A_INC_M,A_INC_N},{HEX_0,REG_N,REG_M,HEX_F}},
+/* 01aaeeffxxyyggnn pmuls Se,Sf,Dg */ {"pmuls",{DSP_REG_E,DSP_REG_F,DSP_REG_G},{PPI,PMUL}, arch_sh_dsp_up},
+/* 10100000xxyynnnn psubc <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"psubc",{DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_0}, arch_sh_dsp_up},
+/* 10110000xxyynnnn paddc <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"paddc",{DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_0}, arch_sh_dsp_up},
+/* 10000100xxyynnnn pcmp <DSP_REG_X>,<DSP_REG_Y> */
+{"pcmp", {DSP_REG_X,DSP_REG_Y},{PPI,PPI3,HEX_8,HEX_4}, arch_sh_dsp_up},
+/* 10100100xxyynnnn pwsb <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"pwsb", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_4}, arch_sh_dsp_up},
+/* 10110100xxyynnnn pwad <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"pwad", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_4}, arch_sh_dsp_up},
+/* 10001000xxyynnnn pabs <DSP_REG_X>,<DSP_REG_N> */
+{"pabs", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_8,HEX_8}, arch_sh_dsp_up},
+/* 10011000xxyynnnn prnd <DSP_REG_X>,<DSP_REG_N> */
+{"prnd", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_9,HEX_8}, arch_sh_dsp_up},
+/* 10101000xxyynnnn pabs <DSP_REG_Y>,<DSP_REG_N> */
+{"pabs", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_8}, arch_sh_dsp_up},
+/* 10111000xxyynnnn prnd <DSP_REG_Y>,<DSP_REG_N> */
+{"prnd", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_8}, arch_sh_dsp_up},
 
-/* 0000nnnn00100011 braf <REG_N>       */{"braf",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_3}},
+{"dct",{0},{PPI,PDC,HEX_1}, arch_sh_dsp_up},
+{"dcf",{0},{PPI,PDC,HEX_2}, arch_sh_dsp_up},
 
-/* 0000nnnn00000011 bsrf <REG_N>       */{"bsrf",{A_REG_N},{HEX_0,REG_N,HEX_0,HEX_3}},
+/* 00000iiiiiiinnnn pshl #<imm>,<DSP_REG_N> */ {"pshl",{A_IMM,DSP_REG_N},{PPI,PSH,HEX_0}, arch_sh_dsp_up},
+/* 10000001xxyynnnn pshl <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"pshl", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_1}, arch_sh_dsp_up},
+/* 00010iiiiiiinnnn psha #<imm>,<DSP_REG_N> */ {"psha",{A_IMM,DSP_REG_N},{PPI,PSH,HEX_1}, arch_sh_dsp_up},
+/* 10010001xxyynnnn psha <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"psha", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_1}, arch_sh_dsp_up},
+/* 10100001xxyynnnn psub <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"psub", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_1}, arch_sh_dsp_up},
+/* 10110001xxyynnnn padd <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"padd", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_1}, arch_sh_dsp_up},
+/* 10010101xxyynnnn pand <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"pand", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_5}, arch_sh_dsp_up},
+/* 10100101xxyynnnn pxor <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"pxor", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_5}, arch_sh_dsp_up},
+/* 10110101xxyynnnn por  <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */
+{"por",  {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_5}, arch_sh_dsp_up},
+/* 10001001xxyynnnn pdec <DSP_REG_X>,<DSP_REG_N> */
+{"pdec", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_9}, arch_sh_dsp_up},
+/* 10011001xxyynnnn pinc <DSP_REG_X>,<DSP_REG_N> */
+{"pinc", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_9}, arch_sh_dsp_up},
+/* 10101001xxyynnnn pdec <DSP_REG_Y>,<DSP_REG_N> */
+{"pdec", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_9}, arch_sh_dsp_up},
+/* 10111001xxyynnnn pinc <DSP_REG_Y>,<DSP_REG_N> */
+{"pinc", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_9}, arch_sh_dsp_up},
+/* 10001101xxyynnnn pclr <DSP_REG_N> */
+{"pclr", {DSP_REG_N},{PPI,PPIC,HEX_8,HEX_D}, arch_sh_dsp_up},
+/* 10011101xxyynnnn pdmsb <DSP_REG_X>,<DSP_REG_N> */
+{"pdmsb", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_D}, arch_sh_dsp_up},
+/* 10111101xxyynnnn pdmsb <DSP_REG_Y>,<DSP_REG_N> */
+{"pdmsb", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_D}, arch_sh_dsp_up},
+/* 11001001xxyynnnn pneg  <DSP_REG_X>,<DSP_REG_N> */
+{"pneg",  {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_C,HEX_9}, arch_sh_dsp_up},
+/* 11011001xxyynnnn pcopy <DSP_REG_X>,<DSP_REG_N> */
+{"pcopy", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_D,HEX_9}, arch_sh_dsp_up},
+/* 11101001xxyynnnn pneg  <DSP_REG_Y>,<DSP_REG_N> */
+{"pneg",  {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_E,HEX_9}, arch_sh_dsp_up},
+/* 11111001xxyynnnn pcopy <DSP_REG_Y>,<DSP_REG_N> */
+{"pcopy", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_F,HEX_9}, arch_sh_dsp_up},
+/* 11001101xxyynnnn psts MACH,<DSP_REG_N> */
+{"psts", {A_MACH,DSP_REG_N},{PPI,PPIC,HEX_C,HEX_D}, arch_sh_dsp_up},
+/* 11011101xxyynnnn psts MACL,<DSP_REG_N> */
+{"psts", {A_MACL,DSP_REG_N},{PPI,PPIC,HEX_D,HEX_D}, arch_sh_dsp_up},
+/* 11101101xxyynnnn plds <DSP_REG_N>,MACH */
+{"plds", {DSP_REG_N,A_MACH},{PPI,PPIC,HEX_E,HEX_D}, arch_sh_dsp_up},
+/* 11111101xxyynnnn plds <DSP_REG_N>,MACL */
+{"plds", {DSP_REG_N,A_MACL},{PPI,PPIC,HEX_F,HEX_D}, arch_sh_dsp_up},
 
-/* 1111nnnn01011101 fabs <F_REG_N>     */{"fabs",{FD_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}},
+/* 1111nnnn01011101 fabs <F_REG_N>     */{"fabs",{F_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh3e_up},
+/* 1111nnnn01011101 fabs <D_REG_N>     */{"fabs",{D_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh4_up},
 
-/* 1111nnnnmmmm0000 fadd <F_REG_M>,<F_REG_N>*/{"fadd",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_0}},
-/* 1111nnn0mmm00000 fadd <D_REG_M>,<D_REG_N>*/{"fadd",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_0}},
+/* 1111nnnnmmmm0000 fadd <F_REG_M>,<F_REG_N>*/{"fadd",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_0}, arch_sh3e_up},
+/* 1111nnn0mmm00000 fadd <D_REG_M>,<D_REG_N>*/{"fadd",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_0}, arch_sh4_up},
 
-/* 1111nnnnmmmm0100 fcmp/eq <F_REG_M>,<F_REG_N>*/{"fcmp/eq",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_4}},
-/* 1111nnn0mmm00100 fcmp/eq <D_REG_M>,<D_REG_N>*/{"fcmp/eq",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_4}},
+/* 1111nnnnmmmm0100 fcmp/eq <F_REG_M>,<F_REG_N>*/{"fcmp/eq",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_4}, arch_sh3e_up},
+/* 1111nnn0mmm00100 fcmp/eq <D_REG_M>,<D_REG_N>*/{"fcmp/eq",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_4}, arch_sh4_up},
 
-/* 1111nnnnmmmm0101 fcmp/gt <F_REG_M>,<F_REG_N>*/{"fcmp/gt",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_5}},
-/* 1111nnn0mmm00101 fcmp/gt <D_REG_M>,<D_REG_N>*/{"fcmp/gt",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_5}},
+/* 1111nnnnmmmm0101 fcmp/gt <F_REG_M>,<F_REG_N>*/{"fcmp/gt",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_5}, arch_sh3e_up},
+/* 1111nnn0mmm00101 fcmp/gt <D_REG_M>,<D_REG_N>*/{"fcmp/gt",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_5}, arch_sh4_up},
 
-/* 1111nnn010111101 fcnvds <D_REG_N>,FPUL*/{"fcnvds",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_B,HEX_D}},
+/* 1111nnn010111101 fcnvds <D_REG_N>,FPUL*/{"fcnvds",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_B,HEX_D}, arch_sh4_up},
 
-/* 1111nnn010101101 fcnvsd FPUL,<D_REG_N>*/{"fcnvsd",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_A,HEX_D}},
+/* 1111nnn010101101 fcnvsd FPUL,<D_REG_N>*/{"fcnvsd",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_A,HEX_D}, arch_sh4_up},
 
-/* 1111nnnnmmmm0011 fdiv <F_REG_M>,<F_REG_N>*/{"fdiv",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_3}},
-/* 1111nnn0mmm00011 fdiv <D_REG_M>,<D_REG_N>*/{"fdiv",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_3}},
+/* 1111nnnnmmmm0011 fdiv <F_REG_M>,<F_REG_N>*/{"fdiv",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_3}, arch_sh3e_up},
+/* 1111nnn0mmm00011 fdiv <D_REG_M>,<D_REG_N>*/{"fdiv",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_3}, arch_sh4_up},
 
-/* 1111nnmm11101101 fipr <V_REG_M>,<V_REG_N>*/{"fipr",{V_REG_M,V_REG_N},{HEX_F,REG_NM,HEX_E,HEX_D}},
+/* 1111nnmm11101101 fipr <V_REG_M>,<V_REG_N>*/{"fipr",{V_REG_M,V_REG_N},{HEX_F,REG_NM,HEX_E,HEX_D}, arch_sh4_up},
 
-/* 1111nnnn10001101 fldi0 <F_REG_N>    */{"fldi0",{F_REG_N},{HEX_F,REG_N,HEX_8,HEX_D}},
+/* 1111nnnn10001101 fldi0 <F_REG_N>    */{"fldi0",{F_REG_N},{HEX_F,REG_N,HEX_8,HEX_D}, arch_sh3e_up},
 
-/* 1111nnnn10011101 fldi1 <F_REG_N>    */{"fldi1",{F_REG_N},{HEX_F,REG_N,HEX_9,HEX_D}},
+/* 1111nnnn10011101 fldi1 <F_REG_N>    */{"fldi1",{F_REG_N},{HEX_F,REG_N,HEX_9,HEX_D}, arch_sh3e_up},
 
-/* 1111nnnn00011101 flds <F_REG_N>,FPUL*/{"flds",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_1,HEX_D}},
+/* 1111nnnn00011101 flds <F_REG_N>,FPUL*/{"flds",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_1,HEX_D}, arch_sh3e_up},
 
-/* 1111nnnn00101101 float FPUL,<FD_REG_N>*/{"float",{FPUL_M,FD_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}},
+/* 1111nnnn00101101 float FPUL,<F_REG_N>*/{"float",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}, arch_sh3e_up},
+/* 1111nnnn00101101 float FPUL,<D_REG_N>*/{"float",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}, arch_sh4_up},
 
-/* 1111nnnnmmmm1110 fmac FR0,<F_REG_M>,<F_REG_N>*/{"fmac",{F_FR0,F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_E}},
+/* 1111nnnnmmmm1110 fmac FR0,<F_REG_M>,<F_REG_N>*/{"fmac",{F_FR0,F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_E}, arch_sh3e_up},
 
-/* 1111nnnnmmmm1100 fmov <F_REG_M>,<F_REG_N>*/{"fmov",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_C}},
-/* 1111nnnnmmmm1100 fmov <DX_REG_M>,<DX_REG_N>*/{"fmov",{DX_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_C}},
+/* 1111nnnnmmmm1100 fmov <F_REG_M>,<F_REG_N>*/{"fmov",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_C}, arch_sh3e_up},
+/* 1111nnnnmmmm1100 fmov <DX_REG_M>,<DX_REG_N>*/{"fmov",{DX_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_C}, arch_sh4_up},
 
-/* 1111nnnnmmmm1000 fmov @<REG_M>,<F_REG_N>*/{"fmov",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
-/* 1111nnnnmmmm1000 fmov @<REG_M>,<DX_REG_N>*/{"fmov",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
+/* 1111nnnnmmmm1000 fmov @<REG_M>,<F_REG_N>*/{"fmov",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh3e_up},
+/* 1111nnnnmmmm1000 fmov @<REG_M>,<DX_REG_N>*/{"fmov",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh4_up},
 
-/* 1111nnnnmmmm1010 fmov <F_REG_M>,@<REG_N>*/{"fmov",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
-/* 1111nnnnmmmm1010 fmov <DX_REG_M>,@<REG_N>*/{"fmov",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
+/* 1111nnnnmmmm1010 fmov <F_REG_M>,@<REG_N>*/{"fmov",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh3e_up},
+/* 1111nnnnmmmm1010 fmov <DX_REG_M>,@<REG_N>*/{"fmov",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh4_up},
 
-/* 1111nnnnmmmm1001 fmov @<REG_M>+,<F_REG_N>*/{"fmov",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
-/* 1111nnnnmmmm1001 fmov @<REG_M>+,<DX_REG_N>*/{"fmov",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
+/* 1111nnnnmmmm1001 fmov @<REG_M>+,<F_REG_N>*/{"fmov",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh3e_up},
+/* 1111nnnnmmmm1001 fmov @<REG_M>+,<DX_REG_N>*/{"fmov",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh4_up},
 
-/* 1111nnnnmmmm1011 fmov <F_REG_M>,@-<REG_N>*/{"fmov",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
-/* 1111nnnnmmmm1011 fmov <DX_REG_M>,@-<REG_N>*/{"fmov",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
+/* 1111nnnnmmmm1011 fmov <F_REG_M>,@-<REG_N>*/{"fmov",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh3e_up},
+/* 1111nnnnmmmm1011 fmov <DX_REG_M>,@-<REG_N>*/{"fmov",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh4_up},
 
-/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<F_REG_N>*/{"fmov",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
-/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<DX_REG_N>*/{"fmov",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
+/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<F_REG_N>*/{"fmov",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh3e_up},
+/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<DX_REG_N>*/{"fmov",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh4_up},
 
-/* 1111nnnnmmmm0111 fmov <F_REG_M>,@(R0,<REG_N>)*/{"fmov",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
-/* 1111nnnnmmmm0111 fmov <DX_REG_M>,@(R0,<REG_N>)*/{"fmov",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
+/* 1111nnnnmmmm0111 fmov <F_REG_M>,@(R0,<REG_N>)*/{"fmov",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh3e_up},
+/* 1111nnnnmmmm0111 fmov <DX_REG_M>,@(R0,<REG_N>)*/{"fmov",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh4_up},
 
-/* 1111nnnnmmmm1000 fmov.d @<REG_M>,<DX_REG_N>*/{"fmov.d",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
+/* 1111nnnnmmmm1000 fmov.d @<REG_M>,<DX_REG_N>*/{"fmov.d",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh4_up},
 
-/* 1111nnnnmmmm1010 fmov.d <DX_REG_M>,@<REG_N>*/{"fmov.d",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
+/* 1111nnnnmmmm1010 fmov.d <DX_REG_M>,@<REG_N>*/{"fmov.d",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh4_up},
 
-/* 1111nnnnmmmm1001 fmov.d @<REG_M>+,<DX_REG_N>*/{"fmov.d",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
+/* 1111nnnnmmmm1001 fmov.d @<REG_M>+,<DX_REG_N>*/{"fmov.d",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh4_up},
 
-/* 1111nnnnmmmm1011 fmov.d <DX_REG_M>,@-<REG_N>*/{"fmov.d",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
+/* 1111nnnnmmmm1011 fmov.d <DX_REG_M>,@-<REG_N>*/{"fmov.d",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh4_up},
 
-/* 1111nnnnmmmm0110 fmov.d @(R0,<REG_M>),<DX_REG_N>*/{"fmov.d",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
+/* 1111nnnnmmmm0110 fmov.d @(R0,<REG_M>),<DX_REG_N>*/{"fmov.d",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh4_up},
 
-/* 1111nnnnmmmm0111 fmov.d <DX_REG_M>,@(R0,<REG_N>)*/{"fmov.d",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
+/* 1111nnnnmmmm0111 fmov.d <DX_REG_M>,@(R0,<REG_N>)*/{"fmov.d",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh4_up},
 
-/* 1111nnnnmmmm1000 fmov.s @<REG_M>,<F_REG_N>*/{"fmov.s",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}},
+/* 1111nnnnmmmm1000 fmov.s @<REG_M>,<F_REG_N>*/{"fmov.s",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh3e_up},
 
-/* 1111nnnnmmmm1010 fmov.s <F_REG_M>,@<REG_N>*/{"fmov.s",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}},
+/* 1111nnnnmmmm1010 fmov.s <F_REG_M>,@<REG_N>*/{"fmov.s",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh3e_up},
 
-/* 1111nnnnmmmm1001 fmov.s @<REG_M>+,<F_REG_N>*/{"fmov.s",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}},
+/* 1111nnnnmmmm1001 fmov.s @<REG_M>+,<F_REG_N>*/{"fmov.s",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh3e_up},
 
-/* 1111nnnnmmmm1011 fmov.s <F_REG_M>,@-<REG_N>*/{"fmov.s",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}},
+/* 1111nnnnmmmm1011 fmov.s <F_REG_M>,@-<REG_N>*/{"fmov.s",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh3e_up},
 
-/* 1111nnnnmmmm0110 fmov.s @(R0,<REG_M>),<F_REG_N>*/{"fmov.s",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}},
+/* 1111nnnnmmmm0110 fmov.s @(R0,<REG_M>),<F_REG_N>*/{"fmov.s",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh3e_up},
 
-/* 1111nnnnmmmm0111 fmov.s <F_REG_M>,@(R0,<REG_N>)*/{"fmov.s",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}},
+/* 1111nnnnmmmm0111 fmov.s <F_REG_M>,@(R0,<REG_N>)*/{"fmov.s",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh3e_up},
 
-/* 1111nnnnmmmm0010 fmul <F_REG_M>,<F_REG_N>*/{"fmul",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_2}},
-/* 1111nnn0mmm00010 fmul <D_REG_M>,<D_REG_N>*/{"fmul",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_2}},
+/* 1111nnnnmmmm0010 fmul <F_REG_M>,<F_REG_N>*/{"fmul",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_2}, arch_sh3e_up},
+/* 1111nnn0mmm00010 fmul <D_REG_M>,<D_REG_N>*/{"fmul",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_2}, arch_sh4_up},
 
-/* 1111nnnn01001101 fneg <FD_REG_N>     */{"fneg",{FD_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}},
+/* 1111nnnn01001101 fneg <F_REG_N>     */{"fneg",{F_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh3e_up},
+/* 1111nnnn01001101 fneg <D_REG_N>     */{"fneg",{D_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh4_up},
 
-/* 1111101111111101 frchg               */{"frchg",{0},{HEX_F,HEX_B,HEX_F,HEX_D}},
+/* 1111101111111101 frchg               */{"frchg",{0},{HEX_F,HEX_B,HEX_F,HEX_D}, arch_sh4_up},
 
-/* 1111001111111101 fschg               */{"fschg",{0},{HEX_F,HEX_3,HEX_F,HEX_D}},
+/* 1111001111111101 fschg               */{"fschg",{0},{HEX_F,HEX_3,HEX_F,HEX_D}, arch_sh4_up},
 
-/* 1111nnnn01101101 fsqrt <FD_REG_N>    */{"fsqrt",{FD_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}},
+/* 1111nnnn01101101 fsqrt <F_REG_N>    */{"fsqrt",{F_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh3e_up},
+/* 1111nnnn01101101 fsqrt <D_REG_N>    */{"fsqrt",{D_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh4_up},
 
-/* 1111nnnn00001101 fsts FPUL,<F_REG_N>*/{"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}},
+/* 1111nnnn00001101 fsts FPUL,<F_REG_N>*/{"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}, arch_sh3e_up},
 
-/* 1111nnnnmmmm0001 fsub <F_REG_M>,<F_REG_N>*/{"fsub",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_1}},
-/* 1111nnn0mmm00001 fsub <D_REG_M>,<D_REG_N>*/{"fsub",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_1}},
+/* 1111nnnnmmmm0001 fsub <F_REG_M>,<F_REG_N>*/{"fsub",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_1}, arch_sh3e_up},
+/* 1111nnn0mmm00001 fsub <D_REG_M>,<D_REG_N>*/{"fsub",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_1}, arch_sh4_up},
 
-/* 1111nnnn00111101 ftrc <FD_REG_N>,FPUL*/{"ftrc",{FD_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}},
+/* 1111nnnn00111101 ftrc <F_REG_N>,FPUL*/{"ftrc",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}, arch_sh3e_up},
+/* 1111nnnn00111101 ftrc <D_REG_N>,FPUL*/{"ftrc",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}, arch_sh4_up},
 
-/* 1111nn0111111101 ftrv XMTRX_M4,<V_REG_n>*/{"ftrv",{XMTRX_M4,V_REG_N},{HEX_F,REG_NM,HEX_F,HEX_D}},
+/* 1111nn0111111101 ftrv XMTRX_M4,<V_REG_n>*/{"ftrv",{XMTRX_M4,V_REG_N},{HEX_F,REG_NM,HEX_F,HEX_D}, arch_sh4_up},
 
 { 0 } 
 };
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c
index 0975b28..9fbdb60 100644
--- a/opcodes/sparc-dis.c
+++ b/opcodes/sparc-dis.c
@@ -283,6 +283,7 @@
 	  /* Nonzero means that we have found an instruction which has
 	     the effect of adding or or'ing the imm13 field to rs1.  */
 	  int imm_added_to_rs1 = 0;
+	  int imm_ored_to_rs1 = 0;
 
 	  /* Nonzero means that we have found a plus sign in the args
 	     field of the opcode table.  */
@@ -293,8 +294,9 @@
 
 	  /* Do we have an `add' or `or' instruction combining an
              immediate with rs1?  */
-	  if (opcode->match == 0x80102000 || opcode->match == 0x80002000)
-	  /*			  (or)				 (add)  */
+	  if (opcode->match == 0x80102000) /* or */
+	    imm_ored_to_rs1 = 1;
+	  if (opcode->match == 0x80002000) /* add */
 	    imm_added_to_rs1 = 1;
 
 	  if (X_RS1 (insn) != X_RD (insn)
@@ -670,7 +672,7 @@
 	     If so, attempt to print the result of the add or
 	     or (in this context add and or do the same thing)
 	     and its symbolic value.  */
-	  if (imm_added_to_rs1)
+	  if (imm_ored_to_rs1 || imm_added_to_rs1)
 	    {
 	      unsigned long prev_insn;
 	      int errcode;
@@ -709,8 +711,11 @@
 		    {
 		      (*info->fprintf_func) (stream, "\t! ");
 		      info->target = 
-			(0xFFFFFFFF & (int) X_IMM22 (prev_insn) << 10)
-			| X_SIMM (insn, 13);
+			(0xFFFFFFFF & (int) X_IMM22 (prev_insn) << 10);
+		      if (imm_added_to_rs1)
+			info->target += X_SIMM (insn, 13);
+		      else
+			info->target |= X_SIMM (insn, 13);
 		      (*info->print_address_func) (info->target, info);
 		      info->insn_type = dis_dref;
 		      info->data_size = 4;  /* FIXME!!! */
diff --git a/opcodes/sparc-opc.c b/opcodes/sparc-opc.c
index b50b39b..7ad9d18 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, 1998
+   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
 This file is part of the BFD library.
@@ -378,7 +378,7 @@
 { "lduwa",	F3(3, 0x10, 1), F3(~3, ~0x10, ~1)|RS1_G0,	"[i]o,d", F_ALIAS, v9 },
 { "lduwa",	F3(3, 0x10, 1), F3(~3, ~0x10, ~1)|SIMM13(~0),	"[1]o,d", F_ALIAS, v9 }, /* ld [rs1+0],d */
 
-{ "ldxa",	F3(3, 0x1b, 0), F3(~3, ~0x1b, ~0),		"[1+2]A,d", 0, v9 }, /* lduwa === lda */
+{ "ldxa",	F3(3, 0x1b, 0), F3(~3, ~0x1b, ~0),		"[1+2]A,d", 0, v9 },
 { "ldxa",	F3(3, 0x1b, 0), F3(~3, ~0x1b, ~0)|RS2_G0,	"[1]A,d", 0, v9 }, /* lda [rs1+%g0],d */
 { "ldxa",	F3(3, 0x1b, 1), F3(~3, ~0x1b, ~1),		"[1+i]o,d", 0, v9 },
 { "ldxa",	F3(3, 0x1b, 1), F3(~3, ~0x1b, ~1),		"[i+1]o,d", 0, v9 },
@@ -424,6 +424,25 @@
 { "stw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[i+1]", F_ALIAS, v9 },
 { "stw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v9 },
 { "stw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v9 }, /* st d,[rs1+0] */
+{ "stsw",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v9 },
+{ "stsw",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v9 }, /* st d,[rs1+%g0] */
+{ "stsw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[1+i]", F_ALIAS, v9 },
+{ "stsw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[i+1]", F_ALIAS, v9 },
+{ "stsw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v9 },
+{ "stsw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v9 }, /* st d,[rs1+0] */
+{ "stuw",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v9 },
+{ "stuw",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v9 }, /* st d,[rs1+%g0] */
+{ "stuw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[1+i]", F_ALIAS, v9 },
+{ "stuw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[i+1]", F_ALIAS, v9 },
+{ "stuw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v9 },
+{ "stuw",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v9 }, /* st d,[rs1+0] */
+
+{ "spill",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "spill",	F3(3, 0x04, 0), F3(~3, ~0x04, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* st d,[rs1+%g0] */
+{ "spill",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "spill",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "spill",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "spill",	F3(3, 0x04, 1), F3(~3, ~0x04, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* st d,[rs1+0] */
 
 { "sta",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0),		"d,[1+2]A", 0, v6 },
 { "sta",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0)|RS2(~0),	"d,[1]A", 0, v6 }, /* sta d,[rs1+%g0] */
@@ -445,6 +464,18 @@
 { "stwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1),		"d,[i+1]o", F_ALIAS, v9 },
 { "stwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
 { "stwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* st d,[rs1+0] */
+{ "stswa",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0),		"d,[1+2]A", F_ALIAS, v9 },
+{ "stswa",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v9 }, /* sta d,[rs1+%g0] */
+{ "stswa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stswa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stswa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stswa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* st d,[rs1+0] */
+{ "stuwa",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0),		"d,[1+2]A", F_ALIAS, v9 },
+{ "stuwa",	F3(3, 0x14, 0), F3(~3, ~0x14, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v9 }, /* sta d,[rs1+%g0] */
+{ "stuwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stuwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stuwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stuwa",	F3(3, 0x14, 1), F3(~3, ~0x14, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* st d,[rs1+0] */
 
 { "stb",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI(~0),	"d,[1+2]", 0, v6 },
 { "stb",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI_RS2(~0),	"d,[1]", 0, v6 }, /* stb d,[rs1+%g0] */
@@ -453,6 +484,19 @@
 { "stb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|RS1_G0,	"d,[i]", 0, v6 },
 { "stb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|SIMM13(~0),	"d,[1]", 0, v6 }, /* stb d,[rs1+0] */
 
+{ "stsb",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "stsb",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* stb d,[rs1+%g0] */
+{ "stsb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "stsb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "stsb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "stsb",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* stb d,[rs1+0] */
+{ "stub",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "stub",	F3(3, 0x05, 0), F3(~3, ~0x05, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* stb d,[rs1+%g0] */
+{ "stub",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "stub",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "stub",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "stub",	F3(3, 0x05, 1), F3(~3, ~0x05, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* stb d,[rs1+0] */
+
 { "stba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0),		"d,[1+2]A", 0, v6 },
 { "stba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0)|RS2(~0),	"d,[1]A", 0, v6 }, /* stba d,[rs1+%g0] */
 { "stba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1),		"d,[1+i]o", 0, v9 },
@@ -460,6 +504,19 @@
 { "stba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|RS1_G0,	"d,[i]o", 0, v9 },
 { "stba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|SIMM13(~0),	"d,[1]o", 0, v9 }, /* stb d,[rs1+0] */
 
+{ "stsba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0),		"d,[1+2]A", F_ALIAS, v6 },
+{ "stsba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v6 }, /* stba d,[rs1+%g0] */
+{ "stsba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stsba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stsba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stsba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* stb d,[rs1+0] */
+{ "stuba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0),		"d,[1+2]A", F_ALIAS, v6 },
+{ "stuba",	F3(3, 0x15, 0), F3(~3, ~0x15, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v6 }, /* stba d,[rs1+%g0] */
+{ "stuba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stuba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stuba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stuba",	F3(3, 0x15, 1), F3(~3, ~0x15, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* stb d,[rs1+0] */
+
 { "std",	F3(3, 0x07, 0), F3(~3, ~0x07, ~0)|ASI(~0),	"d,[1+2]", 0, v6 },
 { "std",	F3(3, 0x07, 0), F3(~3, ~0x07, ~0)|ASI_RS2(~0),	"d,[1]", 0, v6 }, /* std d,[rs1+%g0] */
 { "std",	F3(3, 0x07, 1), F3(~3, ~0x07, ~1),		"d,[1+i]", 0, v6 },
@@ -493,6 +550,13 @@
 { "std",	F3(3, 0x37, 1), F3(~3, ~0x37, ~1)|RS1_G0,	"D,[i]", 0, v6notv9 },
 { "std",	F3(3, 0x37, 1), F3(~3, ~0x37, ~1)|SIMM13(~0),	"D,[1]", 0, v6notv9 }, /* std d,[rs1+0] */
 
+{ "spilld",	F3(3, 0x07, 0), F3(~3, ~0x07, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "spilld",	F3(3, 0x07, 0), F3(~3, ~0x07, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* std d,[rs1+%g0] */
+{ "spilld",	F3(3, 0x07, 1), F3(~3, ~0x07, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "spilld",	F3(3, 0x07, 1), F3(~3, ~0x07, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "spilld",	F3(3, 0x07, 1), F3(~3, ~0x07, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "spilld",	F3(3, 0x07, 1), F3(~3, ~0x07, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* std d,[rs1+0] */
+
 { "stda",	F3(3, 0x17, 0), F3(~3, ~0x17, ~0),		"d,[1+2]A", 0, v6 },
 { "stda",	F3(3, 0x17, 0), F3(~3, ~0x17, ~0)|RS2(~0),	"d,[1]A", 0, v6 }, /* stda d,[rs1+%g0] */
 { "stda",	F3(3, 0x17, 1), F3(~3, ~0x17, ~1),		"d,[1+i]o", 0, v9 },
@@ -513,6 +577,19 @@
 { "sth",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|RS1_G0,	"d,[i]", 0, v6 },
 { "sth",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|SIMM13(~0),	"d,[1]", 0, v6 }, /* sth d,[rs1+0] */
 
+{ "stsh",	F3(3, 0x06, 0), F3(~3, ~0x06, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "stsh",	F3(3, 0x06, 0), F3(~3, ~0x06, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* sth d,[rs1+%g0] */
+{ "stsh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "stsh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "stsh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "stsh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* sth d,[rs1+0] */
+{ "stuh",	F3(3, 0x06, 0), F3(~3, ~0x06, ~0)|ASI(~0),	"d,[1+2]", F_ALIAS, v6 },
+{ "stuh",	F3(3, 0x06, 0), F3(~3, ~0x06, ~0)|ASI_RS2(~0),	"d,[1]", F_ALIAS, v6 }, /* sth d,[rs1+%g0] */
+{ "stuh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1),		"d,[1+i]", F_ALIAS, v6 },
+{ "stuh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1),		"d,[i+1]", F_ALIAS, v6 },
+{ "stuh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|RS1_G0,	"d,[i]", F_ALIAS, v6 },
+{ "stuh",	F3(3, 0x06, 1), F3(~3, ~0x06, ~1)|SIMM13(~0),	"d,[1]", F_ALIAS, v6 }, /* sth d,[rs1+0] */
+
 { "stha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0),		"d,[1+2]A", 0, v6 },
 { "stha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0)|RS2(~0),	"d,[1]A", 0, v6 }, /* stha ,[rs1+%g0] */
 { "stha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1),		"d,[1+i]o", 0, v9 },
@@ -520,6 +597,19 @@
 { "stha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|RS1_G0,	"d,[i]o", 0, v9 },
 { "stha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|SIMM13(~0),	"d,[1]o", 0, v9 }, /* sth d,[rs1+0] */
 
+{ "stsha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0),		"d,[1+2]A", F_ALIAS, v6 },
+{ "stsha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v6 }, /* stha ,[rs1+%g0] */
+{ "stsha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stsha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stsha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stsha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* sth d,[rs1+0] */
+{ "stuha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0),		"d,[1+2]A", F_ALIAS, v6 },
+{ "stuha",	F3(3, 0x16, 0), F3(~3, ~0x16, ~0)|RS2(~0),	"d,[1]A", F_ALIAS, v6 }, /* stha ,[rs1+%g0] */
+{ "stuha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1),		"d,[1+i]o", F_ALIAS, v9 },
+{ "stuha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1),		"d,[i+1]o", F_ALIAS, v9 },
+{ "stuha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|RS1_G0,	"d,[i]o", F_ALIAS, v9 },
+{ "stuha",	F3(3, 0x16, 1), F3(~3, ~0x16, ~1)|SIMM13(~0),	"d,[1]o", F_ALIAS, v9 }, /* sth d,[rs1+0] */
+
 { "stx",	F3(3, 0x0e, 0), F3(~3, ~0x0e, ~0)|ASI(~0),	"d,[1+2]", 0, v9 },
 { "stx",	F3(3, 0x0e, 0), F3(~3, ~0x0e, ~0)|ASI_RS2(~0),	"d,[1]", 0, v9 }, /* stx d,[rs1+%g0] */
 { "stx",	F3(3, 0x0e, 1), F3(~3, ~0x0e, ~1),		"d,[1+i]", 0, v9 },
@@ -1374,9 +1464,9 @@
 
 { "nop",	F2(0, 4), 0xfeffffff, "", 0, v6 }, /* sethi 0, %g0 */
 
-{ "set",	F2(0x0, 0x4), F2(~0x0, ~0x4), "Sh,d", F_ALIAS, v6 },
-{ "setuw",	F2(0x0, 0x4), F2(~0x0, ~0x4), "Sh,d", F_ALIAS, v9 },
-{ "setsw",	F2(0x0, 0x4), F2(~0x0, ~0x4), "Sh,d", F_ALIAS, v9 },
+{ "set",	F2(0x0, 0x4), F2(~0x0, ~0x4), "S0,d", F_ALIAS, v6 },
+{ "setuw",	F2(0x0, 0x4), F2(~0x0, ~0x4), "S0,d", F_ALIAS, v9 },
+{ "setsw",	F2(0x0, 0x4), F2(~0x0, ~0x4), "S0,d", F_ALIAS, v9 },
 { "setx",	F2(0x0, 0x4), F2(~0x0, ~0x4), "S0,1,d", F_ALIAS, v9 },
 
 { "sethi",	F2(0x0, 0x4), F2(~0x0, ~0x4), "h,d", 0, v6 },
@@ -1444,33 +1534,42 @@
 
 { "fdivd",	F3F(2, 0x34, 0x04e), F3F(~2, ~0x34, ~0x04e), "v,B,H", F_FLOAT, v6 },
 { "fdivq",	F3F(2, 0x34, 0x04f), F3F(~2, ~0x34, ~0x04f), "V,R,J", F_FLOAT, v8 },
+{ "fdivx",	F3F(2, 0x34, 0x04f), F3F(~2, ~0x34, ~0x04f), "V,R,J", F_FLOAT|F_ALIAS, v8 },
 { "fdivs",	F3F(2, 0x34, 0x04d), F3F(~2, ~0x34, ~0x04d), "e,f,g", F_FLOAT, v6 },
 { "fmuld",	F3F(2, 0x34, 0x04a), F3F(~2, ~0x34, ~0x04a), "v,B,H", F_FLOAT, v6 },
 { "fmulq",	F3F(2, 0x34, 0x04b), F3F(~2, ~0x34, ~0x04b), "V,R,J", F_FLOAT, v8 },
+{ "fmulx",	F3F(2, 0x34, 0x04b), F3F(~2, ~0x34, ~0x04b), "V,R,J", F_FLOAT|F_ALIAS, v8 },
 { "fmuls",	F3F(2, 0x34, 0x049), F3F(~2, ~0x34, ~0x049), "e,f,g", F_FLOAT, v6 },
 
 { "fdmulq",	F3F(2, 0x34, 0x06e), F3F(~2, ~0x34, ~0x06e), "v,B,J", F_FLOAT, v8 },
+{ "fdmulx",	F3F(2, 0x34, 0x06e), F3F(~2, ~0x34, ~0x06e), "v,B,J", F_FLOAT|F_ALIAS, v8 },
 { "fsmuld",	F3F(2, 0x34, 0x069), F3F(~2, ~0x34, ~0x069), "e,f,H", F_FLOAT, v8 },
 
 { "fsqrtd",	F3F(2, 0x34, 0x02a), F3F(~2, ~0x34, ~0x02a)|RS1_G0, "B,H", F_FLOAT, v7 },
 { "fsqrtq",	F3F(2, 0x34, 0x02b), F3F(~2, ~0x34, ~0x02b)|RS1_G0, "R,J", F_FLOAT, v8 },
+{ "fsqrtx",	F3F(2, 0x34, 0x02b), F3F(~2, ~0x34, ~0x02b)|RS1_G0, "R,J", F_FLOAT|F_ALIAS, v8 },
 { "fsqrts",	F3F(2, 0x34, 0x029), F3F(~2, ~0x34, ~0x029)|RS1_G0, "f,g", F_FLOAT, v7 },
 
 { "fabsd",	F3F(2, 0x34, 0x00a), F3F(~2, ~0x34, ~0x00a)|RS1_G0, "B,H", F_FLOAT, v9 },
 { "fabsq",	F3F(2, 0x34, 0x00b), F3F(~2, ~0x34, ~0x00b)|RS1_G0, "R,J", F_FLOAT, v9 },
+{ "fabsx",	F3F(2, 0x34, 0x00b), F3F(~2, ~0x34, ~0x00b)|RS1_G0, "R,J", F_FLOAT|F_ALIAS, v9 },
 { "fabss",	F3F(2, 0x34, 0x009), F3F(~2, ~0x34, ~0x009)|RS1_G0, "f,g", F_FLOAT, v6 },
 { "fmovd",	F3F(2, 0x34, 0x002), F3F(~2, ~0x34, ~0x002)|RS1_G0, "B,H", F_FLOAT, v9 },
 { "fmovq",	F3F(2, 0x34, 0x003), F3F(~2, ~0x34, ~0x003)|RS1_G0, "R,J", F_FLOAT, v9 },
+{ "fmovx",	F3F(2, 0x34, 0x003), F3F(~2, ~0x34, ~0x003)|RS1_G0, "R,J", F_FLOAT|F_ALIAS, v9 },
 { "fmovs",	F3F(2, 0x34, 0x001), F3F(~2, ~0x34, ~0x001)|RS1_G0, "f,g", F_FLOAT, v6 },
 { "fnegd",	F3F(2, 0x34, 0x006), F3F(~2, ~0x34, ~0x006)|RS1_G0, "B,H", F_FLOAT, v9 },
 { "fnegq",	F3F(2, 0x34, 0x007), F3F(~2, ~0x34, ~0x007)|RS1_G0, "R,J", F_FLOAT, v9 },
+{ "fnegx",	F3F(2, 0x34, 0x007), F3F(~2, ~0x34, ~0x007)|RS1_G0, "R,J", F_FLOAT|F_ALIAS, v9 },
 { "fnegs",	F3F(2, 0x34, 0x005), F3F(~2, ~0x34, ~0x005)|RS1_G0, "f,g", F_FLOAT, v6 },
 
 { "faddd",	F3F(2, 0x34, 0x042), F3F(~2, ~0x34, ~0x042), "v,B,H", F_FLOAT, v6 },
 { "faddq",	F3F(2, 0x34, 0x043), F3F(~2, ~0x34, ~0x043), "V,R,J", F_FLOAT, v8 },
+{ "faddx",	F3F(2, 0x34, 0x043), F3F(~2, ~0x34, ~0x043), "V,R,J", F_FLOAT|F_ALIAS, v8 },
 { "fadds",	F3F(2, 0x34, 0x041), F3F(~2, ~0x34, ~0x041), "e,f,g", F_FLOAT, v6 },
 { "fsubd",	F3F(2, 0x34, 0x046), F3F(~2, ~0x34, ~0x046), "v,B,H", F_FLOAT, v6 },
 { "fsubq",	F3F(2, 0x34, 0x047), F3F(~2, ~0x34, ~0x047), "V,R,J", F_FLOAT, v8 },
+{ "fsubx",	F3F(2, 0x34, 0x047), F3F(~2, ~0x34, ~0x047), "V,R,J", F_FLOAT|F_ALIAS, v8 },
 { "fsubs",	F3F(2, 0x34, 0x045), F3F(~2, ~0x34, ~0x045), "e,f,g", F_FLOAT, v6 },
 
 #define CMPFCC(x)	(((x)&0x3)<<25)
@@ -1495,6 +1594,16 @@
 { "fcmpeq",	CMPFCC(1)|F3F(2, 0x35, 0x057), CMPFCC(~1)|F3F(~2, ~0x35, ~0x057),	 "7,V,R", F_FLOAT, v9 },
 { "fcmpeq",	CMPFCC(2)|F3F(2, 0x35, 0x057), CMPFCC(~2)|F3F(~2, ~0x35, ~0x057),	 "8,V,R", F_FLOAT, v9 },
 { "fcmpeq",	CMPFCC(3)|F3F(2, 0x35, 0x057), CMPFCC(~3)|F3F(~2, ~0x35, ~0x057),	 "9,V,R", F_FLOAT, v9 },
+{ "fcmpx",	          F3F(2, 0x35, 0x053),            F3F(~2, ~0x35, ~0x053)|RD_G0,	 "V,R", F_FLOAT|F_ALIAS, v8 },
+{ "fcmpx",	CMPFCC(0)|F3F(2, 0x35, 0x053), CMPFCC(~0)|F3F(~2, ~0x35, ~0x053),	 "6,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpx",	CMPFCC(1)|F3F(2, 0x35, 0x053), CMPFCC(~1)|F3F(~2, ~0x35, ~0x053),	 "7,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpx",	CMPFCC(2)|F3F(2, 0x35, 0x053), CMPFCC(~2)|F3F(~2, ~0x35, ~0x053),	 "8,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpx",	CMPFCC(3)|F3F(2, 0x35, 0x053), CMPFCC(~3)|F3F(~2, ~0x35, ~0x053),	 "9,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpex",	          F3F(2, 0x35, 0x057),            F3F(~2, ~0x35, ~0x057)|RD_G0,	 "V,R", F_FLOAT|F_ALIAS, v8 },
+{ "fcmpex",	CMPFCC(0)|F3F(2, 0x35, 0x057), CMPFCC(~0)|F3F(~2, ~0x35, ~0x057),	 "6,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpex",	CMPFCC(1)|F3F(2, 0x35, 0x057), CMPFCC(~1)|F3F(~2, ~0x35, ~0x057),	 "7,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpex",	CMPFCC(2)|F3F(2, 0x35, 0x057), CMPFCC(~2)|F3F(~2, ~0x35, ~0x057),	 "8,V,R", F_FLOAT|F_ALIAS, v9 },
+{ "fcmpex",	CMPFCC(3)|F3F(2, 0x35, 0x057), CMPFCC(~3)|F3F(~2, ~0x35, ~0x057),	 "9,V,R", F_FLOAT|F_ALIAS, v9 },
 { "fcmps",	          F3F(2, 0x35, 0x051),            F3F(~2, ~0x35, ~0x051)|RD_G0, "e,f",   F_FLOAT, v6 },
 { "fcmps",	CMPFCC(0)|F3F(2, 0x35, 0x051), CMPFCC(~0)|F3F(~2, ~0x35, ~0x051),	 "6,e,f", F_FLOAT, v9 },
 { "fcmps",	CMPFCC(1)|F3F(2, 0x35, 0x051), CMPFCC(~1)|F3F(~2, ~0x35, ~0x051),	 "7,e,f", F_FLOAT, v9 },
@@ -1608,10 +1717,11 @@
 { "casxa",	F3(3, 0x3e, 1), F3(~3, ~0x3e, ~1), "[1]o,2,d", 0, v9 },
 
 /* v9 synthetic insns */
-/* FIXME: still missing "signx d", and "clruw d".  Can't be done here.  */
 { "iprefetch",	F2(0, 1)|(2<<20)|BPRED, F2(~0, ~1)|(1<<20)|ANNUL|COND(~0), "G", 0, v9 }, /* bn,a,pt %xcc,label */
 { "signx",	F3(2, 0x27, 0), F3(~2, ~0x27, ~0)|(1<<12)|ASI(~0)|RS2_G0, "1,d", F_ALIAS, v9 }, /* sra rs1,%g0,rd */
+{ "signx",	F3(2, 0x27, 0), F3(~2, ~0x27, ~0)|(1<<12)|ASI(~0)|RS2_G0, "r", F_ALIAS, v9 }, /* sra rd,%g0,rd */
 { "clruw",	F3(2, 0x26, 0), F3(~2, ~0x26, ~0)|(1<<12)|ASI(~0)|RS2_G0, "1,d", F_ALIAS, v9 }, /* srl rs1,%g0,rd */
+{ "clruw",	F3(2, 0x26, 0), F3(~2, ~0x26, ~0)|(1<<12)|ASI(~0)|RS2_G0, "r", F_ALIAS, v9 }, /* srl rd,%g0,rd */
 { "cas",	F3(3, 0x3c, 0)|ASI(0x80), F3(~3, ~0x3c, ~0)|ASI(~0x80), "[1],2,d", F_ALIAS, v9 }, /* casa [rs1]ASI_P,rs2,rd */
 { "casl",	F3(3, 0x3c, 0)|ASI(0x88), F3(~3, ~0x3c, ~0)|ASI(~0x88), "[1],2,d", F_ALIAS, v9 }, /* casa [rs1]ASI_P_L,rs2,rd */
 { "casx",	F3(3, 0x3e, 0)|ASI(0x80), F3(~3, ~0x3e, ~0)|ASI(~0x80), "[1],2,d", F_ALIAS, v9 }, /* casxa [rs1]ASI_P,rs2,rd */
diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c
index 1051457..5ccf893 100644
--- a/opcodes/tic30-dis.c
+++ b/opcodes/tic30-dis.c
@@ -1,5 +1,5 @@
 /* Disassembly routines for TMS320C30 architecture
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999 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
@@ -19,8 +19,7 @@
 
 #include <errno.h>
 #include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include "sysdep.h"
 #include "dis-asm.h"
 #include "opcode/tic30.h"
 
diff --git a/texinfo/texinfo.tex b/texinfo/texinfo.tex
new file mode 100644
index 0000000..7d3a33c
--- /dev/null
+++ b/texinfo/texinfo.tex
@@ -0,0 +1,5431 @@
+% texinfo.tex -- TeX macros to handle Texinfo files.
+% $Id$
+%
+% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
+% Free Software Foundation, Inc.
+%
+% This texinfo.tex 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, or (at
+% your option) any later version.
+%
+% This texinfo.tex file 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 texinfo.tex file; see the file COPYING.  If not, write
+% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+% In other words, you are welcome to use, share and improve this program.
+% You are forbidden to forbid anyone else to use, share and improve
+% what you give them.   Help stamp out software-hoarding!
+%
+% Please try the latest version of texinfo.tex before submitting bug
+% reports; you can get the latest version from:
+%   ftp://ftp.gnu.org/pub/gnu/texinfo.tex
+%   /home/gd/gnu/doc/texinfo.tex on the GNU machines.
+%   (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
+%   ftp://tug.org/tex/texinfo.tex
+%   ftp://ctan.org/macros/texinfo/texinfo.tex
+%   (and all CTAN mirrors, finger ctan@ctan.org for a list).
+% The texinfo.tex in the texinfo distribution itself could well be out
+% of date, so if that's what you're using, please check.
+% 
+% Send bug reports to bug-texinfo@gnu.org.
+% Please include a precise test case in each bug report,
+% including a complete document with which we can reproduce the problem.
+% 
+% To process a Texinfo manual with TeX, it's most reliable to use the
+% texi2dvi shell script that comes with the distribution.  For simple
+% manuals, however, you can get away with:
+%   tex foo.texi
+%   texindex foo.??
+%   tex foo.texi
+%   tex foo.texi
+%   dvips foo.dvi -o # or whatever, to process the dvi file.
+% The extra runs of TeX get the cross-reference information correct.
+% Sometimes one run after texindex suffices, and sometimes you need more
+% than two; texi2dvi does it as many times as necessary.
+
+
+% Make it possible to create a .fmt file just by loading this file:
+% if the underlying format is not loaded, start by loading it now.
+% Added by gildea November 1993.
+\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
+
+% This automatically updates the version number based on RCS.
+\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
+\deftexinfoversion$Revision$
+\message{Loading texinfo package [Version \texinfoversion]:}
+
+% If in a .fmt file, print the version number
+% and turn on active characters that we couldn't do earlier because
+% they might have appeared in the input file name.
+\everyjob{\message{[Texinfo version \texinfoversion]}\message{}
+  \catcode`+=\active \catcode`\_=\active}
+
+% Save some parts of plain tex whose names we will redefine.
+
+\let\ptexb=\b
+\let\ptexbullet=\bullet
+\let\ptexc=\c
+\let\ptexcomma=\,
+\let\ptexdot=\.
+\let\ptexdots=\dots
+\let\ptexend=\end
+\let\ptexequiv=\equiv
+\let\ptexexclam=\!
+\let\ptexi=\i
+\let\ptexlbrace=\{
+\let\ptexrbrace=\}
+\let\ptexstar=\*
+\let\ptext=\t
+
+% We never want plain's outer \+ definition in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+
+\message{Basics,}
+\chardef\other=12
+
+% If this character appears in an error message or help string, it
+% starts a new line in the output.
+\newlinechar = `^^J
+
+% Set up fixed words for English if not already set.
+\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
+\ifx\putwordChapter\undefined  \gdef\putwordChapter{Chapter}\fi
+\ifx\putwordfile\undefined     \gdef\putwordfile{file}\fi
+\ifx\putwordInfo\undefined     \gdef\putwordInfo{Info}\fi
+\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
+\ifx\putwordon\undefined       \gdef\putwordon{on}\fi
+\ifx\putwordpage\undefined     \gdef\putwordpage{page}\fi
+\ifx\putwordsection\undefined  \gdef\putwordsection{section}\fi
+\ifx\putwordSection\undefined  \gdef\putwordSection{Section}\fi
+\ifx\putwordsee\undefined      \gdef\putwordsee{see}\fi
+\ifx\putwordSee\undefined      \gdef\putwordSee{See}\fi
+\ifx\putwordShortContents\undefined  \gdef\putwordShortContents{Short Contents}\fi
+\ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
+
+% Ignore a token.
+%
+\def\gobble#1{}
+
+\hyphenation{ap-pen-dix}
+\hyphenation{mini-buf-fer mini-buf-fers}
+\hyphenation{eshell}
+\hyphenation{white-space}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen \bindingoffset
+\newdimen \normaloffset
+\newdimen\pagewidth \newdimen\pageheight
+
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal.  We don't just call \tracingall here,
+% since that produces some useless output on the terminal.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\ifx\eTeXversion\undefined
+\def\loggingall{\tracingcommands2 \tracingstats2
+   \tracingpages1 \tracingoutput1 \tracinglostchars1
+   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
+   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+\else
+\def\loggingall{\tracingcommands3 \tracingstats2
+   \tracingpages1 \tracingoutput1 \tracinglostchars1
+   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
+   \tracingscantokens1 \tracingassigns1 \tracingifs1
+   \tracinggroups1 \tracingnesting2
+   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+\fi
+
+% For @cropmarks command.
+% Do @cropmarks to get crop marks.
+% 
+\newif\ifcropmarks
+\let\cropmarks = \cropmarkstrue
+%
+% Dimensions to add cropmarks at corners.
+% Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
+\newdimen\cornerlong  \cornerlong=1pc
+\newdimen\cornerthick \cornerthick=.3pt
+\newdimen\topandbottommargin \topandbottommargin=.75in
+
+% Main output routine.
+\chardef\PAGE = 255
+\output = {\onepageout{\pagecontents\PAGE}}
+
+\newbox\headlinebox
+\newbox\footlinebox
+
+% \onepageout takes a vbox as an argument.  Note that \pagecontents
+% does insertions, but you have to call it yourself.
+\def\onepageout#1{%
+  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+  %
+  \ifodd\pageno  \advance\hoffset by \bindingoffset
+  \else \advance\hoffset by -\bindingoffset\fi
+  %
+  % Do this outside of the \shipout so @code etc. will be expanded in
+  % the headline as they should be, not taken literally (outputting ''code).
+  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
+  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
+  %
+  {%
+    % Have to do this stuff outside the \shipout because we want it to
+    % take effect in \write's, yet the group defined by the \vbox ends
+    % before the \shipout runs.
+    %
+    \escapechar = `\\     % use backslash in output files.
+    \indexdummies         % don't expand commands in the output.
+    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
+                   % the page break happens to be in the middle of an example.
+    \shipout\vbox{%
+      \ifcropmarks \vbox to \outervsize\bgroup
+        \hsize = \outerhsize
+        \line{\ewtop\hfil\ewtop}%
+        \nointerlineskip
+        \line{%
+          \vbox{\moveleft\cornerthick\nstop}%
+          \hfill
+          \vbox{\moveright\cornerthick\nstop}%
+        }%
+        \vskip\topandbottommargin
+        \line\bgroup
+          \hfil % center the page within the outer (page) hsize.
+          \ifodd\pageno\hskip\bindingoffset\fi
+          \vbox\bgroup
+      \fi
+      %
+      \unvbox\headlinebox
+      \pagebody{#1}%
+      \ifdim\ht\footlinebox > 0pt
+        % Only leave this space if the footline is nonempty.
+        % (We lessened \vsize for it in \oddfootingxxx.)
+        % The \baselineskip=24pt in plain's \makefootline has no effect.
+        \vskip 2\baselineskip
+        \unvbox\footlinebox
+      \fi
+      %
+      \ifcropmarks
+          \egroup % end of \vbox\bgroup
+        \hfil\egroup % end of (centering) \line\bgroup
+        \vskip\topandbottommargin plus1fill minus1fill
+        \boxmaxdepth = \cornerthick
+        \line{%
+          \vbox{\moveleft\cornerthick\nsbot}%
+          \hfill
+          \vbox{\moveright\cornerthick\nsbot}%
+        }%
+        \nointerlineskip
+        \line{\ewbot\hfil\ewbot}%
+      \egroup % \vbox from first cropmarks clause
+      \fi
+    }% end of \shipout\vbox
+  }% end of group with \turnoffactive
+  \advancepageno
+  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
+}
+
+\newinsert\margin \dimen\margin=\maxdimen
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+% marginal hacks, juha@viisa.uucp (Juha Takala)
+\ifvoid\margin\else % marginal info is present
+  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
+\dimen@=\dp#1 \unvbox#1
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+% Here are the rules for the cropmarks.  Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1.  The argument is the rest of
+% the input line (except we remove a trailing comment).  #1 should be a
+% macro which expects an ordinary undelimited TeX argument.
+%
+\def\parsearg#1{%
+  \let\next = #1%
+  \begingroup
+    \obeylines
+    \futurelet\temp\parseargx
+}
+
+% If the next token is an obeyed space (from an @example environment or
+% the like), remove it and recurse.  Otherwise, we're done.
+\def\parseargx{%
+  % \obeyedspace is defined far below, after the definition of \sepspaces.
+  \ifx\obeyedspace\temp
+    \expandafter\parseargdiscardspace
+  \else
+    \expandafter\parseargline
+  \fi
+}
+
+% Remove a single space (as the delimiter token to the macro call).
+{\obeyspaces %
+ \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
+
+{\obeylines %
+  \gdef\parseargline#1^^M{%
+    \endgroup % End of the group started in \parsearg.
+    %
+    % First remove any @c comment, then any @comment.
+    % Result of each macro is put in \toks0.
+    \argremovec #1\c\relax %
+    \expandafter\argremovecomment \the\toks0 \comment\relax %
+    %
+    % Call the caller's macro, saved as \next in \parsearg.
+    \expandafter\next\expandafter{\the\toks0}%
+  }%
+}
+
+% Since all \c{,omment} does is throw away the argument, we can let TeX
+% do that for us.  The \relax here is matched by the \relax in the call
+% in \parseargline; it could be more or less anything, its purpose is
+% just to delimit the argument to the \c.
+\def\argremovec#1\c#2\relax{\toks0 = {#1}}
+\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
+
+% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
+%    @end itemize  @c foo
+% will have two active spaces as part of the argument with the
+% `itemize'.  Here we remove all active spaces from #1, and assign the
+% result to \toks0.
+%
+% This loses if there are any *other* active characters besides spaces
+% in the argument -- _ ^ +, for example -- since they get expanded.
+% Fortunately, Texinfo does not define any such commands.  (If it ever
+% does, the catcode of the characters in questionwill have to be changed
+% here.)  But this means we cannot call \removeactivespaces as part of
+% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
+% that \parsearg gets might well have any character at all in it.
+%
+\def\removeactivespaces#1{%
+  \begingroup
+    \ignoreactivespaces
+    \edef\temp{#1}%
+    \global\toks0 = \expandafter{\temp}%
+  \endgroup
+}
+
+% Change the active space to expand to nothing.
+%
+\begingroup
+  \obeyspaces
+  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
+\endgroup
+
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+%% These are used to keep @begin/@end levels from running away
+%% Call \inENV within environments (after a \begingroup)
+\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
+\def\ENVcheck{%
+\ifENV\errmessage{Still within an environment; press RETURN to continue}
+\endgroup\fi} % This is not perfect, but it should reduce lossage
+
+% @begin foo  is the same as @foo, for now.
+\newhelp\EMsimple{Press RETURN to continue.}
+
+\outer\def\begin{\parsearg\beginxxx}
+
+\def\beginxxx #1{%
+\expandafter\ifx\csname #1\endcsname\relax
+{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
+\csname #1\endcsname\fi}
+
+% @end foo executes the definition of \Efoo.
+%
+\def\end{\parsearg\endxxx}
+\def\endxxx #1{%
+  \removeactivespaces{#1}%
+  \edef\endthing{\the\toks0}%
+  %
+  \expandafter\ifx\csname E\endthing\endcsname\relax
+    \expandafter\ifx\csname \endthing\endcsname\relax
+      % There's no \foo, i.e., no ``environment'' foo.
+      \errhelp = \EMsimple
+      \errmessage{Undefined command `@end \endthing'}%
+    \else
+      \unmatchedenderror\endthing
+    \fi
+  \else
+    % Everything's ok; the right environment has been started.
+    \csname E\endthing\endcsname
+  \fi
+}
+
+% There is an environment #1, but it hasn't been started.  Give an error.
+%
+\def\unmatchedenderror#1{%
+  \errhelp = \EMsimple
+  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
+}
+
+% Define the control sequence \E#1 to give an unmatched @end error.
+%
+\def\defineunmatchedend#1{%
+  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
+}
+
+
+% Single-spacing is done by various environments (specifically, in
+% \nonfillstart and \quotations).
+\newskip\singlespaceskip \singlespaceskip = 12.5pt
+\def\singlespace{%
+  % Why was this kern here?  It messes up equalizing space above and below
+  % environments.  --karl, 6may93
+  %{\advance \baselineskip by -\singlespaceskip
+  %\kern \baselineskip}%
+  \setleading \singlespaceskip
+}
+
+%% Simple single-character @ commands
+
+% @@ prints an @
+% Kludge this until the fonts are right (grr).
+\def\@{{\tt\char64}}
+
+% This is turned off because it was never documented
+% and you can use @w{...} around a quote to suppress ligatures.
+%% Define @` and @' to be the same as ` and '
+%% but suppressing ligatures.
+%\def\`{{`}}
+%\def\'{{'}}
+
+% Used to generate quoted braces.
+\def\mylbrace {{\tt\char123}}
+\def\myrbrace {{\tt\char125}}
+\let\{=\mylbrace
+\let\}=\myrbrace
+\begingroup
+  % Definitions to produce actual \{ & \} command in an index.
+  \catcode`\{ = 12 \catcode`\} = 12
+  \catcode`\[ = 1 \catcode`\] = 2
+  \catcode`\@ = 0 \catcode`\\ = 12
+  @gdef@lbracecmd[\{]%
+  @gdef@rbracecmd[\}]%
+@endgroup
+
+% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
+\let\, = \c
+\let\dotaccent = \.
+\def\ringaccent#1{{\accent23 #1}}
+\let\tieaccent = \t
+\let\ubaraccent = \b
+\let\udotaccent = \d
+
+% Other special characters: @questiondown @exclamdown
+% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
+\def\questiondown{?`}
+\def\exclamdown{!`}
+
+% Dotless i and dotless j, used for accents.
+\def\imacro{i}
+\def\jmacro{j}
+\def\dotless#1{%
+  \def\temp{#1}%
+  \ifx\temp\imacro \ptexi
+  \else\ifx\temp\jmacro \j
+  \else \errmessage{@dotless can be used only with i or j}%
+  \fi\fi
+}
+
+% Be sure we're in horizontal mode when doing a tie, since we make space
+% equivalent to this in @example-like environments. Otherwise, a space
+% at the beginning of a line will start with \penalty -- and
+% since \penalty is valid in vertical mode, we'd end up putting the
+% penalty on the vertical list instead of in the new paragraph.
+{\catcode`@ = 11
+ % Avoid using \@M directly, because that causes trouble
+ % if the definition is written into an index file.
+ \global\let\tiepenalty = \@M
+ \gdef\tie{\leavevmode\penalty\tiepenalty\ }
+}
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break\hbox{}\ignorespaces}
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=3000 }
+
+% @! is an end-of-sentence bang.
+\def\!{!\spacefactor=3000 }
+
+% @? is an end-of-sentence query.
+\def\?{?\spacefactor=3000 }
+
+% @w prevents a word break.  Without the \leavevmode, @w at the
+% beginning of a paragraph, when TeX is still in vertical mode, would
+% produce a whole line of output instead of starting the paragraph.
+\def\w#1{\leavevmode\hbox{#1}}
+
+% @group ... @end group forces ... to be all on one page, by enclosing
+% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
+% to keep its height that of a normal line.  According to the rules for
+% \topskip (p.114 of the TeXbook), the glue inserted is
+% max (\topskip - \ht (first item), 0).  If that height is large,
+% therefore, no glue is inserted, and the space between the headline and
+% the text is small, which looks bad.
+%
+\def\group{\begingroup
+  \ifnum\catcode13=\active \else
+    \errhelp = \groupinvalidhelp
+    \errmessage{@group invalid in context where filling is enabled}%
+  \fi
+  %
+  % The \vtop we start below produces a box with normal height and large
+  % depth; thus, TeX puts \baselineskip glue before it, and (when the
+  % next line of text is done) \lineskip glue after it.  (See p.82 of
+  % the TeXbook.)  Thus, space below is not quite equal to space
+  % above.  But it's pretty close.
+  \def\Egroup{%
+    \egroup           % End the \vtop.
+    \endgroup         % End the \group.
+  }%
+  %
+  \vtop\bgroup
+    % We have to put a strut on the last line in case the @group is in
+    % the midst of an example, rather than completely enclosing it.
+    % Otherwise, the interline space between the last line of the group
+    % and the first line afterwards is too small.  But we can't put the
+    % strut in \Egroup, since there it would be on a line by itself.
+    % Hence this just inserts a strut at the beginning of each line.
+    \everypar = {\strut}%
+    %
+    % Since we have a strut on every line, we don't need any of TeX's
+    % normal interline spacing.
+    \offinterlineskip
+    %
+    % OK, but now we have to do something about blank
+    % lines in the input in @example-like environments, which normally
+    % just turn into \lisppar, which will insert no space now that we've
+    % turned off the interline space.  Simplest is to make them be an
+    % empty paragraph.
+    \ifx\par\lisppar
+      \edef\par{\leavevmode \par}%
+      %
+      % Reset ^^M's definition to new definition of \par.
+      \obeylines
+    \fi
+    %
+    % Do @comment since we are called inside an environment such as
+    % @example, where each end-of-line in the input causes an
+    % end-of-line in the output.  We don't want the end-of-line after
+    % the `@group' to put extra space in the output.  Since @group
+    % should appear on a line by itself (according to the Texinfo
+    % manual), we don't worry about eating any user text.
+    \comment
+}
+%
+% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
+% message, so this ends up printing `@group can only ...'.
+%
+\newhelp\groupinvalidhelp{%
+group can only be used in environments such as @example,^^J%
+where each line of input produces a line of output.}
+
+% @need space-in-mils
+% forces a page break if there is not space-in-mils remaining.
+
+\newdimen\mil  \mil=0.001in
+
+\def\need{\parsearg\needx}
+
+% Old definition--didn't work.
+%\def\needx #1{\par %
+%% This method tries to make TeX break the page naturally
+%% if the depth of the box does not fit.
+%{\baselineskip=0pt%
+%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
+%\prevdepth=-1000pt
+%}}
+
+\def\needx#1{%
+  % Go into vertical mode, so we don't make a big box in the middle of a
+  % paragraph.
+  \par
+  %
+  % Don't add any leading before our big empty box, but allow a page
+  % break, since the best break might be right here.
+  \allowbreak
+  \nointerlineskip
+  \vtop to #1\mil{\vfil}%
+  %
+  % TeX does not even consider page breaks if a penalty added to the
+  % main vertical list is 10000 or more.  But in order to see if the
+  % empty box we just added fits on the page, we must make it consider
+  % page breaks.  On the other hand, we don't want to actually break the
+  % page after the empty box.  So we use a penalty of 9999.
+  %
+  % There is an extremely small chance that TeX will actually break the
+  % page at this \penalty, if there are no other feasible breakpoints in
+  % sight.  (If the user is using lots of big @group commands, which
+  % almost-but-not-quite fill up a page, TeX will have a hard time doing
+  % good page breaking, for example.)  However, I could not construct an
+  % example where a page broke at this \penalty; if it happens in a real
+  % document, then we can reconsider our strategy.
+  \penalty9999
+  %
+  % Back up by the size of the box, whether we did a page break or not.
+  \kern -#1\mil
+  %
+  % Do not allow a page break right after this kern.
+  \nobreak
+}
+
+% @br   forces paragraph break
+
+\let\br = \par
+
+% @dots{} output an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{%
+  \leavevmode
+  \hbox to 1.5em{%
+    \hskip 0pt plus 0.25fil minus 0.25fil
+    .\hss.\hss.%
+    \hskip 0pt plus 0.5fil minus 0.5fil
+  }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+% 
+\def\enddots{%
+  \leavevmode
+  \hbox to 2em{%
+    \hskip 0pt plus 0.25fil minus 0.25fil
+    .\hss.\hss.\hss.%
+    \hskip 0pt plus 0.5fil minus 0.5fil
+  }%
+  \spacefactor=3000
+}
+
+
+% @page    forces the start of a new page
+%
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+% This records the amount of indent in the innermost environment.
+% That's how much \exdent should take out.
+\newskip\exdentamount
+
+% This defn is used inside fill environments such as @defun.
+\def\exdent{\parsearg\exdentyyy}
+\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
+
+% This defn is used inside nofill environments such as @example.
+\def\nofillexdent{\parsearg\nofillexdentyyy}
+\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
+\leftline{\hskip\leftskip{\rm#1}}}}
+
+% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
+
+\def\inmargin#1{%
+\strut\vadjust{\nobreak\kern-\strutdepth
+  \vtop to \strutdepth{\baselineskip\strutdepth\vss
+  \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
+\newskip\inmarginspacing \inmarginspacing=1cm
+\def\strutdepth{\dp\strutbox}
+
+%\hbox{{\rm#1}}\hfil\break}}
+
+% @include file    insert text of that file as input.
+% Allow normal characters that  we make active in the argument (a file name).
+\def\include{\begingroup
+  \catcode`\\=12
+  \catcode`~=12
+  \catcode`^=12
+  \catcode`_=12
+  \catcode`|=12
+  \catcode`<=12
+  \catcode`>=12
+  \catcode`+=12
+  \parsearg\includezzz}
+% Restore active chars for included file.
+\def\includezzz#1{\endgroup\begingroup
+  % Read the included file in a group so nested @include's work.
+  \def\thisfile{#1}%
+  \input\thisfile
+\endgroup}
+
+\def\thisfile{}
+
+% @center line   outputs that line, centered
+
+\def\center{\parsearg\centerzzz}
+\def\centerzzz #1{{\advance\hsize by -\leftskip
+\advance\hsize by -\rightskip
+\centerline{#1}}}
+
+% @sp n   outputs n lines of vertical space
+
+\def\sp{\parsearg\spxxx}
+\def\spxxx #1{\vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore  is another way to write a comment
+
+\def\comment{\begingroup \catcode`\^^M=\other%
+\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
+\commentxxx}
+{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
+
+\let\c=\comment
+
+% @paragraphindent  is defined for the Info formatting commands only.
+\let\paragraphindent=\comment
+
+% Prevent errors for section commands.
+% Used in @ignore and in failing conditionals.
+\def\ignoresections{%
+\let\chapter=\relax
+\let\unnumbered=\relax
+\let\top=\relax
+\let\unnumberedsec=\relax
+\let\unnumberedsection=\relax
+\let\unnumberedsubsec=\relax
+\let\unnumberedsubsection=\relax
+\let\unnumberedsubsubsec=\relax
+\let\unnumberedsubsubsection=\relax
+\let\section=\relax
+\let\subsec=\relax
+\let\subsubsec=\relax
+\let\subsection=\relax
+\let\subsubsection=\relax
+\let\appendix=\relax
+\let\appendixsec=\relax
+\let\appendixsection=\relax
+\let\appendixsubsec=\relax
+\let\appendixsubsection=\relax
+\let\appendixsubsubsec=\relax
+\let\appendixsubsubsection=\relax
+\let\contents=\relax
+\let\smallbook=\relax
+\let\titlepage=\relax
+}
+
+% Used in nested conditionals, where we have to parse the Texinfo source
+% and so want to turn off most commands, in case they are used
+% incorrectly.
+%
+\def\ignoremorecommands{%
+  \let\defcodeindex = \relax
+  \let\defcv = \relax
+  \let\deffn = \relax
+  \let\deffnx = \relax
+  \let\defindex = \relax
+  \let\defivar = \relax
+  \let\defmac = \relax
+  \let\defmethod = \relax
+  \let\defop = \relax
+  \let\defopt = \relax
+  \let\defspec = \relax
+  \let\deftp = \relax
+  \let\deftypefn = \relax
+  \let\deftypefun = \relax
+  \let\deftypevar = \relax
+  \let\deftypevr = \relax
+  \let\defun = \relax
+  \let\defvar = \relax
+  \let\defvr = \relax
+  \let\ref = \relax
+  \let\xref = \relax
+  \let\printindex = \relax
+  \let\pxref = \relax
+  \let\settitle = \relax
+  \let\setchapternewpage = \relax
+  \let\setchapterstyle = \relax
+  \let\everyheading = \relax
+  \let\evenheading = \relax
+  \let\oddheading = \relax
+  \let\everyfooting = \relax
+  \let\evenfooting = \relax
+  \let\oddfooting = \relax
+  \let\headings = \relax
+  \let\include = \relax
+  \let\lowersections = \relax
+  \let\down = \relax
+  \let\raisesections = \relax
+  \let\up = \relax
+  \let\set = \relax
+  \let\clear = \relax
+  \let\item = \relax
+}
+
+% Ignore @ignore ... @end ignore.
+%
+\def\ignore{\doignore{ignore}}
+
+% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
+%
+\def\ifinfo{\doignore{ifinfo}}
+\def\ifhtml{\doignore{ifhtml}}
+\def\ifnottex{\doignore{ifnottex}}
+\def\html{\doignore{html}}
+\def\menu{\doignore{menu}}
+\def\direntry{\doignore{direntry}}
+
+% @dircategory CATEGORY  -- specify a category of the dir file
+% which this file should belong to.  Ignore this in TeX.
+\let\dircategory = \comment
+
+% Ignore text until a line `@end #1'.
+%
+\def\doignore#1{\begingroup
+  % Don't complain about control sequences we have declared \outer.
+  \ignoresections
+  %
+  % Define a command to swallow text until we reach `@end #1'.
+  % This @ is a catcode 12 token (that is the normal catcode of @ in
+  % this texinfo.tex file).  We change the catcode of @ below to match.
+  \long\def\doignoretext##1@end #1{\enddoignore}%
+  %
+  % Make sure that spaces turn into tokens that match what \doignoretext wants.
+  \catcode32 = 10
+  %
+  % Ignore braces, too, so mismatched braces don't cause trouble.
+  \catcode`\{ = 9
+  \catcode`\} = 9
+  %
+  % We must not have @c interpreted as a control sequence.
+  \catcode`\@ = 12
+  %
+  % Make the letter c a comment character so that the rest of the line
+  % will be ignored. This way, the document can have (for example)
+  %   @c @end ifinfo
+  % and the @end ifinfo will be properly ignored.
+  % (We've just changed @ to catcode 12.)
+  \catcode`\c = 14
+  %
+  % And now expand that command.
+  \doignoretext
+}
+
+% What we do to finish off ignored text.
+%
+\def\enddoignore{\endgroup\ignorespaces}%
+
+\newif\ifwarnedobs\warnedobsfalse
+\def\obstexwarn{%
+  \ifwarnedobs\relax\else
+  % We need to warn folks that they may have trouble with TeX 3.0.
+  % This uses \immediate\write16 rather than \message to get newlines.
+    \immediate\write16{}
+    \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
+    \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
+    \immediate\write16{If you are running another version of TeX, relax.}
+    \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
+    \immediate\write16{  Then upgrade your TeX installation if you can.}
+    \immediate\write16{  (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
+    \immediate\write16{If you are stuck with version 3.0, run the}
+    \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
+    \immediate\write16{  to use a workaround.}
+    \immediate\write16{}
+    \global\warnedobstrue
+    \fi
+}
+
+% **In TeX 3.0, setting text in \nullfont hangs tex.  For a
+% workaround (which requires the file ``dummy.tfm'' to be installed),
+% uncomment the following line:
+%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
+
+% Ignore text, except that we keep track of conditional commands for
+% purposes of nesting, up to an `@end #1' command.
+%
+\def\nestedignore#1{%
+  \obstexwarn
+  % We must actually expand the ignored text to look for the @end
+  % command, so that nested ignore constructs work.  Thus, we put the
+  % text into a \vbox and then do nothing with the result.  To minimize
+  % the change of memory overflow, we follow the approach outlined on
+  % page 401 of the TeXbook: make the current font be a dummy font.
+  %
+  \setbox0 = \vbox\bgroup
+    % Don't complain about control sequences we have declared \outer.
+    \ignoresections
+    %
+    % Define `@end #1' to end the box, which will in turn undefine the
+    % @end command again.
+    \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
+    %
+    % We are going to be parsing Texinfo commands.  Most cause no
+    % trouble when they are used incorrectly, but some commands do
+    % complicated argument parsing or otherwise get confused, so we
+    % undefine them.
+    %
+    % We can't do anything about stray @-signs, unfortunately;
+    % they'll produce `undefined control sequence' errors.
+    \ignoremorecommands
+    %
+    % Set the current font to be \nullfont, a TeX primitive, and define
+    % all the font commands to also use \nullfont.  We don't use
+    % dummy.tfm, as suggested in the TeXbook, because not all sites
+    % might have that installed.  Therefore, math mode will still
+    % produce output, but that should be an extremely small amount of
+    % stuff compared to the main input.
+    %
+    \nullfont
+    \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
+    \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
+    \let\tensf = \nullfont
+    % Similarly for index fonts (mostly for their use in
+    % smallexample)
+    \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
+    \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
+    \let\indsf = \nullfont
+    %
+    % Don't complain when characters are missing from the fonts.
+    \tracinglostchars = 0
+    %
+    % Don't bother to do space factor calculations.
+    \frenchspacing
+    %
+    % Don't report underfull hboxes.
+    \hbadness = 10000
+    %
+    % Do minimal line-breaking.
+    \pretolerance = 10000
+    %
+    % Do not execute instructions in @tex
+    \def\tex{\doignore{tex}}%
+    % Do not execute macro definitions.
+    % `c' is a comment character, so the word `macro' will get cut off.
+    \def\macro{\doignore{ma}}%
+}
+
+% @set VAR sets the variable VAR to an empty value.
+% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
+%
+% Since we want to separate VAR from REST-OF-LINE (which might be
+% empty), we can't just use \parsearg; we have to insert a space of our
+% own to delimit the rest of the line, and then take it out again if we
+% didn't need it.  Make sure the catcode of space is correct to avoid
+% losing inside @example, for instance.
+%
+\def\set{\begingroup\catcode` =10
+  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
+  \parsearg\setxxx}
+\def\setxxx#1{\setyyy#1 \endsetyyy}
+\def\setyyy#1 #2\endsetyyy{%
+  \def\temp{#2}%
+  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
+  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
+  \fi
+  \endgroup
+}
+% Can't use \xdef to pre-expand #2 and save some time, since \temp or
+% \next or other control sequences that we've defined might get us into
+% an infinite loop. Consider `@set foo @cite{bar}'.
+\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
+
+% @clear VAR clears (i.e., unsets) the variable VAR.
+%
+\def\clear{\parsearg\clearxxx}
+\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
+
+% @value{foo} gets the text saved in variable foo.
+%
+{
+  \catcode`\_ = \active
+  %
+  % We might end up with active _ or - characters in the argument if
+  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
+  % such active characters to their normal equivalents.
+  \gdef\value{\begingroup
+    \catcode`\-=12 \catcode`\_=12
+    \indexbreaks \let_\normalunderscore
+    \valuexxx}
+}
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
+
+% We have this subroutine so that we can handle at least some @value's
+% properly in indexes (we \let\value to this in \indexdummies).  Ones
+% whose names contain - or _ still won't work, but we can't do anything
+% about that.  The command has to be fully expandable, since the result
+% winds up in the index file.  This means that if the variable's value
+% contains other Texinfo commands, it's almost certain it will fail
+% (although perhaps we could fix that with sufficient work to do a
+% one-level expansion on the result, instead of complete).
+% 
+\def\expandablevalue#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    {[No value for ``#1'']v}%
+  \else
+    \csname SET#1\endcsname
+  \fi
+}
+
+% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
+% with @set.
+%
+\def\ifset{\parsearg\ifsetxxx}
+\def\ifsetxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifsetfail
+  \else
+    \expandafter\ifsetsucceed
+  \fi
+}
+\def\ifsetsucceed{\conditionalsucceed{ifset}}
+\def\ifsetfail{\nestedignore{ifset}}
+\defineunmatchedend{ifset}
+
+% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% defined with @set, or has been undefined with @clear.
+%
+\def\ifclear{\parsearg\ifclearxxx}
+\def\ifclearxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifclearsucceed
+  \else
+    \expandafter\ifclearfail
+  \fi
+}
+\def\ifclearsucceed{\conditionalsucceed{ifclear}}
+\def\ifclearfail{\nestedignore{ifclear}}
+\defineunmatchedend{ifclear}
+
+% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
+% following, through the first @end iftex (etc.).  Make `@end iftex'
+% (etc.) valid only after an @iftex.
+%
+\def\iftex{\conditionalsucceed{iftex}}
+\def\ifnothtml{\conditionalsucceed{ifnothtml}}
+\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
+\defineunmatchedend{iftex}
+\defineunmatchedend{ifnothtml}
+\defineunmatchedend{ifnotinfo}
+
+% We can't just want to start a group at @iftex (for example) and end it
+% at @end iftex, since then @set commands inside the conditional have no
+% effect (they'd get reverted at the end of the group).  So we must
+% define \Eiftex to redefine itself to be its previous value.  (We can't
+% just define it to fail again with an ``unmatched end'' error, since
+% the @ifset might be nested.)
+%
+\def\conditionalsucceed#1{%
+  \edef\temp{%
+    % Remember the current value of \E#1.
+    \let\nece{prevE#1} = \nece{E#1}%
+    %
+    % At the `@end #1', redefine \E#1 to be its previous value.
+    \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
+  }%
+  \temp
+}
+
+% We need to expand lots of \csname's, but we don't want to expand the
+% control sequences after we've constructed them.
+%
+\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
+
+% @asis just yields its argument.  Used with @table, for example.
+%
+\def\asis#1{#1}
+
+% @math means output in math mode.
+% We don't use $'s directly in the definition of \math because control
+% sequences like \math are expanded when the toc file is written.  Then,
+% we read the toc file back, the $'s will be normal characters (as they
+% should be, according to the definition of Texinfo).  So we must use a
+% control sequence to switch into and out of math mode.
+%
+% This isn't quite enough for @math to work properly in indices, but it
+% seems unlikely it will ever be needed there.
+%
+\let\implicitmath = $
+\def\math#1{\implicitmath #1\implicitmath}
+
+% @bullet and @minus need the same treatment as @math, just above.
+\def\bullet{\implicitmath\ptexbullet\implicitmath}
+\def\minus{\implicitmath-\implicitmath}
+
+% @refill is a no-op.
+\let\refill=\relax
+
+% If working on a large document in chapters, it is convenient to
+% be able to disable indexing, cross-referencing, and contents, for test runs.
+% This is done with @novalidate (before @setfilename).
+%
+\newif\iflinks \linkstrue % by default we want the aux files.
+\let\novalidate = \linksfalse
+
+% @setfilename is done at the beginning of every texinfo file.
+% So open here the files we need to have open while reading the input.
+% This makes it possible to make a .fmt file for texinfo.
+\def\setfilename{%
+   \iflinks 
+     \readauxfile
+   \fi % \openindices needs to do some work in any case.
+   \openindices
+   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
+   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+   %
+   % If texinfo.cnf is present on the system, read it.
+   % Useful for site-wide @afourpaper, etc.
+   % Just to be on the safe side, close the input stream before the \input.
+   \openin 1 texinfo.cnf
+   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
+   \closein1
+   \temp
+   %
+   \comment % Ignore the actual filename.
+}
+
+% Called from \setfilename.
+% 
+\def\openindices{%
+  \newindex{cp}%
+  \newcodeindex{fn}%
+  \newcodeindex{vr}%
+  \newcodeindex{tp}%
+  \newcodeindex{ky}%
+  \newcodeindex{pg}%
+}
+
+% @bye.
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+
+\message{fonts,}
+% Font-change commands.
+
+% Texinfo sort of supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf analogous to plain's \rm, etc.
+\newfam\sffam
+\def\sf{\fam=\sffam \tensf}
+\let\li = \sf % Sometimes we call it \li, not \sf.
+
+% We don't need math for this one.
+\def\ttsl{\tenttsl}
+
+% Use Computer Modern fonts at \magstephalf (11pt).
+\newcount\mainmagstep
+\mainmagstep=\magstephalf
+
+% Set the font macro #1 to the font named #2, adding on the
+% specified font prefix (normally `cm').
+% #3 is the font's design size, #4 is a scale factor
+\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
+
+% Use cm as the default font prefix.
+% To specify the font prefix, you must define \fontprefix
+% before you read in texinfo.tex.
+\ifx\fontprefix\undefined
+\def\fontprefix{cm}
+\fi
+% Support font families that don't use the same naming scheme as CM.
+\def\rmshape{r}
+\def\rmbshape{bx}               %where the normal face is bold
+\def\bfshape{b}
+\def\bxshape{bx}
+\def\ttshape{tt}
+\def\ttbshape{tt}
+\def\ttslshape{sltt}
+\def\itshape{ti}
+\def\itbshape{bxti}
+\def\slshape{sl}
+\def\slbshape{bxsl}
+\def\sfshape{ss}
+\def\sfbshape{ss}
+\def\scshape{csc}
+\def\scbshape{csc}
+
+\ifx\bigger\relax
+\let\mainmagstep=\magstep1
+\setfont\textrm\rmshape{12}{1000}
+\setfont\texttt\ttshape{12}{1000}
+\else
+\setfont\textrm\rmshape{10}{\mainmagstep}
+\setfont\texttt\ttshape{10}{\mainmagstep}
+\fi
+% Instead of cmb10, you many want to use cmbx10.
+% cmbx10 is a prettier font on its own, but cmb10
+% looks better when embedded in a line with cmr10.
+\setfont\textbf\bfshape{10}{\mainmagstep}
+\setfont\textit\itshape{10}{\mainmagstep}
+\setfont\textsl\slshape{10}{\mainmagstep}
+\setfont\textsf\sfshape{10}{\mainmagstep}
+\setfont\textsc\scshape{10}{\mainmagstep}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+
+% A few fonts for @defun, etc.
+\setfont\defbf\bxshape{10}{\magstep1} %was 1314
+\setfont\deftt\ttshape{10}{\magstep1}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
+
+% Fonts for indices and small examples (9pt).
+% We actually use the slanted font rather than the italic,
+% because texinfo normally uses the slanted fonts for that.
+% Do not make many font distinctions in general in the index, since they
+% aren't very useful.
+\setfont\ninett\ttshape{9}{1000}
+\setfont\ninettsl\ttslshape{10}{900}
+\setfont\indrm\rmshape{9}{1000}
+\setfont\indit\itshape{9}{1000}
+\setfont\indsl\slshape{9}{1000}
+\let\indtt=\ninett
+\let\indttsl=\ninettsl
+\let\indsf=\indrm
+\let\indbf=\indrm
+\setfont\indsc\scshape{10}{900}
+\font\indi=cmmi9
+\font\indsy=cmsy9
+
+% Fonts for title page:
+\setfont\titlerm\rmbshape{12}{\magstep3}
+\setfont\titleit\itbshape{10}{\magstep4}
+\setfont\titlesl\slbshape{10}{\magstep4}
+\setfont\titlett\ttbshape{12}{\magstep3}
+\setfont\titlettsl\ttslshape{10}{\magstep4}
+\setfont\titlesf\sfbshape{17}{\magstep1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\authorrm{\secrm}
+
+% Chapter (and unnumbered) fonts (17.28pt).
+\setfont\chaprm\rmbshape{12}{\magstep2}
+\setfont\chapit\itbshape{10}{\magstep3}
+\setfont\chapsl\slbshape{10}{\magstep3}
+\setfont\chaptt\ttbshape{12}{\magstep2}
+\setfont\chapttsl\ttslshape{10}{\magstep3}
+\setfont\chapsf\sfbshape{17}{1000}
+\let\chapbf=\chaprm
+\setfont\chapsc\scbshape{10}{\magstep3}
+\font\chapi=cmmi12 scaled \magstep2
+\font\chapsy=cmsy10 scaled \magstep3
+
+% Section fonts (14.4pt).
+\setfont\secrm\rmbshape{12}{\magstep1}
+\setfont\secit\itbshape{10}{\magstep2}
+\setfont\secsl\slbshape{10}{\magstep2}
+\setfont\sectt\ttbshape{12}{\magstep1}
+\setfont\secttsl\ttslshape{10}{\magstep2}
+\setfont\secsf\sfbshape{12}{\magstep1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep2}
+\font\seci=cmmi12 scaled \magstep1
+\font\secsy=cmsy10 scaled \magstep2
+
+% \setfont\ssecrm\bxshape{10}{\magstep1}    % This size an font looked bad.
+% \setfont\ssecit\itshape{10}{\magstep1}    % The letters were too crowded.
+% \setfont\ssecsl\slshape{10}{\magstep1}
+% \setfont\ssectt\ttshape{10}{\magstep1}
+% \setfont\ssecsf\sfshape{10}{\magstep1}
+
+%\setfont\ssecrm\bfshape{10}{1315}      % Note the use of cmb rather than cmbx.
+%\setfont\ssecit\itshape{10}{1315}      % Also, the size is a little larger than
+%\setfont\ssecsl\slshape{10}{1315}      % being scaled magstep1.
+%\setfont\ssectt\ttshape{10}{1315}
+%\setfont\ssecsf\sfshape{10}{1315}
+
+%\let\ssecbf=\ssecrm
+
+% Subsection fonts (13.15pt).
+\setfont\ssecrm\rmbshape{12}{\magstephalf}
+\setfont\ssecit\itbshape{10}{1315}
+\setfont\ssecsl\slbshape{10}{1315}
+\setfont\ssectt\ttbshape{12}{\magstephalf}
+\setfont\ssecttsl\ttslshape{10}{1315}
+\setfont\ssecsf\sfbshape{12}{\magstephalf}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{\magstep1}
+\font\sseci=cmmi12 scaled \magstephalf
+\font\ssecsy=cmsy10 scaled 1315
+% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
+% but that is not a standard magnification.
+
+% In order for the font changes to affect most math symbols and letters,
+% we have to define the \textfont of the standard families.  Since
+% texinfo doesn't allow for producing subscripts and superscripts, we
+% don't bother to reset \scriptfont and \scriptscriptfont (which would
+% also require loading a lot more fonts).
+%
+\def\resetmathfonts{%
+  \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
+  \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
+  \textfont\ttfam = \tentt \textfont\sffam = \tensf
+}
+
+
+% The font-changing commands redefine the meanings of \tenSTYLE, instead
+% of just \STYLE.  We do this so that font changes will continue to work
+% in math mode, where it is the current \fam that is relevant in most
+% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
+% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
+% redefine \bf itself.
+\def\textfonts{%
+  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
+  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
+  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
+  \resetmathfonts}
+\def\titlefonts{%
+  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
+  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
+  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
+  \let\tenttsl=\titlettsl
+  \resetmathfonts \setleading{25pt}}
+\def\titlefont#1{{\titlefonts\rm #1}}
+\def\chapfonts{%
+  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
+  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
+  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
+  \resetmathfonts \setleading{19pt}}
+\def\secfonts{%
+  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
+  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
+  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
+  \resetmathfonts \setleading{16pt}}
+\def\subsecfonts{%
+  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
+  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
+  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
+  \resetmathfonts \setleading{15pt}}
+\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
+\def\indexfonts{%
+  \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
+  \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
+  \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
+  \resetmathfonts \setleading{12pt}}
+
+% Set up the default fonts, so we can use them for creating boxes.
+%
+\textfonts
+
+% Define these so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}
+\setfont\shortcontbf\bxshape{12}{1000}
+\setfont\shortcontsl\slshape{12}{1000}
+
+%% Add scribe-like font environments, plus @l for inline lisp (usually sans
+%% serif) and @ii for TeX italic
+
+% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
+% unless the following character is such as not to need one.
+\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
+\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
+\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
+
+\let\i=\smartitalic
+\let\var=\smartslanted
+\let\dfn=\smartslanted
+\let\emph=\smartitalic
+\let\cite=\smartslanted
+
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+% We can't just use \exhyphenpenalty, because that only has effect at
+% the end of a paragraph.  Restore normal hyphenation at the end of the
+% group within which \nohyphenation is presumably called.
+%
+\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
+\def\restorehyphenation{\hyphenchar\font = `- }
+
+\def\t#1{%
+  {\tt \rawbackslash \frenchspacing #1}%
+  \null
+}
+\let\ttfont=\t
+\def\samp#1{`\tclose{#1}'\null}
+\setfont\smallrm\rmshape{8}{1000}
+\font\smallsy=cmsy9
+\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
+  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
+    \vbox{\hrule\kern-0.4pt
+     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
+    \kern-0.4pt\hrule}%
+  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
+% The old definition, with no lozenge:
+%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+% @file, @option are the same as @samp.
+\let\file=\samp
+\let\option=\samp
+
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
+\def\tclose#1{%
+  {%
+    % Change normal interword space to be same as for the current font.
+    \spaceskip = \fontdimen2\font
+    %
+    % Switch to typewriter.
+    \tt
+    %
+    % But `\ ' produces the large typewriter interword space.
+    \def\ {{\spaceskip = 0pt{} }}%
+    %
+    % Turn off hyphenation.
+    \nohyphenation
+    %
+    \rawbackslash
+    \frenchspacing
+    #1%
+  }%
+  \null
+}
+
+% We *must* turn on hyphenation at `-' and `_' in \code.
+% Otherwise, it is too hard to avoid overfull hboxes
+% in the Emacs manual, the Library manual, etc.
+
+% Unfortunately, TeX uses one parameter (\hyphenchar) to control
+% both hyphenation at - and hyphenation within words.
+% We must therefore turn them both off (\tclose does that)
+% and arrange explicitly to hyphenate at a dash.
+%  -- rms.
+{
+  \catcode`\-=\active
+  \catcode`\_=\active
+  %
+  \global\def\code{\begingroup
+    \catcode`\-=\active \let-\codedash
+    \catcode`\_=\active \let_\codeunder
+    \codex
+  }
+  %
+  % If we end up with any active - characters when handling the index,
+  % just treat them as a normal -.
+  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
+}
+
+\def\realdash{-}
+\def\codedash{-\discretionary{}{}{}}
+\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
+\def\codex #1{\tclose{#1}\endgroup}
+
+%\let\exp=\tclose  %Was temporary
+
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+%   `example' (@kbd uses ttsl only inside of @example and friends),
+%   or `code' (@kbd uses normal tty font always).
+\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
+\def\kbdinputstylexxx#1{%
+  \def\arg{#1}%
+  \ifx\arg\worddistinct
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+  \else\ifx\arg\wordexample
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+  \else\ifx\arg\wordcode
+    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+  \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is kbdinputdistinct.  (Too much of a hassle to call the macro,
+% the catcodes are wrong for parsearg to work.)
+\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else{\tclose{\kbdfont\look}}\fi
+\else{\tclose{\kbdfont\look}}\fi}
+
+% For @url, @env, @command quotes seem unnecessary, so use \code.
+\let\url=\code
+\let\env=\code
+\let\command=\code
+
+% @uref (abbreviation for `urlref') takes an optional second argument
+% specifying the text to display.  First (mandatory) arg is the url.
+% Perhaps eventually put in a hypertex \special here.
+% 
+\def\uref#1{\urefxxx #1,,\finish}
+\def\urefxxx#1,#2,#3\finish{%
+  \setbox0 = \hbox{\ignorespaces #2}%
+  \ifdim\wd0 > 0pt
+    \unhbox0\ (\code{#1})%
+  \else
+    \code{#1}%
+  \fi
+}
+
+% rms does not like the angle brackets --karl, 17may97.
+% So now @email is just like @uref.
+%\def\email#1{\angleleft{\tt #1}\angleright}
+\let\email=\uref
+
+% Check if we are currently using a typewriter font.  Since all the
+% Computer Modern typewriter fonts have zero interword stretch (and
+% shrink), and it is reasonable to expect all typewriter fonts to have
+% this property, we can check that font parameter.
+%
+\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+
+% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
+% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
+%
+\def\dmn#1{\thinspace #1}
+
+\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
+
+% @l was never documented to mean ``switch to the Lisp font'',
+% and it is not used as such in any manual I can find.  We need it for
+% Polish suppressed-l.  --karl, 22sep96.
+%\def\l#1{{\li #1}\null}
+
+% Explicit font changes: @r, @sc, undocumented @ii.
+\def\r#1{{\rm #1}}              % roman font
+\def\sc#1{{\smallcaps#1}}       % smallcaps font
+\def\ii#1{{\it #1}}             % italic font
+
+% @acronym downcases the argument and prints in smallcaps.
+\def\acronym#1{{\smallcaps \lowercase{#1}}}
+
+% @pounds{} is a sterling sign.
+\def\pounds{{\it\$}}
+
+
+\message{page headings,}
+
+\newskip\titlepagetopglue \titlepagetopglue = 1.5in
+\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
+
+% First the title page.  Must do @settitle before @titlepage.
+\newif\ifseenauthor
+\newif\iffinishedtitlepage
+
+% Do an implicit @contents or @shortcontents after @end titlepage if the
+% user says @contentsaftertitlepage or @shortcontentsaftertitlepage.
+% 
+\newif\ifsetcontentsaftertitlepage
+ \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
+\newif\ifsetshortcontentsaftertitlepage
+ \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
+
+\def\shorttitlepage{\parsearg\shorttitlepagezzz}
+\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+        \endgroup\page\hbox{}\page}
+
+\def\titlepage{\begingroup \parindent=0pt \textfonts
+   \let\subtitlerm=\tenrm
+   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
+   %
+   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
+   %
+   % Leave some space at the very top of the page.
+   \vglue\titlepagetopglue
+   %
+   % Now you can print the title using @title.
+   \def\title{\parsearg\titlezzz}%
+   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
+                    % print a rule at the page bottom also.
+                    \finishedtitlepagefalse
+                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
+   % No rule at page bottom unless we print one at the top with @title.
+   \finishedtitlepagetrue
+   %
+   % Now you can put text using @subtitle.
+   \def\subtitle{\parsearg\subtitlezzz}%
+   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
+   %
+   % @author should come last, but may come many times.
+   \def\author{\parsearg\authorzzz}%
+   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
+      {\authorfont \leftline{##1}}}%
+   %
+   % Most title ``pages'' are actually two pages long, with space
+   % at the top of the second.  We don't want the ragged left on the second.
+   \let\oldpage = \page
+   \def\page{%
+      \iffinishedtitlepage\else
+         \finishtitlepage
+      \fi
+      \oldpage
+      \let\page = \oldpage
+      \hbox{}}%
+%   \def\page{\oldpage \hbox{}}
+}
+
+\def\Etitlepage{%
+   \iffinishedtitlepage\else
+      \finishtitlepage
+   \fi
+   % It is important to do the page break before ending the group,
+   % because the headline and footline are only empty inside the group.
+   % If we use the new definition of \page, we always get a blank page
+   % after the title page, which we certainly don't want.
+   \oldpage
+   \endgroup
+   %
+   % If they want short, they certainly want long too.
+   \ifsetshortcontentsaftertitlepage
+     \shortcontents
+     \contents
+     \global\let\shortcontents = \relax
+     \global\let\contents = \relax
+   \fi
+   %
+   \ifsetcontentsaftertitlepage
+     \contents
+     \global\let\contents = \relax
+     \global\let\shortcontents = \relax
+   \fi
+   %
+   \HEADINGSon
+}
+
+\def\finishtitlepage{%
+   \vskip4pt \hrule height 2pt width \hsize
+   \vskip\titlepagebottomglue
+   \finishedtitlepagetrue
+}
+
+%%% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks\evenheadline    % headline on even pages
+\newtoks\oddheadline     % headline on odd pages
+\newtoks\evenfootline    % footline on even pages
+\newtoks\oddfootline     % footline on odd pages
+
+% Now make Tex use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
+                            \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
+                            \else \the\evenfootline \fi}\HEADINGShook}
+\let\HEADINGShook=\relax
+
+% Commands to set those variables.
+% For example, this is what  @headings on  does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\everyheading{\parsearg\everyheadingxxx}
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\everyfooting{\parsearg\everyfootingxxx}
+
+{\catcode`\@=0 %
+
+\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
+\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
+\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+
+\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
+\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
+\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
+  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
+  %
+  % Leave some space for the footline.  Hopefully ok to assume
+  % @evenfooting will not be used by itself.
+  \global\advance\pageheight by -\baselineskip
+  \global\advance\vsize by -\baselineskip
+}
+
+\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+%
+}% unbind the catcode of @.
+
+% @headings double      turns headings on for double-sided printing.
+% @headings single      turns headings on for single-sided printing.
+% @headings off         turns them off.
+% @headings on          same as @headings double, retained for compatibility.
+% @headings after       turns on double-sided headings after this page.
+% @headings doubleafter turns on double-sided headings after this page.
+% @headings singleafter turns on single-sided headings after this page.
+% By default, they are off at the start of a document,
+% and turned `on' after @end titlepage.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\HEADINGSoff{
+\global\evenheadline={\hfil} \global\evenfootline={\hfil}
+\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
+\HEADINGSoff
+% When we turn headings on, set the page number to 1.
+% For double-sided printing, put current file name in lower left corner,
+% chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSdouble{
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+\let\contentsalignmacro = \chappager
+
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingle{
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+\def\HEADINGSon{\HEADINGSdouble}
+
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\let\HEADINGSdoubleafter=\HEADINGSafter
+\def\HEADINGSdoublex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
+\def\HEADINGSsinglex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+
+% Subroutines used in generating headings
+% Produces Day Month Year style of output.
+\def\today{\number\day\space
+\ifcase\month\or
+January\or February\or March\or April\or May\or June\or
+July\or August\or September\or October\or November\or December\fi
+\space\number\year}
+
+% Use this if you want the Month Day, Year style of output.
+%\def\today{\ifcase\month\or
+%January\or February\or March\or April\or May\or June\or
+%July\or August\or September\or October\or November\or December\fi
+%\space\number\day, \number\year}
+
+% @settitle line...  specifies the title of the document, for headings
+% It generates no output of its own
+
+\def\thistitle{No Title}
+\def\settitle{\parsearg\settitlezzz}
+\def\settitlezzz #1{\gdef\thistitle{#1}}
+
+
+\message{tables,}
+% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent  \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin  \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
+% these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\newif\ifitemxneedsnegativevskip
+
+\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\itemxpar \parsearg\itemzzz}
+
+\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
+\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
+
+\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
+\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
+
+\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
+                 \itemzzz {#1}}
+
+\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
+                 \itemzzz {#1}}
+
+\def\itemzzz #1{\begingroup %
+  \advance\hsize by -\rightskip
+  \advance\hsize by -\tableindent
+  \setbox0=\hbox{\itemfont{#1}}%
+  \itemindex{#1}%
+  \nobreak % This prevents a break before @itemx.
+  %
+  % If the item text does not fit in the space we have, put it on a line
+  % by itself, and do not allow a page break either before or after that
+  % line.  We do not start a paragraph here because then if the next
+  % command is, e.g., @kindex, the whatsit would get put into the
+  % horizontal list on a line by itself, resulting in extra blank space.
+  \ifdim \wd0>\itemmax
+    %
+    % Make this a paragraph so we get the \parskip glue and wrapping,
+    % but leave it ragged-right.
+    \begingroup
+      \advance\leftskip by-\tableindent
+      \advance\hsize by\tableindent
+      \advance\rightskip by0pt plus1fil
+      \leavevmode\unhbox0\par
+    \endgroup
+    %
+    % We're going to be starting a paragraph, but we don't want the
+    % \parskip glue -- logically it's part of the @item we just started.
+    \nobreak \vskip-\parskip
+    %
+    % Stop a page break at the \parskip glue coming up.  Unfortunately
+    % we can't prevent a possible page break at the following
+    % \baselineskip glue.
+    \nobreak
+    \endgroup
+    \itemxneedsnegativevskipfalse
+  \else
+    % The item text fits into the space.  Start a paragraph, so that the
+    % following text (if any) will end up on the same line.  
+    \noindent
+    % Do this with kerns and \unhbox so that if there is a footnote in
+    % the item text, it can migrate to the main vertical list and
+    % eventually be printed.
+    \nobreak\kern-\tableindent
+    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
+    \unhbox0
+    \nobreak\kern\dimen0
+    \endgroup
+    \itemxneedsnegativevskiptrue
+  \fi
+}
+
+\def\item{\errmessage{@item while not in a table}}
+\def\itemx{\errmessage{@itemx while not in a table}}
+\def\kitem{\errmessage{@kitem while not in a table}}
+\def\kitemx{\errmessage{@kitemx while not in a table}}
+\def\xitem{\errmessage{@xitem while not in a table}}
+\def\xitemx{\errmessage{@xitemx while not in a table}}
+
+% Contains a kludge to get @end[description] to work.
+\def\description{\tablez{\dontindex}{1}{}{}{}{}}
+
+% @table, @ftable, @vtable.
+\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
+{\obeylines\obeyspaces%
+\gdef\tablex #1^^M{%
+\tabley\dontindex#1        \endtabley}}
+
+\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
+{\obeylines\obeyspaces%
+\gdef\ftablex #1^^M{%
+\tabley\fnitemindex#1        \endtabley
+\def\Eftable{\endgraf\afterenvbreak\endgroup}%
+\let\Etable=\relax}}
+
+\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
+{\obeylines\obeyspaces%
+\gdef\vtablex #1^^M{%
+\tabley\vritemindex#1        \endtabley
+\def\Evtable{\endgraf\afterenvbreak\endgroup}%
+\let\Etable=\relax}}
+
+\def\dontindex #1{}
+\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
+\def\vritemindex #1{\doind {vr}{\code{#1}}}%
+
+{\obeyspaces %
+\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
+\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
+
+\def\tablez #1#2#3#4#5#6{%
+\aboveenvbreak %
+\begingroup %
+\def\Edescription{\Etable}% Necessary kludge.
+\let\itemindex=#1%
+\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
+\ifnum 0#4>0 \tableindent=#4\mil \fi %
+\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
+\def\itemfont{#2}%
+\itemmax=\tableindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \tableindent %
+\exdentamount=\tableindent
+\parindent = 0pt
+\parskip = \smallskipamount
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def\Etable{\endgraf\afterenvbreak\endgroup}%
+\let\item = \internalBitem %
+\let\itemx = \internalBitemx %
+\let\kitem = \internalBkitem %
+\let\kitemx = \internalBkitemx %
+\let\xitem = \internalBxitem %
+\let\xitemx = \internalBxitemx %
+}
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\def\itemize{\parsearg\itemizezzz}
+
+\def\itemizezzz #1{%
+  \begingroup % ended by the @end itemize
+  \itemizey {#1}{\Eitemize}
+}
+
+\def\itemizey #1#2{%
+\aboveenvbreak %
+\itemmax=\itemindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \itemindent %
+\exdentamount=\itemindent
+\parindent = 0pt %
+\parskip = \smallskipamount %
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def#2{\endgraf\afterenvbreak\endgroup}%
+\def\itemcontents{#1}%
+\let\item=\itemizeitem}
+
+% Set sfcode to normal for the chars that usually have another value.
+% These are `.?!:;,'
+\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
+  \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
+
+% \splitoff TOKENS\endmark defines \first to be the first token in
+% TOKENS, and \rest to be the remainder.
+%
+\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
+
+% Allow an optional argument of an uppercase letter, lowercase letter,
+% or number, to specify the first label in the enumerated list.  No
+% argument is the same as `1'.
+%
+\def\enumerate{\parsearg\enumeratezzz}
+\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
+\def\enumeratey #1 #2\endenumeratey{%
+  \begingroup % ended by the @end enumerate
+  %
+  % If we were given no argument, pretend we were given `1'.
+  \def\thearg{#1}%
+  \ifx\thearg\empty \def\thearg{1}\fi
+  %
+  % Detect if the argument is a single token.  If so, it might be a
+  % letter.  Otherwise, the only valid thing it can be is a number.
+  % (We will always have one token, because of the test we just made.
+  % This is a good thing, since \splitoff doesn't work given nothing at
+  % all -- the first parameter is undelimited.)
+  \expandafter\splitoff\thearg\endmark
+  \ifx\rest\empty
+    % Only one token in the argument.  It could still be anything.
+    % A ``lowercase letter'' is one whose \lccode is nonzero.
+    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
+    %   not equal to itself.
+    % Otherwise, we assume it's a number.
+    %
+    % We need the \relax at the end of the \ifnum lines to stop TeX from
+    % continuing to look for a <number>.
+    %
+    \ifnum\lccode\expandafter`\thearg=0\relax
+      \numericenumerate % a number (we hope)
+    \else
+      % It's a letter.
+      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
+        \lowercaseenumerate % lowercase letter
+      \else
+        \uppercaseenumerate % uppercase letter
+      \fi
+    \fi
+  \else
+    % Multiple tokens in the argument.  We hope it's a number.
+    \numericenumerate
+  \fi
+}
+
+% An @enumerate whose labels are integers.  The starting integer is
+% given in \thearg.
+%
+\def\numericenumerate{%
+  \itemno = \thearg
+  \startenumeration{\the\itemno}%
+}
+
+% The starting (lowercase) letter is in \thearg.
+\def\lowercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more lowercase letters in @enumerate; get a bigger
+                  alphabet}%
+    \fi
+    \char\lccode\itemno
+  }%
+}
+
+% The starting (uppercase) letter is in \thearg.
+\def\uppercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more uppercase letters in @enumerate; get a bigger
+                  alphabet}
+    \fi
+    \char\uccode\itemno
+  }%
+}
+
+% Call itemizey, adding a period to the first argument and supplying the
+% common last two arguments.  Also subtract one from the initial value in
+% \itemno, since @item increments \itemno.
+%
+\def\startenumeration#1{%
+  \advance\itemno by -1
+  \itemizey{#1.}\Eenumerate\flushcr
+}
+
+% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
+% to @enumerate.
+%
+\def\alphaenumerate{\enumerate{a}}
+\def\capsenumerate{\enumerate{A}}
+\def\Ealphaenumerate{\Eenumerate}
+\def\Ecapsenumerate{\Eenumerate}
+
+% Definition of @item while inside @itemize.
+
+\def\itemizeitem{%
+\advance\itemno by 1
+{\let\par=\endgraf \smallbreak}%
+\ifhmode \errmessage{In hmode at itemizeitem}\fi
+{\parskip=0in \hskip 0pt
+\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
+\vadjust{\penalty 1200}}%
+\flushcr}
+
+% @multitable macros
+% Amy Hendrickson, 8/18/94, 3/6/96
+%
+% @multitable ... @end multitable will make as many columns as desired.
+% Contents of each column will wrap at width given in preamble.  Width
+% can be specified either with sample text given in a template line,
+% or in percent of \hsize, the current width of text on page.
+
+% Table can continue over pages but will only break between lines.
+
+% To make preamble:
+%
+% Either define widths of columns in terms of percent of \hsize:
+%   @multitable @columnfractions .25 .3 .45
+%   @item ...
+%
+%   Numbers following @columnfractions are the percent of the total
+%   current hsize to be used for each column. You may use as many
+%   columns as desired.
+
+
+% Or use a template:
+%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+%   @item ...
+%   using the widest term desired in each column.
+%
+% For those who want to use more than one line's worth of words in
+% the preamble, break the line within one argument and it
+% will parse correctly, i.e.,
+%
+%     @multitable {Column 1 template} {Column 2 template} {Column 3
+%      template}
+% Not:
+%     @multitable {Column 1 template} {Column 2 template}
+%      {Column 3 template}
+
+% Each new table line starts with @item, each subsequent new column
+% starts with @tab. Empty columns may be produced by supplying @tab's
+% with nothing between them for as many times as empty columns are needed,
+% ie, @tab@tab@tab will produce two empty columns.
+
+% @item, @tab, @multitable or @end multitable do not need to be on their
+% own lines, but it will not hurt if they are.
+
+% Sample multitable:
+
+%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+%   @item first col stuff @tab second col stuff @tab third col
+%   @item
+%   first col stuff
+%   @tab
+%   second col stuff
+%   @tab
+%   third col
+%   @item first col stuff @tab second col stuff
+%   @tab Many paragraphs of text may be used in any column.
+%
+%         They will wrap at the width determined by the template.
+%   @item@tab@tab This will be in third column.
+%   @end multitable
+
+% Default dimensions may be reset by user.
+% @multitableparskip is vertical space between paragraphs in table.
+% @multitableparindent is paragraph indent in table.
+% @multitablecolmargin is horizontal space to be left between columns.
+% @multitablelinespace is space to leave between table items, baseline
+%                                                            to baseline.
+%   0pt means it depends on current normal line spacing.
+%
+\newskip\multitableparskip
+\newskip\multitableparindent
+\newdimen\multitablecolspace
+\newskip\multitablelinespace
+\multitableparskip=0pt
+\multitableparindent=6pt
+\multitablecolspace=12pt
+\multitablelinespace=0pt
+
+% Macros used to set up halign preamble:
+% 
+\let\endsetuptable\relax
+\def\xendsetuptable{\endsetuptable}
+\let\columnfractions\relax
+\def\xcolumnfractions{\columnfractions}
+\newif\ifsetpercent
+
+% 2/1/96, to allow fractions to be given with more than one digit.
+\def\pickupwholefraction#1 {\global\advance\colcount by1 %
+\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
+\setuptable}
+
+\newcount\colcount
+\def\setuptable#1{\def\firstarg{#1}%
+\ifx\firstarg\xendsetuptable\let\go\relax%
+\else
+  \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
+  \else
+    \ifsetpercent
+       \let\go\pickupwholefraction   % In this case arg of setuptable
+                                     % is the decimal point before the
+                                     % number given in percent of hsize.
+                                     % We don't need this so we don't use it.
+    \else
+       \global\advance\colcount by1
+       \setbox0=\hbox{#1 }% Add a normal word space as a separator;
+                          % typically that is always in the input, anyway.
+       \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
+    \fi%
+  \fi%
+\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
+\fi\go}
+
+% multitable syntax
+\def\tab{&\hskip1sp\relax} % 2/2/96
+                           % tiny skip here makes sure this column space is
+                           % maintained, even if it is never used.
+
+% @multitable ... @end multitable definitions:
+
+\def\multitable{\parsearg\dotable}
+\def\dotable#1{\bgroup
+  \vskip\parskip
+  \let\item\crcr
+  \tolerance=9500
+  \hbadness=9500
+  \setmultitablespacing
+  \parskip=\multitableparskip
+  \parindent=\multitableparindent
+  \overfullrule=0pt
+  \global\colcount=0
+  \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
+  %
+  % To parse everything between @multitable and @item:
+  \setuptable#1 \endsetuptable
+  %
+  % \everycr will reset column counter, \colcount, at the end of
+  % each line. Every column entry will cause \colcount to advance by one.
+  % The table preamble
+  % looks at the current \colcount to find the correct column width.
+  \everycr{\noalign{%
+  %
+  % \filbreak%% keeps underfull box messages off when table breaks over pages.
+  % Maybe so, but it also creates really weird page breaks when the table
+  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
+  % manifests itself, so it can be fixed for real --karl.
+    \global\colcount=0\relax}}%
+  %
+  % This preamble sets up a generic column definition, which will
+  % be used as many times as user calls for columns.
+  % \vtop will set a single line and will also let text wrap and
+  % continue for many paragraphs if desired.
+  \halign\bgroup&\global\advance\colcount by 1\relax
+    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
+  %
+  % In order to keep entries from bumping into each other
+  % we will add a \leftskip of \multitablecolspace to all columns after
+  % the first one.
+  % 
+  % If a template has been used, we will add \multitablecolspace
+  % to the width of each template entry.
+  % 
+  % If the user has set preamble in terms of percent of \hsize we will
+  % use that dimension as the width of the column, and the \leftskip
+  % will keep entries from bumping into each other.  Table will start at
+  % left margin and final column will justify at right margin.
+  % 
+  % Make sure we don't inherit \rightskip from the outer environment.
+  \rightskip=0pt
+  \ifnum\colcount=1
+    % The first column will be indented with the surrounding text.
+    \advance\hsize by\leftskip
+  \else
+    \ifsetpercent \else
+      % If user has not set preamble in terms of percent of \hsize
+      % we will advance \hsize by \multitablecolspace.
+      \advance\hsize by \multitablecolspace
+    \fi
+   % In either case we will make \leftskip=\multitablecolspace:
+  \leftskip=\multitablecolspace
+  \fi
+  % Ignoring space at the beginning and end avoids an occasional spurious
+  % blank line, when TeX decides to break the line at the space before the
+  % box from the multistrut, so the strut ends up on a line by itself.
+  % For example:
+  % @multitable @columnfractions .11 .89
+  % @item @code{#}
+  % @tab Legal holiday which is valid in major parts of the whole country.
+  % Is automatically provided with highlighting sequences respectively marking
+  % characters.
+  \noindent\ignorespaces##\unskip\multistrut}\cr
+}
+
+\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
+% If so, do nothing. If not, give it an appropriate dimension based on
+% current baselineskip.
+\ifdim\multitablelinespace=0pt
+%% strut to put in table in case some entry doesn't have descenders,
+%% to keep lines equally spaced
+\let\multistrut = \strut
+%% Test to see if parskip is larger than space between lines of
+%% table. If not, do nothing.
+%%        If so, set to same dimension as multitablelinespace.
+\else
+\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
+width0pt\relax} \fi
+\ifdim\multitableparskip>\multitablelinespace
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
+                                      %% than skip between lines in the table.
+\fi%
+\ifdim\multitableparskip=0pt
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
+                                      %% than skip between lines in the table.
+\fi}
+
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within \newindex.
+{\catcode`\@=11
+\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that accumulates this index.  The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+%
+\def\newindex#1{%
+  \iflinks
+    \expandafter\newwrite \csname#1indfile\endcsname
+    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
+  \fi
+  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
+    \noexpand\doindex{#1}}
+}
+
+% @defindex foo  ==  \newindex{foo}
+
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+
+\def\newcodeindex#1{%
+  \iflinks
+    \expandafter\newwrite \csname#1indfile\endcsname
+    \openout \csname#1indfile\endcsname \jobname.#1
+  \fi
+  \expandafter\xdef\csname#1index\endcsname{%
+    \noexpand\docodeindex{#1}}
+}
+
+\def\defcodeindex{\parsearg\newcodeindex}
+
+% @synindex foo bar    makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+% The \closeout helps reduce unnecessary open files; the limit on the
+% Acorn RISC OS is a mere 16 files.
+\def\synindex#1 #2 {%
+  \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
+  \expandafter\closeout\csname#1indfile\endcsname
+  \expandafter\let\csname#1indfile\endcsname=\synindexfoo
+  \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
+    \noexpand\doindex{#2}}%
+}
+
+% @syncodeindex foo bar   similar, but put all entries made for index foo
+% inside @code.
+\def\syncodeindex#1 #2 {%
+  \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
+  \expandafter\closeout\csname#1indfile\endcsname
+  \expandafter\let\csname#1indfile\endcsname=\synindexfoo
+  \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
+    \noexpand\docodeindex{#2}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+%  and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+\def\indexdummies{%
+\def\ { }%
+% Take care of the plain tex accent commands.
+\def\"{\realbackslash "}%
+\def\`{\realbackslash `}%
+\def\'{\realbackslash '}%
+\def\^{\realbackslash ^}%
+\def\~{\realbackslash ~}%
+\def\={\realbackslash =}%
+\def\b{\realbackslash b}%
+\def\c{\realbackslash c}%
+\def\d{\realbackslash d}%
+\def\u{\realbackslash u}%
+\def\v{\realbackslash v}%
+\def\H{\realbackslash H}%
+% Take care of the plain tex special European modified letters.
+\def\oe{\realbackslash oe}%
+\def\ae{\realbackslash ae}%
+\def\aa{\realbackslash aa}%
+\def\OE{\realbackslash OE}%
+\def\AE{\realbackslash AE}%
+\def\AA{\realbackslash AA}%
+\def\o{\realbackslash o}%
+\def\O{\realbackslash O}%
+\def\l{\realbackslash l}%
+\def\L{\realbackslash L}%
+\def\ss{\realbackslash ss}%
+% Take care of texinfo commands likely to appear in an index entry.
+% (Must be a way to avoid doing expansion at all, and thus not have to
+% laboriously list every single command here.)
+\def\@{@}% will be @@ when we switch to @ as escape char.
+%\let\{ = \lbracecmd
+%\let\} = \rbracecmd
+\def\_{{\realbackslash _}}%
+\def\w{\realbackslash w }%
+\def\bf{\realbackslash bf }%
+%\def\rm{\realbackslash rm }%
+\def\sl{\realbackslash sl }%
+\def\sf{\realbackslash sf}%
+\def\tt{\realbackslash tt}%
+\def\gtr{\realbackslash gtr}%
+\def\less{\realbackslash less}%
+\def\hat{\realbackslash hat}%
+\def\TeX{\realbackslash TeX}%
+\def\dots{\realbackslash dots }%
+\def\result{\realbackslash result}%
+\def\equiv{\realbackslash equiv}%
+\def\expansion{\realbackslash expansion}%
+\def\print{\realbackslash print}%
+\def\error{\realbackslash error}%
+\def\point{\realbackslash point}%
+\def\copyright{\realbackslash copyright}%
+\def\tclose##1{\realbackslash tclose {##1}}%
+\def\code##1{\realbackslash code {##1}}%
+\def\dotless##1{\realbackslash dotless {##1}}%
+\def\samp##1{\realbackslash samp {##1}}%
+\def\,##1{\realbackslash ,{##1}}%
+\def\t##1{\realbackslash t {##1}}%
+\def\r##1{\realbackslash r {##1}}%
+\def\i##1{\realbackslash i {##1}}%
+\def\b##1{\realbackslash b {##1}}%
+\def\sc##1{\realbackslash sc {##1}}%
+\def\cite##1{\realbackslash cite {##1}}%
+\def\key##1{\realbackslash key {##1}}%
+\def\file##1{\realbackslash file {##1}}%
+\def\var##1{\realbackslash var {##1}}%
+\def\kbd##1{\realbackslash kbd {##1}}%
+\def\dfn##1{\realbackslash dfn {##1}}%
+\def\emph##1{\realbackslash emph {##1}}%
+%
+% Handle some cases of @value -- where the variable name does not
+% contain - or _, and the value does not contain any
+% (non-fully-expandable) commands.
+\let\value = \expandablevalue
+%
+\unsepspaces
+}
+
+% If an index command is used in an @example environment, any spaces
+% therein should become regular spaces in the raw index file, not the
+% expansion of \tie (\\leavevmode \penalty \@M \ ).
+{\obeyspaces
+ \gdef\unsepspaces{\obeyspaces\let =\space}}
+
+% \indexnofonts no-ops all font-change commands.
+% This is used when outputting the strings to sort the index by.
+\def\indexdummyfont#1{#1}
+\def\indexdummytex{TeX}
+\def\indexdummydots{...}
+
+\def\indexnofonts{%
+% Just ignore accents.
+\let\,=\indexdummyfont
+\let\"=\indexdummyfont
+\let\`=\indexdummyfont
+\let\'=\indexdummyfont
+\let\^=\indexdummyfont
+\let\~=\indexdummyfont
+\let\==\indexdummyfont
+\let\b=\indexdummyfont
+\let\c=\indexdummyfont
+\let\d=\indexdummyfont
+\let\u=\indexdummyfont
+\let\v=\indexdummyfont
+\let\H=\indexdummyfont
+\let\dotless=\indexdummyfont
+% Take care of the plain tex special European modified letters.
+\def\oe{oe}%
+\def\ae{ae}%
+\def\aa{aa}%
+\def\OE{OE}%
+\def\AE{AE}%
+\def\AA{AA}%
+\def\o{o}%
+\def\O{O}%
+\def\l{l}%
+\def\L{L}%
+\def\ss{ss}%
+\let\w=\indexdummyfont
+\let\t=\indexdummyfont
+\let\r=\indexdummyfont
+\let\i=\indexdummyfont
+\let\b=\indexdummyfont
+\let\emph=\indexdummyfont
+\let\strong=\indexdummyfont
+\let\cite=\indexdummyfont
+\let\sc=\indexdummyfont
+%Don't no-op \tt, since it isn't a user-level command
+% and is used in the definitions of the active chars like <, >, |...
+%\let\tt=\indexdummyfont
+\let\tclose=\indexdummyfont
+\let\code=\indexdummyfont
+\let\file=\indexdummyfont
+\let\samp=\indexdummyfont
+\let\kbd=\indexdummyfont
+\let\key=\indexdummyfont
+\let\var=\indexdummyfont
+\let\TeX=\indexdummytex
+\let\dots=\indexdummydots
+\def\@{@}%
+}
+
+% To define \realbackslash, we must make \ not be an escape.
+% We must first make another character (@) an escape
+% so we do not become unable to do a definition.
+
+{\catcode`\@=0 \catcode`\\=\other
+ @gdef@realbackslash{\}}
+
+\let\indexbackslash=0  %overridden during \printindex.
+\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
+
+% For \ifx comparisons.
+\def\emptymacro{\empty}
+
+% Most index entries go through here, but \dosubind is the general case.
+% 
+\def\doind#1#2{\dosubind{#1}{#2}\empty}
+
+% Workhorse for all \fooindexes.
+% #1 is name of index, #2 is stuff to put there, #3 is subentry --
+% \empty if called from \doind, as we usually are.  The main exception
+% is with defuns, which call us directly.
+% 
+\def\dosubind#1#2#3{%
+  % Put the index entry in the margin if desired.
+  \ifx\SETmarginindex\relax\else
+    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
+  \fi
+  {%
+    \count255=\lastpenalty
+    {%
+      \indexdummies % Must do this here, since \bf, etc expand at this stage
+      \escapechar=`\\
+      {%
+        \let\folio = 0% We will expand all macros now EXCEPT \folio.
+        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
+        % so it will be output as is; and it will print as backslash.
+        %
+        \def\thirdarg{#3}%
+        %
+        % If third arg is present, precede it with space in sort key.
+        \ifx\thirdarg\emptymacro
+          \let\subentry = \empty
+        \else
+          \def\subentry{ #3}%
+        \fi
+        %
+        % First process the index-string with all font commands turned off
+        % to get the string to sort by.
+        {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
+        %
+        % Now produce the complete index entry, with both the sort key and the
+        % original text, including any font commands.
+        \toks0 = {#2}%
+        \edef\temp{%
+          \write\csname#1indfile\endcsname{%
+            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
+        }%
+        %
+        % If third (subentry) arg is present, add it to the index string.
+        \ifx\thirdarg\emptymacro \else
+          \toks0 = {#3}%
+          \edef\temp{\temp{\the\toks0}}%
+        \fi
+        %
+        % If a skip is the last thing on the list now, preserve it
+        % by backing up by \lastskip, doing the \write, then inserting
+        % the skip again.  Otherwise, the whatsit generated by the
+        % \write will make \lastskip zero.  The result is that sequences
+        % like this:
+        % @end defun
+        % @tindex whatever
+        % @defun ...
+        % will have extra space inserted, because the \medbreak in the
+        % start of the @defun won't see the skip inserted by the @end of
+        % the previous defun.
+        % 
+        % But don't do any of this if we're not in vertical mode.  We
+        % don't want to do a \vskip and prematurely end a paragraph.
+        % 
+        % Avoid page breaks due to these extra skips, too.
+        % 
+        \iflinks
+          \ifvmode
+            \skip0 = \lastskip
+            \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
+          \fi
+          %
+          \temp % do the write
+          %
+          % 
+          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
+        \fi
+      }%
+    }%
+    \penalty\count255
+  }%
+}
+
+% The index entry written in the file actually looks like
+%  \entry {sortstring}{page}{topic}
+% or
+%  \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+%  \initial {c}
+%     before the first topic whose initial is c
+%  \entry {topic}{pagelist}
+%     for a topic that is used without subtopics
+%  \primary {topic}
+%     for the beginning of a topic that is used with subtopics
+%  \secondary {subtopic}{pagelist}
+%     for each subtopic.
+
+% Define the user-accessible indexing commands
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% @printindex causes a particular index (the ??s file) to get printed.
+% It does not print any chapter heading (usually an @unnumbered).
+%
+\def\printindex{\parsearg\doprintindex}
+\def\doprintindex#1{\begingroup
+  \dobreak \chapheadingskip{10000}%
+  %
+  \indexfonts \rm
+  \tolerance = 9500
+  \indexbreaks
+  %
+  % See if the index file exists and is nonempty.
+  % Change catcode of @ here so that if the index file contains
+  % \initial {@}
+  % as its first line, TeX doesn't complain about mismatched braces
+  % (because it thinks @} is a control sequence).
+  \catcode`\@ = 11
+  \openin 1 \jobname.#1s
+  \ifeof 1
+    % \enddoublecolumns gets confused if there is no text in the index,
+    % and it loses the chapter title and the aux file entries for the
+    % index.  The easiest way to prevent this problem is to make sure
+    % there is some text.
+    (Index is nonexistent)
+  \else
+    %
+    % If the index file exists but is empty, then \openin leaves \ifeof
+    % false.  We have to make TeX try to read something from the file, so
+    % it can discover if there is anything in it.
+    \read 1 to \temp
+    \ifeof 1
+      (Index is empty)
+    \else
+      % Index files are almost Texinfo source, but we use \ as the escape
+      % character.  It would be better to use @, but that's too big a change
+      % to make right now.
+      \def\indexbackslash{\rawbackslashxx}%
+      \catcode`\\ = 0
+      \escapechar = `\\
+      \begindoublecolumns
+      \input \jobname.#1s
+      \enddoublecolumns
+    \fi
+  \fi
+  \closein 1
+\endgroup}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+\def\initial#1{{%
+  % Some minor font changes for the special characters.
+  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+  %
+  % Remove any glue we may have, we'll be inserting our own.
+  \removelastskip
+  % 
+  % We like breaks before the index initials, so insert a bonus.
+  \penalty -300
+  %
+  % Typeset the initial.  Making this add up to a whole number of
+  % baselineskips increases the chance of the dots lining up from column
+  % to column.  It still won't often be perfect, because of the stretch
+  % we need before each entry, but it's better.
+  % 
+  % No shrink because it confuses \balancecolumns.
+  \vskip 1.67\baselineskip plus .5\baselineskip
+  \leftline{\secbf #1}%
+  \vskip .33\baselineskip plus .1\baselineskip
+  %
+  % Do our best not to break after the initial.
+  \nobreak
+}}
+
+% This typesets a paragraph consisting of #1, dot leaders, and then #2
+% flush to the right margin.  It is used for index and table of contents
+% entries.  The paragraph is indented by \leftskip.
+%
+\def\entry#1#2{\begingroup
+  %
+  % Start a new paragraph if necessary, so our assignments below can't
+  % affect previous text.
+  \par
+  %
+  % Do not fill out the last line with white space.
+  \parfillskip = 0in
+  %
+  % No extra space above this paragraph.
+  \parskip = 0in
+  %
+  % Do not prefer a separate line ending with a hyphen to fewer lines.
+  \finalhyphendemerits = 0
+  %
+  % \hangindent is only relevant when the entry text and page number
+  % don't both fit on one line.  In that case, bob suggests starting the
+  % dots pretty far over on the line.  Unfortunately, a large
+  % indentation looks wrong when the entry text itself is broken across
+  % lines.  So we use a small indentation and put up with long leaders.
+  %
+  % \hangafter is reset to 1 (which is the value we want) at the start
+  % of each paragraph, so we need not do anything with that.
+  \hangindent = 2em
+  %
+  % When the entry text needs to be broken, just fill out the first line
+  % with blank space.
+  \rightskip = 0pt plus1fil
+  %
+  % A bit of stretch before each entry for the benefit of balancing columns.
+  \vskip 0pt plus1pt
+  %
+  % Start a ``paragraph'' for the index entry so the line breaking
+  % parameters we've set above will have an effect.
+  \noindent
+  %
+  % Insert the text of the index entry.  TeX will do line-breaking on it.
+  #1%
+  % The following is kludged to not output a line of dots in the index if
+  % there are no page numbers.  The next person who breaks this will be
+  % cursed by a Unix daemon.
+  \def\tempa{{\rm }}%
+  \def\tempb{#2}%
+  \edef\tempc{\tempa}%
+  \edef\tempd{\tempb}%
+  \ifx\tempc\tempd\ \else%
+    %
+    % If we must, put the page number on a line of its own, and fill out
+    % this line with blank space.  (The \hfil is overwhelmed with the
+    % fill leaders glue in \indexdotfill if the page number does fit.)
+    \hfil\penalty50
+    \null\nobreak\indexdotfill % Have leaders before the page number.
+    %
+    % The `\ ' here is removed by the implicit \unskip that TeX does as
+    % part of (the primitive) \par.  Without it, a spurious underfull
+    % \hbox ensues.
+    \ #2% The page number ends the paragraph.
+  \fi%
+  \par
+\endgroup}
+
+% Like \dotfill except takes at least 1 em.
+\def\indexdotfill{\cleaders
+  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+
+\def\secondary #1#2{
+{\parfillskip=0in \parskip=0in
+\hangindent =1in \hangafter=1
+\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
+}}
+
+% Define two-column mode, which we use to typeset indexes.
+% Adapted from the TeXbook, page 416, which is to say,
+% the manmac.tex format used to print the TeXbook itself.
+\catcode`\@=11
+
+\newbox\partialpage
+\newdimen\doublecolumnhsize
+
+\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
+  % Grab any single-column material above us.
+  \output = {\global\setbox\partialpage = \vbox{%
+    % 
+    % Here is a possibility not foreseen in manmac: if we accumulate a
+    % whole lot of material, we might end up calling this \output
+    % routine twice in a row (see the doublecol-lose test, which is
+    % essentially a couple of indexes with @setchapternewpage off).  In
+    % that case, we must prevent the second \partialpage from
+    % simply overwriting the first, causing us to lose the page.
+    % This will preserve it until a real output routine can ship it
+    % out.  Generally, \partialpage will be empty when this runs and
+    % this will be a no-op.
+    \unvbox\partialpage
+    %
+    % Unvbox the main output page.
+    \unvbox255
+    \kern-\topskip \kern\baselineskip
+  }}%
+  \eject
+  %
+  % Use the double-column output routine for subsequent pages.
+  \output = {\doublecolumnout}%
+  %
+  % Change the page size parameters.  We could do this once outside this
+  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
+  % format, but then we repeat the same computation.  Repeating a couple
+  % of assignments once per index is clearly meaningless for the
+  % execution time, so we may as well do it in one place.
+  %
+  % First we halve the line length, less a little for the gutter between
+  % the columns.  We compute the gutter based on the line length, so it
+  % changes automatically with the paper format.  The magic constant
+  % below is chosen so that the gutter has the same value (well, +-<1pt)
+  % as it did when we hard-coded it.
+  %
+  % We put the result in a separate register, \doublecolumhsize, so we
+  % can restore it in \pagesofar, after \hsize itself has (potentially)
+  % been clobbered.
+  %
+  \doublecolumnhsize = \hsize
+    \advance\doublecolumnhsize by -.04154\hsize
+    \divide\doublecolumnhsize by 2
+  \hsize = \doublecolumnhsize
+  %
+  % Double the \vsize as well.  (We don't need a separate register here,
+  % since nobody clobbers \vsize.)
+  \advance\vsize by -\ht\partialpage
+  \vsize = 2\vsize
+}
+
+% The double-column output routine for all double-column pages except
+% the last.
+% 
+\def\doublecolumnout{%
+  \splittopskip=\topskip \splitmaxdepth=\maxdepth
+  % Get the available space for the double columns -- the normal
+  % (undoubled) page height minus any material left over from the
+  % previous page.
+  \dimen@ = \vsize
+  \divide\dimen@ by 2
+  %
+  % box0 will be the left-hand column, box2 the right.
+  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+  \onepageout\pagesofar
+  \unvbox255
+  \penalty\outputpenalty
+}
+\def\pagesofar{%
+  % Re-output the contents of the output page -- any previous material,
+  % followed by the two boxes we just split, in box0 and box2.
+  \advance\vsize by \ht\partialpage
+  \unvbox\partialpage
+  %
+  \hsize = \doublecolumnhsize
+  \wd0=\hsize \wd2=\hsize
+  \hbox to\pagewidth{\box0\hfil\box2}%
+}
+\def\enddoublecolumns{%
+  \output = {%
+    % Split the last of the double-column material.  Leave on the
+    % current page, no automatic page break.
+    \balancecolumns
+    %
+    % If we end up splitting too much material for the current page,
+    % though, there will be another page break right after this \output
+    % invocation ends.  Having called \balancecolumns once, we do not
+    % want to call it again.  Therefore, reset \output to its normal
+    % definition right away.  (We hope \balancecolumns will never be
+    % called on to balance too much material, but if it is, this makes
+    % the output somewhat more palatable.)
+    \global\output = {\onepageout{\pagecontents\PAGE}}%
+    %
+    % \pagegoal was set to the doubled \vsize above, since we restarted
+    % the current page.  We're now back to normal single-column
+    % typesetting, so reset \pagegoal to the normal \vsize.
+    \pagegoal = \vsize
+  }%
+  \eject
+  \endgroup % started in \begindoublecolumns
+}
+\def\balancecolumns{%
+  % Called at the end of the double column material.
+  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
+  \dimen@ = \ht0
+  \advance\dimen@ by \topskip
+  \advance\dimen@ by-\baselineskip
+  \divide\dimen@ by 2 % target to split to
+  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
+  \splittopskip = \topskip
+  % Loop until we get a decent breakpoint.
+  {%
+    \vbadness = 10000
+    \loop
+      \global\setbox3 = \copy0
+      \global\setbox1 = \vsplit3 to \dimen@
+    \ifdim\ht3>\dimen@
+      \global\advance\dimen@ by 1pt
+    \repeat
+  }%
+  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
+  \setbox0=\vbox to\dimen@{\unvbox1}%
+  \setbox2=\vbox to\dimen@{\unvbox3}%
+  %
+  \pagesofar
+}
+\catcode`\@ = \other
+
+
+\message{sectioning,}
+% Define chapters, sections, etc.
+
+\newcount\chapno
+\newcount\secno        \secno=0
+\newcount\subsecno     \subsecno=0
+\newcount\subsubsecno  \subsubsecno=0
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount\appendixno  \appendixno = `\@
+\def\appendixletter{\char\the\appendixno}
+
+% Each @chapter defines this as the name of the chapter.
+% page headings and footings can use it.  @section does likewise.
+\def\thischapter{}
+\def\thissection{}
+
+\newcount\absseclevel % used to calculate proper heading level
+\newcount\secbase\secbase=0 % @raise/lowersections modify this count
+
+% @raisesections: treat @section as chapter, @subsection as section, etc.
+\def\raisesections{\global\advance\secbase by -1}
+\let\up=\raisesections % original BFox name
+
+% @lowersections: treat @chapter as section, @section as subsection, etc.
+\def\lowersections{\global\advance\secbase by 1}
+\let\down=\lowersections % original BFox name
+
+% Choose a numbered-heading macro
+% #1 is heading level if unmodified by @raisesections or @lowersections
+% #2 is text for heading
+\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \chapterzzz{#2}
+\or
+  \seczzz{#2}
+\or
+  \numberedsubseczzz{#2}
+\or
+  \numberedsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \chapterzzz{#2}
+  \else
+    \numberedsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% like \numhead, but chooses appendix heading levels
+\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \appendixzzz{#2}
+\or
+  \appendixsectionzzz{#2}
+\or
+  \appendixsubseczzz{#2}
+\or
+  \appendixsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \appendixzzz{#2}
+  \else
+    \appendixsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% like \numhead, but chooses numberless heading levels
+\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \unnumberedzzz{#2}
+\or
+  \unnumberedseczzz{#2}
+\or
+  \unnumberedsubseczzz{#2}
+\or
+  \unnumberedsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \unnumberedzzz{#2}
+  \else
+    \unnumberedsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% @chapter, @appendix, @unnumbered.
+\def\thischaptername{No Chapter Title}
+\outer\def\chapter{\parsearg\chapteryyy}
+\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\def\chapterzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
+\chapmacro {#1}{\the\chapno}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+% We don't substitute the actual chapter name into \thischapter
+% because we don't want its macros evaluated now.
+\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
+                                  {\the\chapno}}}%
+\temp
+\donoderef
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+}
+
+\outer\def\appendix{\parsearg\appendixyyy}
+\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
+\def\appendixzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \appendixno by 1
+\message{\putwordAppendix\space \appendixletter}%
+\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
+                       {\putwordAppendix{} \appendixletter}}}%
+\temp
+\appendixnoderef
+\global\let\section = \appendixsec
+\global\let\subsection = \appendixsubsec
+\global\let\subsubsection = \appendixsubsubsec
+}
+
+% @centerchap is like @unnumbered, but the heading is centered.
+\outer\def\centerchap{\parsearg\centerchapyyy}
+\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
+
+% @top is like @unnumbered.
+\outer\def\top{\parsearg\unnumberedyyy}
+
+\outer\def\unnumbered{\parsearg\unnumberedyyy}
+\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
+\def\unnumberedzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+%
+% This used to be simply \message{#1}, but TeX fully expands the
+% argument to \message.  Therefore, if #1 contained @-commands, TeX
+% expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
+% expanded @cite (which turns out to cause errors because \cite is meant
+% to be executed, not expanded).
+%
+% Anyway, we don't want the fully-expanded definition of @cite to appear
+% as a result of the \message, we just want `@cite' itself.  We use
+% \the<toks register> to achieve this: TeX expands \the<toks> only once,
+% simply yielding the contents of <toks register>.  (We also do this for
+% the toc entries.)
+\toks0 = {#1}\message{(\the\toks0)}%
+%
+\unnumbchapmacro {#1}%
+\gdef\thischapter{#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
+\temp
+\unnumbnoderef
+\global\let\section = \unnumberedsec
+\global\let\subsection = \unnumberedsubsec
+\global\let\subsubsection = \unnumberedsubsubsec
+}
+
+% Sections.
+\outer\def\numberedsec{\parsearg\secyyy}
+\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
+\def\seczzz #1{%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
+                                  {\the\chapno}{\the\secno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsection{\parsearg\appendixsecyyy}
+\outer\def\appendixsec{\parsearg\appendixsecyyy}
+\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
+\def\appendixsectionzzz #1{%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
+                                  {\appendixletter}{\the\secno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
+\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
+\def\unnumberedseczzz #1{%
+\plainsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% Subsections.
+\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
+\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
+\def\numberedsubseczzz #1{%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
+                                    {\the\chapno}{\the\secno}{\the\subsecno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
+\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
+\def\appendixsubseczzz #1{%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
+                                {\appendixletter}{\the\secno}{\the\subsecno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
+\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
+\def\unnumberedsubseczzz #1{%
+\plainsubsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
+                                    {\the\toks0}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% Subsubsections.
+\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
+\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
+\def\numberedsubsubseczzz #1{%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
+\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
+\def\appendixsubsubseczzz #1{%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
+  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
+\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
+\def\unnumberedsubsubseczzz #1{%
+\plainsubsubsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
+                                    {\the\toks0}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% These are variants which are not "outer", so they can appear in @ifinfo.
+% Actually, they should now be obsolete; ordinary section commands should work.
+\def\infotop{\parsearg\unnumberedzzz}
+\def\infounnumbered{\parsearg\unnumberedzzz}
+\def\infounnumberedsec{\parsearg\unnumberedseczzz}
+\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
+\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
+
+\def\infoappendix{\parsearg\appendixzzz}
+\def\infoappendixsec{\parsearg\appendixseczzz}
+\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
+\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
+
+\def\infochapter{\parsearg\chapterzzz}
+\def\infosection{\parsearg\sectionzzz}
+\def\infosubsection{\parsearg\subsectionzzz}
+\def\infosubsubsection{\parsearg\subsubsectionzzz}
+
+% These macros control what the section commands do, according
+% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
+% Define them by default for a numbered chapter.
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+
+% Define @majorheading, @heading and @subheading
+
+% NOTE on use of \vbox for chapter headings, section headings, and such:
+%       1) We use \vbox rather than the earlier \line to permit
+%          overlong headings to fold.
+%       2) \hyphenpenalty is set to 10000 because hyphenation in a
+%          heading is obnoxious; this forbids it.
+%       3) Likewise, headings look best if no \parindent is used, and
+%          if justification is not attempted.  Hence \raggedright.
+
+
+\def\majorheading{\parsearg\majorheadingzzz}
+\def\majorheadingzzz #1{%
+{\advance\chapheadingskip by 10pt \chapbreak }%
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+\def\chapheading{\parsearg\chapheadingzzz}
+\def\chapheadingzzz #1{\chapbreak %
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+% @heading, @subheading, @subsubheading.
+\def\heading{\parsearg\plainsecheading}
+\def\subheading{\parsearg\plainsubsecheading}
+\def\subsubheading{\parsearg\plainsubsubsecheading}
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+%%% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+
+%%% Define plain chapter starts, and page on/off switching for it
+% Parameter controlling skip before chapter headings (if needed)
+
+\newskip\chapheadingskip
+
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager
+\global\def\HEADINGSon{\HEADINGSsingle}}
+
+\def\CHAPPAGodd{
+\global\let\contentsalignmacro = \chapoddpage
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage
+\global\def\HEADINGSon{\HEADINGSdouble}}
+
+\CHAPPAGon
+
+\def\CHAPFplain{
+\global\let\chapmacro=\chfplain
+\global\let\unnumbchapmacro=\unnchfplain
+\global\let\centerchapmacro=\centerchfplain}
+
+% Plain chapter opening.
+% #1 is the text, #2 the chapter number or empty if unnumbered.
+\def\chfplain#1#2{%
+  \pchapsepmacro
+  {%
+    \chapfonts \rm
+    \def\chapnum{#2}%
+    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
+    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+          \hangindent = \wd0 \centerparametersmaybe
+          \unhbox0 #1\par}%
+  }%
+  \nobreak\bigskip % no page break after a chapter title
+  \nobreak
+}
+
+% Plain opening for unnumbered.
+\def\unnchfplain#1{\chfplain{#1}{}}
+
+% @centerchap -- centered and unnumbered.
+\let\centerparametersmaybe = \relax
+\def\centerchfplain#1{{%
+  \def\centerparametersmaybe{%
+    \advance\rightskip by 3\rightskip
+    \leftskip = \rightskip
+    \parfillskip = 0pt
+  }%
+  \chfplain{#1}{}%
+}}
+
+\CHAPFplain % The default
+
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt\raggedright
+                       \rm #1\hfill}}\bigskip \par\nobreak
+}
+
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+
+\def\centerchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt
+                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
+}
+
+\def\CHAPFopen{
+\global\let\chapmacro=\chfopen
+\global\let\unnumbchapmacro=\unnchfopen
+\global\let\centerchapmacro=\centerchfopen}
+
+
+% Section titles.
+\newskip\secheadingskip
+\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
+\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
+\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
+
+% Subsection titles.
+\newskip \subsecheadingskip
+\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
+\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
+\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
+
+% Subsubsection titles.
+\let\subsubsecheadingskip = \subsecheadingskip
+\let\subsubsecheadingbreak = \subsecheadingbreak
+\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
+\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
+
+
+% Print any size section title.
+%
+% #1 is the section type (sec/subsec/subsubsec), #2 is the section
+% number (maybe empty), #3 the text.
+\def\sectionheading#1#2#3{%
+  {%
+    \expandafter\advance\csname #1headingskip\endcsname by \parskip
+    \csname #1headingbreak\endcsname
+  }%
+  {%
+    % Switch to the right set of fonts.
+    \csname #1fonts\endcsname \rm
+    %
+    % Only insert the separating space if we have a section number.
+    \def\secnum{#2}%
+    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
+    %
+    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+          \hangindent = \wd0 % zero if no section number
+          \unhbox0 #3}%
+  }%
+  \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
+}
+
+
+\message{toc,}
+\newwrite\tocfile
+
+% Write an entry to the toc file, opening it if necessary.
+% Called from @chapter, etc.  We supply {\folio} at the end of the
+% argument, which will end up as the last argument to the \...entry macro.
+% 
+% We open the .toc file here instead of at @setfilename or any other
+% given time so that @contents can be put in the document anywhere.
+% 
+\newif\iftocfileopened
+\def\writetocentry#1{%
+  \iftocfileopened\else
+    \immediate\openout\tocfile = \jobname.toc
+    \global\tocfileopenedtrue
+  \fi
+  \iflinks \write\tocfile{#1{\folio}}\fi
+}
+
+\newskip\contentsrightmargin \contentsrightmargin=1in
+\newcount\savepageno
+\newcount\lastnegativepageno \lastnegativepageno = -1
+
+% Finish up the main text and prepare to read what we've written
+% to \tocfile.
+% 
+\def\startcontents#1{%
+   % If @setchapternewpage on, and @headings double, the contents should
+   % start on an odd page, unlike chapters.  Thus, we maintain
+   % \contentsalignmacro in parallel with \pagealignmacro.
+   % From: Torbjorn Granlund <tege@matematik.su.se>
+   \contentsalignmacro
+   \immediate\closeout\tocfile
+   %
+   % Don't need to put `Contents' or `Short Contents' in the headline.
+   % It is abundantly clear what they are.
+   \unnumbchapmacro{#1}\def\thischapter{}%
+   \savepageno = \pageno
+   \begingroup                  % Set up to handle contents files properly.
+      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
+      % We can't do this, because then an actual ^ in a section
+      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
+      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
+      \raggedbottom             % Worry more about breakpoints than the bottom.
+      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+      %
+      % Roman numerals for page numbers.
+      \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
+}
+
+
+% Normal (long) toc.
+\def\contents{%
+   \startcontents{\putwordTableofContents}%
+     \openin 1 \jobname.toc
+     \ifeof 1 \else
+       \closein 1
+       \input \jobname.toc
+     \fi
+     \vfill \eject
+   \endgroup
+   \lastnegativepageno = \pageno
+   \pageno = \savepageno
+}
+
+% And just the chapters.
+\def\summarycontents{%
+   \startcontents{\putwordShortContents}%
+      %
+      \let\chapentry = \shortchapentry
+      \let\unnumbchapentry = \shortunnumberedentry
+      % We want a true roman here for the page numbers.
+      \secfonts
+      \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
+      \rm
+      \hyphenpenalty = 10000
+      \advance\baselineskip by 1pt % Open it up a little.
+      \def\secentry ##1##2##3##4{}
+      \def\unnumbsecentry ##1##2{}
+      \def\subsecentry ##1##2##3##4##5{}
+      \def\unnumbsubsecentry ##1##2{}
+      \def\subsubsecentry ##1##2##3##4##5##6{}
+      \def\unnumbsubsubsecentry ##1##2{}
+      \openin 1 \jobname.toc
+      \ifeof 1 \else
+        \closein 1
+        \input \jobname.toc
+      \fi
+     \vfill \eject
+   \endgroup
+   \lastnegativepageno = \pageno
+   \pageno = \savepageno
+}
+\let\shortcontents = \summarycontents
+
+% These macros generate individual entries in the table of contents.
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+% Chapter-level things, for both the long and short contents.
+\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
+
+% See comments in \dochapentry re vbox and related settings
+\def\shortchapentry#1#2#3{%
+  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
+}
+
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
+% We could simplify the code here by writing out an \appendixentry
+% command in the toc file for appendices, instead of using \chapentry
+% for both, but it doesn't seem worth it.
+\setbox0 = \hbox{\shortcontrm \putwordAppendix }
+\newdimen\shortappendixwidth \shortappendixwidth = \wd0
+
+\def\shortchaplabel#1{%
+  % We typeset #1 in a box of constant width, regardless of the text of
+  % #1, so the chapter titles will come out aligned.
+  \setbox0 = \hbox{#1}%
+  \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
+  %
+  % This space should be plenty, since a single number is .5em, and the
+  % widest letter (M) is 1em, at least in the Computer Modern fonts.
+  % (This space doesn't include the extra space that gets added after
+  % the label; that gets put in by \shortchapentry above.)
+  \advance\dimen0 by 1.1em
+  \hbox to \dimen0{#1\hfil}%
+}
+
+\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
+\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
+
+% Sections.
+\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
+\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
+
+% Subsections.
+\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
+\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
+
+% And subsubsections.
+\def\subsubsecentry#1#2#3#4#5#6{%
+  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
+\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
+
+% This parameter controls the indentation of the various levels.
+\newdimen\tocindent \tocindent = 3pc
+
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the
+% page number.
+%
+% If the toc has to be broken over pages, we want it to be at chapters
+% if at all possible; hence the \penalty.
+\def\dochapentry#1#2{%
+   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
+   \begingroup
+     \chapentryfonts
+     \tocentry{#1}{\dopageno{#2}}%
+   \endgroup
+   \nobreak\vskip .25\baselineskip plus.1\baselineskip
+}
+
+\def\dosecentry#1#2{\begingroup
+  \secentryfonts \leftskip=\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+\def\dosubsecentry#1#2{\begingroup
+  \subsecentryfonts \leftskip=2\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+\def\dosubsubsecentry#1#2{\begingroup
+  \subsubsecentryfonts \leftskip=3\tocindent
+  \tocentry{#1}{\dopageno{#2}}%
+\endgroup}
+
+% Final typesetting of a toc entry; we use the same \entry macro as for
+% the index entries, but we want to suppress hyphenation here.  (We
+% can't do that in the \entry macro, since index entries might consist
+% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
+\def\tocentry#1#2{\begingroup
+  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
+  % Do not use \turnoffactive in these arguments.  Since the toc is
+  % typeset in cmr, so characters such as _ would come out wrong; we
+  % have to do the usual translation tricks.
+  \entry{#1}{#2}%
+\endgroup}
+
+% Space between chapter (or whatever) number and the title.
+\def\labelspace{\hskip1em \relax}
+
+\def\dopageno#1{{\rm #1}}
+\def\doshortpageno#1{{\rm #1}}
+
+\def\chapentryfonts{\secfonts \rm}
+\def\secentryfonts{\textfonts}
+\let\subsecentryfonts = \textfonts
+\let\subsubsecentryfonts = \textfonts
+
+
+\message{environments,}
+
+% Since these characters are used in examples, it should be an even number of
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+% Furthermore, these definitions must come after we define our fonts.
+\newbox\dblarrowbox    \newbox\longdblarrowbox
+\newbox\pushcharbox    \newbox\bullbox
+\newbox\equivbox       \newbox\errorbox
+
+%{\tentt
+%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
+%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
+%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
+%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
+% Adapted from the manmac format (p.420 of TeXbook)
+%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
+%                                      depth .1ex\hfil}
+%}
+
+% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
+\def\point{$\star$}
+\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% Adapted from the TeXbook's \boxit.
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
+
+\global\setbox\errorbox=\hbox to \dimen0{\hfil
+   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+   \advance\hsize by -2\dimen2 % Rules.
+   \vbox{
+      \hrule height\dimen2
+      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
+         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+         \kern3pt\vrule width\dimen2}% Space to right.
+      \hrule height\dimen2}
+    \hfil}
+
+% The @error{} command.
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
+% @tex ... @end tex    escapes into raw Tex temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain tex @ character.
+
+\def\tex{\begingroup
+  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+  \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+  \catcode `\%=14
+  \catcode 43=12 % plus
+  \catcode`\"=12
+  \catcode`\==12
+  \catcode`\|=12
+  \catcode`\<=12
+  \catcode`\>=12
+  \escapechar=`\\
+  %
+  \let\b=\ptexb
+  \let\bullet=\ptexbullet
+  \let\c=\ptexc
+  \let\,=\ptexcomma
+  \let\.=\ptexdot
+  \let\dots=\ptexdots
+  \let\equiv=\ptexequiv
+  \let\!=\ptexexclam
+  \let\i=\ptexi
+  \let\{=\ptexlbrace
+  \let\+=\tabalign
+  \let\}=\ptexrbrace
+  \let\*=\ptexstar
+  \let\t=\ptext
+  %
+  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
+  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
+  \def\@{@}%
+\let\Etex=\endgroup}
+
+% Define @lisp ... @endlisp.
+% @lisp does a \begingroup so it can rebind things,
+% including the definition of @endlisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^^M gets inside @lisp, @example, and other
+% such environments.  \null is better than a space, since it doesn't
+% have any width.
+\def\lisppar{\null\endgraf}
+
+% Make each space character in the input produce a normal interword
+% space in the output.  Don't allow a line break at this space, as this
+% is used only in environments like @example, where each line of input
+% should produce a line of output anyway.
+%
+{\obeyspaces %
+\gdef\sepspaces{\obeyspaces\let =\tie}}
+
+% Define \obeyedspace to be our active space, whatever it is.  This is
+% for use in \parsearg.
+{\sepspaces%
+\global\let\obeyedspace= }
+
+% This space is always present above and below environments.
+\newskip\envskipamount \envskipamount = 0pt
+
+% Make spacing and below environment symmetrical.  We use \parskip here
+% to help in doing that, since in @example-like environments \parskip
+% is reset to zero; thus the \afterenvbreak inserts no space -- but the
+% start of the next paragraph will insert \parskip
+%
+\def\aboveenvbreak{{\advance\envskipamount by \parskip
+\endgraf \ifdim\lastskip<\envskipamount
+\removelastskip \penalty-50 \vskip\envskipamount \fi}}
+
+\let\afterenvbreak = \aboveenvbreak
+
+% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
+\let\nonarrowing=\relax
+
+% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
+% environment contents.
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
+%
+\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
+\def\ctr{{\hskip 6pt\circle\char'010}}
+\def\cbl{{\circle\char'012\hskip -6pt}}
+\def\cbr{{\hskip 6pt\circle\char'011}}
+\def\carttop{\hbox to \cartouter{\hskip\lskip
+        \ctl\leaders\hrule height\circthick\hfil\ctr
+        \hskip\rskip}}
+\def\cartbot{\hbox to \cartouter{\hskip\lskip
+        \cbl\leaders\hrule height\circthick\hfil\cbr
+        \hskip\rskip}}
+%
+\newskip\lskip\newskip\rskip
+
+\long\def\cartouche{%
+\begingroup
+        \lskip=\leftskip \rskip=\rightskip
+        \leftskip=0pt\rightskip=0pt %we want these *outside*.
+        \cartinner=\hsize \advance\cartinner by-\lskip
+                          \advance\cartinner by-\rskip
+        \cartouter=\hsize
+        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
+%                                    side, and for 6pt waste from
+%                                    each corner char, and rule thickness
+        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+        % Flag to tell @lisp, etc., not to narrow margin.
+        \let\nonarrowing=\comment
+        \vbox\bgroup
+                \baselineskip=0pt\parskip=0pt\lineskip=0pt
+                \carttop
+                \hbox\bgroup
+                        \hskip\lskip
+                        \vrule\kern3pt
+                        \vbox\bgroup
+                                \hsize=\cartinner
+                                \kern3pt
+                                \begingroup
+                                        \baselineskip=\normbskip
+                                        \lineskip=\normlskip
+                                        \parskip=\normpskip
+                                        \vskip -\parskip
+\def\Ecartouche{%
+                                \endgroup
+                                \kern3pt
+                        \egroup
+                        \kern3pt\vrule
+                        \hskip\rskip
+                \egroup
+                \cartbot
+        \egroup
+\endgroup
+}}
+
+
+% This macro is called at the beginning of all the @example variants,
+% inside a group.
+\def\nonfillstart{%
+  \aboveenvbreak
+  \inENV % This group ends at the end of the body
+  \hfuzz = 12pt % Don't be fussy
+  \sepspaces % Make spaces be word-separators rather than space tokens.
+  \singlespace
+  \let\par = \lisppar % don't ignore blank lines
+  \obeylines % each line of input is a line of output
+  \parskip = 0pt
+  \parindent = 0pt
+  \emergencystretch = 0pt % don't try to avoid overfull boxes
+  % @cartouche defines \nonarrowing to inhibit narrowing
+  % at next level down.
+  \ifx\nonarrowing\relax
+    \advance \leftskip by \lispnarrowing
+    \exdentamount=\lispnarrowing
+    \let\exdent=\nofillexdent
+    \let\nonarrowing=\relax
+  \fi
+}
+
+% Define the \E... control sequence only if we are inside the particular
+% environment, so the error checking in \end will work.
+% 
+% To end an @example-like environment, we first end the paragraph (via
+% \afterenvbreak's vertical glue), and then the group.  That way we keep
+% the zero \parskip that the environments set -- \parskip glue will be
+% inserted at the beginning of the next paragraph in the document, after
+% the environment.
+%
+\def\nonfillfinish{\afterenvbreak\endgroup}
+
+% @lisp: indented, narrowed, typewriter font.
+\def\lisp{\begingroup
+  \nonfillstart
+  \let\Elisp = \nonfillfinish
+  \tt
+  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
+  \gobble       % eat return
+}
+
+% @example: Same as @lisp.
+\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
+
+% @small... is usually equivalent to the non-small (@smallbook
+% redefines).  We must call \example (or whatever) last in the
+% definition, since it reads the return following the @example (or
+% whatever) command.
+% 
+% This actually allows (for example) @end display inside an
+% @smalldisplay.  Too bad, but makeinfo will catch the error anyway.
+%
+\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
+\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
+\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
+\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
+
+% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
+% Originally contributed by Pavel@xerox.
+\def\smalllispx{\begingroup
+  \def\Esmalllisp{\nonfillfinish\endgroup}%
+  \def\Esmallexample{\nonfillfinish\endgroup}%
+  \indexfonts
+  \lisp
+}
+
+% @display: same as @lisp except keep current font.
+%
+\def\display{\begingroup
+  \nonfillstart
+  \let\Edisplay = \nonfillfinish
+  \gobble
+}
+
+% @smalldisplay (when @smallbook): @display plus smaller fonts.
+%
+\def\smalldisplayx{\begingroup
+  \def\Esmalldisplay{\nonfillfinish\endgroup}%
+  \indexfonts \rm
+  \display
+}
+
+% @format: same as @display except don't narrow margins.
+%
+\def\format{\begingroup
+  \let\nonarrowing = t
+  \nonfillstart
+  \let\Eformat = \nonfillfinish
+  \gobble
+}
+
+% @smallformat (when @smallbook): @format plus smaller fonts.
+%
+\def\smallformatx{\begingroup
+  \def\Esmallformat{\nonfillfinish\endgroup}%
+  \indexfonts \rm
+  \format
+}
+
+% @flushleft (same as @format).
+%
+\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
+
+% @flushright.
+% 
+\def\flushright{\begingroup
+  \let\nonarrowing = t
+  \nonfillstart
+  \let\Eflushright = \nonfillfinish
+  \advance\leftskip by 0pt plus 1fill
+  \gobble
+}
+
+% @quotation does normal linebreaking (hence we can't use \nonfillstart)
+% and narrows the margins.
+%
+\def\quotation{%
+  \begingroup\inENV %This group ends at the end of the @quotation body
+  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
+  \singlespace
+  \parindent=0pt
+  % We have retained a nonzero parskip for the environment, since we're
+  % doing normal filling. So to avoid extra space below the environment...
+  \def\Equotation{\parskip = 0pt \nonfillfinish}%
+  %
+  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+  \ifx\nonarrowing\relax
+    \advance\leftskip by \lispnarrowing
+    \advance\rightskip by \lispnarrowing
+    \exdentamount = \lispnarrowing
+    \let\nonarrowing = \relax
+  \fi
+}
+
+
+\message{defuns,}
+% Define formatter for defuns
+% First, allow user to change definition object font (\df) internally
+\def\setdeffont #1 {\csname DEF#1\endcsname}
+
+\newskip\defbodyindent \defbodyindent=.4in
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deftypemargin \deftypemargin=12pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+
+\newcount\parencount
+% define \functionparens, which makes ( and ) and & do special things.
+% \functionparens affects the group it is contained in.
+\def\activeparens{%
+\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
+\catcode`\[=\active \catcode`\]=\active}
+
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
+
+{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
+
+% Be sure that we always have a definition for `(', etc.  For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+\global\let(=\lparen \global\let)=\rparen
+\global\let[=\lbrack \global\let]=\rbrack
+
+\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
+\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+% This is used to turn on special parens
+% but make & act ordinary (given that it's active).
+\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
+
+% Definitions of (, ) and & used in args for functions.
+% This is the definition of ( outside of all parentheses.
+\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
+  \global\advance\parencount by 1
+}
+%
+% This is the definition of ( when already inside a level of parens.
+\gdef\opnested{\char`\(\global\advance\parencount by 1 }
+%
+\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
+  % also in that case restore the outer-level definition of (.
+  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
+  \global\advance \parencount by -1 }
+% If we encounter &foo, then turn on ()-hacking afterwards
+\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
+%
+\gdef\normalparens{\boldbrax\let&=\ampnr}
+} % End of definition inside \activeparens
+%% These parens (in \boldbrax) actually are a little bolder than the
+%% contained text.  This is especially needed for [ and ]
+\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
+\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
+\def\ampnr{\&}
+\def\lbrb{{\bf\char`\[}}
+\def\rbrb{{\bf\char`\]}}
+
+% First, defname, which formats the header line itself.
+% #1 should be the function name.
+% #2 should be the type of definition, such as "Function".
+
+\def\defname #1#2{%
+% Get the values of \leftskip and \rightskip as they were
+% outside the @def...
+\dimen2=\leftskip
+\advance\dimen2 by -\defbodyindent
+\noindent
+\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
+\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
+\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
+\parshape 2 0in \dimen0 \defargsindent \dimen1
+% Now output arg 2 ("Function" or some such)
+% ending at \deftypemargin from the right margin,
+% but stuck inside a box of width 0 so it does not interfere with linebreaking
+{% Adjust \hsize to exclude the ambient margins,
+% so that \rightline will obey them.
+\advance \hsize by -\dimen2
+\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
+% Make all lines underfull and no complaints:
+\tolerance=10000 \hbadness=10000
+\advance\leftskip by -\defbodyindent
+\exdentamount=\defbodyindent
+{\df #1}\enskip        % Generate function name
+}
+
+% Actually process the body of a definition
+% #1 should be the terminating control sequence, such as \Edefun.
+% #2 should be the "another name" control sequence, such as \defunx.
+% #3 should be the control sequence that actually processes the header,
+%    such as \defunheader.
+
+\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup %
+\catcode 61=\active % 61 is `='
+\obeylines\activeparens\spacesplit#3}
+
+% #1 is the \E... control sequence to end the definition (which we define).
+% #2 is the \...x control sequence for consecutive fns (which we define).
+% #3 is the control sequence to call to resume processing.
+% #4, delimited by the space, is the class name.
+% 
+\def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
+
+% @deftypemethod has an extra argument that nothing else does.  Sigh.
+% #1 is the \E... control sequence to end the definition (which we define).
+% #2 is the \...x control sequence for consecutive fns (which we define).
+% #3 is the control sequence to call to resume processing.
+% #4, delimited by the space, is the class name.
+% #5 is the method's return type.
+% 
+\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
+
+\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 ##2 {\def#4{##1}%
+\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
+
+% These parsing functions are similar to the preceding ones
+% except that they do not make parens into active characters.
+% These are used for "variables" since they have no arguments.
+
+\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2{\begingroup\obeylines\spacesplit#3}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup %
+\catcode 61=\active %
+\obeylines\spacesplit#3}
+
+% This is used for \def{tp,vr}parsebody.  It could probably be used for
+% some of the others, too, with some judicious conditionals.
+%
+\def\parsebodycommon#1#2#3{%
+  \begingroup\inENV %
+  \medbreak %
+  % Define the end token that this defining construct specifies
+  % so that it will exit this group.
+  \def#1{\endgraf\endgroup\medbreak}%
+  \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
+  \parindent=0in
+  \advance\leftskip by \defbodyindent
+  \exdentamount=\defbodyindent
+  \begingroup\obeylines
+}
+
+\def\defvrparsebody#1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \spacesplit{#3{#4}}%
+}
+
+% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
+% type is just `struct', because we lose the braces in `{struct
+% termios}' when \spacesplit reads its undelimited argument.  Sigh.
+% \let\deftpparsebody=\defvrparsebody
+%
+% So, to get around this, we put \empty in with the type name.  That
+% way, TeX won't find exactly `{...}' as an undelimited argument, and
+% won't strip off the braces.
+%
+\def\deftpparsebody #1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
+}
+
+% Fine, but then we have to eventually remove the \empty *and* the
+% braces (if any).  That's what this does.
+%
+\def\removeemptybraces\empty#1\relax{#1}
+
+% After \spacesplit has done its work, this is called -- #1 is the final
+% thing to call, #2 the type name (which starts with \empty), and #3
+% (which might be empty) the arguments.
+%
+\def\parsetpheaderline#1#2#3{%
+  #1{\removeemptybraces#2\relax}{#3}%
+}%
+
+\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 ##2 {\def#4{##1}%
+\begingroup\obeylines\spacesplit{#3{##2}}}%
+\parindent=0in
+\advance\leftskip by \defbodyindent
+\exdentamount=\defbodyindent
+\begingroup\obeylines\spacesplit{#3{#5}}}
+
+% Split up #2 at the first space token.
+% call #1 with two arguments:
+%  the first is all of #2 before the space token,
+%  the second is all of #2 after that space token.
+% If #2 contains no space token, all of it is passed as the first arg
+% and the second is passed as empty.
+
+{\obeylines
+\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
+\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
+\ifx\relax #3%
+#1{#2}{}\else #1{#2}{#3#4}\fi}}
+
+% So much for the things common to all kinds of definitions.
+
+% Define @defun.
+
+% First, define the processing that is wanted for arguments of \defun
+% Use this to expand the args and terminate the paragraph they make up
+
+\def\defunargs #1{\functionparens \sl
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+\hyphenchar\tensl=0
+#1%
+\hyphenchar\tensl=45
+\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\nobreak\vskip -\parskip\nobreak
+}
+
+\def\deftypefunargs #1{%
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+% Use \boldbraxnoamp, not \functionparens, so that & is not special.
+\boldbraxnoamp
+\tclose{#1}% avoid \code because of side effects on active chars
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\nobreak\vskip -\parskip\nobreak
+}
+
+% Do complete processing of one @defun or @defunx line already parsed.
+
+% @deffn Command forward-char nchars
+
+\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+
+\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defun == @deffn Function
+
+\def\defun{\defparsebody\Edefun\defunx\defunheader}
+
+\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Function}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefun int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
+
+% #1 is the data type.  #2 is the name and args.
+\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
+% #1 is the data type, #2 the name, #3 the args.
+\def\deftypefunheaderx #1#2 #3\relax{%
+\doind {fn}{\code{#2}}% Make entry in function index
+\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
+\deftypefunargs {#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
+
+% \defheaderxcond#1\relax$$$
+% puts #1 in @code, followed by a space, but does nothing if #1 is null.
+\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
+
+% #1 is the classification.  #2 is the data type.  #3 is the name and args.
+\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
+% #1 is the classification, #2 the data type, #3 the name, #4 the args.
+\def\deftypefnheaderx #1#2#3 #4\relax{%
+\doind {fn}{\code{#3}}% Make entry in function index
+\begingroup
+\normalparens % notably, turn off `&' magic, which prevents
+%               at least some C++ text from working
+\defname {\defheaderxcond#2\relax$$$#3}{#1}%
+\deftypefunargs {#4}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defmac == @deffn Macro
+
+\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
+
+\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Macro}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defspec == @deffn Special Form
+
+\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+
+\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Special Form}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% This definition is run if you use @defunx
+% anywhere other than immediately after a @defun or @defunx.
+
+\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
+\def\defunx #1 {\errmessage{@defunx in invalid context}}
+\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
+\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
+\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
+\def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
+\def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}}
+
+% @defmethod, and so on
+
+% @defop CATEGORY CLASS OPERATION ARG...
+
+\def\defop #1 {\def\defoptype{#1}%
+\defopparsebody\Edefop\defopx\defopheader\defoptype}
+
+\def\defopheader #1#2#3{%
+\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
+\begingroup\defname {#2}{\defoptype{} on #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @deftypemethod CLASS RETURN-TYPE METHOD ARG...
+%
+\def\deftypemethod{%
+  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
+%
+% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
+\def\deftypemethodheader#1#2#3#4{%
+  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
+  \begingroup
+    \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
+    \deftypefunargs{#4}%
+  \endgroup
+}
+
+% @defmethod == @defop Method
+%
+\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
+%
+% #1 is the class name, #2 the method name, #3 the args.
+\def\defmethodheader#1#2#3{%
+  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
+  \begingroup
+    \defname{#2}{\putwordMethodon\ \code{#1}}%
+    \defunargs{#3}%
+  \endgroup
+}
+
+% @defcv {Class Option} foo-class foo-flag
+
+\def\defcv #1 {\def\defcvtype{#1}%
+\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
+
+\def\defcvarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{\defcvtype{} of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% @defivar == @defcv {Instance Variable}
+
+\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
+
+\def\defivarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{Instance Variable of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% These definitions are run if you use @defmethodx, etc.,
+% anywhere other than immediately after a @defmethod, etc.
+
+\def\defopx #1 {\errmessage{@defopx in invalid context}}
+\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
+\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
+\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
+
+% Now @defvar
+
+% First, define the processing that is wanted for arguments of @defvar.
+% This is actually simple: just print them in roman.
+% This must expand the args and terminate the paragraph they make up
+\def\defvarargs #1{\normalparens #1%
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak}
+
+% @defvr Counter foo-count
+
+\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
+
+\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
+
+% @defvar == @defvr Variable
+
+\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
+
+\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{Variable}%
+\defvarargs {#2}\endgroup %
+}
+
+% @defopt == @defvr {User Option}
+
+\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
+
+\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{User Option}%
+\defvarargs {#2}\endgroup %
+}
+
+% @deftypevar int foobar
+
+\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
+
+% #1 is the data type.  #2 is the name, perhaps followed by text that
+% is actually part of the data type, which should not be put into the index.
+\def\deftypevarheader #1#2{%
+\dovarind#2 \relax% Make entry in variables index
+\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak
+\endgroup}
+\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
+
+% @deftypevr {Global Flag} int enable
+
+\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
+
+\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
+\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak
+\endgroup}
+
+% This definition is run if you use @defvarx
+% anywhere other than immediately after a @defvar or @defvarx.
+
+\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
+\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
+\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
+\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
+\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
+
+% Now define @deftp
+% Args are printed in bold, a slight difference from @defvar.
+
+\def\deftpargs #1{\bf \defvarargs{#1}}
+
+% @deftp Class window height width ...
+
+\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
+
+\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
+\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
+
+% This definition is run if you use @deftpx, etc
+% anywhere other than immediately after a @deftp, etc.
+
+\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
+
+
+\message{macros,}
+% @macro.
+
+% To do this right we need a feature of e-TeX, \scantokens, 
+% which we arrange to emulate with a temporary file in ordinary TeX.
+\ifx\eTeXversion\undefined
+ \newwrite\macscribble
+ \def\scanmacro#1{%
+   \begingroup \newlinechar`\^^M
+   \immediate\openout\macscribble=\jobname.tmp
+   \immediate\write\macscribble{#1}%
+   \immediate\closeout\macscribble
+   \let\xeatspaces\eatspaces
+   \input \jobname.tmp
+   \endgroup
+}
+\else
+\def\scanmacro#1{%
+\begingroup \newlinechar`\^^M
+\let\xeatspaces\eatspaces\scantokens{#1}\endgroup}
+\fi
+
+\newcount\paramno   % Count of parameters
+\newtoks\macname    % Macro name
+\newif\ifrecursive  % Is it recursive?
+
+% Utility routines.
+% Thisdoes \let #1 = #2, except with \csnames.
+\def\cslet#1#2{%
+\expandafter\expandafter
+\expandafter\let
+\expandafter\expandafter
+\csname#1\endcsname
+\csname#2\endcsname}
+
+% Trim leading and trailing spaces off a string.
+% Concepts from aro-bend problem 15 (see CTAN).
+{\catcode`\@=11
+\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
+\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
+\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
+\def\unbrace#1{#1}
+\unbrace{\gdef\trim@@@ #1 } #2@{#1}
+}
+
+% Trim a single trailing ^^M off a string.
+{\catcode`\^^M=12\catcode`\Q=3%
+\gdef\eatcr #1{\eatcra #1Q^^MQ}%
+\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
+\gdef\eatcrb#1Q#2Q{#1}%
+}
+
+% Macro bodies are absorbed as an argument in a context where
+% all characters are catcode 10, 11 or 12, except \ which is active
+% (as in normal texinfo). It is necessary to change the definition of \.
+
+% It's necessary to have hard CRs when the macro is executed. This is 
+% done by  making ^^M (\endlinechar) catcode 12 when reading the macro 
+% body, and then making it the \newlinechar in \scanmacro.
+
+\def\macrobodyctxt{%
+  \catcode`\~=12
+  \catcode`\^=12
+  \catcode`\_=12
+  \catcode`\|=12
+  \catcode`\<=12
+  \catcode`\>=12
+  \catcode`\+=12
+  \catcode`\{=12
+  \catcode`\}=12
+  \catcode`\@=12
+  \catcode`\^^M=12
+  \usembodybackslash}
+
+% \mbodybackslash is the definition of \ in @macro bodies.
+% It maps \foo\ => \csname macarg.foo\endcsname => #N 
+% where N is the macro parameter number.
+% We define \csname macarg.\endcsname to be \realbackslash, so
+% \\ in macro replacement text gets you a backslash.
+
+{\catcode`@=0 @catcode`@\=@active
+ @gdef@usembodybackslash{@let\=@mbodybackslash}
+ @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
+}
+\expandafter\def\csname macarg.\endcsname{\realbackslash}
+
+\def\macro{\recursivefalse\parsearg\macroxxx}
+\def\rmacro{\recursivetrue\parsearg\macroxxx}
+
+\def\macroxxx#1{%
+  \getargs{#1}%           now \macname is the macname and \argl the arglist
+  \ifx\argl\empty       % no arguments
+     \paramno=0%
+  \else
+     \expandafter\parsemargdef \argl;% 
+  \fi
+  \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
+     \cslet{macsave.\the\macname}{\the\macname}%
+  \else
+     \message{Warning: redefining \the\macname}%
+  \fi
+  \begingroup \macrobodyctxt
+  \ifrecursive \expandafter\parsermacbody
+  \else \expandafter\parsemacbody 
+  \fi}
+
+\def\unmacro{\parsearg\unmacroxxx}
+\def\unmacroxxx#1{%
+  \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
+    \errmessage{Macro \the\macname\ not defined.}%
+  \else
+    \cslet{#1}{macsave.#1}%
+    \expandafter\let \csname macsave.\the\macname\endcsname \undefined
+  \fi
+}
+
+% This makes use of the obscure feature that if the last token of a
+% <parameter list> is #, then the preceding argument is delimited by
+% an opening brace, and that opening brace is not consumed.
+\def\getargs#1{\getargsxxx#1{}}
+\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
+\def\getmacname #1 #2\relax{\macname={#1}}
+\def\getmacargs#1{\def\argl{#1}}
+
+% Parse the optional {params} list.  Set up \paramno and \paramlist
+% so \defmacro knows what to do.  Define \macarg.blah for each blah
+% in the params list, to be ##N where N is the position in that list.
+% That gets used by \mbodybackslash (above).
+
+% We need to get `macro parameter char #' into several definitions.
+% The technique used is stolen from LaTeX:  let \hash be something
+% unexpandable, insert that wherever you need a #, and then redefine
+% it to # just before using the token list produced.
+%
+% The same technique is used to protect \eatspaces till just before
+% the macro is used.
+
+\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
+        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
+\def\parsemargdefxxx#1,{%
+  \if#1;\let\next=\relax
+  \else \let\next=\parsemargdefxxx
+    \advance\paramno by 1%
+    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
+        {\xeatspaces{\hash\the\paramno}}%
+    \edef\paramlist{\paramlist\hash\the\paramno,}%
+  \fi\next}
+
+% These two commands read recursive and nonrecursive macro bodies.
+% (They're different since rec and nonrec macros end differently.)
+
+\long\def\parsemacbody#1@end macro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\long\def\parsermacbody#1@end rmacro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+
+% This defines the macro itself. There are six cases: recursive and
+% nonrecursive macros of zero, one, and many arguments.
+% Much magic with \expandafter here.
+% \xdef is used so that macro definitions will survive the file
+% they're defined in; @include reads the file inside a group.
+\def\defmacro{%
+  \let\hash=##% convert placeholders to macro parameter chars
+  \ifrecursive
+    \ifcase\paramno
+    % 0
+      \expandafter\xdef\csname\the\macname\endcsname{%
+        \noexpand\scanmacro{\temp}}%
+    \or % 1
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \noexpand\braceorline\csname\the\macname xxx\endcsname}%
+      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+         \noexpand\scanmacro{\temp}}%
+    \else % many
+      \expandafter\xdef\csname\the\macname\endcsname##1{%
+          \csname\the\macname xxx\endcsname ##1,}%
+      \expandafter\expandafter
+      \expandafter\xdef
+      \expandafter\expandafter
+        \csname\the\macname xxx\endcsname 
+          \paramlist{\noexpand\scanmacro{\temp}}%
+    \fi
+  \else
+    \ifcase\paramno
+    % 0
+      \expandafter\xdef\csname\the\macname\endcsname{%
+        \noexpand\norecurse{\the\macname}%
+        \noexpand\scanmacro{\temp}\egroup}%
+    \or % 1
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \noexpand\braceorline\csname\the\macname xxx\endcsname}%
+      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+        \noexpand\norecurse{\the\macname}%
+        \noexpand\scanmacro{\temp}\egroup}%
+    \else % many
+      \expandafter\xdef\csname\the\macname\endcsname##1{%
+          \csname\the\macname xxx\endcsname ##1,}%
+      \expandafter\expandafter
+      \expandafter\xdef
+      \expandafter\expandafter
+      \csname\the\macname xxx\endcsname
+      \paramlist{%
+          \noexpand\norecurse{\the\macname}%
+          \noexpand\scanmacro{\temp}\egroup}%
+    \fi
+  \fi}
+
+\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
+
+% \braceorline decides whether the next nonwhitespace character is a
+% {.  If so it reads up to the closing }, if not, it reads the whole
+% line.  Whatever was read is then fed to the next control sequence
+% as an argument (by \parsebrace or \parsearg)
+\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
+\def\braceorlinexxx{%
+  \ifx\nchar\bgroup\else
+    \expandafter\parsearg 
+  \fi \next}
+
+
+\message{cross references,}
+\newwrite\auxfile
+
+\newif\ifhavexrefs    % True if xref values are known.
+\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
+
+% @inforef is relatively simple.
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
+  node \samp{\ignorespaces#1{}}}
+
+% @node's job is to define \lastnode.
+\def\node{\ENVcheck\parsearg\nodezzz}
+\def\nodezzz#1{\nodexxx [#1,]}
+\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
+\let\nwnode=\node
+\let\lastnode=\relax
+
+% The sectioning commands (@chapter, etc.) call these.
+\def\donoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}%
+      {Ysectionnumberandtype}%
+    \global\let\lastnode=\relax
+  \fi
+}
+\def\unnumbnoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
+    \global\let\lastnode=\relax
+  \fi
+}
+\def\appendixnoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}%
+      {Yappendixletterandtype}%
+    \global\let\lastnode=\relax
+  \fi
+}
+
+
+% @anchor{NAME} -- define xref target at arbitrary point.
+% 
+\def\anchor#1{\setref{#1}{Ynothing}}
+
+
+% \setref{NAME}{SNT} defines a cross-reference point NAME, namely
+% NAME-title, NAME-pg, and NAME-SNT.  Called from \foonoderef.  We have
+% to set \indexdummies so commands such as @code in a section title
+% aren't expanded.  It would be nicer not to expand the titles in the
+% first place, but there's so many layers that that is hard to do.
+% 
+\def\setref#1#2{{%
+  \indexdummies
+  \dosetq{#1-title}{Ytitle}%
+  \dosetq{#1-pg}{Ypagenumber}%
+  \dosetq{#1-snt}{#2}
+}}
+
+% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
+% the node name, #2 the name of the Info cross-reference, #3 the printed
+% node name, #4 the name of the Info file, #5 the name of the printed
+% manual.  All but the node name can be omitted.
+%
+\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
+\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
+\def\ref#1{\xrefX[#1,,,,,,,]}
+\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
+  \def\printedmanual{\ignorespaces #5}%
+  \def\printednodename{\ignorespaces #3}%
+  \setbox1=\hbox{\printedmanual}%
+  \setbox0=\hbox{\printednodename}%
+  \ifdim \wd0 = 0pt
+    % No printed node name was explicitly given.
+    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
+      % Use the node name inside the square brackets.
+      \def\printednodename{\ignorespaces #1}%
+    \else
+      % Use the actual chapter/section title appear inside
+      % the square brackets.  Use the real section title if we have it.
+      \ifdim \wd1 > 0pt
+        % It is in another manual, so we don't have it.
+        \def\printednodename{\ignorespaces #1}%
+      \else
+        \ifhavexrefs
+          % We know the real title if we have the xref values.
+          \def\printednodename{\refx{#1-title}{}}%
+        \else
+          % Otherwise just copy the Info node name.
+          \def\printednodename{\ignorespaces #1}%
+        \fi%
+      \fi
+    \fi
+  \fi
+  %
+  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
+  % insert empty discretionaries after hyphens, which means that it will
+  % not find a line break at a hyphen in a node names.  Since some manuals
+  % are best written with fairly long node names, containing hyphens, this
+  % is a loss.  Therefore, we give the text of the node name again, so it
+  % is as if TeX is seeing it for the first time.
+  \ifdim \wd1 > 0pt
+    \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
+  \else
+    % _ (for example) has to be the character _ for the purposes of the
+    % control sequence corresponding to the node, but it has to expand
+    % into the usual \leavevmode...\vrule stuff for purposes of
+    % printing. So we \turnoffactive for the \refx-snt, back on for the
+    % printing, back off for the \refx-pg.
+    {\normalturnoffactive
+     % Only output a following space if the -snt ref is nonempty; for
+     % @unnumbered and @anchor, it won't be.
+     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+    }%
+    % [mynode], 
+    [\printednodename],\space
+    % page 3
+    \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+  \fi
+\endgroup}
+
+% \dosetq is the interface for calls from other macros
+
+% Use \normalturnoffactive so that punctuation chars such as underscore
+% and backslash work in node names.  (\turnoffactive doesn't do \.)
+\def\dosetq#1#2{%
+  {\let\folio=0
+   \normalturnoffactive
+   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
+   \iflinks
+     \next
+   \fi
+  }%
+}
+
+% \internalsetq {foo}{page} expands into
+% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
+% When the aux file is read, ' is the escape character
+
+\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
+
+% Things to be expanded by \internalsetq
+
+\def\Ypagenumber{\folio}
+
+\def\Ytitle{\thissection}
+
+\def\Ynothing{}
+
+\def\Ysectionnumberandtype{%
+\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
+\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
+\else %
+\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\def\Yappendixletterandtype{%
+\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
+\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
+\else %
+\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\gdef\xreftie{'tie}
+
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+  \let\linenumber = \empty % Non-3.0.
+\else
+  \def\linenumber{\the\inputlineno:\space}
+\fi
+
+% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
+% If its value is nonempty, SUFFIX is output afterward.
+
+\def\refx#1#2{%
+  \expandafter\ifx\csname X#1\endcsname\relax
+    % If not defined, say something at least.
+    \angleleft un\-de\-fined\angleright
+    \iflinks
+      \ifhavexrefs
+        \message{\linenumber Undefined cross reference `#1'.}%
+      \else
+        \ifwarnedxrefs\else
+          \global\warnedxrefstrue
+          \message{Cross reference values unknown; you must run TeX again.}%
+        \fi
+      \fi
+    \fi
+  \else
+    % It's defined, so just use it.
+    \csname X#1\endcsname
+  \fi
+  #2% Output the suffix in any case.
+}
+
+% This is the macro invoked by entries in the aux file.
+% 
+\def\xrdef#1{\begingroup
+  % Reenable \ as an escape while reading the second argument.
+  \catcode`\\ = 0
+  \afterassignment\endgroup
+  \expandafter\gdef\csname X#1\endcsname
+}
+
+% Read the last existing aux file, if any.  No error if none exists.
+\def\readauxfile{\begingroup
+  \catcode`\^^@=\other
+  \catcode`\^^A=\other
+  \catcode`\^^B=\other
+  \catcode`\^^C=\other
+  \catcode`\^^D=\other
+  \catcode`\^^E=\other
+  \catcode`\^^F=\other
+  \catcode`\^^G=\other
+  \catcode`\^^H=\other
+  \catcode`\^^K=\other
+  \catcode`\^^L=\other
+  \catcode`\^^N=\other
+  \catcode`\^^P=\other
+  \catcode`\^^Q=\other
+  \catcode`\^^R=\other
+  \catcode`\^^S=\other
+  \catcode`\^^T=\other
+  \catcode`\^^U=\other
+  \catcode`\^^V=\other
+  \catcode`\^^W=\other
+  \catcode`\^^X=\other
+  \catcode`\^^Z=\other
+  \catcode`\^^[=\other
+  \catcode`\^^\=\other
+  \catcode`\^^]=\other
+  \catcode`\^^^=\other
+  \catcode`\^^_=\other
+  \catcode`\@=\other
+  \catcode`\^=\other
+  % It was suggested to define this as 7, which would allow ^^e4 etc.
+  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
+  % supported in the main text, it doesn't seem desirable.  Furthermore,
+  % that is not enough: for node names that actually contain a ^
+  % character, we would end up writing a line like this: 'xrdef {'hat
+  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
+  % argument, and \hat is not an expandable control sequence.  It could
+  % all be worked out, but why?  Either we support ^^ or we don't.
+  %
+  % The other change necessary for this was to define \auxhat:
+  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
+  % and then to call \auxhat in \setq.
+  %
+  \catcode`\~=\other
+  \catcode`\[=\other
+  \catcode`\]=\other
+  \catcode`\"=\other
+  \catcode`\_=\other
+  \catcode`\|=\other
+  \catcode`\<=\other
+  \catcode`\>=\other
+  \catcode`\$=\other
+  \catcode`\#=\other
+  \catcode`\&=\other
+  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
+  % Make the characters 128-255 be printing characters
+  {%
+    \count 1=128
+    \def\loop{%
+      \catcode\count 1=\other
+      \advance\count 1 by 1
+      \ifnum \count 1<256 \loop \fi
+    }%
+  }%
+  % The aux file uses ' as the escape (for now).
+  % Turn off \ as an escape so we do not lose on
+  % entries which were dumped with control sequences in their names.
+  % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
+  % Reference to such entries still does not work the way one would wish,
+  % but at least they do not bomb out when the aux file is read in.
+  \catcode`\{=1
+  \catcode`\}=2
+  \catcode`\%=\other
+  \catcode`\'=0
+  \catcode`\\=\other
+  %
+  \openin 1 \jobname.aux
+  \ifeof 1 \else
+    \closein 1
+    \input \jobname.aux
+    \global\havexrefstrue
+    \global\warnedobstrue
+  \fi
+  % Open the new aux file.  TeX will close it automatically at exit.
+  \openout\auxfile=\jobname.aux
+\endgroup}
+
+
+% Footnotes.
+
+\newcount \footnoteno
+
+% The trailing space in the following definition for supereject is
+% vital for proper filling; pages come out unaligned when you do a
+% pagealignmacro call if that space before the closing brace is
+% removed. (Generally, numeric constants should always be followed by a
+% space to prevent strange expansion errors.)
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+% @footnotestyle is meaningful for info output only.
+\let\footnotestyle=\comment
+
+\let\ptexfootnote=\footnote
+
+{\catcode `\@=11
+%
+% Auto-number footnotes.  Otherwise like plain.
+\gdef\footnote{%
+  \global\advance\footnoteno by \@ne
+  \edef\thisfootno{$^{\the\footnoteno}$}%
+  %
+  % In case the footnote comes at the end of a sentence, preserve the
+  % extra spacing after we do the footnote number.
+  \let\@sf\empty
+  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+  %
+  % Remove inadvertent blank space before typesetting the footnote number.
+  \unskip
+  \thisfootno\@sf
+  \footnotezzz
+}%
+
+% Don't bother with the trickery in plain.tex to not require the
+% footnote text as a parameter.  Our footnotes don't need to be so general.
+%
+% Oh yes, they do; otherwise, @ifset and anything else that uses
+% \parseargline fail inside footnotes because the tokens are fixed when
+% the footnote is read.  --karl, 16nov96.
+%
+\long\gdef\footnotezzz{\insert\footins\bgroup
+  % We want to typeset this text as a normal paragraph, even if the
+  % footnote reference occurs in (for example) a display environment.
+  % So reset some parameters.
+  \interlinepenalty\interfootnotelinepenalty
+  \splittopskip\ht\strutbox % top baseline for broken footnotes
+  \splitmaxdepth\dp\strutbox
+  \floatingpenalty\@MM
+  \leftskip\z@skip
+  \rightskip\z@skip
+  \spaceskip\z@skip
+  \xspaceskip\z@skip
+  \parindent\defaultparindent
+  %
+  % Hang the footnote text off the number.
+  \hang
+  \textindent{\thisfootno}%
+  %
+  % Don't crash into the line above the footnote text.  Since this
+  % expands into a box, it must come within the paragraph, lest it
+  % provide a place where TeX can split the footnote.
+  \footstrut
+  \futurelet\next\fo@t
+}
+\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
+  \else\let\next\f@t\fi \next}
+\def\f@@t{\bgroup\aftergroup\@foot\let\next}
+\def\f@t#1{#1\@foot}
+\def\@foot{\strut\egroup}
+
+}%end \catcode `\@=11
+
+% Set the baselineskip to #1, and the lineskip and strut size
+% correspondingly.  There is no deep meaning behind these magic numbers
+% used as factors; they just match (closely enough) what Knuth defined.
+%
+\def\lineskipfactor{.08333}
+\def\strutheightpercent{.70833}
+\def\strutdepthpercent {.29167}
+%
+\def\setleading#1{%
+  \normalbaselineskip = #1\relax
+  \normallineskip = \lineskipfactor\normalbaselineskip
+  \normalbaselines
+  \setbox\strutbox =\hbox{%
+    \vrule width0pt height\strutheightpercent\baselineskip
+                    depth \strutdepthpercent \baselineskip
+  }%
+}
+
+% @| inserts a changebar to the left of the current line.  It should
+% surround any changed text.  This approach does *not* work if the
+% change spans more than two lines of output.  To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).
+%
+\def\|{%
+  % \vadjust can only be used in horizontal mode.
+  \leavevmode
+  %
+  % Append this vertical mode material after the current line in the output.
+  \vadjust{%
+    % We want to insert a rule with the height and depth of the current
+    % leading; that is exactly what \strutbox is supposed to record.
+    \vskip-\baselineskip
+    %
+    % \vadjust-items are inserted at the left edge of the type.  So
+    % the \llap here moves out into the left-hand margin.
+    \llap{%
+      %
+      % For a thicker or thinner bar, change the `1pt'.
+      \vrule height\baselineskip width1pt
+      %
+      % This is the space between the bar and the text.
+      \hskip 12pt
+    }%
+  }%
+}
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt}
+
+% @image.  We use the macros from epsf.tex to support this.
+% If epsf.tex is not installed and @image is used, we complain.
+% 
+% Check for and read epsf.tex up front.  If we read it only at @image
+% time, we might be inside a group, and then its definitions would get
+% undone and the next image would fail.
+\openin 1 = epsf.tex
+\ifeof 1 \else
+  \closein 1
+  % Do not bother showing banner with post-v2.7 epsf.tex (available in
+  % doc/epsf.tex until it shows up on ctan).
+  \def\epsfannounce{\toks0 = }%
+  \input epsf.tex
+\fi
+%
+\newif\ifwarnednoepsf
+\newhelp\noepsfhelp{epsf.tex must be installed for images to
+  work.  It is also included in the Texinfo distribution, or you can get
+  it from ftp://ftp.tug.org/tex/epsf.tex.}
+%
+% Only complain once about lack of epsf.tex.
+\def\image#1{%
+  \ifx\epsfbox\undefined
+    \ifwarnednoepsf \else
+      \errhelp = \noepsfhelp
+      \errmessage{epsf.tex not found, images will be ignored}%
+      \global\warnednoepsftrue
+    \fi
+  \else
+    \imagexxx #1,,,\finish
+  \fi
+}
+%
+% Arguments to @image:
+% #1 is (mandatory) image filename; we tack on .eps extension.
+% #2 is (optional) width, #3 is (optional) height.
+% #4 is just the usual extra ignored arg for parsing this stuff.
+\def\imagexxx#1,#2,#3,#4\finish{%
+  % \epsfbox itself resets \epsf?size at each figure.
+  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+  \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+  % If the image is by itself, center it.
+  \ifvmode
+    \nobreak\medskip
+    \nobreak
+    \centerline{\epsfbox{#1.eps}}%
+    \bigbreak
+  \else
+    \epsfbox{#1.eps}%
+  \fi
+}
+
+
+\message{paper sizes,}
+% And other related parameters.
+
+\newdimen\defaultparindent \defaultparindent = 15pt
+
+\chapheadingskip = 15pt plus 4pt minus 2pt
+\secheadingskip = 12pt plus 3pt minus 2pt
+\subsecheadingskip = 9pt plus 2pt minus 2pt
+
+% Prevent underfull vbox error messages.
+\vbadness = 10000
+
+% Don't be so finicky about underfull hboxes, either.
+\hbadness = 2000
+
+% Following George Bush, just get rid of widows and orphans.
+\widowpenalty=10000
+\clubpenalty=10000
+
+% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
+% using an old version of TeX, don't do anything.  We want the amount of
+% stretch added to depend on the line length, hence the dependence on
+% \hsize.  This makes it come to about 9pt for the 8.5x11 format.  We
+% call this whenever the paper size is set.
+%
+\def\setemergencystretch{%
+  \ifx\emergencystretch\thisisundefined
+    % Allow us to assign to \emergencystretch anyway.
+    \def\emergencystretch{\dimen0}%
+  \else
+    \emergencystretch = \hsize
+    \divide\emergencystretch by 45
+  \fi
+}
+
+% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
+% 4) hoffset; 5) binding offset; 6) topskip.  Then whoever calls us can
+% set \parskip and call \setleading for \baselineskip.
+%
+\def\internalpagesizes#1#2#3#4#5#6{%
+  \voffset = #3\relax
+  \topskip = #6\relax
+  \splittopskip = \topskip
+  %
+  \vsize = #1\relax
+  \advance\vsize by \topskip
+  \outervsize = \vsize
+  \advance\outervsize by 0.6in
+  \pageheight = \vsize
+  %
+  \hsize = #2\relax
+  \outerhsize = \hsize
+  \advance\outerhsize by 0.5in
+  \pagewidth = \hsize
+  %
+  \normaloffset = #4\relax
+  \bindingoffset = #5\relax
+  %
+  \parindent = \defaultparindent
+  \setemergencystretch
+}
+
+% @letterpaper (the default).
+\def\letterpaper{{\globaldefs = 1
+  \parskip = 3pt plus 2pt minus 1pt
+  \setleading{13.2pt}%
+  %
+  % If page is nothing but text, make it come out even.
+  \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
+}}
+
+% Use @smallbook to reset parameters for 7x9.5 (or so) format.
+\def\smallbook{{\globaldefs = 1
+  \parskip = 2pt plus 1pt
+  \setleading{12pt}%
+  %
+  \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
+  %
+  \lispnarrowing = 0.3in
+  \tolerance = 700
+  \hfuzz = 1pt
+  \contentsrightmargin = 0pt
+  \deftypemargin = 0pt
+  \defbodyindent = .5cm
+  %
+  \let\smalldisplay = \smalldisplayx
+  \let\smallexample = \smalllispx
+  \let\smallformat = \smallformatx
+  \let\smalllisp = \smalllispx
+}}
+
+% Use @afourpaper to print on European A4 paper.
+\def\afourpaper{{\globaldefs = 1
+  \setleading{12pt}%
+  \parskip = 3pt plus 2pt minus 1pt
+  %
+  \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
+  %
+  \tolerance = 700
+  \hfuzz = 1pt
+}}
+
+% A specific text layout, 24x15cm overall, intended for A4 paper.  Top margin
+% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
+\def\afourlatex{{\globaldefs = 1
+  \setleading{13.6pt}%
+  %
+  \afourpaper
+  \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
+  %
+  \globaldefs = 0
+}}
+
+% Use @afourwide to print on European A4 paper in wide format.
+\def\afourwide{%
+  \afourpaper
+  \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
+  %
+  \globaldefs = 0
+}
+
+% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
+% Perhaps we should allow setting the margins, \topskip, \parskip,
+% and/or leading, also. Or perhaps we should compute them somehow.
+% 
+\def\pagesizes{\parsearg\pagesizesxxx}
+\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
+\def\pagesizesyyy#1,#2,#3\finish{{%
+  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
+  \globaldefs = 1
+  %
+  \parskip = 3pt plus 2pt minus 1pt
+  \setleading{13.2pt}%
+  %
+  \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
+}}
+
+% Set default to letter.
+% 
+\letterpaper
+
+\message{and turning on texinfo input format.}
+
+% Define macros to output various characters with catcode for normal text.
+\catcode`\"=\other
+\catcode`\~=\other
+\catcode`\^=\other
+\catcode`\_=\other
+\catcode`\|=\other
+\catcode`\<=\other
+\catcode`\>=\other
+\catcode`\+=\other
+\def\normaldoublequote{"}
+\def\normaltilde{~}
+\def\normalcaret{^}
+\def\normalunderscore{_}
+\def\normalverticalbar{|}
+\def\normalless{<}
+\def\normalgreater{>}
+\def\normalplus{+}
+
+% This macro is used to make a character print one way in ttfont
+% where it can probably just be output, and another way in other fonts,
+% where something hairier probably needs to be done.
+%
+% #1 is what to print if we are indeed using \tt; #2 is what to print
+% otherwise.  Since all the Computer Modern typewriter fonts have zero
+% interword stretch (and shrink), and it is reasonable to expect all
+% typewriter fonts to have this, we can check that font parameter.
+%
+\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary).
+% Most of these we simply print from the \tt font, but for some, we can
+% use math or other variants that look better in normal text.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt\char34}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt\char126}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+
+\catcode`\_=\active
+\def_{\ifusingtt\normalunderscore\_}
+% Subroutine for the previous macro.
+\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
+
+\catcode`\|=\active
+\def|{{\tt\char124}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+\catcode`\+=\active
+\def+{{\tt \char 43}}
+%\catcode 27=\active
+%\def^^[{$\diamondsuit$}
+
+% Set up an active definition for =, but don't enable it most of the time.
+{\catcode`\==\active
+\global\def={{\tt \char 61}}}
+
+\catcode`+=\active
+\catcode`\_=\active
+
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have \everyjob (or @setfilename) turn them on.
+% \otherifyactive is called near the end of this file.
+\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
+
+\catcode`\@=0
+
+% \rawbackslashxx output one backslash character in current font
+\global\chardef\rawbackslashxx=`\\
+%{\catcode`\\=\other
+%@gdef@rawbackslashxx{\}}
+
+% \rawbackslash redefines \ as input to do \rawbackslashxx.
+{\catcode`\\=\active
+@gdef@rawbackslash{@let\=@rawbackslashxx }}
+
+% \normalbackslash outputs one backslash in fixed width font.
+\def\normalbackslash{{\tt\rawbackslashxx}}
+
+% Say @foo, not \foo, in error messages.
+\escapechar=`\@
+
+% \catcode 17=0   % Define control-q
+\catcode`\\=\active
+
+% Used sometimes to turn off (effectively) the active characters
+% even after parsing them.
+@def@turnoffactive{@let"=@normaldoublequote
+@let\=@realbackslash
+@let~=@normaltilde
+@let^=@normalcaret
+@let_=@normalunderscore
+@let|=@normalverticalbar
+@let<=@normalless
+@let>=@normalgreater
+@let+=@normalplus}
+
+@def@normalturnoffactive{@let"=@normaldoublequote
+@let\=@normalbackslash
+@let~=@normaltilde
+@let^=@normalcaret
+@let_=@normalunderscore
+@let|=@normalverticalbar
+@let<=@normalless
+@let>=@normalgreater
+@let+=@normalplus}
+
+% Make _ and + \other characters, temporarily.
+% This is canceled by @fixbackslash.
+@otherifyactive
+
+% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
+% That is what \eatinput is for; after that, the `\' should revert to printing
+% a backslash.
+%
+@gdef@eatinput input texinfo{@fixbackslash}
+@global@let\ = @eatinput
+
+% On the other hand, perhaps the file did not have a `\input texinfo'. Then
+% the first `\{ in the file would cause an error. This macro tries to fix
+% that, assuming it is called before the first `\' could plausibly occur.
+% Also back turn on active characters that might appear in the input
+% file name, in case not using a pre-dumped format.
+%
+@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
+  @catcode`+=@active @catcode`@_=@active}
+
+% These look ok in all fonts, so just make them not special.  The @rm below
+% makes sure that the current font starts out as the newly loaded cmr10
+@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
+
+@textfonts
+@rm
+
+@c Local variables:
+@c page-delimiter: "^\\\\message"
+@c End: